hi

will reading the inputstream directly without using "getHeader(String
headerName)" return the headers also?
regards
Anup

At 12:15 PM 7/19/00 -0600, you wrote:
>On the surface your code looks correct, so I am not sure what the problem is.
>You could try the following code which has worked for me:
>
>    res.setContentType("text/html");
>    PrintWriter out = res.getWriter();
>
>    ServletInputStream in = req.getInputStream();
>    byte[] b = new byte[8192];
>    ByteArrayOutputStream baos = new ByteArrayOutputStream(8192);
>
>    out.println("<html><body><pre>");
>
>    while (in.readLine(b, 0, 8192) != -1) {
>      baos.write(b, 0, 8192);
>      out.println(baos.toString());
>    }
>
>    out.println("</pre></body></html>");
>
>K Mukhar
>
>Andy Mayer wrote:
>>
>> Hi all,
>>
>> I am unsuccessfully trying to display the "raw" HTTP header that gets sent
>> to my server.
>> I have written the code below, but the BufferedReader returns no data at
>> all. In fact
>> the print statement displays "Ready: false" indicating there is no data. I
>> am running the
>> servlet on Oracle Application Server.
>>
>> All ideas welcome, as I desperately need this to work to troubleshoot a WAP
>> gateway.
>>
>> Regards,
>>
>> Andy
>> ---
>> www.andymayer.com
>>
>> public class Header extends HttpServlet {
>>
>> public void service ( HttpServletRequest request, HttpServletResponse
>> response)
>> throws ServletException, IOException {
>>
>>      response.setContentType("text/html");
>>     PrintWriter out = response.getWriter();
>>
>>     ServletInputStream inStream = request.getInputStream();
>>     InputStreamReader inputStreamReader = new InputStreamReader(inStream);
>>     out.println("Ready : "+inputStreamReader.ready());
>>
>>     BufferedReader in = new BufferedReader(inputStreamReader);
>>
>>     String inputLine;
>>     while ((inputLine = in.readLine()) != null) {
>>          out.println(inputLine);
>> }
>
>___________________________________________________________________________
>To unsubscribe, send email to [EMAIL PROTECTED] and include in the body
>of the message "signoff SERVLET-INTEREST".
>
>Archives: http://archives.java.sun.com/archives/servlet-interest.html
>Resources: http://java.sun.com/products/servlet/external-resources.html
>LISTSERV Help: http://www.lsoft.com/manuals/user/user.html
>

___________________________________________________________________________
To unsubscribe, send email to [EMAIL PROTECTED] and include in the body
of the message "signoff SERVLET-INTEREST".

Archives: http://archives.java.sun.com/archives/servlet-interest.html
Resources: http://java.sun.com/products/servlet/external-resources.html
LISTSERV Help: http://www.lsoft.com/manuals/user/user.html

Reply via email to