Class SilverpeasHttpServlet
- java.lang.Object
-
- javax.servlet.GenericServlet
-
- javax.servlet.http.HttpServlet
-
- org.silverpeas.core.web.mvc.webcomponent.SilverpeasHttpServlet
-
- All Implemented Interfaces:
Serializable
,javax.servlet.Servlet
,javax.servlet.ServletConfig
- Direct Known Subclasses:
AuthenticationServlet
,ChatUserSelectionServlet
,JSONServlet
,LoginServlet
,SilverpeasAuthenticatedHttpServlet
,VisioServlet
public class SilverpeasHttpServlet extends javax.servlet.http.HttpServlet
This servlet is the parent one of Silverpeas application. It provides common HTTP servlet tools.- Author:
- Yohann Chastagnier
- See Also:
- Serialized Form
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description protected static class
SilverpeasHttpServlet.HttpError
Internal exception class managementprotected static class
SilverpeasHttpServlet.UserSessionStatus
-
Constructor Summary
Constructors Constructor Description SilverpeasHttpServlet()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected SilverpeasHttpServlet.UserSessionStatus
existOpenedUserSession(javax.servlet.http.HttpServletRequest request)
Indicates if it exists an opened user session.protected SilverpeasHttpServlet.HttpError
forbidden(String msg)
protected SilverpeasHttpServlet.HttpError
notFound(String msg)
protected SilverpeasHttpServlet.HttpError
preconditionFailed(String msg)
protected void
redirectOrForwardService(javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response, String destination)
Handle the sendRedirect or the forward.protected void
sendError(javax.servlet.http.HttpServletResponse response, int status)
Sends an HTTP error to the client with the specified error code.protected void
sendError(javax.servlet.http.HttpServletResponse response, int status, String message)
Sends an HTTP error to the client with the specified error code and error message.protected void
service(javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response)
protected void
throwHttpForbiddenError()
The HTTP server understood the request, but is refusing to fulfill it.protected void
throwHttpForbiddenError(String message)
The HTTP server understood the request, but is refusing to fulfill it.protected void
throwHttpNotFoundError()
The server has not found anything matching the requested address (URI) ( not found ).protected void
throwHttpNotFoundError(String message)
The server has not found anything matching the requested address (URI) ( not found ).protected void
throwHttpPreconditionFailedError()
The precondition given in one or more of the request-header fields evaluated to false when it was tested on the server.protected void
throwHttpPreconditionFailedError(String message)
The precondition given in one or more of the request-header fields evaluated to false when it was tested on the server.-
Methods inherited from class javax.servlet.http.HttpServlet
doDelete, doGet, doHead, doOptions, doPost, doPut, doTrace, getLastModified, service
-
-
-
-
Method Detail
-
service
protected void service(javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response) throws javax.servlet.ServletException, IOException
- Overrides:
service
in classjavax.servlet.http.HttpServlet
- Throws:
javax.servlet.ServletException
IOException
-
existOpenedUserSession
protected SilverpeasHttpServlet.UserSessionStatus existOpenedUserSession(javax.servlet.http.HttpServletRequest request)
Indicates if it exists an opened user session.- Parameters:
request
- the current request.- Returns:
- true if it exists an opened user session, false otherwise.
-
redirectOrForwardService
protected void redirectOrForwardService(javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response, String destination) throws javax.servlet.ServletException, IOException
Handle the sendRedirect or the forward.- Throws:
javax.servlet.ServletException
- on redirect or forward error.IOException
- on redirect error.
-
throwHttpPreconditionFailedError
protected void throwHttpPreconditionFailedError()
The precondition given in one or more of the request-header fields evaluated to false when it was tested on the server. This response code allows the client to place preconditions on the current resource meta-information (header field data) and thus prevent the requested method from being applied to a resource other than the one intended.
-
throwHttpForbiddenError
protected void throwHttpForbiddenError()
The HTTP server understood the request, but is refusing to fulfill it. This status code is commonly used when the server does not wish to reveal exactly why the request has been refused, or when no other response is applicable (for example the server is an Intranet and only the LAN machines are authorized to connect).
-
throwHttpNotFoundError
protected void throwHttpNotFoundError()
The server has not found anything matching the requested address (URI) ( not found ). This means the URL you have typed or clicked on is wrong or obsolete and does not match any document existing on the server (you may try to gradually remove the URL components from the right to the left to eventually retrieve an existing path).
-
throwHttpPreconditionFailedError
protected void throwHttpPreconditionFailedError(String message)
The precondition given in one or more of the request-header fields evaluated to false when it was tested on the server. This response code allows the client to place preconditions on the current resource meta-information (header field data) and thus prevent the requested method from being applied to a resource other than the one intended.
-
throwHttpForbiddenError
protected void throwHttpForbiddenError(String message)
The HTTP server understood the request, but is refusing to fulfill it. This status code is commonly used when the server does not wish to reveal exactly why the request has been refused, or when no other response is applicable (for example the server is an Intranet and only the LAN machines are authorized to connect).
-
throwHttpNotFoundError
protected void throwHttpNotFoundError(String message)
The server has not found anything matching the requested address (URI) ( not found ). This means the URL you have typed or clicked on is wrong or obsolete and does not match any document existing on the server (you may try to gradually remove the URL components from the right to the left to eventually retrieve an existing path).
-
sendError
protected void sendError(javax.servlet.http.HttpServletResponse response, int status)
Sends an HTTP error to the client with the specified error code. Once the error is sent, the HTTP response is consumed, and it cannot be used anymore; so the servlet service should return directly after invoking this method.- Parameters:
response
- the HTTP responsestatus
- the error status code
-
sendError
protected void sendError(javax.servlet.http.HttpServletResponse response, int status, String message)
Sends an HTTP error to the client with the specified error code and error message. Once the error is sent, the HTTP response is consumed, and it cannot be used anymore; so the servlet service should return directly after invoking this method.- Parameters:
response
- the HTTP responsestatus
- the error status codemessage
- the message to pass in the response and giving details about the error.
-
preconditionFailed
protected SilverpeasHttpServlet.HttpError preconditionFailed(String msg)
-
forbidden
protected SilverpeasHttpServlet.HttpError forbidden(String msg)
-
notFound
protected SilverpeasHttpServlet.HttpError notFound(String msg)
-
-