You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@struts.apache.org by Johannes Geppert <jo...@apache.org> on 2011/04/27 20:11:22 UTC

Error in REST Showcase

I get following Error when I try out the Detail View in the REST Showcase:

http://localhost:8080/struts2-rest-showcase/orders/3

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)


When I change the show() Method in the OrdersController I get it work.

from

    public HttpHeaders show() {
        return new DefaultHttpHeaders("show");
    }

to 

    public String show() {
        return "show";
    }

Is this the right Solution? Does anyone knows why this Error happens in the
current version of REST Showcase?

Johannes

-----

--------------
web: http://www.jgeppert.com
twitter: http://twitter.com/jogep
--
View this message in context: http://struts.1045723.n5.nabble.com/Error-in-REST-Showcase-tp4344374p4344374.html
Sent from the Struts - Dev mailing list archive at Nabble.com.

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@struts.apache.org
For additional commands, e-mail: dev-help@struts.apache.org


Re: Error in REST Showcase

Posted by Maurizio Cucchiara <ma...@gmail.com>.
> I think we should open an issue.
done https://issues.apache.org/jira/browse/WW-3616
-- 
Maurizio Cucchiara

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@struts.apache.org
For additional commands, e-mail: dev-help@struts.apache.org


Re: Error in REST Showcase

Posted by Lukasz Lenart <lu...@googlemail.com>.
2011/4/28 Johannes Geppert <jo...@apache.org>:
> Solves the Problem. Can there be any other Side Effects?

Maybe, as it's a new feature, but that the users should inform us ;-)


Kind regards
-- 
Łukasz
+ 48 606 323 122 http://www.lenart.org.pl/
Warszawa JUG conference - Confitura http://confitura.pl/

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@struts.apache.org
For additional commands, e-mail: dev-help@struts.apache.org


Re: Error in REST Showcase

Posted by Johannes Geppert <jo...@apache.org>.
> Is this the side effect of that issue ? What do you think ? 
> https://issues.apache.org/jira/browse/WW-3590
I think this is the source of the Problem.

> Maybe just switching to "" as a default namespace for REST will solve 
> the problem ? 
    protected String namespace = "";
Solves the Problem. Can there be any other Side Effects?

Johannes

-----

--------------
web: http://www.jgeppert.com
twitter: http://twitter.com/jogep
--
View this message in context: http://struts.1045723.n5.nabble.com/Error-in-REST-Showcase-tp4344374p4346273.html
Sent from the Struts - Dev mailing list archive at Nabble.com.

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@struts.apache.org
For additional commands, e-mail: dev-help@struts.apache.org


Re: Error in REST Showcase

Posted by Lukasz Lenart <lu...@googlemail.com>.
2011/4/28 Maurizio Cucchiara <ma...@gmail.com>:
> Johannes,
> this happens cause the RestActionProxyFactory uses the root ("/") as
> default namespace and RestActionMapper maps this kind of action along
> the empty ("") namespace.
>
> if you try to insert the following xml code inside the struts
> configuration file, it works.
> <constant name="struts.rest.namespace" value=""/>

Is this the side effect of that issue ? What do you think ?
https://issues.apache.org/jira/browse/WW-3590

Maybe just switching to "" as a default namespace for REST will solve
the problem ?


Kind regards
-- 
Łukasz
+ 48 606 323 122 http://www.lenart.org.pl/
Warszawa JUG conference - Confitura http://confitura.pl/

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@struts.apache.org
For additional commands, e-mail: dev-help@struts.apache.org


Re: Error in REST Showcase

Posted by Maurizio Cucchiara <ma...@gmail.com>.
Johannes,
this happens cause the RestActionProxyFactory uses the root ("/") as
default namespace and RestActionMapper maps this kind of action along
the empty ("") namespace.

if you try to insert the following xml code inside the struts
configuration file, it works.
<constant name="struts.rest.namespace" value=""/>

I think we should open an issue.

