Announcement Announcement Module
No announcement yet.
Configuring Properties in XsltView Page Title Module
Move Remove Collapse
Conversation Detail Module
  • Filter
  • Time
  • Show
Clear All
new posts

  • Configuring Properties in XsltView

    I am trying to use XsltView to execute a style sheet to render an XML model into html.

    I see by default, the media type of the HttpResponse is set by XsltView to be whatever the properties are of the transformer's OutputKeys.MEDIA_TYPE is set to.

    I would like to be able to set this property from the Controller, something like:

    ModelAndView mav = new ModelAndView("hello",model);
    XsltView v = (XsltView)mav.getView();
    v.setOutputProperties(OutputKeys.MEDIA_TYPE, "text/html");

    Unfortunately, there appears to be no mechanism to set a single property, it is all or nothing. Worse, I cannot seem to find a getOutputProperties() that would allow me to modify only a single property by retrieving the current set, modify one of them, and then use setOutputProperties() to affect my change.

    What are my alternatives? Build a subclass of XsltView that hardcodes this customization?