You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@myfaces.apache.org by Jason Kissinger <Ja...@guidant.com> on 2005/08/18 18:26:11 UTC
access to request values prior to 'apply request values'
How do we access the request values in a pre-Restore View phase
listener? We want to do something like:
public PhaseId getPhaseId() {
return PhaseId.RESTORE_VIEW;
}
public void beforePhase(PhaseEvent e) {
...
Hashtable postValues = HttpUtils.parsePostData(
req.getContentLength(),
req.getInputStream());
...
}
but this throws a 'java.lang.IllegalArgumentException: Short Read'.
We're trying to implement a 'request thread' scope (longer than request,
shorter than session) by adding a hidden input on our pages. We then
want to pull this and set it into a request scoped 'page' backing bean
in a pre-Restore View phase listener. Then during the lifecycle events,
our normal request-scoped backing beans will initialize themselves from
a session-scoped cache bean using the hidden input as a reference to the
correct 'request thread'.
Re: access to request values prior to 'apply request values'
Posted by Jason Kissinger <Ja...@guidant.com>.
Thank you!
I feel so stupid... we were already using the parameterMap with a
different key to allow client to bootstrap an existing 'request thread'
through the url (ie http://.../file.jsf?clientId=1234), but used a
different clientId for the hidden component. I didn't realize the
parameterMap held both GET and POST values. Everything works now.
Thanks a million!
-Jason
On Thu, 2005-08-18 at 18:49 +0200, Volker Weber wrote:
> If you know the clientId of your hidden input you can do
>
> FacesContext.getCurrentInstance().getExternalContext()
> .getRequestParameterMap().get(<clientId>);
>
> never tryed, but should work.
>
> Regards
>
> Jason Kissinger wrote:
> > How do we access the request values in a pre-Restore View phase
> > listener? We want to do something like:
> >
> > public PhaseId getPhaseId() {
> > return PhaseId.RESTORE_VIEW;
> > }
> >
> > public void beforePhase(PhaseEvent e) {
> > ...
> > Hashtable postValues = HttpUtils.parsePostData(
> > req.getContentLength(),
> > req.getInputStream());
> > ...
> > }
> >
> > but this throws a 'java.lang.IllegalArgumentException: Short Read'.
> >
> >
> >
> > We're trying to implement a 'request thread' scope (longer than request,
> > shorter than session) by adding a hidden input on our pages. We then
> > want to pull this and set it into a request scoped 'page' backing bean
> > in a pre-Restore View phase listener. Then during the lifecycle events,
> > our normal request-scoped backing beans will initialize themselves from
> > a session-scoped cache bean using the hidden input as a reference to the
> > correct 'request thread'.
> >
>
Re: access to request values prior to 'apply request values'
Posted by Volker Weber <us...@weber-oldenburg.de>.
If you know the clientId of your hidden input you can do
FacesContext.getCurrentInstance().getExternalContext()
.getRequestParameterMap().get(<clientId>);
never tryed, but should work.
Regards
Jason Kissinger wrote:
> How do we access the request values in a pre-Restore View phase
> listener? We want to do something like:
>
> public PhaseId getPhaseId() {
> return PhaseId.RESTORE_VIEW;
> }
>
> public void beforePhase(PhaseEvent e) {
> ...
> Hashtable postValues = HttpUtils.parsePostData(
> req.getContentLength(),
> req.getInputStream());
> ...
> }
>
> but this throws a 'java.lang.IllegalArgumentException: Short Read'.
>
>
>
> We're trying to implement a 'request thread' scope (longer than request,
> shorter than session) by adding a hidden input on our pages. We then
> want to pull this and set it into a request scoped 'page' backing bean
> in a pre-Restore View phase listener. Then during the lifecycle events,
> our normal request-scoped backing beans will initialize themselves from
> a session-scoped cache bean using the hidden input as a reference to the
> correct 'request thread'.
>
--
Don't answer to From: address!
Mail to this account are droped if not recieved via mailinglist.
To contact me direct create the mail address by
concatenating my forename to my senders domain.