Re: Issue with Nokia HttpConnection.flush()

Ricardo Scholz <[email protected]> Tue, 23 Jun 2009 00:32:55 -0300
Newsgroups gmane.comp.java.sun.kvm
Message-ID <[email protected]>
--001e680f13387e8021046cfba54e
Content-Type: text/plain; charset=windows-1252
Content-Transfer-Encoding: quoted-printable

Hi All,

There's a mistake in the first message, when I said HttpConnection.flush() =
I
meant OutputStream.flush().

Hi Chris,

Thanx for your reply. Yes, you're right. Setting the content-length makes n=
o
sense if the chunked protocol prepends each chunk length at the beginning o=
f
the chunks. The Motorola version content-length is overwritten to -1, and
works fine.

My question is: why the Nokia version does not overwrite the content-length
property to -1 when I call OutputStream.flush() [what seems to be the metho=
d
that makes transfer-encoding be changed to chunked in the Motorola version]=
?
Also, this method does not make the transfer-encoding be changed to chunked=
,
nor actually includes the prepended chunks length in the message body [it
seems to infuence both in the Motorola version].

I can't underestand how to get control of 'chunking' turnning on/off. (I
don't even know whether it is possible or not).

I'll try without setting the content-length (as setting it is useless and
makes no sense anyway ;)

Best regards,

Ricardo.

On Mon, Jun 22, 2009 at 11:21 PM, Chris B <[email protected]> wrote:

>  content-length: -1 (although I explicitly set it to the byte array
> length)
> connection: close (implicitly set)
> content-type: application/x-www-form-urlencoded (explicitly set)
> transfer-encoding: chunked (implicitly set)
>
>
> you cant have a chunked with a content length! it's one or the other.
>
>
> ----- Original Message -----
> *From:* Ricardo Scholz <[email protected]>
> *To:* [email protected]
> *Sent:* Monday, June 22, 2009 9:25 PM
> *Subject:* Issue with Nokia HttpConnection.flush()
>
> Hello everybody,
>
> I've been trying to implement a client-server application that exchanges
> byte arrays through a HTTP connection. My client-server application works
> fine with a Motorola V3, but when I try to connect from a Nokia 5310
> XpressMusic, the input stream in the server cannot be read (it comes empt=
y).
> I used a software that receives the connection and forwards the request t=
o
> the server, to see some information about what was being sent by the
> clients, so I got the information below:
>
> In the successful Motorola version, the header parameters are:
>
> content-length: -1 (although I explicitly set it to the byte array length=
)
> connection: close (implicitly set)
> content-type: application/x-www-form-urlencoded (explicitly set)
> transfer-encoding: chunked (implicitly set)
>
> and the actual data sent has the chunked formatting (the chunk size
> prepended and a zeroed chunk size to inform the end of the chunks sequenc=
e),
> as below:
>
> 29
> 3333223 cdefghijkb=96=9F5=A9=A6=9C=936=93=94=95=96<=93=94=95=96=97=98r=99=
=9A=9B
> 0
>
> In the other hand, the unsuccessful Nokia version has the following heade=
r
> parameters:
>
> content-length: <the actual data length> (explicitly set)
> connection: keep alive (implicitly set)
> content-type: application/x-www-form-urlencoded (explicitly set)
> <no transfer-encoding parameter set>
>
> and the actual data sent does not have the chunked formating, as below:
>
> 3333223 cdefghijkb=96=9F5=A9=A6=9C=936=93=94=95=96<=93=94=95=96=97=98r=99=
=9A=9B
>
> I used pretty much the networking implementation as defined in the API. I=
n
> addition, as far as I could understand, the call to HttpConnection.flush(=
)
> sets the transfer-encoding header parameter to chunked, but it only works
> for the Motorola version. Without it, none of the two versions works fine=
,
> as it seems that the server can only deal with chunked data.
>
> I've tried to find something in the Forum Nokia, KVM-Interests archives a=
nd
> Google, but without actual success.
>
> If you guys have any idea on how to work this around, either in the clien=
t
> application or in the server application, I'd appreciate.
>
> Many thanks.
>
> Best regards,
>
> Ricardo Scholz.
>
> --
> ricardo]scholz
> meantime]mobile.creations
> +55[81]8664.8665
> =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D
> To unsubscribe, send email to [email protected] and include in the
> body of the message "signoff KVM-INTEREST". For general help, send email =
to
> [email protected] and include in the body of the message "help".
>
> =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D
> To unsubscribe, send email to [email protected] and include in the
> body of the message "signoff KVM-INTEREST". For general help, send email =
to
> [email protected] and include in the body of the message "help".




