Class DocumentViewCodecService
java.lang.Object
org.nuxeo.runtime.model.DefaultComponent
org.nuxeo.ecm.platform.url.service.DocumentViewCodecService
- All Implemented Interfaces:
Serializable
,DocumentViewCodecManager
,Adaptable
,Component
,Extensible
,TimestampedService
- See Also:
-
Field Summary
Modifier and TypeFieldDescriptionprotected final Map<String,
DocumentViewCodec> static final String
protected String
protected final Map<String,
DocumentViewCodecDescriptor> static final String
Fields inherited from class org.nuxeo.runtime.model.DefaultComponent
lastModified, name
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionvoid
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.getCodec()
Returns theDocumentViewCodec
with the given name ornull
if ot doesn't exist.Returns the default codec name.getDocumentViewFromUrl
(String url, boolean hasBaseUrl, String baseUrl) Returns a DocumentView applying for given url, or null.getDocumentViewFromUrl
(String codecName, String url, boolean hasBaseUrl, String baseUrl) Returns a DocumentView callingDocumentViewCodec.getDocumentViewFromUrl(String)
on codec with given name.protected DocumentView
getDocumentViewFromUrl
(DocumentViewCodec codec, String finalUrl) getUrlFromDocumentView
(String codecName, DocumentView docView, boolean needBaseUrl, String baseUrl) Returns an URL callingDocumentViewCodec.getUrlFromDocumentView(DocumentView)
on codec with given name.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) 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) Methods inherited from class org.nuxeo.runtime.model.DefaultComponent
activate, addRuntimeMessage, addRuntimeMessage, getDescriptor, getDescriptors, getLastModified, getRegistry, register, registerExtension, setLastModified, setModifiedNow, setName, start, stop, unregister, unregisterExtension
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface org.nuxeo.runtime.model.Component
getApplicationStartedOrder
-
Field Details
-
NAME
-
CODECS_EXTENSION_POINT
- See Also:
-
defaultCodecName
-
descriptors
-
codecs
-
-
Constructor Details
-
DocumentViewCodecService
public DocumentViewCodecService()
-
-
Method Details
-
deactivate
Description copied from interface:Component
Deactivates the component.This method is called by the runtime when a component is deactivated.
- Specified by:
deactivate
in interfaceComponent
- Overrides:
deactivate
in classDefaultComponent
- Parameters:
context
- the runtime context
-
getAdapter
Description copied from interface:Adaptable
Returns an object which is an instance of the given class associated with this object. Returnsnull
if no such object can be found.- Specified by:
getAdapter
in interfaceAdaptable
- Overrides:
getAdapter
in classDefaultComponent
- Parameters:
adapter
- the adapter class to look up- Returns:
- a object castable to the given class, or
null
if this object does not have an adapter for the given class
-
registerContribution
public void registerContribution(Object contribution, String extensionPoint, ComponentInstance contributor) - Overrides:
registerContribution
in classDefaultComponent
-
unregisterContribution
public void unregisterContribution(Object contribution, String extensionPoint, ComponentInstance contributor) - Overrides:
unregisterContribution
in classDefaultComponent
-
getDocumentViewCodecDescriptorNames
-
getDefaultCodecName
Description copied from interface:DocumentViewCodecManager
Returns the default codec name.This information is set on codec descriptors.
- Specified by:
getDefaultCodecName
in interfaceDocumentViewCodecManager
-
getCodec
-
getCodec
Description copied from interface:DocumentViewCodecManager
Returns theDocumentViewCodec
with the given name ornull
if ot doesn't exist.- Specified by:
getCodec
in interfaceDocumentViewCodecManager
-
getUrlFromDocumentView
Description copied from interface:DocumentViewCodecManager
Returns an URL applying for given document view, or null.Iterates over registered codecs, starting from the default codec, and if
DocumentViewCodec.handleDocumentView(DocumentView)
returns true, callsDocumentViewCodec.getUrlFromDocumentView(DocumentView)
. Stops iterating when a codec returns a non-null value. am docView the original document view from request- Specified by:
getUrlFromDocumentView
in interfaceDocumentViewCodecManager
- Parameters:
docView
- the original document view from requestneedBaseUrl
- boolean indicating if base url should be added to the url returned by the codec.baseUrl
- value of the base url.
-
getUrlFromDocumentView
public String getUrlFromDocumentView(String codecName, DocumentView docView, boolean needBaseUrl, String baseUrl) Description copied from interface:DocumentViewCodecManager
Returns an URL callingDocumentViewCodec.getUrlFromDocumentView(DocumentView)
on codec with given name.- Specified by:
getUrlFromDocumentView
in interfaceDocumentViewCodecManager
- Parameters:
codecName
- the codec name to usedocView
- the original document view from requestneedBaseUrl
- boolean indicating if base url should be added to the url returned by the codec.baseUrl
- value of the base url.
-
getUrlFromDocumentView
protected String getUrlFromDocumentView(DocumentViewCodec codec, DocumentView docView, boolean needBaseUrl, String baseUrl) -
getDocumentViewFromUrl
Description copied from interface:DocumentViewCodecManager
Returns a DocumentView applying for given url, or null.Iterates over registered codecs, starting from the default codec, and if
DocumentViewCodec.handleUrl(String)
returns true, callsDocumentViewCodec.getDocumentViewFromUrl(String)
. Stops iterating when a codec returns a non-null value.- Specified by:
getDocumentViewFromUrl
in interfaceDocumentViewCodecManager
- Parameters:
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.
-
getDocumentViewFromUrl
public DocumentView getDocumentViewFromUrl(String codecName, String url, boolean hasBaseUrl, String baseUrl) Description copied from interface:DocumentViewCodecManager
Returns a DocumentView callingDocumentViewCodec.getDocumentViewFromUrl(String)
on codec with given name.- Specified by:
getDocumentViewFromUrl
in interfaceDocumentViewCodecManager
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.
-
getUrlWithoutBase
-
getDocumentViewFromUrl
-