com.sun.jersey.api.client
Class ViewResource

java.lang.Object
  extended by com.sun.jersey.api.client.filter.Filterable
      extended by com.sun.jersey.api.client.ViewResource
All Implemented Interfaces:
RequestBuilder<ViewResource.Builder>, ViewUniformInterface

public class ViewResource
extends Filterable
implements RequestBuilder<ViewResource.Builder>, ViewUniformInterface


Nested Class Summary
 class ViewResource.Builder
          The builder for building a ClientRequest instance and handling the request using the UniformInterface.
 
Method Summary
 ViewResource.Builder accept(MediaType... types)
          Add acceptable media types.
 ViewResource.Builder accept(java.lang.String... types)
          Add acceptable media types.
 ViewResource.Builder acceptLanguage(java.util.Locale... locales)
          Add acceptable languages
 ViewResource.Builder acceptLanguage(java.lang.String... locales)
          Add acceptable languages
 ViewResource.Builder cookie(Cookie cookie)
          Add a cookie to be set.
<T> T
delete(java.lang.Class<T> c)
           
<T> T
delete(java.lang.Class<T> c, java.lang.Object requestEntity)
           
<T> T
delete(T t)
           
<T> T
delete(T t, java.lang.Object requestEntity)
           
 ViewResource.Builder entity(java.lang.Object entity)
          Set the request entity.
 ViewResource.Builder entity(java.lang.Object entity, MediaType type)
          Set the request entity with its media type.
 ViewResource.Builder entity(java.lang.Object entity, java.lang.String type)
          Set the request entity with its media type.
 boolean equals(java.lang.Object obj)
          Compares this resource to the specified object.
<T> T
get(java.lang.Class<T> c)
           
<T> T
get(T t)
           
 ViewResource.Builder getRequestBuilder()
          Get the ClientRequest builder.
 java.net.URI getURI()
          Get the URI to the resource.
 UriBuilder getUriBuilder()
          Get the URI builder to the resource.
 int hashCode()
          Returns a hash code for this WebResource.
<T> T
head(java.lang.Class<T> c)
           
<T> T
head(T t)
           
 ViewResource.Builder header(java.lang.String name, java.lang.Object value)
          Add an HTTP header and value.
<T> T
method(java.lang.String method, java.lang.Class<T> c)
           
<T> T
method(java.lang.String method, java.lang.Class<T> c, java.lang.Object requestEntity)
           
<T> T
method(java.lang.String method, T t)
           
<T> T
method(java.lang.String method, T t, java.lang.Object requestEntity)
           
<T> T
options(java.lang.Class<T> c)
           
<T> T
options(T t)
           
 ViewResource path(java.lang.String path)
          Create a new WebResource from this web resource with an additional path added to the URI of this web resource.
<T> T
post(java.lang.Class<T> c)
           
<T> T
post(java.lang.Class<T> c, java.lang.Object requestEntity)
           
<T> T
post(T t)
           
<T> T
post(T t, java.lang.Object requestEntity)
           
<T> T
put(java.lang.Class<T> c)
           
<T> T
put(java.lang.Class<T> c, java.lang.Object requestEntity)
           
<T> T
put(T t)
           
<T> T
put(T t, java.lang.Object requestEntity)
           
 ViewResource queryParam(java.lang.String key, java.lang.String value)
          Create a new WebResource from this web resource with an additional query parameter added to the URI of this web resource.
 ViewResource queryParams(MultivaluedMap<java.lang.String,java.lang.String> params)
          Create a new WebResource from this web resource with additional query parameters added to the URI of this web resource.
 java.lang.String toString()
           
 ViewResource.Builder type(MediaType type)
          Set the media type.
 ViewResource.Builder type(java.lang.String type)
          Set the media type.
 ViewResource uri(java.net.URI uri)
          Create a new WebResource from this web resource.
 
Methods inherited from class com.sun.jersey.api.client.filter.Filterable
addFilter, getHeadHandler, isFilterPresent, isFilterPreset, removeAllFilters, removeFilter
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Method Detail

getURI

public java.net.URI getURI()
Get the URI to the resource.

Returns:
the URI.

getUriBuilder

