Why Filter does't work?

I want to write a plugin with servlet filter to process upload data.
The filter class is below and only for testing:
public class UploadFilter implements Filter {
FilterConfig initFilterConfig = null;
public void init(FilterConfig filterConfig) throws ServletException {
initFilterConfig = filterConfig;

public void doFilter(ServletRequest servletRequest, ServletResponse servletResponse, FilterChain filterChain) throws IOException, ServletException {
    HttpServletResponse httpResponse = (HttpServletResponse) servletResponse;
    httpResponse.sendError(401, "Not Auth!");

public void destroy() {
    initFilterConfig = null;


the config file is :slight_smile:

${project.description} ${project.version} images/pluginIcon.png images/pluginLogo.png
<!-- add our i18n resource -->
<resource type="i18n" name="i18n" location="encrypt"/>

<!-- add our web resources -->
<servlet-filter name="Uploadfile  decrypt file Servlet Filter" key="uploadfile-decrypt" class="com.hisense.filter.UploadFilter" system="false" location="before-dispatch" weight="100">

when I request localhost:8090/hello ,the response is not 401 error. this means the filter does’t work.
Is my setting error? anyone can help me.


Not sure which product you are using but give it a try with localhost:8090/confluence/hello for Confluence or localhost:8090/jira/hello for Jira.


The root cause is that two javax.servlet.filter version conflict.Thanks