aspose file tools*
The moose likes Struts and the fly likes Blank page after user cancels basic authentication Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Frameworks » Struts
Bookmark "Blank page after user cancels basic authentication" Watch "Blank page after user cancels basic authentication" New topic
Author

Blank page after user cancels basic authentication

Jared Cope
Ranch Hand

Joined: Aug 18, 2004
Posts: 243
Hi,

When a user cancels basic authentication (rather than clicking 'Ok'), a blank page is displayed in the browser. I can't figure out what is going on because when the user presses 'Ok', the processing goes straight to the Tomcat filters that have been setup.

I would like to display a custom error page when the user presses cancel, but can't seem to figure out where the cancel response gets sent and how to trap it.

Apologies if this is more of a Tomcat question, but thought Struts might be involved somehow too.

Regards, Jared.


SCJP 1.4 91%, SCJP 1.5 88%, SCJD B&S
Rama Krishna Ghanta
Ranch Hand

Joined: Nov 20, 2006
Posts: 59
Check your Action Class. If the authentication is success you will forward the Action to a success page. In the same manner you need to have an error page also, to which the action will be forwarded in case of failure.


Ram...
Jaikiran Pai
Marshal

Joined: Jul 20, 2005
Posts: 10290
    
168

When a user cancels basic authentication (rather than clicking 'Ok'), a blank page is displayed in the browser.


I tried this case(Clicking on the Cancel button during BASIC authentication) and i was rightly shown the 401 error page saying "This request requires HTTP authentication ().". Can you post the contents of your web.xml?


[My Blog] [JavaRanch Journal]
Jaikiran Pai
Marshal

Joined: Jul 20, 2005
Posts: 10290
    
168

Since you mention that you are using Struts, have you defined any Global forwards for 401 type of error in your struts-config.xml? If yes, then that might be a reason why you are seeing the blank page.
Jared Cope
Ranch Hand

Joined: Aug 18, 2004
Posts: 243
Hi,

Originally posted by Rama Krishna Ghanta:
Check your Action Class. If the authentication is success you will forward the Action to a success page. In the same manner you need to have an error page also, to which the action will be forwarded in case of failure.


I guess this is where I am getting stuck. I am setting a breakpoint in various classes but it just never goes there like it does when I click 'Ok' instead.

web.xml has:



and the code always executes this when I click 'Ok' (it executes this for any request). But clicking cancel never goes into this filter at all.

I have tried defining error pages in web.xml like:



but all I see is a blank page when cancel is pressed.

Cheers, Jared.
Jared Cope
Ranch Hand

Joined: Aug 18, 2004
Posts: 243
Hi,

Originally posted by Jaikiran Pai:
Since you mention that you are using Struts, have you defined any Global forwards for 401 type of error in your struts-config.xml? If yes, then that might be a reason why you are seeing the blank page.


There are no global forwards defined for a 401 in struts-config.xml. Could the absence of any be causing this problem?

Cheers, Jared.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Blank page after user cancels basic authentication