Interface EntityRequestHandler
-
public interface EntityRequestHandlerHandles the URL/request processing for an entity in a central location- Author:
- Aaron Zeckoski (aaron@caret.cam.ac.uk)
-
-
Field Summary
Fields Modifier and Type Field Description static StringBATCHThe reserved word used to trigger batch operationsstatic StringCOMPENSATE_METHODThis is the special indicator used to denote that POST should be translated to a PUT or DELETE in order to compensate for browser limitations, Example: /people/1?static StringDESCRIBEThe reserved word used to trigger entity descriptionsstatic StringFAKE_IDThe id used in generated URLsstatic StringHEADER_ENTITY_IDThis is the name of the header which will contain the id of newly created entitiesstatic StringHEADER_ENTITY_REFERENCEThis is the name of the header which will contain the reference of created/updated entitiesstatic StringHEADER_ENTITY_URLThis is the name of the header that will contain created/updated entities SHOW URLstatic StringSLASH_BATCHstatic StringSLASH_DESCRIBE
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description StringhandleEntityAccess(HttpServletRequest req, HttpServletResponse res, String path)Handles the servlet request response cycle for all direct servlet accesses, logically, we only want to let this request continue on if the entity exists AND there is an http access provider to handle it AND the user can access it (there is some auth completed already or no auth is required)StringhandleEntityError(HttpServletRequest req, Throwable error)Handles an error which occurs by sending an email and logging extra info about the failure
-
-
-
Field Detail
-
DESCRIBE
static final String DESCRIBE
The reserved word used to trigger entity descriptions- See Also:
- Constant Field Values
-
SLASH_DESCRIBE
static final String SLASH_DESCRIBE
- See Also:
- Constant Field Values
-
BATCH
static final String BATCH
The reserved word used to trigger batch operations- See Also:
- Constant Field Values
-
SLASH_BATCH
static final String SLASH_BATCH
- See Also:
- Constant Field Values
-
HEADER_ENTITY_ID
static final String HEADER_ENTITY_ID
This is the name of the header which will contain the id of newly created entities- See Also:
- Constant Field Values
-
HEADER_ENTITY_REFERENCE
static final String HEADER_ENTITY_REFERENCE
This is the name of the header which will contain the reference of created/updated entities- See Also:
- Constant Field Values
-
HEADER_ENTITY_URL
static final String HEADER_ENTITY_URL
This is the name of the header that will contain created/updated entities SHOW URL- See Also:
- Constant Field Values
-
FAKE_ID
static final String FAKE_ID
The id used in generated URLs- See Also:
- Constant Field Values
-
COMPENSATE_METHOD
static final String COMPENSATE_METHOD
This is the special indicator used to denote that POST should be translated to a PUT or DELETE in order to compensate for browser limitations, Example: /people/1?_method=PUT- See Also:
- Constant Field Values
-
-
Method Detail
-
handleEntityAccess
String handleEntityAccess(HttpServletRequest req, HttpServletResponse res, String path)
Handles the servlet request response cycle for all direct servlet accesses, logically, we only want to let this request continue on if the entity exists AND there is an http access provider to handle it AND the user can access it (there is some auth completed already or no auth is required)- Parameters:
req- the servlet requestres- the servlet responsepath- the path from the request (if null it will be generated from the req)- Returns:
- the entity reference that was handled as part of this request
- Throws:
EntityException- if entity could not be found or failure parsing
-
handleEntityError
String handleEntityError(HttpServletRequest req, Throwable error)
Handles an error which occurs by sending an email and logging extra info about the failure- Parameters:
req- the current requesterror- the current error that occurred- Returns:
- the comprehensive error message
-
-