Home » U++ Library support » U++ MT-multithreading and servers » [Solved]Can't show favicon.ico in Skylark if root path is not Null
[Solved]Can't show favicon.ico in Skylark if root path is not Null [message #36868] |
Sun, 15 July 2012 13:03 |
kasome
Messages: 78 Registered: July 2008 Location: Taiwan
|
Member |
|
|
Hello,
In order to display the favicon.ico (by Firefox, Opera, GoogleChrome browser), I try to modify the example Skylark01 in upp\tutorial, as the following,
#include <Web/Web.h>
#include <Draw/Draw.h>
#include <plugin/png/png.h>
#include <Skylark/Skylark.h>
using namespace Upp;
#define IMAGECLASS ICON
#define IMAGEFILE <UppSkylark.iml>
#include <Draw/iml.h>
#if( defined(flagMSC) && defined(flagDEBUG) )
#define DEBUG_NEW new(_NORMAL_BLOCK, __FILE__, __LINE__)
#define new DEBUG_NEW
#endif
SKYLARK( HomePage, "" ) {
http.ContentType( HttpTextHtml(CHARSET_UTF8) ) << "<html><body>Hello world!</body></html>";
}
SKYLARK( Param, "*/param" ) {
http.ContentType( HttpTextHtml(CHARSET_UTF8) ) << "<html><body>Parameter: " << http[0] << "</html></body>";
}
SKYLARK( Params, "params/**" ) {
http.ContentType( HttpTextHtml(CHARSET_UTF8) );
http << "<html><body>Parameters: ";
for( int i=0; i<http.GetParamCount(); ++i ) {
http << http[i] << " ";
}
http << "</html></body>";
}
SKYLARK( FavIcon, "favicon.ico" ) {
http.ContentType( HttpImage("x-icon") ) << PNGEncoder().SaveString(ICON::Upp());
}
SKYLARK( CatchAll, "**" ) {
http.Redirect(HomePage);
}
class MyApp : public SkylarkApp {
public:
MyApp() {
// root = Null;
// root = "myapp";
#ifdef flagDEBUG
prefork = 0;
use_caching = false;
#endif
}
};
CONSOLE_APP_MAIN {
#ifdef flagMSC
_CrtSetDbgFlag ( _CRTDBG_ALLOC_MEM_DF | _CRTDBG_LEAK_CHECK_DF );
#endif
#ifdef flagDEBUG
Ini::skylark_log = true;
StdLogSetup( LOG_FILE | LOG_COUT );
#endif
MyApp().Run();
}
And it works if the root path is only Null (In MyApp constructor)
when i connect to http://127.0.0.1:8001/ .
But when the root path is not Null, like root = "myapp"; ,
then how could i handle the request for
http://127.0.0.1:8001/favicon.ico ¡H
[Updated on: Tue, 17 July 2012 04:28] Report message to a moderator
|
|
|
|
|
Goto Forum:
Current Time: Fri Sep 20 10:54:35 CEST 2024
Total time taken to generate the page: 0.03560 seconds
|