## com.sun.jersey.spi.container
Class CachedEntityContainerRequest

    java.lang.Object
      com.sun.jersey.spi.container.ContainerRequest
          com.sun.jersey.spi.container.AdaptingContainerRequest
              com.sun.jersey.spi.container.CachedEntityContainerRequest

All Implemented Interfaces:
  HttpRequestContext, Traceable, HttpHeaders, Request, SecurityContext

    public class CachedEntityContainerRequest

extends AdaptingContainerRequest

A cached entity in-bound HTTP request that caches the entity instance obtained from the adapted container request.

A filter may utilize this class if it requires an entity of a specific type and that same type will also be utilized by a resource method.

Author:
  Paul.Sandoz@Sun.Com

Field Summary

Fields inherited from class com.sun.jersey.spi.container.AdaptingContainerRequest
`acr`

Fields inherited from class com.sun.jersey.spi.container.ContainerRequest
`VARY_HEADER`

Fields inherited from interface javax.ws.rs.core.HttpHeaders
`ACCEPT, ACCEPT_CHARSET, ACCEPT_ENCODING, ACCEPT_LANGUAGE, AUTHORIZATION, CACHE_CONTROL, CONTENT_ENCODING, CONTENT_LANGUAGE, CONTENT_LENGTH, CONTENT_LOCATION, CONTENT_TYPE, COOKIE, DATE, ETAG, EXPIRES, HOST, IF_MATCH, IF_MODIFIED_SINCE, IF_NONE_MATCH, IF_UNMODIFIED_SINCE, LAST_MODIFIED, LOCATION, SET_COOKIE, USER_AGENT, VARY, WWW_AUTHENTICATE`

Fields inherited from interface javax.ws.rs.core.SecurityContext
`BASIC_AUTH, CLIENT_CERT_AUTH, DIGEST_AUTH, FORM_AUTH`

Constructor Summary
`CachedEntityContainerRequest(ContainerRequest acr)`

Method Summary

`

`<T> T`

`

`getEntity(java.lang.Class<T> type)`
Get the entity or a cached instance.

`

`<T> T`

`

`getEntity(java.lang.Class<T> type, java.lang.reflect.Type genericType, java.lang.annotation.Annotation[] as)`
Get the entity or a cached instance.

Methods inherited from class com.sun.jersey.spi.container.AdaptingContainerRequest

`evaluatePreconditions, evaluatePreconditions, evaluatePreconditions, evaluatePreconditions, getAbsolutePath, getAbsolutePathBuilder, getAcceptableLanguages, getAcceptableMediaType, getAcceptableMediaTypes, getAcceptableMediaTypes, getAuthenticationScheme, getBaseUri, getBaseUriBuilder, getCookieNameValueMap, getCookies, getEntityInputStream, getFormParameters, getHeaderValue, getLanguage, getMediaType, getMessageBodyWorkers, getMethod, getPath, getPath, getPathSegments, getPathSegments, getProperties, getQueryParameters, getQueryParameters, getRequestHeader, getRequestHeaders, getRequestUri, getRequestUriBuilder, getSecurityContext, getUserPrincipal, isSecure, isTracingEnabled, isUserInRole, selectVariant, setEntityInputStream, setHeaders, setMethod, setSecurityContext, setUris, trace`

Methods inherited from class com.sun.jersey.spi.container.ContainerRequest
`setEntity`

Methods inherited from class java.lang.Object
`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

Constructor Detail

### CachedEntityContainerRequest

    public CachedEntityContainerRequest(ContainerRequest acr)

Method Detail

### getEntity

    public <T> T getEntity(java.lang.Class<T> type)
                throws java.lang.ClassCastException

  Get the entity or a cached instance.

  Specified by:
    `getEntity` in interface `HttpRequestContext`
  Overrides:
    `getEntity` in class `AdaptingContainerRequest`
  Parameters:
    `type` - the type of entity
  Returns:
    If called for the first time obtain the entity from the adapting container request and cache the instance. If called for second or subsequent time return the cached instance.
  Throws:
    `java.lang.ClassCastException` - if the cached entity cannot be cast to the type requested.

### getEntity

    public <T> T getEntity(java.lang.Class<T> type,
                           java.lang.reflect.Type genericType,
                           java.lang.annotation.Annotation[] as)
                throws java.lang.ClassCastException

  Get the entity or a cached instance.

  Specified by:
    `getEntity` in interface `HttpRequestContext`
  Overrides:
    `getEntity` in class `AdaptingContainerRequest`
  Parameters:
    `type` - the type of entity
    `genericType` - type the generic type of entity, it is the responsibility of the callee to ensure that the type and generic type are consistent otherwise the behaviour of this method is undefined.
    `as` - the annotations associated with the type
  Returns:
    If called for the first time obtain the entity from the adapting container request and cache the instance. If called for second or subsequent time return the cached instance.
  Throws:
    `java.lang.ClassCastException` - if the cached entity cannot be cast to the type requested.

Copyright © 2017 Oracle Corporation. All Rights Reserved.