ForwardResolution to URL doesn't seem to set parameters

classic Classic list List threaded Threaded
7 messages Options
Reply | Threaded
Open this post in threaded view
|

ForwardResolution to URL doesn't seem to set parameters

Mike McNally-3
When I've got a UrlBinding like "/whatever/{foo}/{bar}", and I create and use a ForwardResolution to "/whatever/hello/world", it kind-of seems like it'd be nice if in the action bean "foo" was set to "hello" and "bar" was set to "world".  As far as I can tell, however, that doesn't happen.

Is there something I'm missing?


--
Turtle, turtle, on the ground,
Pink and shiny, turn around.

------------------------------------------------------------------------------
LogMeIn Rescue: Anywhere, Anytime Remote support for IT. Free Trial
Remotely access PCs and mobile devices and provide instant support
Improve your efficiency, and focus on delivering more value-add services
Discover what IT Professionals Know. Rescue delivers
http://p.sf.net/sfu/logmein_12329d2d
_______________________________________________
Stripes-users mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/stripes-users
Reply | Threaded
Open this post in threaded view
|

Re: ForwardResolution to URL doesn't seem to set parameters

Matthijs Laan
On 2012-12-19 02:48, Mike McNally wrote:
> When I've got a UrlBinding like "/whatever/{foo}/{bar}", and I create
> and use a ForwardResolution to "/whatever/hello/world", it kind-of
> seems like it'd be nice if in the action bean "foo" was set to "hello"
> and "bar" was set to "world".  As far as I can tell, however, that
> doesn't happen.
>
> Is there something I'm missing?

This works fine for me, see minimal testcase below, which works when you
add a servlet mapping to StripesDispatcher for /action/* in web.xml:

package some.thing.stripes;

import net.sourceforge.stripes.action.*;

@UrlBinding("/action/test/{foo}/{bar}")
public class TestActionBean implements ActionBean {

     private ActionBeanContext context;
     private String foo, bar;

     @Override
     public ActionBeanContext getContext() {
         return context;
     }

     @Override
     public void setContext(ActionBeanContext context) {
         this.context = context;
     }

     public String getFoo() {
         return foo;
     }

     public void setFoo(String foo) {
         this.foo = foo;
     }

     public String getBar() {
         return bar;
     }

     public void setBar(String bar) {
         this.bar = bar;
     }

     public Resolution baz() {
         return new StreamingResolution("text/plain",
String.format("foo=%s,bar=%s", foo, bar));
     }
}


Matthijs


------------------------------------------------------------------------------
LogMeIn Rescue: Anywhere, Anytime Remote support for IT. Free Trial
Remotely access PCs and mobile devices and provide instant support
Improve your efficiency, and focus on delivering more value-add services
Discover what IT Professionals Know. Rescue delivers
http://p.sf.net/sfu/logmein_12329d2d
_______________________________________________
Stripes-users mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/stripes-users
Reply | Threaded
Open this post in threaded view
|

Re: ForwardResolution to URL doesn't seem to set parameters

Mike McNally-3

So you see those parameters being set when another action bean returns a ForwardResolution to that bean? The url parameters work fine for me too when the incoming HTTP request originally is targeted to such an action.

On Dec 21, 2012 7:00 AM, "Matthijs Laan" <[hidden email]> wrote:
On 2012-12-19 02:48, Mike McNally wrote:
> When I've got a UrlBinding like "/whatever/{foo}/{bar}", and I create
> and use a ForwardResolution to "/whatever/hello/world", it kind-of
> seems like it'd be nice if in the action bean "foo" was set to "hello"
> and "bar" was set to "world".  As far as I can tell, however, that
> doesn't happen.
>
> Is there something I'm missing?

This works fine for me, see minimal testcase below, which works when you
add a servlet mapping to StripesDispatcher for /action/* in web.xml:

package some.thing.stripes;

import net.sourceforge.stripes.action.*;

@UrlBinding("/action/test/{foo}/{bar}")
public class TestActionBean implements ActionBean {

     private ActionBeanContext context;
     private String foo, bar;

     @Override
     public ActionBeanContext getContext() {
         return context;
     }

     @Override
     public void setContext(ActionBeanContext context) {
         this.context = context;
     }

     public String getFoo() {
         return foo;
     }

     public void setFoo(String foo) {
         this.foo = foo;
     }

     public String getBar() {
         return bar;
     }

     public void setBar(String bar) {
         this.bar = bar;
     }

     public Resolution baz() {
         return new StreamingResolution("text/plain",
String.format("foo=%s,bar=%s", foo, bar));
     }
}


Matthijs


------------------------------------------------------------------------------
LogMeIn Rescue: Anywhere, Anytime Remote support for IT. Free Trial
Remotely access PCs and mobile devices and provide instant support
Improve your efficiency, and focus on delivering more value-add services
Discover what IT Professionals Know. Rescue delivers
http://p.sf.net/sfu/logmein_12329d2d
_______________________________________________
Stripes-users mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/stripes-users

------------------------------------------------------------------------------
LogMeIn Rescue: Anywhere, Anytime Remote support for IT. Free Trial
Remotely access PCs and mobile devices and provide instant support
Improve your efficiency, and focus on delivering more value-add services
Discover what IT Professionals Know. Rescue delivers
http://p.sf.net/sfu/logmein_12329d2d
_______________________________________________
Stripes-users mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/stripes-users
Reply | Threaded
Open this post in threaded view
|

Re: ForwardResolution to URL doesn't seem to set parameters

VANKEISBELCK Remi
In reply to this post by Matthijs Laan
Yeah it should.

Mike have you mapped the dispatcher to work in internal FORWARDs ?

Stuff like :

    <filter-mapping>
        <filter-name>DynamicMappingFilter</filter-name>
        <url-pattern>/*</url-pattern>
        <dispatcher>REQUEST</dispatcher>
        <dispatcher>FORWARD</dispatcher> <!-- the one you need for internal dispatch -->
    </filter-mapping>

HTH

Remi

Le 21 déc. 2012 à 13:59, Matthijs Laan a écrit :

> On 2012-12-19 02:48, Mike McNally wrote:
>> When I've got a UrlBinding like "/whatever/{foo}/{bar}", and I create
>> and use a ForwardResolution to "/whatever/hello/world", it kind-of
>> seems like it'd be nice if in the action bean "foo" was set to "hello"
>> and "bar" was set to "world".  As far as I can tell, however, that
>> doesn't happen.
>>
>> Is there something I'm missing?
>
> This works fine for me, see minimal testcase below, which works when you
> add a servlet mapping to StripesDispatcher for /action/* in web.xml:
>
> package some.thing.stripes;
>
> import net.sourceforge.stripes.action.*;
>
> @UrlBinding("/action/test/{foo}/{bar}")
> public class TestActionBean implements ActionBean {
>
>     private ActionBeanContext context;
>     private String foo, bar;
>
>     @Override
>     public ActionBeanContext getContext() {
>         return context;
>     }
>
>     @Override
>     public void setContext(ActionBeanContext context) {
>         this.context = context;
>     }
>
>     public String getFoo() {
>         return foo;
>     }
>
>     public void setFoo(String foo) {
>         this.foo = foo;
>     }
>
>     public String getBar() {
>         return bar;
>     }
>
>     public void setBar(String bar) {
>         this.bar = bar;
>     }
>
>     public Resolution baz() {
>         return new StreamingResolution("text/plain",
> String.format("foo=%s,bar=%s", foo, bar));
>     }
> }
>
>
> Matthijs
>
>
> ------------------------------------------------------------------------------
> LogMeIn Rescue: Anywhere, Anytime Remote support for IT. Free Trial
> Remotely access PCs and mobile devices and provide instant support
> Improve your efficiency, and focus on delivering more value-add services
> Discover what IT Professionals Know. Rescue delivers
> http://p.sf.net/sfu/logmein_12329d2d
> _______________________________________________
> Stripes-users mailing list
> [hidden email]
> https://lists.sourceforge.net/lists/listinfo/stripes-users


------------------------------------------------------------------------------
LogMeIn Rescue: Anywhere, Anytime Remote support for IT. Free Trial
Remotely access PCs and mobile devices and provide instant support
Improve your efficiency, and focus on delivering more value-add services
Discover what IT Professionals Know. Rescue delivers
http://p.sf.net/sfu/logmein_12329d2d
_______________________________________________
Stripes-users mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/stripes-users
Reply | Threaded
Open this post in threaded view
|

Re: ForwardResolution to URL doesn't seem to set parameters

Matthijs Laan
Good catch, this is indeed required otherwise the following additional
example won't work:

package some.thing.stripes;
import net.sourceforge.stripes.action.*;

@UrlBinding("/action/forward")
public class MyForwardActionBean implements ActionBean {
     // context property etc...

     public Resolution forward() {
         return new ForwardResolution(TestActionBean.class)
                 .addParameter("foo", "1")
                 .addParameter("bar", "2");
     }
}

Use of DynamicMappingFilter instead of StripesFilter is not required.

Matthijs

On 2012-12-21 14:06, Remi VANKEISBELCK wrote:

> Yeah it should.
>
> Mike have you mapped the dispatcher to work in internal FORWARDs ?
>
> Stuff like :
>
>      <filter-mapping>
>          <filter-name>DynamicMappingFilter</filter-name>
>          <url-pattern>/*</url-pattern>
>          <dispatcher>REQUEST</dispatcher>
>          <dispatcher>FORWARD</dispatcher> <!-- the one you need for internal dispatch -->
>      </filter-mapping>
>
> HTH
>
> Remi
>
> Le 21 déc. 2012 à 13:59, Matthijs Laan a écrit :
>
>> On 2012-12-19 02:48, Mike McNally wrote:
>>> When I've got a UrlBinding like "/whatever/{foo}/{bar}", and I create
>>> and use a ForwardResolution to "/whatever/hello/world", it kind-of
>>> seems like it'd be nice if in the action bean "foo" was set to "hello"
>>> and "bar" was set to "world".  As far as I can tell, however, that
>>> doesn't happen.
>>>
>>> Is there something I'm missing?
>> This works fine for me, see minimal testcase below, which works when you
>> add a servlet mapping to StripesDispatcher for /action/* in web.xml:
>>
>> package some.thing.stripes;
>>
>> import net.sourceforge.stripes.action.*;
>>
>> @UrlBinding("/action/test/{foo}/{bar}")
>> public class TestActionBean implements ActionBean {
>>
>>      private ActionBeanContext context;
>>      private String foo, bar;
>>
>>      @Override
>>      public ActionBeanContext getContext() {
>>          return context;
>>      }
>>
>>      @Override
>>      public void setContext(ActionBeanContext context) {
>>          this.context = context;
>>      }
>>
>>      public String getFoo() {
>>          return foo;
>>      }
>>
>>      public void setFoo(String foo) {
>>          this.foo = foo;
>>      }
>>
>>      public String getBar() {
>>          return bar;
>>      }
>>
>>      public void setBar(String bar) {
>>          this.bar = bar;
>>      }
>>
>>      public Resolution baz() {
>>          return new StreamingResolution("text/plain",
>> String.format("foo=%s,bar=%s", foo, bar));
>>      }
>> }
>>
>>
>> Matthijs
>>
>>
>> ------------------------------------------------------------------------------
>> LogMeIn Rescue: Anywhere, Anytime Remote support for IT. Free Trial
>> Remotely access PCs and mobile devices and provide instant support
>> Improve your efficiency, and focus on delivering more value-add services
>> Discover what IT Professionals Know. Rescue delivers
>> http://p.sf.net/sfu/logmein_12329d2d
>> _______________________________________________
>> Stripes-users mailing list
>> [hidden email]
>> https://lists.sourceforge.net/lists/listinfo/stripes-users
>
> ------------------------------------------------------------------------------
> LogMeIn Rescue: Anywhere, Anytime Remote support for IT. Free Trial
> Remotely access PCs and mobile devices and provide instant support
> Improve your efficiency, and focus on delivering more value-add services
> Discover what IT Professionals Know. Rescue delivers
> http://p.sf.net/sfu/logmein_12329d2d
> _______________________________________________
> Stripes-users mailing list
> [hidden email]
> https://lists.sourceforge.net/lists/listinfo/stripes-users



------------------------------------------------------------------------------
LogMeIn Rescue: Anywhere, Anytime Remote support for IT. Free Trial
Remotely access PCs and mobile devices and provide instant support
Improve your efficiency, and focus on delivering more value-add services
Discover what IT Professionals Know. Rescue delivers
http://p.sf.net/sfu/logmein_12329d2d
_______________________________________________
Stripes-users mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/stripes-users
Reply | Threaded
Open this post in threaded view
|

Re: ForwardResolution to URL doesn't seem to set parameters

Mike McNally-3
In reply to this post by VANKEISBELCK Remi

Ah well I guess I should check that - thank you!

On Dec 21, 2012 7:08 AM, "Remi VANKEISBELCK" <[hidden email]> wrote:
Yeah it should.

Mike have you mapped the dispatcher to work in internal FORWARDs ?

Stuff like :

    <filter-mapping>
        <filter-name>DynamicMappingFilter</filter-name>
        <url-pattern>/*</url-pattern>
        <dispatcher>REQUEST</dispatcher>
        <dispatcher>FORWARD</dispatcher> <!-- the one you need for internal dispatch -->
    </filter-mapping>

HTH

Remi

Le 21 déc. 2012 à 13:59, Matthijs Laan a écrit :

> On 2012-12-19 02:48, Mike McNally wrote:
>> When I've got a UrlBinding like "/whatever/{foo}/{bar}", and I create
>> and use a ForwardResolution to "/whatever/hello/world", it kind-of
>> seems like it'd be nice if in the action bean "foo" was set to "hello"
>> and "bar" was set to "world".  As far as I can tell, however, that
>> doesn't happen.
>>
>> Is there something I'm missing?
>
> This works fine for me, see minimal testcase below, which works when you
> add a servlet mapping to StripesDispatcher for /action/* in web.xml:
>
> package some.thing.stripes;
>
> import net.sourceforge.stripes.action.*;
>
> @UrlBinding("/action/test/{foo}/{bar}")
> public class TestActionBean implements ActionBean {
>
>     private ActionBeanContext context;
>     private String foo, bar;
>
>     @Override
>     public ActionBeanContext getContext() {
>         return context;
>     }
>
>     @Override
>     public void setContext(ActionBeanContext context) {
>         this.context = context;
>     }
>
>     public String getFoo() {
>         return foo;
>     }
>
>     public void setFoo(String foo) {
>         this.foo = foo;
>     }
>
>     public String getBar() {
>         return bar;
>     }
>
>     public void setBar(String bar) {
>         this.bar = bar;
>     }
>
>     public Resolution baz() {
>         return new StreamingResolution("text/plain",
> String.format("foo=%s,bar=%s", foo, bar));
>     }
> }
>
>
> Matthijs
>
>
> ------------------------------------------------------------------------------
> LogMeIn Rescue: Anywhere, Anytime Remote support for IT. Free Trial
> Remotely access PCs and mobile devices and provide instant support
> Improve your efficiency, and focus on delivering more value-add services
> Discover what IT Professionals Know. Rescue delivers
> http://p.sf.net/sfu/logmein_12329d2d
> _______________________________________________
> Stripes-users mailing list
> [hidden email]
> https://lists.sourceforge.net/lists/listinfo/stripes-users


------------------------------------------------------------------------------
LogMeIn Rescue: Anywhere, Anytime Remote support for IT. Free Trial
Remotely access PCs and mobile devices and provide instant support
Improve your efficiency, and focus on delivering more value-add services
Discover what IT Professionals Know. Rescue delivers
http://p.sf.net/sfu/logmein_12329d2d
_______________________________________________
Stripes-users mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/stripes-users

------------------------------------------------------------------------------
LogMeIn Rescue: Anywhere, Anytime Remote support for IT. Free Trial
Remotely access PCs and mobile devices and provide instant support
Improve your efficiency, and focus on delivering more value-add services
Discover what IT Professionals Know. Rescue delivers
http://p.sf.net/sfu/logmein_12329d2d
_______________________________________________
Stripes-users mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/stripes-users
Reply | Threaded
Open this post in threaded view
|

Re: ForwardResolution to URL doesn't seem to set parameters

Mike McNally-3
Yes that did it. Wow, that was easy :-)



On Fri, Dec 21, 2012 at 7:18 AM, Mike McNally <[hidden email]> wrote:

Ah well I guess I should check that - thank you!

On Dec 21, 2012 7:08 AM, "Remi VANKEISBELCK" <[hidden email]> wrote:
Yeah it should.

Mike have you mapped the dispatcher to work in internal FORWARDs ?

Stuff like :

    <filter-mapping>
        <filter-name>DynamicMappingFilter</filter-name>
        <url-pattern>/*</url-pattern>
        <dispatcher>REQUEST</dispatcher>
        <dispatcher>FORWARD</dispatcher> <!-- the one you need for internal dispatch -->
    </filter-mapping>

HTH

Remi

Le 21 déc. 2012 à 13:59, Matthijs Laan a écrit :

> On 2012-12-19 02:48, Mike McNally wrote:
>> When I've got a UrlBinding like "/whatever/{foo}/{bar}", and I create
>> and use a ForwardResolution to "/whatever/hello/world", it kind-of
>> seems like it'd be nice if in the action bean "foo" was set to "hello"
>> and "bar" was set to "world".  As far as I can tell, however, that
>> doesn't happen.
>>
>> Is there something I'm missing?
>
> This works fine for me, see minimal testcase below, which works when you
> add a servlet mapping to StripesDispatcher for /action/* in web.xml:
>
> package some.thing.stripes;
>
> import net.sourceforge.stripes.action.*;
>
> @UrlBinding("/action/test/{foo}/{bar}")
> public class TestActionBean implements ActionBean {
>
>     private ActionBeanContext context;
>     private String foo, bar;
>
>     @Override
>     public ActionBeanContext getContext() {
>         return context;
>     }
>
>     @Override
>     public void setContext(ActionBeanContext context) {
>         this.context = context;
>     }
>
>     public String getFoo() {
>         return foo;
>     }
>
>     public void setFoo(String foo) {
>         this.foo = foo;
>     }
>
>     public String getBar() {
>         return bar;
>     }
>
>     public void setBar(String bar) {
>         this.bar = bar;
>     }
>
>     public Resolution baz() {
>         return new StreamingResolution("text/plain",
> String.format("foo=%s,bar=%s", foo, bar));
>     }
> }
>
>
> Matthijs
>
>
> ------------------------------------------------------------------------------
> LogMeIn Rescue: Anywhere, Anytime Remote support for IT. Free Trial
> Remotely access PCs and mobile devices and provide instant support
> Improve your efficiency, and focus on delivering more value-add services
> Discover what IT Professionals Know. Rescue delivers
> http://p.sf.net/sfu/logmein_12329d2d
> _______________________________________________
> Stripes-users mailing list
> [hidden email]
> https://lists.sourceforge.net/lists/listinfo/stripes-users


------------------------------------------------------------------------------
LogMeIn Rescue: Anywhere, Anytime Remote support for IT. Free Trial
Remotely access PCs and mobile devices and provide instant support
Improve your efficiency, and focus on delivering more value-add services
Discover what IT Professionals Know. Rescue delivers
http://p.sf.net/sfu/logmein_12329d2d
_______________________________________________
Stripes-users mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/stripes-users



--
Turtle, turtle, on the ground,
Pink and shiny, turn around.
------------------------------------------------------------------------------
LogMeIn Rescue: Anywhere, Anytime Remote support for IT. Free Trial
Remotely access PCs and mobile devices and provide instant support
Improve your efficiency, and focus on delivering more value-add services
Discover what IT Professionals Know. Rescue delivers
http://p.sf.net/sfu/logmein_12329d2d
_______________________________________________
Stripes-users mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/stripes-users