public class D1ResourceHandler
extends java.lang.Object
Modifier and Type | Field and Description |
---|---|
static byte |
DELETE
HTTP Verb DELETE
|
protected static java.lang.String |
FUNCTION_NAME_INSERT |
protected static java.lang.String |
FUNCTION_NAME_UPDATE |
static byte |
GET
HTTP Verb GET
|
protected MetacatHandler |
handler |
static byte |
HEAD
HTTP Verb HEAD
|
protected static org.apache.log4j.Logger |
logMetacat |
protected static int |
MAX_UPLOAD_SIZE
Maximum size of uploads, defaults to 1GB if not set in property file
|
protected java.util.Map<java.lang.String,java.util.List<java.lang.String>> |
multipartparams |
protected java.util.Hashtable<java.lang.String,java.lang.String[]> |
params |
static byte |
POST
HTTP Verb POST
|
static byte |
PUT
HTTP Verb PUT
|
protected javax.servlet.http.HttpServletRequest |
request |
protected static java.lang.String |
RESOURCE_ACCESS_RULES |
protected static java.lang.String |
RESOURCE_BASE_URL |
protected static java.lang.String |
RESOURCE_IS_AUTHORIZED |
protected static java.lang.String |
RESOURCE_LOG |
protected static java.lang.String |
RESOURCE_META |
protected static java.lang.String |
RESOURCE_OBJECTS |
protected static java.lang.String |
RESOURCE_QUERY |
protected static java.lang.String |
RESOURCE_VIEWS |
protected javax.servlet.http.HttpServletResponse |
response |
protected javax.servlet.ServletContext |
servletContext |
protected org.dataone.service.types.v1.Session |
session |
Constructor and Description |
---|
D1ResourceHandler(javax.servlet.ServletContext servletContext,
javax.servlet.http.HttpServletRequest request,
javax.servlet.http.HttpServletResponse response)
Initializes new instance by setting servlet context,request and response
|
Modifier and Type | Method and Description |
---|---|
protected java.util.Map<java.lang.String,java.io.File> |
collectMultipartFiles()
Process the MMP request that includes files for each param
|
protected void |
collectMultipartParams()
Parse string parameters from the mime multipart entity of the request.
|
static java.lang.String |
decode(java.lang.String s)
A method to decode the given string which is a part of a uri.
|
protected static java.lang.String[] |
findBoundaryString(java.io.InputStream is)
locate the boundary marker for an MMP
|
protected static java.io.File |
getTempDirectory()
return the directory where temp files are stored
|
void |
handle(byte httpVerb)
This function is called from REST API servlet and handles each request
|
protected void |
initMultipartParams()
Collect the multipart params from the request
|
protected void |
initParams()
copies request parameters to a hashtable which is given as argument to
native metacathandler functions
|
protected boolean |
isD1Enabled()
subclasses should provide a more useful implementation
|
protected java.lang.String |
parseTrailing(java.lang.String resource,
java.lang.String token) |
protected void |
printError(java.lang.String message,
javax.servlet.http.HttpServletResponse response)
Prints xml response
|
protected void |
serializeException(org.dataone.service.exceptions.BaseException e,
java.io.OutputStream out)
serialize a D1 exception using jibx
|
public static final byte GET
public static final byte POST
public static final byte PUT
public static final byte DELETE
public static final byte HEAD
protected static int MAX_UPLOAD_SIZE
protected static final java.lang.String RESOURCE_BASE_URL
protected static final java.lang.String RESOURCE_OBJECTS
protected static final java.lang.String RESOURCE_META
protected static final java.lang.String RESOURCE_LOG
protected static final java.lang.String RESOURCE_QUERY
protected static final java.lang.String RESOURCE_IS_AUTHORIZED
protected static final java.lang.String RESOURCE_ACCESS_RULES
protected static final java.lang.String RESOURCE_VIEWS
protected static final java.lang.String FUNCTION_NAME_INSERT
protected static final java.lang.String FUNCTION_NAME_UPDATE
protected javax.servlet.ServletContext servletContext
protected static org.apache.log4j.Logger logMetacat
protected MetacatHandler handler
protected javax.servlet.http.HttpServletRequest request
protected javax.servlet.http.HttpServletResponse response
protected java.util.Hashtable<java.lang.String,java.lang.String[]> params
protected java.util.Map<java.lang.String,java.util.List<java.lang.String>> multipartparams
protected org.dataone.service.types.v1.Session session
public D1ResourceHandler(javax.servlet.ServletContext servletContext, javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response)
public void handle(byte httpVerb)
httpVerb
- (GET, POST, PUT or DELETE)protected boolean isD1Enabled()
protected java.lang.String parseTrailing(java.lang.String resource, java.lang.String token)
protected void collectMultipartParams() throws java.io.IOException, org.apache.commons.fileupload.FileUploadException, java.lang.Exception
java.io.IOException
org.apache.commons.fileupload.FileUploadException
java.lang.Exception
protected java.util.Map<java.lang.String,java.io.File> collectMultipartFiles() throws org.dataone.service.exceptions.ServiceFailure, org.dataone.service.exceptions.InvalidRequest
org.dataone.service.exceptions.ServiceFailure
org.dataone.service.exceptions.InvalidRequest
protected void initParams()
protected void initMultipartParams() throws java.lang.Exception
java.lang.Exception
protected static java.lang.String[] findBoundaryString(java.io.InputStream is) throws java.io.IOException
is
- java.io.IOException
protected static java.io.File getTempDirectory()
protected void printError(java.lang.String message, javax.servlet.http.HttpServletResponse response)
message
- Message to be displayedresponse
- Servlet response that xml message will be printedprotected void serializeException(org.dataone.service.exceptions.BaseException e, java.io.OutputStream out)
e
- out
- public static java.lang.String decode(java.lang.String s)
s
- Copyright © 2020 Regents of the University of California. All Rights Reserved.