You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@struts.apache.org by Ramiro Alba Queipo <ra...@cttc.upc.edu> on 2005/03/01 14:11:41 UTC

Compiling STRUTS and STRUTS-FACES with servlet 2.4 and jsp 2.0

Hello everybody:

I was using tomcat 4.0.24 to develop an application with struts, I and
decided to migrate to tomcat 5.0.28 so as I could user EL natively from
JSP 2.0. I thought it would be a good idea to compile STRUTS 1.2.4 under
servlet 2.4 and JSP 2.0 from tomcat 5.0.28. Everything went wright
except for one class:

org/apache/struts/upload/MultipartRequestWrapper.java

It is not implementing the following methods from interface
javax.servlet.ServletRequest corresponding to servlet-api.jar of tomcat
5.0.28:
 
    public String getLocalName() {}
    public String getLocalAddr() {}
    public int getLocalPort() {}     
    public int getRemotePort() {}

To bypass the problem I created trivial methods, and then I could
complete the compilation process. Everything seams to work, but in order
to work with tomcat 5.0.x:

1) Is it a good idea to make this compilation o better to stuck with
   the official binary supplied struts.jar?

2) Is this situation going to be solved in a near feature? (I have seen
no changes in struts 1.2.6)


I have found the same problem compiling struts-faces, which seams to be
compiled with servlet and jsp apis from tomcat 5.0.25

Thanks in advance

Regards


P.D: I have posted this e-mail at user@struts.apache.org more than a
week ago and I have no answer, probably due to be a question out of
scope for that list, so I decided to post here the same question. Sorry
for the cross posting.


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


Re: Compiling STRUTS and STRUTS-FACES with servlet 2.4 and jsp 2.0

Posted by Ramiro Alba Queipo <ra...@cttc.upc.edu>.
On Tue, 2005-03-01 at 18:11, Craig McClanahan wrote:
> Doing the simple version of a change like this will cause the wrapper
> class to not be compilable against a 2.2 or 2.3 version of the servlet
> API any longer, which is a particular problem for the standard Struts
> release.  It will require a bit more work to use reflection to call
> through these methods if they exist, or return nothing if they do not
> exist.

So, in order to use STRUTS and STRUTS-FACES with JSP 2.0 and the
Expression Language, what should I do?

a) Compile against servlet 2.4 and JSP 2.0 and adding the mentioned
methods not implemented.

b) Using the oficial binary version for both STRUTS and STRUTS-FACES

I understand that both STRUTS and STRUTS-FACES are compiled against
servlet 2.2 and 2.3 and terster for servlet 2.4 and JSP 2.0.

Regards 


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


Re: Compiling STRUTS and STRUTS-FACES with servlet 2.4 and jsp 2.0

Posted by Niall Pemberton <ni...@blueyonder.co.uk>.
Having the wrapper extend the HttpServletRequestWrapper (introduced in
Servlet 2.3) resolves this - just need to remove the "dummy" methods.

Niall

----- Original Message ----- 
From: "Craig McClanahan" <cr...@gmail.com>
To: "Struts Developers List" <de...@struts.apache.org>
Sent: Monday, March 14, 2005 4:11 AM
Subject: Re: Compiling STRUTS and STRUTS-FACES with servlet 2.4 and jsp 2.0


> FYI, as soon as I apply some recent patches (to remove the wrapper
> class) this whole area will become a non-issue for struts-faces.  In
> the general case, however, it is not currently feasible to create a
> wrapper that works across 2.3 and 2.4 unless you're willing to do a
> little work with Java reflection to transparently deal with the 2.4
> methods that are not there in 2.3 (and therefore you cannot delegate
> to the underlying wrapper).
>
> Craig
>
>
>
> On Sat, 12 Mar 2005 09:16:39 -0500, Bill Siggelkow
> <bi...@bellsouth.net> wrote:
> > On 2005-03-11 00:25:35 -0500, Martin Cooper <mf...@gmail.com> said:
> >
> > > On Tue, 1 Mar 2005 09:11:28 -0800, Craig McClanahan
<cr...@gmail.com> wrote:
> > >> Doing the simple version of a change like this will cause the wrapper
> > >> class to not be compilable against a 2.2 or 2.3 version of the
servlet
> > >> API any longer, which is a particular problem for the standard Struts
> > >> release.
> > >
> > > I don't believe that's the case. The current implementation of
> > > MultipartRequestWrapper uses exactly the same technique that Ramiro
> > > mentions to allow compilation against the Servlets 2.3 API. Adding
> > > extra methods to the implementation class allows it to compile against
> > > the newer API, while the methods become just ordinary class methods
> > > when compiled against the older API.
> > >
> > > It's true that the dummy methods added to satisfy the newer API are
> > > not useful (without the use of reflection, as you suggest below), but
> > > that doesn't seem to have caused problems for people using the
> > > Servlets 2.3 API while we've been dummying up the methods new to that
> > > version over Servlets 2.2.
> >
> > Well, I ran into this the other day -- and while it seemed like I could
> > just no-op (or wrapper) for the new methods in the Servlet API
> > (getLocalAddr()  etc.) there are other problems in the taglibs against
> > the JSP API -- because JSP 2.0 introduces new classes like
> > ExpressionEvaluator.



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


