You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@struts.apache.org by Andre Beskrowni <be...@hotmail.com> on 2002/04/12 19:23:04 UTC

Problems with multi-app config

i'm trying to get this feature to work, and i'm basically using past 
discussions from this group as documentation since i couldn't find any on 
the website.

from what i understand, using multiple struts config files seems pretty 
damned simple.  basically, if i wanted to use a struts config for a 
sub-application named "subapp", i would create a struts-config-subapp.xml 
and configure it as i would any normal struts config file, and i would add 
the following lines to the web.xml in the struts servlet definition:
  <init-param>
    <param-name>config/subapp</param-name>
    <param-value>/WEB-INF/struts-config-subapp.xml</param-value>
  </init-param>

now, to access any actions in struts-config-subapp.xml, i just need to 
prefix those action calls with "subapp".  so.... if i have the "/actions" 
mapped to struts as follows:
  <servlet-mapping>
    <servlet-name>action</servlet-name>
    <url-pattern>/actions/*</url-pattern>
  </servlet-mapping>

i would invoke an action from struts-config-subapp.xml as:

/actions/subapp/<action-mapping-name>

this is pretty straightforward, right?  well i can't get it to work, and i 
think i know why.

the configuration appears to be correctly parsed with the servlet init's.  
my problem is invoking actions in anything other than the main struts-config 
file.

ok, the first thing that touches my requests is ActionServlet, which hands 
of the request to it's process() method.  ActionServlet.process() infers 
which ApplicationConfig to use, and then uses the appropriate 
RequestProcessor.  however, in my case, the appropriate RequestProcessor is 
never found because RequestUtils.selectApplication() isn't finding the 
correct ApplicationConfig.  the problem is the first line of 
RequestUtils.selectApplication(request, context):

  String matchPath = request.getServletPath();

this always returns "/actions" (which doesn't map to any of the keys for any 
of the application configs), and i think what it's supposed to return is 
"/subapp".  if i didn't have more faith in y'all, i'd say i just found a 
bug, but instead i'm assuming that i've made some sort of mistake in my 
understanding.  (there's also the fact that this functionality appears to 
have been in use by others for quite sometime --- also an indication that 
i'm just an idiot.)

anyway, can someone either set me straight or back me up here?  i've gone as 
far as i can go on my own.

thanks,

ab




_________________________________________________________________
MSN Photos is the easiest way to share and print your photos: 
http://photos.msn.com/support/worldwide.aspx


--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>


Re: Problems with multi-app config

Posted by Martin Cooper <ma...@tumbleweed.com>.
What you've found is a known limitation. If you are using the multi-app
features, you must use extension mapping - path mapping is not supported.
Change your servlet mapping to use extension mapping, and everything should
just work. (Path mapping will be supported when someone can figure out how
to make it work. :)

--
Martin Cooper


----- Original Message -----
From: "Andre Beskrowni" <be...@hotmail.com>
To: <st...@jakarta.apache.org>
Sent: Friday, April 12, 2002 10:23 AM
Subject: Problems with multi-app config


> i'm trying to get this feature to work, and i'm basically using past
> discussions from this group as documentation since i couldn't find any on
> the website.
>
> from what i understand, using multiple struts config files seems pretty
> damned simple.  basically, if i wanted to use a struts config for a
> sub-application named "subapp", i would create a struts-config-subapp.xml
> and configure it as i would any normal struts config file, and i would add
> the following lines to the web.xml in the struts servlet definition:
>   <init-param>
>     <param-name>config/subapp</param-name>
>     <param-value>/WEB-INF/struts-config-subapp.xml</param-value>
>   </init-param>
>
> now, to access any actions in struts-config-subapp.xml, i just need to
> prefix those action calls with "subapp".  so.... if i have the "/actions"
> mapped to struts as follows:
>   <servlet-mapping>
>     <servlet-name>action</servlet-name>
>     <url-pattern>/actions/*</url-pattern>
>   </servlet-mapping>
>
> i would invoke an action from struts-config-subapp.xml as:
>
> /actions/subapp/<action-mapping-name>
>
> this is pretty straightforward, right?  well i can't get it to work, and i
> think i know why.
>
> the configuration appears to be correctly parsed with the servlet init's.
> my problem is invoking actions in anything other than the main
struts-config
> file.
>
> ok, the first thing that touches my requests is ActionServlet, which hands
> of the request to it's process() method.  ActionServlet.process() infers
> which ApplicationConfig to use, and then uses the appropriate
> RequestProcessor.  however, in my case, the appropriate RequestProcessor
is
> never found because RequestUtils.selectApplication() isn't finding the
> correct ApplicationConfig.  the problem is the first line of
> RequestUtils.selectApplication(request, context):
>
>   String matchPath = request.getServletPath();
>
> this always returns "/actions" (which doesn't map to any of the keys for
any
> of the application configs), and i think what it's supposed to return is
> "/subapp".  if i didn't have more faith in y'all, i'd say i just found a
> bug, but instead i'm assuming that i've made some sort of mistake in my
> understanding.  (there's also the fact that this functionality appears to
> have been in use by others for quite sometime --- also an indication that
> i'm just an idiot.)
>
> anyway, can someone either set me straight or back me up here?  i've gone
as
> far as i can go on my own.
>
> thanks,
>
> ab
>
>
>
>
> _________________________________________________________________
> MSN Photos is the easiest way to share and print your photos:
> http://photos.msn.com/support/worldwide.aspx
>
>
> --
> To unsubscribe, e-mail:
<ma...@jakarta.apache.org>
> For additional commands, e-mail:
<ma...@jakarta.apache.org>
>


--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>