users@jersey.java.net

[Jersey] URL encoding on multi-part

From: dloy <david.loy_at_ucop.edu>
Date: Tue, 22 Feb 2011 11:57:34 -0800

I'm running into the problem that jersey appears to require URL encoding
of multi-part elements.

In the example below the line containing #%checkm_0.7 is causing Jersey
to fail with:
java.lang.IllegalArgumentException: URLDecoder: Illegal hex characters
in escape (%) pattern - For input string: "ch"

Is there some header causing this problem or is this the normal behavior
of a POST multi-part?

Thanks
David

DUMP:

Feb 22, 2011 11:34:25 AM
com.sun.jersey.api.container.filter.LoggingFilter filter
INFO: 10 * Server in-bound request
10 > POST http://localhost:28080/storage/add/10/12345-abcde
10 > host: localhost:28080
10 > user-agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US;
rv:1.9.2.13) Gecko/20101203 Firefox/3.6.13 ( .NET CLR 3.5.30729)
10 > accept: text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8
10 > accept-language: en-us,en;q=0.5
10 > accept-encoding: gzip,deflate
10 > accept-charset: ISO-8859-1,utf-8;q=0.7,*;q=0.7
10 > keep-alive: 115
10 > connection: keep-alive
10 > referer: http://localhost:28080/mrtstorejsp/jsp/version.jsp
10 > content-type: multipart/form-data;
boundary=---------------------------298551205316962
10 > content-length: 3280
10 >
-----------------------------298551205316962
Content-Disposition: form-data; name="manifest";
filename="testmanifest4.txt"
Content-Type: text/plain

#%checkm_0.7
#%profile http://uc3.cdlib.org/registry/mrt/mrt-add-manifest
https://confluence.ucop.edu/download/attachments/20250670/testG23.xls |
MD5 | 6a572cde2333264596ff1d0439c49717 | 21504 | - | fptr105.xls
https://confluence.ucop.edu/download/attachments/20250670/testG24.xls |
MD5 | e30fbb511b1d2f82f6949b8e43166c5c | 21504 | - | fptr106.xls
...

#%EOF
-----------------------------298551205316962
Content-Disposition: form-data; name="t"

xhtml
-----------------------------298551205316962--


Feb 22, 2011 11:34:25 AM com.sun.jersey.spi.container.ContainerResponse
mapMappableContainerException
SEVERE: The RuntimeException could not be mapped to a response,
re-throwing to the HTTP container
java.lang.IllegalArgumentException: URLDecoder: Illegal hex characters
in escape (%) pattern - For input string: "ch"
         at java.net.URLDecoder.decode(URLDecoder.java:173)
         at
com.sun.jersey.core.impl.provider.entity.BaseFormProvider.readFrom(BaseFormProvider.java:74)
         at
com.sun.jersey.core.impl.provider.entity.FormProvider.readFrom(FormProvider.java:70)
         at
com.sun.jersey.core.impl.provider.entity.FormProvider.readFrom(FormProvider.java:57)
         at
com.sun.jersey.spi.container.ContainerRequest.getEntity(ContainerRequest.java:444)
         at
com.sun.jersey.spi.container.ContainerRequest.getEntity(ContainerRequest.java:453)
         at
com.sun.jersey.server.impl.model.method.dispatch.FormDispatchProvider.processForm(FormDispatchProvider.java:93)
         at
com.sun.jersey.server.impl.model.method.dispatch.FormDispatchProvider$FormParameterProvider.getInjectableValues(FormDispatchProvider.java:105)
         at
com.sun.jersey.server.impl.model.method.dispatch.AbstractResourceMethodDispatchProvider$EntityParamInInvoker.getParams(AbstractResourceMethodDispatchProvider.java:119)
         at
com.sun.jersey.server.impl.model.method.dispatch.AbstractResourceMethodDispatchProvider$ResponseOutInvoker._dispatch(AbstractResourceMethodDispatchProvider.java:166)
         at
com.sun.jersey.server.impl.model.method.dispatch.ResourceJavaMethodDispatcher.dispatch(ResourceJavaMethodDispatcher.java:67)
         at
com.sun.jersey.server.impl.uri.rules.HttpMethodRule.accept(HttpMethodRule.java:259)
         at
com.sun.jersey.server.impl.uri.rules.RightHandPathRule.accept(RightHandPathRule.java:133)
         at
com.sun.jersey.server.impl.uri.rules.ResourceClassRule.accept(ResourceClassRule.java:83)
         at
com.sun.jersey.server.impl.uri.rules.RightHandPathRule.accept(RightHandPathRule.java:133)
         at
com.sun.jersey.server.impl.uri.rules.RootResourceClassesRule.accept(RootResourceClassesRule.java:71)
         at
com.sun.jersey.server.impl.application.WebApplicationImpl._handleRequest(WebApplicationImpl.java:990)
         at
com.sun.jersey.server.impl.application.WebApplicationImpl.handleRequest(WebApplicationImpl.java:941)
         at
com.sun.jersey.server.impl.application.WebApplicationImpl.handleRequest(WebApplicationImpl.java:932)
         at
com.sun.jersey.spi.container.servlet.WebComponent.service(WebComponent.java:384)
         at
com.sun.jersey.spi.container.servlet.ServletContainer.service(ServletContainer.java:451)
         at
com.sun.jersey.spi.container.servlet.ServletContainer.service(ServletContainer.java:632)
         at javax.servlet.http.HttpServlet.service(HttpServlet.java:717)
         at
org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:290)
         at
org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
         at
org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:233)
         at
org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:191)
         at
org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:128)
         at
org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102)
         at
org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)
         at
org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:286)
         at
org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:845)
         at
org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:583)
         at
org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:447)
         at java.lang.Thread.run(Thread.java:619)