• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Tim Cooke
  • Liutauras Vilda
  • Jeanne Boyarsky
  • paul wheaton
Sheriffs:
  • Ron McLeod
  • Devaka Cooray
  • Henry Wong
Saloon Keepers:
  • Tim Holloway
  • Stephan van Hulst
  • Carey Brown
  • Tim Moores
  • Mikalai Zaikin
Bartenders:
  • Frits Walraven

Http POST and GET Request on a single connection

 
Greenhorn
Posts: 19
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
 
ranger
Posts: 17347
11
Mac IntelliJ IDE Spring
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
 
Ranch Hand
Posts: 165
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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).
 
Let nothing stop you! Not even this tiny ad:
Gift giving made easy with the permaculture playing cards
https://coderanch.com/t/777758/Gift-giving-easy-permaculture-playing
reply
    Bookmark Topic Watch Topic
  • New Topic