public abstract class FedoraRequest<T> extends Object
| Constructor and Description |
|---|
FedoraRequest() |
| Modifier and Type | Method and Description |
|---|---|
void |
addHeader(String key,
String value)
Adds an HTTP header to this request.
|
protected void |
addQueryParam(String key,
String value) |
FedoraResponse |
execute()
Executes this request against the
DEFAULT_CLIENT |
abstract <F extends FedoraResponse> |
execute(FedoraClient fedora)
Execute this request using the supplied FedoraClient instance.
|
protected String |
getFirstQueryParam(String key) |
javax.ws.rs.core.MultivaluedMap<String,String> |
getHeaders()
Retrieves the current HTTP headers set on this request.
|
protected List<String> |
getQueryParam(String key) |
protected javax.ws.rs.core.MultivaluedMap<String,String> |
getQueryParams() |
static boolean |
isDefaultClientSet()
Return boolean indicating whether
DEFAULT_CLIENT has been set. |
void |
removeHeader(String key)
Removes all HTTP headers of a specified name to this request.
|
protected com.sun.jersey.api.client.WebResource |
resource()
|
protected com.sun.jersey.api.client.WebResource |
resource(FedoraClient fc)
Returns a
WebResource as supplied by the
FedoraClient fc using FedoraClient.resource(). |
protected com.sun.jersey.api.client.WebResource |
resource(FedoraClient fc,
String path)
Returns a
WebResource as supplied by the
FedoraClient fc using FedoraClient.resource(). |
protected com.sun.jersey.api.client.WebResource |
resource(String path)
|
static void |
setDefaultClient(FedoraClient client)
Set the instance of
FedoraClient that all FedoraRequests
should use by default. |
void |
setHeaders(javax.ws.rs.core.MultivaluedMap<String,String> headers)
Sets the current HTTP headers on this request.
|
T |
xParam(String key,
String value)
Add an arbitrary query parameter and value to the method.
|
public FedoraResponse execute() throws FedoraClientException
Executes this request against the DEFAULT_CLIENT
FedoraClientException - if DEFAULT_CLIENT is nullpublic static void setDefaultClient(FedoraClient client)
FedoraClient that all FedoraRequests
should use by default.client - the instance of FedoraClient that requests should use by defaultpublic static boolean isDefaultClientSet()
DEFAULT_CLIENT has been set.public abstract <F extends FedoraResponse> FedoraResponse execute(FedoraClient fedora) throws FedoraClientException
Execute this request using the supplied FedoraClient instance.
fedora - an instance of FedoraClientFedoraClientException - if the HTTP status code of the response is
>= 400.public T xParam(String key, String value)
Add an arbitrary query parameter and value to the method.
This method is intended as mild future-proofing, allowing fedora-client to be used with future or unreleased versions of Fedora that may support additional or different query parameters than fedora-client is aware of.
key - the query parameter namevalue - the valuepublic javax.ws.rs.core.MultivaluedMap<String,String> getHeaders()
MultivaluedMap of HTTP headers.public void setHeaders(javax.ws.rs.core.MultivaluedMap<String,String> headers)
headers - A MultivaluedMap of HTTP headers.public void addHeader(String key, String value)
key - The name of the HTTP header to set.value - The value of the HTTP header to set.public void removeHeader(String key)
key - The name of the HTTP header to remove.protected com.sun.jersey.api.client.WebResource resource()
throws FedoraClientException
Returns a WebResource as supplied by the
DEFAULT_CLIENT using FedoraClient.resource().
Also adds any headers as found via getHeaders() to the resource.
FedoraClientException - if DEFAULT_CLIENT is nullprotected com.sun.jersey.api.client.WebResource resource(String path) throws FedoraClientException
Returns a WebResource as supplied by the
DEFAULT_CLIENT using FedoraClient.resource().
Also adds any headers as found via getHeaders() to the resource.
path - the path to use for this resourceFedoraClientException - if DEFAULT_CLIENT is nullprotected com.sun.jersey.api.client.WebResource resource(FedoraClient fc)
Returns a WebResource as supplied by the
FedoraClient fc using FedoraClient.resource().
Also adds any headers as found via getHeaders() to the resource.
fc - the FedoraClient from which to get this resourceprotected com.sun.jersey.api.client.WebResource resource(FedoraClient fc, String path)
Returns a WebResource as supplied by the
FedoraClient fc using FedoraClient.resource().
Also adds any headers as found via getHeaders() to the resource.
fc - the FedoraClient from which to get this resourcepath - the path to use for this resourceCopyright © 2010-2013 MediaShelf. All Rights Reserved.