• 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

Original request referer in Action/Interceptor

 
Ranch Hand
Posts: 32
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
How to know from where the request has come from.

request.getHeader("referer") works only when the request is made from a click of link.

is there any way or solution that I can know from which url the request has routed to my action/servlet ?

Thanks in advance.
 
Author
Posts: 12617
IntelliJ IDE Ruby
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Just look at the request?
 
Greenhorn
Posts: 20
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Try calling getRequestURI() and/or getRequestURL() on the request object.
 
Krishna Nagadev
Ranch Hand
Posts: 32
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hope I am not wrong, request.getRequestURI() and request.requestURL() tells you what was requested by the user but not who requested it (ie the origin of the requester). Lets say if your webapplication is routed from Google then, I want to know that the url of Google, not requested URL ie your application url
 
Ranch Hand
Posts: 315
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
it works also when a form is submitted..

thanks
neeraj.
 
Krishna Nagadev
Ranch Hand
Posts: 32
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Thanks for reply, I dont see the referer in header..
 
Krishna Nagadev
Ranch Hand
Posts: 32
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I think I didn't explain the problem properly.. Let me explain it again

I am implementing a Login Service for my application. Some times users may choose the page from public domain directly. So I want to capture that url initially and the request is directed to Login page. When user login is successful then I want to redirect him with the page what he requested earlier.

I can keep the originally requested url in session and I can redirect to it once the user successful in login.. This is temporary solution
Is there any other solution which dont uses session/cookie/url rewriting

Thanks,
 
Neeraj Vij
Ranch Hand
Posts: 315
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
referer could have been removed by the source browser/proxy/plugin..

try some other browser ? if referer is not removed explicitly, it will come in the header.

thanks
Neeraj.
reply
    Bookmark Topic Watch Topic
  • New Topic