Re: [Simpleweb-Support] Problem of trying simple
Brought to you by:
niallg
From: Carfield Y. <car...@gm...> - 2005-09-28 19:01:57
|
> Within BasicServive call the handle method with the > status code. So for not found, the following will > work. > > handle(request, response, 404); > > or > > throw new FileNotFoundException(); > What I need is just set the status code so that I can test using HTTP status code, and I've custom error page, if I use handle(req, res, 404), will it call the browser to use default error page? > You should use the simple.http.load.RedirectService > this will allow you to forward or redirect to some > other path or URL. It will forward relative URLs > (e.g /path/index.html) and redirect absolute URLs (e.g > http://domain/path/index.html). > This is an abstract class, how can I get an really instance? and I guess the method I should use is RedirectService.resolve(URI) , right? Besides, is this method thread safe? Or it better that I create new instance for every redirect call? > The Context.getMimeType method will use the file > extension e.g "html" for index.html to convert to a > MIME type. The MIME database is located at > simple/http/serve/Mime.properties. You can override > with mime.xml. > I think the default one should work... > > 4) Any example of how http request work? E.g. how to > > handle multipart request? > > Download the simple-upload-0.1.tar.gz package. > > I would recommend that you download the > simple-demo-1.2.tar.gz package to learn how > configuration files are used. Also, there are plenty > of examples. > Seen it work good However, how can I set the default class for TemplateEngine? Can I do similar thing like LoaderEngine engine =3D new LoaderEngine(); engine.load("default", "org.skife.simple.HelloService"); engine.link("*", "default"); ProtocolHandler handler =3D HandlerFactory.getInstance(engine); Connection connection =3D ConnectionFactory.getConnection(handler); connection.connect(new ServerSocket(8282)); ?? |