• Post Reply Bookmark Topic Watch Topic
  • New Topic

imort & servlet filter

 
Marko Tekavc
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I have a servlet filter which doesn't get invoked when I use jst import tag with relative path. My filter mapping is:

On the other side I'm using jstl import tag in simple JSP file:

If i change import tag to use absolute path

filter works fine.

Can I fix this so that filter will work also with relative path?
 
David Newton
Author
Rancher
Posts: 12617
IntelliJ IDE Ruby
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I don't recall how <c:import> does its work, but you probably have to set the filter to be invoked on forwards and requests and the very least. (I think they're set for just requests by default, but that's probably container-specific.)
 
Bear Bibeault
Author and ninkuma
Marshal
Posts: 65524
105
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
When using the relative path, an include will be employed.
 
Marko Tekavc
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thank you. That was helpful. I’ve added INCLUDE as dispatcher type on filter and now filter is invoked.

But now I have another problem.

In filter I need the path of the file that was included. Is it possible to get that path somehow (maybe from HTTPRequest Object)?
I’ve tried getRequestURL() method but this method returns the path to the page that contains include statement.
 
David Newton
Author
Rancher
Posts: 12617
IntelliJ IDE Ruby
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Why do you need that? That sounds a little sketchy to me.
 
Bear Bibeault
Author and ninkuma
Marshal
Posts: 65524
105
IntelliJ IDE Java jQuery Mac Mac OS X
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!