Re: Compiling STRUTS and STRUTS-FACES with servlet 2.4 and jsp 2.0

Posted by Craig McClanahan <cr...@gmail.com>.
FYI, as soon as I apply some recent patches (to remove the wrapper
class) this whole area will become a non-issue for struts-faces.  In
the general case, however, it is not currently feasible to create a
wrapper that works across 2.3 and 2.4 unless you're willing to do a
little work with Java reflection to transparently deal with the 2.4
methods that are not there in 2.3 (and therefore you cannot delegate
to the underlying wrapper).

Craig



On Sat, 12 Mar 2005 09:16:39 -0500, Bill Siggelkow
<bi...@bellsouth.net> wrote:
> On 2005-03-11 00:25:35 -0500, Martin Cooper <mf...@gmail.com> said:
> 
> > On Tue, 1 Mar 2005 09:11:28 -0800, Craig McClanahan <cr...@gmail.com> wrote:
> >> Doing the simple version of a change like this will cause the wrapper
> >> class to not be compilable against a 2.2 or 2.3 version of the servlet
> >> API any longer, which is a particular problem for the standard Struts
> >> release.
> >
> > I don't believe that's the case. The current implementation of
> > MultipartRequestWrapper uses exactly the same technique that Ramiro
> > mentions to allow compilation against the Servlets 2.3 API. Adding
> > extra methods to the implementation class allows it to compile against
> > the newer API, while the methods become just ordinary class methods
> > when compiled against the older API.
> >
> > It's true that the dummy methods added to satisfy the newer API are
> > not useful (without the use of reflection, as you suggest below), but
> > that doesn't seem to have caused problems for people using the
> > Servlets 2.3 API while we've been dummying up the methods new to that
> > version over Servlets 2.2.
> 
> Well, I ran into this the other day -- and while it seemed like I could
> just no-op (or wrapper) for the new methods in the Servlet API
> (getLocalAddr()  etc.) there are other problems in the taglibs against
> the JSP API -- because JSP 2.0 introduces new classes like
> ExpressionEvaluator.
> 
> 
> ---------------------------------------------------------------------
> 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: Compiling STRUTS and STRUTS-FACES with servlet 2.4 and jsp 2.0

Posted by Bill Siggelkow <bi...@bellsouth.net>.
On 2005-03-11 00:25:35 -0500, Martin Cooper <mf...@gmail.com> said:

> On Tue, 1 Mar 2005 09:11:28 -0800, Craig McClanahan <cr...@gmail.com> wrote:
>> Doing the simple version of a change like this will cause the wrapper
>> class to not be compilable against a 2.2 or 2.3 version of the servlet
>> API any longer, which is a particular problem for the standard Struts
>> release.
> 
> I don't believe that's the case. The current implementation of
> MultipartRequestWrapper uses exactly the same technique that Ramiro
> mentions to allow compilation against the Servlets 2.3 API. Adding
> extra methods to the implementation class allows it to compile against
> the newer API, while the methods become just ordinary class methods
> when compiled against the older API.
> 
> It's true that the dummy methods added to satisfy the newer API are
> not useful (without the use of reflection, as you suggest below), but
> that doesn't seem to have caused problems for people using the
> Servlets 2.3 API while we've been dummying up the methods new to that
> version over Servlets 2.2.

Well, I ran into this the other day -- and while it seemed like I could 
just no-op (or wrapper) for the new methods in the Servlet API 
(getLocalAddr()  etc.) there are other problems in the taglibs against 
the JSP API -- because JSP 2.0 introduces new classes like 
ExpressionEvaluator.



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


Re: Compiling STRUTS and STRUTS-FACES with servlet 2.4 and jsp 2.0

Posted by Martin Cooper <mf...@gmail.com>.
On Tue, 1 Mar 2005 09:11:28 -0800, Craig McClanahan <cr...@gmail.com> wrote:
> Doing the simple version of a change like this will cause the wrapper
> class to not be compilable against a 2.2 or 2.3 version of the servlet
> API any longer, which is a particular problem for the standard Struts
> release.

