You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@struts.apache.org by Matthias Wessendorf <ma...@matthias-wessendorf.de> on 2004/06/24 19:50:02 UTC

[Struts-Faces] wrapping a HttpServletRequest

Hi, i tried the faces-struts-lib with RI.
It works.

But not with Open-Source-Implementation *MyFaces*.
i notices, that in struts-faces the servletPath is
a *.do (or that for struts).

But it must be an faces-mapping for servlet-Path
(*.faces e.g.)
the FacesRequestProcessor know if request is for
ActionSerclet or not.

If not, it delegates it to JSF-Impl.
Base of checking is a URI, that is configed 
in <forward name="success" path="/test.faces"/> (e.g.)

so i wrote a simple HttpServletRequestWrapper
which wrappes the uri as new ServletPath.
now everything is fine.

like this (in FacesRequesProcessor)
<code>
           FacesContextFactory fcf = (FacesContextFactory)
 
FactoryFinder.getFactory(FactoryFinder.FACES_CONTEXT_FACTORY);

                HttpServletRequestWrapper wrapper = new
HttpServletRequestWrapper(request,uri);


            context = fcf.getFacesContext(servlet.getServletContext(),
wrapper,
                                          response, lifecycle); 
</code>
it is not an error in myfaces-impl. 
it is an bug in the RI.

please see the email of Ted Husted (on myfaces-list)
<ted>

On Wed, 23 Jun 2004 20:21:49 -0700,
myfaces-develop-request@lists.sourceforge.net wrote:
> the MyFaces implementation is correct in this aspect and I don't think

> we should clone the bugs of the RI just because struts relies on them.

> I hope spec-compliant does not mean we have to have the same bugs the 
> RI has ;-)? By the way, if the RI is fixed, struts will not work there

> any longer, too.

The RI and Struts-Faces were created in tandem, so it's not surprising
the same assumptions crop up in each. But, no, specification-compliant
does not mean that we should rely on bugs in any implementation,
including the RI. In fact, the Struts tradition has been to expose bugs
in implementations so that vendors are compelled to fix them. 

If you develop any patches you would like applied, please bring them to
my attention. Once we can get 1.2.1 out-the-door (could be this week),
we will be setting up several subprojects, including Struts-Faces, that
can be released separately. 

> So the clean solution from my point of view is to fix the issue in 
> struts. For example it would be possible to wrap the servlet request 
> before the FacesContext is created. The wrapper takes the uri of the 
> view to be displayed to simulate a valid jsf servlet path for the view

> manager. What do you think?
>
> Oliver

</ted>


and here is the simple wrapper-class:
i can apply a patch, but on that i will
do a bit better documentation of that
wrapper-class


Cheers,
Matthias

/*
 * Copyright 2002,2004 The Apache Software Foundation.
 * 
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 * 
 *      http://www.apache.org/licenses/LICENSE-2.0
 * 
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */
package org.apache.struts.faces.util;

import java.io.BufferedReader;
import java.io.IOException;
import java.io.UnsupportedEncodingException;
import java.security.Principal;
import java.util.Enumeration;
import java.util.Locale;
import java.util.Map;

import javax.servlet.RequestDispatcher;
import javax.servlet.ServletInputStream;
import javax.servlet.http.Cookie;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpSession;

/**
 * <p>Concrete implementation of <code>HttpServletRequest</code> that
 * that wrapps the <code>ServletPath</code> with an URI, that was
detected
 * by <code>ActionServlet</code> to forward to a standard
<code>FacesServlet</code>.
 *
 */
public class HttpServletRequestWrapper implements HttpServletRequest {

	// ------------------------------------------------------
Instance Variables
	
	protected HttpServletRequest original = null;
	protected String servletPath = null;

	// ------------------------------------------------------------
Constructors


	/**
	 * <p>Construct a new <code>HttpServletRequest</code> instance
	 * and an URI, which is used by <code>FacesServlet</code>.</p>
	 *
	 * @param request Original default
<code>HttpServletRequest</code>
	 *
	 * @param servletPat the new ServletPath for a
<code>FacesServlet</code>
	 *
	 */
	
	public HttpServletRequestWrapper(HttpServletRequest request,
String servletPath){
		this.original = request;
		this.servletPath = servletPath;
	}

	// ----------------------------------------------------------
Public Methods


	/**
	 * <p>Returns the new <code>ServletPath</code> needed by a
FacesServlet.</p>
	 *
	 */
	public String getServletPath() {
		// TODO Auto-generated method stub
		return this.servletPath;
	}

	// ----------------------------------------------------------
Delegate Methods
	
	
	/* (non-Javadoc)
	 * @see java.lang.Object#equals(java.lang.Object)
	 */
	public boolean equals(Object arg0) {
		return original.equals(arg0);
	}

	...
}




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


Re: [Struts-Faces] wrapping a HttpServletRequest

Posted by Craig McClanahan <cr...@apache.org>.
Matthias Wessendorf wrote:

