java - How to GET and POST requests separately with HttpRequestHandler -


i'm using httprequesthandler inject spring beans servlets:

@component("myservlet") public class myservlet implements httprequesthandler {      @autowired     private myservice myservice; 

httpservlet has separate methods doget, dopost etc different request methods. httprequesthandler has one:

    public void handlerequest (httpservletrequest req, httpservletresponse resp) 

so how handle , post requests in method separately? need have different logic different request methods.

update: have question: there possibility restrict handlerequest method support post requests configuration , sendhttp error 405 automatically other requests?

the httpservletrequest provides method getmethod()

returns name of http method request made, example, get, post, or put. same value of cgi variable request_method.


Comments

Popular posts from this blog

curl - PHP fsockopen help required -

HTTP/1.0 407 Proxy Authentication Required PHP -

c# - Resource not found error -