Remember that servlet mapping and action paths are two entirely seperate things. For servlet mappings, *.do/** would be infix, not suffix -- and infix is not allowed. Suffix means, roughly, 'at the end'. In other words, you can either have 'text*' (prefix mapping) or '*text' (suffix mapping). It's one or the other, you can't mix them.

So, to use wildcard action paths with suffix mapping, your mapping would be '*.do', your action would be specified like this

  <action path="/my/action/**" ...

and the URL you would use to access it would look like this

  http://host/app/my/action/some/path.do

The servlet contain matches the entire request URL against your servlet mappings, do it can't match '.../...do/...' because the '.do' is neither at the start of the URL (for prefix mapping) or the end of the URL (for suffix mapping). It's only *after* the contain matches the URL as a whole that it's passed to Struts for matching against your action paths.

So, you either use prefix mapping and have something to match at the start of the URL, or you use suffix mapping and have something to match at the end of the URL.

Like I said, I haven't tried it with suffix mapping, but that's how it would look in theory.

L.

emre akbas wrote:
Again, thank you very much Laurie.

I couldn't understand how ** wildcard mapping could work with suffix mapping
(*.do). I have tried, in web.xml, *.do/** but tomcat said "invalid
url-pattern". If I manage to get ** wilcard mapping work with *.do, I will
be able to correctly process a request like
http://localhost:8080/myapp/server.do/chapter1/1.html

Also, I've tried *.do** , tomcat did accept this but this time, it expected
me to write ** at the end of all URL's. That is, it didn't work as a
wildcard mapping.

And in struts-config.xml, I modified my action as " <action path=/server**
... " but this didn't work either. It seems that ** wildcard mapping is not
possible with *.do suffix mapping. What do you think Laurie?

---------- Forwarded message ----------
From: Laurie Harper <[EMAIL PROTECTED]>
To: user@struts.apache.org
Date: Mon, 26 Sep 2005 14:31:10 -0400
Subject: Re: user Digest 25 Sep 2005 21:39:29 -0000 Issue 6130
emre akbas wrote:

Now, I have another problem. We have written our Struts application using
prefix mappings, i.e "*.do". In order to use DownloadAction with **

mapping,

we should migrate to suffix mapping, i.e. "/do/*" . Is there an easy way

of

migrating a whole Struts application from prefix mapping to suffix

mapping?

Or, is it possible that both mappings exists in web.xml ? (Sorry, if these
are weird questions.)


[Note: '*.do' is a suffix, /do/* is a prefix (pre- -> previous); just to
reduce any confusion for people following along ;-)]

Actually, I think wildcard mappings *should* work with suffix mapping
too, though I've never tried it. But you can define both types of
mapping in web.xml, so long as you pick a prefix your application
doesn't already use. In other words, as long as you don't already have
linkes that start /do/... then adding a /do/* mapping is fine.

Migrating your whole app from one mapping style to the other wouldn't be
super hard -- just find anywhere you have an explicit .do and update
appropriately. However, I wouldn't recommend trying that if this is the
only driver. If what you have works, keep it ;-)

L.



---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to