3
I’m using a class inherited from Filter in Java to do login control.
I did the mapping on Web.xml as follows:
<filter>
<filter-name>ValidacaoLoginFilter</filter-name>
<filter-class>br.com.dgtbr.configuracao.ValidacaoLoginFilter</filter-class>
</filter>
<filter-mapping>
<filter-name>ValidacaoLoginFilter</filter-name>
<url-pattern>/sistema/*</url-pattern>
</filter-mapping>
My problem is I just want the pages .JSP fall into the filter, but I cannot place the url-pattern as follows:
.....
<filter-mapping>
<filter-name>ValidacaoLoginFilter</filter-name>
<url-pattern>/sistema/*.jsp</url-pattern>
</filter-mapping>
The following error occurs:
Deployment is in Progress...
deploy? config=file%3A%2FC%3A%2FUsers%2FLeonardo%2FAppData%2FLocal%2FTemp%2Fcontext4308821743855259488.xml&path=/Dgtbr.
FAIL - Deployed application at context path ... but context failed to start
......nbproject build-impl.xml:1163: The module has not been deployed.
Check the server log for more details.
In short, inside the folder /sistema/ I have another folder that nay I want you to go through Filter.
the mapping part in another folder worked. But keep looking on the net and I found the way to handle it manually in Filter itself. I thought it was nice and helpful. Follow the link http://stackoverflow.com/questions/3125296/can-i-exclude-some-concrete-urls-from-url-pattern-inside-filter-mapping. E thanks for the help. Tks.
– lionbtt
@lionbtt This link is an implementation of workaround proposed in the answer. But instead of using the method
endsWithto check the extension instead of the path it usesstartsWithto check the folder.– utluiz