Uploaded image for project: 'Struts 2'
  1. Struts 2
  2. WW-5060

Struts 2 Rest Plugin Conversion Issue

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Open
    • Major
    • Resolution: Unresolved
    • 2.3.1
    • 2.6.1
    • Other
    • None

    Description

       I integrated strust2 convention plugin and rest plugin.

      When a request come to server where my field is long and I am sending a string then default stacktrace occurs.

      I want to handle the exception from my side but before request come to any interceptor, it is throwing exception.

       

      My configuration :

      <bean type="org.apache.struts2.rest.handler.ContentTypeHandler" name="jackson" class="org.apache.struts2.rest.handler.JacksonLibHandler"/>
      <constant name="struts.rest.handlerOverride.json" value="jackson"/>

       

      <package name="sm" namespace="/sm/*" extends="rest-default, json-default">

      <result-types>
      <result-type name="tiles" class="org.apache.struts2.views.tiles.TilesResult" />
      <result-type name="eliteJson" class="com.elitecore.neoxemsippbx.coreneoxemsippbx.ep.util.EliteJsonResult" />
      </result-types>
      <interceptors>
      <interceptor name="transaction" class="com.elitecore.neoxemsippbx.system.interceptor.TransactionInterceptor"></interceptor>
      <interceptor name="audit" class="com.elitecore.neoxemsippbx.system.interceptor.AuditInterceptor" />
      <interceptor name="neoxRest" class="com.elitecore.neoxemsippbx.system.interceptor.CustomRestWorkflowInterceptor"/>
      <interceptor-stack name="restStack">
      <interceptor-ref name="transaction">
      <param name="excludeMethods">deleteConfirm,cacheServerGroups,validateRuleset</param>
      </interceptor-ref>
      <interceptor-ref name="audit"></interceptor-ref>
      <interceptor-ref name="restDefaultStack">
      <param name="restWorkflow.excludeMethods">*</param>
      </interceptor-ref>
      <interceptor-ref name="neoxRest"/>
      </interceptor-stack>

      </interceptors>
      <global-results>
      <result name="redirectAction" type="redirect">${actionChainUrl}</result>
      <result name="exception" type="tiles">commons/general/UnhandledException</result>
      <result name="error" type="tiles">commons/general/Error</result>
      <result name="unauthorize" type="tiles">${actionChainUrl}</result>
      <result name="serverManagerWelcome" type="tiles">ServerManagerWelcome</result>
      <result name="redirectURL" type="tiles">${actionChainUrl}</result>
      <result name="redirectURLWithoutCommit" type="tiles">${actionChainUrl}</result>
      <result name="genericPartnerSearch" type="tiles">_${actionChainUrl}</result>
      <result name="redirectUploadReport" type="tiles">${actionChainUrl}</result>
      <result name="dispatchView" type="tiles">${actionChainUrl}</result>
      <result name="subtableurl">${actionChainUrl}</result>
      <result name="ajaxSuccess" type="json"></result>
      <result name="ajaxError" type="json"></result>
      <result name="download" type="stream">
      <param name="contentDisposition">attachment;filename=${fileName}</param>
      <param name="contentType">$(contentType)</param>
      <param name="inputName">fileInputStream</param>
      <param name="bufferSize">1024</param>
      </result>

      <result name="SearchSuccess" type="eliteJson">
      <!-- ignoreHierarchy param is used to access parent property in json -->
      <param name="ignoreHierarchy">false</param>
      <!-- modelProperties Params is custom property which is used to pass
      dynamic includeProperites -->
      <param name="modelProperties">${includeSearchProperties}</param>
      </result>
      </global-results>

      <global-exception-mappings>
      <exception-mapping result="exception" exception="java.lang.Throwable"></exception-mapping>
      <exception-mapping result="exception" exception="java.lang.RuntimeException"></exception-mapping>
      </global-exception-mappings>
      </package>

      Attachments

        Activity

          People

            Unassigned Unassigned
            ronak.jain Ronak Jain
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

            Dates

              Created:
              Updated: