Handling HTTP 401 error with JSP

Discussion in 'Java' started by Philippe Poulard, Jul 31, 2003.

  1. Hi,

    in my web application, i defined a restrictive area, like this :

    <!-- Define a Security Constraint on this Application -->
    <security-constraint>
    <web-resource-collection>
    <web-resource-name>Entire Application</web-resource-name>
    <url-pattern>/foo/*</url-pattern>
    </web-resource-collection>
    <auth-constraint>
    <role-name>knownuser<role-name>
    </auth-constraint>
    </security-constraint>
    <!-- Define the Login Configuration for this Application -->
    <login-config>
    <auth-method>BASIC</auth-method>
    <realm-name>myreal</realm-name>
    </login-config>
    <!-- Security roles referenced by this web application -->
    <security-role>
    <role-name>knownuser</role-name>
    </security-role>

    when the browser popups the login window, and the user cancels, the
    following message is delivered by the server :

    HTTP 401 auth required

    i'd like to handle such error server side and use my /error.jsp page instead

    how should i do ?
    --
    Cordialement,

    ///
    (. .)
    -----ooO--(_)--Ooo-----
    | Philippe Poulard |
    -----------------------
    Philippe Poulard, Jul 31, 2003
    #1
    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. Steven Cheng[MSFT]

    Re: Debugging returning 401 HTTP error

    Steven Cheng[MSFT], Apr 1, 2004, in forum: ASP .Net
    Replies:
    6
    Views:
    832
    James Bailey
    Apr 6, 2004
  2. sck10

    Can't catch the error: HTTP 401.2

    sck10, Apr 29, 2005, in forum: ASP .Net
    Replies:
    1
    Views:
    1,860
    Steven Cheng[MSFT]
    Apr 30, 2005
  3. Patrick.O.Ige

    'HTTP/1.1 401 Access Denied'.error

    Patrick.O.Ige, Oct 12, 2005, in forum: ASP .Net
    Replies:
    2
    Views:
    7,090
    Patrick.O.Ige
    Oct 13, 2005
  4. =?Utf-8?B?U2h3ZXRoYQ==?=

    HTTP 401.1 error

    =?Utf-8?B?U2h3ZXRoYQ==?=, Sep 5, 2007, in forum: ASP .Net
    Replies:
    0
    Views:
    450
    =?Utf-8?B?U2h3ZXRoYQ==?=
    Sep 5, 2007
  5. Eric von Horst

    Help with suds: HTTP Error 401

    Eric von Horst, Jun 11, 2010, in forum: Python
    Replies:
    3
    Views:
    1,997
    plainsane
    Jun 21, 2010
Loading...

Share This Page