|
View:
New views
12 Messages
—
Rating Filter:
Alert me
|
|
|
Grabbing the "Current" ResolutionHello,
Let's say I
annotate a method like this:
@Before(LifecycleStage.ResolutionExecution)
When the annotated
method is called, I assume that some Resolution has been chosen, but has yet to
be executed. Is there a way, in that annotated method, to get a reference
to the Resolution that is about to be executed? If so, how do I do
so? Also, will there also be a Resolution available when
binding/validation errors have occurred?
Thanks!!
-Ryan
This e-mail message is being sent solely for use by the intended recipient(s) and may contain confidential information. Any unauthorized review, use, disclosure or distribution is prohibited. If you are not the intended recipient, please contact the sender by phone or reply by e-mail, delete the original message and destroy all copies. Thank you. ------------------------------------------------------------------------- Check out the new SourceForge.net Marketplace. It's the best place to buy or sell services for just about anything Open Source. http://sourceforge.net/services/buy/index.php _______________________________________________ Stripes-users mailing list Stripes-users@... https://lists.sourceforge.net/lists/listinfo/stripes-users |
|
|
Re: Grabbing the "Current" ResolutionWhen you define an Interceptor, Stripes passes an ExecutionContext. This object contains the resolution. I'm not sure, but I don't think that the BeforeAfterMethodInterceptor hands @Before/@After methods the execution context (it would be nice, though, to have the interceptor support an optional parameter).
On Mon, Jun 23, 2008 at 8:41 PM, Asleson, Ryan <asleson@...> wrote:
------------------------------------------------------------------------- Check out the new SourceForge.net Marketplace. It's the best place to buy or sell services for just about anything Open Source. http://sourceforge.net/services/buy/index.php _______________________________________________ Stripes-users mailing list Stripes-users@... https://lists.sourceforge.net/lists/listinfo/stripes-users |
|
|
Re: Grabbing the "Current" ResolutionMaybe do something like this?
public class SomeActionBean extends BaseActionBean { On Mon, Jun 23, 2008 at 2:41 PM, Asleson, Ryan <asleson@...> wrote:
-- Ben Gunter ------------------------------------------------------------------------- Check out the new SourceForge.net Marketplace. It's the best place to buy or sell services for just about anything Open Source. http://sourceforge.net/services/buy/index.php _______________________________________________ Stripes-users mailing list Stripes-users@... https://lists.sourceforge.net/lists/listinfo/stripes-users |
|
|
Re: Grabbing the "Current" ResolutionSorry; fat fingers.
public class SomeActionBean extends BaseActionBean { private Resolution resolution; @Before(LifecycleStage.ResolutionExecution) public blah() { if (this.resolution != null) { // do something with the resolution } } public Resolution doSomething() { return this.resolution = new RedirectResolution( ... ); } } Someone correct me if I'm wrong, but I don't think the interceptor method will ever execute on B&V errors because the lifecycle gets cut short. -Ben On Mon, Jun 23, 2008 at 3:17 PM, Ben Gunter <bgunter@...> wrote: Maybe do something like this? -- Ben Gunter ------------------------------------------------------------------------- Check out the new SourceForge.net Marketplace. It's the best place to buy or sell services for just about anything Open Source. http://sourceforge.net/services/buy/index.php _______________________________________________ Stripes-users mailing list Stripes-users@... https://lists.sourceforge.net/lists/listinfo/stripes-users |
|
|
Re: Grabbing the "Current" ResolutionOK, so if I define an interceptor that intercepts like
this:
@Before(LifecycleStage.ResolutionExecution)
Will the method be called when there's a binding/validation
error, or is it totally skipped?
From: stripes-users-bounces@... [mailto:stripes-users-bounces@...] On Behalf Of Levi Hoogenberg Sent: Monday, June 23, 2008 2:17 PM To: Stripes Users List Subject: Re: [Stripes-users] Grabbing the "Current" Resolution On Mon, Jun 23, 2008 at 8:41 PM, Asleson, Ryan <asleson@...> wrote:
This e-mail message is being sent solely for use by the intended recipient(s) and may contain confidential information. Any unauthorized review, use, disclosure or distribution is prohibited. If you are not the intended recipient, please contact the sender by phone or reply by e-mail, delete the original message and destroy all copies. Thank you. ------------------------------------------------------------------------- Check out the new SourceForge.net Marketplace. It's the best place to buy or sell services for just about anything Open Source. http://sourceforge.net/services/buy/index.php _______________________________________________ Stripes-users mailing list Stripes-users@... https://lists.sourceforge.net/lists/listinfo/stripes-users |
|
|
Re: Grabbing the "Current" ResolutionI just tried this and yes, the interceptor will be invoked (with both the validation errors in place and a net.sourceforge.stripes.action.ValidationErrorReportResolution as resolution).
On Mon, Jun 23, 2008 at 9:50 PM, Asleson, Ryan <asleson@...> wrote:
------------------------------------------------------------------------- Check out the new SourceForge.net Marketplace. It's the best place to buy or sell services for just about anything Open Source. http://sourceforge.net/services/buy/index.php _______________________________________________ Stripes-users mailing list Stripes-users@... https://lists.sourceforge.net/lists/listinfo/stripes-users |
|
|
is it possible to redirect response while rendering stripes template definition jsp?Hello, I have the following task. I need to make
sure that user gets redirected to a certain page anywhere in the app, if
certain condition happens. I have all pages using stripes layout.jsp. Naturally,
I tried to put condition in layout.jsp before or after <stripes:layout-definition>
tag and do <% response.sendRedirect(:http://google.com”) %>
as a proof concept. However, it did not work and there were no exceptions. My
theory is that once stripes starts writing to response object by processing layout
tags (pulling layout.jsp), redirect can no longer be performed. I could prove it by moving the check
condition outside layout.jsp into home.jsp (which is defined layout.jsp as it’s
template) – then, redirect happens. Does it make sense? Is it possible to do
what I am trying to do using layout.jsp? This is tomcat 5.20 stipes 1.4.3 ------------------------------------------------------------------------- Check out the new SourceForge.net Marketplace. It's the best place to buy or sell services for just about anything Open Source. http://sourceforge.net/services/buy/index.php _______________________________________________ Stripes-users mailing list Stripes-users@... https://lists.sourceforge.net/lists/listinfo/stripes-users |
|
|
Re: is it possible to redirect response while rendering stripes template definition jsp?Hi Leonard,
Why not just use an Interceptor? And if said condition happens, return new RedirectResolution("http://www.google.com"); Cheers, Freddy ------------------------------------------------------------------------- Check out the new SourceForge.net Marketplace. It's the best place to buy or sell services for just about anything Open Source. http://sourceforge.net/services/buy/index.php _______________________________________________ Stripes-users mailing list Stripes-users@... https://lists.sourceforge.net/lists/listinfo/stripes-users |
|
|
Re: Grabbing the "Current" ResolutionExcept for ResolutionExecution
> Someone correct me if I'm wrong, but I don't think the interceptor method > will ever execute on B&V errors because the lifecycle gets cut short. For most other lifecycle stages, the lifecycle gets cut short if at any point, a resolution gets returned (which is what happens on B&V errors). However, ResolutionExecution stage does get called, as well as its interceptors, because the resolution still needs to be executed. However, if something bad happens (e.g. exception thrown), all bets are off. Only RequestComplete will be called, since it is in a finally block. That's a good place for resource cleanup. Sorry if I gave more information than necessary, I just happen to be buried in that stuff right now ;) Cheers, Freddy ------------------------------------------------------------------------- Check out the new SourceForge.net Marketplace. It's the best place to buy or sell services for just about anything Open Source. http://sourceforge.net/services/buy/index.php _______________________________________________ Stripes-users mailing list Stripes-users@... https://lists.sourceforge.net/lists/listinfo/stripes-users |
|
|
Re: is it possible to redirect response while rendering stripes template definition jsp?Hi Freddy,
I think this would definitely work. I am reluctant to put interceptor because it does obfuscate the logic; in our case, the requirement is basically to check for an ACL. We have custom tags that evaluate ACL and render the body of the tag or skip it. I wanted to keep this logic on the page since I did not want some ACL resolution to be done by interceptor and others within the pages. I think stripes 1.5 has better support for ACL in general, so I was thinking of reevaluating our security in general once we move to 1.5 My question was more driven by curiosity why redirect does not happen and there are no Exceptions at all. I do have an OK workaround, so I am not stuck. -----Original Message----- From: stripes-users-bounces@... [mailto:stripes-users-bounces@...] On Behalf Of Freddy D. Sent: Monday, June 23, 2008 7:53 PM To: stripes-users@... Subject: Re: [Stripes-users]is it possible to redirect response while rendering stripes template definition jsp? Hi Leonard, Why not just use an Interceptor? And if said condition happens, return new RedirectResolution("http://www.google.com"); Cheers, Freddy ------------------------------------------------------------------------ - Check out the new SourceForge.net Marketplace. It's the best place to buy or sell services for just about anything Open Source. http://sourceforge.net/services/buy/index.php _______________________________________________ Stripes-users mailing list Stripes-users@... https://lists.sourceforge.net/lists/listinfo/stripes-users ------------------------------------------------------------------------- Check out the new SourceForge.net Marketplace. It's the best place to buy or sell services for just about anything Open Source. http://sourceforge.net/services/buy/index.php _______________________________________________ Stripes-users mailing list Stripes-users@... https://lists.sourceforge.net/lists/listinfo/stripes-users |
|
|
Re: is it possible to redirect response while rendering stripes template definition jsp?On Jun 23, 2008, at 8:07 PM, Leonard Gestrin wrote: > My question was more driven by curiosity why redirect does not happen > and there are no Exceptions at all. A redirect is done by setting an HTTP header. Once the response starts streaming, header can no longer be written. To add to the fun, this isn't precisely true. JSPs stream in to a buffer, when the buffer fills up, it's "committed" to the browser. Up until that commit point, you can set headers and what not. So, you could expand the buffer for all of your JSPs, of you can make your redirect decision earlier in the process. Regards, Will Hartung ------------------------------------------------------------------------- Check out the new SourceForge.net Marketplace. It's the best place to buy or sell services for just about anything Open Source. http://sourceforge.net/services/buy/index.php _______________________________________________ Stripes-users mailing list Stripes-users@... https://lists.sourceforge.net/lists/listinfo/stripes-users |
|
|
Re: is it possible to redirect response whilerendering stripes template definition jsp?Thanks for the explanation.
P.S. I switched to interceptor. Works likes a charm. -----Original Message----- From: stripes-users-bounces@... [mailto:stripes-users-bounces@...] On Behalf Of Will Hartung Sent: Monday, June 23, 2008 8:50 PM To: Stripes Users List Subject: Re: [Stripes-users] is it possible to redirect response whilerendering stripes template definition jsp? On Jun 23, 2008, at 8:07 PM, Leonard Gestrin wrote: > My question was more driven by curiosity why redirect does not happen > and there are no Exceptions at all. A redirect is done by setting an HTTP header. Once the response starts streaming, header can no longer be written. To add to the fun, this isn't precisely true. JSPs stream in to a buffer, when the buffer fills up, it's "committed" to the browser. Up until that commit point, you can set headers and what not. So, you could expand the buffer for all of your JSPs, of you can make your redirect decision earlier in the process. Regards, Will Hartung ------------------------------------------------------------------------ - Check out the new SourceForge.net Marketplace. It's the best place to buy or sell services for just about anything Open Source. http://sourceforge.net/services/buy/index.php _______________________________________________ Stripes-users mailing list Stripes-users@... https://lists.sourceforge.net/lists/listinfo/stripes-users ------------------------------------------------------------------------- Check out the new SourceForge.net Marketplace. It's the best place to buy or sell services for just about anything Open Source. http://sourceforge.net/services/buy/index.php _______________________________________________ Stripes-users mailing list Stripes-users@... https://lists.sourceforge.net/lists/listinfo/stripes-users |
| Free Forum Powered by Nabble | Forum Help |