You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by Brice Roncace <br...@gmail.com> on 2010/01/27 22:03:43 UTC
using a custom struts.multipart.parser in struts2.1.8.1
I'm trying to use a custom implementation of the
org.apache.struts2.dispatcher.multipart.MultiPartRequest interface, but even
after changing the appropriate struts2 constant value I still end up with
the default JakartaMultiPartRequest.
Here's the change I've made to my struts.xml file:
{code}
<constant name="struts.multipart.parser"
value="test.MyCustomMultiPartRequest"/>
{code}
Struts gives me this debug statement:
{quote}
Choosing bean (test.MyCustomMultiPartRequest) for interface
org.apache.struts2.dispatcher.multipart.MultiPartRequest to be loaded from
the ObjectFactory
{quote}
I am using object factory 'spring'. And I did try defining a spring bean
for my MyCustomMultiPartRequest object and using just the bean name in the
constant value attribute above, but no luck.
Can anybody help me out?
Thanks,
Brice
Re: using a custom struts.multipart.parser in struts2.1.8.1
Posted by Brice Roncace <br...@gmail.com>.
Hot dang Steve! Thanks! I have a feeling you've saved me a ton of
frustration. This really should be documented somewhere. . .
Brice
On Wed, Jan 27, 2010 at 3:00 PM, Stephen Ince <st...@gmail.com>wrote:
> Brice,
> I went through a similiar issue. Here is how I resolved it. I spent
> days on it. You have do it via a plugin. This is not documented any
> where.
>
> create a plugin. e.g fileupload.jar and put in under WEB-INF/lib
> The jar file should have the classes and a struts-plugin.xml file.
>
> struts-plugin.xml show have a reference to your parser.
> e.g.
> <struts>
> <bean type="org.apache.struts2.dispatcher.multipart.MultiPartRequest"
> name="jakartax"
> class="com.loadgeneral.struts2.JakartaMultiPartRequestx"
> scope="default" />
>
>
> The following may not be necessary.
> Struts.xml
> ----------------------------------------------------------------
> <struts>
> <constant name="struts.devMode" value="false" />
> <bean type="org.apache.struts2.dispatcher.multipart.MultiPartRequest"
> name="jakartax"
> class="com.loadgeneral.struts2.JakartaMultiPartRequestx"
> scope="default" />
> <constant name="struts.multipart.handler" value="jakartax" />
>
>
>
> Steve
> On Wed, Jan 27, 2010 at 4:03 PM, Brice Roncace <br...@gmail.com>
> wrote:
> > I'm trying to use a custom implementation of the
> > org.apache.struts2.dispatcher.multipart.MultiPartRequest interface, but
> even
> > after changing the appropriate struts2 constant value I still end up with
> > the default JakartaMultiPartRequest.
> >
> > Here's the change I've made to my struts.xml file:
> >
> > {code}
> > <constant name="struts.multipart.parser"
> > value="test.MyCustomMultiPartRequest"/>
> > {code}
> >
> > Struts gives me this debug statement:
> >
> > {quote}
> > Choosing bean (test.MyCustomMultiPartRequest) for interface
> > org.apache.struts2.dispatcher.multipart.MultiPartRequest to be loaded
> from
> > the ObjectFactory
> > {quote}
> >
> > I am using object factory 'spring'. And I did try defining a spring bean
> > for my MyCustomMultiPartRequest object and using just the bean name in
> the
> > constant value attribute above, but no luck.
> >
> > Can anybody help me out?
> >
> > Thanks,
> > Brice
> >
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
> For additional commands, e-mail: user-help@struts.apache.org
>
>
Re: using a custom struts.multipart.parser in struts2.1.8.1
Posted by Brice Roncace <br...@gmail.com>.
Lo and behold! This does work. . . the problem I was initially running into
was that I was using the name:
struts.multipart.parser
and not the correct (new as of 2.1.8 ?)
struts.multipart.handler
So yes, defining the bean to use, in this case jakartax, will accomplish
just what a struts-plugin.xml configuration file with the same bean
definition will do.
This, however, will not work (whereas it did at least in version 2.1.6):
<constant name="struts.multipart.handler"
value="com.loadgeneral.struts2.JakartaMultiPartRequestx" />
Brice
On Wed, Jan 27, 2010 at 11:38 PM, Lukasz Lenart <
lukasz.lenart@googlemail.com> wrote:
> 2010/1/27 Stephen Ince <st...@gmail.com>:
> > The following may not be necessary.
> > Struts.xml
> > ----------------------------------------------------------------
> > <struts>
> > <constant name="struts.devMode" value="false" />
> > <bean type="org.apache.struts2.dispatcher.multipart.MultiPartRequest"
> > name="jakartax"
> > class="com.loadgeneral.struts2.JakartaMultiPartRequestx"
> > scope="default" />
> > <constant name="struts.multipart.handler" value="jakartax" />
>
> I'm curious why this didn't work... this is the normal approach to
> define beans in Struts 2.
>
>
> Regards
> --
> Lukasz
> http://www.lenart.org.pl/
> Kapituła Javarsovia 2010
> http://javarsovia.pl
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
> For additional commands, e-mail: user-help@struts.apache.org
>
>
Re: using a custom struts.multipart.parser in struts2.1.8.1
Posted by Lukasz Lenart <lu...@googlemail.com>.
2010/1/27 Stephen Ince <st...@gmail.com>:
> The following may not be necessary.
> Struts.xml
> ----------------------------------------------------------------
> <struts>
> <constant name="struts.devMode" value="false" />
> <bean type="org.apache.struts2.dispatcher.multipart.MultiPartRequest"
> name="jakartax"
> class="com.loadgeneral.struts2.JakartaMultiPartRequestx"
> scope="default" />
> <constant name="struts.multipart.handler" value="jakartax" />
I'm curious why this didn't work... this is the normal approach to
define beans in Struts 2.
Regards
--
Lukasz
http://www.lenart.org.pl/
Kapituła Javarsovia 2010
http://javarsovia.pl
---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org
Re: using a custom struts.multipart.parser in struts2.1.8.1
Posted by Stephen Ince <st...@gmail.com>.
Brice,
I went through a similiar issue. Here is how I resolved it. I spent
days on it. You have do it via a plugin. This is not documented any
where.
create a plugin. e.g fileupload.jar and put in under WEB-INF/lib
The jar file should have the classes and a struts-plugin.xml file.
struts-plugin.xml show have a reference to your parser.
e.g.
<struts>
<bean type="org.apache.struts2.dispatcher.multipart.MultiPartRequest"
name="jakartax"
class="com.loadgeneral.struts2.JakartaMultiPartRequestx"
scope="default" />
The following may not be necessary.
Struts.xml
----------------------------------------------------------------
<struts>
<constant name="struts.devMode" value="false" />
<bean type="org.apache.struts2.dispatcher.multipart.MultiPartRequest"
name="jakartax"
class="com.loadgeneral.struts2.JakartaMultiPartRequestx"
scope="default" />
<constant name="struts.multipart.handler" value="jakartax" />
Steve
On Wed, Jan 27, 2010 at 4:03 PM, Brice Roncace <br...@gmail.com> wrote:
> I'm trying to use a custom implementation of the
> org.apache.struts2.dispatcher.multipart.MultiPartRequest interface, but even
> after changing the appropriate struts2 constant value I still end up with
> the default JakartaMultiPartRequest.
>
> Here's the change I've made to my struts.xml file:
>
> {code}
> <constant name="struts.multipart.parser"
> value="test.MyCustomMultiPartRequest"/>
> {code}
>
> Struts gives me this debug statement:
>
> {quote}
> Choosing bean (test.MyCustomMultiPartRequest) for interface
> org.apache.struts2.dispatcher.multipart.MultiPartRequest to be loaded from
> the ObjectFactory
> {quote}
>
> I am using object factory 'spring'. And I did try defining a spring bean
> for my MyCustomMultiPartRequest object and using just the bean name in the
> constant value attribute above, but no luck.
>
> Can anybody help me out?
>
> Thanks,
> Brice
>
---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org