Announcement Announcement Module
Collapse
No announcement yet.
Getting at complete url of current page? Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • Getting at complete url of current page?

    Hi,

    though not necessarily a Spring question (I think), how can I get at the complete url of the current page in my jsp?

    request.getRequestURI() returns the translated name of my jsp (i.e. something like /blahblah/WEB-INF/views/jsp/signup.jsp).

    Is there a clever way to get the at the url as the user sees it (i.e. http://blah.com/blahblah/signup.html)?

  • #2
    Use
    Code:
    request.getRequestURL().toString()

    Comment


    • #3
      Hi,

      won't work either. Gives me this:

      http://blah.com/blahblah/WEB-INF/views/signup.jsp

      I basically need the unmapped url. I'm using
      SimpleUrlHandlerMapping.

      Comment


      • #4
        Originally posted by Jack Hackwerk View Post
        Hi,

        won't work either. Gives me this:

        http://blah.com/blahblah/WEB-INF/views/signup.jsp

        I basically need the unmapped url. I'm using
        SimpleUrlHandlerMapping.
        Really strange. Perhaps you should capture the name in an HttpFilter using request.getRequestURL().toString() and put it in a request attribute. It may work, because the filter is executed before the Spring Servlet, which seems to somehow chage the original url to the mapped one

        Comment


        • #5
          I'm pretty sure that the InternalResourceViewResolver forwards to the jsp by default, so perhaps try the following:

          Code:
          request.getAttribute("javax.servlet.forward.request_uri");

          Comment

          Working...
          X