Skip to content

Filter will not called when Controller is annotated with @API #83

@derlinuxer

Description

@derlinuxer

My custom filter will not be called when Controller is annotated with @Api.
Based on your current example it is reproduceable with following code.

package com.knappsack.swagger4springweb.controllers;
import java.lang.reflect.Method;
import com.knappsack.swagger4springweb.filter.Filter;

public class TestFilter implements Filter{
    private static final Logger LOGGER = LoggerFactory.getLogger(TestFilter.class);
    @Override
    public boolean isApplicable(Method method) {
        LOGGER.debug("### MethodName isApplicable: " + method.getName());
        return true;
    }
    @Override
    public boolean ignore(Method method) {
        LOGGER.debug("### MethodName ignore: " + method.getName());
        return false;
    }
}
public class ExampleDocumentationController extends ApiDocumentationController {

    public ExampleDocumentationController() {
        ....
        List<Filter> filters = new ArrayList<Filter>();
        filters.add(new TestFilter());
        setFilters(filters);
        ....
}

Only the methods of User & Category Controller can be handled by the filter. Removing @Api the other controller also call the Filter Inteface.
Is that works as designed a bug or a mistake of me.

thanks

stephan

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions