Class ServiceUtils
- java.lang.Object
-
- org.openprovenance.prov.service.core.ServiceUtils
-
public class ServiceUtils extends Object
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static classServiceUtils.Actionstatic classServiceUtils.Destination
-
Field Summary
Fields Modifier and Type Field Description static StringACCESS_CONTROL_ALLOW_ORIGINstatic StringcontainerClassifierstatic StringcontainerVersionstatic StringDOCUMENT_NOT_FOUNDstatic StringHEADER_PARAM_ACCEPTstatic StringlongContainerVersionStringUPLOADED_FILE_PATHstatic StringWILDCARD
-
Constructor Summary
Constructors Constructor Description ServiceUtils()
-
Method Summary
Modifier and Type Method Description javax.ws.rs.core.ResponsecomposeResponseBadRequest(String result, Throwable thrown)javax.ws.rs.core.ResponsecomposeResponseError(javax.ws.rs.core.Response.Status status, String result, Throwable thrown)javax.ws.rs.core.ResponsecomposeResponseInternalServerError(String result, Throwable thrown)javax.ws.rs.core.ResponsecomposeResponseNotAcceptable(List<javax.ws.rs.core.Variant> vs)javax.ws.rs.core.ResponsecomposeResponseNotFOUND(String result)javax.ws.rs.core.ResponsecomposeResponseNotFOUND(String result, Throwable thrown)javax.ws.rs.core.ResponsecomposeResponseNotFoundConstraintResource(String msg)javax.ws.rs.core.ResponsecomposeResponseNotFoundDocument(String msg)javax.ws.rs.core.ResponsecomposeResponseNotFoundResource(String msg)javax.ws.rs.core.ResponsecomposeResponseNotFoundSummarisation(String msg)javax.ws.rs.core.ResponsecomposeResponseNotFoundType(String msg)javax.ws.rs.core.Response.ResponseBuildercomposeResponseOK(Object o)javax.ws.rs.core.Response.ResponseBuildercomposeResponseSeeOther(String uri)javax.ws.rs.core.ResponsecontentNegotiationForDocument(javax.ws.rs.core.Request request, String path)javax.ws.rs.core.ResponsecontentNegotiationForDocument(javax.ws.rs.core.Request request, String msg, String uriPath)FilecreateConfigurationFile()FilecreateTempFile(String extension)DocumentResourcedoProcessFile(InputStream inputStream, String mediaType)booleandoProcessFile(DocumentResource vr, boolean known)DocumentResourcedoProcessFileForm(List<org.jboss.resteasy.plugins.providers.multipart.InputPart> inputParts)DocumentResourcedoProcessStatementsForm(List<org.jboss.resteasy.plugins.providers.multipart.InputPart> inputParts, List<org.jboss.resteasy.plugins.providers.multipart.InputPart> type)DocumentResourcedoProcessURLForm(List<org.jboss.resteasy.plugins.providers.multipart.InputPart> inputParts)ServiceUtils.ActiongetAction(Map<String,List<org.jboss.resteasy.plugins.providers.multipart.InputPart>> formData)ServiceUtils.DestinationgetDestination(Map<String,List<org.jboss.resteasy.plugins.providers.multipart.InputPart>> formData)StringgetFileName(javax.ws.rs.core.MultivaluedMap<String,String> header)header sample { Content-Type=[image/png], Content-Disposition=[form-data; name="file"; filename="filename.extension"] }StringgetFormDataValue(Map<String,List<org.jboss.resteasy.plugins.providers.multipart.InputPart>> formData, String name)static StringgetRequestURL(javax.servlet.http.HttpServletRequest request, String api, String docId, String action)static booleanisNumeric(String str)static StringisSelf(String s, javax.ws.rs.core.UriInfo uInfo, String resource)voidprintStackTrace(PrintWriter pw, Throwable thrown)
-
-
-
Field Detail
-
DOCUMENT_NOT_FOUND
public static final String DOCUMENT_NOT_FOUND
- See Also:
- Constant Field Values
-
WILDCARD
public static final String WILDCARD
- See Also:
- Constant Field Values
-
ACCESS_CONTROL_ALLOW_ORIGIN
public static final String ACCESS_CONTROL_ALLOW_ORIGIN
- See Also:
- Constant Field Values
-
HEADER_PARAM_ACCEPT
public static final String HEADER_PARAM_ACCEPT
- See Also:
- Constant Field Values
-
UPLOADED_FILE_PATH
public final String UPLOADED_FILE_PATH
-
containerVersion
public static final String containerVersion
-
containerClassifier
public static final String containerClassifier
-
longContainerVersion
public static final String longContainerVersion
-
-
Method Detail
-
getDestination
public ServiceUtils.Destination getDestination(Map<String,List<org.jboss.resteasy.plugins.providers.multipart.InputPart>> formData) throws IOException
- Throws:
IOException
-
getFormDataValue
public String getFormDataValue(Map<String,List<org.jboss.resteasy.plugins.providers.multipart.InputPart>> formData, String name) throws IOException
- Throws:
IOException
-
getAction
public ServiceUtils.Action getAction(Map<String,List<org.jboss.resteasy.plugins.providers.multipart.InputPart>> formData) throws IOException
- Throws:
IOException
-
getRequestURL
public static String getRequestURL(javax.servlet.http.HttpServletRequest request, String api, String docId, String action)
-
isNumeric
public static boolean isNumeric(String str)
-
composeResponseNotFOUND
public javax.ws.rs.core.Response composeResponseNotFOUND(String result)
-
composeResponseBadRequest
public javax.ws.rs.core.Response composeResponseBadRequest(String result, Throwable thrown)
-
composeResponseNotFOUND
public javax.ws.rs.core.Response composeResponseNotFOUND(String result, Throwable thrown)
-
composeResponseError
public javax.ws.rs.core.Response composeResponseError(javax.ws.rs.core.Response.Status status, String result, Throwable thrown)
-
printStackTrace
public void printStackTrace(PrintWriter pw, Throwable thrown)
-
composeResponseInternalServerError
public javax.ws.rs.core.Response composeResponseInternalServerError(String result, Throwable thrown)
-
composeResponseSeeOther
public javax.ws.rs.core.Response.ResponseBuilder composeResponseSeeOther(String uri)
-
composeResponseOK
public javax.ws.rs.core.Response.ResponseBuilder composeResponseOK(Object o)
-
composeResponseNotAcceptable
public javax.ws.rs.core.Response composeResponseNotAcceptable(List<javax.ws.rs.core.Variant> vs)
-
composeResponseNotFoundDocument
public javax.ws.rs.core.Response composeResponseNotFoundDocument(String msg)
-
composeResponseNotFoundResource
public javax.ws.rs.core.Response composeResponseNotFoundResource(String msg)
-
composeResponseNotFoundConstraintResource
public javax.ws.rs.core.Response composeResponseNotFoundConstraintResource(String msg)
-
composeResponseNotFoundType
public javax.ws.rs.core.Response composeResponseNotFoundType(String msg)
-
composeResponseNotFoundSummarisation
public javax.ws.rs.core.Response composeResponseNotFoundSummarisation(String msg)
-
doProcessFile
public DocumentResource doProcessFile(InputStream inputStream, String mediaType)
-
doProcessFile
public boolean doProcessFile(DocumentResource vr, boolean known)
-
doProcessStatementsForm
public DocumentResource doProcessStatementsForm(List<org.jboss.resteasy.plugins.providers.multipart.InputPart> inputParts, List<org.jboss.resteasy.plugins.providers.multipart.InputPart> type)
-
doProcessFileForm
public DocumentResource doProcessFileForm(List<org.jboss.resteasy.plugins.providers.multipart.InputPart> inputParts)
-
doProcessURLForm
public DocumentResource doProcessURLForm(List<org.jboss.resteasy.plugins.providers.multipart.InputPart> inputParts)
-
createTempFile
public File createTempFile(String extension) throws IOException
- Throws:
IOException
-
createConfigurationFile
public File createConfigurationFile() throws IOException
- Throws:
IOException
-
getFileName
public String getFileName(javax.ws.rs.core.MultivaluedMap<String,String> header)
header sample { Content-Type=[image/png], Content-Disposition=[form-data; name="file"; filename="filename.extension"] }
-
contentNegotiationForDocument
public javax.ws.rs.core.Response contentNegotiationForDocument(javax.ws.rs.core.Request request, String msg, String uriPath) throws IllegalArgumentException- Throws:
IllegalArgumentException
-
contentNegotiationForDocument
public javax.ws.rs.core.Response contentNegotiationForDocument(javax.ws.rs.core.Request request, String path) throws IllegalArgumentException- Throws:
IllegalArgumentException
-
-