public final class RestUtil extends Object
| Modifier and Type | Class and Description |
|---|---|
static class |
RestUtil.R
Response builder functions.
|
| Modifier and Type | Method and Description |
|---|---|
static javax.ws.rs.core.Response.ResponseBuilder |
fileResponse(File f,
Option<String> contentType,
Option<String> fileName)
Create a file response.
|
static javax.ws.rs.core.Response.ResponseBuilder |
fileResponse(File f,
String contentType,
Option<String> fileName)
Create a file response.
|
static String |
generateErrorResponse(ErrorCodeException e) |
static Tuple<String,String> |
getEndpointUrl(org.osgi.service.component.ComponentContext cc)
Return the endpoint's server URL and the service path by extracting the relevant parameters from the
ComponentContext.
|
static Tuple<String,String> |
getEndpointUrl(org.osgi.service.component.ComponentContext cc,
String serverUrlKey,
String servicePathKey)
Return the endpoint's server URL and the service path by extracting the relevant parameters from the
ComponentContext.
|
static javax.ws.rs.core.MediaType |
getResponseFormat(String format)
Deprecated.
|
static javax.ws.rs.core.MediaType |
getResponseType(String type)
Return JSON if
type == json, XML else. |
static javax.ws.rs.core.Response.ResponseBuilder |
partialFileResponse(File f,
String contentType,
Option<String> fileName,
String rangeHeader)
create a partial file response
|
static Monadics.ListMonadic<String> |
splitCommaSeparatedParam(Option<String> param)
Split a comma separated request param into a list of trimmed strings discarding any blank parts.
|
static javax.ws.rs.core.Response.ResponseBuilder |
streamResponse(InputStream in,
String contentType,
Option<Long> streamLength,
Option<String> fileName)
|
public static Tuple<String,String> getEndpointUrl(org.osgi.service.component.ComponentContext cc)
cc - ComponentContext to get configuration fromError - if the service path is not configured for this componentpublic static Tuple<String,String> getEndpointUrl(org.osgi.service.component.ComponentContext cc, String serverUrlKey, String servicePathKey)
cc - ComponentContext to get configuration fromserverUrlKey - Configuration key for the server URLservicePathKey - Configuration key for the service pathError - if the service path is not configured for this componentpublic static javax.ws.rs.core.Response.ResponseBuilder fileResponse(File f, String contentType, Option<String> fileName)
public static javax.ws.rs.core.Response.ResponseBuilder fileResponse(File f, Option<String> contentType, Option<String> fileName)
public static javax.ws.rs.core.Response.ResponseBuilder partialFileResponse(File f, String contentType, Option<String> fileName, String rangeHeader) throws IOException
f - the requested filecontentType - the contentType to sendfileName - the filename to sendrangeHeader - the range headerIOException - if something goes wrong@Deprecated public static javax.ws.rs.core.Response.ResponseBuilder streamResponse(InputStream in, String contentType, Option<Long> streamLength, Option<String> fileName)
RestUtil.R.ok(java.io.InputStream, String, org.opencastproject.util.data.Option, org.opencastproject.util.data.Option)
instead@Deprecated public static javax.ws.rs.core.MediaType getResponseFormat(String format)
getResponseType(String)format == json, XML else.public static javax.ws.rs.core.MediaType getResponseType(String type)
type == json, XML else.public static Monadics.ListMonadic<String> splitCommaSeparatedParam(Option<String> param)
x=comma,separated,,%20value -> ["comma", "separated", "value"]
public static String generateErrorResponse(ErrorCodeException e)
Copyright © 2009–2021 Opencast Project. All rights reserved.