com.silverpeas.util.web.servlet
Class AbstractRestServlet

java.lang.Object
  extended by javax.servlet.GenericServlet
      extended by javax.servlet.http.HttpServlet
          extended by com.silverpeas.util.web.servlet.AbstractRestServlet
All Implemented Interfaces:
Serializable, javax.servlet.Servlet, javax.servlet.ServletConfig

public abstract class AbstractRestServlet
extends javax.servlet.http.HttpServlet

See Also:
Serialized Form

Constructor Summary
AbstractRestServlet()
           
 
Method Summary
protected abstract  void create(RestRequest request, javax.servlet.http.HttpServletResponse response)
          Dispatches client requests to the protected create method if it is a creation.
protected abstract  void delete(RestRequest request, javax.servlet.http.HttpServletResponse response)
          Dispatches client requests to the protected delete method if it is a deletion.
protected abstract  void find(RestRequest request, javax.servlet.http.HttpServletResponse response)
          Dispatches client requests to the protected find method if it is a search.
protected  String getServletRequestPath()
          The path element in the request used to call the servlet.This method might be overriden for each instance - otherwise it returns the initialization parameter "request_path".
protected  void service(javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response)
           
protected abstract  void update(RestRequest request, javax.servlet.http.HttpServletResponse response)
          Dispatches client requests to the protected update method if it is an update.
 
Methods inherited from class javax.servlet.http.HttpServlet
doDelete, doGet, doHead, doOptions, doPost, doPut, doTrace, getLastModified, service
 
Methods inherited from class javax.servlet.GenericServlet
destroy, getInitParameter, getInitParameterNames, getServletConfig, getServletContext, getServletInfo, getServletName, init, init, log, log
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

AbstractRestServlet

public AbstractRestServlet()
Method Detail

getServletRequestPath

protected String getServletRequestPath()
The path element in the request used to call the servlet.This method might be overriden for each instance - otherwise it returns the initialization parameter "request_path".

Returns:
the path element in the request used to call the servlet.

service

protected void service(javax.servlet.http.HttpServletRequest request,
                       javax.servlet.http.HttpServletResponse response)
                throws javax.servlet.ServletException,
                       IOException
Overrides:
service in class javax.servlet.http.HttpServlet
Throws:
javax.servlet.ServletException
IOException

delete

protected abstract void delete(RestRequest request,
                               javax.servlet.http.HttpServletResponse response)
                        throws javax.servlet.ServletException,
                               IOException
Dispatches client requests to the protected delete method if it is a deletion. This method must be to overriden.

Parameters:
request - the rest request.
response - - the HttpServletResponse object that contains the response the servlet returns to the client
Throws:
javax.servlet.ServletException - - if the HTTP request cannot be handled.
IOException - - if an input or output error occurs while the servlet is handling the HTTP request .

create

protected abstract void create(RestRequest request,
                               javax.servlet.http.HttpServletResponse response)
                        throws javax.servlet.ServletException,
                               IOException
Dispatches client requests to the protected create method if it is a creation. This method must be to overriden.

Parameters:
request - the rest request.
response - - the HttpServletResponse object that contains the response the servlet returns to the client
Throws:
javax.servlet.ServletException - - if the HTTP request cannot be handled.
IOException - - if an input or output error occurs while the servlet is handling the HTTP request .

update

protected abstract void update(RestRequest request,
                               javax.servlet.http.HttpServletResponse response)
                        throws javax.servlet.ServletException,
                               IOException
Dispatches client requests to the protected update method if it is an update. This method must be to overriden.

Parameters:
request - the rest request.
response - - the HttpServletResponse object that contains the response the servlet returns to the client
Throws:
javax.servlet.ServletException - - if the HTTP request cannot be handled.
IOException - - if an input or output error occurs while the servlet is handling the HTTP request .

find

protected abstract void find(RestRequest request,
                             javax.servlet.http.HttpServletResponse response)
                      throws javax.servlet.ServletException,
                             IOException
Dispatches client requests to the protected find method if it is a search. This method must be to overriden.

Parameters:
request - the rest request.
response - - the HttpServletResponse object that contains the response the servlet returns to the client
Throws:
javax.servlet.ServletException - - if the HTTP request cannot be handled.
IOException - - if an input or output error occurs while the servlet is handling the HTTP request .


Copyright © 2016 Silverpeas. All Rights Reserved.