java - Break servlet-filter work -
i have securityauthorisationfilter
, following part of code:
for(string anonymousrequesturi : anonymousrequesturis) { if(httprequest.getrequesturi().equals(anonymousrequesturi)) { //allow request } } string authtoken = gettokenfromrequest(httprequest);
if equals true need skip next filter operations , send request controller. but, if write filterchain.dofilter(servletrequest, servletresponse)
, there no result. filter continue operations find token. how can break out of filter?
as understand comment, wish "break out" of current filter if condition anonymous request uri true. return;
after calling chain.dofilter()
:
for ( string uri : anonuris ) { if ( ... ) { chain.dofilter( ... ); return; } } string authtoken = gettokenfromrequest( httprequest ); ...
cheers,
Comments
Post a Comment