>Craig,
>
>i tried the struts-faces-example with myfaces
>and RI (worked out of the box)
>
>this happens with myfaces:
>
>i clicked LINK "editRegistration.do?action=Create"
>and become IllegalArgumentException:
>
>could not find pathMapping for servletPath = /editRegistration.do
>requestPathInfo = null
>	
>net.sourceforge.myfaces.application.jsp.JspViewHandlerImpl.getServletMap
>ping(JspViewHandlerImpl.java:407)
>	
>net.sourceforge.myfaces.application.jsp.JspViewHandlerImpl.renderView(Js
>pViewHandlerImpl.java:185)
>	
>org.apache.struts.faces.application.ViewHandlerImpl.renderView(ViewHandl
>erImpl.java:134)
>	
>net.sourceforge.myfaces.lifecycle.LifecycleImpl.render(LifecycleImpl.jav
>a:282)
>	
>org.apache.struts.faces.application.FacesRequestProcessor.doForward(Face
>sRequestProcessor.java:148)
>
>
>okay, after that i looked in myfaces JspViewHandlerImpl.java
>and noticed we only react on FacesServlet-Mappings (eg *.faces,
>/faces/*,...)
>i changed it, now it works
>
>but as a result of following discussion on myfaces-mailinglist
>(see the three forwards)
>
>i decided to create that wrapper,
>that sets requestPath from struts (*do)
>to faces (*.faces) now it works again with myfaces and of course RI
>
>so perhaps you have other hints on that?
>
>Matthias
>  
>
Matthias,

Thanks for the forwards ... I'm going to get out my trusty debugger and 
walk through this in detail.  At first glance, it appears more likely 
that the problem is in Struts, calculating the view id in the created 
component tree (the processing should convert "/registration.faces" to 
"/registration.jsp" in the particular example webapp, before calling 
ViewHandler.renderView()).  If that were to be done,  a ViewHandler 
implementation that relied solely on the view id *should* work, with no 
wrapper -- we'll see if that prediction comes true or not.

This chunk of code is bringing back bad memories :-) of the work it took 
to get this to run at all.  I see that it needs some more work :-) :-).

The change in servletPath is part of what a RequestDispatcher.forward() 
call normally does (that's what happens on a normal Struts request).  I 
ran into quite a few difficulties making an RD.forward() to the Faces 
servlet do the right thing here -- but if using a wrapper ends up being 
the right solution, there's some other things we'll need to change as 
well so that it works with a prefix mapped FacesServlet (/faces/*) too.

More news as I debug this further.

Craig

PS:  There was an implication in the mail and bug report comments that 
the RI is violating the spec in its view handler implementation.  If it 
is, I'd like to fix that, and my commit privileges there still work 
:-).  Can you point to any specific place where that might be true?



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


RE: [Struts-Faces] wrapping a HttpServletRequest

Posted by Matthias Wessendorf <ma...@matthias-wessendorf.de>.
Craig,

i tried the struts-faces-example with myfaces
and RI (worked out of the box)

this happens with myfaces:

i clicked LINK "editRegistration.do?action=Create"
and become IllegalArgumentException:

could not find pathMapping for servletPath = /editRegistration.do
requestPathInfo = null
	
net.sourceforge.myfaces.application.jsp.JspViewHandlerImpl.getServletMap
ping(JspViewHandlerImpl.java:407)
	
net.sourceforge.myfaces.application.jsp.JspViewHandlerImpl.renderView(Js
pViewHandlerImpl.java:185)
	
org.apache.struts.faces.application.ViewHandlerImpl.renderView(ViewHandl
erImpl.java:134)
	
net.sourceforge.myfaces.lifecycle.LifecycleImpl.render(LifecycleImpl.jav
a:282)
	
org.apache.struts.faces.application.FacesRequestProcessor.doForward(Face
sRequestProcessor.java:148)


okay, after that i looked in myfaces JspViewHandlerImpl.java
and noticed we only react on FacesServlet-Mappings (eg *.faces,
/faces/*,...)
i changed it, now it works

but as a result of following discussion on myfaces-mailinglist
(see the three forwards)

i decided to create that wrapper,
that sets requestPath from struts (*do)
to faces (*.faces) now it works again with myfaces and of course RI

so perhaps you have other hints on that?

Matthias

> -----Original Message-----
> From: Craig McClanahan [mailto:craigmcc@apache.org] 
> Sent: Thursday, July 08, 2004 3:27 AM
> To: Struts Developers List
> Cc: mailings@matthias-wessendorf.de
> Subject: Re: [Struts-Faces] wrapping a HttpServletRequest
> 
> 
> Matthias Wessendorf wrote:
> 
> >Hi, i tried the faces-struts-lib with RI.
> >It works.
> >
> >  
> >
> Matthias,
> 
> Could you please explain in more detail exactly what appears 
> to you to 
> be a bug in the struts-faces library that requires this wrapper, and 
> also what unspecified behavior in the RI is being relied on?  This is 
> not at all obvious to me -- and I intend to pull the wrapper back out 
> unless you can show me why it's needed.  The explanation 
> below, and all 
> the mail threads and messages on bug 29809, still haven't 
> made it clear 
> to me what the problems you are trying to solve really are.
> 
> Craig
> 
> 
> 
> >But not with Open-Source-Implementation *MyFaces*.
> >i notices, that in struts-faces the servletPath is
> >a *.do (or that for struts).
> >
> >But it must be an faces-mapping for servlet-Path
> >(*.faces e.g.)
> >the FacesRequestProcessor know if request is for
> >ActionSerclet or not.
> >
> >If not, it delegates it to JSF-Impl.
> >Base of checking is a URI, that is configed
> >in <forward name="success" path="/test.faces"/> (e.g.)
> >
> >so i wrote a simple HttpServletRequestWrapper
> >which wrappes the uri as new ServletPath.
> >now everything is fine.
> >
> >like this (in FacesRequesProcessor)
> ><code>
> >           FacesContextFactory fcf = (FacesContextFactory)
> > 
> >FactoryFinder.getFactory(FactoryFinder.FACES_CONTEXT_FACTORY);
> >
> >                HttpServletRequestWrapper wrapper = new
> >HttpServletRequestWrapper(request,uri);
> >
> >
> >            context = 
> fcf.getFacesContext(servlet.getServletContext(),
> >wrapper,
> >                                          response, lifecycle);
> ></code>
> >it is not an error in myfaces-impl. 
> >it is an bug in the RI.
> >
> >please see the email of Ted Husted (on myfaces-list)
> ><ted>
> >
> >On Wed, 23 Jun 2004 20:21:49 -0700, 
> >myfaces-develop-request@lists.sourceforge.net wrote:
> >  
> >
> >>the MyFaces implementation is correct in this aspect and I 
> don't think
> >>    
> >>
> >
> >  
> >
> >>we should clone the bugs of the RI just because struts 
> relies on them.
> >>    
> >>
> >
> >  
> >
> >>I hope spec-compliant does not mean we have to have the 
> same bugs the
> >>RI has ;-)? By the way, if the RI is fixed, struts will not 
> work there
> >>    
> >>
> >
> >  
> >
> >>any longer, too.
> >>    
> >>
> >
> >The RI and Struts-Faces were created in tandem, so it's not 
> surprising 
> >the same assumptions crop up in each. But, no, 
> specification-compliant 
> >does not mean that we should rely on bugs in any implementation, 
> >including the RI. In fact, the Struts tradition has been to 
> expose bugs 
> >in implementations so that vendors are compelled to fix them.
> >
> >If you develop any patches you would like applied, please 
> bring them to 
> >my attention. Once we can get 1.2.1 out-the-door (could be 
> this week), 
> >we will be setting up several subprojects, including 
> Struts-Faces, that 
> >can be released separately.
> >
> >  
> >
> >>So the clean solution from my point of view is to fix the issue in
> >>struts. For example it would be possible to wrap the 
> servlet request 
> >>before the FacesContext is created. The wrapper takes the 
> uri of the 
> >>view to be displayed to simulate a valid jsf servlet path 
> for the view
> >>    
> >>
> >
> >  
> >
> >>manager. What do you think?
> >>
> >>Oliver
> >>    
> >>
> >
> ></ted>
> >
> >
> >and here is the simple wrapper-class:
> >i can apply a patch, but on that i will
> >do a bit better documentation of that
> >wrapper-class
> >
> >
> >Cheers,
> >Matthias
> >
> >/*
> > * Copyright 2002,2004 The Apache Software Foundation.
> > *
> > * Licensed under the Apache License, Version 2.0 (the "License");
> > * you may not use this file except in compliance with the License.
> > * You may obtain a copy of the License at
> > * 
> > *      http://www.apache.org/licenses/LICENSE-2.0
> > * 
> > * Unless required by applicable law or agreed to in 
> writing, software
> > * distributed under the License is distributed on an "AS IS" BASIS,
> > * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
> >implied.
> > * See the License for the specific language governing 
> permissions and
> > * limitations under the License.
> > */
> >package org.apache.struts.faces.util;
> >
> >import java.io.BufferedReader;
> >import java.io.IOException;
> >import java.io.UnsupportedEncodingException;
> >import java.security.Principal;
> >import java.util.Enumeration;
> >import java.util.Locale;
> >import java.util.Map;
> >
> >import javax.servlet.RequestDispatcher;
> >import javax.servlet.ServletInputStream;
> >import javax.servlet.http.Cookie;
> >import javax.servlet.http.HttpServletRequest;
> >import javax.servlet.http.HttpSession;
> >
> >/**
> > * <p>Concrete implementation of <code>HttpServletRequest</code> that
> > * that wrapps the <code>ServletPath</code> with an URI, that was 
> >detected
> > * by <code>ActionServlet</code> to forward to a standard 
> ><code>FacesServlet</code>.
> > *
> > */
> >public class HttpServletRequestWrapper implements 
> HttpServletRequest {
> >
> >	// ------------------------------------------------------
> >Instance Variables
> >	
> >	protected HttpServletRequest original = null;
> >	protected String servletPath = null;
> >
> >	// ------------------------------------------------------------
> >Constructors
> >
> >
> >	/**
> >	 * <p>Construct a new <code>HttpServletRequest</code> instance
> >	 * and an URI, which is used by <code>FacesServlet</code>.</p>
> >	 *
> >	 * @param request Original default 
> <code>HttpServletRequest</code>
> >	 *
> >	 * @param servletPat the new ServletPath for a
> ><code>FacesServlet</code>
> >	 *
> >	 */
> >	
> >	public HttpServletRequestWrapper(HttpServletRequest 
> request, String 
> >servletPath){
> >		this.original = request;
> >		this.servletPath = servletPath;
> >	}
> >
> >	// ----------------------------------------------------------
> >Public Methods
> >
> >
> >	/**
> >	 * <p>Returns the new <code>ServletPath</code> needed by a 
> >FacesServlet.</p>
> >	 *
> >	 */
> >	public String getServletPath() {
> >		// TODO Auto-generated method stub
> >		return this.servletPath;
> >	}
> >
> >	// ----------------------------------------------------------
> >Delegate Methods
> >	
> >	
> >	/* (non-Javadoc)
> >	 * @see java.lang.Object#equals(java.lang.Object)
> >	 */
> >	public boolean equals(Object arg0) {
> >		return original.equals(arg0);
> >	}
> >
> >	...
> >}
> >
> >
> >
> >
> >---------------------------------------------------------------------
> >To unsubscribe, e-mail: dev-unsubscribe@struts.apache.org
> >For additional commands, e-mail: dev-help@struts.apache.org
> >  
> >
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: dev-unsubscribe@struts.apache.org
> For additional commands, e-mail: dev-help@struts.apache.org
> 


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


Re: [Struts-Faces] wrapping a HttpServletRequest

Posted by Craig McClanahan <cr...@apache.org>.
Matthias Wessendorf wrote:

>Hi, i tried the faces-struts-lib with RI.
>It works.
>
>  
>
Matthias,

Could you please explain in more detail exactly what appears to you to 
be a bug in the struts-faces library that requires this wrapper, and 
also what unspecified behavior in the RI is being relied on?  This is 
not at all obvious to me -- and I intend to pull the wrapper back out 
unless you can show me why it's needed.  The explanation below, and all 
the mail threads and messages on bug 29809, still haven't made it clear 
to me what the problems you are trying to solve really are.

Craig



>But not with Open-Source-Implementation *MyFaces*.
>i notices, that in struts-faces the servletPath is
>a *.do (or that for struts).
>
>But it must be an faces-mapping for servlet-Path
>(*.faces e.g.)
>the FacesRequestProcessor know if request is for
>ActionSerclet or not.
>
>If not, it delegates it to JSF-Impl.
>Base of checking is a URI, that is configed 
>in <forward name="success" path="/test.faces"/> (e.g.)
>
>so i wrote a simple HttpServletRequestWrapper
>which wrappes the uri as new ServletPath.
>now everything is fine.
>
>like this (in FacesRequesProcessor)
><code>
>           FacesContextFactory fcf = (FacesContextFactory)
> 
>FactoryFinder.getFactory(FactoryFinder.FACES_CONTEXT_FACTORY);
>
>                HttpServletRequestWrapper wrapper = new
>HttpServletRequestWrapper(request,uri);
>
>
>            context = fcf.getFacesContext(servlet.getServletContext(),
>wrapper,
>                                          response, lifecycle); 
></code>
>it is not an error in myfaces-impl. 
>it is an bug in the RI.
>
>please see the email of Ted Husted (on myfaces-list)
><ted>
>
>On Wed, 23 Jun 2004 20:21:49 -0700,
>myfaces-develop-request@lists.sourceforge.net wrote:
>  
>
>>the MyFaces implementation is correct in this aspect and I don't think
>>    
>>
>
>  
>
>>we should clone the bugs of the RI just because struts relies on them.
>>    
>>
>
>  
>
>>I hope spec-compliant does not mean we have to have the same bugs the 
>>RI has ;-)? By the way, if the RI is fixed, struts will not work there
>>    
>>
>
>  
>
>>any longer, too.
>>    
>>
>
>The RI and Struts-Faces were created in tandem, so it's not surprising
>the same assumptions crop up in each. But, no, specification-compliant
>does not mean that we should rely on bugs in any implementation,
>including the RI. In fact, the Struts tradition has been to expose bugs
>in implementations so that vendors are compelled to fix them. 
>
>If you develop any patches you would like applied, please bring them to
>my attention. Once we can get 1.2.1 out-the-door (could be this week),
>we will be setting up several subprojects, including Struts-Faces, that
>can be released separately. 
>
>  
>
>>So the clean solution from my point of view is to fix the issue in 
>>struts. For example it would be possible to wrap the servlet request 
>>before the FacesContext is created. The wrapper takes the uri of the 
>>view to be displayed to simulate a valid jsf servlet path for the view
>>    
>>
>
>  
>
>>manager. What do you think?
>>
>>Oliver
>>    
>>
>
></ted>
>
>
>and here is the simple wrapper-class:
>i can apply a patch, but on that i will
>do a bit better documentation of that
>wrapper-class
>
>
>Cheers,
>Matthias
>
>/*
> * Copyright 2002,2004 The Apache Software Foundation.
> * 
> * Licensed under the Apache License, Version 2.0 (the "License");
> * you may not use this file except in compliance with the License.
> * You may obtain a copy of the License at
> * 
> *      http://www.apache.org/licenses/LICENSE-2.0
> * 
> * Unless required by applicable law or agreed to in writing, software
> * distributed under the License is distributed on an "AS IS" BASIS,
> * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
>implied.
> * See the License for the specific language governing permissions and
> * limitations under the License.
> */
>package org.apache.struts.faces.util;
>
>import java.io.BufferedReader;
>import java.io.IOException;
>import java.io.UnsupportedEncodingException;
>import java.security.Principal;
>import java.util.Enumeration;
>import java.util.Locale;
>import java.util.Map;
>
>import javax.servlet.RequestDispatcher;
>import javax.servlet.ServletInputStream;
>import javax.servlet.http.Cookie;
>import javax.servlet.http.HttpServletRequest;
>import javax.servlet.http.HttpSession;
>
>/**
> * <p>Concrete implementation of <code>HttpServletRequest</code> that
> * that wrapps the <code>ServletPath</code> with an URI, that was
>detected
> * by <code>ActionServlet</code> to forward to a standard
><code>FacesServlet</code>.
> *
> */
>public class HttpServletRequestWrapper implements HttpServletRequest {
>
>	// ------------------------------------------------------
>Instance Variables
>	
>	protected HttpServletRequest original = null;
>	protected String servletPath = null;
>
>	// ------------------------------------------------------------
>Constructors
>
>
>	/**
>	 * <p>Construct a new <code>HttpServletRequest</code> instance
>	 * and an URI, which is used by <code>FacesServlet</code>.</p>
>	 *
>	 * @param request Original default
><code>HttpServletRequest</code>
>	 *
>	 * @param servletPat the new ServletPath for a
><code>FacesServlet</code>
>	 *
>	 */
>	
>	public HttpServletRequestWrapper(HttpServletRequest request,
>String servletPath){
>		this.original = request;
>		this.servletPath = servletPath;
>	}
>
>	// ----------------------------------------------------------
>Public Methods
>
>
>	/**
>	 * <p>Returns the new <code>ServletPath</code> needed by a
>FacesServlet.</p>
>	 *
>	 */
>	public String getServletPath() {
>		// TODO Auto-generated method stub
>		return this.servletPath;
>	}
>
>	// ----------------------------------------------------------
>Delegate Methods
>	
>	
>	/* (non-Javadoc)
>	 * @see java.lang.Object#equals(java.lang.Object)
>	 */
>	public boolean equals(Object arg0) {
>		return original.equals(arg0);
>	}
>
>	...
>}
>
>
>
>
>---------------------------------------------------------------------
>To unsubscribe, e-mail: dev-unsubscribe@struts.apache.org
>For additional commands, e-mail: dev-help@struts.apache.org
>  
>


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


