• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Http POST and GET Request on a single connection

 
Maddi Ranjan
Greenhorn
Posts: 19
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi All,

Can any body help me how i send request by HTTP Post fist and then HTTP GET on a single http connection connection.

Actually I want to send a requst by http post then according to the response of this message again I want to send another request but in http get method. Please any one help me as soon as posible, its very help ful if provide code by some one.

Regards
Maddi
 
Mark Spritzler
ranger
Sheriff
Posts: 17278
6
IntelliJ IDE Mac Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Well, this appears to me like a design issue going on. Are you using the same Servlet for the get and the post? Why not have two different Servlets, on that only uses the post. So you can do your request and response. Then call Connector.open(String url) with the url of the other Servlet to send a get.

Mark
 
Pawel Veselov
Ranch Hand
Posts: 165
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
HTTP Connections are reusable. If the 'Connection:keep-alive' header is set,
server will not close the connection after returning the request (if compliant).

However, it doesn't look like in MIDP (nor, IMHO, J2SE), you can create a HTTP Connection object that can be reused. So it looks like you have to have your own HTTP connection object implemented to achieve what you need. If you don't expect fancy headrs, like continuation, and redirections, this may be somewhat easy to do, however, parsing the chunked data streams is somewhat cumbersome. The idea would be to have a connection pool (like MIDP does), but don't remove the connections when a response is completely read (like MIDP does too).
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic