Solved

how to change the http error message more understandable

Posted on 2009-04-12
2
225 Views
Last Modified: 2012-05-06
I want to change the http error message send to client of tomcat to understandable error message. E.g:
HTTP Status 403 - Forbidden

type Status report

message Forbidden

description Access to the specified resource (Forbidden) has been forbidden.
Apache Tomcat/6.0.14

Change to. You cannot access this resource
Is there any ideas? Thanks for any help.
0
Comment
Question by:meoconx
2 Comments
 
LVL 27

Accepted Solution

by:
rrz earned 300 total points
ID: 24126070
On your JSP put
<%@ page errorPage="/403.html" %>
In  your web app's web.xml file add  
    <error-page>
                <error-code>403</error-code>
                <location>/403.html</location>
    </error-page>

The file 403.html can contain
<htm>
           You cannot access this resource
</html>

see
http://publib.boulder.ibm.com/infocenter/wchelp/v6r0m0/index.jsp?topic=/com.ibm.commerce.developer.doc/concepts/csdjsperror.htm
http://www.experts-exchange.com/Programming/Languages/Java/J2EE/JSP/Q_23383788.html?sfQueryTermInfo=1+10+error+page
0
 
LVL 5

Expert Comment

by:avya2k
ID: 24129601
There is one method which gets you the errorCode from response
You can use property fiel to match errorCode to your custom message
0

Featured Post

Better Security Awareness With Threat Intelligence

See how one of the leading financial services organizations uses Recorded Future as part of a holistic threat intelligence program to promote security awareness and proactively and efficiently identify threats.

Join & Write a Comment

INTRODUCTION Working with files is a moderately common task in Java.  For most projects hard coding the file names, using parameters in configuration files, or using command-line arguments is sufficient.   However, when your application has vi…
Java contains several comparison operators (e.g., <, <=, >, >=, ==, !=) that allow you to compare primitive values. However, these operators cannot be used to compare the contents of objects. Interface Comparable is used to allow objects of a cl…
Viewers will learn one way to get user input in Java. Introduce the Scanner object: Declare the variable that stores the user input: An example prompting the user for input: Methods you need to invoke in order to properly get  user input:
This tutorial will introduce the viewer to VisualVM for the Java platform application. This video explains an example program and covers the Overview, Monitor, and Heap Dump tabs.

705 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

19 Experts available now in Live!

Get 1:1 Help Now