Re: configuring tomcat on XP as a service

2005-05-04 Thread luke
Hi,

03May2005 @ 22:45 Greg Baynham thusly spake
 However, I have set the environment variables JAVA_HOME and PATH to both 
 reference my installation of the JSDK.  I have rebooted, but still get the 
Do the env var paths have spaces? 
Since I had a problem with that on windows once, I've made sure that all
subsequent installations had no spaces.
How about CATALINA_HOME?

Could help,
kind regards,
Luke
-- 
._
:|  .| |.|/.|_
:|__.|_|.|\.|_
:0421 276 282.

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: configuring tomcat on XP as a service

2005-05-04 Thread Dominik Drzewiecki
Greg Baynham [EMAIL PROTECTED] wrote:
 I'm getting tripped up trying to get tomcat to run JSP code when it's 
 installed as a service.  when I access a JSP page I get this error:
 
  root cause
 Unable to find a javac compiler;
 com.sun.tools.javac.Main is not on the classpath.
 Perhaps JAVA_HOME does not point to the JDK
 
 However, I have set the environment variables JAVA_HOME and PATH to both 
 
 reference my installation of the JSDK.  I have rebooted, but still get 
 the 
 error.
 
 specifics:
 tomcat 5.0.28
 windows XP home
 JAVA_HOME=C:\j2sdk1.4.2_06\bin
 PATH=%SystemRoot%\system32;%SystemRoot%;%SystemRoot%\System32\Wbem;C:\Pro
 gram Files\Common Files\Adaptec Shared\System;%JAVA_HOME%

JAVA_HOME should point to the very directory the jdk is installed into.
Set the JAVA_HOME=C:\j2sdk1.4.2_06
You might also want to update your PATH so that it contains %JAVA_HOME%\bin

Your env variables should look like that then:

JAVA_HOME=C:\j2sdk1.4.2_06
PATH=%SystemRoot%\system32;%SystemRoot%;%SystemRoot%\System32\Wbem;C:\Progr
am Files\Common Files\Adaptec Shared\System;%JAVA_HOME%\bin

This should make it work.

cheers,
/dd


-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



RE: Network Disk Not Exist Under Tomcat-5.5.9

2005-05-04 Thread Peter Crowther
 From: NanFei Wang [mailto:[EMAIL PROTECTED] 
 Why Network Disk Not Exist Under Tomcat-5.5.9 ?

Are you running Tomcat as a service?  If so, remember that drive
mappings (eg. mapping Y: to \\myserver\myshare) are user- and
session-specific.  You have mapped a drive as a user; the services on
your computer know nothing about this.

- Peter

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Amount of free disk space

2005-05-04 Thread Mark Benussi
I host my sites with a provider who supplied tomcat 5.0 on a UNIX platform.

 

Is there a Java API call I can make to detect how much disk space has been
allocated to my account and the current amount used?

 

 



RE: Amount of free disk space

2005-05-04 Thread Peter Crowther
 From: Mark Benussi [mailto:[EMAIL PROTECTED] 
 Is there a Java API call I can make to detect how much disk 
 space has been
 allocated to my account and the current amount used?

Depending on how hard they've nailed down the lid on Tomcat, you *might*
be able to invoke UNIX executables using Runtime.exec().  Then it's a
case of working out what quota program is on the machine - which in turn
depends on the UNIX version - and asking it.

An alternative would be to phone the service provider and ask how much
space has been allocated and used at one instant, and to write code to
traverse the filestore that contains your files counting up the file
sizes.  Add the constant for the difference between what you can see and
what they think you've used, and you have a usage checker that you can
re-run at any time.

- Peter

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: Network Disk Not Exist Under Tomcat-5.5.9

2005-05-04 Thread NanFei Wang
Dear Peter,
I have already mapped a Network Disk named 'Y'.

My question is :
If the webserver is Tomcat with ver.earlier than Tomcat-5.5.9(like 5.0.18),
Then the test.jsp will get Y:\ exists()=true
But with  Tomcat-5.5.9 ,the test.jsp will get Y:\ exists()=false

Thanks

- NanFei


- Original Message - 
From: Peter Crowther [EMAIL PROTECTED]
To: Tomcat Users List tomcat-user@jakarta.apache.org
Sent: Wednesday, May 04, 2005 3:59 PM
Subject: RE: Network Disk Not Exist Under Tomcat-5.5.9


 From: NanFei Wang [mailto:[EMAIL PROTECTED] 
 Why Network Disk Not Exist Under Tomcat-5.5.9 ?

Are you running Tomcat as a service?  If so, remember that drive
mappings (eg. mapping Y: to \\myserver\myshare) are user- and
session-specific.  You have mapped a drive as a user; the services on
your computer know nothing about this.

- Peter

-
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]



pdf not working

2005-05-04 Thread Maarten Janssen
Hi all,

Iam trying to call a link to a new window and that's calling a pdf document
thats somewhere in my folder under webapps.
The problem is that the pdf is not shown. If i try it with an image it will
be displayed correctly. I am using Tomcat 5.5.

Maarten
--
No virus found in this outgoing message.
Checked by AVG Anti-Virus.
Version: 7.0.308 / Virus Database: 266.11.3 - Release Date: 3-5-2005


-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: pdf not working

2005-05-04 Thread Parsons Technical Services
What browser are you using?
Doug
- Original Message - 
From: Maarten Janssen [EMAIL PROTECTED]
To: Tomcat User List tomcat-user@jakarta.apache.org
Sent: Wednesday, May 04, 2005 6:04 AM
Subject: pdf not working


Hi all,
Iam trying to call a link to a new window and that's calling a pdf 
document
thats somewhere in my folder under webapps.
The problem is that the pdf is not shown. If i try it with an image it 
will
be displayed correctly. I am using Tomcat 5.5.

Maarten
--
No virus found in this outgoing message.
Checked by AVG Anti-Virus.
Version: 7.0.308 / Virus Database: 266.11.3 - Release Date: 3-5-2005
-
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]


RE: pdf not working

2005-05-04 Thread Maarten Janssen
hI.

I am using internet explorer. The problem is when I open it as a file system
file (i.e. d:\etc..\x.pdf) it works.
But a relative path to a folder in my webapps it is NOT working.

Maarten

-Oorspronkelijk bericht-
Van: Parsons Technical Services [mailto:[EMAIL PROTECTED]
Verzonden: woensdag 4 mei 2005 13:20
Aan: Tomcat Users List
Onderwerp: Re: pdf not working


What browser are you using?

Doug


- Original Message -
From: Maarten Janssen [EMAIL PROTECTED]
To: Tomcat User List tomcat-user@jakarta.apache.org
Sent: Wednesday, May 04, 2005 6:04 AM
Subject: pdf not working


 Hi all,

 Iam trying to call a link to a new window and that's calling a pdf
 document
 thats somewhere in my folder under webapps.
 The problem is that the pdf is not shown. If i try it with an image it
 will
 be displayed correctly. I am using Tomcat 5.5.

 Maarten
 --
 No virus found in this outgoing message.
 Checked by AVG Anti-Virus.
 Version: 7.0.308 / Virus Database: 266.11.3 - Release Date: 3-5-2005


 -
 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]

--
No virus found in this incoming message.
Checked by AVG Anti-Virus.
Version: 7.0.308 / Virus Database: 266.11.3 - Release Date: 3-5-2005

--
No virus found in this outgoing message.
Checked by AVG Anti-Virus.
Version: 7.0.308 / Virus Database: 266.11.3 - Release Date: 3-5-2005


-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Tomcat5.5.9 + jdk1.5 HTTPS

2005-05-04 Thread Carlos Conde
Hello,

I'm trying to enable HTTPS with Tomcat5.5.9. Here is my connector description in
the server.xml file:

Connector port=8443
   minProcessors=5
   maxProcessors=75
   enableLookups=true
   disableUploadTimeout=true
   acceptCount=100
   debug=0
   scheme=https
   secure=true
   clientAuth=false
   sslProtocol=TLS
   keystoreFile=conf/ssl/keystore
   keystorePass=/

my keystore is valid, keys have been imported successfully (certificate from
Thawte).

New, when I try to connect to https://myserver:8443/, the browser show an error
saying he hasn't a common encryption algorithm with the server ...

any ideas ?




-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Help Basedir Error

2005-05-04 Thread Richard Reyes
Hi Guys,

Im trying to setup tomcat 5 on Fedora Core 3 and I keep on having this
BASEDIR error...

[EMAIL PROTECTED] ~]$ env | grep CATALINA
CATALINA_HOME=/home/sandman/jakarta-tomcat-5.0.28
CATALINA_BASE=/home/sandman/jakarta-tomcat-5.0.28
[EMAIL PROTECTED] ~]$ $CATALINA_HOME/bin/startup.sh
The BASEDIR environment variable is not defined correctly
This environment variable is needed to run this program
[EMAIL PROTECTED] ~]$

Please help...

Regards
Richard

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



SSL Connector with client auth in TC 5.5.9

2005-05-04 Thread Domenico Aquilino
We are switching to TC 5.5.9 in an embedded server.
In version 5.0.29, whe configured SSL with client auth as follows:
CoyoteConnector connector = new CoyoteConnector();
connector.setAddress( host );
connector.setPort( port );
connector.setSecure(true);
connector.setCiphers( 
SSL_RSA_WITH_RC4_128_MD5,SSL_RSA_WITH_3DES_EDE_CBC_SHA );
CoyoteServerSocketFactory factory = new CoyoteServerSocketFactory();
factory.setClientAuth( true );
factory.setKeystoreFile( keyStore );
factory.setKeystorePass( *** );
factory.setProtocol( TLS );
connector.setFactory( factory );

In 5.5.9 whe use
org.apache.catalina.connector.Connector connector;
connector = webServer.createConnector( host, port, true);
but we cannot find out how to set the Socket Factory for client auth.
Are we missing something with the new Connector class?
Thanks in advance
Domenico Aquilino

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]


StandardContext is added to host but won't start

2005-05-04 Thread Erik Hellman \(KA/EAB\)
I'm trying to create and deploy a StandardContext (i.e., a webapp) inside my 
Servlet: 

StandardContext theContext = new StandardContext()
theContext.setDisplayName(thePath);
theContext.setDocBase(myBaseDir + thePath);
theContext.setName(thePath);
theContext.setPath(thePath);
 
myHost.addChild(theContext);
 
theContext.start();

The webapp gets added and is displayed when I check the manager, but it won't 
start.
 
Any suggestions?
 
regards,
Erik
 
 



Re: pdf not working

2005-05-04 Thread Jay Hulslander
Just so I understand, file.jpg is hosted fine back to a browser.  File.pdf, 
in the same location, is not hosted back to the browser find.  Is that what 
you are experiencing?  Sounds like tomcat is configured to execute pdf 
documents as opposed to hosting them.  Much like you would configure a web 
server to execute streaming video as opposed to just hosting a video to be 
downloaded.  I do not know where this configuration is done in Tomcat, but 
that is where I would start.
-Jay
At 06:04 AM 5/4/2005, you wrote:
Hi all,
Iam trying to call a link to a new window and that's calling a pdf document
thats somewhere in my folder under webapps.
The problem is that the pdf is not shown. If i try it with an image it will
be displayed correctly. I am using Tomcat 5.5.
Maarten
--
No virus found in this outgoing message.
Checked by AVG Anti-Virus.
Version: 7.0.308 / Virus Database: 266.11.3 - Release Date: 3-5-2005
-
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]


Re: Network Disk Not Exist Under Tomcat-5.5.9

2005-05-04 Thread NanFei Wang
Hi,
I have found the solution as follow:
change tomcat service account:
Control Panel  Administrative Tools  Services
change tomcat service log on account: administrator

Now,it works.
the test.jsp will get Y:\ exists()=true

- NanFei

- Original Message - 
From: NanFei Wang [EMAIL PROTECTED]
To: Tomcat Users List tomcat-user@jakarta.apache.org
Sent: Wednesday, May 04, 2005 5:47 PM
Subject: Re: Network Disk Not Exist Under Tomcat-5.5.9


 Dear Peter,
 I have already mapped a Network Disk named 'Y'.

 My question is :
 If the webserver is Tomcat with ver.earlier than Tomcat-5.5.9(like
5.0.18),
 Then the test.jsp will get Y:\ exists()=true
 But with  Tomcat-5.5.9 ,the test.jsp will get Y:\ exists()=false

 Thanks

 - NanFei


 - Original Message - 
 From: Peter Crowther [EMAIL PROTECTED]
 To: Tomcat Users List tomcat-user@jakarta.apache.org
 Sent: Wednesday, May 04, 2005 3:59 PM
 Subject: RE: Network Disk Not Exist Under Tomcat-5.5.9


  From: NanFei Wang [mailto:[EMAIL PROTECTED]
  Why Network Disk Not Exist Under Tomcat-5.5.9 ?

 Are you running Tomcat as a service?  If so, remember that drive
 mappings (eg. mapping Y: to \\myserver\myshare) are user- and
 session-specific.  You have mapped a drive as a user; the services on
 your computer know nothing about this.

 - Peter

 -
 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]



-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Serving files using tomcat

2005-05-04 Thread Steve Vanspall
Hi,

I have been looking around and haven't found a solution that works

basically I have a PDF that gets created dynamically. Now to save memory I have 
the PDF written to a file rather than a ByteArray. The only way I can be sure 
that I wont encounter errors creating the file is to use File.createTempFile. 
The creation goes of ok. And I have checked the file itself and the PDF looks 
great.

How do i now serve this to the user who has requested it. If I try to write it 
to the response (using the same method I use to creare dynamic image, this 
works), it just shows up a blank screen. 

The problem also is, even if it did show the PDF, acrobat, to my understand 
will read only chunks of the stream and will go pack to get more. Thisis a 
problem because there is nothing to go back for.

So the point, 

If I can just redirect the browser to a file in the tomcat temp directory (can 
I do that, will the use have access to that directory), then how do I translate 
the location of the temp directory to a url that is accesible outside. 

If not then what other suggestions can people give me.

Thanks in advance

Steve

Re: pdf not working

2005-05-04 Thread Michael McQuade
I have the exact opposite of your problem,   and I have no idea why mine
works,  I want to display a PDF file in the Browser Window from a list of
documents. It may be JPG, DOC, BMP, PDF, whatever..  And then I want
to be able to VIEW the document FULL SCREEN, and send it out to WORD,  or
ADOBE, etc, depending on the document type.

A JPG or BMP  will display in my Browser when selected successfully and go
out to a separate window (I.E.)   successfully if I hit VIEW FULL SCREEN

a  PDF, will NOT display in my current browser window,  but if I hit VIEW
full screen it will go out to Adobe Reader,   which is what I want it to
do  I made NO changes to Tomcat to make this happen.

Mike


- Original Message - 
From: Maarten Janssen [EMAIL PROTECTED]
To: Tomcat User List tomcat-user@jakarta.apache.org
Sent: Wednesday, May 04, 2005 6:04 AM
Subject: pdf not working


 Hi all,

 Iam trying to call a link to a new window and that's calling a pdf
