No there is no such configuration in deployment descriptor, you can use code to determine request type
httpRequest.getMethod();
문제
Recently I'm developing an app in which we need to filter just specific type of requests. For example only GET or POST. It is easy to check type in code and simply forward to the next filter in doFilter
method, but I wonder if there is some way to define it in the web.xml file? For example something like:
<filter>
<filter-name>SomeFilter</filter-name>
<filter-class>org.src.SomeFilter</filter-class>
<filter-type>POST</filter-type> <<<<< this
</filter>
<filter-mapping>
<filter-name>SomeFilter</filter-name>
<url-pattern>/*</url-pattern>
</filter-mapping>
해결책
No there is no such configuration in deployment descriptor, you can use code to determine request type
httpRequest.getMethod();
다른 팁
I think there is no such thing to configure in web.xml.But you can use getMethod()
method of ServletRequest
object in Your filter class and design your logic there in doFilter() method.