struts-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Rafael Taboada <kaliman.fore...@gmail.com>
Subject Re: Struts2 REST plugin problems
Date Tue, 31 Aug 2010 22:23:27 GMT
Hi,

I was debugging PrefixBasedActionMapper and a I noticed that:

- It gets the right actionmappers
"/service" ->
org.apache.struts2.dispatcher.mapper.Restful2ActionMapper@34e6529c
"" -> org.apache.struts2.dispatcher.mapper.DefaultActionMapper@50e8709d

- When I can access the uri /example/HelloWorld.action it takes the
defaultActionMapper

Using ActionMapper
org.apache.struts2.dispatcher.mapper.DefaultActionMapper@50e8709d

- but in the line "ActionMapping actionMapping =
actionMapper.getMapping(request, configManager);" it returns NULL

ActionMapper
org.apache.struts2.dispatcher.mapper.DefaultActionMapper@50e8709d failed to
return an ActionMapping

And the log "no ActionMapper found"

Any comment about this?

Thanks in advance

On Tue, Aug 31, 2010 at 4:17 PM, Rafael Taboada
<kaliman.forever@gmail.com>wrote:

> Great,
>
> But I'm having the same problem "HTTP status 404"
>
> I've downloaded struts-blank2.2.1 and added jars about restful plugin
> (struts2-rest-showcase-2.2.1)
>
> My struts.xml looks like :
>
> <struts>
>
>     <constant name="struts.enable.DynamicMethodInvocation" value="true" />
>     <constant name="struts.devMode" value="false" />
>
>     <bean type="org.apache.struts2.dispatcher.mapper.ActionMapper"
> name="pseudoRestful"
> class="org.apache.struts2.dispatcher.mapper.Restful2ActionMapper"/>
>     <constant name="struts.mapper.class"
> value="org.apache.struts2.dispatcher.mapper.PrefixBasedActionMapper"/>
>     <constant name="struts.mapper.prefixMapping"
> value="service:pseudoRestful,:struts"/>
>
>
>     <include file="example.xml"/>
>
>
>
>     <package name="default" namespace="/" extends="struts-default">
>         <default-action-ref name="index" />
>         <action name="index">
>             <result type="redirectAction">
>                 <param name="actionName">HelloWorld</param>
>                 <param name="namespace">/example</param>
>             </result>
>         </action>
>     </package>
>
>     <!-- Add packages here -->
>
> </struts>
>
> 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
>
> Maybe i'm missing another config? What am I doing wrong?
>
>
>
> On Tue, Aug 31, 2010 at 4:05 PM, Dale Newfield <dale@newfield.org> wrote:
>
>> On 8/31/10 4:40 PM, Rafael Taboada wrote:
>>
>>> I have in my struts.xml
>>> <bean type="org.apache.struts2.dispatcher.mapper.ActionMapper"
>>> name="pseudoRestful"
>>> class="org.apache.struts2.dispatcher.mapper.Restful2ActionMapper"/>
>>> <constant name="struts.mapper.class"
>>> value="org.apache.struts2.dispatcher.mapper.PrefixBasedActionMapper"/>
>>> <constant name="struts.mapper.prefixMapping"
>>> value="/service:pseudoRestful,:struts"/>
>>>
>>> It means, every url that contains 'service' must be mapped with
>>> Restful2ActionMapper, everything else use default mapping.
>>>
>>> Is that correct? What am i missing or doing wrong?
>>>
>>
>> Almost.  It means that every request that starts with "/service/"
>> (ignoring context root) will first be mapped using the Restful2ActionMapper,
>> if that fails, then it'll be mapped by the standard struts
>> DefaultActionMapper.  Anything that doesn't start with "/service/" will just
>> be mapped by the standard struts DefaultActionMapper.
>>
>> -Dale
>>
>
>
>
> --
> Rafael Taboada
> Software Engineer
>
> Cell : +511-992741026
>
> "No creo en el destino pues no me gusta tener la idea de controlar mi vida"
>



-- 
Rafael Taboada
Software Engineer

Cell : +511-992741026

"No creo en el destino pues no me gusta tener la idea de controlar mi vida"

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message