You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by Rupesh Mankar <ru...@persistent.co.in> on 2009/11/17 09:45:25 UTC
Problem in uploading file from stand-alone application
Hi,
I want to upload file on server from stand-alone application (using HTTPURLConnection). But when I run stand-alone application which uploads file, I get following exception on server:
-------------------------------------------------------------------------------------------------------------------------------------------
WARNING: Parameters: Character decoding failed. Parameter skipped.
java.io.CharConversionException: isHexDigit
at org.apache.tomcat.util.buf.UDecoder.convert(UDecoder.java:88)
at org.apache.tomcat.util.buf.UDecoder.convert(UDecoder.java:49)
at org.apache.tomcat.util.http.Parameters.urlDecode(Parameters.java:410)
at org.apache.tomcat.util.http.Parameters.processParameters(Parameters.java:392)
at org.apache.tomcat.util.http.Parameters.processParameters(Parameters.java:344)
at org.apache.catalina.connector.Request.parseParameters(Request.java:2453)
at org.apache.catalina.connector.Request.getParameterNames(Request.java:1073)
at org.apache.catalina.connector.Request.getParameterMap(Request.java:1053)
at org.apache.catalina.connector.RequestFacade.getParameterMap(RequestFacade.java:414)
at javax.servlet.ServletRequestWrapper.getParameterMap(ServletRequestWrapper.java:166)
at org.apache.struts2.dispatcher.mapper.DefaultActionMapper.handleSpecialParameters(DefaultActionMapper.java:351)
at org.apache.struts2.dispatcher.mapper.DefaultActionMapper.getMapping(DefaultActionMapper.java:311)
-------------------------------------------------------------------------------------------------------------------------------------------
It seems struts2 filter tries to retrieve parameters from request. I am directly writing file content which are byte array on output stream of url connection.
One workaround I found is to bypass the upload request from struts2 filtering. But this approach is not good because my entire web application is struts based.
Is there any way to upload file through strut itself?
Thanks,
Rupesh
DISCLAIMER
==========
This e-mail may contain privileged and confidential information which is the property of Persistent Systems Ltd. It is intended only for the use of the individual or entity to which it is addressed. If you are not the intended recipient, you are not authorized to read, retain, copy, print, distribute or use this message. If you have received this communication in error, please notify the sender and delete all copies of this message. Persistent Systems Ltd. does not accept any liability for virus infected mails.
RE: Problem in uploading file from stand-alone application
Posted by Rupesh Mankar <ru...@persistent.co.in>.
Thanks a lot jayakumar.
I successfully uploaded binary file using Apache HTTPClient and could successfully receive uploaded file in action class of struts without any exception :)
-----Original Message-----
From: jayakumar ala [mailto:alajay123@gmail.com]
Sent: Tuesday, November 17, 2009 9:09 PM
To: Struts Users Mailing List
Subject: Re: Problem in uploading file from stand-alone application
Rupesh,
Probably you can try this with Apache HttpClient.
On Tue, Nov 17, 2009 at 1:45 AM, Rupesh Mankar <
rupesh_mankar@persistent.co.in> wrote:
> Hi,
>
> I want to upload file on server from stand-alone application (using
> HTTPURLConnection). But when I run stand-alone application which uploads
> file, I get following exception on server:
>
>
> -------------------------------------------------------------------------------------------------------------------------------------------
> WARNING: Parameters: Character decoding failed. Parameter skipped.
> java.io.CharConversionException: isHexDigit
> at org.apache.tomcat.util.buf.UDecoder.convert(UDecoder.java:88)
> at org.apache.tomcat.util.buf.UDecoder.convert(UDecoder.java:49)
> at
> org.apache.tomcat.util.http.Parameters.urlDecode(Parameters.java:410)
> at
> org.apache.tomcat.util.http.Parameters.processParameters(Parameters.java:392)
> at
> org.apache.tomcat.util.http.Parameters.processParameters(Parameters.java:344)
> at
> org.apache.catalina.connector.Request.parseParameters(Request.java:2453)
> at
> org.apache.catalina.connector.Request.getParameterNames(Request.java:1073)
> at
> org.apache.catalina.connector.Request.getParameterMap(Request.java:1053)
> at
> org.apache.catalina.connector.RequestFacade.getParameterMap(RequestFacade.java:414)
> at
> javax.servlet.ServletRequestWrapper.getParameterMap(ServletRequestWrapper.java:166)
> at
> org.apache.struts2.dispatcher.mapper.DefaultActionMapper.handleSpecialParameters(DefaultActionMapper.java:351)
> at
> org.apache.struts2.dispatcher.mapper.DefaultActionMapper.getMapping(DefaultActionMapper.java:311)
>
> -------------------------------------------------------------------------------------------------------------------------------------------
>
> It seems struts2 filter tries to retrieve parameters from request. I am
> directly writing file content which are byte array on output stream of url
> connection.
>
> One workaround I found is to bypass the upload request from struts2
> filtering. But this approach is not good because my entire web application
> is struts based.
>
> Is there any way to upload file through strut itself?
>
> Thanks,
> Rupesh
>
>
>
> DISCLAIMER
> ==========
> This e-mail may contain privileged and confidential information which is
> the property of Persistent Systems Ltd. It is intended only for the use of
> the individual or entity to which it is addressed. If you are not the
> intended recipient, you are not authorized to read, retain, copy, print,
> distribute or use this message. If you have received this communication in
> error, please notify the sender and delete all copies of this message.
> Persistent Systems Ltd. does not accept any liability for virus infected
> mails.
>
DISCLAIMER
==========
This e-mail may contain privileged and confidential information which is the property of Persistent Systems Ltd. It is intended only for the use of the individual or entity to which it is addressed. If you are not the intended recipient, you are not authorized to read, retain, copy, print, distribute or use this message. If you have received this communication in error, please notify the sender and delete all copies of this message. Persistent Systems Ltd. does not accept any liability for virus infected mails.
---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org
Re: Problem in uploading file from stand-alone application
Posted by jayakumar ala <al...@gmail.com>.
Rupesh,
Probably you can try this with Apache HttpClient.
On Tue, Nov 17, 2009 at 1:45 AM, Rupesh Mankar <
rupesh_mankar@persistent.co.in> wrote:
> Hi,
>
> I want to upload file on server from stand-alone application (using
> HTTPURLConnection). But when I run stand-alone application which uploads
> file, I get following exception on server:
>
>
> -------------------------------------------------------------------------------------------------------------------------------------------
> WARNING: Parameters: Character decoding failed. Parameter skipped.
> java.io.CharConversionException: isHexDigit
> at org.apache.tomcat.util.buf.UDecoder.convert(UDecoder.java:88)
> at org.apache.tomcat.util.buf.UDecoder.convert(UDecoder.java:49)
> at
> org.apache.tomcat.util.http.Parameters.urlDecode(Parameters.java:410)
> at
> org.apache.tomcat.util.http.Parameters.processParameters(Parameters.java:392)
> at
> org.apache.tomcat.util.http.Parameters.processParameters(Parameters.java:344)
> at
> org.apache.catalina.connector.Request.parseParameters(Request.java:2453)
> at
> org.apache.catalina.connector.Request.getParameterNames(Request.java:1073)
> at
> org.apache.catalina.connector.Request.getParameterMap(Request.java:1053)
> at
> org.apache.catalina.connector.RequestFacade.getParameterMap(RequestFacade.java:414)
> at
> javax.servlet.ServletRequestWrapper.getParameterMap(ServletRequestWrapper.java:166)
> at
> org.apache.struts2.dispatcher.mapper.DefaultActionMapper.handleSpecialParameters(DefaultActionMapper.java:351)
> at
> org.apache.struts2.dispatcher.mapper.DefaultActionMapper.getMapping(DefaultActionMapper.java:311)
>
> -------------------------------------------------------------------------------------------------------------------------------------------
>
> It seems struts2 filter tries to retrieve parameters from request. I am
> directly writing file content which are byte array on output stream of url
> connection.
>
> One workaround I found is to bypass the upload request from struts2
> filtering. But this approach is not good because my entire web application
> is struts based.
>
> Is there any way to upload file through strut itself?
>
> Thanks,
> Rupesh
>
>
>
> DISCLAIMER
> ==========
> This e-mail may contain privileged and confidential information which is
> the property of Persistent Systems Ltd. It is intended only for the use of
> the individual or entity to which it is addressed. If you are not the
> intended recipient, you are not authorized to read, retain, copy, print,
> distribute or use this message. If you have received this communication in
> error, please notify the sender and delete all copies of this message.
> Persistent Systems Ltd. does not accept any liability for virus infected
> mails.
>