document
 thats somewhere in my folder under webapps.
 The problem is that the pdf is not shown. If i try it with an image it
will
 be displayed correctly. I am using Tomcat 5.5.

 Maarten
 --
 No virus found in this outgoing message.
 Checked by AVG Anti-Virus.
 Version: 7.0.308 / Virus Database: 266.11.3 - Release Date: 3-5-2005


 -
 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]



RE: pdf not working

2005-05-04 Thread David B. Saul
Here is what worked for me. The PDF is created dynamically.

1. a small bit of code which used FOP and served it as a stream. Be sure to
set the response type.

  byte[] fo;
  .
  .
  .
  InputSource fopInput = new InputSource( new ByteArrayInputStream( fo )
);
  ByteArrayOutputStream outStream = new ByteArrayOutputStream();
  Driver driver = new Driver( fopInput, outStream );
  driver.setLogger(log);
  driver.setRenderer(Driver.RENDER_PDF);
  driver.run();
  output = outStream.toByteArray();

  response.setContentType(application/pdf);
  response.resetBuffer();
  response.setContentLength(output.length);
  ServletOutputStream os = response.getOutputStream();
  os.write(output);
  os.close();

2. Also added to the URL at the end was the following:

pdf=.pdf\

   Can't remember where I found this idea, nor can I find it at this minute,
but it made it work.

hth,
Dave




-Original Message-
From: Jay Hulslander [mailto:[EMAIL PROTECTED] 
Sent: Wednesday, May 04, 2005 6:17 AM
To: Tomcat Users List
Subject: Re: pdf not working


Just so I understand, file.jpg is hosted fine back to a browser.  File.pdf, 
in the same location, is not hosted back to the browser find.  Is that what 
you are experiencing?  Sounds like tomcat is configured to execute pdf 
documents as opposed to hosting them.  Much like you would configure a web 
server to execute streaming video as opposed to just hosting a video to be 
downloaded.  I do not know where this configuration is done in Tomcat, but 
that is where I would start.
-Jay
At 06:04 AM 5/4/2005, you wrote:
Hi all,

Iam trying to call a link to a new window and that's calling a pdf 
document thats somewhere in my folder under webapps. The problem is 
that the pdf is not shown. If i try it with an image it will be 
displayed correctly. I am using Tomcat 5.5.

Maarten
--
No virus found in this outgoing message.
Checked by AVG Anti-Virus.
Version: 7.0.308 / Virus Database: 266.11.3 - Release Date: 3-5-2005


-
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]


-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



RE: pdf not working

2005-05-04 Thread Phillip Qin
I think your point 2 is more important. I found out that in IE, I have to
append .pdf somewhere in the url otherwise the ActiveX control that
interprets pdf simple wouldn't work. In my piece of work, I use
http://www.mydomain.com/myapp/statement.pdf?myquerystring... Mozilla/Firefox
has no such problem.

-Original Message-
From: David B. Saul [mailto:[EMAIL PROTECTED] 
Sent: May 4, 2005 12:51 PM
To: 'Tomcat Users List'
Subject: RE: pdf not working


Here is what worked for me. The PDF is created dynamically.

1. a small bit of code which used FOP and served it as a stream. Be sure to
set the response type.

  byte[] fo;
  .
  .
  .
  InputSource fopInput = new InputSource( new ByteArrayInputStream( fo )
);
  ByteArrayOutputStream outStream = new ByteArrayOutputStream();
  Driver driver = new Driver( fopInput, outStream );
  driver.setLogger(log);
  driver.setRenderer(Driver.RENDER_PDF);
  driver.run();
  output = outStream.toByteArray();

  response.setContentType(application/pdf);
  response.resetBuffer();
  response.setContentLength(output.length);
  ServletOutputStream os = response.getOutputStream();
  os.write(output);
  os.close();

2. Also added to the URL at the end was the following:

pdf=.pdf\

   Can't remember where I found this idea, nor can I find it at this minute,
but it made it work.

hth,
Dave




-Original Message-
From: Jay Hulslander [mailto:[EMAIL PROTECTED] 
Sent: Wednesday, May 04, 2005 6:17 AM
To: Tomcat Users List
Subject: Re: pdf not working


Just so I understand, file.jpg is hosted fine back to a browser.  File.pdf, 
in the same location, is not hosted back to the browser find.  Is that what 
you are experiencing?  Sounds like tomcat is configured to execute pdf 
documents as opposed to hosting them.  Much like you would configure a web 
server to execute streaming video as opposed to just hosting a video to be 
downloaded.  I do not know where this configuration is done in Tomcat, but 
that is where I would start.
-Jay
At 06:04 AM 5/4/2005, you wrote:
Hi all,

Iam trying to call a link to a new window and that's calling a pdf
document thats somewhere in my folder under webapps. The problem is 
that the pdf is not shown. If i try it with an image it will be 
displayed correctly. I am using Tomcat 5.5.

Maarten
--
No virus found in this outgoing message.
Checked by AVG Anti-Virus.
Version: 7.0.308 / Virus Database: 266.11.3 - Release Date: 3-5-2005


-
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]


-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]


!DSPAM:4278d3bc82251395011244!


BadPaddingException revisited

2005-05-04 Thread Faine, Mark
 
 
Is a keystore required to use PKCS12 ssl certs with Tomcat 5?  I'm trying
(once again) to convert a cert issued for Apache (OpenSSL) to a pkcs12 for
Tomcat but I keep getting the following error:
 
 Protocol handler start failed: java.io.IOException: failed to decrypt safe
contents entry: javax.crypto.BadPaddingException: Given final block not
properly padded...
 
I've  had this problem before and was able to overcome it though I don't
know how.  I don't know what I did to get it working last time and I'm
hoping I can once and for all determine the cause of this error so that I
will not have to go through this again.
 
I've been trying the following openssl command to convert the cert
 
openssl pkcs12 -export -in mycert.cer -inkey mykey.key -out cert.p12 -name
tomcat -CAfile entrust_ssl_ca.cer -caname root -chain
 
I'd appreciate any help I could get on this issue.
 
Thanks,
-Mark
 


RE: pdf not working

2005-05-04 Thread David B. Saul
Yes - I did some looking on the MS site and found that the earlier IE
browsers were making three requests while 5.5 makes two. Haven't found what
6 is doing. But setting the response type, length, adding the pdf=.pdf\
works. In addition the same kind of thing helped with SVG - but slightly
different - (i.e. MIME=image/svg) as part of the URL.

You comment about the ActiveX is important as well according to what I found
searching MS. 

-Original Message-
From: Phillip Qin [mailto:[EMAIL PROTECTED] 
Sent: Wednesday, May 04, 2005 7:25 AM
To: 'Tomcat Users List'
Subject: RE: pdf not working


I think your point 2 is more important. I found out that in IE, I have to
append .pdf somewhere in the url otherwise the ActiveX control that
interprets pdf simple wouldn't work. In my piece of work, I use
http://www.mydomain.com/myapp/statement.pdf?myquerystring... Mozilla/Firefox
has no such problem.

-Original Message-
From: David B. Saul [mailto:[EMAIL PROTECTED] 
Sent: May 4, 2005 12:51 PM
To: 'Tomcat Users List'
Subject: RE: pdf not working


Here is what worked for me. The PDF is created dynamically.

1. a small bit of code which used FOP and served it as a stream. Be sure to
set the response type.

  byte[] fo;
  .
  .
  .
  InputSource fopInput = new InputSource( new ByteArrayInputStream( fo )
);
  ByteArrayOutputStream outStream = new ByteArrayOutputStream();
  Driver driver = new Driver( fopInput, outStream );
  driver.setLogger(log);
  driver.setRenderer(Driver.RENDER_PDF);
  driver.run();
  output = outStream.toByteArray();

  response.setContentType(application/pdf);
  response.resetBuffer();
  response.setContentLength(output.length);
  ServletOutputStream os = response.getOutputStream();
  os.write(output);
  os.close();

2. Also added to the URL at the end was the following:

pdf=.pdf\

   Can't remember where I found this idea, nor can I find it at this minute,
but it made it work.

hth,
Dave




-Original Message-
From: Jay Hulslander [mailto:[EMAIL PROTECTED] 
Sent: Wednesday, May 04, 2005 6:17 AM
To: Tomcat Users List
Subject: Re: pdf not working


Just so I understand, file.jpg is hosted fine back to a browser.  File.pdf, 
in the same location, is not hosted back to the browser find.  Is that what 
you are experiencing?  Sounds like tomcat is configured to execute pdf 
documents as opposed to hosting them.  Much like you would configure a web 
server to execute streaming video as opposed to just hosting a video to be 
downloaded.  I do not know where this configuration is done in Tomcat, but 
that is where I would start.
-Jay
At 06:04 AM 5/4/2005, you wrote:
Hi all,

Iam trying to call a link to a new window and that's calling a pdf 
document thats somewhere in my folder under webapps. The problem is 
that the pdf is not shown. If i try it with an image it will be 
displayed correctly. I am using Tomcat 5.5.

Maarten
--
No virus found in this outgoing message.
Checked by AVG Anti-Virus.
Version: 7.0.308 / Virus Database: 266.11.3 - Release Date: 3-5-2005


-
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]


-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]


!DSPAM:4278d3bc82251395011244!


-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: Serving files using tomcat

2005-05-04 Thread Anhony
Greetings,
Take a look at the code fragment below. It should serve as a good starting 
point.
I hope this helps.

AS-
   private void processPDFRequest(HttpServletRequest request, 
HttpServletResponse response) throws ServletException, IOException, 
Exception
   {
   int bytesCopied = 0;

   FileInputStream fin = null;
   OutputStream out = null;
   String fileAddress = The fully qualified path to your PDF file;
   if( fileAddress == null )
   return;
   int ext = fileAddress.lastIndexOf( '.' );
   if( ext != -1 )
   {
   ext = fileAddress.substring( ext+1, 
fileAddress.length() ).toLowerCase();

   if( ext == pdf )
   response.setContentType(application/pdf);
   else
   Do whatever you think best to do
   }
   else
   Do whatever you think best to do
   try
   {
   out = response.getOutputStream();
   fin = new FileInputStream( fileAddress );
   bytesCopied = StreamCopier.copy( fin, out );
   }
   finally
   {
   if( fin != null )
   fin.close();
   if( out != null )
   {
   out.flush();
   out.close();
   }
   }
   }
- Original Message - 
From: Steve Vanspall [EMAIL PROTECTED]
To: Tomcat User List tomcat-user@jakarta.apache.org
Sent: Wednesday, May 04, 2005 9:29 AM
Subject: Serving files using tomcat

Hi,
I have been looking around and haven't found a solution that works
basically I have a PDF that gets created dynamically. Now to save memory I 
have the PDF written to a file rather than a ByteArray. The only way I can 
be sure that I wont encounter errors creating the file is to use 
File.createTempFile. The creation goes of ok. And I have checked the file 
itself and the PDF looks great.

How do i now serve this to the user who has requested it. If I try to write 
it to the response (using the same method I use to creare dynamic image, 
this works), it just shows up a blank screen.

The problem also is, even if it did show the PDF, acrobat, to my understand 
will read only chunks of the stream and will go pack to get more. Thisis a 
problem because there is nothing to go back for.

So the point,
If I can just redirect the browser to a file in the tomcat temp directory 
(can I do that, will the use have access to that directory), then how do I 
translate the location of the temp directory to a url that is accesible 
outside.

If not then what other suggestions can people give me.
Thanks in advance
Steve 


-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]


Multiple Server With Tomcat

2005-05-04 Thread Farid Izem
Hi All,

This is the first time, i'm trying to configure Tomcat.
I'm currently using Tomcat 5.0.28 / Java 1.4.2.
I'have written my own server.xml regarding 
Tomcat Documentation at jakarta.apache.org.

this is what i have done : 

Server className=org.apache.catalina.core.StandardServer
port=8015 shutdown=SHUTDOWN
Listener
className=org.apache.catalina.mbeans.ServerLifecycleListener
debug=0/
Listener
className=org.apache.catalina.mbeans.GlobalResourcesLifecycleListener
debug=0/

Service name=Catalina
Connector port=8080 maxThreads=150
minSpareThreads=25 maxSpareThreads=75
enableLookups=false redirectPort=8443
acceptCount=100 debug=0
connectionTimeout=2
disableUploadTimeout=true compression=on
compressionMinSize=2048
noCompressionUserAgents=gozilla, traviata
compressableMimeType=text/html,text/xml/

Engine name=StandAlone-Catalina
backgroundProcessorDelay=-1 defaultHost=localhost debug=0
Valve
className=org.apache.catalina.valves.AccessLogValve
prefix=Catalina_access_log
suffix=.txt directory=logs rotatable=true
/Valve

Logger
className=org.apache.catalina.logger.FileLogger
directory=logs
prefix=Catalina_access_log suffix=.txt timestamp=true/

  Host name=localhost debug=0 appBase=webapps unpackWARs=true 
 autoDeploy=true xmlValidation=false
xmlNamespaceAware=false
   Context className=org.apache.catalina.core.StandardContext
path=/jsp-examples/
   Context className=org.apache.catalina.core.StandardContext
path=/servlets-examples/
   Context className=org.apache.catalina.core.StandardContext
path=/webdav/
   Context className=org.apache.catalina.core.StandardContext
path=/tomcat-docs/
   Context className=org.apache.catalina.core.StandardContext
path=/ROOT/
 /Host
   /Engine 
  /Service
/Server

This works fine and i can browse the Tomcat examples.

What i want to do now is to use the following server.xml file which
declare 2 Tomcat Servers :

Server className=org.apache.catalina.core.StandardServer
port=8015 shutdown=SHUTDOWN
Listener
className=org.apache.catalina.mbeans.ServerLifecycleListener
debug=0/
Listener
className=org.apache.catalina.mbeans.GlobalResourcesLifecycleListener
debug=0/

Service name=Catalina
Connector port=8080 maxThreads=150
minSpareThreads=25 maxSpareThreads=75
enableLookups=false redirectPort=8443
acceptCount=100 debug=0
connectionTimeout=2
disableUploadTimeout=true compression=on
compressionMinSize=2048
noCompressionUserAgents=gozilla, traviata
compressableMimeType=text/html,text/xml/

Engine name=StandAlone-Catalina
backgroundProcessorDelay=-1 defaultHost=localhost debug=0
Valve
className=org.apache.catalina.valves.AccessLogValve
prefix=Catalina_access_log
suffix=.txt directory=logs rotatable=true
/Valve

Logger
className=org.apache.catalina.logger.FileLogger
directory=logs
prefix=Catalina_access_log suffix=.txt timestamp=true/

Host name=localhost debug=0
appBase=webapps unpackWARs=true
autoDeploy=true
xmlValidation=false xmlNamespaceAware=false
Context
className=org.apache.catalina.core.StandardContext
path=/jsp-examples/
Context
className=org.apache.catalina.core.StandardContext
path=/servlets-examples/
Context
className=org.apache.catalina.core.StandardContext path=/webdav/
Context
className=org.apache.catalina.core.StandardContext
path=/tomcat-docs/
Context
className=org.apache.catalina.core.StandardContext path=/ROOT/
/Host
/Engine 
/Service
/Server

