On 03/09/2010 16:55, Paul Sandoz wrote:
>
> On Sep 3, 2010, at 4:31 PM, Ángel Eduardo wrote:
>
>> This is the result. It seems indeed some problem with media type, but
>> later it seems to found my classes and path, so no clue here...
>>
>> INFO: 1 * Server in-bound request
>> 1 > POST http://test.com/filterSupport/cell
>> 1 > host: test.com
>> 1 > x-real-ip: 127.0.0.1
>> 1 > x-forwarded-for: 127.0.0.1
>> 1 > connection: close
>> 1 > referer: https://test.com/list/cells
>> 1 > content-length: 469
>> 1 > cache-control: max-age=0
>> 1 > origin: https://test.com
>> 1 > content-type: multipart/form-data;
>> boundary=----WebKitFormBoundaryMbWFHE6Ulo5PCN5r
>> 1 > accept:
>> application/xml,application/xhtml+xml,text/html;q=0.9,text/plain;q=0.8,image/png,*/*;q=0.5
>> 1 > user-agent: Mozilla/5.0 (Macintosh; U; Intel Mac OS X 10_6_3;
>> en-US) AppleWebKit/534.7 (KHTML, like Gecko) Chrome/7.0.512.0
>> Safari/534.7
>> 1 > accept-encoding: gzip,deflate,sdch
>> 1 > accept-language: en-US,en;q=0.8
>> 1 > accept-charset: ISO-8859-1,utf-8;q=0.7,*;q=0.3
>> 1 > cookie: PHPSESSID=njr5agujma3ohh1uqmpu1uf9v1
>> 1 >
>> ------WebKitFormBoundaryMbWFHE6Ulo5PCN5r
>> Content-Disposition: form-data; name="auth"
>> pass::pass
>> ------WebKitFormBoundaryMbWFHE6Ulo5PCN5r
>> Content-Disposition: form-data; name="data"; filename="lalala"
>> Content-Type:
>
> The above value is empty. I am not sure if this is valid MIME message
> or not. When the Content-Type is absent one assumes text/plain. But in
> this case it is not absent but with an empty value. I guess in this
> case Jersey should be liberal in what it accepts.
I'm not sure what you mean. My Content-Type is not empty, but is
1 > content-type: multipart/form-data;
boundary=----WebKitFormBoundaryMbWFHE6Ulo5PCN5r
...don't know why Jersey thinks it's empty. Or are you referring to
another var?
>
> Is this being sent from a browser like Safari?
This is sent from a Chrome browser (Chromium last build, exactly)
>
> Paul.
Sorry for all the trouble, and thanks a lot for your support :)
--
Ángel Eduardo
>
>> 123321,data,data
>> ------WebKitFormBoundaryMbWFHE6Ulo5PCN5r--
>>
>> INFO: Mapped exception to response: 400 (Bad Request)
>> javax.ws.rs.WebApplicationException:
>> java.lang.IllegalArgumentException: Error parsing media type ''
>> at
>> com.sun.jersey.multipart.impl.MultiPartReaderClientSide.readMultiPart(MultiPartReaderClientSide.java:200)
>> at
>> com.sun.jersey.multipart.impl.MultiPartReaderServerSide.readMultiPart(MultiPartReaderServerSide.java:80)
>> at
>> com.sun.jersey.multipart.impl.MultiPartReaderClientSide.readFrom(MultiPartReaderClientSide.java:139)
>> at
>> com.sun.jersey.multipart.impl.MultiPartReaderClientSide.readFrom(MultiPartReaderClientSide.java:77)
>> at
>> com.sun.jersey.spi.container.ContainerRequest.getEntity(ContainerRequest.java:454)
>> at
>> com.sun.jersey.spi.container.ContainerRequest.getEntity(ContainerRequest.java:463)
>> at
>> com.sun.jersey.multipart.impl.FormDataMultiPartDispatchProvider$FormDataInjectableValuesProvider.getInjectableValues(FormDataMultiPartDispatchProvider.java:115)
>> at
>> com.sun.jersey.server.impl.model.method.dispatch.AbstractResourceMethodDispatchProvider$EntityParamInInvoker.getParams(AbstractResourceMethodDispatchProvider.java:138)
>> at
>> com.sun.jersey.server.impl.model.method.dispatch.AbstractResourceMethodDispatchProvider$ResponseOutInvoker._dispatch(AbstractResourceMethodDispatchProvider.java:185)
>> at
>> com.sun.jersey.server.impl.model.method.dispatch.ResourceJavaMethodDispatcher.dispatch(ResourceJavaMethodDispatcher.java:70)
>> at
>> com.sun.jersey.server.impl.uri.rules.HttpMethodRule.accept(HttpMethodRule.java:279)
>> at
>> com.sun.jersey.server.impl.uri.rules.RightHandPathRule.accept(RightHandPathRule.java:136)
>> at
>> com.sun.jersey.server.impl.uri.rules.ResourceClassRule.accept(ResourceClassRule.java:86)
>> at
>> com.sun.jersey.server.impl.uri.rules.RightHandPathRule.accept(RightHandPathRule.java:136)
>> at
>> com.sun.jersey.server.impl.uri.rules.RootResourceClassesRule.accept(RootResourceClassesRule.java:74)
>> at
>> com.sun.jersey.server.impl.application.WebApplicationImpl._handleRequest(WebApplicationImpl.java:1358)
>> at
>> com.sun.jersey.server.impl.application.WebApplicationImpl._handleRequest(WebApplicationImpl.java:1290)
>> at
>> com.sun.jersey.server.impl.application.WebApplicationImpl.handleRequest(WebApplicationImpl.java:1240)
>> at
>> com.sun.jersey.server.impl.application.WebApplicationImpl.handleRequest(WebApplicationImpl.java:1230)
>> at
>> com.sun.jersey.spi.container.servlet.WebComponent.service(WebComponent.java:419)
>> at
>> com.sun.jersey.spi.container.servlet.ServletContainer.service(ServletContainer.java:497)
>> at
>> com.sun.jersey.spi.container.servlet.ServletContainer.service(ServletContainer.java:684)
>> at javax.servlet.http.HttpServlet.service(HttpServlet.java:847)
>> at
>> org.apache.catalina.core.StandardWrapper.service(StandardWrapper.java:1523)
>> at
>> org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:279)
>> at
>> org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:188)
>> at
>> org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:641)
>> at com.sun.enterprise.web.WebPipeline.invoke(WebPipeline.java:97)
>> at
>> com.sun.enterprise.web.PESessionLockingStandardPipeline.invoke(PESessionLockingStandardPipeline.java:85)
>> at
>> org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:185)
>> at
>> org.apache.catalina.connector.CoyoteAdapter.doService(CoyoteAdapter.java:325)
>> at
>> org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:226)
>> at
>> com.sun.enterprise.v3.services.impl.ContainerMapper.service(ContainerMapper.java:165)
>> at
>> com.sun.grizzly.http.ProcessorTask.invokeAdapter(ProcessorTask.java:791)
>> at
>> com.sun.grizzly.comet.CometEngine.executeServlet(CometEngine.java:473)
>> at com.sun.grizzly.comet.CometEngine.handle(CometEngine.java:341)
>> at
>> com.sun.grizzly.comet.CometAsyncFilter.doFilter(CometAsyncFilter.java:84)
>> at
>> com.sun.grizzly.arp.DefaultAsyncExecutor.invokeFilters(DefaultAsyncExecutor.java:161)
>> at
>> com.sun.grizzly.arp.DefaultAsyncExecutor.interrupt(DefaultAsyncExecutor.java:137)
>> at
>> com.sun.grizzly.arp.AsyncProcessorTask.doTask(AsyncProcessorTask.java:88)
>> at com.sun.grizzly.http.TaskBase.run(TaskBase.java:189)
>> at
>> com.sun.grizzly.util.AbstractThreadPool$Worker.doWork(AbstractThreadPool.java:330)
>> at
>> com.sun.grizzly.util.AbstractThreadPool$Worker.run(AbstractThreadPool.java:309)
>> at java.lang.Thread.run(Thread.java:637)
>> Caused by: java.lang.IllegalArgumentException: Error parsing media
>> type ''
>> at
>> com.sun.jersey.core.impl.provider.header.MediaTypeProvider.fromString(MediaTypeProvider.java:80)
>> at
>> com.sun.jersey.core.impl.provider.header.MediaTypeProvider.fromString(MediaTypeProvider.java:53)
>> at javax.ws.rs.core.MediaType.valueOf(MediaType.java:119)
>> at
>> com.sun.jersey.multipart.impl.MultiPartReaderClientSide.readMultiPart(MultiPartReaderClientSide.java:196)
>> ... 43 more
>> Caused by: java.text.ParseException: End of header
>> at
>> com.sun.jersey.core.header.reader.HttpHeaderReaderImpl.getNextCharacter(HttpHeaderReaderImpl.java:219)
>> at
>> com.sun.jersey.core.header.reader.HttpHeaderReaderImpl.next(HttpHeaderReaderImpl.java:184)
>> at
>> com.sun.jersey.core.header.reader.HttpHeaderReader.nextToken(HttpHeaderReader.java:96)
>> at
>> com.sun.jersey.core.impl.provider.header.MediaTypeProvider.valueOf(MediaTypeProvider.java:90)
>> at
>> com.sun.jersey.core.impl.provider.header.MediaTypeProvider.fromString(MediaTypeProvider.java:78)
>> ... 46 more
>>
>> INFO: 1 * Server out-bound response
>> 1 < 400
>> 1 < X-Jersey-Trace-000: accept root resource classes:
>> "/filterSupport/cell"
>> 1 < X-Jersey-Trace-001: match path "/filterSupport/cell" ->
>> "/application\.wadl(/.*)?", "/filterSupport(/.*)?"
>> 1 < X-Jersey-Trace-002: accept right hand path
>> java.util.regex.Matcher[pattern=/filterSupport(/.*)? region=0,19
>> lastmatch=/filterSupport/cell]: "/filterSupport/cell" ->
>> "/filterSupport" : "/cell"
>> 1 < X-Jersey-Trace-003: accept resource: "filterSupport" ->
>> @Path("/filterSupport") test.FilterSupportPath_at_29d4e543
>> 1 < X-Jersey-Trace-004: match path "/cell" -> "/cell(/)?", "/os(/)?", ""
>> 1 < X-Jersey-Trace-005: accept right hand path
>> java.util.regex.Matcher[pattern=/cell(/)? region=0,5
>> lastmatch=/cell]: "/cell" -> "/cell" : ""
>> 1 < X-Jersey-Trace-006: accept sub-resource methods: "filterSupport"
>> : "/cell", POST -> test.FilterSupportPath_at_29d4e543
>> 1 < X-Jersey-Trace-007: matched sub-resource method: @Path("/cell")
>> public javax.ws.rs.core.Response
>> test.FilterSupportPath.onCell(java.lang.String,java.io.InputStream)
>> 1 < X-Jersey-Trace-008: matched message body reader: class
>> com.sun.jersey.multipart.FormDataMultiPart,
>> "multipart/form-data;boundary=----WebKitFormBoundaryMbWFHE6Ulo5PCN5r"
>> -> com.sun.jersey.multipart.impl.MultiPartReaderServerSide_at_6506fe2b
>> 1 < X-Jersey-Trace-009: mapped exception to response:
>> javax.ws.rs.WebApplicationException_at_321baa4a -> 400
>> 1 <
>>
>>
>> --
>> Ángel Eduardo
>>
>>
>> On 03/09/2010 15:18, Paul Sandoz wrote:
>>>
>>> On Sep 3, 2010, at 2:12 PM, Ángel Eduardo wrote:
>>>
>>>> Hi again.
>>>>
>>>> I'm trying with 1.4-SNAPSHOT version, but now the lines
>>>> jersey-client-components and jersey-server-components doesn't
>>>> appear in the log.
>>>
>>>
>>> Right i changed the multipart stuff so it no longer does that.
>>>
>>>
>>>> Also it seems that multipart is not working and server returns a
>>>> 400 (The request sent by the client was syntactically incorrect)
>>>> when trying to access that test method I posted earlier.
>>>>
>>>
>>> I am guessing the Jersey multipart is kicking in otherwise you would
>>> have got another error, so it could be related to the actual parsing
>>> of the multipart/form-data message.
>>>
>>>
>>>> Any clues how to debug / fix this? (I know the OSGi guy is on
>>>> vacation, but maybe someone have any idea)
>>>>
>>>
>>> Jakub is back, but busy today with some Oracle integration stuff
>>> happening for Prague.
>>>
>>> Can you enable logging and tracing?
>>>
>>> <init-param>
>>> <param-name>com.sun.jersey.config.feature.Trace</param-name>
>>> <param-value>true</param-value>
>>> </init-param>
>>> <init-param>
>>> <param-name>com.sun.jersey.spi.container.ContainerRequestFilters</param-name>
>>>
>>> <param-value>com.sun.jersey.api.container.filter.LoggingFilter</param-value>
>>>
>>> </init-param>
>>> <init-param>
>>> <param-name>com.sun.jersey.spi.container.ContainerResponseFilters</param-name>
>>>
>>> <param-value>com.sun.jersey.api.container.filter.LoggingFilter</param-value>
>>>
>>> </init-param>
>>>
>>> I would like to know if there is something wrong with the
>>> multipart/form-data.
>>>
>>> Best thing to do if possible is to send us a reproducible example.
>>>
>>> Paul.
>>>
>>>
>>> ---------------------------------------------------------------------
>>> To unsubscribe, e-mail: users-unsubscribe_at_jersey.dev.java.net
>>> For additional commands, e-mail: users-help_at_jersey.dev.java.net
>>>
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: users-unsubscribe_at_jersey.dev.java.net
>> For additional commands, e-mail: users-help_at_jersey.dev.java.net
>>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe_at_jersey.dev.java.net
> For additional commands, e-mail: users-help_at_jersey.dev.java.net
>