com.sun.jersey.api.client
Class AsyncViewResource

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

public class AsyncViewResource
extends Filterable
implements RequestBuilder<AsyncViewResource.Builder>, AsyncViewUniformInterface, AsyncClientHandler


Nested Class Summary
 class AsyncViewResource.Builder
          The builder for building a ClientRequest instance and handling the request using the UniformInterface.
 
Constructor Summary
protected AsyncViewResource(AsyncViewResource that, UriBuilder ub)
           
protected AsyncViewResource(Client c, java.net.URI u)
           
 
Method Summary
 AsyncViewResource.Builder accept(MediaType... types)
          Add acceptable media types.
 AsyncViewResource.Builder accept(java.lang.String... types)
          Add acceptable media types.
 AsyncViewResource.Builder acceptLanguage(java.util.Locale... locales)
          Add acceptable languages
 AsyncViewResource.Builder acceptLanguage(java.lang.String... locales)
          Add acceptable languages
 AsyncViewResource.Builder cookie(Cookie cookie)
          Add a cookie to be set.
<T> java.util.concurrent.Future<T>
delete(java.lang.Class<T> c)
           
<T> java.util.concurrent.Future<T>
delete(java.lang.Class<T> c, java.lang.Object requestEntity)
           
<T> java.util.concurrent.Future<T>
delete(T t)
           
<T> java.util.concurrent.Future<T>
delete(T t, java.lang.Object requestEntity)
           
 AsyncViewResource.Builder entity(java.lang.Object entity)
          Set the request entity.
 AsyncViewResource.Builder entity(java.lang.Object entity, MediaType type)
          Set the request entity with its media type.
 AsyncViewResource.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> java.util.concurrent.Future<T>
get(java.lang.Class<T> c)
           
<T> java.util.concurrent.Future<T>
get(T t)
           
 AsyncViewResource.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.
 java.util.concurrent.Future<ClientResponse> handle(ClientRequest request, FutureListener<ClientResponse> l)
          Invoke an asynchronous client request.
 int hashCode()
          Returns a hash code for this WebResource.
<T> java.util.concurrent.Future<T>
head(java.lang.Class<T> c)
           
<T> java.util.concurrent.Future<T>
head(T t)
           
 AsyncViewResource.Builder header(java.lang.String name, java.lang.Object value)
          Add an HTTP header and value.
<T> java.util.concurrent.Future<T>
method(java.lang.String method, java.lang.Class<T> c)
           
<T> java.util.concurrent.Future<T>
method(java.lang.String method, java.lang.Class<T> c, java.lang.Object requestEntity)
           
<T> java.util.concurrent.Future<T>
method(java.lang.String method, T t)
           
<T> java.util.concurrent.Future<T>
method(java.lang.String method, T t, java.lang.Object requestEntity)
           
<T> java.util.concurrent.Future<T>
options(java.lang.Class<T> c)
           
<T> java.util.concurrent.Future<T>
options(T t)
           
 AsyncViewResource 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> java.util.concurrent.Future<T>
post(java.lang.Class<T> c)
           
<T> java.util.concurrent.Future<T>
post(java.lang.Class<T> c, java.lang.Object requestEntity)
           
<T> java.util.concurrent.Future<T>
post(T t)
           
<T> java.util.concurrent.Future<T>
post(T t, java.lang.Object requestEntity)
           
<T> java.util.concurrent.Future<T>
put(java.lang.Class<T> c)
           
<T> java.util.concurrent.Future<T>
put(java.lang.Class<T> c, java.lang.Object requestEntity)
           
<T> java.util.concurrent.Future<T>
put(T t)
           
<T> java.util.concurrent.Future<T>
put(T t, java.lang.Object requestEntity)
           
 AsyncViewResource 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.
 AsyncViewResource 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()
           
 AsyncViewResource.Builder type(MediaType type)
          Set the media type.
 AsyncViewResource.Builder type(java.lang.String type)
          Set the media type.
 AsyncViewResource 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
 

Constructor Detail

AsyncViewResource

protected AsyncViewResource(Client c,
                            java.net.URI u)

