public class StoreObjectHandler extends AStoreHandler
FACTORY, HEADER_REQUEST_HOST, HTTP_UTILS| Constructor and Description |
|---|
StoreObjectHandler() |
| Modifier and Type | Method and Description |
|---|---|
protected int |
getSuccessStatus(java.lang.String requestMethod,
java.lang.String requestUri,
Record inputRecord,
java.lang.Object resultObject)
Returns the success code.
|
protected boolean |
isValidMethod(java.lang.String method,
java.lang.String requestUri)
Checks if the handler allows the HTTP method.
|
protected Any |
listObjects(java.lang.String requestHost,
java.lang.String storeName,
java.lang.String objectIdPrefix)
list all objects with the given prefix.
|
java.lang.Object |
process(java.lang.String method,
java.lang.String requestUri,
Record inputRecord,
HttpExchange exchange)
process input record and return result object.
|
protected void |
putBonObject(java.lang.String storeName,
java.lang.String objectId,
Record inputRecord)
try to write one BON object to the object store.
|
protected BinaryObjectStreamIterator |
readBonBulk(java.lang.String storeName,
java.lang.String objectId)
try to read object as a BON bulk.
|
protected Any |
readJsonObject(java.lang.String storeName,
java.lang.String objectId)
try to read a single JSON object from the object store object.
|
protected void |
removeObject(java.lang.String storeName,
java.lang.String objectId,
Record inputRecord)
Remove object, input record is not needed here but in subclass.
|
protected void |
writeResultObject(java.io.OutputStream responseStream,
java.lang.Object resultObject)
write result object.
|
getErrorStatus, getObjectId, getObjectStoreService, getStoreName, setObjectStoreService, unsetObjectStoreServicegetRequestHost, getSuccessStatus, handle, process, writeErrorResult, writeSuccessResultactivate, getDynamicUriParts, getRootContextPath, getStaticUriParts, getUriPattern, matches, urlDecodeprotected boolean isValidMethod(java.lang.String method,
java.lang.String requestUri)
isValidMethod in class JsonRequestHandlermethod - HTTP methodrequestUri - request URIpublic java.lang.Object process(java.lang.String method,
java.lang.String requestUri,
Record inputRecord,
HttpExchange exchange)
throws java.lang.Exception
process in class JsonRequestHandlermethod - HTTP methodrequestUri - request URI.inputRecord - input record parsed either from request body, if it has content, or from request URI parameters.exchange - http exchange object, contains e.g. the http header fieldsRecord, you have to provide a
JsonRequestHandler.writeResultObject(OutputStream, Object) method, too.java.lang.Exception - any failure during processing.protected Any listObjects(java.lang.String requestHost, java.lang.String storeName, java.lang.String objectIdPrefix) throws ObjectStoreException
ObjectStoreExceptionprotected BinaryObjectStreamIterator readBonBulk(java.lang.String storeName, java.lang.String objectId) throws ObjectStoreException, java.io.IOException
ObjectStoreExceptionjava.io.IOExceptionprotected Any readJsonObject(java.lang.String storeName, java.lang.String objectId) throws ObjectStoreException, java.io.IOException
ObjectStoreExceptionjava.io.IOExceptionprotected void putBonObject(java.lang.String storeName,
java.lang.String objectId,
Record inputRecord)
throws ObjectStoreException
ObjectStoreExceptionprotected void removeObject(java.lang.String storeName,
java.lang.String objectId,
Record inputRecord)
throws ObjectStoreException
ObjectStoreExceptionprotected int getSuccessStatus(java.lang.String requestMethod,
java.lang.String requestUri,
Record inputRecord,
java.lang.Object resultObject)
getSuccessStatus in class JsonRequestHandlerrequestMethod - HTTP methodrequestUri - request URIinputRecord - input recordresultObject - result object returned from processprotected void writeResultObject(java.io.OutputStream responseStream,
java.lang.Object resultObject)
throws java.io.IOException
Record results. Subclasses that produce
different result types must override this method.writeResultObject in class JsonRequestHandlerresponseStream - response streamresultObject - result object.java.io.IOException - error writing result