RE: [Struts-Faces] wrapping a HttpServletRequest

Posted by Matthias Wessendorf <ma...@matthias-wessendorf.de>.
James,

i did an upload for servlet2.3
http://issues.apache.org/bugzilla/show_bug.cgi?id=29809

see patch-file
http://issues.apache.org/bugzilla/showattachment.cgi?attach_id=11956
..
Matthias

> -----Original Message-----
> From: James Holmes [mailto:james@jamesholmes.com] 
> Sent: Tuesday, June 29, 2004 3:29 PM
> To: 'Struts Developers List'
> Subject: RE: [Struts-Faces] wrapping a HttpServletRequest
> 
> 
> Matthias,
> 
> Did you see Ted's note attached to your Bugzilla ticket for 
> Struts-Faces? He wants the code to work with the previous 
> version of the servlet spec.
> 
> -James
> 
> -----Original Message-----
> From: Matthias Wessendorf [mailto:mailings@matthias-wessendorf.de] 
> Sent: Friday, June 25, 2004 12:19 PM
> To: 'Struts Developers List'
> Subject: RE: [Struts-Faces] wrapping a HttpServletRequest
> 
> One i missed to mention,
> 
> this *solution* is not bound to MyFaces,
> it works also with the RI shipped by Sun...
> 
> :-)
> Cheers,
> 
> > -----Original Message-----
> > From: Matthias Wessendorf [mailto:mailings@matthias-wessendorf.de]
> > Sent: Thursday, June 24, 2004 7:50 PM
> > To: dev@struts.apache.org; husted@apache.org
> > Subject: [Struts-Faces] wrapping a HttpServletRequest
> > 
> > 
> > Hi, i tried the faces-struts-lib with RI.
> > It works.
> > 
> > But not with Open-Source-Implementation *MyFaces*.
> > i notices, that in struts-faces the servletPath is
> > a *.do (or that for struts).
> > 
> > But it must be an faces-mapping for servlet-Path
> > (*.faces e.g.)
> > the FacesRequestProcessor know if request is for 
> ActionSerclet or not.
> > 
> > If not, it delegates it to JSF-Impl.
> > Base of checking is a URI, that is configed
> > in <forward name="success" path="/test.faces"/> (e.g.)
> > 
> > so i wrote a simple HttpServletRequestWrapper
> > which wrappes the uri as new ServletPath.
> > now everything is fine.
> > 
> > like this (in FacesRequesProcessor)
> > <code>
> >            FacesContextFactory fcf = (FacesContextFactory)
> >  
> > FactoryFinder.getFactory(FactoryFinder.FACES_CONTEXT_FACTORY);
> > 
> >                 HttpServletRequestWrapper wrapper = new
> > HttpServletRequestWrapper(request,uri);
> > 
> > 
> >             context = 
> fcf.getFacesContext(servlet.getServletContext(),
> > wrapper,
> >                                           response, lifecycle);
> > </code>
> > it is not an error in myfaces-impl. 
> > it is an bug in the RI.
> > 
> > please see the email of Ted Husted (on myfaces-list)
> > <ted>
> > 
> > On Wed, 23 Jun 2004 20:21:49 -0700,
> > myfaces-develop-request@lists.sourceforge.net wrote:
> > > the MyFaces implementation is correct in this aspect and I
> > don't think
> > 
> > > we should clone the bugs of the RI just because struts
> > relies on them.
> > 
> > > I hope spec-compliant does not mean we have to have the
> > same bugs the
> > > RI has ;-)? By the way, if the RI is fixed, struts will not
> > work there
> > 
> > > any longer, too.
> > 
> > The RI and Struts-Faces were created in tandem, so it's not
> > surprising the same assumptions crop up in each. But, no, 
> > specification-compliant does not mean that we should rely on 
> > bugs in any implementation, including the RI. In fact, the 
> > Struts tradition has been to expose bugs in implementations 
> > so that vendors are compelled to fix them. 
> > 
> > If you develop any patches you would like applied, please
> > bring them to my attention. Once we can get 1.2.1 
> > out-the-door (could be this week), we will be setting up 
> > several subprojects, including Struts-Faces, that can be 
> > released separately. 
> > 
> > > So the clean solution from my point of view is to fix the 
> issue in 
> > > struts. For example it would be possible to wrap the
> > servlet request
> > > before the FacesContext is created. The wrapper takes the
> > uri of the
> > > view to be displayed to simulate a valid jsf servlet path
> > for the view
> > 
> > > manager. What do you think?
> > >
> > > Oliver
> > 
> > </ted>
> > 
> > 
> > and here is the simple wrapper-class:
> > i can apply a patch, but on that i will
> > do a bit better documentation of that
> > wrapper-class
> > 
> > 
> > Cheers,
> > Matthias
> > 
> > /*
> >  * Copyright 2002,2004 The Apache Software Foundation.
> >  *
> >  * Licensed under the Apache License, Version 2.0 (the "License");
> >  * you may not use this file except in compliance with the License.
> >  * You may obtain a copy of the License at
> >  * 
> >  *      http://www.apache.org/licenses/LICENSE-2.0
> >  * 
> >  * Unless required by applicable law or agreed to in 
> writing, software
> >  * distributed under the License is distributed on an "AS IS" BASIS,
> >  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either 
> > express or implied.
> >  * See the License for the specific language governing 
> permissions and
> >  * limitations under the License.
> >  */
> > package org.apache.struts.faces.util;
> > 
> > import java.io.BufferedReader;
> > import java.io.IOException;
> > import java.io.UnsupportedEncodingException;
> > import java.security.Principal;
> > import java.util.Enumeration;
> > import java.util.Locale;
> > import java.util.Map;
> > 
> > import javax.servlet.RequestDispatcher;
> > import javax.servlet.ServletInputStream;
> > import javax.servlet.http.Cookie;
> > import javax.servlet.http.HttpServletRequest;
> > import javax.servlet.http.HttpSession;
> > 
> > /**
> >  * <p>Concrete implementation of 
> <code>HttpServletRequest</code> that
> >  * that wrapps the <code>ServletPath</code> with an URI, that
> > was detected
> >  * by <code>ActionServlet</code> to forward to a standard 
> > <code>FacesServlet</code>.
> >  *
> >  */
> > public class HttpServletRequestWrapper implements 
> HttpServletRequest {
> > 
> > 	// ------------------------------------------------------
> > Instance Variables
> > 	
> > 	protected HttpServletRequest original = null;
> > 	protected String servletPath = null;
> > 
> > 	// ------------------------------------------------------------
> > Constructors
> > 
> > 
> > 	/**
> > 	 * <p>Construct a new <code>HttpServletRequest</code> instance
> > 	 * and an URI, which is used by <code>FacesServlet</code>.</p>
> > 	 *
> > 	 * @param request Original default
> > <code>HttpServletRequest</code>
> > 	 *
> > 	 * @param servletPat the new ServletPath for a 
> > <code>FacesServlet</code>
> > 	 *
> > 	 */
> > 	
> > 	public HttpServletRequestWrapper(HttpServletRequest
> > request, String servletPath){
> > 		this.original = request;
> > 		this.servletPath = servletPath;
> > 	}
> > 
> > 	// ----------------------------------------------------------
> > Public Methods
> > 
> > 
> > 	/**
> > 	 * <p>Returns the new <code>ServletPath</code> needed
> > by a FacesServlet.</p>
> > 	 *
> > 	 */
> > 	public String getServletPath() {
> > 		// TODO Auto-generated method stub
> > 		return this.servletPath;
> > 	}
> > 
> > 	// ----------------------------------------------------------
> > Delegate Methods
> > 	
> > 	
> > 	/* (non-Javadoc)
> > 	 * @see java.lang.Object#equals(java.lang.Object)
> > 	 */
> > 	public boolean equals(Object arg0) {
> > 		return original.equals(arg0);
> > 	}
> > 
> > 	...
> > }
> > 
> > 
> > 
> > 
> > 
> ---------------------------------------------------------------------
> > To unsubscribe, e-mail: dev-unsubscribe@struts.apache.org
> > For additional commands, e-mail: dev-help@struts.apache.org
> > 
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: dev-unsubscribe@struts.apache.org
> For additional commands, e-mail: dev-help@struts.apache.org
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: dev-unsubscribe@struts.apache.org
> For additional commands, e-mail: dev-help@struts.apache.org
> 


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


