Win a copy of The Little Book of Impediments (e-book only) this week in the Agile and Other Processes forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

HttpServletRequest API

 
Schandha Ravi
Ranch Hand
Posts: 167
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi All,

I'm trying to work on a small eCommerce application (Just like shopping cart). My controller should be able select different helper classes to perform different actions like authentication etc. I was going through PetStore application at Pet Store - Front Controller for my application.

My question is assuming view1, view2, view3 .... view n all these views call/being selected by only one controller. How can we find which view is calling the controller, in our controller code, so that we can use some if else kind of logic to select our own workflow .
 
Schandha Ravi
Ranch Hand
Posts: 167
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
In the Front Controller pattern given in PetStore application, there is a method call request.getPathInfo(), in doGet() method. I tried the same method call. But evertime I invoke, it is always returning me null. What does that method do?
 
Ulf Dittmer
Rancher
Posts: 42969
73
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
there is a method call request.getPathInfo(), in doGet() method. I tried the same method call. But evertime I invoke, it is always returning me null. What does that method do?


It only returns something if the URL has extra path info. The first paragraph of the javadocs explain (very briefly) what extra path info. Suppose you're accessing the URL

and the servlet is configured to listen to "myServlet", then "myBadaBing" is the extra path info. Playing around with different URLs will give you a feeling for it.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic