Don't like ads? PRO users don't see any ads ;-)
Guest

Untitled

By: a guest on Apr 28th, 2012  |  syntax: None  |  size: 0.42 KB  |  hits: 13  |  expires: Never
download  |  raw  |  embed  |  report abuse  |  print
Text below is selected. Please press Ctrl+C to copy to your clipboard. (⌘+C on Mac)
  1. Servlet: custom 401 page isn't triggered
  2. <error-page>
  3.     <error-code>401</error-code>
  4.     <location>/WEB-INF/exceptions/401.jsp</location>
  5. </error-page>
  6.        
  7. response.sendError(401, "message here");
  8.        
  9. <%@page contentType="text/html" pageEncoding="UTF-8" isErrorPage="true"%>
  10. <!DOCTYPE html>
  11. <html>
  12.     ...
  13.     <body>
  14.         <h1>Unauthorized (401)</h1>
  15.         <p><%= exception.getMessage() %></p>
  16.     </body>    
  17. </html>