To JRun Mailing List,
I have submitted this request previously to the list but directed it to
two members. This re-submission is to the wider audience even Scott Stirling
if will to venture a response.
This solution is fine for JRun 3.0, but it world not work for JRun 2.3.3.
This is half my solution.
We are migrating customers from JRun 2.3.3 to JRun 3.0, and our code is
server independent - so far.
Our current global properties file for JRun 2.3.3 is
public String configFile ="../properties/AdminConfig.txt";
Questions:-
1. Will the similar method work for JRun 2.3.3. What will this path point to
?
2. Is there a way of detecting which Server type is running and then
being able to determine the properties file ?
Regards
Naipaul Ojar
RSA Security
> -----Original Message-----
> From: Lynn Walton [mailto:[EMAIL PROTECTED]]
> Sent: Tuesday, August 08, 2000 9:12 AM
> To: [EMAIL PROTECTED]
> Subject: Re: getResourceAsStream() path solution
>
>
> Cool, Mike. Thanks for sharing that!
> Lynn
>
> Mike Hogarth wrote:
>
> > Re: getResourceAsStream(path)
> >
> > Figured it out! I also found it to be a very cool way of
> providing property files for web-apps and have them deployed
> with the application (under WEB-INF/properties).
> >
> > To load a file from within the webapp context using
> getResourceAsStream(path):
> >
> > The ServletContext.getResourceAsStream(pathToResource)
> starts at the getContextPath() as the path root.
> >
> > For example, if you have a file Headache.xml in the
> following directory hiearchy:
> >
> > /approot/
> > /WEB-INF
> > /guidelines
> > Headache.xml
> >
> > You use the following to read from a file programmatically
> within a servlet:
> >
> > ServletContext sc = this.getServletContext();
> > InputStream is_xml =
> sc.getResourceAsStream("WEB-INF/guidelines/Headache.xml");
> >
> > One odd thing with JRun3:
> > The sc.getContextPath() returns "/approot" without the
> second slash. Not sure why I don't need a /WEB-INF when using
> getResourceAsStream() but it wouldn't work that way. It seems
> to add the second slash. The specification only states that
> it must start with a slash, so there is some vagueness in the spec:
> >
> >
> --------------------------------------------------------------
> --------------------------------------------------------------
> -----------------------------
> > public java.net.URL getResource(java.lang.String path)
> > throws java.net.MalformedURLException
> >
> > Returns a URL to the resource that is mapped to a
> specified path. The path must begin with a "/" and is
> interpreted as relative to the current context root.
> > This method allows the servlet container to make a
> resource available to servlets from any source. Resources can
> be located on a local or remote file system, in a
> database, or in a .war file.
> >
> > The servlet container must implement the URL
> handlers and URLConnection objects that are necessary to
> access the resource.
> >
> --------------------------------------------------------------
> --------------------------------------------------------------
> --------------------------
> >
> > For those curious as to what I am doing, I'm using Apache's
> Xalan to perform XSL Transformation on an XML file using a
> particular XSL stylesheet. Both the XML and XSL files are
> loaded programmatically and the XSLT processor invoked. We
> starting constructing medical guidelines in XML format and
> are exploring the use of XSLT to output them in a variety of
> formats including HTML "on the fly". Pretty slow when it
> starts, but works nicely once it is loaded and running in the
> servlet container.
> >
> > One thing I did notice was that the XSLT Processor chokes
> on URLs that have multiple variables (using an ampersand) to
> be passed to servlets. Apparently, an ampersand does not make
> for a well formed XML document.
> >
> > --Mike H
> >
> >
> --------------------------------------------------------------
> ----------------
> > Archives: http://www.egroups.com/group/jrun-interest/
> > Unsubscribe:
> http://www.houseoffusion.com/index.cfm?sidebarysts&bodyysts/jrun_talk
> > or send a message to [EMAIL PROTECTED]
> with 'unsubscribe' in the body.
>
> --------------------------------------------------------------
> ----------------
> Archives: http://www.egroups.com/group/jrun-interest/
> Unsubscribe:
> http://www.houseoffusion.com/index.cfm?sidebar=lists&body=list
s/jrun_talk
or send a message to [EMAIL PROTECTED] with 'unsubscribe'
in the body.
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Structure your ColdFusion code with Fusebox. Get the official book at
http://www.fusionauthority.com/bkinfo.cfm
Archives: http://www.mail-archive.com/[email protected]/
Unsubscribe: http://www.houseoffusion.com/index.cfm?sidebar=lists