This week's book giveaway is in the Jython/Python forum.
We're giving away four copies of Murach's Python Programming and have Michael Urban and Joel Murach on-line!
See this thread for details.
Win a copy of Murach's Python Programming this week in the Jython/Python forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

HTTP POST  RSS feed

 
Chandraprabha Rajput
Ranch Hand
Posts: 37
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Question is:
Is the below statement is correct
While using HTTP POST method, the requested target resource must be an active resource like Servlets or JSP.

accorind to me this is not correct but in java beat question dump it is given that this is correct.

Can any one explain me why?
 
Jesper de Jong
Java Cowboy
Sheriff
Posts: 15861
81
Android IntelliJ IDE Java Scala Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
When you send data to server, for example when you POST the contents of a form, then there must be some logic on the server to process the data that you are sending with the POST method. When you're POSTing to a passive document (something that doesn't contain any logic), then there's nothing to handle the data. There must be an "active resource" such as a servlet, JSP, CGI script, ASP page or something else that can handle the data.
 
sudhir nim
Ranch Hand
Posts: 212
Eclipse IDE Spring Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Because there is no benefit of sending the information to the server, if there is no logic to process that information.
 
Norm Radder
Rancher
Posts: 1733
22
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Not sure I understand why POST is different from GET in this case.
Are you saying that if the action in a <FORM is POST then there must be a CGI of some kind, but if the action is GET, there is NOT a requirement for a CGI?
 
Bear Bibeault
Author and ninkuma
Marshal
Posts: 65826
134
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
In a POST the data is passed in the request body. Without an active resource, there is no way to fetch it. In a GET, where any data is part of the query string, the data can be parsed by JavaScript (though that's not generally done).

The point is, it's meaningless to POST data to a non-active resource because there's no way to get and process the posted data.
 
Pat Farrell
Rancher
Posts: 4678
7
Linux Mac OS X VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Originally posted by Chandraprabha Rajput:
While using HTTP POST method, the requested target resource must be an active resource like Servlets or JSP.


or perl script, php program, etc.
You need something to generate the response, a POST is not used to GET something static
 
Bear Bibeault
Author and ninkuma
Marshal
Posts: 65826
134
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Originally posted by Pat Farrell:
You need something to generate the response ...

Which should not be construed to mean that static resources do not generate responses. All requests result in a response. However, a static resource is itself returned as the response, rather than a dynamic resource which executes to generate the response.
 
Pat Farrell
Rancher
Posts: 4678
7
Linux Mac OS X VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Right, the semantics of GET are simple, get something.
And POST writes something.

The trivial result of a GET is the thing that is gotten.

A POST doesn't have a clear trivial response, but by convention, you usually send back at least a page that says "got it"
 
It is sorta covered in the JavaRanch Style Guide.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!