public UriBuilder getUriBuilder()
Get the URI builder to the resource.

Returns:
the URI builder.

getRequestBuilder

public ViewResource.Builder getRequestBuilder()
Get the ClientRequest builder.

Returns:
the ClientRequest builder.

toString

public java.lang.String toString()
Overrides:
toString in class java.lang.Object
Returns:
the URI as a String instance

hashCode

public int hashCode()
Returns a hash code for this WebResource.

The hash code is the hash code of URI of this WebResource.

Overrides:
hashCode in class java.lang.Object
Returns:
a hash code for this WebResource.

equals

public boolean equals(java.lang.Object obj)
Compares this resource to the specified object.

The result is true if and only if the argument is not null and is a WebResource object whose URI is equal to the URI of this WebResource.

Overrides:
equals in class java.lang.Object
Parameters:
obj - the object to compare this WebResource against.
Returns:
true if the WebResource are equal; false otherwise.

head

public <T> T head(java.lang.Class<T> c)
Specified by:
head in interface ViewUniformInterface

head

public <T> T head(T t)
Specified by:
head in interface ViewUniformInterface

options

public <T> T options(java.lang.Class<T> c)
Specified by:
options in interface ViewUniformInterface

options

public <T> T options(T t)
Specified by:
options in interface ViewUniformInterface

get

public <T> T get(java.lang.Class<T> c)
Specified by:
get in interface ViewUniformInterface

get

public <T> T get(T t)
Specified by:
get in interface ViewUniformInterface

put

public <T> T put(java.lang.Class<T> c)
Specified by:
put in interface ViewUniformInterface

put

public <T> T put(T t)
Specified by:
put in interface ViewUniformInterface

put

public <T> T put(java.lang.Class<T> c,
                 java.lang.Object requestEntity)
Specified by:
put in interface ViewUniformInterface

put

public <T> T put(T t,
                 java.lang.Object requestEntity)
Specified by:
put in interface ViewUniformInterface

post

public <T> T post(java.lang.Class<T> c)
Specified by:
post in interface ViewUniformInterface

post

public <T> T post(T t)
Specified by:
post in interface ViewUniformInterface

post

public <T> T post(java.lang.Class<T> c,
                  java.lang.Object requestEntity)
Specified by:
post in interface ViewUniformInterface

post

public <T> T post(T t,
                  java.lang.Object requestEntity)
Specified by:
post in interface ViewUniformInterface

delete

public <T> T delete(java.lang.Class<T> c)
Specified by:
delete in interface ViewUniformInterface

delete

public <T> T delete(T t)
Specified by:
delete in interface ViewUniformInterface

delete

public <T> T delete(java.lang.Class<T> c,
                    java.lang.Object requestEntity)
Specified by:
delete in interface ViewUniformInterface

delete

public <T> T delete(T t,
                    java.lang.Object requestEntity)
Specified by:
delete in interface ViewUniformInterface

method

public <T> T method(java.lang.String method,
                    java.lang.Class<T> c)
Specified by:
method in interface ViewUniformInterface

method

public <T> T method(java.lang.String method,
                    T t)
Specified by:
method in interface ViewUniformInterface

method

public <T> T method(java.lang.String method,
                    java.lang.Class<T> c,
                    java.lang.Object requestEntity)
Specified by:
method in interface ViewUniformInterface

method

public <T> T method(java.lang.String method,
                    T t,
                    java.lang.Object requestEntity)
Specified by:
method in interface ViewUniformInterface

entity

public ViewResource.Builder entity(java.lang.Object entity)
Description copied from interface: RequestBuilder
Set the request entity.

Any Java type instance for a request entity, that is supported by the client configuration of the client, can be passed. If generic information is required then an instance of GenericEntity may be used.

Specified by:
entity in interface RequestBuilder<ViewResource.Builder>
Parameters:
entity - the request entity
Returns:
the builder.

entity

public ViewResource.Builder entity(java.lang.Object entity,
                                   MediaType type)
Description copied from interface: RequestBuilder
Set the request entity with its media type.

Any Java type instance for a request entity, that is supported by the client configuration of the client, can be passed. If generic information is required then an instance of GenericEntity may be used.

