• 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

Track the Jsp from where the request is coming to the Servlet

 
Ranch Hand
Posts: 47
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
hi all,
I have a problem, where in i am trying to trace the jsp page from where the request is coming to the Particular servlet.
I have 2 different jsp pages and request from both the pages go to the same servlet at different times.... so i need to track in the servelt as to the particular request is from which jsp page.....

Can anybody please help me on this....

thanks and Regards
Jyothi.
 
Sheriff
Posts: 14691
16
Eclipse IDE VI Editor Ubuntu
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
In every JSP files, you could put some information in the request to tell the servlet which JSP sent it. A request parameter for example.
 
Jyothi Bhogadi
Ranch Hand
Posts: 47
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
hi Satou,
thnks for the reply.
I guess that does help.... but just curious to know if there is any standard way using the API.....to get the name of the jsp....

Thanks and Regards
Jyothi.
 
Christophe Verré
Sheriff
Posts: 14691
16
Eclipse IDE VI Editor Ubuntu
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I don't think there is such standard way to do this (like API methods)
I've also heard of using HTTP header called "Referer", but it is not reliable.

(please be careful of this forum's policy about your login name)
 
Ranch Hand
Posts: 71
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Actually it is available.
Look at the interface HttpServletRequest
Method getRequestURI should give you the JSP page requested by the user, though you might have to parse it from the actual servername
 
Christophe Verré
Sheriff
Posts: 14691
16
Eclipse IDE VI Editor Ubuntu
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
getRequestURI() won't tell FROM which JSP the request is coming, but TO which location it is going (the servlet itself in this case)
 
Jyothi Bhogadi
Ranch Hand
Posts: 47
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
hi virag,
i think satou is right.....
getRequestURI()does not give the jsp page from where the request is coming....

Regards
Jyothi.
 
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
There is nothing in the API that will tell you what JSP generated the request.
Requests don't have to be from JSPs. They could be from static HTML pages, custom, clients, other servlets, etc...

If you need to know this then the advice from Satou is your best bet.
Just add a parameter to the query string or HTML form with an identifier.
 
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
"B.Jyothi"

Please adjust your display name to have a space netween the B. and the Jyothi in order to comply with the JavaRanch naming policy.

thanks
bear
Forum bartender
 
Ranch Hand
Posts: 1026
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator


Posted by Satou kurinosuke
I've also heard of using HTTP header called "Referer", but it is not reliable.



I thought Referer is the best choice here. Can u tell me why it isn't reliable.
 
Christophe Verré
Sheriff
Posts: 14691
16
Eclipse IDE VI Editor Ubuntu
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Web browsers tend to set the Referer header the way they want.
http://www.webtechniques.com/archives/1998/09/webm/

This would be a good technique if it was always set properly, which is not the case.
 
Vishnu Prakash
Ranch Hand
Posts: 1026
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Thanks for your quick response Satou kurinosuke. I will go through it after lunch and get back to you if there is any issue.
 
Virag Saksena
Ranch Hand
Posts: 71
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Satou,
You are right. I misread the question as a servlet being called from within a JSP
 
Vishnu Prakash
Ranch Hand
Posts: 1026
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
If I want to include a link to a particular page of a website from my site but I don't want them to know about my site file path. Is there a way to suppress the referer fields. Is there any option in browsers(FireFox esp)
 
Christophe Verré
Sheriff
Posts: 14691
16
Eclipse IDE VI Editor Ubuntu
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
There was an extension called "Adaptive Referer Remover", but it is not supported by Firefox's latest version.
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
reply
    Bookmark Topic Watch Topic
  • New Topic