I don't believe that's the case. The current implementation of
MultipartRequestWrapper uses exactly the same technique that Ramiro
mentions to allow compilation against the Servlets 2.3 API. Adding
extra methods to the implementation class allows it to compile against
the newer API, while the methods become just ordinary class methods
when compiled against the older API.

It's true that the dummy methods added to satisfy the newer API are
not useful (without the use of reflection, as you suggest below), but
that doesn't seem to have caused problems for people using the
Servlets 2.3 API while we've been dummying up the methods new to that
version over Servlets 2.2.

--
Martin Cooper


> It will require a bit more work to use reflection to call
> through these methods if they exist, or return nothing if they do not
> exist.
> 
> Craig
> 
> 
> On Tue, 01 Mar 2005 14:11:41 +0100, Ramiro Alba Queipo <ra...@cttc.upc.edu> wrote:
> > Hello everybody:
> >
> > I was using tomcat 4.0.24 to develop an application with struts, I and
> > decided to migrate to tomcat 5.0.28 so as I could user EL natively from
> > JSP 2.0. I thought it would be a good idea to compile STRUTS 1.2.4 under
> > servlet 2.4 and JSP 2.0 from tomcat 5.0.28. Everything went wright
> > except for one class:
> >
> > org/apache/struts/upload/MultipartRequestWrapper.java
> >
> > It is not implementing the following methods from interface
> > javax.servlet.ServletRequest corresponding to servlet-api.jar of tomcat
> > 5.0.28:
> >
> >     public String getLocalName() {}
> >     public String getLocalAddr() {}
> >     public int getLocalPort() {}
> >     public int getRemotePort() {}
> >
> > To bypass the problem I created trivial methods, and then I could
> > complete the compilation process. Everything seams to work, but in order
> > to work with tomcat 5.0.x:
> >
> > 1) Is it a good idea to make this compilation o better to stuck with
> >    the official binary supplied struts.jar?
> >
> > 2) Is this situation going to be solved in a near feature? (I have seen
> > no changes in struts 1.2.6)
> >
> > I have found the same problem compiling struts-faces, which seams to be
> > compiled with servlet and jsp apis from tomcat 5.0.25
> >
> > Thanks in advance
> >
> > Regards
> >
> > P.D: I have posted this e-mail at user@struts.apache.org more than a
> > week ago and I have no answer, probably due to be a question out of
> > scope for that list, so I decided to post here the same question. Sorry
> > for the cross posting.
> >
> > ---------------------------------------------------------------------
> > 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: Compiling STRUTS and STRUTS-FACES with servlet 2.4 and jsp 2.0

Posted by Craig McClanahan <cr...@gmail.com>.
Doing the simple version of a change like this will cause the wrapper
class to not be compilable against a 2.2 or 2.3 version of the servlet
API any longer, which is a particular problem for the standard Struts
release.  It will require a bit more work to use reflection to call
through these methods if they exist, or return nothing if they do not
exist.

Craig


On Tue, 01 Mar 2005 14:11:41 +0100, Ramiro Alba Queipo <ra...@cttc.upc.edu> wrote:
> Hello everybody:
> 
> I was using tomcat 4.0.24 to develop an application with struts, I and
> decided to migrate to tomcat 5.0.28 so as I could user EL natively from
> JSP 2.0. I thought it would be a good idea to compile STRUTS 1.2.4 under
> servlet 2.4 and JSP 2.0 from tomcat 5.0.28. Everything went wright
> except for one class:
> 
> org/apache/struts/upload/MultipartRequestWrapper.java
> 
> It is not implementing the following methods from interface
> javax.servlet.ServletRequest corresponding to servlet-api.jar of tomcat
> 5.0.28:
> 
>     public String getLocalName() {}
>     public String getLocalAddr() {}
>     public int getLocalPort() {}
>     public int getRemotePort() {}
> 
> To bypass the problem I created trivial methods, and then I could
> complete the compilation process. Everything seams to work, but in order
> to work with tomcat 5.0.x:
> 
> 1) Is it a good idea to make this compilation o better to stuck with
>    the official binary supplied struts.jar?
> 
> 2) Is this situation going to be solved in a near feature? (I have seen
> no changes in struts 1.2.6)
> 
> I have found the same problem compiling struts-faces, which seams to be
> compiled with servlet and jsp apis from tomcat 5.0.25
> 
> Thanks in advance
> 
> Regards
> 
> P.D: I have posted this e-mail at user@struts.apache.org more than a
> week ago and I have no answer, probably due to be a question out of
> scope for that list, so I decided to post here the same question. Sorry
> for the cross posting.
> 
> ---------------------------------------------------------------------
> 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