• 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
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

HTTP POST

 
Ranch Hand
Posts: 37
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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?
 
Java Cowboy
Posts: 16084
88
Android Scala IntelliJ IDE Spring Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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.
 
Ranch Hand
Posts: 212
Eclipse IDE Spring Ubuntu
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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.
 
Rancher
Posts: 5008
38
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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?
 
Sheriff
Posts: 67746
173
Mac Mac OS X IntelliJ IDE jQuery TypeScript Java iOS
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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.
 
Rancher
Posts: 4803
7
Mac OS X VI Editor Linux
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
Sheriff
Posts: 67746
173
Mac Mac OS X IntelliJ IDE jQuery TypeScript Java iOS
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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: 4803
7
Mac OS X VI Editor Linux
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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"
reply
    Bookmark Topic Watch Topic
  • New Topic