Package com.sodius.oslc.client
Interface OslcResource
-
public interface OslcResourceRepresents an OSLC resource, enabling the invocation of different HTTP methods.
This interface is not intended to be implemented by clients.
- See Also:
OslcClient.resource(URI)
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description OslcResourceaccept(String... values)Add values to the Accept header.OslcResourceaccept(MediaType... values)Add values to the Accept header.OslcResourceacceptLanguage(String... values)Add values to the Accept-Language header.OslcResourceacceptLanguage(Locale... values)Add values to the Accept-Language header.Objectattribute(String key)Get an attributeOslcResourceattribute(String key, Object value)Set an attribute on the resource.OslcResourcecontentType(String mediaType)Set the Content-Type header, overriding any previous value.OslcResourcecontentType(MediaType mediaType)Set the Content-Type header, overriding any previous value.OslcResourcecookie(String value)Add a Cookie value.OslcResourcecookie(Cookie value)Add a Cookie value.ClientResponsedelete()Invoke the DELETE methodClientResponseget()Invoke the GET methodUriBuildergetUriBuilder()Get theUriBuilderassociated with this resource.ClientResponsehead()Invoke the HEAD methodOslcResourceheader(String name, String... values)Adds a request header to be used in every invocation, making sure that any existing header with the same name is removed before adding the new one.ClientResponseoptions()Invoke the OPTIONS methodClientResponsepatch(Object requestEntity)Executes a PATCH request on the OSLC resource.ClientResponsepost(Object requestEntity)Invoke the POST methodClientResponseput(Object requestEntity)Invoke the PUT methodOslcResourcequeryParam(String key, Object... values)Add a query parameter to the uriOslcResourcequeryParams(MultivaluedMap<String,String> params)Add all the query parameters from the provided multivalued map.OslcResourceuri(String uri)Set the uri of this resource and create a new UriBuilderOslcResourceuri(URI uri)Set the uri of this resource and create a new UriBuilder
-
-
-
Method Detail
-
header
OslcResource header(String name, String... values)
Adds a request header to be used in every invocation, making sure that any existing header with the same name is removed before adding the new one.- Parameters:
name- name of the header to add. the name of the header is case insensitive.values- the values of the header. All of the values will be added to the same header, separated by a commas (,).- Returns:
- this resource instance
- Since:
- 1.9.1
-
accept
OslcResource accept(String... values)
Add values to the Accept header.- Parameters:
values- accept header values to add- Returns:
- this resource instance
-
accept
OslcResource accept(MediaType... values)
Add values to the Accept header.- Parameters:
values- accept header values to add- Returns:
- this resource instance
-
acceptLanguage
OslcResource acceptLanguage(String... values)
Add values to the Accept-Language header.- Parameters:
values- accept-language header values to add- Returns:
- this resource instance
- Since:
- 3.2.0
-
acceptLanguage
OslcResource acceptLanguage(Locale... values)
Add values to the Accept-Language header.- Parameters:
values- accept-language header values to add- Returns:
- this resource instance
- Since:
- 3.2.0
-
cookie
OslcResource cookie(String value)
Add a Cookie value. Every call to this method will create a new Cookie header.- Parameters:
value- the cookie value to add- Returns:
- this resource instance
-
cookie
OslcResource cookie(Cookie value)
Add a Cookie value. Every call to this method will create a new Cookie header.- Parameters:
value- the cookie value to add- Returns:
- this resource instance
-
contentType
OslcResource contentType(String mediaType)
Set the Content-Type header, overriding any previous value.- Parameters:
mediaType- the content type to set- Returns:
- this resource instance
-
contentType
OslcResource contentType(MediaType mediaType)
Set the Content-Type header, overriding any previous value.- Parameters:
mediaType- the content type to set- Returns:
- this resource instance
-
queryParam
OslcResource queryParam(String key, Object... values)
Add a query parameter to the uri- Parameters:
key- the name of the query parametervalues- values of the query parameters. A query parameter will be added for every value- Returns:
- this resource instance
-
queryParams
OslcResource queryParams(MultivaluedMap<String,String> params)
Add all the query parameters from the provided multivalued map.- Parameters:
params- multivalued map of parameters.- Returns:
- this resource instance
-
attribute
OslcResource attribute(String key, Object value)
Set an attribute on the resource.- Parameters:
key- attribute keyvalue- attribute value- Returns:
- this resource instance
-
attribute
Object attribute(String key)
Get an attribute- Parameters:
key- attribute key- Returns:
- attribute value, or null if the attribute is not set
-
getUriBuilder
UriBuilder getUriBuilder()
Get theUriBuilderassociated with this resource. All modifications to the builder affect the uri of the resource- Returns:
- the
UriBuilderassociated with this resource
-
uri
OslcResource uri(URI uri)
Set the uri of this resource and create a new UriBuilder- Parameters:
uri- the new uri for this resource- Returns:
- this resource instance
-
uri
OslcResource uri(String uri)
Set the uri of this resource and create a new UriBuilder- Parameters:
uri- the new uri for this resource- Returns:
- this resource instance
-
head
ClientResponse head()
Invoke the HEAD method- Returns:
- the ClientResponse for the invocation
-
options
ClientResponse options()
Invoke the OPTIONS method- Returns:
- the ClientResponse for the invocation
-
get
ClientResponse get()
Invoke the GET method- Returns:
- the ClientResponse for the invocation
-
post
ClientResponse post(Object requestEntity)
Invoke the POST method- Parameters:
requestEntity- the request entity- Returns:
- the ClientResponse for the invocation
-
put
ClientResponse put(Object requestEntity)
Invoke the PUT method- Parameters:
requestEntity- the request entity- Returns:
- the ClientResponse for the invocation
-
delete
ClientResponse delete()
Invoke the DELETE method- Returns:
- the ClientResponse for the invocation
-
patch
ClientResponse patch(Object requestEntity)
Executes a PATCH request on the OSLC resource.- Parameters:
requestEntity- the entity to send as request payload.- Returns:
- the response of the request execution.
- Since:
- 1.2.0
-
-