Server className=org.apache.catalina.core.StandardServer
port=8016 shutdown=SHUTDOWN
Listener
className=org.apache.catalina.mbeans.ServerLifecycleListener
debug=0/
Listener
className=org.apache.catalina.mbeans.GlobalResourcesLifecycleListener
debug=0/

Service name=Angelina
Connector port=8181 maxThreads=150
minSpareThreads=25 maxSpareThreads=75
enableLookups=false redirectPort=8444
acceptCount=100 debug=0
connectionTimeout=2
disableUploadTimeout=true compression=on
compressionMinSize=2048
noCompressionUserAgents=gozilla, traviata
compressableMimeType=text/html,text/xml/

Engine 

Tomcat v5.0.28 has memory leaking?

2005-05-04 Thread Gary Shi
Tomcat v5.0.28 has memory leaking Problem ?

My environment:

Win2000 with SP4

380M Ram

Intel(R)ieo

2.8 GHz

Tomcat v5.0.28

Axia-1-2RC3

JDBC Driver to SQL-Server2000

We have a small web services to be hosted in Tomcat .

Problem:

When we send request to web services for 10 hours non-stop, we got Java
heap out of memory.=20 Then, we set initial memory as 128M and max
memory 256M (java -Xms128m -Xmx256 ...) After 20 hours runing I got out
of memory and out of Java heap space. tomcat stop. Tomcat v5.0.28 has
memory leaking Problem ? How to handle it ?

thanks for your help

gary



RE: SSL, Form Authentication 408 error

2005-05-04 Thread Andrew Chapman
I have resolved this problem, and as is so often is the case (certainly with
me anyway) the cause of this wasn't what it initially appeared. Anyway I
thought I'd share my findings in case anyone else came across this problem.

This is an IE specific problem relating to IFRAMES and nothing to do with
Tomcat.

A look at the AuthenticatorBase code lead me to believe the only thing that
could actually cause the 408 is if the session could not be located. This is
looked up from the session id in the request. It was a fair guess that
something was happening to the session id cookie when the request came as
the result of an IFRAME.

A little investigation with the Privacy controls in IE fixed the problem. It
seems the cookie settings are different to pages in IFRAMES than top level
pages. In order to get this working the global privacy level must be dropped
(specifically to Always allow session cookies) or (probably more
advisable) add the app url to the Manged Sites from the Advanced tab with
Always Allow

-Original Message-
From: Andrew Chapman [mailto:[EMAIL PROTECTED] 
Sent: 03 May 2005 10:29
To: tomcat-user@jakarta.apache.org
Subject: SSL, Form Authentication 408 error

If I set the src of an IFRAME to my web application, which uses Form
Authentication and SSL, the server consistently throws back a 408 error in
IE when attempting to log in. The same scenario consistently works with
Firefox.

I suspect there are timing issues with IE, IFRAMEs and Form Authentication
causing the 408. I have searched the archives without success and a more
general search seems to indicate that there are issues with IFRAMEs and SSL
in IE but no specifics.

My question is: Does anyone know of a way to configure Tomcat (5.0.28) to be
more resilient/permissive i.e. to increase the timeout for Form
Authentication before a 408 error is thrown?

Thanks in advance

Andy Chapman



-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: Tomcat v5.0.28 has memory leaking?

2005-05-04 Thread Jason Bainbridge
On 5/4/05, Gary Shi [EMAIL PROTECTED] wrote:
 Tomcat v5.0.28 has memory leaking Problem ?
 
 My environment:
 
 Win2000 with SP4
 
 380M Ram
 
 Intel(R)ieo
 
 2.8 GHz
 
 Tomcat v5.0.28
 
 Axia-1-2RC3
 
 JDBC Driver to SQL-Server2000
 
 We have a small web services to be hosted in Tomcat .
 
 Problem:
 
 When we send request to web services for 10 hours non-stop, we got Java
 heap out of memory.=20 Then, we set initial memory as 128M and max
 memory 256M (java -Xms128m -Xmx256 ...) After 20 hours runing I got out
 of memory and out of Java heap space. tomcat stop. Tomcat v5.0.28 has
 memory leaking Problem ? How to handle it ?

Problem is more than likely with your web application and not Tomcat,
use a profiler such as jProfiler -
http://www.ej-technologies.com/products/jprofiler/overview.html to
find the leak.

Regards,
-- 
Jason Bainbridge
http://kde.org - [EMAIL PROTECTED]
Personal Site - http://jasonbainbridge.com

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Admin Application doesn't save correctly - Tomcat 5.5.7

2005-05-04 Thread Ankit Shah
Hi,
We are experiencing a strange problem with the Tomcat admin utility. Upon 
clicking 'Commit Changes', NOT ALL options are written out to the 
server.xml file !! Here is the tag that was messed up:

Before:
Connector port=4443 maxThreads=40 minSpareThreads=10 
maxSpareThreads=25 enableLookups=false disableUploadTimeout=true 
acceptCount=10 debug=0 scheme=https secure=true keystorePass=
 keystoreFile=C:\path\to\certificate\file clientAuth=false 
sslProtocol=TLS / 

After:
Connector port=4443 scheme=https secure=true / 

The only changes we did were to add an environment variable for tomcat.

Tomcat Configuration in use:
Tomcat version: 5.5.7 with 1.4.2 compatibility kit
Platform: Win2K
JRE: 1.4.2_05

If anyone has any suggestions/clues as to why this is happenning, please 
do let us know. Also has anyone else encountered similar problems which 
they can share with us for our information, that would be great.

Thanks in advance,
Ankit

Re: Serving files using tomcat

2005-05-04 Thread Steve Vanspall
Unfortunately that is what I do

OutputStream dos = null;
FileInputStream fis = null;
   try
   {
fis = new FileInputStream(rf.getPdf());
response.setContentType(application/pdf);
response.setContentLength((int) rf.getPdf().length());
//response.setHeader(response.)
dos = response.getOutputStream();

int read = -1;
byte[] bytes = new byte[10];
while((read = fis.read(bytes)) != -1)
 dos.write(bytes, 0, read);
dos.flush();
return mapping.findForward(PDF);
   } catch (Exception e)
   {
// TODO Auto-generated catch block
if(e instanceof SocketException)
 return mapping.findForward(reload);
throw new IOException(e.toString());
   }
   finally
   {

if(dos != null)
 dos.close();
if(fis != null)
 fis.close();


   }

Acrobat now loads but the PDF doesn't appear.

Probably worth mentioning that I use struts, so I forward to a blank page
with the content type set to application/pdf, maybe that is the problem, but
not sure what else to do with the return.

When I do the same thing with a dynamic image and forward to a page with a
jpg content type, the image appears without a problem.

Steve
- Original Message -
From: Anhony [EMAIL PROTECTED]
To: Tomcat Users List tomcat-user@jakarta.apache.org
Sent: Thursday, May 05, 2005 1:02 AM
Subject: Re: Serving files using tomcat


 Greetings,

 Take a look at the code fragment below. It should serve as a good starting
 point.
 I hope this helps.

 AS-

 private void processPDFRequest(HttpServletRequest request,
 HttpServletResponse response) throws ServletException, IOException,
 Exception
 {
 int bytesCopied = 0;

 FileInputStream fin = null;
 OutputStream out = null;

 String fileAddress = The fully qualified path to your PDF file;
 if( fileAddress == null )
 return;

 int ext = fileAddress.lastIndexOf( '.' );
 if( ext != -1 )
 {
 ext = fileAddress.substring( ext+1,
 fileAddress.length() ).toLowerCase();

 if( ext == pdf )
 response.setContentType(application/pdf);
 else
 Do whatever you think best to do
 }
 else
 Do whatever you think best to do

 try
 {
 out = response.getOutputStream();
 fin = new FileInputStream( fileAddress );
 bytesCopied = StreamCopier.copy( fin, out );
 }
 finally
 {
 if( fin != null )
 fin.close();
 if( out != null )
 {
 out.flush();
 out.close();
 }
 }
 }


 - Original Message -
 From: Steve Vanspall [EMAIL PROTECTED]
 To: Tomcat User List tomcat-user@jakarta.apache.org
 Sent: Wednesday, May 04, 2005 9:29 AM
 Subject: Serving files using tomcat


 Hi,

 I have been looking around and haven't found a solution that works

 basically I have a PDF that gets created dynamically. Now to save memory I
 have the PDF written to a file rather than a ByteArray. The only way I can
 be sure that I wont encounter errors creating the file is to use
 File.createTempFile. The creation goes of ok. And I have checked the file
 itself and the PDF looks great.

 How do i now serve this to the user who has requested it. If I try to
write
 it to the response (using the same method I use to creare dynamic image,
 this works), it just shows up a blank screen.

 The problem also is, even if it did show the PDF, acrobat, to my
understand
 will read only chunks of the stream and will go pack to get more. Thisis a
 problem because there is nothing to go back for.

 So the point,

 If I can just redirect the browser to a file in the tomcat temp directory
 (can I do that, will the use have access to that directory), then how do I
 translate the location of the temp directory to a url that is accesible
 outside.

 If not then what other suggestions can people give me.

 Thanks in advance

 Steve



 -
 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]



Tomcat server memory optimization

2005-05-04 Thread =?iso-8859-1?Q?Ac=E1cio_Furtado_Costa?=
I read an article about Considering the server VM. 
 
In this article I realize the JVM (Sun´s) actually contains different VM inside 
the binary that´s executed to start up Java applications: the Client and The 
Server VM.
 
The server VM trades priorities for emphasis on greater scalability for 
server-type apllications and the Client VM priorize startup time and minimizing 
latency of GC. 
 
BY default, Java uses the client VM and It recommends  to passing the  - 
server command-line option to the java VM on startup.
 
Does anyone used and know, how to pass this parameter to use with Tomcat 5.0.x 
? and what´s result reached? 
 
TIA
 

Acacio Furtado Costa
Pesquisa e Tecnologia

GIA - Magnesita S/A
*  [EMAIL PROTECTED]

 


RE: pdf not working

2005-05-04 Thread Diogo Quintela \(EF\)
Hello

Try adding the following any of the following response headers:
Content-Type, application/pdf
And any of the follwing..
Content-disposition,inline; filename=example.pdf
Content-disposition,attachment; filename=example.pdf
Content-disposition,filename= example.pdf


Diogo Quintela

@see http://support.microsoft.com/support/kb/articles/Q260/5/19.ASP
@see http://support.microsoft.com/support/kb/articles/Q279/6/67.ASP

