Details
-
Bug
-
Status: Closed
-
Major
-
Resolution: Fixed
-
2.2.3
-
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=""/>