You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tomcat.apache.org by Timothy Fisher <tr...@yahoo.com> on 2001/10/04 17:06:47 UTC

Writing to files from Servlets

I have a servlet in which I save some data to a file.
I open the file just using the file name, with no path
information.

By default, I notice the file is being put into the
TOMCAT_HOME/bin directory.

How can I change the default "working" directory to be
that of the current web application?

Thanks,
Tim


How to develop custom user authentication for Tomcat based on SecurityCheck ?

Posted by Thierry Delaitre <de...@cpc.wmin.ac.uk>.
Hello,

We have developed a JSP based application based on tomcat 3.2.3. This
application requires different level of administration and requires users
to login. We would like to develop a custom authentication module for
authenticating users against NIS login/password database. I've already
developed a C program which checks if a given login/password is correct
but it is not clear how to integrate this C program with tomcat. This C
program runs as root (setuid !) and takes the login name and password in
input using a pipe and returns true or false if the login/password pair is
correct or not.

We have had a look at extending the SecurityCheck class but it seems that
the SecurityCheck class does not exist anymore in tomcat 3.2.3 ? Has a new
class superseded the SecurityCheck class and is there some kind of
documentation about this new class ? I would be grateful for any
information !

Thanks !

Thierry & Mathilde.


Duplicate indices in 4.0

Posted by Yoav Shapira <sh...@mpi.com>.
Hi there,
I have a servlet in my webapp that I'd like loaded on server startup, after
the Tomcat servlets (default, invoker, jsp, cgi-bin, etc.).

Expected behavior: My understanding was that if in my
webapp/WEB-INF/web.xml I have something like
<servlet>
  <servlet-name>MyServlet</servlet-name>
....
  <load-on-startup>1</load-on-startup>
</servlet>

Then MyServlet will be loaded first in my webapp, AFTER all the tomcat
defaults from the $CATALINA_HOME/conf/web.xml file.

Observed Behavior:
I can't even access localhost:8080 index.html file, or anything else.
Tomcat
seems to not respond, the startup logs stop in a weird place: the HTTP
listener
starts, but doesn't start any threads.

Removing load-on-startup fixes the problem, and I would guess that changing
it to something like 999 would fix it as well.  Was my expectation wrong, or
is this a bug?

Thanks,

Yoav Shapira
Millennium Pharmaceuticals, Inc.


Simple log question

Posted by Andrew Standley <an...@ecnetwork.co.nz>.
Hi,
	I posted a long winded question but have a much simpler one now too!


	I use perl to post up to a web site. The Apache log file says it got it. I
define a virtual host and this should pass it on to Tomcat. The perl program
says "internal server error". I have two Tomcat's running on different ports
set up with JkMounts to different ajp12 processes. I can't see in any Tomcat
log files an error or an indication it has been passed something. Can you
set logs for ajp12 or tomcat to see what it is doing or whether it receives
anything at all????



andy


RE: Writing to files from Servlets

Posted by Jim Urban <ji...@netsteps.net>.
Tim,

You could try this:

String contextPath = new String(getServletContext().getRealPath("/"));
Then append your file name.

Jim

-----Original Message-----
From: Timothy Fisher [mailto:trfishermi@yahoo.com]
Sent: Thursday, October 04, 2001 10:07 AM
To: tomcat-user@jakarta.apache.org
Subject: Writing to files from Servlets


I have a servlet in which I save some data to a file.
I open the file just using the file name, with no path
information.

By default, I notice the file is being put into the
TOMCAT_HOME/bin directory.

How can I change the default "working" directory to be
that of the current web application?

Thanks,
Tim



Re: Writing to files from Servlets

Posted by Alexandre Victoor <av...@prisma-presse.com>.
You can use the property tomcat.home to build an absolute path that 
correspond to your "working" directory. You can also try to use the static 
method Class.getLocation()

Alex


At 08:06 04/10/2001 -0700, you wrote:
>I have a servlet in which I save some data to a file.
>I open the file just using the file name, with no path
>information.
>
>By default, I notice the file is being put into the
>TOMCAT_HOME/bin directory.
>
>How can I change the default "working" directory to be
>that of the current web application?
>
>Thanks,
>Tim