-Original Message-
From: Phillip Qin [mailto:[EMAIL PROTECTED] 
Sent: quarta-feira, 4 de Maio de 2005 15:25
To: 'Tomcat Users List'
Subject: RE: pdf not working

I think your point 2 is more important. I found out that in IE, I have to
append .pdf somewhere in the url otherwise the ActiveX control that
interprets pdf simple wouldn't work. In my piece of work, I use
http://www.mydomain.com/myapp/statement.pdf?myquerystring... Mozilla/Firefox
has no such problem.

-Original Message-
From: David B. Saul [mailto:[EMAIL PROTECTED] 
Sent: May 4, 2005 12:51 PM
To: 'Tomcat Users List'
Subject: RE: pdf not working


Here is what worked for me. The PDF is created dynamically.

1. a small bit of code which used FOP and served it as a stream. Be sure to
set the response type.

  byte[] fo;
  .
  .
  .
  InputSource fopInput = new InputSource( new ByteArrayInputStream( fo )
);
  ByteArrayOutputStream outStream = new ByteArrayOutputStream();
  Driver driver = new Driver( fopInput, outStream );
  driver.setLogger(log);
  driver.setRenderer(Driver.RENDER_PDF);
  driver.run();
  output = outStream.toByteArray();

  response.setContentType(application/pdf);
  response.resetBuffer();
  response.setContentLength(output.length);
  ServletOutputStream os = response.getOutputStream();
  os.write(output);
  os.close();

2. Also added to the URL at the end was the following:

pdf=.pdf\

   Can't remember where I found this idea, nor can I find it at this minute,
but it made it work.

hth,
Dave




-Original Message-
From: Jay Hulslander [mailto:[EMAIL PROTECTED] 
Sent: Wednesday, May 04, 2005 6:17 AM
To: Tomcat Users List
Subject: Re: pdf not working


Just so I understand, file.jpg is hosted fine back to a browser.  File.pdf, 
in the same location, is not hosted back to the browser find.  Is that what 
you are experiencing?  Sounds like tomcat is configured to execute pdf 
documents as opposed to hosting them.  Much like you would configure a web 
server to execute streaming video as opposed to just hosting a video to be 
downloaded.  I do not know where this configuration is done in Tomcat, but 
that is where I would start.
-Jay
At 06:04 AM 5/4/2005, you wrote:
Hi all,

Iam trying to call a link to a new window and that's calling a pdf
document thats somewhere in my folder under webapps. The problem is 
that the pdf is not shown. If i try it with an image it will be 
displayed correctly. I am using Tomcat 5.5.

Maarten
--
No virus found in this outgoing message.
Checked by AVG Anti-Virus.
Version: 7.0.308 / Virus Database: 266.11.3 - Release Date: 3-5-2005


-
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]


-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]


!DSPAM:4278d3bc82251395011244!


-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



RE: pdf not working

2005-05-04 Thread Diogo Quintela \(EF\)
Next time I promise I'll read it before clicking Send. :-)
Diogo

-Original Message-
From: Diogo Quintela (EF) [mailto:[EMAIL PROTECTED] 
Sent: quarta-feira, 4 de Maio de 2005 17:01
To: 'Tomcat Users List'
Subject: RE: pdf not working

Hello

Try adding the following any of the following response headers:
Content-Type, application/pdf
And any of the follwing..
Content-disposition,inline; filename=example.pdf
Content-disposition,attachment; filename=example.pdf
Content-disposition,filename= example.pdf


Diogo Quintela

@see http://support.microsoft.com/support/kb/articles/Q260/5/19.ASP
@see http://support.microsoft.com/support/kb/articles/Q279/6/67.ASP

-Original Message-
From: Phillip Qin [mailto:[EMAIL PROTECTED] 
Sent: quarta-feira, 4 de Maio de 2005 15:25
To: 'Tomcat Users List'
Subject: RE: pdf not working

I think your point 2 is more important. I found out that in IE, I have to
append .pdf somewhere in the url otherwise the ActiveX control that
interprets pdf simple wouldn't work. In my piece of work, I use
http://www.mydomain.com/myapp/statement.pdf?myquerystring... Mozilla/Firefox
has no such problem.

-Original Message-
From: David B. Saul [mailto:[EMAIL PROTECTED] 
Sent: May 4, 2005 12:51 PM
To: 'Tomcat Users List'
Subject: RE: pdf not working


Here is what worked for me. The PDF is created dynamically.

1. a small bit of code which used FOP and served it as a stream. Be sure to
set the response type.

  byte[] fo;
  .
  .
  .
  InputSource fopInput = new InputSource( new ByteArrayInputStream( fo )
);
  ByteArrayOutputStream outStream = new ByteArrayOutputStream();
  Driver driver = new Driver( fopInput, outStream );
  driver.setLogger(log);
  driver.setRenderer(Driver.RENDER_PDF);
  driver.run();
  output = outStream.toByteArray();

  response.setContentType(application/pdf);
  response.resetBuffer();
  response.setContentLength(output.length);
  ServletOutputStream os = response.getOutputStream();
  os.write(output);
  os.close();

2. Also added to the URL at the end was the following:

pdf=.pdf\

   Can't remember where I found this idea, nor can I find it at this minute,
but it made it work.

hth,
Dave




-Original Message-
From: Jay Hulslander [mailto:[EMAIL PROTECTED] 
Sent: Wednesday, May 04, 2005 6:17 AM
To: Tomcat Users List
Subject: Re: pdf not working


Just so I understand, file.jpg is hosted fine back to a browser.  File.pdf, 
in the same location, is not hosted back to the browser find.  Is that what 
you are experiencing?  Sounds like tomcat is configured to execute pdf 
documents as opposed to hosting them.  Much like you would configure a web 
server to execute streaming video as opposed to just hosting a video to be 
downloaded.  I do not know where this configuration is done in Tomcat, but 
that is where I would start.
-Jay
At 06:04 AM 5/4/2005, you wrote:
Hi all,

Iam trying to call a link to a new window and that's calling a pdf
document thats somewhere in my folder under webapps. The problem is 
that the pdf is not shown. If i try it with an image it will be 
displayed correctly. I am using Tomcat 5.5.

Maarten
--
No virus found in this outgoing message.
Checked by AVG Anti-Virus.
Version: 7.0.308 / Virus Database: 266.11.3 - Release Date: 3-5-2005


-
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]


-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]


!DSPAM:4278d3bc82251395011244!


-
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]



RE: Serving files using tomcat

2005-05-04 Thread Phillip Qin
Code should work. Also read email between Daivd and mine. .pdf has to be
appended for IE to load pdf.

-Original Message-
From: Steve Vanspall [mailto:[EMAIL PROTECTED] 
Sent: May 4, 2005 11:48 AM
To: Tomcat Users List
Subject: Re: Serving files using tomcat


Unfortunately that is what I do

OutputStream dos = null;
FileInputStream fis = null;
   try
   {
fis = new FileInputStream(rf.getPdf());
response.setContentType(application/pdf);
response.setContentLength((int) rf.getPdf().length());
//response.setHeader(response.)
dos = response.getOutputStream();

int read = -1;
byte[] bytes = new byte[10];
while((read = fis.read(bytes)) != -1)
 dos.write(bytes, 0, read);
dos.flush();
return mapping.findForward(PDF);
   } catch (Exception e)
   {
// TODO Auto-generated catch block
if(e instanceof SocketException)
 return mapping.findForward(reload);
throw new IOException(e.toString());
   }
   finally
   {

if(dos != null)
 dos.close();
if(fis != null)
 fis.close();


   }

Acrobat now loads but the PDF doesn't appear.

Probably worth mentioning that I use struts, so I forward to a blank page
with the content type set to application/pdf, maybe that is the problem, but
not sure what else to do with the return.

When I do the same thing with a dynamic image and forward to a page with a
jpg content type, the image appears without a problem.

Steve
- Original Message -
From: Anhony [EMAIL PROTECTED]
To: Tomcat Users List tomcat-user@jakarta.apache.org
Sent: Thursday, May 05, 2005 1:02 AM
Subject: Re: Serving files using tomcat


 Greetings,

 Take a look at the code fragment below. It should serve as a good 
 starting point. I hope this helps.

 AS-

 private void processPDFRequest(HttpServletRequest request, 
 HttpServletResponse response) throws ServletException, IOException, 
 Exception
 {
 int bytesCopied = 0;

 FileInputStream fin = null;
 OutputStream out = null;

 String fileAddress = The fully qualified path to your PDF file;
 if( fileAddress == null )
 return;

 int ext = fileAddress.lastIndexOf( '.' );
 if( ext != -1 )
 {
 ext = fileAddress.substring( ext+1,
 fileAddress.length() ).toLowerCase();

 if( ext == pdf )
 response.setContentType(application/pdf);
 else
 Do whatever you think best to do
 }
 else
 Do whatever you think best to do

 try
 {
 out = response.getOutputStream();
 fin = new FileInputStream( fileAddress );
 bytesCopied = StreamCopier.copy( fin, out );
 }
 finally
 {
 if( fin != null )
 fin.close();
 if( out != null )
 {
 out.flush();
 out.close();
 }
 }
 }


 - Original Message -
 From: Steve Vanspall [EMAIL PROTECTED]
 To: Tomcat User List tomcat-user@jakarta.apache.org
 Sent: Wednesday, May 04, 2005 9:29 AM
 Subject: Serving files using tomcat


 Hi,

 I have been looking around and haven't found a solution that works

 basically I have a PDF that gets created dynamically. Now to save 
 memory I have the PDF written to a file rather than a ByteArray. The 
 only way I can be sure that I wont encounter errors creating the file 
 is to use File.createTempFile. The creation goes of ok. And I have 
 checked the file itself and the PDF looks great.

 How do i now serve this to the user who has requested it. If I try to
write
 it to the response (using the same method I use to creare dynamic 
 image, this works), it just shows up a blank screen.

 The problem also is, even if it did show the PDF, acrobat, to my
understand
 will read only chunks of the stream and will go pack to get more. 
 Thisis a problem because there is nothing to go back for.

 So the point,

 If I can just redirect the browser to a file in the tomcat temp 
 directory (can I do that, will the use have access to that directory), 
 then how do I translate the location of the temp directory to a url 
 that is accesible outside.

 If not then what other suggestions can people give me.

 Thanks in advance

 Steve



 -
 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]


!DSPAM:4278f10a96891759557146!


RE: pdf not working

2005-05-04 Thread Phillip Qin
Has Content-Disposition become standard or just a recommendation?

-Original Message-
From: Diogo Quintela (EF) [mailto:[EMAIL PROTECTED] 
Sent: May 4, 2005 12:10 PM
To: 'Tomcat Users List'
Subject: RE: pdf not working


Next time I promise I'll read it before clicking Send. :-) Diogo

-Original Message-
From: Diogo Quintela (EF) [mailto:[EMAIL PROTECTED] 
Sent: quarta-feira, 4 de Maio de 2005 17:01
To: 'Tomcat Users List'
Subject: RE: pdf not working

Hello

Try adding the following any of the following response headers:
Content-Type, application/pdf And any of the follwing..
Content-disposition,inline; filename=example.pdf
Content-disposition,attachment; filename=example.pdf
Content-disposition,filename= example.pdf


Diogo Quintela

@see http://support.microsoft.com/support/kb/articles/Q260/5/19.ASP
@see http://support.microsoft.com/support/kb/articles/Q279/6/67.ASP

-Original Message-
From: Phillip Qin [mailto:[EMAIL PROTECTED] 
Sent: quarta-feira, 4 de Maio de 2005 15:25
To: 'Tomcat Users List'
Subject: RE: pdf not working

I think your point 2 is more important. I found out that in IE, I have to
append .pdf somewhere in the url otherwise the ActiveX control that
interprets pdf simple wouldn't work. In my piece of work, I use
http://www.mydomain.com/myapp/statement.pdf?myquerystring... Mozilla/Firefox
has no such problem.

-Original Message-
From: David B. Saul [mailto:[EMAIL PROTECTED] 
Sent: May 4, 2005 12:51 PM
To: 'Tomcat Users List'
Subject: RE: pdf not working


Here is what worked for me. The PDF is created dynamically.

1. a small bit of code which used FOP and served it as a stream. Be sure to
set the response type.

  byte[] fo;
  .
  .
  .
  InputSource fopInput = new InputSource( new ByteArrayInputStream( fo )
);
  ByteArrayOutputStream outStream = new ByteArrayOutputStream();
  Driver driver = new Driver( fopInput, outStream );
  driver.setLogger(log);
  driver.setRenderer(Driver.RENDER_PDF);
  driver.run();
  output = outStream.toByteArray();

  response.setContentType(application/pdf);
  response.resetBuffer();
  response.setContentLength(output.length);
  ServletOutputStream os = response.getOutputStream();
  os.write(output);
  os.close();

2. Also added to the URL at the end was the following:

pdf=.pdf\

   Can't remember where I found this idea, nor can I find it at this minute,
but it made it work.

hth,
Dave




-Original Message-
From: Jay Hulslander [mailto:[EMAIL PROTECTED] 
Sent: Wednesday, May 04, 2005 6:17 AM
To: Tomcat Users List
Subject: Re: pdf not working


Just so I understand, file.jpg is hosted fine back to a browser.  File.pdf, 
in the same location, is not hosted back to the browser find.  Is that what 
you are experiencing?  Sounds like tomcat is configured to execute pdf 
documents as opposed to hosting them.  Much like you would configure a web 
server to execute streaming video as opposed to just hosting a video to be 
downloaded.  I do not know where this configuration is done in Tomcat, but 
that is where I would start.
-Jay
At 06:04 AM 5/4/2005, you wrote:
Hi all,

Iam trying to call a link to a new window and that's calling a pdf 
document thats somewhere in my folder under webapps. The problem is 
that the pdf is not shown. If i try it with an image it will be 
displayed correctly. I am using Tomcat 5.5.

Maarten
--
No virus found in this outgoing message.
Checked by AVG Anti-Virus.
Version: 7.0.308 / Virus Database: 266.11.3 - Release Date: 3-5-2005


-
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]


-
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]


-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]


!DSPAM:4278f46d100932250632097!


Re: Serving files using tomcat

2005-05-04 Thread Anhony
I use this code and it works in my app. Their are small differences between 
how we copy the data to the response output. I don't know for sure, but this 
may account for why the fragment I posted works.

The difference is small, I think it would be worth giving it a try.
AS-
- Original Message - 
From: Steve Vanspall [EMAIL PROTECTED]
To: Tomcat Users List tomcat-user@jakarta.apache.org
Sent: Wednesday, May 04, 2005 11:47 AM
Subject: Re: Serving files using tomcat


Unfortunately that is what I do
OutputStream dos = null;
   FileInputStream fis = null;
  try
  {
   fis = new FileInputStream(rf.getPdf());
   response.setContentType(application/pdf);
   response.setContentLength((int) rf.getPdf().length());
   //response.setHeader(response.)
   dos = response.getOutputStream();
   int read = -1;
   byte[] bytes = new byte[10];
   while((read = fis.read(bytes)) != -1)
dos.write(bytes, 0, read);
   dos.flush();
   return mapping.findForward(PDF);
  } catch (Exception e)
  {
   // TODO Auto-generated catch block
   if(e instanceof SocketException)
return mapping.findForward(reload);
   throw new IOException(e.toString());
  }
  finally
  {
   if(dos != null)
dos.close();
   if(fis != null)
fis.close();
  }
Acrobat now loads but the PDF doesn't appear.
Probably worth mentioning that I use struts, so I forward to a blank page
with the content type set to application/pdf, maybe that is the problem, 
but
not sure what else to do with the return.

When I do the same thing with a dynamic image and forward to a page with a
jpg content type, the image appears without a problem.
Steve
- Original Message -
From: Anhony [EMAIL PROTECTED]
To: Tomcat Users List tomcat-user@jakarta.apache.org
Sent: Thursday, May 05, 2005 1:02 AM
Subject: Re: Serving files using tomcat

Greetings,
Take a look at the code fragment below. It should serve as a good 
starting
point.
I hope this helps.

AS-
private void processPDFRequest(HttpServletRequest request,
HttpServletResponse response) throws ServletException, IOException,
Exception
{
int bytesCopied = 0;
FileInputStream fin = null;
OutputStream out = null;
String fileAddress = The fully qualified path to your PDF file;
if( fileAddress == null )
return;
int ext = fileAddress.lastIndexOf( '.' );
if( ext != -1 )
{
ext = fileAddress.substring( ext+1,
fileAddress.length() ).toLowerCase();
if( ext == pdf )
response.setContentType(application/pdf);
else
Do whatever you think best to do
}
else
Do whatever you think best to do
try
{
out = response.getOutputStream();
fin = new FileInputStream( fileAddress );
bytesCopied = StreamCopier.copy( fin, out );
}
finally
{
if( fin != null )
fin.close();
if( out != null )
{
out.flush();
out.close();
}
}
}
- Original Message -
From: Steve Vanspall [EMAIL PROTECTED]
To: Tomcat User List tomcat-user@jakarta.apache.org
Sent: Wednesday, May 04, 2005 9:29 AM
Subject: Serving files using tomcat
Hi,
I have been looking around and haven't found a solution that works
basically I have a PDF that gets created dynamically. Now to save memory 
I
have the PDF written to a file rather than a ByteArray. The only way I 
can
be sure that I wont encounter errors creating the file is to use
File.createTempFile. The creation goes of ok. And I have checked the file
itself and the PDF looks great.

How do i now serve this to the user who has requested it. If I try to
write
it to the response (using the same method I use to creare dynamic image,
this works), it just shows up a blank screen.
The problem also is, even if it did show the PDF, acrobat, to my
understand
will read only chunks of the stream and will go pack to get more. Thisis 
a
problem because there is nothing to go back for.

So the point,
If I can just redirect the browser to a file in the tomcat temp directory
(can I do that, will the use have access to that directory), then how do 
I
translate the location of the temp directory to a url that is accesible
outside.

If not then what other suggestions can people give me.
Thanks in advance
Steve

-
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]


-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]


Implementing a custom REALM and storing retrieved information

2005-05-04 Thread stephan
Hi there,

I'm about to code my own authentication realm implementation. I'm facing 
an interesting problem. My authentication mechanism returns not only 
username/password but an additional security token that I need in my 
servlets to communicate with a backend system.

I will implement org.apache.catalina.Realm. When implementing the 
authenticate method I intend to give back not  a java.security.Principal 
but
org.demo.MyPrincipal Object (which extends the java.security.Principal 
object using a decorator pattern).

Questions: is that the object that later is available in my servlet when I 
call: HttpServletRequest.getUserPrincipal() ? If I then would cast it into 
a org.demo.MyPricipal Object would it return the additional properties I 
have defined?

Or alternatively: what would be the appropriate process to get more 
information delivered from the authentication process to the code running 
inside the container?

:-) stw

Re: Serving files using tomcat

2005-05-04 Thread Steve Vanspall
Yes i see no difference,

I assume StreamCopier.copy() just does what my code does. I cannot find it
in any of the standard jars, so I assume this is one of your own.

Other than that everything else seems to be fine.

Oh well I am sure I will owrk it out

Steve
- Original Message -
From: Anhony [EMAIL PROTECTED]
To: Tomcat Users List tomcat-user@jakarta.apache.org
Sent: Thursday, May 05, 2005 2:19 AM
Subject: Re: Serving files using tomcat


 I use this code and it works in my app. Their are small differences
between
 how we copy the data to the response output. I don't know for sure, but
this
 may account for why the fragment I posted works.

 The difference is small, I think it would be worth giving it a try.

 AS-


 - Original Message -
 From: Steve Vanspall [EMAIL PROTECTED]
 To: Tomcat Users List tomcat-user@jakarta.apache.org
 Sent: Wednesday, May 04, 2005 11:47 AM
 Subject: Re: Serving files using tomcat


  Unfortunately that is what I do
 
  OutputStream dos = null;
 FileInputStream fis = null;
try
{
 fis = new FileInputStream(rf.getPdf());
 response.setContentType(application/pdf);
 response.setContentLength((int) rf.getPdf().length());
 //response.setHeader(response.)
 dos = response.getOutputStream();
 
 int read = -1;
 byte[] bytes = new byte[10];
 while((read = fis.read(bytes)) != -1)
  dos.write(bytes, 0, read);
 dos.flush();
 return mapping.findForward(PDF);
} catch (Exception e)
{
 // TODO Auto-generated catch block
 if(e instanceof SocketException)
  return mapping.findForward(reload);
 throw new IOException(e.toString());
}
finally
{
 
 if(dos != null)
  dos.close();
 if(fis != null)
  fis.close();
 
 
}
 
  Acrobat now loads but the PDF doesn't appear.
 
  Probably worth mentioning that I use struts, so I forward to a blank
page
  with the content type set to application/pdf, maybe that is the problem,
  but
  not sure what else to do with the return.
 
  When I do the same thing with a dynamic image and forward to a page with
a
  jpg content type, the image appears without a problem.
 
  Steve
  - Original Message -
  From: Anhony [EMAIL PROTECTED]
  To: Tomcat Users List tomcat-user@jakarta.apache.org
  Sent: Thursday, May 05, 2005 1:02 AM
  Subject: Re: Serving files using tomcat
 
 
  Greetings,
 
  Take a look at the code fragment below. It should serve as a good
  starting
  point.
  I hope this helps.
 
  AS-
 
  private void processPDFRequest(HttpServletRequest request,
  HttpServletResponse response) throws ServletException, IOException,
  Exception
  {
  int bytesCopied = 0;
 
  FileInputStream fin = null;
  OutputStream out = null;
 
  String fileAddress = The fully qualified path to your PDF
file;
  if( fileAddress == null )
  return;
 
  int ext = fileAddress.lastIndexOf( '.' );
  if( ext != -1 )
  {
  ext = fileAddress.substring( ext+1,
  fileAddress.length() ).toLowerCase();
 
  if( ext == pdf )
  response.setContentType(application/pdf);
  else
  Do whatever you think best to do
  }
  else
  Do whatever you think best to do
 
  try
  {
  out = response.getOutputStream();
  fin = new FileInputStream( fileAddress );
  bytesCopied = StreamCopier.copy( fin, out );
  }
  finally
  {
  if( fin != null )
  fin.close();
  if( out != null )
  {
  out.flush();
  out.close();
  }
  }
  }
 
 
  - Original Message -
  From: Steve Vanspall [EMAIL PROTECTED]
  To: Tomcat User List tomcat-user@jakarta.apache.org
  Sent: Wednesday, May 04, 2005 9:29 AM
  Subject: Serving files using tomcat
 
 
  Hi,
 
  I have been looking around and haven't found a solution that works
 
  basically I have a PDF that gets created dynamically. Now to save
memory
  I
  have the PDF written to a file rather than a ByteArray. The only way I
  can
  be sure that I wont encounter errors creating the file is to use
  File.createTempFile. The creation goes of ok. And I have checked the
file
  itself and the PDF looks great.
 
  How do i now serve this to the user who has requested it. If I try to
  write
  it to the response (using the same method I use to creare dynamic
image,
  this works), it just shows up a blank screen.
 
  The problem also is, even if it did show the PDF, acrobat, to my
  understand
  will read only chunks of the stream and will go pack to get more.
Thisis
  a
  problem because there is nothing to go back for.
 
  So the point,
 
  If I can just redirect the browser to a file in the tomcat temp
directory
  (can I do that, will the use have access to that directory), then how
do
  I
  

Tomcat processes

2005-05-04 Thread Iannis Hanen
Hi everyone,

 

I have a question related to the scalability and performance of Tomcat.
Typically, when tomcat gets started, it creates one process that spawns
all the threads required to answer the requests for all the deployed web
applications. 

 

Let's assume that I have 6 distinct web applications to deploy on a
tomcat instance. If tomcat runs on a single high end server machine
(with multi CPU), I am wondering which approach would scale better:

 

1) launch tomcat once with the 6 web applications (the regular
way)

