struts-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Dale Newfield <d...@newfield.org>
Subject Re: Struts2 REST plugin problems
Date Tue, 31 Aug 2010 22:24:31 GMT
On 8/31/10 5:17 PM, Rafael Taboada wrote:
> But I'm having the same problem "HTTP status 404"

So it is failing to find any valid action mapping?  What do your logs show?
This might help you figure out what's going on:
http://struts.apache.org/2.x/docs/config-browser-plugin.html

> My struts.xml looks like :

> <include file="example.xml"/>

I don't know what's in that file--I'm guessing a package with the 
namespace "/example"?  Do you have any packages whose namespace is 
"/service"?

> <package name="default" namespace="/" extends="struts-default">

I've not looked into the details of the plugins you said you're using. 
Do any of them provide packages that you need to extend instead of 
struts-default to get their benefits?

> <result type="redirectAction">
> <param name="actionName">HelloWorld</param>
> <param name="namespace">/example</param>

So if you try to access /index.action, does it redirect to 
/example/HellowWorld.action ?

> And when I try to acces
> http://localhost:8080/struts221/example/HelloWorld.action, apparently it
> is driven by restful, because it shows "HTTP status 404" error

Your configuration doesn't specify that this should be mapped by the 
Restful2ActionMapper, so why do you assume this?

> Maybe i'm missing another config? What am I doing wrong?

I don't know how the Restful2ActionMapper does it's thing.  When I 
looked at the two provided Restful action mappers several years ago I 
found that neither really did what I needed, so I ended up writing my 
own.  I've actually found that most of what people want when they say 
they want REST style urls can be provided by the default action mapper 
with wildcards.  (Also, make sure that you have SlashesInActionNames set 
appropriately for the rest of your config.)

http://struts.apache.org/2.x/docs/restfulactionmapper.html and/or 
http://struts.apache.org/2.x/struts2-core/apidocs/org/apache/struts2/dispatcher/mapper/Restful2ActionMapper.html

should be helpful.

-Dale

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


Mime
View raw message