[jcifs] How to customize HTTP Status 401 Error message

Richard Caper rcaper at gmail.com
Thu Apr 7 10:13:34 GMT 2005


In jcifs.http.NtlmSsp, you can add the following at the bottom:

    resp.setStatus(HttpServletResponse.SC_UNAUTHORIZED);
    // add this line
    req.getRequestDispatcher("/error401.jsp").include(req, resp);
    resp.flushBuffer();
    return null;

This page will be seen if the request gets cancelled after the
challenge is sent (NTLM type 2 message).  Also in
jcifs.http.NtlmHttpFilter you would add similar lines at about line
182 and line 196 (between the setStatus and flushBuffer).  Line 182 is
seen if authentication fails and the user is prompted again.  Line 196
is seen when the site is first visited and NTLM is started.



On Apr 7, 2005 5:05 AM, Guofeng Zhang <guofeng at radvision.com> wrote:
>  
>  
> 
> I use NTLM HTTP Authentication. Sometime IE pop up a window dialog to prompt
> for a password. At this time if the user clicks the Cancel button on this
> window, IE displays: 
> 
>   
> 
> type Status report 
> 
>   
> 
> message 
> 
>   
> 
> description This request requires HTTP authentication (). 
> 
>   
> 
> --------------------------------------------------------------------------------
> 
>   
> 
> Apache Tomcat/5.0.26 
> 
>   
> 
> I want to customize this page by defining an error page in web.xml, like: 
> 
>     <error-page> 
> 
>        <error-code>401</error-code> 
> 
>        <location>error401.jsp</location>      
> 
> </error-page> 
> 
> But SSO will not work. 
> 
>   
> 
> Is there a way to change NtlmHttpFilter so that at least the description of
> the above could be customized? 
> 
>   
> 
> I use JBoss 4.0.1 
> 
>   
> 
> Thank you very much. 
> 
>   
> 
> Guofeng 
> 
>   
> 
>


More information about the jcifs mailing list