public class Resource extends Object
| Modifier and Type | Field and Description |
|---|---|
javax.servlet.ServletContext |
servletContext |
| Constructor and Description |
|---|
Resource() |
| Modifier and Type | Method and Description |
|---|---|
protected static Context |
createContext()
Create context to work with DSpace database.
|
protected String |
getActionString(int action)
Return string representation of values
org.dspace.core.Constants.{READ,WRITE,DELETE}.
|
protected String[] |
mySplit(String key)
Split string with regex ".".
|
protected static void |
processException(String message,
Context context)
Process exception, print message to logger error stream and abort DSpace
context.
|
protected void |
processFinally(Context context)
Process finally statement.
|
protected void |
writeStats(DSpaceObject dspaceObject,
UsageEvent.Action action,
String user_ip,
String user_agent,
String xforwardedfor,
javax.ws.rs.core.HttpHeaders headers,
javax.servlet.http.HttpServletRequest request,
Context context)
Records a statistics event about an object used via REST API.
|
protected static Context createContext() throws ContextException, SQLException
ContextException - Thrown in case of a problem creating context. Can be caused by
SQLException error in creating context or finding the user to
log in. Can be caused by AuthorizeException if there was a
problem authorizing the found user.SQLExceptionprotected void writeStats(DSpaceObject dspaceObject, UsageEvent.Action action, String user_ip, String user_agent, String xforwardedfor, javax.ws.rs.core.HttpHeaders headers, javax.servlet.http.HttpServletRequest request, Context context)
dspaceObject - DSpace object on which a request was performed.action - Action that was performed.user_ip - user_agent - xforwardedfor - headers - request - context - protected static void processException(String message, Context context) throws javax.ws.rs.WebApplicationException
message - Message, which will be printed to error stream.context - Context which must be aborted.javax.ws.rs.WebApplicationException - This exception is throw for user of REST api.protected void processFinally(Context context) throws javax.ws.rs.WebApplicationException
context - Context which must be aborted.javax.ws.rs.WebApplicationException - This exception is throw for user of REST api.protected String[] mySplit(String key)
key - String which will be splitted.protected String getActionString(int action)
action - Constant from org.dspace.core.Constants.*Copyright © 2016 DuraSpace. All rights reserved.