Win a copy of Java 9 Revealed this week in the Features new in Java 9 forum!
    Bookmark Topic Watch Topic
  • New Topic

Printing out HTTP POST request headers and Content from servlet  RSS feed

 
Sanjay Ra
Ranch Hand
Posts: 31
  • Mark post as helpful
  • send pies
  • Report post to moderator
Hi ,

I would like to a sample piece of servlet code which handles a HTTP Post and prints the header and content of the request.

thanks
Sanjay
 
Jeroen Wenting
Ranch Hand
Posts: 5093
  • Mark post as helpful
  • send pies
  • Report post to moderator
It's easy to do if you just make the effort of checking out the API docs.
I suggest you do that and try for yourself, it will take no more than a few minutes yet be educational.
 
Fisher Daniel
Ranch Hand
Posts: 582
  • Mark post as helpful
  • send pies
  • Report post to moderator
Hi,
You can try like this...



For what you want, you can check on Servlet API...

Correct me if I am wrong
Hope this help

daniel
 
Sanjay Ra
Ranch Hand
Posts: 31
  • Mark post as helpful
  • send pies
  • Report post to moderator
thanks!
 
Paul Bourdeaux
Ranch Hand
Posts: 783
  • Mark post as helpful
  • send pies
  • Report post to moderator
Sanjay,

You should still look at the APIs, or even invest in a book (there are plenty of good books listed here on JavaRanch). After all, Daniel's code works very well, but a good developer also understands what it is actually doing. (I.e. who is calling the service method, what other information/objects you can get from the request object, what the request object actually is...)
 
Deepak Kumar Aggarwal
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
  • Report post to moderator
Hi Sanjay,

Did you get the servlet code to print the post request on html page?
 
Ron McLeod
Saloon Keeper
Posts: 1456
209
Android Angular Framework Eclipse IDE Java Linux MySQL Database Redhat TypeScript
  • Mark post as helpful
  • send pies
  • Report post to moderator
Deepak - you may not have noticed that this topic is over 11 years old and Sanjay has not posted anything for 10 years - unlikely he will reply.

Are you haing a similar problem?
 
Bear Bibeault
Author and ninkuma
Marshal
Posts: 65891
135
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Report post to moderator
I'm closing this topic so the member can start a new topic with more information.
 
Don't get me started about those stupid light bulbs.
    Bookmark Topic Watch Topic
  • New Topic
Boost this thread!