public class RequestScopedResourceModelCache extends Object implements javax.servlet.Filter
Modifier and Type | Class and Description |
---|---|
static interface |
RequestScopedResourceModelCache.Configuration |
Constructor and Description |
---|
RequestScopedResourceModelCache() |
Modifier and Type | Method and Description |
---|---|
protected void |
activate(RequestScopedResourceModelCache.Configuration configuration) |
void |
destroy() |
void |
doFilter(javax.servlet.ServletRequest request,
javax.servlet.ServletResponse response,
javax.servlet.FilterChain chain) |
<T> Optional<T> |
get(org.apache.sling.api.resource.Resource resource,
Key key)
Retrieve a cached model.
|
void |
init(javax.servlet.FilterConfig filterConfig) |
<T> void |
put(org.apache.sling.api.resource.Resource resource,
Key key,
T model) |
protected void activate(RequestScopedResourceModelCache.Configuration configuration)
@CheckForNull public <T> Optional<T> get(@Nonnull org.apache.sling.api.resource.Resource resource, @Nonnull Key key)
resource
- The resource adapted
to the target type. Never null
.key
- The key used to identify the stored model. Never null
.Optional.isPresent()
,
or null
, signaling that the key is not known to the cache.public <T> void put(@Nonnull org.apache.sling.api.resource.Resource resource, @Nonnull Key key, @CheckForNull T model)
resource
- The resource adapted
to the target type. Never null
.model
- the model representing the mapped result of the adaptation. Can be null
.key
- the key by which the model is identified and get(Resource, Key)
retrieved}. Never null
.public void doFilter(@Nonnull javax.servlet.ServletRequest request, @Nonnull javax.servlet.ServletResponse response, @Nonnull javax.servlet.FilterChain chain) throws IOException, javax.servlet.ServletException
doFilter
in interface javax.servlet.Filter
IOException
javax.servlet.ServletException
public void init(javax.servlet.FilterConfig filterConfig)
init
in interface javax.servlet.Filter
public void destroy()
destroy
in interface javax.servlet.Filter
Copyright © 2024. All rights reserved.