2) create two server.xml files (one server.xml including 3 web apps,
and another one containing the remaining 3), and start two tomcat
instances (running on different port obviously) on the same machine.

3) Follow approach 2 except that each tomcat instance contains all 6
web apps (and some load balancer is put in front). 

 

In short, I am wondering if having multiple tomcat processes running on
a multi CPU box would scale better than having a single tomcat process
dealing with everything. Is there a way to tune up the number or tomcat
processes from server.xml or elsewhere? I could not find anything
related to the number of processes to spawn at all. In some app server,
it is possible to create several process for the same application. Is
there anything similar in Tomcat? 

 

Best regards,

Iannis



Re: Network Disk Not Exist Under Tomcat-5.5.9

2005-05-04 Thread Jason Bainbridge
On 5/4/05, NanFei Wang [EMAIL PROTECTED] wrote:
 Hi,
 I have found the solution as follow:
 change tomcat service account:
 Control Panel  Administrative Tools  Services
 change tomcat service log on account: administrator

Uhm you don't want to do that, running any service as Administrator is
just asking for trouble.

You want a dedicated service account for tomcat, there were some posts
about the pernissions and privileges required for such an account a
while back.

Regards,
-- 
Jason Bainbridge
http://kde.org - [EMAIL PROTECTED]
Personal Site - http://jasonbainbridge.com

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: Tomcat5.5.9 + jdk1.5 HTTPS

2005-05-04 Thread Jason Bainbridge
On 5/4/05, Carlos Conde [EMAIL PROTECTED] wrote:
 Hello,
 
 I'm trying to enable HTTPS with Tomcat5.5.9. Here is my connector description 
 in
 the server.xml file:
 
 Connector port=8443
minProcessors=5
maxProcessors=75
enableLookups=true
disableUploadTimeout=true
acceptCount=100
debug=0
scheme=https
secure=true
clientAuth=false
sslProtocol=TLS
keystoreFile=conf/ssl/keystore
keystorePass=/
 

Try specifying an absolute path for the keystoreFile, I'm not sure
what that is relative to and shouldn't that be .keystore anyway?

Regards,
-- 
Jason Bainbridge
http://kde.org - [EMAIL PROTECTED]
Personal Site - http://jasonbainbridge.com

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



RE: Tomcat processes

2005-05-04 Thread J. Ryan Earl
Generally speaking, one process with a lot of threads should perform better
than distributing the threads among multiple processes because you're not
doing as much context switching and it's more efficient on caches.

J. Ryan Earl
Systems/Network Engineer
dynaConnections Corporation
512.306.9898

-Original Message-
From: Iannis Hanen [mailto:[EMAIL PROTECTED]
Sent: Wednesday, May 04, 2005 12:01 PM
To: tomcat-user@jakarta.apache.org
Subject: Tomcat processes


Hi everyone,



I have a question related to the scalability and performance of Tomcat.
Typically, when tomcat gets started, it creates one process that spawns
all the threads required to answer the requests for all the deployed web
applications.



Let's assume that I have 6 distinct web applications to deploy on a
tomcat instance. If tomcat runs on a single high end server machine
(with multi CPU), I am wondering which approach would scale better:



1) launch tomcat once with the 6 web applications (the regular
way)

2) create two server.xml files (one server.xml including 3 web apps,
and another one containing the remaining 3), and start two tomcat
instances (running on different port obviously) on the same machine.

3) Follow approach 2 except that each tomcat instance contains all 6
web apps (and some load balancer is put in front).



In short, I am wondering if having multiple tomcat processes running on
a multi CPU box would scale better than having a single tomcat process
dealing with everything. Is there a way to tune up the number or tomcat
processes from server.xml or elsewhere? I could not find anything
related to the number of processes to spawn at all. In some app server,
it is possible to create several process for the same application. Is
there anything similar in Tomcat?



Best regards,

Iannis



-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



RE: Serving files using tomcat

2005-05-04 Thread David B. Saul
May not be critical but try using the ServletOutputStream instead of
OutputStream.
DOC URL:
http://java.sun.com/j2ee/1.4/docs/api/javax/servlet/ServletResponse.html


//Clear content of the underlying buffer in the response 
//without clearing headers or status code.
response.resetBuffer();
response.setContentLength(output.length);

//Returns a ServletOutputStream suitable for writing binary data in the
response. 
//The servlet container does not encode the binary data. 
ServletOutputStream os = response.getOutputStream();
os.write(output);
os.close();

Additionally, append   pdf=.pdf\   to the URL.





