Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Ability to exclude HandlerInterceptor from specific path with <mvc:interceptor> [SPR-6570] #11236

Closed
spring-projects-issues opened this issue Dec 16, 2009 · 8 comments
Assignees
Labels
has: votes-jira Issues migrated from JIRA with more than 10 votes at the time of import type: enhancement A general enhancement
Milestone

Comments

@spring-projects-issues
Copy link
Collaborator

spring-projects-issues commented Dec 16, 2009

R. A. opened SPR-6570 and commented

mvc:interceptor should have a path parameter to exclude path from intercepting. For example: Interceptor runs for all paths /* , but it must not intercept specified paths: /admin/ *. /image/ * and /styles/ *


Affects: 3.0 GA

Issue Links:

Referenced from: commits 92759ed

24 votes, 25 watchers

@spring-projects-issues
Copy link
Collaborator Author

R. A. commented

In my app case I don't know how to restrict interceptor to a path, because it has to load a menu for every webpage, except "/admin/" pages , "/image/..." and some other url's, so menuInterceptor itself has to filter request paths for strings like "/admin" or "/image" and cancel if finds.

 
<mvc:interceptors>
  <mvc:interceptor>   	
    <mvc:mapping ignorepath="/admin/*" />
    <mvc:mapping ignorepath="/image/* " />
    <bean name="menuInterceptor" class="MenuInterceptor" />
  </mvc:interceptor>      
</mvc:interceptors>

Excluding some paths from intercepting seems like no less likely case than asigning them to certain paths.

@spring-projects-issues
Copy link
Collaborator Author

Ashish Jain commented

Going through, 3.0 reference, this provides a way, to apply to certain mappings.

<mvc:interceptors>
    <mvc:interceptor>
        <mvc:mapping path="/secure/*"/>
        <bean class="org.example.SecurityInterceptor" />
    </mvc:interceptor>
</mvc:interceptors>

@spring-projects-issues
Copy link
Collaborator Author

Ken McCracken commented

I agree with R.A.'s sentiment, path exclusion should be a first-class/standard feature of mapping.

@spring-projects-issues
Copy link
Collaborator Author

Jason Sheedy commented

Agreed .. I've wasted a lot of time trying to exclude paths. This would be a REALLY helpful feature.

@spring-projects-issues
Copy link
Collaborator Author

Carlo Sciolla commented

Not having exclusion patterns makes it quite cumbersome to use the mvc:interceptors syntax in bigger applications, please consider fixing this issue (which has started aging)

@spring-projects-issues
Copy link
Collaborator Author

Rossen Stoyanchev commented

I've added an <mvc:exclude-pattern path="/adimin/**"> to the MVC namespace as well as an equivalent option to the MVC Java config.

@spring-projects-issues
Copy link
Collaborator Author

Japan Trivedi commented

Perfect (y). This is what I was looking for. Thanks. :)

@spring-projects-issues
Copy link
Collaborator Author

Adrian Ber commented

I think the same should be implemented for <mvc:interceptors> too.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
has: votes-jira Issues migrated from JIRA with more than 10 votes at the time of import type: enhancement A general enhancement
Projects
None yet
Development

No branches or pull requests

2 participants