• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Tim Cooke
  • Campbell Ritchie
  • paul wheaton
  • Ron McLeod
  • Devaka Cooray
Sheriffs:
  • Jeanne Boyarsky
  • Liutauras Vilda
  • Paul Clapham
Saloon Keepers:
  • Tim Holloway
  • Carey Brown
  • Piet Souris
Bartenders:

Using Servlet in <welcome-file-list>

 
Greenhorn
Posts: 9
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I faced a problem of IE caching the JSP Pages. I tried to solve this problem by introducing <meta tags in JSP but that did not work out. I found that there was a new feature that is introduced as part of servlet 2.4 spec. - using servlet in welcome-file-list in web.xml.

So, introduced a servlet and gave that as an entry in ><welcome-file>



Does any body see drawbacks in using a Servlet as Welcome-file? Please let me know...


Thanks,
Balaji
 
Sheriff
Posts: 67754
173
Mac Mac OS X IntelliJ IDE jQuery TypeScript Java iOS
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
How is that going to solve your caching problem?
 
Balaji Ramalingam
Greenhorn
Posts: 9
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Probably, I understated the problem. We were trying to download a jnlp file when user enters a URL. JNLP File is an XML Document. We have an attribute max-heap-size as part of a tag in JNLP File. When user hits a URL, we got to download the JNLP File. But before downloading to client, we got to modify the max-heap-size attribute if there was any user entered value for it(we have a separate gui where user can enter memory heap that client want to use).



So, whenever user hits the URL, http://IP:PORT/Test we would download the JNLP file. We are doing post processing using a Filter to modify the response provided by JNLPDownloadServlet(provided by javawebstart) to make use of the user entered max-heap-size value.

For the first time, it works fine. But when i modified the max-heap-size thru the gui (same web-app with admin previlege) and tried to download this jnlp file, it was still using the same file. I found that it was not hitting the Filter every time.

As we are always requesting for a resource(Test.jnlp that is not at modified) I observed that HTTPServer caches the file and not at all forwarding the request to WebServer. Only if the request is forwarded to the webserver, it would try to download the jnlp file again.

As the resource is already cached and available with HTTP Server, request is served by HTTP Server. So, I introduced a servlet to solve this problem.

Thats where the proposed solution comes to picture.




So, From HTTP Server perspective, we would always be trying to execute a servlet and not a resource, so it is not caching the jnlp file. It always hits the servlet This solved caching problem.


Let me know if there is any drawback in this approach.


Thanks,
Balaji



 
Sheriff
Posts: 13411
Firefox Browser VI Editor Redhat
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I would, first, make sure that all the no-cache headers are set.
If that didn't work, I would modify the links to the JNLP page to make sure that they are always unique.
A querystring variable with a timestamp for a value will usually do the trick.
 
Ranch Hand
Posts: 357
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
i would suggest to call your home page using a fake parameter that changes for each request such as getting the date using javascript

the algorithm would be like this in your home pages for example index.html


1) create a random value such as getting the time using jascript
2) redirect to the same page using javascript but this time passing the value you got on (1) ... something like this index.html?ts=<current time value>
3) ofcourse you must add some logic in your page so that it will not keep redirecting ... for example if it don't find a "ts" in the querystring then redirect using points 1 and 2.


hope it work ;)
 
Balaji Ramalingam
Greenhorn
Posts: 9
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi Ben,

I tried with all the meta tags with no cache headers. But that did not work out.


If that didn't work, I would modify the links to the JNLP page to make sure that they are always unique.



Could you please elaborate a bit more on this?


Thanks,
Balaji
 
Ranch Hand
Posts: 489
Eclipse IDE Tomcat Server Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator


As we are always requesting for a resource(Test.jnlp that is not at modified) I observed that HTTPServer caches the file and not at all forwarding the request to WebServer. Only if the request is forwarded to the webserver, it would try to download the jnlp file again.



Isnt this a configuration issue? If you are proxying requests through a http server, you should be able to specify which kind of resources to cache on the http server and which should be forwarded to the webserver. Such settings are configurable on IIS and apache.

ram.
 
reply
    Bookmark Topic Watch Topic
  • New Topic