-Original Message-
From: Anhony [mailto:[EMAIL PROTECTED] 
Sent: Wednesday, May 04, 2005 9:20 AM
To: Tomcat Users List
Subject: Re: Serving files using tomcat


I use this code and it works in my app. Their are small differences between 
how we copy the data to the response output. I don't know for sure, but this

may account for why the fragment I posted works.

The difference is small, I think it would be worth giving it a try.

AS-


- Original Message - 
From: Steve Vanspall [EMAIL PROTECTED]
To: Tomcat Users List tomcat-user@jakarta.apache.org
Sent: Wednesday, May 04, 2005 11:47 AM
Subject: Re: Serving files using tomcat


 Unfortunately that is what I do

 OutputStream dos = null;
FileInputStream fis = null;
   try
   {
fis = new FileInputStream(rf.getPdf());
response.setContentType(application/pdf);
response.setContentLength((int) rf.getPdf().length());
//response.setHeader(response.)
dos = response.getOutputStream();

int read = -1;
byte[] bytes = new byte[10];
while((read = fis.read(bytes)) != -1)
 dos.write(bytes, 0, read);
dos.flush();
return mapping.findForward(PDF);
   } catch (Exception e)
   {
// TODO Auto-generated catch block
if(e instanceof SocketException)
 return mapping.findForward(reload);
throw new IOException(e.toString());
   }
   finally
   {

if(dos != null)
 dos.close();
if(fis != null)
 fis.close();


   }

 Acrobat now loads but the PDF doesn't appear.

 Probably worth mentioning that I use struts, so I forward to a blank 
 page with the content type set to application/pdf, maybe that is the 
 problem, but not sure what else to do with the return.

 When I do the same thing with a dynamic image and forward to a page 
 with a jpg content type, the image appears without a problem.

 Steve
 - Original Message -
 From: Anhony [EMAIL PROTECTED]
 To: Tomcat Users List tomcat-user@jakarta.apache.org
 Sent: Thursday, May 05, 2005 1:02 AM
 Subject: Re: Serving files using tomcat


 Greetings,

 Take a look at the code fragment below. It should serve as a good
 starting
 point.
 I hope this helps.

 AS-

 private void processPDFRequest(HttpServletRequest request, 
 HttpServletResponse response) throws ServletException, IOException, 
 Exception
 {
 int bytesCopied = 0;

 FileInputStream fin = null;
 OutputStream out = null;

 String fileAddress = The fully qualified path to your PDF file;
 if( fileAddress == null )
 return;

 int ext = fileAddress.lastIndexOf( '.' );
 if( ext != -1 )
 {
 ext = fileAddress.substring( ext+1,
 fileAddress.length() ).toLowerCase();

 if( ext == pdf )
 response.setContentType(application/pdf);
 else
 Do whatever you think best to do
 }
 else
 Do whatever you think best to do

 try
 {
 out = response.getOutputStream();
 fin = new FileInputStream( fileAddress );
 bytesCopied = StreamCopier.copy( fin, out );
 }
 finally
 {
 if( fin != null )
 fin.close();
 if( out != null )
 {
 out.flush();
 out.close();
 }
 }
 }


 - Original Message -
 From: Steve Vanspall [EMAIL PROTECTED]
 To: Tomcat User List tomcat-user@jakarta.apache.org
 Sent: Wednesday, May 04, 2005 9:29 AM
 Subject: Serving files using tomcat


 Hi,

 I have been looking around and haven't found a solution that works

 basically I have a PDF that gets created dynamically. Now to save 
 memory
 I
 have the PDF written to a file rather than a ByteArray. The only way I 
 can
 be sure that I wont encounter errors creating the file is to use
 File.createTempFile. The creation goes of ok. And I have checked the file
 itself and the PDF looks great.

 How do i now serve this to the user who has requested it. If I try to
 write
 it to the response (using the same method I use to creare dynamic 
 image, this works), it just shows up a blank screen.

 The problem also is, even if it did show the PDF, acrobat, to my
 understand
 will read only chunks of the stream and will go pack to get more. 
 Thisis
 a
 problem because there is nothing to 

RE: BadPaddingException revisited

2005-05-04 Thread Faine, Mark
The password was incorrect, after correcting this, the server works as
intended.

-Mark
 

-Original Message-
From: Faine, Mark 
Sent: Wednesday, May 04, 2005 9:27 AM
To: 'Tomcat Users List'
Subject: BadPaddingException revisited

 
 
Is a keystore required to use PKCS12 ssl certs with Tomcat 5?  I'm trying
(once again) to convert a cert issued for Apache (OpenSSL) to a pkcs12 for
Tomcat but I keep getting the following error:
 
 Protocol handler start failed: java.io.IOException: failed to decrypt safe
contents entry: javax.crypto.BadPaddingException: Given final block not
properly padded...
 
I've  had this problem before and was able to overcome it though I don't
know how.  I don't know what I did to get it working last time and I'm
hoping I can once and for all determine the cause of this error so that I
will not have to go through this again.
 
I've been trying the following openssl command to convert the cert
 
openssl pkcs12 -export -in mycert.cer -inkey mykey.key -out cert.p12 -name
tomcat -CAfile entrust_ssl_ca.cer -caname root -chain
 
I'd appreciate any help I could get on this issue.
 
Thanks,
-Mark
 

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



simple deployment problem - please help

2005-05-04 Thread Guy Katz
hi;

i have tomcat 5.5.9 running with jdk1.4.2

my application is configured in a context element in the server.xml and it is 
deployed twice instead of once!!! (only one context is defined in the 
server.xml)

i have no idea why. 

if i remove the context element from the server.xml and prepare a myapp.xml 
and put it in the conf\Catalina\localhost than it is deployed once but the path 
element is ignored (per spec) and my application is a root application (should 
start when invoking localhost:8080) so its not a good solution.

below is my server.xml and a view of tomcat console output. the server.xml is 
really basic.

i hope someone can please guide me cause i am desperate here.

thanks in advance.

myserver.xml:

Server port=8005 shutdown=SHUTDOWN
  Listener className=org.apache.catalina.mbeans.ServerLifecycleListener /
  Listener 
className=org.apache.catalina.mbeans.GlobalResourcesLifecycleListener /
  Listener 
className=org.apache.catalina.storeconfig.StoreConfigLifecycleListener/
  GlobalNamingResources
Resource name=UserDatabase auth=Container
  type=org.apache.catalina.UserDatabase
   description=User database that can be updated and saved
   factory=org.apache.catalina.users.MemoryUserDatabaseFactory
  pathname=conf/tomcat-users.xml /
  /GlobalNamingResources
  Service name=Catalina
Connector port=8080 maxHttpHeaderSize=8192
   maxThreads=150 minSpareThreads=25 maxSpareThreads=75
   enableLookups=false redirectPort=8443 acceptCount=100
   connectionTimeout=2 disableUploadTimeout=true /
Connector port=8009 
   enableLookups=false redirectPort=8443 protocol=AJP/1.3 /
Engine name=Catalina defaultHost=localhost
  Realm className=org.apache.catalina.realm.UserDatabaseRealm
 resourceName=UserDatabase/
  Host name=localhost appBase=webapps
   unpackWARs=true autoDeploy=true
   xmlValidation=false xmlNamespaceAware=false
Context crossContext=false path= docBase=waves debug=0 
reloadable=true
 Resource name=waves/jdbc/WavesDB auth=Container 
type=javax.sql.DataSource
 maxActive=100 maxIdle=30 maxWait=3 
removeAbandoned=true removeAbandonedTimeout=60 logAbandoned=true
 username=superadmin password=EJsec6DM 
driverClassName=com.mysql.jdbc.Driver
 
url=jdbc:mysql://localhost/waves?useUnicode=trueamp;characterEncoding=UTF-8amp;autoReconnect=trueamp;/
 ResourceParams name=waves/mail/Session 
 parameter 
   namemail.smtp.host/name 
   valuemail.xwave.co.il/value 
 /parameter
  /ResourceParams
 Realm className=org.apache.catalina.realm.DataSourceRealm debug=99
  dataSourceName=waves/jdbc/WavesDB localDataSource=true
  userTable=users userNameCol=user_name userCredCol=user_pass
  userRoleTable=user_roles roleNameCol=role_name/
/Context
  /Host
/Engine
  /Service
/Server


 

tomcat console output:

INFO: Starting Servlet Engine: Apache Tomcat/5.5.9
04/05/2005 21:49:57 org.apache.catalina.core.StandardHost start
INFO: XML validation disabled
2005-05-04 21:50:01 [main] WARN  commons.digester.Digester  - [ConverterRule]{fa
ces-config/converter} Merge(null,java.math.BigDecimal)
2005-05-04 21:50:01 [main] WARN  commons.digester.Digester  - [ConverterRule]{fa
ces-config/converter} Merge(null,java.math.BigInteger)
2005-05-04 21:50:01 [main] WARN  commons.digester.Digester  - [ComponentRule]{fa
ces-config/component} Merge(marquee)
2005-05-04 21:50:01 [main] WARN  commons.digester.Digester  - [ValidatorRule]{fa
ces-config/validator} Merge(emailValidator)
ctx!!! [EMAIL PROTECTED]
2005-05-04 21:50:04 [main] INFO  scheduler.web.SchedulerInitializer  - scheduler
 init complete
trying to find encoding
2005-05-04 21:50:05 [main] INFO  sms.web.EncodingFilter  - encoding
2005-05-04 21:50:10 [main] WARN  commons.digester.Digester  - [ConverterRule]{fa
ces-config/converter} Merge(null,java.math.BigDecimal)
2005-05-04 21:50:10 [main] WARN  commons.digester.Digester  - [ConverterRule]{fa
ces-config/converter} Merge(null,java.math.BigInteger)
2005-05-04 21:50:10 [main] WARN  commons.digester.Digester  - [ComponentRule]{fa
ces-config/component} Merge(marquee)
2005-05-04 21:50:10 [main] WARN  commons.digester.Digester  - [ValidatorRule]{fa
ces-config/validator} Merge(emailValidator)
ctx!!! [EMAIL PROTECTED]
2005-05-04 21:50:13 [main] INFO  scheduler.web.SchedulerInitializer  - scheduler
 init complete
trying to find encoding
2005-05-04 21:50:13 [main] INFO  sms.web.EncodingFilter  - encoding 
04/05/2005 21:50:14 org.apache.coyote.http11.Http11Protocol start
INFO: Starting Coyote HTTP/1.1 on http-8080
04/05/2005 21:50:14 org.apache.jk.common.ChannelSocket init
INFO: JK: ajp13 listening on /0.0.0.0:8009
04/05/2005 21:50:14 org.apache.jk.server.JkMain start
INFO: Jk running ID=0 time=0/90  config=null
04/05/2005 21:50:15 

Re: Moving from http to https doesnt expire session

2005-05-04 Thread Bob Feretich
If you start a session under http, Tomcat will maintain the session into 
https. This is the desired behavior for most users. Most e-commerce 
sites use shopping cart models and don't switch to https until you 
want to check out. If the session was changed on the transition, you 
would lose the shopping cart contents just as it was time to pay. Also, 
maintaining the session from http to https does not create a security 
hazard.

Tomcat does not permit a session to be maintained across a https to http 
transition for security reasons.

To force a session to expire when moving from http to https...
For https pages, at the top of your servlet/jsp, where request is the 
HttpServletRequest object. Insert...
   if (!request.isSecure() ) // not needed if page is a secure resource
   {code to redirect back to the same page under https}
   // get the browser's cookies
   Cookie[] cookies = request.getCookies();
   if (cookies==null)
   {code to tell user to enable cookies}
   // check session
   HttpSession session = request.getSession(false);
   if (session!=null) {
  // Find the JSESSIONID cookie
  for (int i=0; icookies.length; i++) {
 if (JSESSIONID.equals(cookies[i].getName() ) ) {
if (!cookies[i].getsecure() ) {
   // invalidate non-secure session
   session().invalidate();
   // see below Note 1.
   break;
} // if cookie[]
 } // if found cookie
  } // for i
   } // if session
   session = request.getSession(true);

Note 1. At this spot in my servlet, I have code to redirect back to the 
sevlet under https. It shouldn't be required, but I may have suspected 
that session.invalidate() immediately followed by a 
request.getSession(true) didn't work.

Hope this helps.
Bob Feretich
Subject: Moving from http to https doesnt expire session
From:Fabian Pena [EMAIL PROTECTED]
Date:Mon, 02 May 2005 09:54:29 -0300
To:tomcat-user@jakarta.apache.org
hi all
I have a simple question, at least I think that.
I am developing an applicatin that contains confidential information,
and I'm having a simple problem.
when a user move from http to https de session doesnt expire, the
jsessionid is the same.
I want generate a new session and of course change de jsessionid in the
first https request.
Any one can help me.
Thanks in advance
Fabian 


-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]


Re: Serving files using tomcat

2005-05-04 Thread Dakota Jack
If you are using struts, you should be forwarding a null.  That is
probably your problem.

On 5/4/05, Steve Vanspall [EMAIL PROTECTED] wrote:
 Unfortunately that is what I do
 
 OutputStream dos = null;
 FileInputStream fis = null;
try
{
 fis = new FileInputStream(rf.getPdf());
 response.setContentType(application/pdf);
 response.setContentLength((int) rf.getPdf().length());
 //response.setHeader(response.)
 dos = response.getOutputStream();
 
 int read = -1;
 byte[] bytes = new byte[10];
 while((read = fis.read(bytes)) != -1)
  dos.write(bytes, 0, read);
 dos.flush();
 return mapping.findForward(PDF);
} catch (Exception e)
{
 // TODO Auto-generated catch block
 if(e instanceof SocketException)
  return mapping.findForward(reload);
 throw new IOException(e.toString());
}
finally
{
 
 if(dos != null)
  dos.close();
 if(fis != null)
  fis.close();
 
}
 
 Acrobat now loads but the PDF doesn't appear.
 
 Probably worth mentioning that I use struts, so I forward to a blank page
 with the content type set to application/pdf, maybe that is the problem, but
 not sure what else to do with the return.
 
 When I do the same thing with a dynamic image and forward to a page with a
 jpg content type, the image appears without a problem.
 
 Steve
 - Original Message -
 From: Anhony [EMAIL PROTECTED]
 To: Tomcat Users List tomcat-user@jakarta.apache.org
 Sent: Thursday, May 05, 2005 1:02 AM
 Subject: Re: Serving files using tomcat
 
  Greetings,
 
  Take a look at the code fragment below. It should serve as a good starting
  point.
  I hope this helps.
 
  AS-
 
  private void processPDFRequest(HttpServletRequest request,
  HttpServletResponse response) throws ServletException, IOException,
  Exception
  {
  int bytesCopied = 0;
 
  FileInputStream fin = null;
  OutputStream out = null;
 
  String fileAddress = The fully qualified path to your PDF file;
  if( fileAddress == null )
  return;
 
  int ext = fileAddress.lastIndexOf( '.' );
  if( ext != -1 )
  {
  ext = fileAddress.substring( ext+1,
  fileAddress.length() ).toLowerCase();
 
  if( ext == pdf )
  response.setContentType(application/pdf);
  else
  Do whatever you think best to do
  }
  else
  Do whatever you think best to do
 
  try
  {
  out = response.getOutputStream();
  fin = new FileInputStream( fileAddress );
  bytesCopied = StreamCopier.copy( fin, out );
  }
  finally
  {
  if( fin != null )
  fin.close();
  if( out != null )
  {
  out.flush();
  out.close();
  }
  }
  }
 
 
  - Original Message -
  From: Steve Vanspall [EMAIL PROTECTED]
  To: Tomcat User List tomcat-user@jakarta.apache.org
  Sent: Wednesday, May 04, 2005 9:29 AM
  Subject: Serving files using tomcat
 
 
  Hi,
 
  I have been looking around and haven't found a solution that works
 
  basically I have a PDF that gets created dynamically. Now to save memory I
  have the PDF written to a file rather than a ByteArray. The only way I can
  be sure that I wont encounter errors creating the file is to use
  File.createTempFile. The creation goes of ok. And I have checked the file
  itself and the PDF looks great.
 
  How do i now serve this to the user who has requested it. If I try to
 write
  it to the response (using the same method I use to creare dynamic image,
  this works), it just shows up a blank screen.
 
  The problem also is, even if it did show the PDF, acrobat, to my
 understand
  will read only chunks of the stream and will go pack to get more. Thisis a
  problem because there is nothing to go back for.
 
  So the point,
 
  If I can just redirect the browser to a file in the tomcat temp directory
  (can I do that, will the use have access to that directory), then how do I
  translate the location of the temp directory to a url that is accesible
  outside.
 
  If not then what other suggestions can people give me.
 
  Thanks in advance
 
  Steve
 
 
 
  -
  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]
 
 


-- 
You can lead a horse to water but you cannot make it float on its back.
~Dakota Jack~

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: Help - Alias or Symlink to external(to the context) images directory?

2005-05-04 Thread Matt Galvin
On 5/3/05, Mott Leroy [EMAIL PROTECTED] wrote:
 http://jakarta.apache.org/tomcat/tomcat-5.0-doc/config/context.html -
 
 see the allowLinking property.

This did the trick :) Thanks Mott!!!

 As far as how to create the symlink when the app is deployed, not sure
 beyond running some sort of script when the application loads (using a
 context listener perhaps).

I actually have a script that deploys the app for me, so in that
script I create the symlink after deploying.

Thanks again,

Matt

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: tomcat stopped

2005-05-04 Thread Fred Cook
Hi Wendy,
We just use cp to get foo.war into the webapps dir.  But we shut down 
tomcat first, then restart it.
The exact steps:

We build our test app under a  /home file system, then cp the .war 
file to the Tomcat webapps dir , Tomcat is under the same /home file 
system.

Shut down Tomcat.
Startup Tomcat.
Go to //localhost:8080/foo/ with FireFox, we see a blank screen.
It's probably cached in the browser, did you hold down shift and click
reload to force it to request the page again?
We always force a reload on the browser.
It concerns me that the Manager does not run from localhost:8080 or anything else for that matter.  I think the first step maybe to get Tomcats home page links working. 

Here is the error log file for our test app //localhost:8080/MiniHR/.  
Things go pretty well till Tomcat tries to boot MiniHR.  What happens if I just 
manually delete MinHR.war and it's sub dirs from webapps, does this break 
anything?
Hope this helps.
-Fred
May 4, 2005 10:51:25 AM org.apache.coyote.http11.Http11Protocol init
INFO: Initializing Coyote HTTP/1.1 on http-8080
May 4, 2005 10:51:25 AM org.apache.catalina.startup.Catalina load
INFO: Initialization processed in 5405 ms
May 4, 2005 10:51:26 AM org.apache.catalina.core.StandardService start
INFO: Starting service Catalina
May 4, 2005 10:51:26 AM org.apache.catalina.core.StandardEngine start
INFO: Starting Servlet Engine: Apache Tomcat/5.5.7
May 4, 2005 10:51:26 AM org.apache.catalina.core.StandardHost start
INFO: XML validation disabled
May 4, 2005 10:51:28 AM org.apache.catalina.core.ApplicationContext log
INFO: org.apache.catalina.servlets.DefaultServlet: init
May 4, 2005 10:51:28 AM org.apache.catalina.core.ApplicationContext log
INFO: org.apache.jasper.servlet.JspServlet: init
May 4, 2005 10:51:29 AM org.apache.catalina.startup.HostConfig deployWAR
INFO: Deploying web application archive MiniHR.war
May 4, 2005 10:51:30 AM org.apache.catalina.core.ApplicationContext log
SEVERE: StandardWrapper.Throwable
java.lang.NoSuchMethodError: 
javax.servlet.ServletConfig.getServletName()Ljava/lang/String;
   at 
org.apache.struts.action.ActionServlet.initServlet(ActionServlet.java:1076)
   at org.apache.struts.action.ActionServlet.init(ActionServlet.java:324)
   at javax.servlet.GenericServlet.init(GenericServlet.java:172)
   at 
org.apache.catalina.core.StandardWrapper.loadServlet(StandardWrapper.java:1068)
   at 
org.apache.catalina.core.StandardWrapper.load(StandardWrapper.java:900)
   at 
org.apache.catalina.core.StandardContext.loadOnStartup(StandardContext.java:3823)
   at 
org.apache.catalina.core.StandardContext.start(StandardContext.java:4087)
   at 
org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.java:759)
   at 
org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:739)
   at org.apache.catalina.core.StandardHost.addChild(StandardHost.java:524)
   at org.apache.catalina.startup.HostConfig.deployWAR(HostConfig.java:800)
   at 
org.apache.catalina.startup.HostConfig.deployWARs(HostConfig.java:695)
   at 
org.apache.catalina.startup.HostConfig.deployApps(HostConfig.java:472)
   at org.apache.catalina.startup.HostConfig.start(HostConfig.java:1106)
   at 
org.apache.catalina.startup.HostConfig.lifecycleEvent(HostConfig.java:310)
   at 
org.apache.catalina.util.LifecycleSupport.fireLifecycleEvent(LifecycleSupport.java:119)
   at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1019)
   at org.apache.catalina.core.StandardHost.start(StandardHost.java:718)
   at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1011)
   at 
org.apache.catalina.core.StandardEngine.start(StandardEngine.java:440)
   at 
