Thread: [Simpleweb-Support] Problem of trying simple
Brought to you by:
niallg
From: Carfield Y. <car...@gm...> - 2005-09-27 18:48:59
|
Like to try out simple to see if it is work better than normal servlet. However I am not sure how to port some method from servlet to simple api: 1) HttpServletResponse.setStatus(HttpServletResponse.SC_NOT_FOUND) , how do I set response header status? 2) HttpServletResponse.sendRedirect(), how do I redirect user to some liink= ? 3) HttpServlet.getServletContext().getMimeType(file), is it possible to get the typical MIME type of a file? Context.getMimeType() is the correct method? 4) Any example of how http request work? E.g. how to handle multipart reque= st? |
From: Carfield Y. <car...@ca...> - 2005-09-27 19:11:52
|
Like to try out simple to see if it is work better than normal servlet. However I am not sure how to port some method from servlet to simple api: 1) HttpServletResponse.setStatus(HttpServletResponse.SC_NOT_FOUND) , how do I set response header status? 2) HttpServletResponse.sendRedirect(), how do I redirect user to some liink= ? 3) HttpServlet.getServletContext().getMimeType(file), is it possible to get the typical MIME type of a file? Context.getMimeType() is the correct method? 4) Any example of how http request work? E.g. how to handle multipart reque= st? |
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 |
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)); ?? |
From: Niall G. <gal...@ya...> - 2005-09-28 21:51:31
|
Hi Carfield, --- Carfield Yim <car...@gm...> wrote: > > 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? Well, kind of. It will generate a default error message saying "File Not Found". If you would like a custom error page then I suggest that you implement your own simple.http.serve.Format implementation. Or implement the handle(request, response, code) method yourself. > > 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? Yes, you implement the redirect(Request, Response) method which the action you want to take. Then when this finishes return the Resource you want to redirect to. For example, you could do either of these: public Resource redirect(Request req, Response resp) { /* some code here to do somthing */ return resolve("/path/to/some/service.html"); } public Resource redirect(Request req, Response resp) { /* some code here to do somthing */ return lookup("myNamedService"); } > Besides, is this method thread safe? Or it better > that I create new > instance for every redirect call? It is thread safe throughout, you should extend the class and provide some implementation. Although not documented the intended way to use the RedirectService is to perform some operation that does not provide a "display" then forward to a service that does, such as an ActionService. For example: Client ---> RedirectService ---> ActionService > > 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 = new LoaderEngine(); > engine.load("default", > "org.skife.simple.HelloService"); > engine.link("*", "default"); > ProtocolHandler handler = > HandlerFactory.getInstance(engine); > Connection connection = > ConnectionFactory.getConnection(handler); > connection.connect(new ServerSocket(8282)); The above load and link can be encapsulated within an entry to mapper.xml as follows. <resolve match="*" name="default" type="org.skife.simple.HelloService"/> However you must use the PatternMapper. To set this for the server you can edit the simple-demo-1.2 server.xml (which is already set) or you can use a -D command such as: -Dsimple.http.load.mapper=simple.http.load.PatternMapper In the simple-demo-1.2 download the service classes are located in the directory home/class Niall Niall Gallagher __________________________________ Yahoo! Mail - PC Magazine Editors' Choice 2005 http://mail.yahoo.com |
From: Carfield Y. <car...@ca...> - 2005-09-29 22:14:18
|
> Well, kind of. It will generate a default error > message saying "File Not Found". If you would like a > custom error page then I suggest that you implement > your own simple.http.serve.Format implementation. Or > implement the handle(request, response, code) method > yourself. Too sad that I can't just set the response code easy as servlet api does, will you consider to provide this feature in future release? > > Yes, you implement the redirect(Request, Response) > method which the action you want to take. Then when > this finishes return the Resource you want to redirect > to. For example, you could do either of these: > > public Resource redirect(Request req, Response resp) { > /* some code here to do somthing */ > > return resolve("/path/to/some/service.html"); > } > > public Resource redirect(Request req, Response resp) { > /* some code here to do somthing */ > > return lookup("myNamedService"); > } > Haven't notice that some interface API haven't been implemented... > The above load and link can be encapsulated within an > entry to mapper.xml as follows. > > <resolve match=3D"*" name=3D"default" > type=3D"org.skife.simple.HelloService"/> > > However you must use the PatternMapper. To set this > for the server you can edit the simple-demo-1.2 > server.xml (which is already set) or you can use a -D > command such as: > > -Dsimple.http.load.mapper=3Dsimple.http.load.PatternMapper > > In the simple-demo-1.2 download the service classes > are located in the directory home/class > Where should this mapper.xml put so that simple can load? Is it possible for me to set these information at code? I think I can use System.setProperty("simple.http.load.mapper","simple.http.load.PatternMappe= r"); To set the mapper using, but how can I change the resolve properties that mapper.xml tell the system? Another question is how many instance will the ActionService created? Will it create a new instance for every request, or it act like servlet, create one instance then run the process() method many time to serve difference request? For now, my application like this: public class Controller extends ActionService { =09final private core.Context ctx; =09public Controller(Context context) { =09=09super(context); =09=09try { =09=09=09final File file =3D new File("WEB-INF/data/"); =09=09=09this.ctx =3D new core.Context(file); =09=09} catch (Exception e) { =09=09=09throw new RuntimeException(e); =09=09} =09} =09protected void finalize() throws Throwable { =09=09super.finalize(); =09=09ctx.shutdown(); =09} =09private void handleRequest(Request req, Response res, Document document)= ; =09public void process(Request request, Response response) throws Exception= { =09=09try { =09=09=09handleRequest(request, response, system.lookup("template.vm")); =09=09} catch (Exception e) { =09=09=09throw new RuntimeException(e); =09=09} =09} =09public static void main(String[] list) throws Exception { =09=09TemplateEngine engine =3D new TemplateEngine(new FileContext(), new VelocityContainer(new TemplateManager().engine())); =09=09Connection connection =3D ConnectionFactory.getConnection(engine); =09=09connection.connect(new ServerSocket(8082)); =09} } Where =09final private core.Context ctx should only created once for the application, if Controller will create may time then I need to think difference implement, and now I use finalizer to trigger the clean up, which is not work in most case. Just wonder if simple provide standard way for me to clean up application if the user quit? |
From: Niall G. <gal...@ya...> - 2005-09-29 23:26:38
|
Hi, --- Carfield Yim <car...@ca...> wrote: > > Well, kind of. It will generate a default error > > message saying "File Not Found". If you would like > a > > custom error page then I suggest that you > implement > > your own simple.http.serve.Format implementation. > Or > > implement the handle(request, response, code) > method > > yourself. > > Too sad that I can't just set the response code easy > as servlet api > does, will you consider to provide this feature in > future release? You can set the response code using Response.setCode. > > > > Yes, you implement the redirect(Request, Response) > > method which the action you want to take. Then > when > > this finishes return the Resource you want to > redirect > > to. For example, you could do either of these: > > > > public Resource redirect(Request req, Response > resp) { > > /* some code here to do somthing */ > > > > return resolve("/path/to/some/service.html"); > > } > > > > public Resource redirect(Request req, Response > resp) { > > /* some code here to do somthing */ > > > > return lookup("myNamedService"); > > } > > > > Haven't notice that some interface API haven't been > implemented... I am not sure what your are asking here? > > The above load and link can be encapsulated within > an > > entry to mapper.xml as follows. > > > > <resolve match="*" name="default" > > type="org.skife.simple.HelloService"/> > > > > However you must use the PatternMapper. To set > this > > for the server you can edit the simple-demo-1.2 > > server.xml (which is already set) or you can use a > -D > > command such as: > > > > > -Dsimple.http.load.mapper=simple.http.load.PatternMapper > > > > In the simple-demo-1.2 download the service > classes > > are located in the directory home/class > > > > Where should this mapper.xml put so that simple can > load? > Is it possible for me to set these information at > code? I think I can use Anywhere within the context root the current working directory or anywhere the Locator can reach. Look at simple.http.serve.FileLocator. System.setProperty("simple.http.load.mapper","simple.http.load.PatternMapper"); > > To set the mapper using, but how can I change the > resolve properties > that mapper.xml tell the system? Edit the mapper.xml file, its loaded once on startup. > Another question is how many instance will the > ActionService created? > Will it create a new instance for every request, or > it act like > servlet, create one instance then run the process() > method many time > to serve difference request? For now, my application > like this: > One instance is created, if the TemplateEngine will reload the class if it is modified though. I would set a Controller attribute. For example: controller.set("core", new Core()); And within the ActionService.prepare acquire the instance doing the following: core = (Core) system.get("core"); > public class Controller extends ActionService { > final private core.Context ctx; > public Controller(Context context) { > super(context); > try { > final File file = new File("WEB-INF/data/"); > this.ctx = new core.Context(file); > } catch (Exception e) { > throw new RuntimeException(e); > } > } > > protected void finalize() throws Throwable { > super.finalize(); > ctx.shutdown(); > } > > private void handleRequest(Request req, Response > res, Document document); > > public void process(Request request, Response > response) throws Exception { > try { > handleRequest(request, response, > system.lookup("template.vm")); > } catch (Exception e) { > throw new RuntimeException(e); > } > } > > public static void main(String[] list) throws > Exception { > TemplateEngine engine = new TemplateEngine(new > FileContext(), new > VelocityContainer(new TemplateManager().engine())); > Connection connection = > ConnectionFactory.getConnection(engine); > connection.connect(new ServerSocket(8082)); > } > } > > Where > final private core.Context ctx > should only created once for the application, if > Controller will > create may time then I need to think difference > implement, and now I > use finalizer to trigger the clean up, which is not > work in most case. > Just wonder if simple provide standard way for me to > clean up > application if the user quit? > Niall Niall Gallagher __________________________________ Yahoo! Mail - PC Magazine Editors' Choice 2005 http://mail.yahoo.com |
From: Carfield Y. <car...@gm...> - 2005-10-02 17:24:04
|
> You can set the response code using Response.setCode. > Thx , that what I look for. > > Haven't notice that some interface API haven't been > > implemented... > > I am not sure what your are asking here? > Nothing ask, just sorry for asking question which api document have show. > Anywhere within the context root the current working > directory or anywhere the Locator can reach. Look at > simple.http.serve.FileLocator. > > System.setProperty("simple.http.load.mapper","simple.http.load.PatternMap= per"); > > > > To set the mapper using, but how can I change the > > resolve properties > > that mapper.xml tell the system? > > Edit the mapper.xml file, its loaded once on startup. > I would like to package the software as a java web start application, in order to make the process easier, I will like to prevent config file as much as possible. In fact, there is only one ActionService so I would like to tell simple to that ActionService at code but not in XML file, is it possible? > One instance is created, if the TemplateEngine will > reload the class if it is modified though. I would set > a Controller attribute. For example: > > controller.set("core", new Core()); > > And within the ActionService.prepare acquire the > instance doing the following: > > core =3D (Core) system.get("core"); > ok, thx for the hint, and how about clean up part? |
From: Carfield Y. <car...@ca...> - 2005-09-30 19:32:34
|
> > controller.set("core", new Core()); > > > > And within the ActionService.prepare acquire the > > instance doing the following: > > > > core =3D (Core) system.get("core"); > > And I think you mean something like this, right? =09=09=09core.Context temp =3D (core.Context)system.get("core"); =09=09=09if(temp =3D=3D null) { =09=09=09=09final File file =3D new File("WEB-INF/data/"); =09=09=09=09temp =3D new core.Context(file); =09=09=09=09system.put("core", temp); =09=09=09} =09=09=09ctx =3D temp; |
From: Niall G. <gal...@ya...> - 2005-10-02 20:54:28
|
Hi, Yes, this should be fine. Niall --- Carfield Yim <car...@ca...> wrote: > > > controller.set("core", new Core()); > > > > > > And within the ActionService.prepare acquire the > > > instance doing the following: > > > > > > core = (Core) system.get("core"); > > > > > And I think you mean something like this, right? > > core.Context temp = > (core.Context)system.get("core"); > if(temp == null) { > final File file = new File("WEB-INF/data/"); > temp = new core.Context(file); > system.put("core", temp); > } > ctx = temp; > > > ------------------------------------------------------- > This SF.Net email is sponsored by: > Power Architecture Resource Center: Free content, > downloads, discussions, > and more. > http://solutions.newsforge.com/ibmarch.tmpl > _______________________________________________ > Simpleweb-Support mailing list > Sim...@li... > https://lists.sourceforge.net/lists/listinfo/simpleweb-support > Niall Gallagher ______________________________________________________ Yahoo! for Good Donate to the Hurricane Katrina relief effort. http://store.yahoo.com/redcross-donate3/ |
From: Carfield Y. <car...@gm...> - 2005-10-03 04:57:02
|
So... how about this one? possible? > Anywhere within the context root the current working > directory or anywhere the Locator can reach. Look at > simple.http.serve.FileLocator. > > System.setProperty("simple.http.load.mapper","simple.http.load.PatternMap= per"); > > > > To set the mapper using, but how can I change the > > resolve properties > > that mapper.xml tell the system? > > Edit the mapper.xml file, its loaded once on startup. > I would like to package the software as a java web start application, in order to make the process easier, I will like to prevent config file as much as possible. In fact, there is only one ActionService so I would like to tell simple to that ActionService at code but not in XML file, is it possible? On 10/1/05, Niall Gallagher <gal...@ya...> wrote: > Hi, > > Yes, this should be fine. > > Niall > |
From: Carfield Y. <car...@ca...> - 2005-10-04 04:35:42
|
So... how about this one? possible? > Anywhere within the context root the current working > directory or anywhere the Locator can reach. Look at > simple.http.serve.FileLocator. > > System.setProperty("simple.http.load.mapper","simple.http.load.PatternMap= per"); > > > > To set the mapper using, but how can I change the > > resolve properties > > that mapper.xml tell the system? > > Edit the mapper.xml file, its loaded once on startup. > I would like to package the software as a java web start application, in order to make the process easier, I will like to prevent config file as much as possible. In fact, there is only one ActionService so I would like to tell simple to that ActionService at code but not in XML file, is it possible? |
From: Niall G. <gal...@ya...> - 2005-10-04 11:14:21
|
Hi Carfield, --- Carfield Yim <car...@ca...> wrote: > So... how about this one? possible? > > > Anywhere within the context root the current > working > > directory or anywhere the Locator can reach. Look > at > > simple.http.serve.FileLocator. > > > > > System.setProperty("simple.http.load.mapper","simple.http.load.PatternMapper"); > > > > > > To set the mapper using, but how can I change > the > > > resolve properties > > > that mapper.xml tell the system? > > > > Edit the mapper.xml file, its loaded once on > startup. > > > I would like to package the software as a java web > start application, > in order to make the process easier, I will like to > prevent config > file as much as possible. In fact, there is only one > ActionService so > I would like to tell simple to that ActionService at > code but not in > XML file, is it possible? You can create your own Mapper object to return the name of your ActionService implementation. For example: public class MyMapper implements Mapper { public MyMapper(Context context){} public String getClass(String name) { return "mypackage.MyActionService"; } public String getPath(String target) { return target; } public String getName(String target) { return "myName"; } } This should work if you only need one service. Niall Niall Gallagher __________________________________ Yahoo! Mail - PC Magazine Editors' Choice 2005 http://mail.yahoo.com |
From: Carfield Y. <car...@gm...> - 2005-10-05 04:20:27
|
Nearly done, thx for support, still have some minor issue > You can create your own Mapper object to return the > name of your ActionService implementation. For > example: > After I do that, at the constructor, it complaint system is null, thus instead of core.Context temp =3D (core.Context)system.get("core= "); if(temp =3D=3D null) { final File file =3D new File("WEB-INF/data/"= ); temp =3D new core.Context(file); system.put("core", temp); } ctx =3D temp; At constructor, now I just use static variable to held core.Context The other problem is context.getMimeType(location.getName()) always return "application/octetstream" for unknown type, which is not very handle for me. Otherwise , all are working :-) |
From: Carfield Y. <car...@ca...> - 2005-10-04 21:11:28
|
Nearly done, thx for support, still have some minor issue > You can create your own Mapper object to return the > name of your ActionService implementation. For > example: > After I do that, at the constructor, it complaint system is null, thus instead of core.Context temp =3D (core.Context)system.get("core"= ); if(temp =3D=3D null) { final File file =3D new File("WEB-INF/data/")= ; temp =3D new core.Context(file); system.put("core", temp); } ctx =3D temp; At constructor, now I just use static variable to held core.Context The other problem is context.getMimeType(location.getName()) always return "application/octetstream" for unknown type, which is not very handle for me. All other function are working :-) |
From: Niall G. <gal...@ya...> - 2005-10-04 21:35:10
|
Hi Carfield, --- Carfield Yim <car...@ca...> wrote: > Nearly done, thx for support, still have some minor > issue > > > You can create your own Mapper object to return > the > > name of your ActionService implementation. For > > example: > > > After I do that, at the constructor, it complaint > system is null, thus > instead of > > core.Context temp = > (core.Context)system.get("core"); > if(temp == null) { > final File file = new > File("WEB-INF/data/"); > temp = new > core.Context(file); > system.put("core", > temp); > } > ctx = temp; > > At constructor, now I just use static variable to > held core.Context Not sure what your problem is here. But if it works then great! > The other problem is > context.getMimeType(location.getName()) always > return "application/octetstream" for unknown type, > which is not very > handle for me. This is a requirement of the HTTP/1.1 specification. Just edit simple/http/serve/Mime.properties to map file extensions to types. Niall Niall Gallagher __________________________________ Yahoo! Mail - PC Magazine Editors' Choice 2005 http://mail.yahoo.com |
From: Carfield Y. <car...@ca...> - 2005-10-10 11:45:16
|
Anyone know what is the simple api work similar to the following API of HttpServlet? protected final long getLastModified(final HttpServletRequest req) |
From: Niall G. <gal...@ya...> - 2005-10-10 13:29:16
|
Hi Yes, you do the following Request.getDate("last-modified") or if you want to check conditional headers Request.getDate("if-modified-since") Niall --- Carfield Yim <car...@ca...> wrote: > Anyone know what is the simple api work similar to > the following API > of HttpServlet? > > protected final long getLastModified(final > HttpServletRequest req) > > > ------------------------------------------------------- > This SF.Net email is sponsored by: > Power Architecture Resource Center: Free content, > downloads, discussions, > and more. > http://solutions.newsforge.com/ibmarch.tmpl > _______________________________________________ > Simpleweb-Support mailing list > Sim...@li... > https://lists.sourceforge.net/lists/listinfo/simpleweb-support > Niall Gallagher __________________________________ Start your day with Yahoo! - Make it your home page! http://www.yahoo.com/r/hs |
From: Carfield Y. <car...@gm...> - 2005-10-10 14:15:20
|
Request?? Or it should be Response? On 10/10/05, Niall Gallagher <gal...@ya...> wrote: > Hi > > Yes, you do the following > > Request.getDate("last-modified") > > or if you want to check conditional headers > > Request.getDate("if-modified-since") > > Niall > > --- Carfield Yim <car...@ca...> wrote: > > > Anyone know what is the simple api work similar to > > the following API > > of HttpServlet? > > > > protected final long getLastModified(final > > HttpServletRequest req) > > > > > > > ------------------------------------------------------- > > This SF.Net email is sponsored by: > > Power Architecture Resource Center: Free content, > > downloads, discussions, > > and more. > > http://solutions.newsforge.com/ibmarch.tmpl > > _______________________________________________ > > Simpleweb-Support mailing list > > Sim...@li... > > > https://lists.sourceforge.net/lists/listinfo/simpleweb-support > > > > > Niall Gallagher > > > > __________________________________ > Start your day with Yahoo! - Make it your home page! > http://www.yahoo.com/r/hs > > > ------------------------------------------------------- > This SF.Net email is sponsored by: > Power Architecture Resource Center: Free content, downloads, discussions, > and more. http://solutions.newsforge.com/ibmarch.tmpl > _______________________________________________ > Simpleweb-Support mailing list > Sim...@li... > https://lists.sourceforge.net/lists/listinfo/simpleweb-support > |
From: Carfield Y. <car...@gm...> - 2005-10-10 14:32:01
|
In fact, I've override HttpServlet.getLastModified() so that the cache work better. I guess similar logic in simple is Request.setDate("last-modified", date), right? On 10/10/05, Carfield Yim <car...@gm...> wrote: > Request?? Or it should be Response? > > On 10/10/05, Niall Gallagher <gal...@ya...> wrote: > > Hi > > > > Yes, you do the following > > > > Request.getDate("last-modified") > > > > or if you want to check conditional headers > > > > Request.getDate("if-modified-since") > > > > Niall > > > > --- Carfield Yim <car...@ca...> wrote: > > > > > Anyone know what is the simple api work similar to > > > the following API > > > of HttpServlet? > > > > > > protected final long getLastModified(final > > > HttpServletRequest req) > > > > > > > > > > > ------------------------------------------------------- > > > This SF.Net email is sponsored by: > > > Power Architecture Resource Center: Free content, > > > downloads, discussions, > > > and more. > > > http://solutions.newsforge.com/ibmarch.tmpl > > > _______________________________________________ > > > Simpleweb-Support mailing list > > > Sim...@li... > > > > > https://lists.sourceforge.net/lists/listinfo/simpleweb-support > > > > > > > > > Niall Gallagher > > > > > > > > __________________________________ > > Start your day with Yahoo! - Make it your home page! > > http://www.yahoo.com/r/hs > > > > > > ------------------------------------------------------- > > This SF.Net email is sponsored by: > > Power Architecture Resource Center: Free content, downloads, discussion= s, > > and more. http://solutions.newsforge.com/ibmarch.tmpl > > _______________________________________________ > > Simpleweb-Support mailing list > > Sim...@li... > > https://lists.sourceforge.net/lists/listinfo/simpleweb-support > > > |
From: Niall G. <gal...@ya...> - 2005-10-10 15:24:56
|
Hi If you would like to tell the client when something was last modified you would set: Response.setDate("last-modified", date) Setting the Request will have no affect. In short, setDate and getDate in both the Request and Response objects will get and set dates in the HTTP request and response headers respectively. How you use them is up to you... Niall --- Carfield Yim <car...@gm...> wrote: > In fact, I've override HttpServlet.getLastModified() > so that the cache > work better. I guess similar logic in simple is > Request.setDate("last-modified", date), right? > > On 10/10/05, Carfield Yim <car...@gm...> > wrote: > > Request?? Or it should be Response? > > > > On 10/10/05, Niall Gallagher > <gal...@ya...> wrote: > > > Hi > > > > > > Yes, you do the following > > > > > > Request.getDate("last-modified") > > > > > > or if you want to check conditional headers > > > > > > Request.getDate("if-modified-since") > > > > > > Niall > > > > > > --- Carfield Yim <car...@ca...> > wrote: > > > > > > > Anyone know what is the simple api work > similar to > > > > the following API > > > > of HttpServlet? > > > > > > > > protected final long getLastModified(final > > > > HttpServletRequest req) > > > > > > > > > > > > > > > > ------------------------------------------------------- > > > > This SF.Net email is sponsored by: > > > > Power Architecture Resource Center: Free > content, > > > > downloads, discussions, > > > > and more. > > > > http://solutions.newsforge.com/ibmarch.tmpl > > > > > _______________________________________________ > > > > Simpleweb-Support mailing list > > > > Sim...@li... > > > > > > > > https://lists.sourceforge.net/lists/listinfo/simpleweb-support > > > > > > > > > > > > > Niall Gallagher > > > > > > > > > > > > __________________________________ > > > Start your day with Yahoo! - Make it your home > page! > > > http://www.yahoo.com/r/hs > > > > > > > > > > ------------------------------------------------------- > > > This SF.Net email is sponsored by: > > > Power Architecture Resource Center: Free > content, downloads, discussions, > > > and more. > http://solutions.newsforge.com/ibmarch.tmpl > > > _______________________________________________ > > > Simpleweb-Support mailing list > > > Sim...@li... > > > > https://lists.sourceforge.net/lists/listinfo/simpleweb-support > > > > > > > > ------------------------------------------------------- > This SF.Net email is sponsored by: > Power Architecture Resource Center: Free content, > downloads, discussions, > and more. > http://solutions.newsforge.com/ibmarch.tmpl > _______________________________________________ > Simpleweb-Support mailing list > Sim...@li... > https://lists.sourceforge.net/lists/listinfo/simpleweb-support > Niall Gallagher __________________________________ Yahoo! Mail - PC Magazine Editors' Choice 2005 http://mail.yahoo.com |