• 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:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Controller Question

 
Ranch Hand
Posts: 15304
6
Mac OS X IntelliJ IDE Chrome
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Right now, my url-pattern for my Controller is *.do. While this works, I just don't like the look of page.do in the URL on the browser.
I would rather not have an extension at all. I initially tried just using /* for my URL-pattern and this worked until I forwarded to a JSP then I just got caught in the awful loop because it kept hitting the Controller over and over for every request.
The other option I tried, which worked, was to map all my actions to something like /action/*. That way, my JSP's were never in that url-pattern, so I lost the loop.
However, is there any way to say something like "all but .jsp" are mapped through the controller? Or is it best to just make the url-pattern something where the JSP's aren't located. As in /action/*?
Thanks.
 
Ranch Hand
Posts: 541
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
IIRC it is not possible to do negatives in URL patterns, it's not like a regular expression.
I would recommend a mapping like index.html just so that people can't guess what technology you are using and it looks 'normal' in a browser
 
Gregg Bolinger
Ranch Hand
Posts: 15304
6
Mac OS X IntelliJ IDE Chrome
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Originally posted by Tim Baker:
IIRC it is not possible to do negatives in URL patterns, it's not like a regular expression.
I would recommend a mapping like index.html just so that people can't guess what technology you are using and it looks 'normal' in a browser


Good suggestion. Why hide the technology though?
 
Sheriff
Posts: 67746
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

I would recommend a mapping like index.html just so that people can't guess what technology you are using and it looks 'normal' in a browser


Be afraid. Be very afraid.
If you do this, "helpful" servers on the web (most notably AOL) will cache your results thinking that the content is static. (Thus ending up with bugs like one customer's data beng presented to another -- not pretty and I have the scars to show for it).
I use /action in my framework. There's no sense in "hiding" the technology to me.
bear
[ December 29, 2003: Message edited by: Bear Bibeault ]
 
Ranch Hand
Posts: 101
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I also like the 'technology' hiding. I not only like to 'hide' the implementation from the user, but the extension is also the perfect place to find out what 'flavor' the user wants (html, wml, pdf, etc..).
I believe (I may be wrong) that a URL without an extension is usually translated, or assumed to be, as a directory. In any case, I would assume that you would only want the controller logic to execute once per request. I see why you are not a fan of *.do, but explicitly forcing all .do request through the controller is exactly why STRUTS selected to go that way.
One way around it that I can think of is to create a super class servlet that contains all controller code not having to do with mapping (security and such). Then just map each servlet (extending the super class of course) to each URL as normal in web.xml. I suggest putting any objects/vars in the ServletContext or a seperate Static class and only put methods in the superclass.
 
Ken Robinson
Ranch Hand
Posts: 101
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Originally posted by Bear Bibeault:

Be afraid. Be very afraid.
If you do this, "helpful" servers on the web (most notably AOL) will cache your results thinking that the content is static. (Thus ending up with bugs like one customer's data beng presented to another -- not pretty and I have the scars to show for it).



Is it not possible to set the page lifetime or cache life to zero or to expire in the past to avoid this?
 
Gregg Bolinger
Ranch Hand
Posts: 15304
6
Mac OS X IntelliJ IDE Chrome
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Originally posted by Kenneth Robinson:


Is it not possible to set the page lifetime or cache life to zero or to expire in the past to avoid this?


I think for AOL no, because the integrated AOL browser ignores META tags to disable caching (I think).
Since AOL is primarily Dial up, they cache like crazy for speed purposes.
 
Don't get me started about those stupid light bulbs.
reply
    Bookmark Topic Watch Topic
  • New Topic