You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tomcat.apache.org by "P.Ruijters" <p....@chello.nl> on 2002/07/06 22:04:34 UTC

servlet(tomcat?) saves file in unwanted location

Hello,

First question:
=========
In one of my first servlets I  want to save Form data in a file in the same
directory as the servlet is running: ...../classes/formdata.txt. When I use
straight forward code to do this I find the file formdata.txt back NOT in
the classes directory but in the directory:
C:\WINNT\Profiles\pruijter\StartMenu\Programs\Apache Tomcat4.0\formdata.txt.
(it took quite some time to find this out!!)
When I test the specific code part for "saving" the file outside the servlet
in a separate Test.class in the same ...../classes directory, the
formdata.txt file DOES appear as expected in the same directory. So the code
is ok.....

Can anybody tell me why the servlet saves the formdata.txt file in a totally
different location, and how can I make the servlet behave "normal".


Second Question:
============
As an extension to question one I do want to save the file in a different
location namely the location of another user on our intranet. He wants to
have this formdata.txt automatically appear in his directory. Is this
possible?


Thanks
-------

Pierre R.






--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>


Re: Tomcat directory listing

Posted by Lars Nielsen Lind <mo...@worldonline.dk>.
Kapil Sharma wrote:

>Hi,
>I am using tomcat 3.3.1 and apache 1.3.26. I read a lot about how to
>disable a directory listing but nine of them works? Still directory
>index is enable in tomcat context. I am able to disable it by changing
>auto/mod_jk.conf file. How can I do it automatically when the tomcat
>starts.
>
>kapil
>
>
>
>--
>To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
>For additional commands, e-mail: <ma...@jakarta.apache.org>
>
>

Hi.

Go to <jakarta-tomcat path>/conf/web.xml and change 
<param-name>listings</param-name><param-name>false</param-name> as shown 
here:

<servlet>
    <servlet-name>default</servlet-name>
    
<servlet-class>org.apache.catalina.servlets.DefaultServlet</servlet-class>
    <init-param>
      <param-name>debug</param-name>
      <param-value>0</param-value>
    </init-param>
    <init-param>
      <param-name>listings</param-name>
      <param-value>false</param-value>
    </init-param>
    <load-on-startup>1</load-on-startup>
  </servlet>

Best regards,

Lars Nielsen Lind


--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>


Tomcat startup script

Posted by Kapil Sharma <ks...@wishstream.com>.
Hi,
I am using Solaris 8 with tomcat 3.3.1+apache 1.3.26. Can anyone send me
a startup script for tomcat. I am also running tomcat as different user
so have to take care of that also. The script should start using that
user..
Cheers
jerry



--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>


Re: Tomcat directory listing

Posted by Nancy Crisostomo Martinez <na...@correo.uqroo.mx>.
Kapil:

"To turn off directory listings, change the listings attribute of the
StaticInterceptor to false in the server.xml file. For example:

    <StaticInterceptor listings="false" /> .... "


This is a paragraph from the Tomcat 3.3 User's Guide, but maybe this could help
you with your Tomcat 3.3.1
They could have the same behaviour.

Nancy.


Kapil Sharma wrote:

> Hi,
> I am using tomcat 3.3.1 and apache 1.3.26. I read a lot about how to
> disable a directory listing but nine of them works? Still directory
> index is enable in tomcat context. I am able to disable it by changing
> auto/mod_jk.conf file. How can I do it automatically when the tomcat
> starts.
>
> kapil
>
> --
> To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
> For additional commands, e-mail: <ma...@jakarta.apache.org>


--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>


Tomcat directory listing

Posted by Kapil Sharma <ks...@wishstream.com>.
Hi,
I am using tomcat 3.3.1 and apache 1.3.26. I read a lot about how to
disable a directory listing but nine of them works? Still directory
index is enable in tomcat context. I am able to disable it by changing
auto/mod_jk.conf file. How can I do it automatically when the tomcat
starts.

kapil



--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>


Re: Tomcat and static content

Posted by Tim Funk <fu...@joedog.org>.
The apache access logs can tell you how long it took for a request to be 
served. All requests (whether they live in tomcat or not) are served by 
apache. So you'll need to check your access logs on the tomcat instance 
to see if only jsp's (or servlets are showing up) are being served by 
tomcat. If image requests are appearing in the tomcat logs - then tomcat 
is serving images. (Meaning apache is probably forwarding all requests 
to tomcat, which is inefficient)

