• 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
  • paul wheaton
  • Paul Clapham
  • Ron McLeod
Sheriffs:
  • Jeanne Boyarsky
  • Liutauras Vilda
Saloon Keepers:
  • Tim Holloway
  • Carey Brown
  • Roland Mueller
  • Piet Souris
Bartenders:

HTTP POST

 
Greenhorn
Posts: 8
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I have a servlet which only accepts multipart form-data and data via post only....i need to write a client (JAVA CODE only) to call the servlet by passing multiple pairs of info ex : nam=name, password=pass , i am getting a boundary exception any help
 
Desperado
Posts: 3226
5
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I personally would need more information to reply intelligently.
I assume that you have your code in doPost(), right?
 
Greenhorn
Posts: 15
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I think his solution would be to take a look at the HTTP protocol RFC. You want a client written in Java to hit the servlet and get data back. If I understand properly, you want to POST to a servlet without a web browser but with Java code.
By checking out the RFC you can check what needs to be sent as a standard HTTP request to a server and how the POST should look like when being sent. Also, if you google, or maybe native Java libraries include classes that write requests and POST data for you.
Another solution is if *YOU* have access to the servlet your trying to hit, you can define the doGet method to call the doPost method, and then you can just send a request within Java with your name/value pairs in the querystring.
Good luck!
 
Author and all-around good cowpoke
Posts: 13078
6
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
The java.net.HttpURLConnection class has the methods you need to set the type of connection from the client to POST, set headers etc.
Bill
 
reply
    Bookmark Topic Watch Topic
  • New Topic