Can we pass parameters to login.jsp in Tomcat Form-Based authentication

Discussion in 'Java' started by Bharath, May 6, 2005.

  1. Bharath

    Bharath Guest

    I have a web-application (WebApp_1) running on Tomcat.
    The security is Tomcat Container-managed security --
    it is FORM-based. The login page is a servlet,
    /servlet/loginHandler

    <login-config>
    <auth-method>FORM</auth-method>
    <form-login-config>
    <form-login-page>/servlet/loginHandler</form-login-page>
    <form-error-page>/fail_login.html</form-error-page>
    </form-login-config>
    </login-config>

    Two types of users can access my application.
    And depending on that, I want to provide appropriate
    login pages say
    http://<ipaddress>/englishLogin.jsp and
    http://<ipaddress>/spanishLogin.jsp

    When I access either of these pages, Tomcat invokes
    /servlet/loginHandler.

    The question is:
    When I am in /servlet/loginHandler servlet, I don't
    know which URI was accessed. So, while in the
    loginHandler servlet how do I access the information
    related to the actual URL sent by the browser
    (englishLogin.jsp or spanishLogin.jsp)

    I'd appreciate any help in this regard.


    P.S. I tried adding custom information in HTTP header
    so that I can use that information in loginHandler but
    that is not a feasible solution.
     
    Bharath, May 6, 2005
    #1
    1. Advertising

  2. Bharath

    Robert Guest

    You can get the URL or URI from the HttpServletRequest object.
     
    Robert, May 7, 2005
    #2
    1. Advertising

  3. Bharath

    Bharath Guest

    > You can get the URL or URI from the HttpServletRequest object.

    Thanks for your response.

    getRequestURL and getRequestURI return the following
    respectively when invoked from loginHandler.

    http://10.2.14.220:8080/servlet/loginHandler (URL)

    /servlet/loginHandler (URI)

    But what I want to access is the original URL (of a protected
    resource, say spanishLogin.jsp).

    It appears that Tomcat has exclusive access to the original
    URI in this case and it is not accessible from a program.

    Is this correct?
     
    Bharath, May 8, 2005
    #3
  4. Bharath

    Robert Guest

    Ok so you should just use a hidden input that called language and set
    it respectively on the page the user hits. Then on the submit you can
    parse it as a request parameter.
    <input type="hidden" name="language" value="" />

    where value is either "spanish" or "english"

    in the servlet just do this

    String language = request.getParameter( "language" );

    Won't that do it?
     
    Robert, May 10, 2005
    #4
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. David Krussow
    Replies:
    4
    Views:
    1,492
    David Krussow
    Jan 29, 2004
  2. Raul
    Replies:
    0
    Views:
    345
  3. sridhar kumar ch
    Replies:
    1
    Views:
    8,766
  4. sridhar kumar ch
    Replies:
    0
    Views:
    830
    sridhar kumar ch
    Jun 28, 2006
  5. manu
    Replies:
    1
    Views:
    837
    Evans
    Jul 20, 2008
Loading...

Share This Page