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, name| 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)
Returns the
DocumentViewCodec with the given name or null if ot doesn't exist. |
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, getDescriptor, getDescriptors, getLastModified, getRegistry, register, registerExtension, setLastModified, setModifiedNow, setName, start, stop, unregister, unregisterExtensionclone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitapplicationStarted, getApplicationStartedOrderpublic 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)
ComponentThis method is called by the runtime when a component is deactivated.
deactivate in interface Componentdeactivate in class DefaultComponentcontext - the runtime contextpublic <T> T getAdapter(Class<T> adapter)
Adaptablenull
if no such object can be found.getAdapter in interface AdaptablegetAdapter in class DefaultComponentadapter - 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 DefaultComponentpublic void unregisterContribution(Object contribution, String extensionPoint, ComponentInstance contributor)
unregisterContribution in class DefaultComponentpublic List<String> getDocumentViewCodecDescriptorNames()
public String getDefaultCodecName()
DocumentViewCodecManagerThis information is set on codec descriptors.
getDefaultCodecName in interface DocumentViewCodecManagerpublic DocumentViewCodec getCodec()
public DocumentViewCodec getCodec(String codecName)
DocumentViewCodecManagerDocumentViewCodec with the given name or null if ot doesn't exist.getCodec in interface DocumentViewCodecManagerpublic 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 DocumentViewCodecManagerdocView - the original document view from requestbaseUrl - value of the base url.public String getUrlFromDocumentView(String codecName, DocumentView docView, boolean needBaseUrl, String baseUrl)
DocumentViewCodecManagergetUrlFromDocumentView in interface DocumentViewCodecManagerdocView - 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 DocumentViewCodecManagerurl - 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)
DocumentViewCodecManagerDocumentViewCodec#getDocumentViewFromUrl(String, boolean, String) on codec
with given name.getDocumentViewFromUrl in interface DocumentViewCodecManagerurl - 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 © 2019 Nuxeo. All rights reserved.