You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@struts.apache.org by "Lauri Lehtinen (JIRA)" <ji...@apache.org> on 2010/01/01 03:17:53 UTC

[jira] Issue Comment Edited: (WW-3363) Custom struts.multipart.parser is ignored as of 2.1.8

    [ https://issues.apache.org/struts/browse/WW-3363?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=47202#action_47202 ] 

Lauri Lehtinen edited comment on WW-3363 at 1/1/10 2:16 AM:
------------------------------------------------------------

Here's what I found after looking into it a bit more:

A new StrutsConstant STRUTS_MULTIPART_HANDLER was introduced in 2.1.8. The default value is set to "jakarta" in the struts-default.xml in 2.1.8 (line 49).

If this value is not overridden, a custom value for STRUTS_MULTIPART_PARSER seems to be ignored due to how Dispatcher now works.

The workaround that worked for me was to define the following in my struts.xml:

<constant name="struts.multipart.parser" value="com.systemout.pdf.webapp.base.multipart.MonitoredMultiPartRequest" />
<constant name="struts.multipart.handler" value="com.systemout.pdf.webapp.base.multipart.MonitoredMultiPartRequest" />

Leaving either one out causes my handler/parser to not get used.

I may not fully understand the difference between the handler and the parser, but for my purposes one of them seems redundant. In any case, I did not find any documentation regarding this change in the 2.1.6 -> 2.1.8 migration notes.

      was (Author: lehtinen):
    Here's what I found after looking into it a bit more:

A new StrutsConstant STRUTS_MULTIPART_HANDLER was introduced in 2.1.8. The default value is set to "jakarta" in the struts-default.xml in 2.1.8 (line 49).

If this value is not overridden, a custom value for STRUTS_MULTIPART_PARSER seems to be ignored due to how Dispatcher now works.

The workaround that worked for me was to define the following in my struts.xml:

<constant name="struts.multipart.parser" value="com.systemout.pdf.webapp.base.multipart.MonitoredMultiPartRequest" />
<constant name="struts.multipart.handler" value="com.systemout.pdf.webapp.base.multipart.MonitoredMultiPartRequest" />

Leaving either one out causes my handler/parser to not get used.

I may not fully understand the difference between the handler and the parser, but for my purposes one of them seems redundant. In any case, I did not find any documentation regarding this change in the 2.1.8 release notes.
  
> Custom struts.multipart.parser is ignored as of 2.1.8
> -----------------------------------------------------
>
>                 Key: WW-3363
>                 URL: https://issues.apache.org/struts/browse/WW-3363
>             Project: Struts 2
>          Issue Type: Bug
>    Affects Versions: 2.1.8
>            Reporter: Lauri Lehtinen
>
> This issue appears when I update my struts2 dependency from 2.1.6 to 2.1.8, and disappears when reverting. Here are some facts I've gathered so far:
> In my struts.xml:
> <constant name="struts.multipart.parser" value="com.systemout.pdf.webapp.base.multipart.MonitoredMultiPartRequest" />
> Tomcat startup:
> ...
> 09-12-31 13:36:54 DEBUG org.apache.struts2.config.BeanSelectionProvider - Choosing bean (class com.systemout.pdf.webapp.base.multipart.MonitoredMultiPartRequest) for interface org.apache.struts2.dispatcher.multipart.MultiPartRequest
> ...
> On file upload, debugging in org.apache.struts2.dispatcher.Dispatcher.java, after line 697 has been executed, multiNames contains: [default, jakarta, struts] and multipartHandlerName is set to "jakarta"
> My custom MonitoredMultiPartRequest is never instantiated, instead, JakartaMultiPartRequest is used.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.