"Craig R. McClanahan" wrote:
> No ... and (this time at least) not because of lack of time.  It is not at
> all obvious how to rig path mapping to the controller to work together
> with the basic assumption of sub-applications that there is a prefix for
> that subapp.  All I can think of is requiring you to map the controller
> once per subapp, which is both ugly and will require a bunch of changes to
> the existing code that assumes there is only one mapping to the controller
> servlet.
> 
> Ideas, anyone?

It looks like we need to call both getServletPath and getPathInfo, and
then subtract the servlet-mapping. 

Here's what the HttpRequest is willing to tell us: 

  <servlet-mapping>
    <servlet-name>action</servlet-name>
    <url-pattern>/do/*</url-pattern>
  </servlet-mapping>

action: ** PATH INFO:
action: /find/Last
action: ** PATH TRANS:
action: D:\public\tomcat\webapps\artimus\find\Last
action: ** QUERY STRING:
action: null
action: ** REQUEST URI:
action: /artimus/do/find/Last
action: ** SERVLET PATH:
action: /do


  <servlet-mapping>
    <servlet-name>action</servlet-name>
    <url-pattern>*.do</url-pattern>
  </servlet-mapping>

 action: ** PATH INFO:
 action: null
 action: ** PATH TRANS:
 action: null
 action: ** QUERY STRING:
 action: null
 action: ** REQUEST URI:
 action: /artimus/find/Last.do
 action: ** SERVLET PATH:
 action: /find/Last.do


If you do this 

servletPath + pathInfo

you get 

/do/find/Last

and 

/find/Last.do

respectively. 

So then we just need to mask the prefix (/do/*) or suffix (*.do) to get 

/find/Last

in either case. 

I believe this will make 

/do/module1/action

and 

/module1/action.do 

equivalent under 1.1 as it is under 1.0.


If this sounds reasonable, I'll give it a try. 

In 1.0, there was also a place in html:form that assumed extension
mapping and so prevented using extensions under prefix mapping. If the
rest works out, I'd check on that too. 


-- Ted Husted, Husted dot Com, Fairport NY US
-- Developing Java Web Applications with Struts
-- Tel: +1 585 737-3463
-- Web: http://husted.com/about/services

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

Reply via email to