RE: [Struts-Faces] wrapping a HttpServletRequest

Posted by James Holmes <ja...@jamesholmes.com>.
Matthias,

Did you see Ted's note attached to your Bugzilla ticket for Struts-Faces?
He wants the code to work with the previous version of the servlet spec.

-James

-----Original Message-----
From: Matthias Wessendorf [mailto:mailings@matthias-wessendorf.de] 
Sent: Friday, June 25, 2004 12:19 PM
To: 'Struts Developers List'
Subject: RE: [Struts-Faces] wrapping a HttpServletRequest

One i missed to mention,

this *solution* is not bound to MyFaces,
it works also with the RI shipped by Sun...

:-)
Cheers,

> -----Original Message-----
> From: Matthias Wessendorf [mailto:mailings@matthias-wessendorf.de] 
> Sent: Thursday, June 24, 2004 7:50 PM
> To: dev@struts.apache.org; husted@apache.org
> Subject: [Struts-Faces] wrapping a HttpServletRequest
> 
> 
> Hi, i tried the faces-struts-lib with RI.
> It works.
> 
> But not with Open-Source-Implementation *MyFaces*.
> i notices, that in struts-faces the servletPath is
> a *.do (or that for struts).
> 
> But it must be an faces-mapping for servlet-Path
> (*.faces e.g.)
> the FacesRequestProcessor know if request is for
> ActionSerclet or not.
> 
> If not, it delegates it to JSF-Impl.
> Base of checking is a URI, that is configed 
> in <forward name="success" path="/test.faces"/> (e.g.)
> 
> so i wrote a simple HttpServletRequestWrapper
> which wrappes the uri as new ServletPath.
> now everything is fine.
> 
> like this (in FacesRequesProcessor)
> <code>
>            FacesContextFactory fcf = (FacesContextFactory)
>  
> FactoryFinder.getFactory(FactoryFinder.FACES_CONTEXT_FACTORY);
> 
>                 HttpServletRequestWrapper wrapper = new
> HttpServletRequestWrapper(request,uri);
> 
> 
>             context = fcf.getFacesContext(servlet.getServletContext(),
> wrapper,
>                                           response, lifecycle); 
> </code>
> it is not an error in myfaces-impl. 
> it is an bug in the RI.
> 
> please see the email of Ted Husted (on myfaces-list)
> <ted>
> 
> On Wed, 23 Jun 2004 20:21:49 -0700, 
> myfaces-develop-request@lists.sourceforge.net wrote:
> > the MyFaces implementation is correct in this aspect and I 
> don't think
> 
> > we should clone the bugs of the RI just because struts 
> relies on them.
> 
> > I hope spec-compliant does not mean we have to have the 
> same bugs the
> > RI has ;-)? By the way, if the RI is fixed, struts will not 
> work there
> 
> > any longer, too.
> 
> The RI and Struts-Faces were created in tandem, so it's not 
> surprising the same assumptions crop up in each. But, no, 
> specification-compliant does not mean that we should rely on 
> bugs in any implementation, including the RI. In fact, the 
> Struts tradition has been to expose bugs in implementations 
> so that vendors are compelled to fix them. 
> 
> If you develop any patches you would like applied, please 
> bring them to my attention. Once we can get 1.2.1 
> out-the-door (could be this week), we will be setting up 
> several subprojects, including Struts-Faces, that can be 
> released separately. 
> 
> > So the clean solution from my point of view is to fix the issue in
> > struts. For example it would be possible to wrap the 
> servlet request 
> > before the FacesContext is created. The wrapper takes the 
> uri of the 
> > view to be displayed to simulate a valid jsf servlet path 
> for the view
> 
> > manager. What do you think?
> >
> > Oliver
> 
> </ted>
> 
> 
> and here is the simple wrapper-class:
> i can apply a patch, but on that i will
> do a bit better documentation of that
> wrapper-class
> 
> 
> Cheers,
> Matthias
> 
> /*
>  * Copyright 2002,2004 The Apache Software Foundation.
>  * 
>  * Licensed under the Apache License, Version 2.0 (the "License");
>  * you may not use this file except in compliance with the License.
>  * You may obtain a copy of the License at
>  * 
>  *      http://www.apache.org/licenses/LICENSE-2.0
>  * 
>  * Unless required by applicable law or agreed to in writing, software
>  * distributed under the License is distributed on an "AS IS" BASIS,
>  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either 
> express or implied.
>  * See the License for the specific language governing permissions and
>  * limitations under the License.
>  */
> package org.apache.struts.faces.util;
> 
> import java.io.BufferedReader;
> import java.io.IOException;
> import java.io.UnsupportedEncodingException;
> import java.security.Principal;
> import java.util.Enumeration;
> import java.util.Locale;
> import java.util.Map;
> 
> import javax.servlet.RequestDispatcher;
> import javax.servlet.ServletInputStream;
> import javax.servlet.http.Cookie;
> import javax.servlet.http.HttpServletRequest;
> import javax.servlet.http.HttpSession;
> 
> /**
>  * <p>Concrete implementation of <code>HttpServletRequest</code> that
>  * that wrapps the <code>ServletPath</code> with an URI, that 
> was detected
>  * by <code>ActionServlet</code> to forward to a standard 
> <code>FacesServlet</code>.
>  *
>  */
> public class HttpServletRequestWrapper implements HttpServletRequest {
> 
> 	// ------------------------------------------------------
> Instance Variables
> 	
> 	protected HttpServletRequest original = null;
> 	protected String servletPath = null;
> 
> 	// ------------------------------------------------------------
> Constructors
> 
> 
> 	/**
> 	 * <p>Construct a new <code>HttpServletRequest</code> instance
> 	 * and an URI, which is used by <code>FacesServlet</code>.</p>
> 	 *
> 	 * @param request Original default 
> <code>HttpServletRequest</code>
> 	 *
> 	 * @param servletPat the new ServletPath for a 
> <code>FacesServlet</code>
> 	 *
> 	 */
> 	
> 	public HttpServletRequestWrapper(HttpServletRequest 
> request, String servletPath){
> 		this.original = request;
> 		this.servletPath = servletPath;
> 	}
> 
> 	// ----------------------------------------------------------
> Public Methods
> 
> 
> 	/**
> 	 * <p>Returns the new <code>ServletPath</code> needed 
> by a FacesServlet.</p>
> 	 *
> 	 */
> 	public String getServletPath() {
> 		// TODO Auto-generated method stub
> 		return this.servletPath;
> 	}
> 
> 	// ----------------------------------------------------------
> Delegate Methods
> 	
> 	
> 	/* (non-Javadoc)
> 	 * @see java.lang.Object#equals(java.lang.Object)
> 	 */
> 	public boolean equals(Object arg0) {
> 		return original.equals(arg0);
> 	}
> 
> 	...
> }
> 
> 
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: dev-unsubscribe@struts.apache.org
> For additional commands, e-mail: dev-help@struts.apache.org
> 


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


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


