Tim,

On 5/25/21 05:03, Scott,Tim wrote:
Hi Mark,

No. You should be able to use HttpServletRequest.getPart()
I've given up on that attempt as I keep getting:
java.lang.AbstractMethodError: Method 
org/apache/struts/upload/MultipartRequestWrapper.getPart(Ljava/lang/String;)Ljavax/servlet/http/Part;
 is abstract

I have my workaround and do not anticipate it worthwhile me spending
any more time on the matter.
You know, it's funny. I use Struts 1.x and in order to use the Tomcat-provided multipart handling, you need to do extra work. I thought of that when Mark suggested using Tomcat's multipart parsing but then thought "nah, nobody still uses Struts 1.x".

Anyway, if you want to disable Struts's multipart handling, you have to add this to your <servlet> definition for Struts. Note that this may break other parts of your application that might depend upon the Struts multipart handling. But at this point, it's not working anyway, so you are probably okay.

  <servlet>
    <servlet-name>action</servlet-name>
    <servlet-class>org.apache.struts.action.ActionServlet</servlet-class>
<!-- Disable Struts's multipart upload; The idea is to use Servlet 3.0 multipart -->
    <init-param>
      <description>Disable Struts Multipart Handling</description>
      <param-name>multipartClass</param-name>
      <param-value>none</param-value>
    </init-param>
    <multipart-config>
      <max-file-size>1048576</max-file-size><!-- 1MiB -->
      <max-request-size>1049600</max-request-size><!-- 1 MiB + 1 kiB -->
      <file-size-threshold>1024</file-size-threshold><!-- 1KiB -->
    </multipart-config>
  </servlet>

Note that you may have to "merge" the above with what you have in your WEB-INF/web.xml.

But at this point, if you have things working, you can probably stop. But something is *definitely* wrong if changing the default file encoding causes your files to be corrupted. It is *extraordinarily* unlikely that Tomcat or Struts is doing this. It is much more likely to be your application somewhere writing to a Writer instead of a Stream.

-chris

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org
For additional commands, e-mail: users-h...@tomcat.apache.org

Reply via email to