Win a copy of The Little Book of Impediments (e-book only) this week in the Agile and Other Processes forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

HFS p680 Filters

 
Roger Yates
Ranch Hand
Posts: 118
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Is it valid to use <servlet-name> in this way?:
<filter-mapping>
<filter-name>Filter4</filter-name>
<servlet-name>/Recipes/Modify/ModRecipes.do</servlet-name>
</filter-mapping>



... and if so, which servlet is used? (one with the name "/Recipes/Modify/ModRecipes.do"?)
... and what url-pattern would it filter on?
Would all requests go to it, or just those specified in a servlet-mapping it might have?

I think the filter-mapping in HFS p680 above is wrong.

Did the authors in fact mean something like this?:
<filter-mapping>
<filter-name>Filter4</filter-name>
<servlet-name>MyServlet</servlet-name>
</filter-mapping>

<servlet>
<servlet-name>MyServlet</servlet-name>
<servlet-class>foo.MyFilterClass</servlet-class>
</servlet>

<servlet-mapping>
<servlet-name>MyServlet</servlet-name>
<url-pattern>/Recipes/Modify/ModRecipes.do</url-pattern>
</servlet-mapping>


Bert/Kathy/Bryan/anyone - is this valid?!
[ October 21, 2004: Message edited by: Roger Yates ]
 
Bert Bates
author
Sheriff
Posts: 8905
5
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Roger -

In the last thread when you mention "the author's shorthand" you were right :roll:

We will make this more explicit in the next printing, but to save space on the page we did in fact take a shortcut...

If you assume that in the <servlet-mapping> elements the values for <servlet-name> and <url-pattern> are the same, would that make more sense?

Thanks,

Bert
 
Roger Yates
Ranch Hand
Posts: 118
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Yes, it would, but maybe clearer to use a more "normal" servlet-name so as not to confuse readers on their first time through.

It was only after answering Romy's query that I took a second look at the xml and it struck me that something wasn't quite right...
I can understand why you did it, and pleased to be reassured that I hadn't missed some deep, dark secret way of mapping filters and servlets.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic