----------------------------------------------------------------
BEFORE YOU POST, search the faq at <http://java.apache.org/faq/>
WHEN YOU POST, include all relevant version numbers, log files,
and configuration files.  Don't make us guess your problem!!!
----------------------------------------------------------------

Let me start by saying that I read the FAQ (and got some ideas from it).  I 
am using Apache 1.3.12 and ApacheJServ 1.1.2 and SUN JVM v1.2.2 on Win NT 
Workstation 4 Service Pack 5.  JServ is in autostart mode.

I have a system environment variable that I am trying to read inside the 
servlet: UPLOAD_DIR (user environment variable).

I previously attempted to use System.getenv("UPLOAD_DIR") -- to no avail 
because it is no longer supported -- and System.getProperty("UPLOAD_DIR") -- 
which works if the value is specified in jserv.properties as follows:

wrapper.bin.parameters=-DUPLOAD_DIR=%UPLOAD_DIR%  -- the problem here is that 
it sends the text "%UPLOAD_DIR%" rather than the value.

Instead, I am now trying to use the following in jserv.properties:

wrapper.env.copy=UPLOAD_DIR

The code that is trying to get this value is in the init( ) method of 
ServletBase.java (which extends HttpServlet).  From reading the FAQ, it seems 
that I should be using the getAttribute( ) method -- I am using it as a 
method within ServletContext.  I always get a null return value.

I have confirmed that the environment variable exists under NT and I have 
restarted Apache & JServ with each test.

Here's the code (please help -- note Logger.log simply writes to the servlet 
log):

Logger.log("UPLOAD_DIR is: " + 
(String)servletContext.getAttribute("org.apache.jserv.UPLOAD_DIR"));
This always produces NULL.

This also produces NULL:
Logger.log("UPLOAD_DIR is: " + 
(String)servletContext.getAttribute("UPLOAD_DIR"));


I have also tried this code (as stolen from the FAQ):
Object obj = servletContext.getAttribute("org.apache.jserv.attribute_names");
... and then treated it like an enumeration, but it is also always null.

*Please* help me figure out this issue.  Your input is most appreciated.

Erik Klein
Versatile Consulting Inc.
732-936-0573
mailto:[EMAIL PROTECTED]
http://members.aol.com/ErikKlein


--
--------------------------------------------------------------
Please read the FAQ! <http://java.apache.org/faq/>
To subscribe:        [EMAIL PROTECTED]
To unsubscribe:      [EMAIL PROTECTED]
Search Archives: 
<http://www.mail-archive.com/java-apache-users%40list.working-dogs.com/>
Problems?:           [EMAIL PROTECTED]

Reply via email to