• 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

HttpServletRequest, getServletPath as controller

 
Ranch Hand
Posts: 2108
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Any one has experience where getServletPath is not useful (not reliable) in determining which path was used to connect to the servlet?

Servlet 2.4 specs


My code


My descriptor


(As you can see, I did not use /*)

[ December 15, 2006: Message edited by: Jesus Angeles ]
[ December 15, 2006: Message edited by: Jesus Angeles ]
 
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
First and foremost, why on earth use if-then-else rather than separate servlets? What a mess!

If you are trying to create a unified Front Controller, if-then-else is still not the way to go. Look into the Command pattern.

Secondly, things can get complicated when dealing with includes and forwards. Is this the case?
[ December 15, 2006: Message edited by: Bear Bibeault ]
 
Bear Bibeault
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
By the way, I have no idea what the "req" in your subject is supposed to mean. Please use real words when posting.
 
Jesus Angeles
Ranch Hand
Posts: 2108
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
My design (although working) may need improvement. (I have an excuse, its my first, and only 6 months into j2ee design/implement. But yes, there is no excuse for stuff blowing up in production.)

But the application was installed already last week, and I am researching if that sole logic on 'control' is bullet-proof.

That is:
1. The (j2ee) system will allow entry, only on those 3 servlet mapping (The class are inside web-inf, therefore are not accessible directly? ; whether server was set to allow direct or indirect component access).

2. That that method getServletPath will return those 3 exact String.

(The system is on https and has authentication.)
 
Jesus Angeles
Ranch Hand
Posts: 2108
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I might have used some sort of pattern, but I did not intend to do so. My design was simply brought by a huge logic that I could have broken down to methods or classes.

(I edited the title, for the 'req')
[ December 15, 2006: Message edited by: Jesus Angeles ]
 
Legend has it that if you rub the right tiny ad, a genie comes out.
a bit of art, as a gift, that will fit in a stocking
https://gardener-gift.com
reply
    Bookmark Topic Watch Topic
  • New Topic