AsyncViewResource

protected AsyncViewResource(AsyncViewResource that,
                            UriBuilder ub)
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 AsyncViewResource.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> java.util.concurrent.Future<T> head(java.lang.Class<T> c)
Specified by:
head in interface AsyncViewUniformInterface

head

public <T> java.util.concurrent.Future<T> head(T t)
Specified by:
head in interface AsyncViewUniformInterface

options

public <T> java.util.concurrent.Future<T> options(java.lang.Class<T> c)
Specified by:
options in interface AsyncViewUniformInterface

options

public <T> java.util.concurrent.Future<T> options(T t)
Specified by:
options in interface AsyncViewUniformInterface

get

public <T> java.util.concurrent.Future<T> get(java.lang.Class<T> c)
Specified by:
get in interface AsyncViewUniformInterface

get

public <T> java.util.concurrent.Future<T> get(T t)
Specified by:
get in interface AsyncViewUniformInterface

put

public <T> java.util.concurrent.Future<T> put(java.lang.Class<T> c)
Specified by:
put in interface AsyncViewUniformInterface

put

public <T> java.util.concurrent.Future<T> put(T t)
Specified by:
put in interface AsyncViewUniformInterface

put

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

put

public <T> java.util.concurrent.Future<T> put(T t,
                                              java.lang.Object requestEntity)
Specified by:
put in interface AsyncViewUniformInterface

post

public <T> java.util.concurrent.Future<T> post(java.lang.Class<T> c)
Specified by:
post in interface AsyncViewUniformInterface

post

public <T> java.util.concurrent.Future<T> post(T t)
Specified by:
post in interface AsyncViewUniformInterface

post

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

post

public <T> java.util.concurrent.Future<T> post(T t,
                                               java.lang.Object requestEntity)
Specified by:
post in interface AsyncViewUniformInterface

delete

public <T> java.util.concurrent.Future<T> delete(java.lang.Class<T> c)
Specified by:
delete in interface AsyncViewUniformInterface

delete

public <T> java.util.concurrent.Future<T> delete(T t)
Specified by:
delete in interface AsyncViewUniformInterface

delete

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

delete

public <T> java.util.concurrent.Future<T> delete(T t,
                                                 java.lang.Object requestEntity)
Specified by:
delete in interface AsyncViewUniformInterface

method

public <T> java.util.concurrent.Future<T> method(java.lang.String method,
                                                 java.lang.Class<T> c)
Specified by:
method in interface AsyncViewUniformInterface

method

public <T> java.util.concurrent.Future<T> method(java.lang.String method,
                                                 T t)
Specified by:
method in interface AsyncViewUniformInterface

method

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

method

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

entity

public AsyncViewResource.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<AsyncViewResource.Builder>
Parameters:
entity - the request entity
Returns:
the builder.

entity

public AsyncViewResource.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<AsyncViewResource.Builder>
Parameters:
entity - the request entity
type - the media type
Returns:
the builder.

entity

public AsyncViewResource.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<AsyncViewResource.Builder>
Parameters:
entity - the request entity
type - the media type
Returns:
the builder.

type

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

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

type

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

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

accept

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

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

accept

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

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

acceptLanguage

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

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

acceptLanguage

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

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

cookie

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

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

header

public AsyncViewResource.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<AsyncViewResource.Builder>
Parameters:
name - the HTTP header name.
value - the HTTP header value.
Returns:
the builder.

path

public AsyncViewResource 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 AsyncViewResource 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 AsyncViewResource 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 AsyncViewResource 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.

handle

public java.util.concurrent.Future<ClientResponse> handle(ClientRequest request,
                                                          FutureListener<ClientResponse> l)
Description copied from interface: AsyncClientHandler
Invoke an asynchronous client request. This method returns without waiting for the client response.

Specified by:
handle in interface AsyncClientHandler
Parameters:
request - the client request.
l - the future listener to receive a completed Future with the client response.
Returns:
a future that may be used to wait until the future completes and obtain the client response state, or cancel the request.


Copyright © 2013 Oracle Corporation. All Rights Reserved.