File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

HttpServletRequest, getServletPath as controller

 
Jesus Angeles
Ranch Hand
Posts: 2068
  • 0
  • Mark post as helpful
  • send pies
  • 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 ]
 
Bear Bibeault
Author and ninkuma
Marshal
Pie
Posts: 64178
83
IntelliJ IDE Java jQuery Mac Mac OS X
  • 0
  • Mark post as helpful
  • send pies
  • 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
Author and ninkuma
Marshal
Pie
Posts: 64178
83
IntelliJ IDE Java jQuery Mac Mac OS X
  • 0
  • Mark post as helpful
  • send pies
  • 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: 2068
  • 0
  • Mark post as helpful
  • send pies
  • 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: 2068
  • 0
  • Mark post as helpful
  • send pies
  • 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 ]
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic