URL bindings not always resolved

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

URL bindings not always resolved

Grzegorz Krugły
I have a strange problem.

I have an action with URL binding like this:

@UrlBinding("/admin/userGroups/{$event}/{userGroup}")
public class AdminUserGroupAction extends AbstractDashboardAction {

and I have a JSP form like this:

<s:form beanclass="pl.msi.el.action.AdminUserGroupAction"
class="form-horizontal">

In other words - it's as simple as it can be. Most of the time it works
fine.

But once in a while strange thing happens -- in the HTML that goes to
the browser, form's action is not /admin/userGroups, but...
/admin/userGroups/{$event}/{userGroup}
URL binding tokens get passed to HTML!

Has any of You encountered such problem? What could I do? Trying to
debug Stripes code, but am not that fluent in it.

Best regards,
Grzegorz


------------------------------------------------------------------------------
Flow-based real-time traffic analytics software. Cisco certified tool.
Monitor traffic, SLAs, QoS, Medianet, WAAS etc. with NetFlow Analyzer
Customize your own dashboards, set traffic alerts and generate reports.
Network behavioral analysis & security monitoring. All-in-one tool.
http://pubads.g.doubleclick.net/gampad/clk?id=126839071&iu=/4140/ostg.clktrk
_______________________________________________
Stripes-users mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/stripes-users
Reply | Threaded
Open this post in threaded view
|

Re: URL bindings not always resolved

Grzegorz Krugły
I hate bumping, but I'm really stuck with this one. Nothing obvious even
though I've debugged a lot.
Perhaps someone has an insight for the inner workings of UrlBindings and
has an idea what might cause those {$event} and {params} to leak to the
final HTML...


W dniu 02.03.2014 12:30, Grzegorz Krugły pisze:

> I have a strange problem.
>
> I have an action with URL binding like this:
>
> @UrlBinding("/admin/userGroups/{$event}/{userGroup}")
> public class AdminUserGroupAction extends AbstractDashboardAction {
>
> and I have a JSP form like this:
>
> <s:form beanclass="pl.msi.el.action.AdminUserGroupAction"
> class="form-horizontal">
>
> In other words - it's as simple as it can be. Most of the time it works
> fine.
>
> But once in a while strange thing happens -- in the HTML that goes to
> the browser, form's action is not /admin/userGroups, but...
> /admin/userGroups/{$event}/{userGroup}
> URL binding tokens get passed to HTML!
>
> Has any of You encountered such problem? What could I do? Trying to
> debug Stripes code, but am not that fluent in it.
>
> Best regards,
> Grzegorz

------------------------------------------------------------------------------
Subversion Kills Productivity. Get off Subversion & Make the Move to Perforce.
With Perforce, you get hassle-free workflows. Merge that actually works.
Faster operations. Version large binaries.  Built-in WAN optimization and the
freedom to use Git, Perforce or both. Make the move to Perforce.
http://pubads.g.doubleclick.net/gampad/clk?id=122218951&iu=/4140/ostg.clktrk
_______________________________________________
Stripes-users mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/stripes-users
Reply | Threaded
Open this post in threaded view
|

Re: URL bindings not always resolved

VANKEISBELCK Remi
Hi Grzegorz,

Sorry for the delay.

Do you mean the braces etc end up in the "action" attribute of the form tag ?
Does this happen "randomly" in a running application ?

Cheers

Rémi



2014-03-09 21:23 GMT+01:00 Grzegorz Krugły <[hidden email]>:
I hate bumping, but I'm really stuck with this one. Nothing obvious even
though I've debugged a lot.
Perhaps someone has an insight for the inner workings of UrlBindings and
has an idea what might cause those {$event} and {params} to leak to the
final HTML...


W dniu 02.03.2014 12:30, Grzegorz Krugły pisze:
> I have a strange problem.
>
> I have an action with URL binding like this:
>
> @UrlBinding("/admin/userGroups/{$event}/{userGroup}")
> public class AdminUserGroupAction extends AbstractDashboardAction {
>
> and I have a JSP form like this:
>
> <s:form beanclass="pl.msi.el.action.AdminUserGroupAction"
> class="form-horizontal">
>
> In other words - it's as simple as it can be. Most of the time it works
> fine.
>
> But once in a while strange thing happens -- in the HTML that goes to
> the browser, form's action is not /admin/userGroups, but...
> /admin/userGroups/{$event}/{userGroup}
> URL binding tokens get passed to HTML!
>
> Has any of You encountered such problem? What could I do? Trying to
> debug Stripes code, but am not that fluent in it.
>
> Best regards,
> Grzegorz

------------------------------------------------------------------------------
Subversion Kills Productivity. Get off Subversion & Make the Move to Perforce.
With Perforce, you get hassle-free workflows. Merge that actually works.
Faster operations. Version large binaries.  Built-in WAN optimization and the
freedom to use Git, Perforce or both. Make the move to Perforce.
http://pubads.g.doubleclick.net/gampad/clk?id=122218951&iu=/4140/ostg.clktrk
_______________________________________________
Stripes-users mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/stripes-users


------------------------------------------------------------------------------
Learn Graph Databases - Download FREE O'Reilly Book
"Graph Databases" is the definitive new guide to graph databases and their
applications. Written by three acclaimed leaders in the field,
this first edition is now available. Download your free book today!
http://p.sf.net/sfu/13534_NeoTech
_______________________________________________
Stripes-users mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/stripes-users
Reply | Threaded
Open this post in threaded view
|

Re: URL bindings not always resolved

Grzegorz Krugły
Yes, braces etc end up in the "action" attribute of the form tag. It happens randomly, but it seems the most often it happens the first time I visit the page -- subsequent accesses tend to work ok.

W dniu 10.03.2014 11:01, VANKEISBELCK Remi pisze:
Hi Grzegorz,

Sorry for the delay.

Do you mean the braces etc end up in the "action" attribute of the form tag ?
Does this happen "randomly" in a running application ?

Cheers

Rémi



2014-03-09 21:23 GMT+01:00 Grzegorz Krugły <[hidden email]>:
I hate bumping, but I'm really stuck with this one. Nothing obvious even
though I've debugged a lot.
Perhaps someone has an insight for the inner workings of UrlBindings and
has an idea what might cause those {$event} and {params} to leak to the
final HTML...


W dniu 02.03.2014 12:30, Grzegorz Krugły pisze:
> I have a strange problem.
>
> I have an action with URL binding like this:
>
> @UrlBinding("/admin/userGroups/{$event}/{userGroup}")
> public class AdminUserGroupAction extends AbstractDashboardAction {
>
> and I have a JSP form like this:
>
> <s:form beanclass="pl.msi.el.action.AdminUserGroupAction"
> class="form-horizontal">
>
> In other words - it's as simple as it can be. Most of the time it works
> fine.
>
> But once in a while strange thing happens -- in the HTML that goes to
> the browser, form's action is not /admin/userGroups, but...
> /admin/userGroups/{$event}/{userGroup}
> URL binding tokens get passed to HTML!
>
> Has any of You encountered such problem? What could I do? Trying to
> debug Stripes code, but am not that fluent in it.
>
> Best regards,
> Grzegorz

------------------------------------------------------------------------------
Subversion Kills Productivity. Get off Subversion & Make the Move to Perforce.
With Perforce, you get hassle-free workflows. Merge that actually works.
Faster operations. Version large binaries.  Built-in WAN optimization and the
freedom to use Git, Perforce or both. Make the move to Perforce.
http://pubads.g.doubleclick.net/gampad/clk?id=122218951&iu=/4140/ostg.clktrk
_______________________________________________
Stripes-users mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/stripes-users



------------------------------------------------------------------------------
Learn Graph Databases - Download FREE O'Reilly Book
"Graph Databases" is the definitive new guide to graph databases and their
applications. Written by three acclaimed leaders in the field,
this first edition is now available. Download your free book today!
http://p.sf.net/sfu/13534_NeoTech


_______________________________________________
Stripes-users mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/stripes-users


------------------------------------------------------------------------------
Learn Graph Databases - Download FREE O'Reilly Book
"Graph Databases" is the definitive new guide to graph databases and their
applications. Written by three acclaimed leaders in the field,
this first edition is now available. Download your free book today!
http://p.sf.net/sfu/13534_NeoTech
_______________________________________________
Stripes-users mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/stripes-users
Reply | Threaded
Open this post in threaded view
|

Re: URL bindings not always resolved

Grzegorz Krugły
In reply to this post by Grzegorz Krugły
No, there's nothing "fancy" in the code, the request goes to ActionBean
and it returns ForwardResolution to JSP.

W dniu 10.03.2014 11:43, Marcus Kraßmann pisze:
> Maybe it happens when you call the JSP directly while it works when being called by an action bean?
>
> Am 10.03.2014 11:36 schrieb =?UTF-8?Q?Grzegorz_Krug=C5=82y?= <[hidden email]>:
>


------------------------------------------------------------------------------
Learn Graph Databases - Download FREE O'Reilly Book
"Graph Databases" is the definitive new guide to graph databases and their
applications. Written by three acclaimed leaders in the field,
this first edition is now available. Download your free book today!
http://p.sf.net/sfu/13534_NeoTech
_______________________________________________
Stripes-users mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/stripes-users
Reply | Threaded
Open this post in threaded view
|

Re: URL bindings not always resolved

VANKEISBELCK Remi
I've had a peek at the sources. 

When using FormTag, the "action" attribute it computed by (in short) replacing the placeholders in the @UrlBinding. The binding prototype is used and the "base url" is built, including clean-URL params if any :

net.sourceforge.stripes.util.UrlBuilder#getBaseURL

I have no idea why the placeholders (UrlBindingParameter instances in the components list) don't get replaced in your case. 

Thinking out loud : 
- are the parameters (the ones that you need in your query) present in the FORM ?
- do you have validation constraints ?

In order to help debugging, you can try to step in UrlBuilder. What I'd do is either :

1/ toss a conditional breakpoint in net/sourceforge/stripes/util/UrlBuilder.java:543, that breaks when the "url" variable contains a brace for example

or

2/ patch the source by adding stuff like : 
if (url.contains("{")) {
  throw new RuntimeException("shit happens");
}
and break on the "throw new..." line.

This way, you'll have the whole environment, stack, variables, and logs. Of course, turn stripes logs to DEBUG before you do this.

One note though : I fail to understand how the {$event} param can be used in a form's action. I mean, it is not known until the user presses a submit, which happens *after* the action attribute gets generated...

Cheers

Rémi






2014-03-10 11:45 GMT+01:00 Grzegorz Krugły <[hidden email]>:
No, there's nothing "fancy" in the code, the request goes to ActionBean
and it returns ForwardResolution to JSP.

W dniu 10.03.2014 11:43, Marcus Kraßmann pisze:
> Maybe it happens when you call the JSP directly while it works when being called by an action bean?
>
> Am 10.03.2014 11:36 schrieb =?UTF-8?Q?Grzegorz_Krug=C5=82y?= <[hidden email]>:
>


------------------------------------------------------------------------------
Learn Graph Databases - Download FREE O'Reilly Book
"Graph Databases" is the definitive new guide to graph databases and their
applications. Written by three acclaimed leaders in the field,
this first edition is now available. Download your free book today!
http://p.sf.net/sfu/13534_NeoTech
_______________________________________________
Stripes-users mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/stripes-users


------------------------------------------------------------------------------
Learn Graph Databases - Download FREE O'Reilly Book
"Graph Databases" is the definitive new guide to graph databases and their
applications. Written by three acclaimed leaders in the field,
this first edition is now available. Download your free book today!
http://p.sf.net/sfu/13534_NeoTech
_______________________________________________
Stripes-users mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/stripes-users
Reply | Threaded
Open this post in threaded view
|

Re: URL bindings not always resolved

Grzegorz Krugły
I've tried debugging UrlBuilder now and have the direct cause of my problems caught.

In UrlBuilder:472 there's a line

        if (baseUrl.equals(binding.toString())) {

In my code baseUrl is /organization/{$event}/{schoolId}/{param1}
and binding.toString() is /organization/{$event=index}/{schoolId}/{param1}

Note the extra =index after {$event

It causes the line 473 (baseUrl = binding.getPath();) to be skipped and after check at line 477 (if (binding.getPath().length() < baseUrl.length()) {) the baseUrl with { and }s is returned.

But if I hit "refresh" in the browser, the next time I debug the same code for the same page, baseUrl also has that $event=index part and everything works ok.



W dniu 10.03.2014 13:16, VANKEISBELCK Remi pisze:
I've had a peek at the sources. 

When using FormTag, the "action" attribute it computed by (in short) replacing the placeholders in the @UrlBinding. The binding prototype is used and the "base url" is built, including clean-URL params if any :

net.sourceforge.stripes.util.UrlBuilder#getBaseURL

I have no idea why the placeholders (UrlBindingParameter instances in the components list) don't get replaced in your case. 

Thinking out loud : 
- are the parameters (the ones that you need in your query) present in the FORM ?
- do you have validation constraints ?

In order to help debugging, you can try to step in UrlBuilder. What I'd do is either :

1/ toss a conditional breakpoint in net/sourceforge/stripes/util/UrlBuilder.java:543, that breaks when the "url" variable contains a brace for example

or

2/ patch the source by adding stuff like : 
if (url.contains("{")) {
  throw new RuntimeException("shit happens");
}
and break on the "throw new..." line.

This way, you'll have the whole environment, stack, variables, and logs. Of course, turn stripes logs to DEBUG before you do this.

One note though : I fail to understand how the {$event} param can be used in a form's action. I mean, it is not known until the user presses a submit, which happens *after* the action attribute gets generated...

Cheers

Rémi






2014-03-10 11:45 GMT+01:00 Grzegorz Krugły <[hidden email]>:
No, there's nothing "fancy" in the code, the request goes to ActionBean
and it returns ForwardResolution to JSP.

W dniu 10.03.2014 11:43, Marcus Kraßmann pisze:
> Maybe it happens when you call the JSP directly while it works when being called by an action bean?
>
> Am 10.03.2014 11:36 schrieb =?UTF-8?Q?Grzegorz_Krug=C5=82y?= <[hidden email]>:
>


------------------------------------------------------------------------------
Learn Graph Databases - Download FREE O'Reilly Book
"Graph Databases" is the definitive new guide to graph databases and their
applications. Written by three acclaimed leaders in the field,
this first edition is now available. Download your free book today!
http://p.sf.net/sfu/13534_NeoTech
_______________________________________________
Stripes-users mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/stripes-users



------------------------------------------------------------------------------
Learn Graph Databases - Download FREE O'Reilly Book
"Graph Databases" is the definitive new guide to graph databases and their
applications. Written by three acclaimed leaders in the field,
this first edition is now available. Download your free book today!
http://p.sf.net/sfu/13534_NeoTech


_______________________________________________
Stripes-users mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/stripes-users


------------------------------------------------------------------------------
Learn Graph Databases - Download FREE O'Reilly Book
"Graph Databases" is the definitive new guide to graph databases and their
applications. Written by three acclaimed leaders in the field,
this first edition is now available. Download your free book today!
http://p.sf.net/sfu/13534_NeoTech
_______________________________________________
Stripes-users mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/stripes-users
Reply | Threaded
Open this post in threaded view
|

Re: URL bindings not always resolved

Grzegorz Krugły
The call stack is

FormTag.doEndTag: 241
FormTag.buildAction: 511
UrlBuilder.toString: 304
UrlBuilder.build: 406
UrlBuilder.getBaseUrl: 454

No idea where to go from here.


W dniu 10.03.2014 14:16, Grzegorz Krugły pisze:
I've tried debugging UrlBuilder now and have the direct cause of my problems caught.

In UrlBuilder:472 there's a line

        if (baseUrl.equals(binding.toString())) {

In my code baseUrl is /organization/{$event}/{schoolId}/{param1}
and binding.toString() is /organization/{$event=index}/{schoolId}/{param1}

Note the extra =index after {$event

It causes the line 473 (baseUrl = binding.getPath();) to be skipped and after check at line 477 (if (binding.getPath().length() < baseUrl.length()) {) the baseUrl with { and }s is returned.

But if I hit "refresh" in the browser, the next time I debug the same code for the same page, baseUrl also has that $event=index part and everything works ok.


------------------------------------------------------------------------------
Learn Graph Databases - Download FREE O'Reilly Book
"Graph Databases" is the definitive new guide to graph databases and their
applications. Written by three acclaimed leaders in the field,
this first edition is now available. Download your free book today!
http://p.sf.net/sfu/13534_NeoTech
_______________________________________________
Stripes-users mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/stripes-users
Reply | Threaded
Open this post in threaded view
|

Re: URL bindings not always resolved

Nikolaos Giannopoulos
Grzegorz,

Years ago when I was actively developing with Stripes I saw a very similar behavior with respect to initialization of bindings where the issue only happened on initial server request.  I think it has to do with lazy initialization of URL bindings... that for some reason do not get initialized properly the 1st time around.

I tried debugging it for quite some time however in the end I could not get to the root of the problem.  

I know I asked about it on these lists but do not think there was ever any resolution.  IIRC this was 1.5.4 or .3

I would:

1.  Look to see if there are any prior cases fitting your issue... and either create a new issue or extend an existing open with your notes...

2.  See if you could make a bare bones project demonstrating the issue and someone (like Remi ;-) could use to resolve the issue...

I think b/c it happens on initial server request and b/c people do things like hit their main web page URL or fire a run a non-URL binding test that few people notice the issue.

In our case after all the extended effort we simply decided to ensure we hit the site at least once prior to release cutover b/c in our case IIRC wasn't as easy to reproduce b/c we

But it would be great to resolve this issue once and for all.

--Nikolaos
Sent from my iPhone

> On Mar 10, 2014, at 9:25 AM, Grzegorz Krugły <[hidden email]> wrote:
>
> The call stack is
>
> FormTag.doEndTag: 241
> FormTag.buildAction: 511
> UrlBuilder.toString: 304
> UrlBuilder.build: 406
> UrlBuilder.getBaseUrl: 454
>
> No idea where to go from here.
>
>
> W dniu 10.03.2014 14:16, Grzegorz Krugły pisze:
>> I've tried debugging UrlBuilder now and have the direct cause of my problems caught.
>>
>> In UrlBuilder:472 there's a line
>>
>>         if (baseUrl.equals(binding.toString())) {
>>
>> In my code baseUrl is /organization/{$event}/{schoolId}/{param1}
>> and binding.toString() is /organization/{$event=index}/{schoolId}/{param1}
>>
>> Note the extra =index after {$event
>>
>> It causes the line 473 (baseUrl = binding.getPath();) to be skipped and after check at line 477 (if (binding.getPath().length() < baseUrl.length()) {) the baseUrl with { and }s is returned.
>>
>> But if I hit "refresh" in the browser, the next time I debug the same code for the same page, baseUrl also has that $event=index part and everything works ok.
>
> ------------------------------------------------------------------------------
> Learn Graph Databases - Download FREE O'Reilly Book
> "Graph Databases" is the definitive new guide to graph databases and their
> applications. Written by three acclaimed leaders in the field,
> this first edition is now available. Download your free book today!
> http://p.sf.net/sfu/13534_NeoTech
> _______________________________________________
> Stripes-users mailing list
> [hidden email]
> https://lists.sourceforge.net/lists/listinfo/stripes-users

------------------------------------------------------------------------------
Learn Graph Databases - Download FREE O'Reilly Book
"Graph Databases" is the definitive new guide to graph databases and their
applications. Written by three acclaimed leaders in the field,
this first edition is now available. Download your free book today!
http://p.sf.net/sfu/13534_NeoTech
_______________________________________________
Stripes-users mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/stripes-users
Reply | Threaded
Open this post in threaded view
|

Re: URL bindings not always resolved

VANKEISBELCK Remi
In reply to this post by Grzegorz Krugły
Interesting, this means that defaultValue is set so "index" in
net/sourceforge/stripes/controller/UrlBindingParameter.java 

There are 3 affectations of this variable :
- 2 in net.sourceforge.stripes.controller.UrlBindingParameter#getDefaultValue
- 1 in the constructor net.sourceforge.stripes.controller.UrlBindingParameter#UrlBindingParameter(java.lang.Class<? extends net.sourceforge.stripes.action.ActionBean>, java.lang.String, java.lang.String, java.lang.String)

Could you break in there ? The defaultValue should be null. My guess is that you have "index" instead. Then the stack trace should tell how how it got there.

I'm on Stripes' IRC for about an hour if you wanna join, would be easier to debug together...

Cheers

Rémi 



2014-03-10 14:16 GMT+01:00 Grzegorz Krugły <[hidden email]>:
I've tried debugging UrlBuilder now and have the direct cause of my problems caught.

In UrlBuilder:472 there's a line

        if (baseUrl.equals(binding.toString())) {

In my code baseUrl is /organization/{$event}/{schoolId}/{param1}
and binding.toString() is /organization/{$event=index}/{schoolId}/{param1}

Note the extra =index after {$event

It causes the line 473 (baseUrl = binding.getPath();) to be skipped and after check at line 477 (if (binding.getPath().length() < baseUrl.length()) {) the baseUrl with { and }s is returned.

But if I hit "refresh" in the browser, the next time I debug the same code for the same page, baseUrl also has that $event=index part and everything works ok.



W dniu 10.03.2014 13:16, VANKEISBELCK Remi pisze:
I've had a peek at the sources. 

When using FormTag, the "action" attribute it computed by (in short) replacing the placeholders in the @UrlBinding. The binding prototype is used and the "base url" is built, including clean-URL params if any :

net.sourceforge.stripes.util.UrlBuilder#getBaseURL

I have no idea why the placeholders (UrlBindingParameter instances in the components list) don't get replaced in your case. 

Thinking out loud : 
- are the parameters (the ones that you need in your query) present in the FORM ?
- do you have validation constraints ?

In order to help debugging, you can try to step in UrlBuilder. What I'd do is either :

1/ toss a conditional breakpoint in net/sourceforge/stripes/util/UrlBuilder.java:543, that breaks when the "url" variable contains a brace for example

or

2/ patch the source by adding stuff like : 
if (url.contains("{")) {
  throw new RuntimeException("shit happens");
}
and break on the "throw new..." line.

This way, you'll have the whole environment, stack, variables, and logs. Of course, turn stripes logs to DEBUG before you do this.

One note though : I fail to understand how the {$event} param can be used in a form's action. I mean, it is not known until the user presses a submit, which happens *after* the action attribute gets generated...

Cheers

Rémi






2014-03-10 11:45 GMT+01:00 Grzegorz Krugły <[hidden email]>:
No, there's nothing "fancy" in the code, the request goes to ActionBean
and it returns ForwardResolution to JSP.

W dniu 10.03.2014 11:43, Marcus Kraßmann pisze:
> Maybe it happens when you call the JSP directly while it works when being called by an action bean?
>
> Am 10.03.2014 11:36 schrieb =?UTF-8?Q?Grzegorz_Krug=C5=82y?= <[hidden email]>:
>


------------------------------------------------------------------------------
Learn Graph Databases - Download FREE O'Reilly Book
"Graph Databases" is the definitive new guide to graph databases and their
applications. Written by three acclaimed leaders in the field,
this first edition is now available. Download your free book today!
http://p.sf.net/sfu/13534_NeoTech
_______________________________________________
Stripes-users mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/stripes-users



------------------------------------------------------------------------------
Learn Graph Databases - Download FREE O'Reilly Book
"Graph Databases" is the definitive new guide to graph databases and their
applications. Written by three acclaimed leaders in the field,
this first edition is now available. Download your free book today!
http://p.sf.net/sfu/13534_NeoTech


_______________________________________________
Stripes-users mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/stripes-users


------------------------------------------------------------------------------
Learn Graph Databases - Download FREE O'Reilly Book
"Graph Databases" is the definitive new guide to graph databases and their
applications. Written by three acclaimed leaders in the field,
this first edition is now available. Download your free book today!
http://p.sf.net/sfu/13534_NeoTech
_______________________________________________
Stripes-users mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/stripes-users



------------------------------------------------------------------------------
Learn Graph Databases - Download FREE O'Reilly Book
"Graph Databases" is the definitive new guide to graph databases and their
applications. Written by three acclaimed leaders in the field,
this first edition is now available. Download your free book today!
http://p.sf.net/sfu/13534_NeoTech
_______________________________________________
Stripes-users mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/stripes-users
Reply | Threaded
Open this post in threaded view
|

Re: URL bindings not always resolved

VANKEISBELCK Remi
BTW what version of Stripes are you using ? Where did you grab the sources ? I noticed differences in line numbers between yours and mine...

Cheers

Rémi


2014-03-10 17:48 GMT+01:00 VANKEISBELCK Remi <[hidden email]>:
Interesting, this means that defaultValue is set so "index" in
net/sourceforge/stripes/controller/UrlBindingParameter.java 

There are 3 affectations of this variable :
- 2 in net.sourceforge.stripes.controller.UrlBindingParameter#getDefaultValue
- 1 in the constructor net.sourceforge.stripes.controller.UrlBindingParameter#UrlBindingParameter(java.lang.Class<? extends net.sourceforge.stripes.action.ActionBean>, java.lang.String, java.lang.String, java.lang.String)

Could you break in there ? The defaultValue should be null. My guess is that you have "index" instead. Then the stack trace should tell how how it got there.

I'm on Stripes' IRC for about an hour if you wanna join, would be easier to debug together...

Cheers

Rémi 



2014-03-10 14:16 GMT+01:00 Grzegorz Krugły <[hidden email]>:

I've tried debugging UrlBuilder now and have the direct cause of my problems caught.

In UrlBuilder:472 there's a line

        if (baseUrl.equals(binding.toString())) {

In my code baseUrl is /organization/{$event}/{schoolId}/{param1}
and binding.toString() is /organization/{$event=index}/{schoolId}/{param1}

Note the extra =index after {$event

It causes the line 473 (baseUrl = binding.getPath();) to be skipped and after check at line 477 (if (binding.getPath().length() < baseUrl.length()) {) the baseUrl with { and }s is returned.

But if I hit "refresh" in the browser, the next time I debug the same code for the same page, baseUrl also has that $event=index part and everything works ok.



W dniu 10.03.2014 13:16, VANKEISBELCK Remi pisze:
I've had a peek at the sources. 

When using FormTag, the "action" attribute it computed by (in short) replacing the placeholders in the @UrlBinding. The binding prototype is used and the "base url" is built, including clean-URL params if any :

net.sourceforge.stripes.util.UrlBuilder#getBaseURL

I have no idea why the placeholders (UrlBindingParameter instances in the components list) don't get replaced in your case. 

Thinking out loud : 
- are the parameters (the ones that you need in your query) present in the FORM ?
- do you have validation constraints ?

In order to help debugging, you can try to step in UrlBuilder. What I'd do is either :

1/ toss a conditional breakpoint in net/sourceforge/stripes/util/UrlBuilder.java:543, that breaks when the "url" variable contains a brace for example

or

2/ patch the source by adding stuff like : 
if (url.contains("{")) {
  throw new RuntimeException("shit happens");
}
and break on the "throw new..." line.

This way, you'll have the whole environment, stack, variables, and logs. Of course, turn stripes logs to DEBUG before you do this.

One note though : I fail to understand how the {$event} param can be used in a form's action. I mean, it is not known until the user presses a submit, which happens *after* the action attribute gets generated...

Cheers

Rémi






2014-03-10 11:45 GMT+01:00 Grzegorz Krugły <[hidden email]>:
No, there's nothing "fancy" in the code, the request goes to ActionBean
and it returns ForwardResolution to JSP.

W dniu 10.03.2014 11:43, Marcus Kraßmann pisze:
> Maybe it happens when you call the JSP directly while it works when being called by an action bean?
>
> Am 10.03.2014 11:36 schrieb =?UTF-8?Q?Grzegorz_Krug=C5=82y?= <[hidden email]>:
>


------------------------------------------------------------------------------
Learn Graph Databases - Download FREE O'Reilly Book
"Graph Databases" is the definitive new guide to graph databases and their
applications. Written by three acclaimed leaders in the field,
this first edition is now available. Download your free book today!
http://p.sf.net/sfu/13534_NeoTech
_______________________________________________
Stripes-users mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/stripes-users



------------------------------------------------------------------------------
Learn Graph Databases - Download FREE O'Reilly Book
"Graph Databases" is the definitive new guide to graph databases and their
applications. Written by three acclaimed leaders in the field,
this first edition is now available. Download your free book today!
http://p.sf.net/sfu/13534_NeoTech


_______________________________________________
Stripes-users mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/stripes-users


------------------------------------------------------------------------------
Learn Graph Databases - Download FREE O'Reilly Book
"Graph Databases" is the definitive new guide to graph databases and their
applications. Written by three acclaimed leaders in the field,
this first edition is now available. Download your free book today!
http://p.sf.net/sfu/13534_NeoTech
_______________________________________________
Stripes-users mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/stripes-users




------------------------------------------------------------------------------
Learn Graph Databases - Download FREE O'Reilly Book
"Graph Databases" is the definitive new guide to graph databases and their
applications. Written by three acclaimed leaders in the field,
this first edition is now available. Download your free book today!
http://p.sf.net/sfu/13534_NeoTech
_______________________________________________
Stripes-users mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/stripes-users