When to use GET vs POST


There are two common types of HTTP request methods, GET and POST.  GET is the default method.  The GET method places request parameters in the URL string, POST does not.  GET should not be used when sending sensitive information such as a password or financial things. GET also should not be used when the parameters are over 4KB. So why use GET? It is a little faster and it allows users to bookmark pages with the URL parameters intact.

In general, GET requests should be idempotent.  Each request should not change the state of the server.  Post requests are to be used for submitting data that could potentially persist on the server.

I found this info in Murach’s Java Servlets and JSP book.

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s