public class RestResource extends Object
Modifier and Type | Field and Description |
---|---|
protected String |
API_KEY_CLIENT_ID |
protected String |
API_KEY_TOKEN |
protected String |
API_KEY_USER |
protected String |
apiClientId |
protected String |
apiToken |
protected String |
apiUser |
protected String |
AUTHENTICATION_PARAM_NAME |
protected String |
hmacHeader |
protected String |
querySessionId |
protected String |
REMOTE_USER_ID |
protected String |
REMOTE_USER_TOKEN |
protected String |
remoteUserId |
protected String |
remoteUserToken |
protected javax.servlet.http.HttpServletRequest |
request |
protected String |
sessionId |
protected String |
WOR_PARTNER_TOKEN |
protected String |
worPartnerToken |
Constructor and Description |
---|
RestResource() |
Modifier and Type | Method and Description |
---|---|
protected javax.ws.rs.core.Response |
addHeaders(javax.ws.rs.core.Response.ResponseBuilder response,
String fileName) |
protected String |
getThisServer(boolean includeContext) |
protected String |
getUserId()
Extract the User ID from header values in the resource request.
|
protected String |
getUserId(String sessionId)
Extract the User ID from a query parameter value or header values in the resource request.
|
protected RegistryPartner |
getWebPartner() |
protected void |
log(String userId,
String message)
Used to log user actions
|
protected String |
requireUserId()
Attempts to retrieve the identifier for the specific user
|
protected void |
requireUserIdOrWebPartner(String logMessage)
Requires either a valid user request or request from a web partner
|
protected RegistryPartner |
requireWebPartner() |
protected javax.ws.rs.core.Response |
respond(boolean success)
Create an empty
Response object. |
protected javax.ws.rs.core.Response |
respond(Object object)
Create a
Response object from an entity object. |
protected javax.ws.rs.core.Response |
respond(javax.ws.rs.core.Response.Status status)
Create an empty
Response object. |
protected javax.ws.rs.core.Response |
respond(javax.ws.rs.core.Response.Status status,
Object obj)
Create a
Response object from an entity object. |
protected final String AUTHENTICATION_PARAM_NAME
protected final String WOR_PARTNER_TOKEN
protected final String API_KEY_TOKEN
protected final String API_KEY_USER
protected final String API_KEY_CLIENT_ID
protected final String REMOTE_USER_TOKEN
protected final String REMOTE_USER_ID
@HeaderParam(value="X-ICE-WOR-Token") protected String worPartnerToken
@HeaderParam(value="X-ICE-API-Token-Client") protected String apiClientId
@HeaderParam(value="X-ICE-API-Token-User") protected String apiUser
@HeaderParam(value="X-ICE-API-Token") protected String apiToken
@HeaderParam(value="X-ICE-Authentication-SessionId") protected String sessionId
@HeaderParam(value="X-ICE-Remote-User-Token") protected String remoteUserToken
@HeaderParam(value="X-ICE-Remote-User-ID") protected String remoteUserId
@HeaderParam(value="Authorization") protected String hmacHeader
@QueryParam(value="sid") protected String querySessionId
@Context protected javax.servlet.http.HttpServletRequest request
protected String getUserId()
javax.ws.rs.WebApplicationException
- for unauthorized accessprotected String requireUserId()
javax.ws.rs.WebApplicationException
- with status 401 if the user id cannot be retrievedprotected void requireUserIdOrWebPartner(String logMessage)
logMessage
- log message for requestprotected String getThisServer(boolean includeContext)
protected String getUserId(String sessionId)
protected RegistryPartner requireWebPartner()
protected RegistryPartner getWebPartner()
protected javax.ws.rs.core.Response respond(javax.ws.rs.core.Response.Status status, Object obj)
Response
object from an entity object.status
- HTTP status codeobj
- entity in responsenull
protected javax.ws.rs.core.Response respond(Object object)
Response
object from an entity object.object
- entity in responsenull
, else a 200 OK response with the entityprotected javax.ws.rs.core.Response respond(javax.ws.rs.core.Response.Status status)
Response
object.status
- HTTP status code to use on the Responseprotected javax.ws.rs.core.Response respond(boolean success)
Response
object.success
- success/failure flagtrue
, otherwise a 500 error responseprotected void log(String userId, String message)
userId
- unique user identifiermessage
- log messageprotected javax.ws.rs.core.Response addHeaders(javax.ws.rs.core.Response.ResponseBuilder response, String fileName)
Copyright © 2017. All rights reserved.