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

Error in the detail view of the REST Showcase

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Major
    • Resolution: Fixed
    • 2.2.3
    • 2.3.1
    • Plugin - REST
    • 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

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

            Dates

              Created:
              Updated:
              Resolved: