struts-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From James Mitchell <jmitch...@apache.org>
Subject RE: Struts Sub Modules not Working with 1.1-rc1
Date Tue, 25 Mar 2003 16:04:14 GMT
On Mon, 2003-03-24 at 22:05, Viji Sarathy wrote:
> I am not using Tomcat in the first place. 
> I stepped through the Struts source code to find out how it figures out
> if a certain request is meant to be directed to a resource in a
> sub-module. That portion of the code, in the version of the source code
> that I have, seems to always return the prefix that corresponds to the
> default module, namely, "". 
> 
> Would you mind sending me the relevant portions of web.xml and a portion
> of the struts-<sub-module>-config.xml that shows the configuration for
> atleast one action mapping in the sub-module?


I can do better, I released a very small demo of how setup and switch
between modules (3 different ways, but there are more).

You can download the source here:
http://sf.net/projects/struts

Look under the package: 'simple' for 'Module Switching Examples'


* One thing to note - as I replied to your private email, you cannot use
path mapping with Modules, it requires extension mapping (*.do,
*.action, *.whatever)


Good Luck!

> 
> Thanks.
> Viji Sarathy
> 
> 
> 
> 
> 
> > -----Original Message-----
> > From: Navjot Singh [mailto:navjot.s@net4india.net] 
> > Sent: Monday, March 24, 2003 10:34 PM
> > To: Struts Users Mailing List
> > Subject: Re: Struts Sub Modules not Working with 1.1-rc1
> > 
> > 
> > No dear, it works. I have my setup working and running.
> > 
> > may be this would help you to locate your problem.
> > 
> > create a logging.properties with a line
> > .level = FINE
> > 
> > and start the tomcat with logging.properties in system classpath
> > 
> > You will see better messages from struts and tomcat and will 
> > help you in terms of module getting recognized or not.
> > 
> > HTH
> > navjot singh
> > 
> > 
> > 
> > 
> > ----- Original Message -----
> > From: "Viji Sarathy" <vsarathy@comframe.com>
> > To: "'Struts Users Mailing List'" <struts-user@jakarta.apache.org>
> > Sent: Monday, March 24, 2003 4:16 PM
> > Subject: Struts Sub Modules not Working with 1.1-rc1
> > 
> > 
> > | Hello All:
> > |
> > | This is the first time I am posting to this mailing list.
> > | If I have not followed any etiquettes properly, please forgive me.
> > |
> > | Here's my question:
> > | I just updated from Struts 1.1-b2 to Struts 1.1-rc1.
> > | I have an Web Application which has two Struts Applications (or 
> > | Modules as they are now called). When I make an invocation on a 
> > | resource in the sub-module, I get an "Invalid Path Requested" Error.
> > |
> > | My web.xml pertaining to Struts Configuration looks like this:
> > |
> > | <init-param>
> > | <param-name>config</param-name>
> > |
> > | <param-value>/WEB-INF/struts-config.xml</param-value>
> > | </init-param>
> > | <init-param>
> > | <param-name>config/pc</param-name>
> > |
> > | <param-value>/WEB-INF/struts-pc-config.xml</param-value>
> > | </init-param>
> > |
> > |
> > | The root context of the Web Application is "/mc".
> > | So, when a request "/mc/pc/user" is received by Struts, it should 
> > | figure out that it is meant for the Struts Sub-Module 
> > "/pc". However, 
> > | it does not. This used to work in 1.1.-b2.
> > |
> > | When I look in the Struts source code where this is done, 
> > this is what 
> > | I
> > | found:
> > |
> > |     public static String getModuleName(String matchPath, 
> > | ServletContext
> > | context) {
> > |         String prefix = "";
> > |         String prefixes[] = getModulePrefixes(context);
> > |         int lastSlash = 0;
> > |
> > |         while (prefix.equals("") && ((lastSlash =
> > | matchPath.lastIndexOf("/")) > 0)) {
> > |             matchPath = matchPath.substring(0, lastSlash);
> > |             for (int i = 0; i < prefixes.length; i++) {
> > |                 if (matchPath.equals(prefixes[i])) {
> > |                     prefix = prefixes[i];
> > |                     break;
> > |                 }
> > |             }
> > |         }
> > |         return prefix;
> > |     }
> > |
> > | In the above, the argument matchPath is passed in as "/pc" after 
> > | parsing the request's servlet path. But, the above algorithm will 
> > | always return prefix="", is it not?
> > |
> > | Is this a bug ?
> > |
> > | Has anyone tried sub-applications with 1.1-rc1?
> > |
> > | Please help.
> > | Thanks.
> > | Viji Sarathy
> > |



-- 
James Mitchell
Software Developer/Struts Evangelist
http://www.open-tools.org




---------------------------------------------------------------------
To unsubscribe, e-mail: struts-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: struts-user-help@jakarta.apache.org


Mime
View raw message