What does post.getResponseBodyAsString() produce?

Oleg

-----Original Message-----
From: joseph mercado [mailto:[EMAIL PROTECTED]
Sent: Wednesday, August 18, 2004 11:56 AM
To: Commons HttpClient Project
Subject: RE: Response content length is not known


i fully understand what you had said. But my question
is when i try to post data using a browser (ie) i got
the last page shown on my browser? is there some thing
i miss?

below is the snipplet where i post :

for(int x = 0; x < param.size(); x++){
                                        Vector form = (Vector) param.elementAt(x); //
this holds nodeName and nodeValue
                                        //System.out.println(form.size());
                                
                                        //lets post to the first url
                        
URL="https://ereg.bir.gov.ph/ereg/"+url[x].toString();
                        
//URL="http://203.215.79.212/reg-dir/"+url[x].toString();
                                        System.out.println(URL);
                                        post = new PostMethod(URL);
                                
                                        // assemble the nvpair parameter to be posted
                                        for(int i=0;i < form.size(); i++){
                                                String[] array =
form.elementAt(i).toString().split(",");
                                                post.addParameter(array[0],array[1]);
                                        }

                                        //once post data is assembled in a nvpair 
format
lets post it
                                        client.executeMethod(post);
                                
                                        //now lets get the HTTP status code and the
responseBody
                                        if(post.getStatusCode() == HttpStatus.SC_OK){
//HTTP 200
                                                //we only want to get the reposnsebody 
of the
last page
                                                if(x == 7 || x == 6){ //6 is confirm 
page while
7 is the message page
                                        
System.out.println(post.getResponseBodyAsString());
                                                }
                                                //then we continue posting to the next 
page
                                                continue;
                                        }else{
                                                //get the http status and close 
connection
                                                System.out.println("Unexpected 
failure: "
+post.getStatusLine().toString());
                                                post.releaseConnection();
                                         
                                                //roll back msg to mq
                                                ctx.setRollbackOnly();
                                                break;
                                        }




--- "Kalnichevski, Oleg"
<[EMAIL PROTECTED]> wrote:

>
> Joseph,
>
> Here's the response sent by the server
>
> << "HTTP/1.0 200 OK[\r][\n]"
> << "Date: Thu, 19 Aug 2004 02:01:34 GMT[\r][\n]"
> << "Server: Oracle9iAS (9.0.3.0.0) Containers for
> J2EE[\r][\n]"
> << "Content-Type: text/html[\r][\n]"
>
> As you can see the response does not contain a
> 'content-length' header which is mandatory for the
> 200 (OK) response, hence the warning
>
> <RFC1945>
>
> 7.2 Entity Body
>
> ...
>
> For response messages, ... [a]ll 1xx
> (informational), 204 (no content), and 304 (not
> modified) responses must not include a body. All
> other responses must include an entity body or a
> Content-Length header field defined with a value of
> zero (0).
>
> </RFC1945>
>
> I hope this clarifies things a little. As a
> work-around you may want to set HttpClient's log
> verbosity to ERROR. For a real fix do consider
> reporting this problem to Oracle
>
> Oleg
>
>




        
__________________________________
Do you Yahoo!?
New and Improved Yahoo! Mail - 100MB free storage!
http://promotions.yahoo.com/new_mail

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]


***************************************************************************************************
The information in this email is confidential and may be legally privileged.  Access 
to this email by anyone other than the intended addressee is unauthorized.  If you are 
not the intended recipient of this message, any review, disclosure, copying, 
distribution, retention, or any action taken or omitted to be taken in reliance on it 
is prohibited and may be unlawful.  If you are not the intended recipient, please 
reply to or forward a copy of this message to the sender and delete the message, any 
attachments, and any copies thereof from your system.
***************************************************************************************************

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to