Ulf Dittmer wrote:It likely violates the HTTP specification, and will get you into trouble with HTTP handling components that treat them differently.
Actually, in
JEE, an incoming request invokes the HttpServlet service() method, which looks at the the request type, and invokes doGet() if it's a GET and doPost() if it's a POST.
The actual parameters are normalized, so if you make doGet and doPost invoke a common method, you're OK as long as it doesn't attempt to reference resources not appropriate for the request type.
On the other hand, it really isn't a good practice overall. Too much chance that as time goes by someone will start adding request-type specific conditionals into the common method.
One reason why I might combine the two would be something where I'd be doing a "ping" request as a GET with limited parameters, but a POST for a full-function operation or one that had the potential for extended-length parameters. But on the whole, it would be better to have separate handlers for stuff like that.
The secret of how to be miserable is to constantly expect things are going to happen the way that they are "supposed" to happen.
You can have faith, which carries the understanding that you may be disappointed. Then there's being a willfully-blind idiot, which virtually guarantees it.