Child pages
  • S2-052

Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

  1. Disable handling XML pages and requests to such pages

    Code Block
    xml
    xml
    <constant name="struts.action.extension" value="xhtml,,json" />
  2. Override getContentType in XStreamHandler

    Code Block
    languagejava
    public class MyXStreamHandler extends XStreamHandler { public String getContentType() {
     return "not-exitingexisting-content-type-@;/&%$#@";
     }
    }
  3. Register the handler by overriding the one provided by the framework in your struts.xml

    Code Block
    xml
    xml
    <bean type="org.apache.struts2.rest.handler.ContentTypeHandler" name="myXStreamHandmer" class="com.company.MyXStreamHandler"/>
    <constant name="struts.rest.handlerOverride.xml" value="myXStreamHandler"/>

...