Specified by:
entity in interface RequestBuilder<ViewResource.Builder>
Parameters:
entity - the request entity
type - the media type
Returns:
the builder.

entity

public ViewResource.Builder entity(java.lang.Object entity,
                                   java.lang.String type)
Description copied from interface: RequestBuilder
Set the request entity with its media type.

Any Java type instance for a request entity, that is supported by the client configuration of the client, can be passed. If generic information is required then an instance of GenericEntity may be used.

Specified by:
entity in interface RequestBuilder<ViewResource.Builder>
Parameters:
entity - the request entity
type - the media type
Returns:
the builder.

type

public ViewResource.Builder type(MediaType type)
Description copied from interface: RequestBuilder
Set the media type.

Specified by:
type in interface RequestBuilder<ViewResource.Builder>
Parameters:
type - the media type
Returns:
the builder.

type

public ViewResource.Builder type(java.lang.String type)
Description copied from interface: RequestBuilder
Set the media type.

Specified by:
type in interface RequestBuilder<ViewResource.Builder>
Parameters:
type - the media type
Returns:
the builder.

accept

public ViewResource.Builder accept(MediaType... types)
Description copied from interface: RequestBuilder
Add acceptable media types.

Specified by:
accept in interface RequestBuilder<ViewResource.Builder>
Parameters:
types - an array of the acceptable media types
Returns:
the builder.

accept

public ViewResource.Builder accept(java.lang.String... types)
Description copied from interface: RequestBuilder
Add acceptable media types.

Specified by:
accept in interface RequestBuilder<ViewResource.Builder>
Parameters:
types - an array of the acceptable media types
Returns:
the builder.

acceptLanguage

public ViewResource.Builder acceptLanguage(java.util.Locale... locales)
Description copied from interface: RequestBuilder
Add acceptable languages

Specified by:
acceptLanguage in interface RequestBuilder<ViewResource.Builder>
Parameters:
locales - an array of the acceptable languages
Returns:
the builder.

acceptLanguage

public ViewResource.Builder acceptLanguage(java.lang.String... locales)
Description copied from interface: RequestBuilder
Add acceptable languages

Specified by:
acceptLanguage in interface RequestBuilder<ViewResource.Builder>
Parameters:
locales - an array of the acceptable languages
Returns:
the builder.

cookie

public ViewResource.Builder cookie(Cookie cookie)
Description copied from interface: RequestBuilder
Add a cookie to be set.

Specified by:
cookie in interface RequestBuilder<ViewResource.Builder>
Parameters:
cookie - to be set.
Returns:
the builder

header

public ViewResource.Builder header(java.lang.String name,
                                   java.lang.Object value)
Description copied from interface: RequestBuilder
Add an HTTP header and value.

Specified by:
header in interface RequestBuilder<ViewResource.Builder>
Parameters:
name - the HTTP header name.
value - the HTTP header value.
Returns:
the builder.

path

public ViewResource path(java.lang.String path)
Create a new WebResource from this web resource with an additional path added to the URI of this web resource.

Any filters on this web resource are inherited. Removal of filters may cause undefined behaviour.

Parameters:
path - the additional path.
Returns:
the new web resource.

uri

public ViewResource uri(java.net.URI uri)
Create a new WebResource from this web resource.

If the URI contains a path component and the path starts with a '/' then the path of this web resource URI is replaced. Otherwise the path is appended.

If the URI contains query parameters then those query parameters will replace the query parameters (if any) of this web resource.

Any filters on this web resource are inherited. Removal of filters may cause undefined behaviour.

Parameters:
uri - the URI.
Returns:
the new web resource.

queryParam

public ViewResource queryParam(java.lang.String key,
                               java.lang.String value)
Create a new WebResource from this web resource with an additional query parameter added to the URI of this web resource.

Parameters:
key - the query parameter name
value - the query parameter value
Returns:
the new web resource.

queryParams

public ViewResource queryParams(MultivaluedMap<java.lang.String,java.lang.String> params)
Create a new WebResource from this web resource with additional query parameters added to the URI of this web resource.

Parameters:
params - the query parameters.
Returns:
the new web resource.


Copyright © 2013 Oracle Corporation. All Rights Reserved.