dev@grizzly.java.net

Re: async write problem -- WAS: still some help for grizzlywebserver

From: Oleksiy Stashok <Oleksiy.Stashok_at_Sun.COM>
Date: Wed, 14 Jan 2009 13:31:46 +0100

Hi Rama,

can I ask one more thing... Can you pls. submit and issue for async
write problem [1]?

Thanks in advance.

WBR,
Alexey.

[1] http://grizzly.dev.java.net/issues

On Jan 7, 2009, at 20:13 , rama wrote:

>
> As promised, i was able to test the async write today.
>
> Unfortunatly even with the patch nothing changed :)
>
>
> basically i try to load a flash movie (swf) inside another swf movie
> via loadmovie function.
> this bring unexpected result, flash hangs, movie is not loaded and
> so on.
>
> Giving to you other info is a bit complicate :(
>
> If you want, i can wrote a little fla as a test, but probably is
> possible to reproduce the problem even in some other way
>
> best regards.
>
>
>> Also I've commited some fix for async. write [1]. Please try it
>> out, if this will fix your issue.
>>
>>>
>>>
>>>>> 2) async write
>>>>> ****
>>>>> public void useAsynchronousWrite(boolean asyncWrite){
>>>>> st.setAsyncHttpWriteEnabled(asyncWrite);
>>>>> }
>>>>> ****
>>>> Async write currently doesn't work with ssl, just with plain HTTP.
>>>> Can you pls. try plain HTTP to be sure the problem is just with
>>>> HTTPS?
>>>>
>>>>>
>>>>> if i turn this on, i got some wired response :(
>>>>> basically the client is a flash program, that do some loadmovie.
>>>>> Sometimes the flash get corrupted in the transfer and flash
>>>>> crash with pain and suffering.
>>>>> removing the asyncwrite fix the problem :) honestly i don't know
>>>>> how i can debug it :(
>>>>>
>>>>> but i have some info to give to you :D
>>>>>
>>>>> this is what i do to write the response, i have 2 different case
>>>>> a) the request is a POST, i parse the request and generate an
>>>>> XML as a response then, to write it
>>>>> ****
>>>>> httpResp.setHeader("Set-Cookie", "SID="+session.sid);
>>>>> httpResp.setCharacterEncoding("utf-8");
>>>>> httpResp.setStatus(200);
>>>>> httpResp.setContentType("text/xml");
>>>>> httpResp.getWriter().print(res.asXML());
>>>>> ****
>>>>>
>>>>> res.asXML return a string, so for me is ok, isn't it??
>>>>> I haven't tested too much this part with asyncwrite, because the
>>>>> flash crash before (while loading a swf)
>>>>>
>>>>> b) the request is a GET, so i send out a file
>>>>> i don't use staticresadapter, for some odd reason i need to get
>>>>> the file in 2 different place (i know that this is horrible, but
>>>>> at the moment is the only way)
>>>>> and, to write the file out, i do
>>>>> ****
>>>>> //SEND FILE
>>>>> res.setStatus(200);
>>>>>
>>>>> int dot =
>>>>> resource.getName().lastIndexOf(".");
>>>>> if (dot > 0) {
>>>>> String ext =
>>>>> resource.getName().substring(dot + 1);
>>>>> String ct = MimeType.get(ext);
>>>>> if (ct != null) {
>>>>> res.setContentType(ct);
>>>>> }
>>>>> } else {
>>>>>
>>>>> res.setContentType(MimeType.get("html"));
>>>>> }
>>>>>
>>>>> long length = resource.length();
>>>>> res.setContentLengthLong(length);
>>>>>
>>>>> fis = new FileInputStream(resource);
>>>>> byte b[] = new byte[8192];
>>>>> while (fis.read(b) > 0) {
>>>>> res.getStream().write(b);
>>>>> }
>>>>> res.getStream().flush();
>>>>> ****
>>>>>
>>>>> keep in mind that res is a grizzlyresponse in this example.
>>>>> could this piece of code generate some problem with asyncwrite?
>>>>
>>>
>>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: dev-unsubscribe_at_grizzly.dev.java.net
> For additional commands, e-mail: dev-help_at_grizzly.dev.java.net
>