Content Application Developer Manual / Version 2101
Table Of ContentsRender objects of type com.coremedia.xml.Markup by including them from a FreeMarker template using:
<@cm.include self=self.text/>
This uses the class XmlMarkupView as a default view, which converts richtext to XHTML applying the following transformations:
internal links are converted to URIs pointing back into the CoreMedia CAE
links (
href
attributes in thexlink
namespace) without protocol and server are URL encodedanchor and image elements with
xlink href
attributes are converted to XHTMLa href
andimg src
.the CoreMedia richtext namespace is dropped from the elements
If you want to use your own transformations you have to proceed as follows:
Define your own view, plain for example, using a
Customizer
:
<customize:append id="addMarkupView" bean="programmedViews"> <map> <entry key="com.coremedia.xml.Markup#plain"> <bean ..../> </entry> </map> </customize:append>
Use XmlMarkupView as the implementation of the view, but apply a custom filter factory which creates a SAX filter chain per output. Proceed as follows:
Let your filter factory extend RichtextToHtmlFilterFactory.
Overwrite
#createFilters
and append your own transformations beforesuper.createFilters
.
public List createFilters(HttpServletRequest req, HttpServletResponse res, Markup markup, String view) { List result = new ArrayList(); result.add(new MyFilterForRichtext()); result.addAll(super.createFilters(req, res, markup, view)); }
Configure your filter factory in
cae-views.xml
as follows:
<entry key="com.coremedia.xml.Markup#plain"> <bean class="com.coremedia.objectserver.web.XmlMarkupView"> <property name="xmlFilterFactory"> <bean class="com.coremedia.objectserver.web. MyRichtextToHtmlFilterFactory"> <property name="idProvider" ref="idProvider"/> <property name="linkFormatter" ref="linkFormatter"/> </bean> </property> </bean> </entry>