How to check for an OPTIONS method call in a java servlet filter?
I have a servlet filter, in which if the call is OPTIONS method call, then a specific set of task needs to be done.
Is there a way I can check my custom filter , which as of now , extends javax.servlet.filter, if an incoming http request is a request开发者_运维百科 for an OPTIONS call??
Thanks
PS:Im using jetty as my app server.
getMethod
in HttpServletRequest is maybe what you need: http://download.oracle.com/javaee/6/api/javax/servlet/http/HttpServletRequest.html#getMethod()
It should return OPTIONS
in case of an OPTIONS
request.
You must implement doOptions()
method.
精彩评论