Re: directory structure and porting issues
QM wrote: : - Finally, is it the best practice to hard-code the 'context' prefix in : your application? JSTL. I forget the exact tag names, but any JSTL reference will have them listed. There's a tag for creating context-relative links, and (I believe) one for creating context-relative image tags. Yes, William, take a look at JSTL specification, it's here: http://jcp.org/aboutJava/communityprocess/final/jsr052/ . See subsection 7.1 . - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: directory structure and porting issues
Hi, Your problems arise because of imperfect/relaxed implementations of the servlet spec by earlier containers. Tomcat is strict. I don't think there's a double-meaning to 'context' personally but that's a minor point anyways. In addition to the spec, see this for directory structures: http://jakarta.apache.org/tomcat/tomcat-5.0-doc/appdev/index.html Yoav Shapira Millennium Research Informatics -Original Message- From: William Claxton [mailto:[EMAIL PROTECTED] Sent: Saturday, April 10, 2004 6:52 AM To: [EMAIL PROTECTED] Subject: directory structure and porting issues Folks, hi - I keep stumbling into porting issues when moving older servlet applications from Jrun or Servlet Exec to Tomcat. A couple issues related to directory structure always seem to arise. One issue is that an application expecting all servlets to be loaded from a single classpath may not have the 'context' prefix. For example, an application 'app1' that posts to '/servlet/Controller' may not work unless 'app1' is defined as Tomcat's default context. It would work if you change the code so that it posts to 'app1/servlet/Controller'. But that's a global change that hardcodes the context name. Incidentally, I observed the same issue when changing the 'appbase' in Tomcat's server.xml - the Tomcat home page is no longer accessible. Even if you create a new 'tomcat' context, the admin, manager and servlet examples linked from Tomcat's homepage don't work. A solution I found works in Tomcat 5 is to create new contexts for each, such as: Context path=tomcat/servlets-examples docBase=c:\apps\java\tomcat\webapps\servlets-examples debug=0 / As I recall, this didn't work in Tomcat 4. Another issue is that 'context' seems to function as both a 'script-alias' and an 'alias' for static files, but with differing results. For example, suppose that in the application called 'app1', I create a static web page that does 3 things: - displays an image at 'app1/images/button.gif' - loads a stylesheet from '/app1/includes/default.css' - posts a form to '/app1/servlet/Controller' It seems that the images and includes folders are expected to appear in the folder 'app1' directly below my appbase, whereas the Controller servlet is expected in the 'app1/WEB-INF/classes' folder. This is different from where these folders resided in other servlet containers that did not use 'WEB-INF'. Apparently 'app1' is a 'script-alias' for servlets, and an ordinary 'alias' for static files, with different meanings for each. The problem can be resolved if I use a connector to Apache or IIS, and then create the 'alias' for static files in the web server. But in a standalone instance of Tomcat there is no separate alias definition - 'context' is the only way to create aliases. - Am I right about the double-meaning of 'context'? - Do others experience similar porting issues? - Is there an online guide that helps app developers select a directory structure that is portable across servlet containers? - Finally, is it the best practice to hard-code the 'context' prefix in your application? Cheers. Regards, Bill Claxton [EMAIL PROTECTED] OpenAsia Solutions provides streaming media payment solutions. Check out http://www.openasia.net ::: :: - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] This e-mail, including any attachments, is a confidential business communication, and may contain information that is confidential, proprietary and/or privileged. This e-mail is intended only for the individual(s) to whom it is addressed, and may not be saved, copied, printed, disclosed or used by anyone else. If you are not the(an) intended recipient, please immediately delete this e-mail from your computer system and notify the sender. Thank you. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: directory structure and porting issues
QM - Thanks very much for your detailed reply. I have Shawn Bayern's JSTL in Action, and you're right - the URL issue is covered. I have also reviewed relevant portions of the Servlet Spec 2.4, which sets out the general approach to directory structure in applications. It seems safest to place the 'context' prefix before any URL. Cheers. At 11:36 AM 4/10/04 -0500, you wrote: : - Is there an online guide that helps app developers select a directory : structure that is portable across servlet containers? The servlet spec. Do a search at java.sun.com for it. You'll want 2.3 if you're running Tomcat 4, or 2.4 if you're running Tomcat 5. Either way, it's available as a PDF. As a Java web developer, the spec is your guide to webapp standards and portability. At the risk of sounding facetious, it answers all of your questions except this one: : - Finally, is it the best practice to hard-code the 'context' prefix in : your application? JSTL. I forget the exact tag names, but any JSTL reference will have them listed. There's a tag for creating context-relative links, and (I believe) one for creating context-relative image tags. -QM -- software -- http://www.brandxdev.net tech news -- http://www.RoarNetworX.com - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] Regards, Bill Claxton [EMAIL PROTECTED] OpenAsia Solutions provides streaming media payment solutions. Check out http://www.openasia.net : - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
directory structure and porting issues
Folks, hi - I keep stumbling into porting issues when moving older servlet applications from Jrun or Servlet Exec to Tomcat. A couple issues related to directory structure always seem to arise. One issue is that an application expecting all servlets to be loaded from a single classpath may not have the 'context' prefix. For example, an application 'app1' that posts to '/servlet/Controller' may not work unless 'app1' is defined as Tomcat's default context. It would work if you change the code so that it posts to 'app1/servlet/Controller'. But that's a global change that hardcodes the context name. Incidentally, I observed the same issue when changing the 'appbase' in Tomcat's server.xml - the Tomcat home page is no longer accessible. Even if you create a new 'tomcat' context, the admin, manager and servlet examples linked from Tomcat's homepage don't work. A solution I found works in Tomcat 5 is to create new contexts for each, such as: Context path=tomcat/servlets-examples docBase=c:\apps\java\tomcat\webapps\servlets-examples debug=0 / As I recall, this didn't work in Tomcat 4. Another issue is that 'context' seems to function as both a 'script-alias' and an 'alias' for static files, but with differing results. For example, suppose that in the application called 'app1', I create a static web page that does 3 things: - displays an image at 'app1/images/button.gif' - loads a stylesheet from '/app1/includes/default.css' - posts a form to '/app1/servlet/Controller' It seems that the images and includes folders are expected to appear in the folder 'app1' directly below my appbase, whereas the Controller servlet is expected in the 'app1/WEB-INF/classes' folder. This is different from where these folders resided in other servlet containers that did not use 'WEB-INF'. Apparently 'app1' is a 'script-alias' for servlets, and an ordinary 'alias' for static files, with different meanings for each. The problem can be resolved if I use a connector to Apache or IIS, and then create the 'alias' for static files in the web server. But in a standalone instance of Tomcat there is no separate alias definition - 'context' is the only way to create aliases. - Am I right about the double-meaning of 'context'? - Do others experience similar porting issues? - Is there an online guide that helps app developers select a directory structure that is portable across servlet containers? - Finally, is it the best practice to hard-code the 'context' prefix in your application? Cheers. Regards, Bill Claxton [EMAIL PROTECTED] OpenAsia Solutions provides streaming media payment solutions. Check out http://www.openasia.net : - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: directory structure and porting issues
: - Is there an online guide that helps app developers select a directory : structure that is portable across servlet containers? The servlet spec. Do a search at java.sun.com for it. You'll want 2.3 if you're running Tomcat 4, or 2.4 if you're running Tomcat 5. Either way, it's available as a PDF. As a Java web developer, the spec is your guide to webapp standards and portability. At the risk of sounding facetious, it answers all of your questions except this one: : - Finally, is it the best practice to hard-code the 'context' prefix in : your application? JSTL. I forget the exact tag names, but any JSTL reference will have them listed. There's a tag for creating context-relative links, and (I believe) one for creating context-relative image tags. -QM -- software -- http://www.brandxdev.net tech news -- http://www.RoarNetworX.com - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Autoreply: Re: directory structure and porting issues
Hello, Due to the increased volume of SPAM this mailbox has been closed. Please contact us via http://www.directxtras.com/ContactUS.asp We apology for the inconvenience. Best Regards, -- The DirectXtras Team - DirectXtras - Xtra Power for Director and Authorware - http://www.directxtras.com Sites with something to say - http://www.SpeaksForItself.com - Your message reads: Received: from mail.apache.org (unverified [208.185.179.12]) by mail2.intermedia.net (Rockliffe SMTPRA 4.5.6) with SMTP id [EMAIL PROTECTED] for [EMAIL PROTECTED]; Sat, 10 Apr 2004 09:36:50 -0700 Received: (qmail 19223 invoked by uid 500); 10 Apr 2004 16:36:30 - Mailing-List: contact [EMAIL PROTECTED]; run by ezmlm Precedence: bulk List-Unsubscribe: mailto:[EMAIL PROTECTED] List-Subscribe: mailto:[EMAIL PROTECTED] List-Help: mailto:[EMAIL PROTECTED] List-Post: mailto:[EMAIL PROTECTED] List-Id: Tomcat Users List tomcat-user.jakarta.apache.org Reply-To: Tomcat Users List [EMAIL PROTECTED] Delivered-To: mailing list [EMAIL PROTECTED] Received: (qmail 19202 invoked from network); 10 Apr 2004 16:36:29 - Received: from unknown (HELO smarty.dreamhost.com) (66.33.216.24) by daedalus.apache.org with SMTP; 10 Apr 2004 16:36:29 - Received: from strange.dreamhost.com (strange.dreamhost.com [66.33.193.57]) by smarty.dreamhost.com (Postfix) with ESMTP id 4155913F638; Sat, 10 Apr 2004 09:36:33 -0700 (PDT) Received: by strange.dreamhost.com (Postfix, from userid 7734) id 4C81C6AA14; Sat, 10 Apr 2004 09:36:33 -0700 (PDT) Date: Sat, 10 Apr 2004 11:36:33 -0500 From: QM [EMAIL PROTECTED] To: Tomcat Users List [EMAIL PROTECTED] Subject: Re: directory structure and porting issues Message-ID: [EMAIL PROTECTED] References: [EMAIL PROTECTED] Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: [EMAIL PROTECTED] User-Agent: Mutt/1.3.28i X-Spam-Rating: daedalus.apache.org 1.6.2 0/1000/N : - Is there an online guide that helps app developers select a directory : structure that is portable across servlet containers? The servlet spec. Do a search at java.sun.com for it. You'll want 2.3 if you're running Tomcat 4, or 2.4 if you're running Tomcat 5. Either way, it's available as a PDF. As a Java web developer, the spec is your guide to webapp standards and portability. At the risk of sounding facetious, it answers all of your questions except this one: : - Finally, is it the best practice to hard-code the 'context' prefix in : your application? JSTL. I forget the exact tag names, but any JSTL reference will have them listed. There's a tag for creating context-relative links, and (I believe) one for creating context-relative image tags. -QM -- software -- http://www.brandxdev.net tech news -- http://www.RoarNetworX.com - 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]