org.apache.catalina.core.StandardService.start(StandardService.java:450)
   at 
org.apache.catalina.core.StandardServer.start(StandardServer.java:683)
   at org.apache.catalina.startup.Catalina.start(Catalina.java:537)
   at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
   at 
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
   at 
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
   at java.lang.reflect.Method.invoke(Method.java:585)
   at org.apache.catalina.startup.Bootstrap.start(Bootstrap.java:271)
   at org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:409)
May 4, 2005 10:51:30 AM org.apache.catalina.core.ApplicationContext log
SEVERE: Servlet /MiniHR threw load() exception
javax.servlet.ServletException: Servlet.init() for servlet action threw 
exception
   at 
org.apache.catalina.core.StandardWrapper.loadServlet(StandardWrapper.java:1109)
   at 
org.apache.catalina.core.StandardWrapper.load(StandardWrapper.java:900)
   at 
org.apache.catalina.core.StandardContext.loadOnStartup(StandardContext.java:3823)
   at 
org.apache.catalina.core.StandardContext.start(StandardContext.java:4087)
   at 
org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.java:759)
   at 

Re: Moving from http to https doesnt expire session

2005-05-04 Thread Fabian Pena
Thank Bob.
Yes, I think an invalidate and then a request.getSession(true) doesn't work.
Do you know if there are some other options, or a tomcat setting to do this?
The only solution that i found at this moment, was set a diferent domain 
name for http and https.

As you see, me english is not good.
greetings
Fabian
Bob Feretich wrote:
If you start a session under http, Tomcat will maintain the session into 
https. This is the desired behavior for most users. Most e-commerce 
sites use shopping cart models and don't switch to https until you 
want to check out. If the session was changed on the transition, you 
would lose the shopping cart contents just as it was time to pay. Also, 
maintaining the session from http to https does not create a security 
hazard.

Tomcat does not permit a session to be maintained across a https to http 
transition for security reasons.

To force a session to expire when moving from http to https...
For https pages, at the top of your servlet/jsp, where request is the 
HttpServletRequest object. Insert...
   if (!request.isSecure() ) // not needed if page is a secure resource
   {code to redirect back to the same page under https}
   // get the browser's cookies
   Cookie[] cookies = request.getCookies();
   if (cookies==null)
   {code to tell user to enable cookies}
   // check session
   HttpSession session = request.getSession(false);
   if (session!=null) {
  // Find the JSESSIONID cookie
  for (int i=0; icookies.length; i++) {
 if (JSESSIONID.equals(cookies[i].getName() ) ) {
if (!cookies[i].getsecure() ) {
   // invalidate non-secure session
   session().invalidate();
   // see below Note 1.
   break;
} // if cookie[]
 } // if found cookie
  } // for i
   } // if session
   session = request.getSession(true);

Note 1. At this spot in my servlet, I have code to redirect back to the 
sevlet under https. It shouldn't be required, but I may have suspected 
that session.invalidate() immediately followed by a 
request.getSession(true) didn't work.

Hope this helps.
Bob Feretich
Subject: Moving from http to https doesnt expire session
From:Fabian Pena [EMAIL PROTECTED]
Date:Mon, 02 May 2005 09:54:29 -0300
To:tomcat-user@jakarta.apache.org
hi all
I have a simple question, at least I think that.
I am developing an applicatin that contains confidential information,
and I'm having a simple problem.
when a user move from http to https de session doesnt expire, the
jsessionid is the same.
I want generate a new session and of course change de jsessionid in the
first https request.
Any one can help me.
Thanks in advance
Fabian 


-
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]


username password

2005-05-04 Thread peter thesing
Dear Reader,
Recently i have installed jakarta tomcat 4.1 and i have some questions 
regarding logging in.
It is installed from the Cd's that came with SuSE 9.0. SuSE support in 
non-existing and therefore they are unable to answer my questions.
I have the following irritating issues;
What are the default  user name and password settings for both admin and 
manager?
How can i enter a custom user name and password to ensure security?
Does an upgrade to a higher version of Tomcat solve my login problem or 
do i need to modify certain files? If so which ones and how?
Although  i am able to see the page telling me that all is working  do i 
need to rewrite and recompile the software in order to use it?
FYI.
I am using Apache2 and  a 2.4 Linux kernel
After several dozens of tries this is my tomcat-users.xml

?xml version='1.0' encoding='utf-8'?
tomcat-users
role rolename=tomcat/
role rolename=role1/
role rolename=manager/
role rolename=admin/
user username=root password=w8woord 
roles=standard,tomcat,admin,manager/
user username=tomcat password=tomcat roles=tomcat/
user username=both password=tomcat roles=tomcat,role1/
user username=role1 password=tomcat roles=role1/
/tomcat-users
With kind regards
Yours desperate

Peter Thesing
-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]


How do I redirect all tomcat ports to use SSL?

2005-05-04 Thread Donny R Rota

This weeks puzzler 8^)

I want all my Tomcat requests to go through SSL.
I setup tomcat, and got port 80 and port 443 (SSL) working.
But I cannot redirect port 80 to 443. I keep getting refused:

Is there a way in Tomcat to redirect all port 80 requests to SSL(443)?
I know you can do it the other way around 8443 -
80.
I'm just running standalone Tomcat, no Apache.


advTHANKSance!
...Don...

--
Don Rota, CTG Operations
Rational Software, IBM Software Group
20 Maguire Road, Lexington, MA 02421-3104 
Tel: 781 676 2655, Fax: 781 676 7645 
[EMAIL PROTECTED] 

Re: How do I redirect all tomcat ports to use SSL?

2005-05-04 Thread Fabian Pena
In a web application, you can edit your web.xml file and add a 
security-constraint to redirect all application requests to SSL.

I Hope this help
Fabian
Donny R Rota wrote:
This weeks puzzler  8^)
I want all my Tomcat requests to go through SSL.
I setup tomcat, and got port 80 and port 443 (SSL) working.
But I cannot redirect port 80 to 443.  I keep getting refused:
Is there a way in Tomcat to redirect all port 80 requests to SSL(443)?
I know you can do it the other way around 8443 - 80.
I'm just running standalone Tomcat, no Apache.
advTHANKSance!
...Don...
--
Don Rota, CTG Operations
Rational Software, IBM Software Group
20 Maguire Road, Lexington, MA 02421-3104
Tel: 781 676 2655, Fax: 781 676 7645
[EMAIL PROTECTED]

No virus found in this incoming message.
Checked by AVG Anti-Virus.
Version: 7.0.308 / Virus Database: 266.11.3 - Release Date: 03/05/2005
-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]


Log the Content-type

2005-05-04 Thread Juan Manuel Soler =?iso-8859-1?b?UmluY/Nu?=
Hi

I need to log the content-type of the request in a tomcat web-server, can
someone help  me with that???

thx

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



POST not working

2005-05-04 Thread Christian Dechery
Hi everyone, hope u can help me solve this one. It's at least weird.
I have a 4.1.3 installed on a FreeBSD machine running a huge intranet 
corporate system. It runs smoothly and very fast, but for some very 
weird reason, that webapp is the only one on the server wich allows POST.

Even the /admin tool won't allow posts, therefore I can't login to it.
I have another webapp (a little one, for access control), installed. It 
is the simplest webapp possible, only a few JSPs, but POST doesn't work 
on it, only GET.

I've searched through server.xml looking for something that could 
explain this, but found nothing. I have even created a Context for SCA 
exactly as the one I have for the main application.

Any clues?
Thanks in advance,
Christian from Rio, Brazil
-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]


Re: username password

2005-05-04 Thread Mark Thomas
peter thesing wrote:
What are the default  user name and password settings for both admin and 
manager?
For security reasons there isn't a default user name and password for 
either of these applications.

How can i enter a custom user name and password to ensure security?
Yes.
Does an upgrade to a higher version of Tomcat solve my login problem
No.
or do i need to modify certain files?
Yes.
 If so which ones...
It depends how Tomcat has been installed. Assuming the standard 
installation has been altered too much, you will need to edit 
$CATALINA_BASE/conf/tomcat-users.xml and then *restart Tomcat*. If you 
are still having trouble, post your server.xml as this will enable us to 
tell how non-standard the installation is.

 and how?
With any text editor of your choosing.
Although  i am able to see the page telling me that all is working  do i 
need to rewrite and recompile the software in order to use it?
No.
FYI.
I am using Apache2 and  a 2.4 Linux kernel
After several dozens of tries this is my tomcat-users.xml
?xml version='1.0' encoding='utf-8'?
tomcat-users
role rolename=tomcat/
role rolename=role1/
role rolename=manager/
role rolename=admin/
user username=root password=w8woord 
roles=standard,tomcat,admin,manager/
user username=tomcat password=tomcat roles=tomcat/
user username=both password=tomcat roles=tomcat,role1/
user username=role1 password=tomcat roles=role1/
/tomcat-users
Looks OK to me. Did you restart Tomcat?
Mark
-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]


Re: POST not working

2005-05-04 Thread Mark Thomas
What response do you get when you try to POST?
Mark
Christian Dechery wrote:
Hi everyone, hope u can help me solve this one. It's at least weird.
I have a 4.1.3 installed on a FreeBSD machine running a huge intranet 
corporate system. It runs smoothly and very fast, but for some very 
weird reason, that webapp is the only one on the server wich allows POST.

Even the /admin tool won't allow posts, therefore I can't login to it.
I have another webapp (a little one, for access control), installed. It 
is the simplest webapp possible, only a few JSPs, but POST doesn't work 
on it, only GET.

I've searched through server.xml looking for something that could 
explain this, but found nothing. I have even created a Context for SCA 
exactly as the one I have for the main application.

Any clues?
Thanks in advance,
Christian from Rio, Brazil
-
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]


Loading JAR changes without redeploy.

2005-05-04 Thread Eduardo Lobo
Hi,
I have this problem: I need to make a web application that read some 
resources(xml files) from JAR files (located in the shared/lib folder), 
but I need to update constantly the JARs content, then I need that the 
web application always gets the last JAR files version without 
redeploy/restart the web application.

How can I do that, because right now when I replace the JAR file with 
the new one the web application don't get the changes from the JAR content?

In summary, there is some way to make a JAR redeploy?
Any help you can provide me will be well appreciated. .
Thanks.
-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]


Re: username password

2005-05-04 Thread Anoop kumar V
 role rolename=tomcat/
 role rolename=role1/
 role rolename=manager/
 role rolename=admin/
 user username=root password=w8woord
 roles=standard,tomcat,admin,manager/

I dont think 'standard' is a role that has been defined - so maybe for 
debugging purposes remove that and check - i just verified and adding a line 
to the default tomcat-users.xml file helps a lot!

Anoop

On 5/4/05, Mark Thomas [EMAIL PROTECTED] wrote:
 
 peter thesing wrote:
  What are the default user name and password settings for both admin and
  manager?
 For security reasons there isn't a default user name and password for
 either of these applications.
 
  How can i enter a custom user name and password to ensure security?
 Yes.
 
  Does an upgrade to a higher version of Tomcat solve my login problem
 No.
 
  or do i need to modify certain files?
 Yes.
 
  If so which ones...
 It depends how Tomcat has been installed. Assuming the standard
 installation has been altered too much, you will need to edit
 $CATALINA_BASE/conf/tomcat-users.xml and then *restart Tomcat*. If you
 are still having trouble, post your server.xml as this will enable us to
 tell how non-standard the installation is.
 
  and how?
 With any text editor of your choosing.
 
  Although i am able to see the page telling me that all is working do i
  need to rewrite and recompile the software in order to use it?
 No.
 
  FYI.
  I am using Apache2 and a 2.4 Linux kernel
  After several dozens of tries this is my tomcat-users.xml
 
  ?xml version='1.0' encoding='utf-8'?
  tomcat-users
  role rolename=tomcat/
  role rolename=role1/
  role rolename=manager/
  role rolename=admin/
  user username=root password=w8woord
  roles=standard,tomcat,admin,manager/
  user username=tomcat password=tomcat roles=tomcat/
  user username=both password=tomcat roles=tomcat,role1/
  user username=role1 password=tomcat roles=role1/
  /tomcat-users
 Looks OK to me. Did you restart Tomcat?
 
 Mark
 
 -
 To unsubscribe, e-mail: [EMAIL PROTECTED]
 For additional commands, e-mail: [EMAIL PROTECTED]
 
 


-- 
Thanks and best regards,
Anoop


username passwd

2005-05-04 Thread peter thesing
i am happy
Thanks all for your input now i can explore tomcat further
I have removed  the  words tomcat and standard from the line
Then with rctomcat restart the application was shutdown and restarted 
again with no errors
and Presto, i can log in to both apps

Yours Happy
Peter
-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]


Re: How do I redirect all tomcat ports to use SSL?

2005-05-04 Thread Donny R Rota
Thanks, I use security-constraints now, and I've been looking for this 
answer for weeks.
I've not found that option available.  Can you send me an URL to this?
In the mean time, I'm going to see if I can find that option in my other 
sources.
thanks!
...Don...

--
Don Rota, CTG Operations
Rational Software, IBM Software Group
20 Maguire Road, Lexington, MA 02421-3104 
Tel: 781 676 2655, Fax: 781 676 7645 
[EMAIL PROTECTED] 



Fabian Pena [EMAIL PROTECTED] 
05/04/2005 04:51 PM
Please respond to
Tomcat Users List


To
Tomcat Users List tomcat-user@jakarta.apache.org
cc

Subject
Re: How do I redirect all tomcat ports to use SSL?






In a web application, you can edit your web.xml file and add a 
security-constraint to redirect all application requests to SSL.

I Hope this help

Fabian

Donny R Rota wrote:
 
 This weeks puzzler  8^)
 
 I want all my Tomcat requests to go through SSL.
 I setup tomcat, and got port 80 and port 443 (SSL) working.
 But I cannot redirect port 80 to 443.  I keep getting refused:
 
 Is there a way in Tomcat to redirect all port 80 requests to SSL(443)?
 I know you can do it the other way around 8443 - 80.
 I'm just running standalone Tomcat, no Apache.
 
 
 advTHANKSance!
 ...Don...
 
 --
 Don Rota, CTG Operations
 Rational Software, IBM Software Group
 20 Maguire Road, Lexington, MA 02421-3104
 Tel: 781 676 2655, Fax: 781 676 7645
 [EMAIL PROTECTED]
 
 
 
 
 No virus found in this incoming message.
 Checked by AVG Anti-Virus.
 Version: 7.0.308 / Virus Database: 266.11.3 - Release Date: 03/05/2005

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]




How to stop Session Tracking, or stop extraction of ;jsessionid=XXX from requested URL

2005-05-04 Thread Jedidiah Northridge
Hello,

I don't need the functionality of session tracking, either through URL
rewriting or via Cookie assignment.  Is there anyway I can disable it
completely?

More specifically, is there anyway I can stop my Tomcat from
extracting the ;jsessionid=XXX from an incoming URI?  At present,
when I analyze an incoming request, if the requested URI looks
something like: /index.html;jsessionid=XXX by the time it reaches my
servlet, it has been changed to /index.html.

