public class DocumentViewCodecService extends DefaultComponent implements DocumentViewCodecManager
Modifier and Type | Field and Description |
---|---|
protected Map<String,DocumentViewCodec> |
codecs |
static String |
CODECS_EXTENSION_POINT |
protected String |
defaultCodecName |
protected Map<String,DocumentViewCodecDescriptor> |
descriptors |
static String |
NAME |
lastModified
Constructor and Description |
---|
DocumentViewCodecService() |
Modifier and Type | Method and Description |
---|---|
void |
deactivate(ComponentContext context)
Deactivates the component.
|
<T> T |
getAdapter(Class<T> adapter)
Returns an object which is an instance of the given class associated with this object.
|
DocumentViewCodec |
getCodec() |
DocumentViewCodec |
getCodec(String codecName) |
String |
getDefaultCodecName()
Returns the default codec name.
|
List<String> |
getDocumentViewCodecDescriptorNames() |
protected DocumentView |
getDocumentViewFromUrl(DocumentViewCodec codec,
String finalUrl) |
DocumentView |
getDocumentViewFromUrl(String url,
boolean hasBaseUrl,
String baseUrl)
Returns a DocumentView applying for given url, or null.
|
DocumentView |
getDocumentViewFromUrl(String codecName,
String url,
boolean hasBaseUrl,
String baseUrl)
Returns a DocumentView calling
DocumentViewCodec#getDocumentViewFromUrl(String, boolean, String) on codec
with given name. |
String |
getUrlFromDocumentView(DocumentView docView,
boolean needBaseUrl,
String baseUrl)
Returns an URL applying for given document view, or null.
|
protected String |
getUrlFromDocumentView(DocumentViewCodec codec,
DocumentView docView,
boolean needBaseUrl,
String baseUrl) |
String |
getUrlFromDocumentView(String codecName,
DocumentView docView,
boolean needBaseUrl,
String baseUrl)
Returns an URL calling
{@link DocumentViewCodec#getUrlFromDocumentView(DocumentView) on codec
with given name.
|
protected String |
getUrlWithoutBase(String url,
boolean hasBaseUrl,
String baseUrl) |
void |
registerContribution(Object contribution,
String extensionPoint,
ComponentInstance contributor) |
void |
unregisterContribution(Object contribution,
String extensionPoint,
ComponentInstance contributor) |
activate, applicationStarted, getApplicationStartedOrder, getLastModified, registerExtension, setLastModified, setModifiedNow, unregisterExtension
public static final String CODECS_EXTENSION_POINT
protected String defaultCodecName
protected final Map<String,DocumentViewCodecDescriptor> descriptors
protected final Map<String,DocumentViewCodec> codecs
public DocumentViewCodecService()
public void deactivate(ComponentContext context)
Component
This method is called by the runtime when a component is deactivated.
deactivate
in interface Component
deactivate
in class DefaultComponent
context
- the runtime contextpublic <T> T getAdapter(Class<T> adapter)
Adaptable
null
if no such object can be found.getAdapter
in interface Adaptable
getAdapter
in class DefaultComponent
adapter
- the adapter class to look upnull
if this object does not have an adapter for
the given classpublic void registerContribution(Object contribution, String extensionPoint, ComponentInstance contributor)
registerContribution
in class DefaultComponent
public void unregisterContribution(Object contribution, String extensionPoint, ComponentInstance contributor)
unregisterContribution
in class DefaultComponent
public List<String> getDocumentViewCodecDescriptorNames()
public String getDefaultCodecName()
DocumentViewCodecManager
This information is set on codec descriptors.
getDefaultCodecName
in interface DocumentViewCodecManager
public DocumentViewCodec getCodec()
public DocumentViewCodec getCodec(String codecName)
public String getUrlFromDocumentView(DocumentView docView, boolean needBaseUrl, String baseUrl)
DocumentViewCodecManager
Iterates over registered codecs, starting from the default codec, and if
DocumentViewCodec.handleDocumentView(DocumentView)
returns true, calls
DocumentViewCodec.getUrlFromDocumentView(DocumentView)
. Stops iterating when a codec returns a non-null
value. am docView the original document view from request
getUrlFromDocumentView
in interface DocumentViewCodecManager
docView
- the original document view from requestbaseUrl
- value of the base url.public String getUrlFromDocumentView(String codecName, DocumentView docView, boolean needBaseUrl, String baseUrl)
DocumentViewCodecManager
getUrlFromDocumentView
in interface DocumentViewCodecManager
docView
- the original document view from requestbaseUrl
- value of the base url.protected String getUrlFromDocumentView(DocumentViewCodec codec, DocumentView docView, boolean needBaseUrl, String baseUrl)
public DocumentView getDocumentViewFromUrl(String url, boolean hasBaseUrl, String baseUrl)
DocumentViewCodecManager
Iterates over registered codecs, starting from the default codec, and if
DocumentViewCodec.handleUrl(String)
returns true, calls
DocumentViewCodec.getDocumentViewFromUrl(String)
. Stops iterating when a codec returns a non-null value.
getDocumentViewFromUrl
in interface DocumentViewCodecManager
url
- the original url from request, including request parameters if any.hasBaseUrl
- boolean indicating if base url should be removed from given url.baseUrl
- value of the base url.public DocumentView getDocumentViewFromUrl(String codecName, String url, boolean hasBaseUrl, String baseUrl)
DocumentViewCodecManager
DocumentViewCodec#getDocumentViewFromUrl(String, boolean, String)
on codec
with given name.getDocumentViewFromUrl
in interface DocumentViewCodecManager
url
- the original url from request, including request parameters if any.hasBaseUrl
- boolean indicating if base url should be removed from given url.baseUrl
- value of the base url.protected String getUrlWithoutBase(String url, boolean hasBaseUrl, String baseUrl)
protected DocumentView getDocumentViewFromUrl(DocumentViewCodec codec, String finalUrl)
Copyright © 2016 Nuxeo SA. All rights reserved.