On 28 April 2011 09:59, Johannes Geppert <jo...@apache.org> wrote:
>
> Another Question related to the REST Showcase/Plugin.
>
> If I correct the OrdersController like previous described.
>
> So i get a valid HTML Result when I call
>
> http://localhost:8080/struts2-rest-showcase/orders/3
>
> But when I try
>
> http://localhost:8080/struts2-rest-showcase/orders/3.json
>
> I get also a HTML Result instead of an JSON result which I expected.
>
> Is there something wrong or am I on a wrong way?
>
> Johannes
>
>
>
> -----
>
> --------------
> web: http://www.jgeppert.com
> twitter: http://twitter.com/jogep
> --
> View this message in context: http://struts.1045723.n5.nabble.com/Error-in-REST-Showcase-tp4344374p4345959.html
> Sent from the Struts - Dev mailing list archive at Nabble.com.
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: dev-unsubscribe@struts.apache.org
> For additional commands, e-mail: dev-help@struts.apache.org
>



--
Maurizio Cucchiara

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@struts.apache.org
For additional commands, e-mail: dev-help@struts.apache.org


Re: Error in REST Showcase

Posted by Frans Thamura <fr...@meruvian.org>.
will work on it ;)

stay tune..


F


On Thu, Apr 28, 2011 at 3:40 PM, Johannes Geppert <jo...@apache.org> wrote:
> @Frans
> We can create a JacksonLibHandler similar to the JsonLibHandler.
> Are you able to create an Issue and attach a Patch?
>
> Johannes
>
> -----
>
> --------------
> web: http://www.jgeppert.com
> twitter: http://twitter.com/jogep
> --
> View this message in context: http://struts.1045723.n5.nabble.com/Error-in-REST-Showcase-tp4344374p4346023.html
> Sent from the Struts - Dev mailing list archive at Nabble.com.
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: dev-unsubscribe@struts.apache.org
> For additional commands, e-mail: dev-help@struts.apache.org
>
>

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@struts.apache.org
For additional commands, e-mail: dev-help@struts.apache.org


Re: Error in REST Showcase

Posted by Johannes Geppert <jo...@apache.org>.
@Frans
We can create a JacksonLibHandler similar to the JsonLibHandler.
Are you able to create an Issue and attach a Patch?

Johannes

-----

--------------
web: http://www.jgeppert.com
twitter: http://twitter.com/jogep
--
View this message in context: http://struts.1045723.n5.nabble.com/Error-in-REST-Showcase-tp4344374p4346023.html
Sent from the Struts - Dev mailing list archive at Nabble.com.

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@struts.apache.org
For additional commands, e-mail: dev-help@struts.apache.org


Re: Error in REST Showcase

Posted by Frans Thamura <fr...@meruvian.org>.
wanna to add our jackson's json plugin to the showcase, so we have
another alternatif

and our plugins can become org.apache rather org.blueoxygen

F


On Thu, Apr 28, 2011 at 2:59 PM, Johannes Geppert <jo...@apache.org> wrote:
> Another Question related to the REST Showcase/Plugin.
>
> If I correct the OrdersController like previous described.
>
> So i get a valid HTML Result when I call
>
> http://localhost:8080/struts2-rest-showcase/orders/3
>
> But when I try
>
> http://localhost:8080/struts2-rest-showcase/orders/3.json
>
> I get also a HTML Result instead of an JSON result which I expected.
>
> Is there something wrong or am I on a wrong way?
>
> Johannes
>
>
>
> -----
>
> --------------
> web: http://www.jgeppert.com
> twitter: http://twitter.com/jogep
> --
> View this message in context: http://struts.1045723.n5.nabble.com/Error-in-REST-Showcase-tp4344374p4345959.html
> Sent from the Struts - Dev mailing list archive at Nabble.com.
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: dev-unsubscribe@struts.apache.org
> For additional commands, e-mail: dev-help@struts.apache.org
>
>

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@struts.apache.org
For additional commands, e-mail: dev-help@struts.apache.org


Re: Error in REST Showcase

Posted by Johannes Geppert <jo...@apache.org>.
Another Question related to the REST Showcase/Plugin.

If I correct the OrdersController like previous described. 

So i get a valid HTML Result when I call 

http://localhost:8080/struts2-rest-showcase/orders/3

But when I try 

http://localhost:8080/struts2-rest-showcase/orders/3.json

I get also a HTML Result instead of an JSON result which I expected.

Is there something wrong or am I on a wrong way?

Johannes



-----

--------------
web: http://www.jgeppert.com
twitter: http://twitter.com/jogep
--
View this message in context: http://struts.1045723.n5.nabble.com/Error-in-REST-Showcase-tp4344374p4345959.html
Sent from the Struts - Dev mailing list archive at Nabble.com.

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@struts.apache.org
For additional commands, e-mail: dev-help@struts.apache.org