Kapil Sharma wrote:
> Hi,
> Well I can see the images and pages request in apache access log. But it
> shows request for .jsp as well as images file. So I am still confused
> whether the images are served by tomcat or apache?
> 
> Cheers
> kapil
> 
> -----Original Message-----
> From: David Kavanagh [mailto:dak@dotech.com] 
> Sent: 07 July 2002 17:07
> To: Tomcat Users List
> Subject: Re: Tomcat and static content
> 
> 
> Kapil,
> You could look at the apache access log. It will tell when an image has 
> been served. There is now way (that I know of) to configure apache to 
> trap all image requests that would be handled by a tomcat context. Is 
> that what you are trying to do? If so, your web app needs to use paths 
> that are not within the web app context. You can set up aliases within 
> httpd.conf to make it easier to link images from the web app to some 
> convenient path on your httpd server.
> 
> Hope this helps.
> 
> David
> 
> Kapil Sharma wrote:
> 
> 
>>Can someone answer it please...
>>
>>kapil
>>
>>-----Original Message-----
>>From: Kapil Sharma [mailto:ksharma@wishstream.com]
>>Sent: 07 July 2002 00:03
>>To: 'Tomcat Users List'
>>Subject: Tomcat and static content
>>
>>
>>Hi,
>>I have got a problem. I am using apache 1.3.26+tomcat 1.3.1. Is there 
>>any way to know that apache is serving all static content like 
>>.html/.gif/.jpeg? My virtual host (in apache) is running very slow and 
>>images are breaking..
>>
>>Please help?
>>
>>Cheers
>>kapil
>>
>>
>>
>>--
>>To unsubscribe, e-mail: 
>><ma...@jakarta.apache.org>
>>For additional commands, e-mail: 
>><ma...@jakarta.apache.org>
>>
>>
>>
>>
>>--
>>To unsubscribe, e-mail:
> 
> <ma...@jakarta.apache.org>
> 
>>For additional commands, e-mail: 
>><ma...@jakarta.apache.org>
>>
> 
> 
> 
> --
> To unsubscribe, e-mail:
> <ma...@jakarta.apache.org>
> For additional commands, e-mail:
> <ma...@jakarta.apache.org>
> 
> 
> 
> 
> --
> To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
> For additional commands, e-mail: <ma...@jakarta.apache.org>
> 
> 
> 



--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>


Tomcat and static content

Posted by Kapil Sharma <ks...@wishstream.com>.
Hi,
I have got the following lines in my mod_jk.conf-auto file:

# Static files
Alias /foo "/export/home/test/u2/current/foo"
 
<Directory "/export/home/test/u2/current/foo">
    Options Indexes FollowSymLinks
    DirectoryIndex index.jsp index.html index.htm logon.jsp
</Directory>

1: What is the meaning of alias here. This means that apache will deal
with this alias to serve static content?
2: Where can I define Indexes? How can I get rid of directory indexing?
I have already made <StaticInterceptor listings="false" /> change in
server.xml, but still indexing is enables?

kapil



--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>


RE: Tomcat and static content

Posted by Andrew Conrad <an...@msn.com>.
Modify your urlworkermap.properties so it serves only jsp files

Etc...

