Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Spring mvc:mapping path rules

I need to map interceptor for all methods in annotated controller with @RequestMapping(value = "/client")

In mapping I have

<mvc:interceptor>
   <mvc:mapping path="/app/client/*"/>
   <bean class="com.cci.isa.web.CIPClientHandleInterceptor" />
</mvc:interceptor>

This interceptor called perfectly for urls like:
1. http://host/app/client/clientUpdateForm?clientId=305

But doesn't called for urls like:
2. http://host/app/client/clientUpdateForm/clientId_305 (with slash after method name)

How get it called for second variant?

Thanks a lot.

like image 723
atovstonog Avatar asked Aug 02 '11 19:08

atovstonog


3 Answers

This question is too old, but maybe this helps somebody.

You should try removing /app, I think it's not necessary and perhaps this is causing the problem.

<mvc:mapping path="/client/**"/>
like image 78
jelies Avatar answered Dec 30 '22 17:12

jelies


I think this will achieve what you would like:

<mvc:mapping path="/app/client/**/*"/>

The '/**' suggests any number of directories. When this is used in conjunction with '/*', you have something that looks at an arbitrary folder depth, with an arbitrary file name.

like image 24
nicholas.hauschild Avatar answered Dec 30 '22 17:12

nicholas.hauschild


If your controller with

@RequestMapping(value = "/client")

Try

<mvc:mapping path="/client**"/>
like image 22
Khanh Tran Avatar answered Dec 30 '22 18:12

Khanh Tran