RE: [Struts-Faces] wrapping a HttpServletRequest

Posted by James Holmes <ja...@jamesholmes.com>.
Matthias if you send a message with patches to the Struts code I will get
the patch committed.  Also, you may want to open a bugzilla ticket.  

-James

-----Original Message-----
From: Matthias Wessendorf [mailto:mailings@matthias-wessendorf.de] 
Sent: Friday, June 25, 2004 12:19 PM
To: 'Struts Developers List'
Subject: RE: [Struts-Faces] wrapping a HttpServletRequest

One i missed to mention,

this *solution* is not bound to MyFaces,
it works also with the RI shipped by Sun...

:-)
Cheers,

> -----Original Message-----
> From: Matthias Wessendorf [mailto:mailings@matthias-wessendorf.de] 
> Sent: Thursday, June 24, 2004 7:50 PM
> To: dev@struts.apache.org; husted@apache.org
> Subject: [Struts-Faces] wrapping a HttpServletRequest
> 
> 
> Hi, i tried the faces-struts-lib with RI.
> It works.
> 
> But not with Open-Source-Implementation *MyFaces*.
> i notices, that in struts-faces the servletPath is
> a *.do (or that for struts).
> 
> But it must be an faces-mapping for servlet-Path
> (*.faces e.g.)
> the FacesRequestProcessor know if request is for
> ActionSerclet or not.
> 
> If not, it delegates it to JSF-Impl.
> Base of checking is a URI, that is configed 
> in <forward name="success" path="/test.faces"/> (e.g.)
> 
> so i wrote a simple HttpServletRequestWrapper
> which wrappes the uri as new ServletPath.
> now everything is fine.
> 
> like this (in FacesRequesProcessor)
> <code>
>            FacesContextFactory fcf = (FacesContextFactory)
>  
> FactoryFinder.getFactory(FactoryFinder.FACES_CONTEXT_FACTORY);
> 
>                 HttpServletRequestWrapper wrapper = new
> HttpServletRequestWrapper(request,uri);
> 
> 
>             context = fcf.getFacesContext(servlet.getServletContext(),
> wrapper,
>                                           response, lifecycle); 
> </code>
> it is not an error in myfaces-impl. 
> it is an bug in the RI.
> 
> please see the email of Ted Husted (on myfaces-list)
> <ted>
> 
> On Wed, 23 Jun 2004 20:21:49 -0700, 
> myfaces-develop-request@lists.sourceforge.net wrote:
> > the MyFaces implementation is correct in this aspect and I 
> don't think
> 
> > we should clone the bugs of the RI just because struts 
> relies on them.
> 
> > I hope spec-compliant does not mean we have to have the 
> same bugs the
> > RI has ;-)? By the way, if the RI is fixed, struts will not 
> work there
> 
> > any longer, too.
> 
> The RI and Struts-Faces were created in tandem, so it's not 
> surprising the same assumptions crop up in each. But, no, 
> specification-compliant does not mean that we should rely on 
> bugs in any implementation, including the RI. In fact, the 
> Struts tradition has been to expose bugs in implementations 
> so that vendors are compelled to fix them. 
> 
> If you develop any patches you would like applied, please 
> bring them to my attention. Once we can get 1.2.1 
> out-the-door (could be this week), we will be setting up 
> several subprojects, including Struts-Faces, that can be 
> released separately. 
> 
> > So the clean solution from my point of view is to fix the issue in
> > struts. For example it would be possible to wrap the 
> servlet request 
> > before the FacesContext is created. The wrapper takes the 
> uri of the 
> > view to be displayed to simulate a valid jsf servlet path 
> for the view
> 
> > manager. What do you think?
> >
> > Oliver
> 
> </ted>
> 
> 
> and here is the simple wrapper-class:
> i can apply a patch, but on that i will
> do a bit better documentation of that
> wrapper-class
> 
> 
> Cheers,
> Matthias
> 
> /*
>  * Copyright 2002,2004 The Apache Software Foundation.
>  * 
>  * Licensed under the Apache License, Version 2.0 (the "License");
>  * you may not use this file except in compliance with the License.
>  * You may obtain a copy of the License at
>  * 
>  *      http://www.apache.org/licenses/LICENSE-2.0
>  * 
>  * Unless required by applicable law or agreed to in writing, software
>  * distributed under the License is distributed on an "AS IS" BASIS,
>  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either 
> express or implied.
>  * See the License for the specific language governing permissions and
>  * limitations under the License.
>  */
> package org.apache.struts.faces.util;
> 
> import java.io.BufferedReader;
> import java.io.IOException;
> import java.io.UnsupportedEncodingException;
> import java.security.Principal;
> import java.util.Enumeration;
> import java.util.Locale;
> import java.util.Map;
> 
> import javax.servlet.RequestDispatcher;
> import javax.servlet.ServletInputStream;
> import javax.servlet.http.Cookie;
> import javax.servlet.http.HttpServletRequest;
> import javax.servlet.http.HttpSession;
> 
> /**
>  * <p>Concrete implementation of <code>HttpServletRequest</code> that
>  * that wrapps the <code>ServletPath</code> with an URI, that 
> was detected
>  * by <code>ActionServlet</code> to forward to a standard 
> <code>FacesServlet</code>.
>  *
>  */
> public class HttpServletRequestWrapper implements HttpServletRequest {
> 
> 	// ------------------------------------------------------
> Instance Variables
> 	
> 	protected HttpServletRequest original = null;
> 	protected String servletPath = null;
> 
> 	// ------------------------------------------------------------
> Constructors
> 
> 
> 	/**
> 	 * <p>Construct a new <code>HttpServletRequest</code> instance
> 	 * and an URI, which is used by <code>FacesServlet</code>.</p>
> 	 *
> 	 * @param request Original default 
> <code>HttpServletRequest</code>
> 	 *
> 	 * @param servletPat the new ServletPath for a 
> <code>FacesServlet</code>
> 	 *
> 	 */
> 	
> 	public HttpServletRequestWrapper(HttpServletRequest 
> request, String servletPath){
> 		this.original = request;
> 		this.servletPath = servletPath;
> 	}
> 
> 	// ----------------------------------------------------------
> Public Methods
> 
> 
> 	/**
> 	 * <p>Returns the new <code>ServletPath</code> needed 
> by a FacesServlet.</p>
> 	 *
> 	 */
> 	public String getServletPath() {
> 		// TODO Auto-generated method stub
> 		return this.servletPath;
> 	}
> 
> 	// ----------------------------------------------------------
> Delegate Methods
> 	
> 	
> 	/* (non-Javadoc)
> 	 * @see java.lang.Object#equals(java.lang.Object)
> 	 */
> 	public boolean equals(Object arg0) {
> 		return original.equals(arg0);
> 	}
> 
> 	...
> }
> 
> 
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: dev-unsubscribe@struts.apache.org
> For additional commands, e-mail: dev-help@struts.apache.org
> 


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


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


