| 
 | ||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectorg.apache.openjpa.persistence.jest.JESTContext
public class JESTContext
An operational context combines a persistence context and a HTTP execution
 context expressed as a request and response. 
 
 This context parses the HTTP request URL to identity the command and then 
 executes it.
| Field Summary | |
|---|---|
| protected static PrototypeFactory<String,JESTCommand> | _cf | 
| static Localizer | _loc | 
| protected  Log | _log | 
| protected  MetaDataRepository | _repos | 
| static String | CONTEXT_ROOT | 
| static String | JEST_TEMPLATE | 
| static char | QUERY_SEPARATOR | 
| Constructor Summary | |
|---|---|
| JESTContext(String unit,
            OpenJPAEntityManagerFactory emf,
            HttpServletRequest request,
            HttpServletResponse response) | |
| Method Summary | |
|---|---|
|  void | execute()Executes the request. | 
| (package private)  void | findResource(String rsrc)A resource is always looked up with respect to this class. | 
| static String | getAction(String path)Gets the action from the given path. | 
|  OpenJPAEntityManager | getPersistenceContext()Gets the persistence context. | 
|  String | getPersistenceUnitName()Gets the name of the persistence unit. | 
|  HttpServletRequest | getRequest()Gets the request. | 
|  String | getRequestURI()Get the requested URI. | 
|  HttpServletResponse | getResponse()Gets the response. | 
| (package private)  boolean | isContextRoot(String path)Is this path a context root? | 
| (package private)  boolean | isEmpty(String s) | 
|  void | log(short level,
    String message)Logging message. | 
|  ClassMetaData | resolve(String alias)Resolve the given alias to meta-data of the persistent type. | 
| Methods inherited from class java.lang.Object | 
|---|
| clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait | 
| Field Detail | 
|---|
protected MetaDataRepository _repos
protected Log _log
protected static PrototypeFactory<String,JESTCommand> _cf
public static final Localizer _loc
public static final char QUERY_SEPARATOR
public static final String CONTEXT_ROOT
public static final String JEST_TEMPLATE
| Constructor Detail | 
|---|
public JESTContext(String unit,
                   OpenJPAEntityManagerFactory emf,
                   HttpServletRequest request,
                   HttpServletResponse response)
| Method Detail | 
|---|
public String getPersistenceUnitName()
getPersistenceUnitName in interface JPAServletContextpublic OpenJPAEntityManager getPersistenceContext()
getPersistenceContext in interface JPAServletContextpublic HttpServletRequest getRequest()
getRequest in interface JPAServletContextpublic String getRequestURI()
JPAServletContext
getRequestURI in interface JPAServletContextpublic HttpServletResponse getResponse()
getResponse in interface JPAServletContext
public void execute()
             throws Exception
request path. 
 The first path segment is interpreted as action key, and
 if a action with the given key is registered then the control is delegated to the command.
 The command parses the entire request for requisite qualifiers and
 arguments and if the parse is successful then the command is 
 executed in this context.
 http://host:port/demo/jest/find?type=Actor&Robert
 jest.css stylesheet
 in its <head> section.<link ref="jest.css" .....> 
 http://host:port/demo/jest/find/jest.css
 
Exceptionpublic static String getAction(String path)
path - a string
'/' character. 
 Otherwise, if the path starts with context root, then returns the substring before the 
 next '/' character or end of the string, whichever is earlier. 
 If the path does not start with context root, returns 
 the substring before the first '/' character or end of the string, whichever is earlier.public ClassMetaData resolve(String alias)
JPAServletContext
resolve in interface JPAServletContextalias - a moniker for the Java type. It can be fully qualified type name or entity name
 or simple name of the actual persistent Java class.
void findResource(String rsrc)
            throws ProcessingException
rsrc - 
ProcessingException
public void log(short level,
                String message)
JPAServletContext
log in interface JPAServletContextlevel - OpenJPA defined log levels. Invalid levels will print the message on console.message - a printable message.boolean isContextRoot(String path)
path - 
boolean isEmpty(String s)
| 
 | ||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||