This is a multi-part message in MIME format.
--------------080606080700010905000906
Content-Type: text/plain; charset=ISO-8859-1; format=flowed
Content-Transfer-Encoding: 8bit
Greetings,
I've compiled MapServer from the CVS HEAD 4.9-dev (2006-07-28) and I'm
suposing the msIO_getStdoutBufferBytes is not working properly when used
in Java Mapscript. I've written a very simple example to explain how it
happens. Please take a look at it :
public void doPost(HttpServletRequest req,
HttpServletResponse resp) throws
ServletException, IOExcept
{
PrintWriter p = resp.getWriter();
mapObj map = new mapObj("/home/maps/rs.wms.map");
OWSRequest reqOWS = new OWSRequest();
reqOWS.setParameter("SERVICE", "WMS");
reqOWS.setParameter("VERSION", "1.1.0");
reqOWS.setParameter("REQUEST", "GetCapabilities");
mapscript.msIO_installStdoutToBuffer();
map.OWSDispatch(reqOWS);
String contentType = mapscript.msIO_stripStdoutBufferContentType();
byte[] content = mapscript.msIO_getStdoutBufferBytes();
p.print(new String(content));
}
The "byte[] content" stores the result of
msIO_stripStdoutBufferContentType and it has some garbage data at the
end. After the > 0x3E we have an NL 0x0A and finally a EOF 0x00, BUT the
content doesn't stop at this point, there are more data after the 0x00
and the Java Mapscript can "see" it. That's a big problem, because when
this "content" is returned, the resulting XML is corrupted. Please check
this example bellow.
000018a0 20 20 20 20 20 20 20 20 20 3c 2f
4c 65 67 65 6e | </Legen|
000018b0 64 55 52 4c 3e 0a 20 20 20 20 20
20 20 20 3c 2f |dURL>. </|
000018c0 53 74 79 6c 65 3e 0a 20 20 20 20
3c 2f 4c 61 79 |Style>. </Lay|
000018d0 65 72 3e 0a 20 20 3c 2f 4c 61 79
65 72 3e 0a 3c |er>. </Layer>.<|
000018e0 2f 43 61 70 61 62 69 6c 69 74 79
3e 0a 3c 2f 57 |/Capability>.</W|
000018f0 4d 54 5f 4d 53 5f 43 61 70 61 62
69 6c 69 74 69 |MT_MS_Capabiliti|
00001900 65 73 3e 0a 00 14 00 00 00 14 00
00 00 14 00 00 |es>.............|
00001910 00 14 00 00 00 14 00 00 00 14 00
00 00 14 00 00 |................|
00001920 00 14 00 00 00 14 00 00 00 14 00
00 00 14 00 |...............|
Is it a known bug? I'm afraid this kind of garbage can produce
undesirable effects in WMS support. For this simples example I can
"manually" remove it but I'm not sure how to deal with it in other
cases. I'll be greatful if you could give me some light.
Best regards,
--
*JosÈ Vilson de Mello de Farias*
/Analista de Sistemas
//SSE - SeguranÁa Pblica/
*DÕGITRO TECNOLOGIA*
*E-mail:* [EMAIL PROTECTED]
<mailto:[EMAIL PROTECTED]>
*Messenger: [EMAIL PROTECTED]
<mailto:[EMAIL PROTECTED]>
***Site:* www.digitro.com.br <http://www.digitro.com.br%20>
<http://www.digitro.com.br%20>
--------------080606080700010905000906
Content-Type: text/html; charset=ISO-8859-1
Content-Transfer-Encoding: 7bit
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<meta content="text/html;charset=ISO-8859-1" http-equiv="Content-Type">
<title></title>
</head>
<body bgcolor="#ffffff" text="#000000">
<font size="-1"><font face="Verdana">Greetings,<br>
<br>
I've compiled MapServer from the CVS HEAD 4.9-dev (2006-07-28) and
I'm suposing the msIO_getStdoutBufferBytes is not working properly when
used in Java Mapscript. I've written a very simple example to explain
how it happens. Please take a look at it : <br>
<br>
</font></font>
<blockquote>
<pre><font face="Lucida Console"
size="-1"> public void
doPost(HttpServletRequest req,
HttpServletResponse resp) throws
ServletException, IOExcept</font></pre>
<pre><font face="Lucida Console" size="-1"> {
PrintWriter p = resp.getWriter();
mapObj map = new
mapObj("/home/maps/rs.wms.map");</font></pre>
<pre><font face="Lucida Console"
size="-1"> OWSRequest reqOWS =
new OWSRequest();
reqOWS.setParameter("SERVICE", "WMS");
reqOWS.setParameter("VERSION", "1.1.0");
reqOWS.setParameter("REQUEST", "GetCapabilities");
</font></pre>
<pre><font face="Lucida Console"
size="-1">
mapscript.msIO_installStdoutToBuffer();
map.OWSDispatch(reqOWS);
</font></pre>
<pre><font face="Lucida Console"
size="-1"> String contentType
= mapscript.msIO_stripStdoutBufferContentType();
byte[] content = mapscript.msIO_getStdoutBufferBytes();
p.print(new String(content));</font></pre>
<pre><font face="Lucida Console" size="-1"> } </font></pre>
</blockquote>
<font face="Verdana" size="-1"><br>
The "byte[] content" stores the result of
msIO_stripStdoutBufferContentType and it has some garbage data at the
end. After the > 0x3E we have an NL 0x0A and finally a EOF 0x00, BUT
the content doesn't stop at this point, there are more data after the
0x00 and the Java Mapscript can "see" it. That's a big problem, because
when this "content" is returned, the resulting XML is corrupted. Please
check this example bellow.</font><font size="-1"><font face="Verdana"><br>
</font></font><font size="-1"><font face="Verdana"><small><font
face="Lucida Console"><br>
</font></small></font></font>
<blockquote>
<pre>000018a0 20 20 20 20 20 20 20
20 20 3c 2f 4c 65 67 65 6e
|
</Legen|
000018b0 64 55 52 4c 3e 0a 20 20 20
20 20 20 20 20 3c 2f
|dURL>.
</|
000018c0 53 74 79 6c 65 3e 0a 20 20
20 20 3c 2f 4c 61 79
|Style>. </Lay|
000018d0 65 72 3e 0a 20 20 3c 2f 4c
61 79 65 72 3e 0a 3c |er>.
</Layer>.<|
000018e0 2f 43 61 70 61 62 69 6c 69
74 79 3e 0a 3c 2f 57
|/Capability>.</W|
000018f0 4d 54 5f 4d 53 5f 43 61 70
61 62 69 6c 69 74 69 |MT_MS_Capabiliti|
00001900 65 73 3e 0a 00 14 00 00 00
14 00 00 00 14 00 00 |es>.............|
00001910 00 14 00 00 00 14 00 00 00
14 00 00 00 14 00 00 |................|
00001920 00 14 00 00 00 14 00 00 00
14 00 00 00 14 00
|...............|</pre>
</blockquote>
<small><font face="Verdana">Is it a known bug? I'm afraid this kind of
garbage can produce undesirable effects in WMS support. For this
simples example I can "manually" remove it but I'm not sure how to deal
with it in other cases. I'll be greatful if you could give me some
light.</font></small><br>
<br>
<br>
<font size="-1"><font face="Verdana">Best regards,</font></font><br>
<div class="moz-signature"><br>
-- <br>
<meta content="text/html; charset=ISO-8859-1" http-equiv="content-type">
<title></title>
<font color="#000000" face="Verdana, Helvetica, Arial" size="1"><font
color="#000000" size="2"><b>José Vilson
de Mello de Farias</b> </font><br>
<font color="#606060"><i><big>Analista de Sistemas<br>
</big></i></font></font><i style="color: rgb(96, 96, 96);"><font
size="-2">SSE - Segurança Pública</font></i><br>
<font color="#000000" face="Verdana, Helvetica, Arial" size="1"><br>
<font color="#000080"><b>DÍGITRO TECNOLOGIA</b></font><br>
<font color="#000000"><b>E-mail:</b> </font><a
href="mailto:[EMAIL PROTECTED]"><font
color="#606060">[EMAIL PROTECTED]</font></a><br>
</font><font color="#000000" face="Verdana, Helvetica, Arial" size="1"><font
color="#000000"><b>Messenger: </b></font></font><font color="#000000"
face="Verdana, Helvetica, Arial" size="1"><a
href="mailto:[EMAIL PROTECTED]"><font
color="#606060">[EMAIL PROTECTED]</font></a></font><br>
<font color="#000000" face="Verdana, Helvetica,
Arial" size="1"><!--<font color = #000000>
<b>ICQ:</b></font>
<font color = #000000> 11866179</font><br>
!--><font
color="#000000"><b></b></font><font color="#000000"><b>Site:</b></font>
<a href="http://www.digitro.com.br%20"><font
color="#000000">www.digitro.com.br</font></a><a
href="http://www.digitro.com.br%20"> </a></font>
</div>
</body>
</html>
--------------080606080700010905000906--