users@grizzly.java.net

Re: TCP/HTTP Transfer-Encoding chunk problem

From: Jeanfrancois Arcand <Jeanfrancois.Arcand_at_Sun.COM>
Date: Wed, 23 May 2007 12:14:53 -0400

Hi Yaman,

Ustuntas Yaman wrote:
> Hi Jeanfrancois,
>
> Thanks for your reply:
>
> Setup class:
>
> SelectorThread st = new SelectorThread();
> st.setAlgorithmClassName(NoParsingAlgorithm.class.getName());
> st.setPort(port);
> st.setWebAppRootPath(rootFolder);
> st.setAdapter(new RequestHandler());
> st.setDisplayConfiguration(true);
> st.initEndpoint();
> st.startEndpoint();
>
>
> I use the following operation to send data, always one chunck for data:
>
> public void write(Response res, String contentType, byte[] data) throws IOException {
> res.setContentType(contentType);
> res.addHeader("Server", "Cryptosense SL");
> res.sendHeaders();
> ByteChunk chunk = new ByteChunk();
> chunk.setBytes(data, 0, data.length);
> res.doWrite(chunk);
> res.finish();
> }

This looks good. If you put a breakpoint in
tcp/http11/filters/ChunkedOutputFilter, does it get invoked when doing
res.doWrite(...); Also if you add, res.setContentLength(-1), does it
makes a difference? I suspect the chunking is not enabled.

You are using 1.5 right?

Thanks

-- jeanfrancois


>
> after res.doWrite(chunk) line i have also tried the following:
>
> req.action(ActionCode.ACTION_POST_REQUEST , null);
> and
> req.action(ActionCode.ACTION_COMMIT, null);
> and
> req.aknowledge();
>
> but none of them worked to send the "0\r\n\r\n" in a seperate ending chunk.
>
> Thanks
>
> --
> Yaman Ustuntas
>
> 4C Technologies, kZen R&D team
> yaman.ustuntas_at_kzen.be
> tel: +32 (0)3 4513660
> mob: +32 (0)484510888
>
>
>
> -----Original Message-----
> From: Jeanfrancois Arcand [mailto:Jeanfrancois.Arcand_at_Sun.COM]
> Sent: Wed 23/05/2007 17:01
> To: users_at_grizzly.dev.java.net
> Subject: Re: TCP/HTTP Transfer-Encoding chunk problem
>
> Hi Yaman,
>
> Ustuntas Yaman wrote:
>> Hello,
>>
>> I am making a WSS security server with grizzly.
>
> Are you using 1.0 or 1.5?
>
> What the server returns
>> seems fine if a url is requested by the client.
>> But when I make a JAXWS call (generated stubs) to the service, the
>> client fails with the following exception:
>>
>> javax.xml.ws.WebServiceException: Unsupported endpoint address:
>> at
>> com.sun.xml.ws.api.pipe.TransportTubeFactory.create(TransportTubeFactory.java:108)
>> at
>> com.sun.xml.ws.transport.DeferredTransportPipe.processRequest(DeferredTransportPipe.java:76)
>> ....
>>
>> This client works fine if I call the same service deployed on
>> tomcat/glassfish.
>> I wrote another client, this time constructing the SOAP message manually
>> with SOAPMessage class (+ security). This doesn't make the GET call
>> before invoking the service and it works fine on my server.
>> What JAXWS (generated stubs) does it to do a GET on the WSDL file first
>> before invoking the service.
>> The server returns the WSDL but there seems to be something wrong with
>> the Transfer-Encoding chunk.
>
> How are you staring the server (the command line)?
>
>
>> I looked at the server output on the wire and the
>> com.sun.grizzly.tcp.Response class doesn't seem send the "0\r\n" (to
>> indicate the end of the chunks/response) in a seperate chunk but appends
>> "0\r\n to the chunk containing the response.
>> That is the only difference I could find which could make the JAXWS
>> client fail.
>
> The code is under tcp/http11/filters/ChunkedOutputFilter
>
> I suspect that filter is not invoked properly. Is the header properl;y
> chunked? If you can send me a test case, I can take a look.
>
> Thanks!
>
> -- Jeanfrancois
>
>> Any suggestion on how I can make the "0\r\n" to be send in another
>> (last) chunk?
>>
>>
>> Thanks in advance :)
>>
>> --
>> Yaman
>>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe_at_grizzly.dev.java.net
> For additional commands, e-mail: users-help_at_grizzly.dev.java.net
>
>
>
>
> ------------------------------------------------------------------------
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe_at_grizzly.dev.java.net
> For additional commands, e-mail: users-help_at_grizzly.dev.java.net