--=20
ricardo]scholz
+55[81]8664.8665

=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
To unsubscribe, send email to [email protected] and include in the body
of the message "signoff KVM-INTEREST".  For general help, send email to
[email protected] and include in the body of the message "help".

--001e680f13387e8021046cfba54e
Content-Type: text/html; charset=windows-1252
Content-Transfer-Encoding: quoted-printable

Hi All,<br><br>There&#39;s a mistake in the first message, when I said Http=
Connection.flush() I meant OutputStream.flush().<br><br>Hi Chris,<br><br>Th=
anx for your reply. Yes, you&#39;re right. Setting the content-length makes=
 no sense if the chunked protocol prepends each chunk length at the beginni=
ng of the chunks. The Motorola version content-length is overwritten to -1,=
 and works fine. <br>
<br>My question is: why the Nokia version does not overwrite the content-le=
ngth property to -1 when I call OutputStream.flush() [what seems to be the =
method that makes transfer-encoding be changed to chunked in the Motorola v=
ersion]? Also, this method does not make the transfer-encoding be changed t=
o chunked, nor actually includes the prepended chunks length in the message=
 body [it seems to infuence both in the Motorola version].<br>
<br>I can&#39;t underestand how to get control of &#39;chunking&#39; turnni=
ng on/off. (I don&#39;t even know whether it is possible or not).<br><br>I&=
#39;ll try without setting the content-length (as setting it is useless and=
 makes no sense anyway ;)<br>
<br>Best regards,<br><br>Ricardo.<br><br><div class=3D"gmail_quote">On Mon,=
 Jun 22, 2009 at 11:21 PM, Chris B <span dir=3D"ltr">&lt;<a href=3D"mailto:=
[email protected]">[email protected]</a>&gt;</span> wrote:<br><bloc=
kquote class=3D"gmail_quote" style=3D"border-left: 1px solid rgb(204, 204, =
204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">






<div bgcolor=3D"#ffffff"><div class=3D"im">
<div>content-length: -1 (although I explicitly set it to the byte array=20
length)<br>connection: close (implicitly set)<br>content-type:=20
application/x-www-form-urlencoded (explicitly set)<br>transfer-encoding: ch=
unked=20
(implicitly set)</div>
<div>=A0</div>
<div><font size=3D"2" face=3D"Arial"></font>=A0</div>
</div><div><font size=3D"2" face=3D"Arial">you cant have a chunked with a c=
ontent length! it&#39;s=20
one or the other.</font></div>
<div><font size=3D"2" face=3D"Arial"></font>=A0</div>
<blockquote style=3D"border-left: 2px solid rgb(0, 0, 0); padding-right: 0p=
x; padding-left: 5px; margin-left: 5px; margin-right: 0px;"><div><div></div=
><div class=3D"h5">
  <div style=3D"font-family: arial; font-style: normal; font-variant: norma=
l; font-weight: normal; font-size: 10pt; line-height: normal; font-size-adj=
ust: none; font-stretch: normal;">----- Original Message ----- </div>
  <div style=3D"background: rgb(228, 228, 228) none repeat scroll 0% 0%; -m=
oz-background-clip: -moz-initial; -moz-background-origin: -moz-initial; -mo=
z-background-inline-policy: -moz-initial; font-family: arial; font-style: n=
ormal; font-variant: normal; font-weight: normal; font-size: 10pt; line-hei=
ght: normal; font-size-adjust: none; font-stretch: normal;">
<b>From:</b>=20
  <a title=3D"[email protected]" href=3D"mailto:[email protected]=
OM" target=3D"_blank">Ricardo=20
  Scholz</a> </div>
  <div style=3D"font-family: arial; font-style: normal; font-variant: norma=
l; font-weight: normal; font-size: 10pt; line-height: normal; font-size-adj=
ust: none; font-stretch: normal;"><b>To:</b> <a title=3D"KVM-INTEREST@JAVA.=
SUN.COM" href=3D"mailto:[email protected]" target=3D"_blank">KVM-IN=
[email protected]</a> </div>

  <div style=3D"font-family: arial; font-style: normal; font-variant: norma=