RE: [Struts-Faces] wrapping a HttpServletRequest

Posted by Matthias Wessendorf <ma...@matthias-wessendorf.de>.
One i missed to mention,

this *solution* is not bound to MyFaces,
it works also with the RI shipped by Sun...

:-)
Cheers,

> -----Original Message-----
> From: Matthias Wessendorf [mailto:mailings@matthias-wessendorf.de] 
> Sent: Thursday, June 24, 2004 7:50 PM
> To: dev@struts.apache.org; husted@apache.org
> Subject: [Struts-Faces] wrapping a HttpServletRequest
> 
> 
> Hi, i tried the faces-struts-lib with RI.
> It works.
> 
> But not with Open-Source-Implementation *MyFaces*.
> i notices, that in struts-faces the servletPath is
> a *.do (or that for struts).
> 
> But it must be an faces-mapping for servlet-Path
> (*.faces e.g.)
> the FacesRequestProcessor know if request is for
> ActionSerclet or not.
> 
> If not, it delegates it to JSF-Impl.
> Base of checking is a URI, that is configed 
> in <forward name="success" path="/test.faces"/> (e.g.)
> 
> so i wrote a simple HttpServletRequestWrapper
> which wrappes the uri as new ServletPath.
> now everything is fine.
> 
> like this (in FacesRequesProcessor)
> <code>
>            FacesContextFactory fcf = (FacesContextFactory)
>  
> FactoryFinder.getFactory(FactoryFinder.FACES_CONTEXT_FACTORY);
> 
>                 HttpServletRequestWrapper wrapper = new
> HttpServletRequestWrapper(request,uri);
> 
> 
>             context = fcf.getFacesContext(servlet.getServletContext(),
> wrapper,
>                                           response, lifecycle); 
> </code>
> it is not an error in myfaces-impl. 
> it is an bug in the RI.
> 
> please see the email of Ted Husted (on myfaces-list)
> <ted>
> 
> On Wed, 23 Jun 2004 20:21:49 -0700, 
> myfaces-develop-request@lists.sourceforge.net wrote:
> > the MyFaces implementation is correct in this aspect and I 
> don't think
> 
> > we should clone the bugs of the RI just because struts 
> relies on them.
> 
> > I hope spec-compliant does not mean we have to have the 
> same bugs the
> > RI has ;-)? By the way, if the RI is fixed, struts will not 
> work there
> 
> > any longer, too.
> 
> The RI and Struts-Faces were created in tandem, so it's not 
> surprising the same assumptions crop up in each. But, no, 
> specification-compliant does not mean that we should rely on 
> bugs in any implementation, including the RI. In fact, the 
> Struts tradition has been to expose bugs in implementations 
> so that vendors are compelled to fix them. 
> 
> If you develop any patches you would like applied, please 
> bring them to my attention. Once we can get 1.2.1 
> out-the-door (could be this week), we will be setting up 
> several subprojects, including Struts-Faces, that can be 
> released separately. 
> 
> > So the clean solution from my point of view is to fix the issue in
> > struts. For example it would be possible to wrap the 
> servlet request 
> > before the FacesContext is created. The wrapper takes the 
> uri of the 
> > view to be displayed to simulate a valid jsf servlet path 
> for the view
> 
> > manager. What do you think?
> >
> > Oliver
> 
> </ted>
> 
> 
> and here is the simple wrapper-class:
> i can apply a patch, but on that i will
> do a bit better documentation of that
> wrapper-class
> 
> 
> Cheers,
> Matthias
> 
> /*
>  * Copyright 2002,2004 The Apache Software Foundation.
>  * 
>  * Licensed under the Apache License, Version 2.0 (the "License");
>  * you may not use this file except in compliance with the License.
>  * You may obtain a copy of the License at
>  * 
>  *      http://www.apache.org/licenses/LICENSE-2.0
>  * 
>  * Unless required by applicable law or agreed to in writing, software
>  * distributed under the License is distributed on an "AS IS" BASIS,
>  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either 
> express or implied.
>  * See the License for the specific language governing permissions and
>  * limitations under the License.
>  */
> package org.apache.struts.faces.util;
> 
> import java.io.BufferedReader;
> import java.io.IOException;
> import java.io.UnsupportedEncodingException;
> import java.security.Principal;
> import java.util.Enumeration;
> import java.util.Locale;
> import java.util.Map;
> 
> import javax.servlet.RequestDispatcher;
> import javax.servlet.ServletInputStream;
> import javax.servlet.http.Cookie;
> import javax.servlet.http.HttpServletRequest;
> import javax.servlet.http.HttpSession;
> 
> /**
>  * <p>Concrete implementation of <code>HttpServletRequest</code> that
>  * that wrapps the <code>ServletPath</code> with an URI, that 
> was detected
>  * by <code>ActionServlet</code> to forward to a standard 
> <code>FacesServlet</code>.
>  *
>  */
> public class HttpServletRequestWrapper implements HttpServletRequest {
> 
> 	// ------------------------------------------------------
> Instance Variables
> 	
> 	protected HttpServletRequest original = null;
> 	protected String servletPath = null;
> 
> 	// ------------------------------------------------------------
> Constructors
> 
> 
> 	/**
> 	 * <p>Construct a new <code>HttpServletRequest</code> instance
> 	 * and an URI, which is used by <code>FacesServlet</code>.</p>
> 	 *
> 	 * @param request Original default 
> <code>HttpServletRequest</code>
> 	 *
> 	 * @param servletPat the new ServletPath for a 
> <code>FacesServlet</code>
> 	 *
> 	 */
> 	
> 	public HttpServletRequestWrapper(HttpServletRequest 
> request, String servletPath){
> 		this.original = request;
> 		this.servletPath = servletPath;
> 	}
> 
> 	// ----------------------------------------------------------
> Public Methods
> 
> 
> 	/**
> 	 * <p>Returns the new <code>ServletPath</code> needed 
> by a FacesServlet.</p>
> 	 *
> 	 */
> 	public String getServletPath() {
> 		// TODO Auto-generated method stub
> 		return this.servletPath;
> 	}
> 
> 	// ----------------------------------------------------------
> Delegate Methods
> 	
> 	
> 	/* (non-Javadoc)
> 	 * @see java.lang.Object#equals(java.lang.Object)
> 	 */
> 	public boolean equals(Object arg0) {
> 		return original.equals(arg0);
> 	}
> 
> 	...
> }
> 
> 
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: dev-unsubscribe@struts.apache.org
> For additional commands, e-mail: dev-help@struts.apache.org
> 


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