Package net.i2p.servlet
Class ErrorServlet
java.lang.Object
javax.servlet.GenericServlet
javax.servlet.http.HttpServlet
net.i2p.servlet.ErrorServlet
- All Implemented Interfaces:
Serializable,Servlet,ServletConfig
Common servlet for errors
This is intended for webapps and local plugins.
It is not appropriate for eepsites or remotely-accessible plugins,
as it uses local console resources.
See http://www.eclipse.org/jetty/documentation/current/custom-error-pages.html
for how to add to web.xml or see examples in bundled webapps.
Init parameters:
- CSSPath - absolue URL of CSS to reference, starting with /, defaults to console theme
- name - webapp or plugin name, will be translated with bundle, e.g. SusiMail
- bundle - package of translation bundle, e.g. net.i2p.susimail.web.messages
- Since:
- 0.9.34 adapted from routerconsole error.jsp, error500.jsp, and CSSHelper
- See Also:
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected Stringtranslate a string, console bundleprotected Stringtranslate a string, console bundleprotected Stringtranslate a string, console bundleprotected Stringtranslate a string, with webapp bundleprotected voiddoGet(HttpServletRequest req, HttpServletResponse resp) protected voiddoPost(HttpServletRequest req, HttpServletResponse resp) Needed if the errored page was a POSTvoidinit()protected voidoutputMessage(PrintWriter out, int errorCode, String errorMsg, String errorURI, Throwable errorCause) Override for specific cases.Methods inherited from class javax.servlet.http.HttpServlet
doDelete, doHead, doOptions, doPut, doTrace, getLastModified, service, serviceMethods inherited from class javax.servlet.GenericServlet
destroy, getInitParameter, getInitParameterNames, getServletConfig, getServletContext, getServletInfo, getServletName, init, log, log
-
Constructor Details
-
ErrorServlet
public ErrorServlet()
-
-
Method Details
-
init
- Overrides:
initin classGenericServlet- Throws:
ServletException
-
doGet
protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException - Overrides:
doGetin classHttpServlet- Throws:
ServletExceptionIOException
-
doPost
protected void doPost(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException Needed if the errored page was a POST- Overrides:
doPostin classHttpServlet- Throws:
ServletExceptionIOException- Since:
- 0.9.35
-
outputMessage
protected void outputMessage(PrintWriter out, int errorCode, String errorMsg, String errorURI, Throwable errorCause) Override for specific cases. This supports 403, 404, and 500+. Output HTML that goes inside the div.- Parameters:
errorCode- e.g. 404errorMsg- non-null, may be empty, already HTML-escapederrorURI- non-null, may be empty, already HTML-escapederrorCause- may be null
-
_w
translate a string, with webapp bundle -
_t
translate a string, console bundle -
_t
translate a string, console bundle -
_t
translate a string, console bundle
-