Re: [Simpleweb-Support] Problem of trying simple
Brought to you by:
niallg
From: Niall G. <gal...@ya...> - 2005-09-27 19:15:03
|
Hi Carfield, I have answered your questions below. > 1) > HttpServletResponse.setStatus(HttpServletResponse.SC_NOT_FOUND) > , > how do I set response header status? 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(); > 2) HttpServletResponse.sendRedirect(), how do I > redirect user to some liink? 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). > 3) > HttpServlet.getServletContext().getMimeType(file), > is it possible > to get the typical MIME type of a file? > Context.getMimeType() is the > correct method? 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. > 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. Niall Niall Gallagher __________________________________ Yahoo! Mail - PC Magazine Editors' Choice 2005 http://mail.yahoo.com |