RE: Struts Sub Modules not Working with 1.1-rc1
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--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:[EMAIL PROTECTED] > > 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" <[EMAIL PROTECTED]> > > To: "'Struts Users Mailing List'" <[EMAIL PROTECTED]> > > 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: > > | > > | > > | config > > | > > | /WEB-INF/struts-config.xml > > | > > | > > | config/pc > > | > > | /WEB-INF/struts-pc-config.xml > > | > > | > > | > > | 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: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: Struts Sub Modules not Working with 1.1-rc1
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--config.xml that shows the configuration for atleast one action mapping in the sub-module? Thanks. Viji Sarathy > -Original Message- > From: Navjot Singh [mailto:[EMAIL PROTECTED] > 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" <[EMAIL PROTECTED]> > To: "'Struts Users Mailing List'" <[EMAIL PROTECTED]> > 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: > | > | > | config > | > | /WEB-INF/struts-config.xml > | > | > | config/pc > | > | /WEB-INF/struts-pc-config.xml > | > | > | > | 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 > | > | > | > - > | To unsubscribe, e-mail: [EMAIL PROTECTED] > | For additional commands, e-mail: [EMAIL PROTECTED] > | > | > > > - > To unsubscribe, e-mail: [EMAIL PROTECTED] > For additional commands, e-mail: [EMAIL PROTECTED] > - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
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" <[EMAIL PROTECTED]> To: "'Struts Users Mailing List'" <[EMAIL PROTECTED]> 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: | | | config | | /WEB-INF/struts-config.xml | | | config/pc | | /WEB-INF/struts-pc-config.xml | | | | 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 | | | - | To unsubscribe, e-mail: [EMAIL PROTECTED] | For additional commands, e-mail: [EMAIL PROTECTED] | | - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: Struts Sub-modules
Hmmm...seems I might have (incorrectly) zipped the original files. I'll send you the full example off-list. If anyone else following this thread wants it, just let me know. -- James Mitchell Web Developer/Struts Evangelist http://jakarta.apache.org/struts/ "People demand freedom of speech to make up for the freedom of thought which they avoid." - Soren Aabye Kierkegaard (1813-1855) > -Original Message- > From: Stephen Smithstone [mailto:[EMAIL PROTECTED] > Sent: Saturday, March 01, 2003 5:25 AM > To: Struts Users Mailing List > Subject: Re: Struts Sub-modules > > > ta for the zip james ive unzipped it and added the lib > directory however when > i come to run it and click on the link to go to mod1 it errors with > > > HTTP Status 400 - Invalid path /Index was requested > > > type Status report > > > message Invalid path /Index was requested > > > description The request sent by the client was syntactically > incorrect > (Invalid path /Index was requested). > > > On Friday 28 February 2003 4:18 pm, James Mitchell wrote: > > Ok, here ya go. > > > > Only thing missing is the lib directory. > > > > -- > > James Mitchell > > Web Developer/Struts Evangelist > > http://jakarta.apache.org/struts/ > > > > > -Original Message----- > > > From: Stephen Smithstone [mailto:[EMAIL PROTECTED] > > > Sent: Friday, February 28, 2003 10:53 AM > > > To: Struts Users Mailing List > > > Subject: Re: Struts Sub-modules > > > > > > > > > James Mitchell or anyone > > > > > > ive just uploaded an example i made to > > > > > > www.skullboxhouse.co.uk/downloads/smt.war > > > > > > it would be great if u can download and run and help me solve > > > the problem :-) > > > > > > Ta > > > > > > Stephen > > > > > > > > > > - > > > To unsubscribe, e-mail: [EMAIL PROTECTED] > > > For additional commands, e-mail: > [EMAIL PROTECTED] > > > - > To unsubscribe, e-mail: [EMAIL PROTECTED] > For additional commands, e-mail: [EMAIL PROTECTED] > - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Struts Sub-modules
ta for the zip james ive unzipped it and added the lib directory however when i come to run it and click on the link to go to mod1 it errors with HTTP Status 400 - Invalid path /Index was requested type Status report message Invalid path /Index was requested description The request sent by the client was syntactically incorrect (Invalid path /Index was requested). On Friday 28 February 2003 4:18 pm, James Mitchell wrote: > Ok, here ya go. > > Only thing missing is the lib directory. > > -- > James Mitchell > Web Developer/Struts Evangelist > http://jakarta.apache.org/struts/ > > > -Original Message- > > From: Stephen Smithstone [mailto:[EMAIL PROTECTED] > > Sent: Friday, February 28, 2003 10:53 AM > > To: Struts Users Mailing List > > Subject: Re: Struts Sub-modules > > > > > > James Mitchell or anyone > > > > ive just uploaded an example i made to > > > > www.skullboxhouse.co.uk/downloads/smt.war > > > > it would be great if u can download and run and help me solve > > the problem :-) > > > > Ta > > > > Stephen > > > > > > - > > To unsubscribe, e-mail: [EMAIL PROTECTED] > > For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: Struts Sub-modules
Ok, here ya go. Only thing missing is the lib directory. -- James Mitchell Web Developer/Struts Evangelist http://jakarta.apache.org/struts/ > -Original Message- > From: Stephen Smithstone [mailto:[EMAIL PROTECTED] > Sent: Friday, February 28, 2003 10:53 AM > To: Struts Users Mailing List > Subject: Re: Struts Sub-modules > > > James Mitchell or anyone > > ive just uploaded an example i made to > > www.skullboxhouse.co.uk/downloads/smt.war > > it would be great if u can download and run and help me solve > the problem :-) > > Ta > > Stephen > > > - > To unsubscribe, e-mail: [EMAIL PROTECTED] > For additional commands, e-mail: [EMAIL PROTECTED] > smt.zip Description: Zip compressed data - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Struts Sub-modules
James Mitchell or anyone ive just uploaded an example i made to www.skullboxhouse.co.uk/downloads/smt.war it would be great if u can download and run and help me solve the problem :-) Ta Stephen - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Struts Sub-modules
Just on how to set it up and get it workin correctly i understand that u make up a new config file say struts-mod1.xml and mod1 becomes the prefix then i create a folder under the main webapp folder called mod1 then in my default struts-config.xml i have global forward say called toMod1 which looks like this then i have in my struts-mod1.xml do i define an actionmapping that does etc?? had to make that up etc cos i deleted my example on my machine just need some confirmation on is that the correct setup also if im in the mod1 module how do i get back to the default mod1 Also i had to laugh at the url in your sig :-) On Friday 28 February 2003 3:11 pm, James Mitchell wrote: > What kind of problems are you having? > > > > -- > James Mitchell > Web Developer/Struts Evangelist > http://www.microsoft.com/struts/ > > > -Original Message- > > From: Stephen Smithstone [mailto:[EMAIL PROTECTED] > > Sent: Friday, February 28, 2003 9:45 AM > > To: Struts Users Mailing List > > Subject: Struts Sub-modules > > > > > > Does any one have a spare simple war that shows off switching > > modules im > > having to many problems at the minute :/ > > > > if you could email them to [EMAIL PROTECTED] it > > would be great > > > > ta > > > > > > - > > To unsubscribe, e-mail: [EMAIL PROTECTED] > > For additional commands, e-mail: [EMAIL PROTECTED] > > - > To unsubscribe, e-mail: [EMAIL PROTECTED] > For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: Struts Sub-modules
What kind of problems are you having? -- James Mitchell Web Developer/Struts Evangelist http://www.microsoft.com/struts/ > -Original Message- > From: Stephen Smithstone [mailto:[EMAIL PROTECTED] > Sent: Friday, February 28, 2003 9:45 AM > To: Struts Users Mailing List > Subject: Struts Sub-modules > > > Does any one have a spare simple war that shows off switching > modules im > having to many problems at the minute :/ > > if you could email them to [EMAIL PROTECTED] it > would be great > > ta > > > - > To unsubscribe, e-mail: [EMAIL PROTECTED] > For additional commands, e-mail: [EMAIL PROTECTED] > - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]