l; font-weight: normal; font-size: 10pt; line-height: normal; font-size-adj=
ust: none; font-stretch: normal;"><b>Sent:</b> Monday, June 22, 2009 9:25 P=
M</div>

  <div style=3D"font-family: arial; font-style: normal; font-variant: norma=
l; font-weight: normal; font-size: 10pt; line-height: normal; font-size-adj=
ust: none; font-stretch: normal;"><b>Subject:</b> Issue with Nokia=20
  HttpConnection.flush()</div>
  <div><br></div>Hello everybody,<br><br>I&#39;ve been trying to implement =
a=20
  client-server application that exchanges byte arrays through a HTTP=20
  connection. My client-server application works fine with a Motorola V3, b=
ut=20
  when I try to connect from a Nokia 5310 XpressMusic, the input stream in =
the=20
  server cannot be read (it comes empty). I used a software that receives t=
he=20
  connection and forwards the request to the server, to see some informatio=
n=20
  about what was being sent by the clients, so I got the information=20
  below:<br><br>In the successful Motorola version, the header parameters=
=20
  are:<br><br>content-length: -1 (although I explicitly set it to the byte =
array=20
  length)<br>connection: close (implicitly set)<br>content-type:=20
  application/x-www-form-urlencoded (explicitly set)<br>transfer-encoding:=
=20
  chunked (implicitly set)<br><br>and the actual data sent has the chunked=
=20
  formatting (the chunk size prepended and a zeroed chunk size to inform th=
e end=20
  of the chunks sequence), as=20
  below:<br><br>29<br>3333223 cdefghijkb=96=9F5=A9=A6=9C=936=93=94=95=96&lt=
;=93=94=95=96=97=98r=99=9A=9B<br>0<br><br>In=20
  the other hand, the unsuccessful Nokia version has the following header=
=20
  parameters:<br><br>content-length: &lt;the actual data length&gt; (explic=
itly=20
  set)<br>connection: keep alive (implicitly set)<br>content-type:=20
  application/x-www-form-urlencoded (explicitly set)<br>&lt;no transfer-enc=
oding=20
  parameter set&gt;<br><br>and the actual data sent does not have the chunk=
ed=20
  formating, as=20
  below:<br><br>3333223 cdefghijkb=96=9F5=A9=A6=9C=936=93=94=95=96&lt;=93=
=94=95=96=97=98r=99=9A=9B<br><br>I used=20
  pretty much the networking implementation as defined in the API. In addit=
ion,=20
  as far as I could understand, the call to HttpConnection.flush() sets the=
=20
  transfer-encoding header parameter to chunked, but it only works for the=
=20
  Motorola version. Without it, none of the two versions works fine, as it =
seems=20
  that the server can only deal with chunked data.<br><br>I&#39;ve tried to=
 find=20
  something in the Forum Nokia, KVM-Interests archives and Google, but with=
out=20
  actual success.<br><br>If you guys have any idea on how to work this arou=
nd,=20
  either in the client application or in the server application, I&#39;d=20
  appreciate.<br><br>Many thanks.<br><br>Best regards,<br><br>Ricardo=20
  Scholz.<br><br>--=20
  <br>ricardo]scholz<br>meantime]mobile.creations<br>+55[81]8664.8665<br></=
div></div>=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=20
  To unsubscribe, send email to <a href=3D"mailto:[email protected]" ta=
rget=3D"_blank">[email protected]</a> and include in the body of=20
  the message &quot;signoff KVM-INTEREST&quot;. For general help, send emai=
l to=20
  <a href=3D"mailto:[email protected]" target=3D"_blank">listserv@java.=
sun.com</a> and include in the body of the message &quot;help&quot;.=20
</blockquote></div>
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
To unsubscribe, send email to <a href=3D"mailto:[email protected]" targ=
et=3D"_blank">[email protected]</a> and include in the body
of the message &quot;signoff KVM-INTEREST&quot;.  For general help, send em=
ail to
<a href=3D"mailto:[email protected]" target=3D"_blank">[email protected]=
n.com</a> and include in the body of the message &quot;help&quot;.
</blockquote></div><br><br clear=3D"all"><br>-- <br>ricardo]scholz<br>+55[8=
1]8664.8665<br>
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
To unsubscribe, send email to [email protected] and include in the body
of the message "signoff KVM-INTEREST".  For general help, send email to
[email protected] and include in the body of the message "help".

--001e680f13387e8021046cfba54e--