I'm running 5.0.28, and I'm using mod_jk2 as my Connector.  When I
debug the situation, I'm seeing the URI being changed as part of
org.apache.coyote.tomcat5.CoyoteAdapter's parseSessionID.  The method
first parses out the session id, and then extracts it.  For test
purposes, I've used the HTTP Listener as my Connector, and I still see
the same extraction behavior in CoyoteAdapter.

I'm asking about this because I'm using my Tomcat as a reverse proxy. 
I'm encountering difficulty when my Tomcat proxy sits in between a
client and a backend Tomcat that legitimately uses URL rewriting for
session tracking.  When the backend tomcat rewrites a
;jsessionid=XXX as part of a response, this gets back to the client,
but when the client requests it, my proxy tomcat (in the middle)
consumes the jsessionid that was meant for the backend.  I presume
this unnecessarily uses memory for session tracking (in the middle),
but it definitely strips out the URL so that the jsessionid doesn't
make it to the backend.

I understand how to re-attach the ;jsessionid using the Session API
before proxying the request to the backend.  However, seeing as I
don't need the session tracking (for the tomcat in the middle), I'd
like to stop the process before it starts.  Is this possible to
achieve using any configuration options?  Or programmatically?  I see
how to change CoyoteAdapter; but would prefer to avoid changing Tomcat
code.  If the only way to stop it all together is to alter tomcat
code, is CoyoteAdapter the place to do it, or do you recommend
another, more correct, place to make a change?

Thank you very much,

-Jed Northridge

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: tomcat stopped

2005-05-04 Thread Wendy Smoak
From: Fred Cook [EMAIL PROTECTED]

 We just use cp to get foo.war into the webapps dir.  But we shut down
 tomcat first, then restart it.
 The exact steps:

 We build our test app under a  /home file system, then cp the .war
 file to the Tomcat webapps dir , Tomcat is under the same /home file
 system.

 Shut down Tomcat.
 Startup Tomcat.

 Go to //localhost:8080/foo/ with FireFox, we see a blank screen.

This is based on my experience with Tomcat 4.1.  If you're using 5, things
might be different.  That said, try this:
   1. shut down Tomcat
   2. delete the 'myapp' directory under webapps
   3. copy the new myapp.war file into webapps
   4. start Tomcat

I assume you have Tomcat configured to explode the .war file.  If you don't
delete the directory, Tomcat won't ever explode your new .war file.
(Alternately, configure it to run from the un-exploded .war file.)

 It concerns me that the Manager does not run from localhost:8080 or
anything else for that matter.
 I think the first step maybe to get Tomcats home page links working.

Did it ever work?  Do you get the authentication challenge? Did you add a
user to tomcat-users.xml with the correct roles?

Are you certain you're compiling against the same version of servlet.jar (or
the equivalent) that you're running with?

-- 
Wendy Smoak



-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: How to stop Session Tracking, or stop extraction of ;jsessionid=XXX from requested URL

2005-05-04 Thread Tim Funk
The easiest thing to do is to change all your jsp's to have the following code.
[EMAIL PROTECTED] session='false'%
Then unless you have code specifically asking for a session - no sessions 
should be created.

A simplier but uglier kludge is to create a Filter which overrides getSession 
and always returns null instead of allowing a session to be created.

-Tim
Jedidiah Northridge wrote:
Hello,
I don't need the functionality of session tracking, either through URL
rewriting or via Cookie assignment.  Is there anyway I can disable it
completely?
More specifically, is there anyway I can stop my Tomcat from
extracting the ;jsessionid=XXX from an incoming URI?  At present,
when I analyze an incoming request, if the requested URI looks
something like: /index.html;jsessionid=XXX by the time it reaches my
servlet, it has been changed to /index.html.
I'm running 5.0.28, and I'm using mod_jk2 as my Connector.  When I
debug the situation, I'm seeing the URI being changed as part of
org.apache.coyote.tomcat5.CoyoteAdapter's parseSessionID.  The method
first parses out the session id, and then extracts it.  For test
purposes, I've used the HTTP Listener as my Connector, and I still see
the same extraction behavior in CoyoteAdapter.
I'm asking about this because I'm using my Tomcat as a reverse proxy. 
I'm encountering difficulty when my Tomcat proxy sits in between a
client and a backend Tomcat that legitimately uses URL rewriting for
session tracking.  When the backend tomcat rewrites a
;jsessionid=XXX as part of a response, this gets back to the client,
but when the client requests it, my proxy tomcat (in the middle)
consumes the jsessionid that was meant for the backend.  I presume
this unnecessarily uses memory for session tracking (in the middle),
but it definitely strips out the URL so that the jsessionid doesn't
make it to the backend.

I understand how to re-attach the ;jsessionid using the Session API
before proxying the request to the backend.  However, seeing as I
don't need the session tracking (for the tomcat in the middle), I'd
like to stop the process before it starts.  Is this possible to
achieve using any configuration options?  Or programmatically?  I see
how to change CoyoteAdapter; but would prefer to avoid changing Tomcat
code.  If the only way to stop it all together is to alter tomcat
code, is CoyoteAdapter the place to do it, or do you recommend
another, more correct, place to make a change?
Thank you very much,
-Jed Northridge
-
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]


Re: How do I redirect all tomcat ports to use SSL?

2005-05-04 Thread Hassan Schroeder
Donny R Rota wrote:
Thanks, I use security-constraints now, and I've been looking for this 
answer for weeks.
I've not found that option available.  Can you send me an URL to this?
In the mean time, I'm going to see if I can find that option in my other 
sources.
Uh, your other sources would presumably include a copy of the
Servlet spec? :-)   (That'd be SRV12.8 in the 2.4 spec, BTW)
--
Hassan Schroeder - [EMAIL PROTECTED]
Webtuitive Design ===  (+1) 408-938-0567   === http://webtuitive.com
  dream.  code.

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]


Re: Network Disk Not Exist Under Tomcat-5.5.9

2005-05-04 Thread NanFei Wang
Dear Jason:
You are right :
-
Uhm you don't want to do that, running any service as Administrator is
just asking for trouble.
You want a dedicated service account for tomcat, there were some posts
about the pernissions and privileges required for such an account a
while back.
 ---

I use Apache Tomcat-5.5.9 which will give web service automatically.
My solution can only solve the 'network disk' mapping only to some
'shareFile' at server side .
For the 'network disk' mapping to other 'shareFile' over the network, it is
in failure !
I really need to access the 'shareFile' in other computers over network in
my Api.

It can only think about to use 'network disk mapping' to access the
'shareFile' over network,
I don't know is it right or not !

Any idea ? Thanks

- NanFei



- Original Message - 
From: NanFei Wang [EMAIL PROTECTED]
To: Tomcat Users List tomcat-user@jakarta.apache.org
Sent: Wednesday, May 04, 2005 9:21 PM
Subject: Re: Network Disk Not Exist Under Tomcat-5.5.9


 Hi,
 I have found the solution as follow:
 change tomcat service account:
 Control Panel  Administrative Tools  Services
 change tomcat service log on account: administrator

 Now,it works.
 the test.jsp will get Y:\ exists()=true

 - NanFei

 - Original Message - 
 From: NanFei Wang [EMAIL PROTECTED]
 To: Tomcat Users List tomcat-user@jakarta.apache.org
 Sent: Wednesday, May 04, 2005 5:47 PM
 Subject: Re: Network Disk Not Exist Under Tomcat-5.5.9


  Dear Peter,
  I have already mapped a Network Disk named 'Y'.
 
  My question is :
  If the webserver is Tomcat with ver.earlier than Tomcat-5.5.9(like
 5.0.18),
  Then the test.jsp will get Y:\ exists()=true
  But with  Tomcat-5.5.9 ,the test.jsp will get Y:\ exists()=false
 
  Thanks
 
  - NanFei
 
 
  - Original Message - 
  From: Peter Crowther [EMAIL PROTECTED]
  To: Tomcat Users List tomcat-user@jakarta.apache.org
  Sent: Wednesday, May 04, 2005 3:59 PM
  Subject: RE: Network Disk Not Exist Under Tomcat-5.5.9
 
 
   From: NanFei Wang [mailto:[EMAIL PROTECTED]
   Why Network Disk Not Exist Under Tomcat-5.5.9 ?
 
  Are you running Tomcat as a service?  If so, remember that drive
  mappings (eg. mapping Y: to \\myserver\myshare) are user- and
  session-specific.  You have mapped a drive as a user; the services on
  your computer know nothing about this.
 
  - Peter
 
  -
  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]
 
 

 -
 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]



Re: Network Disk Not Exist Under Tomcat-5.5.9

2005-05-04 Thread Jason Bainbridge
On 5/4/05, NanFei Wang [EMAIL PROTECTED] wrote:
 Dear Jason:
 You are right :
 -
 Uhm you don't want to do that, running any service as Administrator is
 just asking for trouble.
 You want a dedicated service account for tomcat, there were some posts
 about the pernissions and privileges required for such an account a
 while back.
  ---
 
 I use Apache Tomcat-5.5.9 which will give web service automatically.
 My solution can only solve the 'network disk' mapping only to some
 'shareFile' at server side .
 For the 'network disk' mapping to other 'shareFile' over the network, it is
 in failure !
 I really need to access the 'shareFile' in other computers over network in
 my Api.

Run it under an account that has network privileges and access to the
share and acces the share by using the UNC path in the format:

\\machinename\sharename

Regards,
-- 
Jason Bainbridge
http://kde.org - [EMAIL PROTECTED]
Personal Site - http://jasonbainbridge.com

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: Amount of free disk space

2005-05-04 Thread QM
On Wed, May 04, 2005 at 09:09:53AM +0100, Peter Crowther wrote:
:  From: Mark Benussi [mailto:[EMAIL PROTECTED]
:  Is there a Java API call I can make to detect how much disk
:  space has been
:  allocated to my account and the current amount used?
: 
: Depending on how hard they've nailed down the lid on Tomcat, you *might*
: be able to invoke UNIX executables using Runtime.exec().

For the OP -- does the code have to be Java?

If the provider permits cronjobs, write a shell/perl/PHP script to
periodically check your disk usage and dump it to a database (or some
other place the Java app can get to it).

-QM

-- 

software   -- http://www.brandxdev.net/
tech news  -- http://www.RoarNetworX.com/
code scan  -- http://www.JxRef.org/

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



symlink not being completely followed

2005-05-04 Thread Scott Heitkamp
I've setup tomcat to follow a symlink to a directory outside of the webapp.  
That part works just fine.  I can load a jsp that is linked outside the webapp 
directory.  The problem that I am having is that Tomcat is not allowing a Java 
Servlet to completely follow the symlink.
 
Here is what I've got:
webapp/images - /images
/images/image.jpg - subdir/image.jpg
 
When the servlet tries to access the file webapp/images/image.jpg Java doesn't 
think the file exists.  When I print out the canonical path of the file all I 
get is /images/image.jpg.  This is not correct, I should get 
/images/subdir/image.jpg.  My first instinct was that this was a Java problem.  
But I tested it in a basic java program and the image loaded up just fine.  
Which leads me to believe that I have a problem with my Tomcat configuration.
 
I am running Tomcat 5.0.28 on IRIX.


-
Do you Yahoo!?
 Yahoo! Mail - You care about security. So do we.

Re: symlink not being completely followed

2005-05-04 Thread Jason Bainbridge
On 5/4/05, Scott Heitkamp [EMAIL PROTECTED] wrote:
 I've setup tomcat to follow a symlink to a directory outside of the webapp.  
 That part works just fine.  I can load a jsp that is linked outside the 
 webapp directory.  The problem that I am having is that Tomcat is not 
 allowing a Java Servlet to completely follow the symlink.

Do you have allowLinking set to true?

-- 
Jason Bainbridge
http://kde.org - [EMAIL PROTECTED]
Personal Site - http://jasonbainbridge.com

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: symlink not being completely followed

2005-05-04 Thread Scott Heitkamp
Yes, I have allowLinking=true in my Context for the webapp I'm working with.

Jason Bainbridge [EMAIL PROTECTED] wrote:On 5/4/05, Scott Heitkamp wrote:
 I've setup tomcat to follow a symlink to a directory outside of the webapp. 
 That part works just fine. I can load a jsp that is linked outside the webapp 
 directory. The problem that I am having is that Tomcat is not allowing a Java 
 Servlet to completely follow the symlink.

Do you have allowLinking set to true?

-- 
Jason Bainbridge
http://kde.org - [EMAIL PROTECTED]
Personal Site - http://jasonbainbridge.com

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]




-
Yahoo! Mail
 Stay connected, organized, and protected. Take the tour

Re: Network Disk Not Exist Under Tomcat-5.5.9

2005-05-04 Thread NanFei Wang
Hi, Jason
Would you please to give me a sample code in a *.jsp file
to show how to use \\machinename\sharename

I try to use my test.jsp file as follow
---
%@ page language=java contentType=text/html;charset=Big5 %
%
  String uncPath=remotehostname\\sharedname;
  java.io.File uncPathF= new java.io.File(uncPath);
  out.print(br);
  out.println(uncPath+ exists()=+uncPathF.exists());
%
---
I get: \\remotehostname\sharedname exists()=false
In my Api, I really need to access the 'shareDirectory' in other computers
over network .


If my test.jsp(where 'Y' is mapped) with follow:
---
%@ page language=java contentType=text/html;charset=Big5 %
%
String netWorkDisk=Y:\\;
java.io.File netWorkDiskF= new java.io.File(netWorkDisk);
out.println(netWorkDisk+ exists()=+netWorkDiskF.exists());
%
---
If I use Tomcat-5.0.18 working in Window2000 and start by startup.bat in
another Dos Window after log-in with administrator,
then the test.jsp will get Y:\ exists()=true

If I use Apache Tomcat-5.5.9 which will give web 'Service' automatically,
(no matter if I log-in with administrator or not log-in)
then the test.jsp will get Y:\ exists()=false;

Please advise
Regards

- NanFei








- Original Message - 
From: Jason Bainbridge [EMAIL PROTECTED]
To: Tomcat Users List tomcat-user@jakarta.apache.org
Sent: Thursday, May 05, 2005 10:04 AM
Subject: Re: Network Disk Not Exist Under Tomcat-5.5.9


On 5/4/05, NanFei Wang [EMAIL PROTECTED] wrote:
 Dear Jason:
 You are right :
 -
 Uhm you don't want to do that, running any service as Administrator is
 just asking for trouble.
 You want a dedicated service account for tomcat, there were some posts
 about the pernissions and privileges required for such an account a
 while back.
  ---

 I use Apache Tomcat-5.5.9 which will give web service automatically.
 My solution can only solve the 'network disk' mapping only to some
 'shareFile' at server side .
 For the 'network disk' mapping to other 'shareFile' over the network, it
is
 in failure !
 I really need to access the 'shareFile' in other computers over network in
 my Api.

Run it under an account that has network privileges and access to the
share and acces the share by using the UNC path in the format:

\\machinename\sharename

Regards,
-- 
Jason Bainbridge
http://kde.org - [EMAIL PROTECTED]
Personal Site - http://jasonbainbridge.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]