You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by Laurie Harper <la...@holoweb.net> on 2006/01/19 19:55:28 UTC

[shale] ViewHandler registration

I have a custom ViewControllerMapper which depends on resources set up 
by my ViewHandler implementation. Unfortunately, in some circumstances, 
ShaleViewHandler calls the mapper before my view handler has done its 
work. I think the problem is that ShaleViewHandler gets installed as a 
wrapper around my view handler, rather than the other way round.

Is there anyway to control that? I'm pretty sure JSF doesn't provide a 
way to do so, but was hoping this might be something Shale could help 
with...

L.


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


Re: Forward After response.getOutputStream

Posted by Mike Darretta <mi...@metnet.navy.mil>.
I think your answer suffices for this time, but my original objective 
was to:

(1) Execute a download of an output stream for a file built on the fly
(2) Forward to another page indicating the download succeded.

Mike

P.S. Thanks for the posting advice...I thought I was posting to the 
entire list.

Laurie Harper wrote:

> Mike Darretta wrote:
> 
>> I posted a similar question yesterday...thought I'd try again.
> 
> 
> Perhaps you posted that one in the middle of another thread as well? 
> Make sure you post new threads as fresh messages, not replies to 
> unrelated messages, to make sure they get seen by as many people as 
> possible.
> 
>> Is there a good way to forward a response after calling 
>> response.getOutputStream()? I've done a lot of web searching, and find 
>> the question asked many times. Yet, I've been unsuccessful (or simply 
>> dense) in finding a suitable answer. Any assistance is appreciated.
> 
> 
> No, that's prohibited. Iff the response is buffered you *might* be able 
> to reset the output stream and do a forward, but really the solution is 
> not to write to the output stream until you know you don't need to do a 
> forward.
> 
> What are you trying to achieve that's requiring this?
> 
> L.
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
> For additional commands, e-mail: user-help@struts.apache.org
> 
> 

-- 

Mike Darretta
Computer Sciences Corporation (CSC)
Sr. Software Engineer
(o) 831.656.4324
(c) 209.814.2774
michael.darretta.ctr@metnet.navy.mil

------------------------------------------------------------
This is a PRIVATE message. If you are not the intended recipient, please 
delete without copying and kindly advise us by e-mail of the mistake in 
delivery. NOTE: Regardless of content, this e-mail shall not operate to 
bind CSC to any order or other contract unless pursuant to explicit 
written agreement or government initiative expressly permitting the use 
of e-mail for such purpose.
------------------------------------------------------------


Re: Forward After response.getOutputStream

Posted by Laurie Harper <la...@holoweb.net>.
Mike Darretta wrote:
> I posted a similar question yesterday...thought I'd try again.

Perhaps you posted that one in the middle of another thread as well? 
Make sure you post new threads as fresh messages, not replies to 
unrelated messages, to make sure they get seen by as many people as 
possible.

> Is there a good way to forward a response after calling 
> response.getOutputStream()? I've done a lot of web searching, and find 
> the question asked many times. Yet, I've been unsuccessful (or simply 
> dense) in finding a suitable answer. Any assistance is appreciated.

No, that's prohibited. Iff the response is buffered you *might* be able 
to reset the output stream and do a forward, but really the solution is 
not to write to the output stream until you know you don't need to do a 
forward.

What are you trying to achieve that's requiring this?

L.


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


Forward After response.getOutputStream

Posted by Mike Darretta <mi...@metnet.navy.mil>.
Hi again.

I posted a similar question yesterday...thought I'd try again.

Is there a good way to forward a response after calling 
response.getOutputStream()? I've done a lot of web searching, and find 
the question asked many times. Yet, I've been unsuccessful (or simply 
dense) in finding a suitable answer. Any assistance is appreciated.

Thanks in advance!
Mike

------------------------------------------------------------
This is a PRIVATE message. If you are not the intended recipient, please 
delete without copying and kindly advise us by e-mail of the mistake in 
delivery. NOTE: Regardless of content, this e-mail shall not operate to 
bind CSC to any order or other contract unless pursuant to explicit 
written agreement or government initiative expressly permitting the use 
of e-mail for such purpose.
------------------------------------------------------------


Re: [shale] ViewHandler registration

Posted by Ryan Wynn <bi...@gmail.com>.
> > You are correct that there's no current way to control the order of view
> > handler initialization. For the specific case of choosing a
> > ViewControllerMapper instance, however, use the context init parameter
> > ShaleApplicationFilter.VIEW_CONTROLLER_MAPPER (the literal value is "
> > org.apache.shale.view.VIEW_CONTROLLER_MAPPER") to specify the fully
> > qualified class name.  Shale's view handler will then use your
> > implementation.

I've notice that with the myfaces impl (not sure if same is true for
sun) that faces-config.xml are loaded from jars in alphabetical order.
 So to get my view handler registered as the outermost I named my jar
zzz-jar.jar.  I wish there was some form of "depends" notation for
faces-config.xml files to enforce order.

Re: [shale] ViewHandler registration

Posted by Laurie Harper <la...@holoweb.net>.
Craig McClanahan wrote:
> On 1/19/06, Laurie Harper <la...@holoweb.net> wrote:
>> I have a custom ViewControllerMapper which depends on resources set up
>> by my ViewHandler implementation. Unfortunately, in some circumstances,
>> ShaleViewHandler calls the mapper before my view handler has done its
>> work. I think the problem is that ShaleViewHandler gets installed as a
>> wrapper around my view handler, rather than the other way round.
>>
>> Is there anyway to control that? I'm pretty sure JSF doesn't provide a
>> way to do so, but was hoping this might be something Shale could help
>> with...
> 
> You are correct that there's no current way to control the order of view
> handler initialization. For the specific case of choosing a
> ViewControllerMapper instance, however, use the context init parameter
> ShaleApplicationFilter.VIEW_CONTROLLER_MAPPER (the literal value is "
> org.apache.shale.view.VIEW_CONTROLLER_MAPPER") to specify the fully
> qualified class name.  Shale's view handler will then use your
> implementation.

Yeah, the mapper registration is working fine, it's just that it needs 
resources that are initialized by the view handler, so I need my view 
handler to be the outer-most one.

I guess I'll have to work around it by accessing that data via a static 
helper method on the view handler that'll lazy-init the required 
resources if necessary.

L.


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


Re: [shale] ViewHandler registration

Posted by Craig McClanahan <cr...@apache.org>.
On 1/19/06, Laurie Harper <la...@holoweb.net> wrote:
>
> I have a custom ViewControllerMapper which depends on resources set up
> by my ViewHandler implementation. Unfortunately, in some circumstances,
> ShaleViewHandler calls the mapper before my view handler has done its
> work. I think the problem is that ShaleViewHandler gets installed as a
> wrapper around my view handler, rather than the other way round.
>
> Is there anyway to control that? I'm pretty sure JSF doesn't provide a
> way to do so, but was hoping this might be something Shale could help
> with...


You are correct that there's no current way to control the order of view
handler initialization. For the specific case of choosing a
ViewControllerMapper instance, however, use the context init parameter
ShaleApplicationFilter.VIEW_CONTROLLER_MAPPER (the literal value is "
org.apache.shale.view.VIEW_CONTROLLER_MAPPER") to specify the fully
qualified class name.  Shale's view handler will then use your
implementation.

L.


Craig