org.apache.openjpa.persistence.jest
Class JESTServlet
java.lang.Object
javax.servlet.GenericServlet
javax.servlet.http.HttpServlet
org.apache.openjpa.persistence.jest.JESTServlet
- All Implemented Interfaces:
- Serializable, Servlet, ServletConfig
public class JESTServlet
- extends HttpServlet
A specialized HTTP servlet to interpret HTTP requests as Java Persistent API commands
on a running persistence unit. The persistence unit is identified by the name of the
unit and is supplied to this servlet during its initialization. The component using
the persistent unit and this servlet must be within the same module scope.
The syntax of the request URL is described in
OpenJPA web site.
The response to a resource request is represented in various format, namely
XML, JSON or a JavaScript that will dynamically render in the browser. The format
can be controlled via the initialization parameter response.format
in
<init-param>
clause or per request basis via format=xml|dojo|json
encoded in the path expression of the Request URI.
Servlet initialization parameter
Parameter | Value |
persistence.unit | Name of the persistence unit. Mandatory |
response.format | Default format used for representation. Defaults to xml . |
- Author:
- Pinaki Poddar
- See Also:
- Serialized Form
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
INIT_PARA_UNIT
public static final String INIT_PARA_UNIT
- Servlet initialization parameter monikers
- See Also:
- Constant Field Values
INIT_PARA_STANDALONE
public static final String INIT_PARA_STANDALONE
- See Also:
- Constant Field Values
_loc
protected static Localizer _loc
JESTServlet
public JESTServlet()
init
public void init(ServletConfig config)
throws ServletException
- Specified by:
init
in interface Servlet
- Overrides:
init
in class GenericServlet
- Throws:
ServletException
doGet
public void doGet(HttpServletRequest request,
HttpServletResponse response)
throws ServletException,
IOException
- Peeks into the servlet path of the request to create appropriate
JEST command
.
Passes the request on to the command which is responsible for generating a response.
- Overrides:
doGet
in class HttpServlet
- Throws:
ServletException
IOException
createPersistenceUnit
protected void createPersistenceUnit()
throws ServletException
- Throws:
ServletException
findPersistenceUnit
protected boolean findPersistenceUnit()
handleError
protected void handleError(JPAServletContext ctx,
Throwable t)
throws IOException
- Throws:
IOException
destroy
public void destroy()
- Specified by:
destroy
in interface Servlet
- Overrides:
destroy
in class GenericServlet
log
public void log(String s)
- Overrides:
log
in class GenericServlet
Copyright © 2006-2012 Apache Software Foundation. All Rights Reserved.