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

Error in the detail view of the REST Showcase

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Major
    • Resolution: Fixed
    • Affects Version/s: 2.2.3
    • Fix Version/s: 2.3.1
    • Component/s: Plugin - REST
    • Labels:
      None

      Description

      Invoking the detail view page [1] throws the following exception:

      org.apache.struts2.rest.DefaultHttpHeaders cannot be cast to
      java.lang.String

      RequestURI=/struts2-rest-showcase/orders/3
      Caused by:

      java.lang.ClassCastException: org.apache.struts2.rest.DefaultHttpHeaders
      cannot be cast to java.lang.String
      at
      com.opensymphony.xwork2.DefaultActionInvocation.invokeAction(DefaultActionInvocation.java:462)
      at
      com.opensymphony.xwork2.DefaultActionInvocation.invokeActionOnly(DefaultActionInvocation.java:291)
      at
      com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:254)
      at
      com.opensymphony.xwork2.interceptor.MethodFilterInterceptor.intercept(MethodFilterInterceptor.java:100)
      at
      com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:248)
      at
      com.opensymphony.xwork2.interceptor.MethodFilterInterceptor.intercept(MethodFilterInterceptor.java:100)

      This happens cause the RestActionProxyFactory uses the root ("/") as default namespace and RestActionMapper maps this kind of action along the empty ("") namespace.

      Adding the following xml code in the struts configuration file, could help (to be honest I don't know if there are any side effects).

      <constant name="struts.rest.namespace" value=""/>

      [1] http://localhost:8080/struts2-rest-showcase/orders/3

        Attachments

          Activity

            People

            • Assignee:
              maurizio.cucchiara Maurizio Cucchiara
              Reporter:
              maurizio.cucchiara Maurizio Cucchiara
            • Votes:
              0 Vote for this issue
              Watchers:
              0 Start watching this issue

              Dates

              • Due:
                Created:
                Updated:
                Resolved: