R
- the resource typepublic abstract class AbstractServletResourceReferenceHandler<R extends org.xwiki.resource.ResourceReference>
extends org.xwiki.resource.AbstractResourceReferenceHandler<org.xwiki.resource.ResourceType>
ResourceReferenceHandler
s that can handle servlet resource requests.Constructor and Description |
---|
AbstractServletResourceReferenceHandler() |
Modifier and Type | Method and Description |
---|---|
protected InputStream |
filterResource(R resourceReference,
InputStream resourceStream)
Filter the resource before sending it to the client.
|
protected String |
getContentType(InputStream resourceStream,
R resourceReference)
Computes the content type of the resource.
|
protected abstract String |
getResourceName(R resourceReference) |
protected abstract InputStream |
getResourceStream(R resourceReference) |
void |
handle(org.xwiki.resource.ResourceReference resourceReference,
org.xwiki.resource.ResourceReferenceHandlerChain chain) |
protected boolean |
isResourceAccessible(R resourceReference) |
protected boolean |
isResourceCacheable(R resourceReference) |
compareTo, getPriority, setPriority
public AbstractServletResourceReferenceHandler()
public void handle(org.xwiki.resource.ResourceReference resourceReference, org.xwiki.resource.ResourceReferenceHandlerChain chain) throws org.xwiki.resource.ResourceReferenceHandlerException
org.xwiki.resource.ResourceReferenceHandlerException
protected boolean isResourceAccessible(R resourceReference)
resourceReference
- the reference of the requested resourcetrue
if the specified resource is accessible, false
otherwiseprotected boolean isResourceCacheable(R resourceReference)
resourceReference
- a resource referencetrue
if the specified resource can be cached, false
otherwiseprotected abstract InputStream getResourceStream(R resourceReference)
resourceReference
- the reference of the requested resourceprotected abstract String getResourceName(R resourceReference)
resourceReference
- the reference of the requested resource@Unstable protected String getContentType(InputStream resourceStream, R resourceReference) throws IOException
TikaUtils.detect(InputStream, String)
based on the resource content and name.resourceStream
- the stream of the requested resourceresourceReference
- the reference of the request resourceIOException
- in case of error during the content type analysisprotected InputStream filterResource(R resourceReference, InputStream resourceStream) throws org.xwiki.resource.ResourceReferenceHandlerException
resourceReference
- the resource to filterresourceStream
- the resource contentorg.xwiki.resource.ResourceReferenceHandlerException
Copyright © 2004–2021 XWiki. All rights reserved.