/*.jsp=ajp13

- Andrew


-----Original Message-----
From: Kapil Sharma [mailto:ksharma@wishstream.com] 
Sent: Sunday, July 07, 2002 12:06 PM
To: 'Tomcat Users List'
Subject: RE: Tomcat and static content


Hi,
Well I can see the images and pages request in apache access log. But it
shows request for .jsp as well as images file. So I am still confused
whether the images are served by tomcat or apache?

Cheers
kapil

-----Original Message-----
From: David Kavanagh [mailto:dak@dotech.com]
Sent: 07 July 2002 17:07
To: Tomcat Users List
Subject: Re: Tomcat and static content


Kapil,
You could look at the apache access log. It will tell when an image has
been served. There is now way (that I know of) to configure apache to
trap all image requests that would be handled by a tomcat context. Is
that what you are trying to do? If so, your web app needs to use paths
that are not within the web app context. You can set up aliases within
httpd.conf to make it easier to link images from the web app to some
convenient path on your httpd server.

Hope this helps.

David

Kapil Sharma wrote:

>Can someone answer it please...
>
>kapil
>
>-----Original Message-----
>From: Kapil Sharma [mailto:ksharma@wishstream.com]
>Sent: 07 July 2002 00:03
>To: 'Tomcat Users List'
>Subject: Tomcat and static content
>
>
>Hi,
>I have got a problem. I am using apache 1.3.26+tomcat 1.3.1. Is there 
>any way to know that apache is serving all static content like 
>.html/.gif/.jpeg? My virtual host (in apache) is running very slow and 
>images are breaking..
>
>Please help?
>
>Cheers
>kapil
>
>
>
>--
>To unsubscribe, e-mail: 
><ma...@jakarta.apache.org>
>For additional commands, e-mail: 
><ma...@jakarta.apache.org>
>
>
>
>
>--
>To unsubscribe, e-mail:
<ma...@jakarta.apache.org>
>For additional commands, e-mail: 
><ma...@jakarta.apache.org>
>



--
To unsubscribe, e-mail:
<ma...@jakarta.apache.org>
For additional commands, e-mail:
<ma...@jakarta.apache.org>




--
To unsubscribe, e-mail:
<ma...@jakarta.apache.org>
For additional commands, e-mail:
<ma...@jakarta.apache.org>


--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>


RE: Tomcat and static content

Posted by Kapil Sharma <ks...@wishstream.com>.
Hi,
Well I can see the images and pages request in apache access log. But it
shows request for .jsp as well as images file. So I am still confused
whether the images are served by tomcat or apache?

Cheers
kapil

-----Original Message-----
From: David Kavanagh [mailto:dak@dotech.com] 
Sent: 07 July 2002 17:07
To: Tomcat Users List
Subject: Re: Tomcat and static content


Kapil,
You could look at the apache access log. It will tell when an image has 
been served. There is now way (that I know of) to configure apache to 
trap all image requests that would be handled by a tomcat context. Is 
that what you are trying to do? If so, your web app needs to use paths 
that are not within the web app context. You can set up aliases within 
httpd.conf to make it easier to link images from the web app to some 
convenient path on your httpd server.

Hope this helps.

David

Kapil Sharma wrote:

>Can someone answer it please...
>
>kapil
>
>-----Original Message-----
>From: Kapil Sharma [mailto:ksharma@wishstream.com]
>Sent: 07 July 2002 00:03
>To: 'Tomcat Users List'
>Subject: Tomcat and static content
>
>
>Hi,
>I have got a problem. I am using apache 1.3.26+tomcat 1.3.1. Is there 
>any way to know that apache is serving all static content like 
>.html/.gif/.jpeg? My virtual host (in apache) is running very slow and 
>images are breaking..
>
>Please help?
>
>Cheers
>kapil
>
>
>
>--
>To unsubscribe, e-mail: 
><ma...@jakarta.apache.org>
>For additional commands, e-mail: 
><ma...@jakarta.apache.org>
>
>
>
>
>--
>To unsubscribe, e-mail:
<ma...@jakarta.apache.org>
>For additional commands, e-mail: 
><ma...@jakarta.apache.org>
>



--
To unsubscribe, e-mail:
<ma...@jakarta.apache.org>
For additional commands, e-mail:
<ma...@jakarta.apache.org>




--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>


Re: Tomcat and static content

Posted by David Kavanagh <da...@dotech.com>.
Kapil,
You could look at the apache access log. It will tell when an image has 
been served. There is now way (that I know of) to configure apache to 
trap all image requests that would be handled by a tomcat context. Is 
that what you are trying to do? If so, your web app needs to use paths 
that are not within the web app context. You can set up aliases within 
httpd.conf to make it easier to link images from the web app to some 
convenient path on your httpd server.

Hope this helps.

David

Kapil Sharma wrote:

>Can someone answer it please...
>
>kapil
>
>-----Original Message-----
>From: Kapil Sharma [mailto:ksharma@wishstream.com] 
>Sent: 07 July 2002 00:03
>To: 'Tomcat Users List'
>Subject: Tomcat and static content
>
>
>Hi,
>I have got a problem. I am using apache 1.3.26+tomcat 1.3.1. Is there
>any way to know that apache is serving all static content like
>.html/.gif/.jpeg? My virtual host (in apache) is running very slow and
>images are breaking..
>
>Please help?
>
>Cheers
>kapil
>
>
>
>--
>To unsubscribe, e-mail:
><ma...@jakarta.apache.org>
>For additional commands, e-mail:
><ma...@jakarta.apache.org>
>
>
>
>
>--
>To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
>For additional commands, e-mail: <ma...@jakarta.apache.org>
>



--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>


Re: Tomcat and static content

Posted by Fredrik Viklund <fr...@biochem.kth.se>.
Kapil Sharma wrote:

> I have got a problem. I am using apache 1.3.26+tomcat 1.3.1. Is there
> any way to know that apache is serving all static content like
> .html/.gif/.jpeg? My virtual host (in apache) is running very slow and
> images are breaking..

I would try these things: (Bear in mind that I am a OpenBSD user and Tomcat
beginner, so this may be completely out of range.

1. Find the problem. Go directly to Tomcat (using its network port), without
passing through the Apache server. If this is faster, the problem is on the
Apache side, if it's still slow, the problem is on the Tomcat side.

2. If the problem is on Tomcat: Are the static pages also parsed by Tomcat. It
should be possible to set some extensions as static content and send them through
the server without parsing them for JSP code etc. I think this is defined in your
web.xml file. (I *said* I'm a beginner:-)

3. Anyway, if the problem can't be fixed in Tomcat, you could set your Apache to
forward only URL:s that end in .jsp to Tomcat.
I use URL rewriting to forward any http://jsp.my.server.com/url.html url to
http://my.server.com:8080/url.html
In that case you do the same, it is easy:
Modify your your Apache httpd.conf under the virutal hosts section for the Tomcat
server:
 RewriteEngine On
 RewriteCondition %{HTTP:Authorization} ^(.*)
 RewriteRule ^(.*\.jsp) http://your.server:8080$1
[e=HTTP_CGI_AUTHORIZATION:%1,t=application/x-httpd-cgi,l,P]

Then Authorization line is only needed if you are using logins or other features
that use HTTP authorization.
The last line is
 RewriteRule ^(.*) (etcetera)
if you want to forward everything to port 8080.

You will of course need to do "LoadModule rewrite_module
/usr/lib/apache/modules/mod_rewrite.so" or similar earlier in your httpd.conf,
but that is covered elsewhere in the Apache documentation.

Good luck.

    /Fredrik




--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>


RE: Tomcat and static content

Posted by Kapil Sharma <ks...@wishstream.com>.
Hi,
I can access the static web pages but it is very slow. Images are
loading very slow!!

kapil

-----Original Message-----
From: mls@VegInfo.com [mailto:mls@VegInfo.com] 
Sent: 07 July 2002 17:10
To: Tomcat Users List
Subject: Re: Tomcat and static content


Kapil Sharma wrote:
> Is there any way to know that apache is serving
> all static content like .html/.gif/.jpeg?

[ May be I am missing something fundamental in your question. ]

Can't you just access one of your static web pages from another computer
and see what you get? 

das

--
To unsubscribe, e-mail:
<ma...@jakarta.apache.org>
For additional commands, e-mail:
<ma...@jakarta.apache.org>




--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>


Re: Tomcat and static content

Posted by ml...@VegInfo.com.
Kapil Sharma wrote:
> Is there any way to know that apache is serving 
> all static content like .html/.gif/.jpeg?

[ May be I am missing something fundamental in your question. ]

Can't you just access one of your static web pages from another
computer and see what you get? 

das

--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>


RE: Tomcat and static content

Posted by Kapil Sharma <ks...@wishstream.com>.
Can someone answer it please...

kapil

-----Original Message-----
From: Kapil Sharma [mailto:ksharma@wishstream.com] 
Sent: 07 July 2002 00:03
To: 'Tomcat Users List'
Subject: Tomcat and static content


Hi,
I have got a problem. I am using apache 1.3.26+tomcat 1.3.1. Is there
any way to know that apache is serving all static content like
.html/.gif/.jpeg? My virtual host (in apache) is running very slow and
images are breaking..

Please help?

Cheers
kapil



--
To unsubscribe, e-mail:
<ma...@jakarta.apache.org>
For additional commands, e-mail:
<ma...@jakarta.apache.org>




--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>


Tomcat and static content

Posted by Kapil Sharma <ks...@wishstream.com>.
Hi,
I have got a problem. I am using apache 1.3.26+tomcat 1.3.1. Is there
any way to know that apache is serving all static content like
.html/.gif/.jpeg? My virtual host (in apache) is running very slow and
images are breaking..

Please help?

Cheers
kapil



--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>