TC4 SSL HOWTO

2001-08-16 Thread Christopher Cain

Okay, I finally got around to writing that SSL HOWTO I kept promising. It's 
attached.

Yeah, yeah, it's a plain old text file. I can't be bothered with XHTML or 
DocBooks at 2:00am =)

Seriously, though, the doc format stuff is still kind of up in the air AFAIK, 
and I wasn't sure how or where (or if) this would make sense in the tree, so 
let me know if you want it in a certain format and I'll see what I can do.

As always, feel free to read it, rip it apart, suggest corrections, anything. I 
went with this basic approach:

Section 1: Quickstart (the wham-bam summary for experts)

Section 2: Fluffy stuff (A brief tour of What is SSL, SSL and Tomcat, Tips 
on Running SSL, etc.)

Section 3: Detailed install/config steps

Section 4: Troubleshooting (all common mistakes/exceptions and their remedies)

If you think it's too much, let me know.

Also, I'll make the minor changes necessary and fire off a TC 3.3 version in 
the morning.

Love to the family,

- Christopher


  Tomcat 4.0 Standalone - SSL Configuration


Author: Christopher Cain
[EMAIL PROTECTED]

QUICKSTART VERSION

1. Download JSSE 1.0.2 or later and make it an installed extension by copying
   the JAR files into $JAVA_HOME/jre/lib/ext.

2. Create the certificate keystore

   keytool -genkey -alias tomcat -keyalg RSA

3. Add the com.sun.net.ssl.internal.ssl.Provider provider to the
   java.security file.

4. Uncomment the secure connector example in server.xml and tweak as necessary

INTRODUCTION TO SSL

SSL, or Secure Socket Layer, is a technology which allows web browsers and
web servers to communicate over a secured connection. This means that the data
being sent is encrypted by one side, transmitted, then decrypted by the other
side prior to any processing. This is a two-way process, meaning that both the
server AND the browser encrypt all traffic before sending out data.

Another important aspect of the SSL protocol is Authentication. The means that
during your initial attempt to communicate with a web server over a secure
connection, that server will present your web browser with a set of
credentials, in the form of a Certificate, as proof the site is who and what
it claims to be. In certain cases, the server may also request a Certificate
from your web browser, asking for proof that YOU are who you claim to be.
This is known as Client Authentication, although in practice this is a
somewhat rare and highly specialized configuration. Most SSL-enabled web
servers do not request Client Authentication.

SSL AND TOMCAT

It is important to note that configuring Tomcat to take advantage of secure
sockets is usually only necessary when running it as a standalone web server.
When running Tomcat primarily as a Servlet/JSP engine behind another web
server, such as Apache or Microsoft IIS, it is usually necessary to configure
the primary web server to handle the SSL connections. Typically, this server
will negotiate all SSL-related functionality, then pass on any requests
destined for the Tomcat engine only after decrypting those requests. In this
environment, Tomcat does not know, nor does it care, that communications
between the primary web server and the client are taking place over a secure
connection. It transmits and receives data just as it normally would.

CERTIFICATES

In order to implement SSL, a web server must have an associated
Certificate for each external interface (IP address) that accepts secure
connections. The theory behind this design is that a server should provide
some kind of reasonable assurance that its owner is who you think it is,
particularly before receiving any sensitive information. While a broader
explanation of Certificates is beyond the scope of this document, think of a
Certificate as a digital driver's license for an internet address. It states
what company the address is associated with, along with some basic contact
information about the site owner or administrator. This driver's license
is cryptographically signed by its owner, and an official Certificate is
therefore extremely difficult for anyone else to forge. For sites involved in
e-commerce, or any other business in which Authentication of identity is
important, an official certificate is typically purchased from a well-known
Certificate Authority (CA) such as VeriSign or Thawte.

In many cases, however, Authentication is not a really a concern. An
administrator may simply want to ensure that the data being transmitted and
received by the server is private and cannot be snooped by anyone who may be
eavesdropping on the connection. Fortunately, Sun provides a relatively simple
command-line tool, called keytool, which can easily create Self-Signed
Certificates. Self-signed Certificates are simply user-generated Certificates
which have not been officially blessed by any well-known CA and are therefore
not really guaranteed to be authenticate at all. Again, this may or may not
even be important, depending on your specific requirements and needs.

Re: TC4 SSL HOWTO

2001-08-16 Thread Christopher Cain

Oops ... one other thing. If someone decides to commit this as-is, please 
add '(passwords: changeit)' to Step 3 of the QUICKSTART section.

- Christopher



Unfound Package Error Message

2001-08-16 Thread Peter Joanes

Hello,

I have a server running tomcat 4.0 beta 7.
I put on it an application that sends email, so mail.jar is in the 
WEB-INF/lib directory.
I got a very unuseful error message when accessing the relevant JSP:

Root Cause:
java.lang.NumberFormatException:  Could not find package named
at java.lang.Throwable.(Throwable.java:96)
at java.lang.Exception.(Exception.java:44)
at java.lang.RuntimeException.(RuntimeException.java:49)
etc..

The problem is that to find out what was wrong I had to move the application 
to my desktop PC which is running tomcat 4.0 beta 6.
This produced a far superior error message that made it clear that I had 
forgotten to put activation.jar into the WEB-INF/lib directory (required for 
javamail).

If you want any more detail on these messages get back to me. I would be very 
grateful if future tomcat 4s can revert to helpful error messages in this 
situation.

Regards,
Peter Joanes
[EMAIL PROTECTED]



cvs commit: jakarta-tomcat-connectors/webapp README.txt

2001-08-16 Thread pier

pier01/08/16 08:41:18

  Modified:webapp   README.txt
  Log:
  Updated the README file to avoid confusion.
  
  Revision  ChangesPath
  1.14  +17 -2 jakarta-tomcat-connectors/webapp/README.txt
  
  Index: README.txt
  ===
  RCS file: /home/cvs/jakarta-tomcat-connectors/webapp/README.txt,v
  retrieving revision 1.13
  retrieving revision 1.14
  diff -u -r1.13 -r1.14
  --- README.txt2001/08/06 21:26:10 1.13
  +++ README.txt2001/08/16 15:41:18 1.14
  @@ -1,8 +1,13 @@
   README for WebApp Library and Related Modules
   -
   
  -How to build the WebApp module from CVS sources:
  -
  +How to obtain the WebApp and Apache Portable Runtime sources:
  +-
  +
  +NOTE: If you downloaded a source distribution from our website or a
  +mirror (the file is called webapp-module...src.tar.gz) you don't need
  +to obtain any other file. Please follow this chapter only if you want
  +to obtain the latest CVS version of the sources.
   
   Check out the module sources from CVS using the following commands:
   
  @@ -23,6 +28,16 @@
   script, configure both APR and the WebApp module and compile:
   
   ./support/buildconf.sh
  +
  +To build the sources, now follow the steps in the next chapter.
  +
  +How to build the WebApp module from CVS sources:
  +
  +
  +If you downloaded the CVS sources (as described above) or downloaded a
  +source distribution of the WebApp module, now all you need to do is build
  +the binary module for your platform. To do so, start by doing a:
  +
   ./configure --with-apxs
   make
   
  
  
  



randomFile in SessionIdGenerator TC3.3B1

2001-08-16 Thread Bill Barker

I just lost half an hour of my life trying to set up TC3.3B1 on a
Windows box because I forgot to remove the randomFile attribute on
SessionIdGenerator.  For the benefit of us under-priviledged people who have
to live on systems like Windows and Solaris, could this attribute please be
moved to the comment in the default server.xml?




RE: randomFile in SessionIdGenerator TC3.3B1

2001-08-16 Thread Martin van den Bemt

works well for me ;)) 

 -Original Message-
 From: Bill Barker [mailto:[EMAIL PROTECTED]]
 Sent: Thursday, August 16, 2001 7:19 PM
 To: [EMAIL PROTECTED]
 Subject: randomFile in SessionIdGenerator TC3.3B1
 
 
 I just lost half an hour of my life trying to set up TC3.3B1 on a
 Windows box because I forgot to remove the randomFile attribute on
 SessionIdGenerator.  For the benefit of us under-priviledged 
 people who have
 to live on systems like Windows and Solaris, could this attribute 
 please be
 moved to the comment in the default server.xml?
 
 



Re: randomFile in SessionIdGenerator TC3.3B1

2001-08-16 Thread cmanolache

On Thu, 16 Aug 2001, Bill Barker wrote:

 I just lost half an hour of my life trying to set up TC3.3B1 on a
 Windows box because I forgot to remove the randomFile attribute on
 SessionIdGenerator.  For the benefit of us under-priviledged people who have
 to live on systems like Windows and Solaris, could this attribute please be
 moved to the comment in the default server.xml?

What's going on ? SessionIdGenerator does check if this file exist - which
on windows does not - and does nothing.

Do you get any errors, or is there something broken ??

Costin




New SSL HOWTOs

2001-08-16 Thread Christopher Cain

While creating the 3.3 version of my SSL HOWTO, I also polished off the
wording here and there and added a TOC and section marks for easier
navigation. Attached are both the 3.3 and 4.0 versions of the file.
Consider this 4.0 version to supercede the one I sent last night (or
early this morning, as it were :-)

If someone could please let me know for sure that adding extension JARs
to the {JDK_HOME}/jre/lib/ext directory under JDK 1.1.8 effectively
makes them installed extensions (makes them available without
necessarily being in the CLASSPATH) just like in = JDK 1.2. Other than
that, I'm pretty sure the TC 3.3 version of the doc is valid for JDK
1.1.8 environments as well. If someone a little more familiar with 1.1.8
could maybe give it a quick once-over and see if anything jumps out,
that would be great.

- Christopher


   Tomcat 4.0 Standalone - SSL Configuration


Author: Christopher Cain
[EMAIL PROTECTED]


Contents
===

Section 1: QUICKSTART INSTRUCTIONS

   Instructions

Section 2: SSL PRIMER  TIPS

   Introduction to SSL
   SSL and Tomcat
   Certificates
   General Tips on Running SSL

Section 3: CONFIGURATION

   Configuration Instructions
   Known Issues
   Troubleshooting


- Section 1: Quickstart Instructions --


INSTRUCTIONS

1. Download JSSE 1.0.2 or later and make it an installed extension by copying
   the JAR files into $JAVA_HOME/jre/lib/ext.

2. Create the certificate keystore (passwords: changeit)

   keytool -genkey -alias tomcat -keyalg RSA

3. Add the com.sun.net.ssl.internal.ssl.Provider provider to the
   java.security file.

4. Uncomment the secure connector example in server.xml and tweak as necessary


--- Section 2: SSL Primer and Tips 


INTRODUCTION TO SSL

SSL, or Secure Sockets Layer, is a technology which allows web browsers and
web servers to communicate over a secured connection. This means that the data
being sent is encrypted by one side, transmitted, then decrypted by the other
side prior to any processing. This is a two-way process, meaning that both the
server AND the browser encrypt all traffic before sending out data.

Another aspect of the SSL protocol is Authentication. The means that during
your initial attempt to communicate with a web server over a secure connection,
that server will present your web browser with a set of credentials, in the
form of a Certificate, in an attempt to prove to you that the site you are
accessing is what you think it is. This particular functionality may or may not
be important to you, depending on your circumstances. See the CERTIFICATES
topic for more information.

In certain cases, the server may also request a certificate
from your web browser, asking for proof that YOU are who you claim to be.
This is known as Client Authentication, although in practice this is a
somewhat rare and highly specialized configuration. Most SSL-enabled web
servers do not request Client Authentication, although Tomcat does support it.


SSL AND TOMCAT

It is important to note that configuring Tomcat to take advantage of secure
sockets is usually only necessary when running it as a standalone web server.
When running Tomcat primarily as a Servlet/JSP engine behind another web
server, such as Apache or Microsoft IIS, it is usually necessary to configure
the primary web server to handle the SSL connections. Typically, this server
will negotiate all SSL-related functionality, then pass on any requests
destined for the Tomcat engine only after decrypting those requests. In this
environment, Tomcat does not know, nor does it care, that communications
between the primary web server and the client are taking place over a secure
connection. It transmits and receives data just as it normally would.


CERTIFICATES

In order to implement SSL, a web server must have an associated
certificate for each external interface (IP address) that accepts secure
connections. The theory behind this design is that a server should provide
some kind of reasonable assurance that its owner is who you think it is,
particularly before receiving any sensitive information. While a broader
explanation of certificates is beyond the scope of this document, think of a
certificate as a digital driver's license for an internet address. It states
what company the address is associated with, along with some basic contact
information about the site owner or administrator. This driver's license
is cryptographically signed by its owner, and an official certificate is
therefore extremely difficult for anyone else to forge. For sites involved in
e-commerce, or any other business in which Authentication of identity is
important, an official certificate is typically purchased from a well-known
Certificate Authority (CA) such as VeriSign or Thawte.

In many cases, however, Authentication is not a really a concern. An
administrator may simply want to ensure 

Re: TC4 SSL HOWTO

2001-08-16 Thread Rob S.

 haven't heard any feedback (other than that the stupid XML parsers on
 Windows won't do includes of relative paths correctly, which I need to
 figure out a workaround for), so I'm going on the lazy
 consensus assumption until someone gripes about that approach and
 suggests something different/better.

I'm the *only* person that had a problem with it?  Anyone else using Win98 w/Cygwin to 
build Tomcat?  Funk!  grumble  Well it hopefully won't be an issue once I get back 
and can use *nix =)

- r




RE: New SSL HOWTOs

2001-08-16 Thread Larry Isaacs

Actually JDK 1.1.8 doesn't support the jre/lib/ext directory.
This was new for Java2.  I'll review the documents before
committing them.  Thanks for the help.

Larry

 -Original Message-
 From: Christopher Cain [mailto:[EMAIL PROTECTED]]
 Sent: Thursday, August 16, 2001 2:12 PM
 To: Tomcat-Dev
 Subject: New SSL HOWTOs
 
 
 While creating the 3.3 version of my SSL HOWTO, I also 
 polished off the
 wording here and there and added a TOC and section marks for easier
 navigation. Attached are both the 3.3 and 4.0 versions of the file.
 Consider this 4.0 version to supercede the one I sent last night (or
 early this morning, as it were :-)
 
 If someone could please let me know for sure that adding 
 extension JARs
 to the {JDK_HOME}/jre/lib/ext directory under JDK 1.1.8 effectively
 makes them installed extensions (makes them available without
 necessarily being in the CLASSPATH) just like in = JDK 1.2. 
 Other than
 that, I'm pretty sure the TC 3.3 version of the doc is valid for JDK
 1.1.8 environments as well. If someone a little more familiar 
 with 1.1.8
 could maybe give it a quick once-over and see if anything jumps out,
 that would be great.
 
 - Christopher
 



Re: TC4 SSL HOWTO

2001-08-16 Thread Craig R. McClanahan



On Thu, 16 Aug 2001, Rob S. wrote:

  haven't heard any feedback (other than that the stupid XML parsers on
  Windows won't do includes of relative paths correctly, which I need to
  figure out a workaround for), so I'm going on the lazy
  consensus assumption until someone gripes about that approach and
  suggests something different/better.
 
 I'm the *only* person that had a problem with it?  Anyone else using
 Win98 w/Cygwin to build Tomcat?  Funk!  grumble Well it hopefully
 won't be an issue once I get back and can use *nix =)
 

Nah .. it happens to me too on Win98 without Cygwin  :-(

 - r
 
 

Craig





Re: New SSL HOWTOs

2001-08-16 Thread Christopher Cain

D'oh! Sorry about that, I thought I remembered it being there back when
I ran the 1.1.8 JDK, but I've slept since then. :)

The relevant places that will require a slight editing, then, are:

* Section 1 - Quickstart Instructions, step 1

* Section 3 - Configuration Instructions, step zero ;-)

* Section 3 - Troubleshooting, item 1

Does 3.3 use the same style DTD as the 4.0 branch (assuming that you
want a tag-ized version of it)?

Also, can I make a suggestion that both branches remove the current
instruction comments in server.xml and instead just provide a pointer to
wherever this doc will be located? It'll be a little easier for me to
keep everything up to date if I (or anyone else) only have to worry
about maintaining it in one place respectively.

- Christopher

Larry Isaacs wrote:
 
 Actually JDK 1.1.8 doesn't support the jre/lib/ext directory.
 This was new for Java2.  I'll review the documents before
 committing them.  Thanks for the help.
 
 Larry
 
  -Original Message-
  From: Christopher Cain [mailto:[EMAIL PROTECTED]]
  Sent: Thursday, August 16, 2001 2:12 PM
  To: Tomcat-Dev
  Subject: New SSL HOWTOs
 
 
  While creating the 3.3 version of my SSL HOWTO, I also
  polished off the
  wording here and there and added a TOC and section marks for easier
  navigation. Attached are both the 3.3 and 4.0 versions of the file.
  Consider this 4.0 version to supercede the one I sent last night (or
  early this morning, as it were :-)
 
  If someone could please let me know for sure that adding
  extension JARs
  to the {JDK_HOME}/jre/lib/ext directory under JDK 1.1.8 effectively
  makes them installed extensions (makes them available without
  necessarily being in the CLASSPATH) just like in = JDK 1.2.
  Other than
  that, I'm pretty sure the TC 3.3 version of the doc is valid for JDK
  1.1.8 environments as well. If someone a little more familiar
  with 1.1.8
  could maybe give it a quick once-over and see if anything jumps out,
  that would be great.
 
  - Christopher
 



Exception when hitting stop on slow servlet..

2001-08-16 Thread Martin van den Bemt

Hi,

Just got an exception on a slow servlet and probably hit stop on the right
moment, because it didn't happen anymore after that, so this one is easy to
mis..

(sorry I cannot copy and paste so bear with me..)

Ajp13Interceptor: Processing connection
org.apache.tomcat.util.net.TcpConnection - java.net.SocketException:
Connection reset by peer (maby this must be Pier?)
 java.net.SocketInputStream.socketRead (native method)
 java.net.SocketInputStream.read (86)
 org.apache.tomcat.modules.server.Ajp13.receive(Ajp13.java:647)
 org.apache.tomcat.modules.server.Ajp13.receiveNextRequest(Ajp13.java:241)

org.apache.tomcat.modules.server.Ajp13Request.receiveNextRequest(Ajp13Interc
eptor.java:218)

org.apache.tomcat.modules.server.Ajp13Interceptor.processConnection(Ajp13Int
erceptor.java:153)
 org.apache.tomcat.util.net.TcpWorkerThread.runIt(PoolTcpEndpoint.java:438)
 snap (horrible to manually type this).

The exception doesn't end up in a log file and only goes to the console and
the exception is correct ;)). Maby catching and logging it would look a bit
better, so for that reason (cannot test btw, since I cannot reproduce it
anymore, ehh after 15 minutes of stopping request I gave up..) I added a
little bit of catching and tried to add logging, but the log(blah) didn't
compile anymore..
Also I don't know if this change fuckes up the rest and must be caught at
the Interceptor..

Hope this is usefull, if not : I've tried ;))

Mvgr,
Martin


Index: Ajp13.java
===
RCS file: 
/home/cvspublic/jakarta-tomcat/src/share/org/apache/tomcat/modules/server/Ajp13.java,v
retrieving revision 1.21
diff -r1.21 Ajp13.java
647c647,653
   int rd = in.read( b, 0, H_SIZE );
---
   int rd = 0;
   try {
   rd = in.read( b, 0, H_SIZE );
   }catch(java.net.SocketException se) {
   //XXX log(client-side terminated request);
   }
   



FW: Version

2001-08-16 Thread Martin van den Bemt

Based on this (and other reactions) maby adding a -version to the startup
options is a good idea ?

mvgr,
Martin

-Original Message-
From: Barnabas Yohannes [mailto:[EMAIL PROTECTED]]
Sent: Thursday, August 16, 2001 9:38 PM
To: [EMAIL PROTECTED]
Subject: Version


Folks,
How do I know what version of tomcat I have on my apache server?  This dude
who installed tomcat for us, I think, he installed only the beta release of
tomcat.  Now, he is asking $10,000 to fix it.  Oh holly cow! was my bosses
reaction.:)

I used the command:

openssl version -a

But it only gave me the ssl version.

Any help will be appreciated!




Re: Exception when hitting stop on slow servlet..

2001-08-16 Thread Pier P. Fumagalli

Martin van den Bemt at [EMAIL PROTECTED] wrote:

 Hi,
 
 Just got an exception on a slow servlet and probably hit stop on the right
 moment, because it didn't happen anymore after that, so this one is easy to
 mis..
 
 (sorry I cannot copy and paste so bear with me..)
 
 Ajp13Interceptor: Processing connection
 org.apache.tomcat.util.net.TcpConnection - java.net.SocketException:
 Connection reset by peer (maby this must be Pier?)

I'm not doing AJP nor mod_jk... Sorry.

Pier




cvs commit: jakarta-tomcat-4.0/webapps/tomcat-docs ssl-howto.xml build.xml index.xml project.xml

2001-08-16 Thread craigmcc

craigmcc01/08/16 13:21:54

  Modified:webapps/tomcat-docs build.xml index.xml project.xml
  Added:   webapps/tomcat-docs ssl-howto.xml
  Log:
  Add Christopher Cain's *excellent* SSL HOWTO to the Tomcat 4 documentation
  app (tomcat-docs).  I took a couple of minor liberties with the wording,
  but the rest was great.
  
  Submitted by: Christopher Cain [EMAIL PROTECTED]
  
  Revision  ChangesPath
  1.7   +6 -1  jakarta-tomcat-4.0/webapps/tomcat-docs/build.xml
  
  Index: build.xml
  ===
  RCS file: /home/cvs/jakarta-tomcat-4.0/webapps/tomcat-docs/build.xml,v
  retrieving revision 1.6
  retrieving revision 1.7
  diff -u -r1.6 -r1.7
  --- build.xml 2001/08/06 19:08:51 1.6
  +++ build.xml 2001/08/16 20:21:54 1.7
  @@ -53,7 +53,9 @@
 file=appdev/build.xml.txt/
   
   !-- Catalina Functional Specifications --
  -!-- Placeholder - no current static files to copy --
  +!--
  +mkdir dir=${webapps.build}/${webapp.name}/catalina/funcspecs/
  +--
   
   !-- Catalina Javadocs --
   mkdir dir=${webapps.build}/${webapp.name}/catalina/docs/api/
  @@ -113,7 +115,9 @@
   /style
   
   !-- Catalina Functional Specifications --
  +!--
   mkdir dir=${webapps.build}/${webapp.name}/catalina/
  +mkdir dir=${webapps.build}/${webapp.name}/catalina/funcspecs/
   style basedir=funcspecs
  destdir=${webapps.build}/${webapp.name}/catalina/funcspecs
extension=.html
  @@ -122,6 +126,7 @@
 includes=*.xml
 param name=relative-path expression=../../
   /style
  +--
   
   !-- Server Configuration Reference --
   style basedir=config
  
  
  
  1.6   +3 -0  jakarta-tomcat-4.0/webapps/tomcat-docs/index.xml
  
  Index: index.xml
  ===
  RCS file: /home/cvs/jakarta-tomcat-4.0/webapps/tomcat-docs/index.xml,v
  retrieving revision 1.5
  retrieving revision 1.6
  diff -u -r1.5 -r1.6
  --- index.xml 2001/08/06 20:24:07 1.5
  +++ index.xml 2001/08/16 20:21:54 1.6
  @@ -62,6 +62,9 @@
   - Reference manual that documents all available elements and attributes
 that may be placed into a Tomcat 4 codeconf/server.xml/code file.
   /li
  +lia href=ssl-howto.htmlstrongSSL HOW-TO/strong/a - Installing and
  +configuring SSL support so that your Tomcat will serve requests using
  +the codehttps/code protocol./li
   /ul
   
   /section
  
  
  
  1.6   +1 -0  jakarta-tomcat-4.0/webapps/tomcat-docs/project.xml
  
  Index: project.xml
  ===
  RCS file: /home/cvs/jakarta-tomcat-4.0/webapps/tomcat-docs/project.xml,v
  retrieving revision 1.5
  retrieving revision 1.6
  diff -u -r1.5 -r1.6
  --- project.xml   2001/08/06 20:24:07 1.5
  +++ project.xml   2001/08/16 20:21:54 1.6
  @@ -24,6 +24,7 @@
   
   menu name=Administrators
   item name=Config. Reference href=config/index.html/
  +item name=SSL HOW-TOhref=ssl-howto.html/
   /menu
   
   menu name=Application Developers
  
  
  
  1.1  jakarta-tomcat-4.0/webapps/tomcat-docs/ssl-howto.xml
  
  Index: ssl-howto.xml
  ===
  ?xml version=1.0?
  !DOCTYPE document [
!ENTITY project SYSTEM project.xml
  ]
  document
  
  project;
  
  properties
  author email=[EMAIL PROTECTED]Christopher Cain/author
  titleSSL Configuration HOW-TO/title
  /properties
  
  body
  
  
  section name=Quick-Start Version
  
  pTo install and configure SSL support on Tomcat 4, you need to follow
  these simple steps.  For more information, read the rest of this HOW-TO./p
  ol
  liDownload JSSE 1.0.2 (or later) from
  a 
href=http://java.sun.com/products/jsse/;http://java.sun.com/products/jsse//a
  and make it an eminstalled extension/em by copying the included JAR
  files into code$JAVA_HOME/jre/lib/ext/code./libr/br/
  liCreate a certificate keystore by executing the following command:
  source
  keytool -genkey -alias tomcat -keyalg RSA
  /source
  and specify a password value of changeit./libr/br/
  liEdit code$JAVA_HOME/jre/lib/security/java.security/code and add
  source
  security.provider.2=com.sun.net.ssl.internal.ssl.Provider
  /source
  (if you already have a codesecurity.provider.2/code entry, use the
  next available numeric identifier)./libr/br/
  liUncomment the SSL HTTP/1.1 Connector entry in
  code$CATALINA_HOME/conf/server.xml/code and tweak as necessary./li
  br/br/
  /ol
  
  
  /section
  
  
  section name=Introduction to SSL
  
  pSSL, or Secure Socket Layer, is a technology which allows web browsers and
  web servers to communicate over a secured connection.  This means that 

RE: Exception when hitting stop on slow servlet..

2001-08-16 Thread Martin van den Bemt

Keep forgetting that.. mod_webapp crashes are yours ;)).. 

 -Original Message-
 From: Pier P. Fumagalli [mailto:[EMAIL PROTECTED]]
 Sent: Thursday, August 16, 2001 10:20 PM
 To: [EMAIL PROTECTED]
 Subject: Re: Exception when hitting stop on slow servlet..
 
 
 Martin van den Bemt at [EMAIL PROTECTED] wrote:
 
  Hi,
  
  Just got an exception on a slow servlet and probably hit stop 
 on the right
  moment, because it didn't happen anymore after that, so this 
 one is easy to
  mis..
  
  (sorry I cannot copy and paste so bear with me..)
  
  Ajp13Interceptor: Processing connection
  org.apache.tomcat.util.net.TcpConnection - java.net.SocketException:
  Connection reset by peer (maby this must be Pier?)
 
 I'm not doing AJP nor mod_jk... Sorry.
 
 Pier
 
 



FW: i18n UTF to ISO charsets conversions..

2001-08-16 Thread Martin van den Bemt

Hi guys,

I think my message got lost on tomcat-user and will never be replies to
;((..
Since tomcat does a lot of translating, I hope one of you guys (or girls?)
can give me a couple of hints how to get this done (if it can be done that
is..)..

TIA,
Mvgr,
Martin

-Original Message-
From: Martin van den Bemt [mailto:[EMAIL PROTECTED]]
Sent: Thursday, August 16, 2001 1:42 PM
To: jakarta-tomcat-user
Subject: i18n UTF to ISO charsets conversions..


Hi,

Just keep in mind that a big system was designed without REAL i18n in mind,
so there are better solutions to storing the data.

We have a 2 part system : one which allowes multiple encodings to be used
(eg an english web user-interface, where you can edit data in a localized
manner). Because of that we have to use UTF-8 for this system.
The other system is showing the result of system 1 localised (so not mixed
as system 1).
Everything is stored as text databases on the file system using the java
default encoding of ISO-8859-1 (even greek text), which works great for
system 2 (just set the appropiate charset in the request header and
everything works well.)

System 1 doesn't have problems with this either, until we want to save
data..
It comes in encoded as UTF-8 and needs to be written to disk as ISO-8859-1
(1000's of files are set up like this and converting those is too much
impact right now)

What I need is to convert the parameter from UTF-8 to ISO-8859-whatever..

As an example 2 headers : (extracted with getReader and read()..)

this is greek text entered in ie..

the ISO-8859-1 encoding
isotext=%EB%E5%F0%F4%EF%EC%DD%F1%E5%E9%E5%F2
the UTF-8 encoding
utf8text=%CE%BB%CE%B5%CF%80%CF%84%CE%BF%CE%BC%CE%AD%CF%81%CE%B5%CE%B9%CE%B5%
CF%82

from ISO to UTF is not a problem, but from UTF-8 to IS0-8859-whatever is
not working..

so I want to get convert utf8text to have the same value as with isotext..

Does anyone know how to handle this conversion or know where to find a class
/ source that can do this conversion?

Hope it makes any sense what I'm asking


TIA

Mvgr,
Martin




Re: cvs commit: jakarta-tomcat-4.0/webapps/tomcat-docs ssl-howto.xml build.xml index.xml project.xml

2001-08-16 Thread Christopher Cain


[EMAIL PROTECTED] wrote:
 
 craigmcc01/08/16 13:21:54

[snip]

 I took a couple of minor liberties with the wording,
 but the rest was great.

_Outstanding_ job on those liberties. The polishing you did in a few
places is superb, and the final version is quite slick. Thanks!

- Christopher



Re: FW: i18n UTF to ISO charsets conversions..

2001-08-16 Thread Craig R. McClanahan



On Thu, 16 Aug 2001, Martin van den Bemt wrote:

 Hi guys,
 
 I think my message got lost on tomcat-user and will never be replies to
 ;((..

Probably 'cause it's not really a Tomcat question.  :-)

 Since tomcat does a lot of translating, I hope one of you guys (or girls?)
 can give me a couple of hints how to get this done (if it can be done that
 is..)..
 

One approach would be to remember that Java uses Unicode internally, so
you could do it in two stages:

  UTF8 -- Reader -- Unicode (in a String) -- Writer -- ISO-8859-1

Just configure the reader to read UTF8, and the writer to write ISO-8859-1
and you should be fine.

 TIA,
 Mvgr,
 Martin
 
Craig


 -Original Message-
 From: Martin van den Bemt [mailto:[EMAIL PROTECTED]]
 Sent: Thursday, August 16, 2001 1:42 PM
 To: jakarta-tomcat-user
 Subject: i18n UTF to ISO charsets conversions..
 
 
 Hi,
 
 Just keep in mind that a big system was designed without REAL i18n in mind,
 so there are better solutions to storing the data.
 
 We have a 2 part system : one which allowes multiple encodings to be used
 (eg an english web user-interface, where you can edit data in a localized
 manner). Because of that we have to use UTF-8 for this system.
 The other system is showing the result of system 1 localised (so not mixed
 as system 1).
 Everything is stored as text databases on the file system using the java
 default encoding of ISO-8859-1 (even greek text), which works great for
 system 2 (just set the appropiate charset in the request header and
 everything works well.)
 
 System 1 doesn't have problems with this either, until we want to save
 data..
 It comes in encoded as UTF-8 and needs to be written to disk as ISO-8859-1
 (1000's of files are set up like this and converting those is too much
 impact right now)
 
 What I need is to convert the parameter from UTF-8 to ISO-8859-whatever..
 
 As an example 2 headers : (extracted with getReader and read()..)
 
 this is greek text entered in ie..
 
 the ISO-8859-1 encoding
 isotext=%EB%E5%F0%F4%EF%EC%DD%F1%E5%E9%E5%F2
 the UTF-8 encoding
 utf8text=%CE%BB%CE%B5%CF%80%CF%84%CE%BF%CE%BC%CE%AD%CF%81%CE%B5%CE%B9%CE%B5%
 CF%82
 
 from ISO to UTF is not a problem, but from UTF-8 to IS0-8859-whatever is
 not working..
 
 so I want to get convert utf8text to have the same value as with isotext..
 
 Does anyone know how to handle this conversion or know where to find a class
 / source that can do this conversion?
 
 Hope it makes any sense what I'm asking
 
 
 TIA
 
 Mvgr,
 Martin
 
 




JSP Document parsing

2001-08-16 Thread Mark Abbott

Hi all -

I've noticed a couple of problems with Jasper when processing
JSP documents, that is, JSP pages authored in the XML syntax.
I'm using the tomcat-b7 release.

The documents I've tried contain explicit jsp:root elements,
as it seems they ought to.  Unfortunately, the XmlOutputter class
in Jasper, while making an effort to avoid choking on multiple
jsp:root elements encountered while processing included
pages, does not handle the case where the outermost containing
page itself contains such an element.

One result is that two /jsp:root end tags get emitted into the page.
The more subtle issue has to do with the xmlns:jsp and version
attributes on the jsp:root start tag.  Jasper inserts hardcoded values 
for those attributes corresponding to the JSP 1.2 release. But in order
to be truly valid, the document itself should contain those attributes
(at least version is required). So two instances of each attribute end up
in the output, causing the resulting XML stream to be invalid when parsed
by, for example, the tag library validator in JSPTL.

Maybe the attributes in the outermost containing page ought to
override any hardcoded defaults Jasper wants to assert? Or maybe Jasper
should report an error if the version attribute in the document doesn't agree
with the JSP version it thinks it is processing?  What do you think?
I may be able to provide diffs for a solution if I was sure what to do.

Thanks - Mark






RE: Exception when hitting stop on slow servlet..

2001-08-16 Thread Rob S.

 org.apache.tomcat.util.net.TcpConnection - java.net.SocketException:
 Connection reset by peer (maby this must be Pier?)

HAHAHAHAHHAA that's too funny =)

Connection reset by Pier lol

- r




Re: Exception when hitting stop on slow servlet..

2001-08-16 Thread Christopher Cain


Rob S. wrote:
 
  org.apache.tomcat.util.net.TcpConnection - java.net.SocketException:
  Connection reset by peer (maby this must be Pier?)
 
 HAHAHAHAHHAA that's too funny =)
 
 Connection reset by Pier lol

LOL! I think someone should try and sneak in a source patch and change
the exception to say that instead. _Especially_ in the mod_jk stuff ...
now THAT'S humor ;-) ... or maybe just have it say Pier set up us the
bomb!!!, or Pier sends you this file to have your advice. ... hehe

P.S. Speaking of mod_jk, where is Gomez? Is he on vacation, too?



cvs commit: jakarta-tomcat-4.0/webapps/tomcat-docs manager-howto.xml index.xml project.xml

2001-08-16 Thread craigmcc

craigmcc01/08/16 16:21:25

  Modified:webapps/tomcat-docs index.xml project.xml
  Added:   webapps/tomcat-docs manager-howto.xml
  Log:
  Add a HOW-TO doc for the Manager web application (motivated by
  Christopher's SSL HOW-TO and a couple of questions on TOMCAT-USER today).
  
  Revision  ChangesPath
  1.7   +5 -1  jakarta-tomcat-4.0/webapps/tomcat-docs/index.xml
  
  Index: index.xml
  ===
  RCS file: /home/cvs/jakarta-tomcat-4.0/webapps/tomcat-docs/index.xml,v
  retrieving revision 1.6
  retrieving revision 1.7
  diff -u -r1.6 -r1.7
  --- index.xml 2001/08/16 20:21:54 1.6
  +++ index.xml 2001/08/16 23:21:25 1.7
  @@ -62,7 +62,11 @@
   - Reference manual that documents all available elements and attributes
 that may be placed into a Tomcat 4 codeconf/server.xml/code file.
   /li
  -lia href=ssl-howto.htmlstrongSSL HOW-TO/strong/a - Installing and
  +lia href=manager-howto.htmlstrongManager App HOW-TO/strong/a -
  +Operating the codeManager/code web app to deploy, undeploy, and
  +redeploy applications while Tomcat is running./li
  +lia href=ssl-howto.htmlstrongSSL Configuration HOW-TO/strong/a -
  +Installing and
   configuring SSL support so that your Tomcat will serve requests using
   the codehttps/code protocol./li
   /ul
  
  
  
  1.7   +2 -1  jakarta-tomcat-4.0/webapps/tomcat-docs/project.xml
  
  Index: project.xml
  ===
  RCS file: /home/cvs/jakarta-tomcat-4.0/webapps/tomcat-docs/project.xml,v
  retrieving revision 1.6
  retrieving revision 1.7
  diff -u -r1.6 -r1.7
  --- project.xml   2001/08/16 20:21:54 1.6
  +++ project.xml   2001/08/16 23:21:25 1.7
  @@ -24,7 +24,8 @@
   
   menu name=Administrators
   item name=Config. Reference href=config/index.html/
  -item name=SSL HOW-TOhref=ssl-howto.html/
  +item name=Manager App HOW-TOhref=manager-howto.html/
  +item name=SSL Config HOW-TO href=ssl-howto.html/
   /menu
   
   menu name=Application Developers
  
  
  
  1.1  jakarta-tomcat-4.0/webapps/tomcat-docs/manager-howto.xml
  
  Index: manager-howto.xml
  ===
  ?xml version=1.0?
  !DOCTYPE document [
!ENTITY project SYSTEM project.xml
  ]
  document
  
  project;
  
  properties
  author email=[EMAIL PROTECTED]Craig R. McClanahan/author
  titleManager App HOW-TO/title
  /properties
  
  body
  
  
  section name=Introduction
  
  pIn many production environments, it is very useful to have the capability
  to deploy a new web application, or undeploy an existing one, without having
  to shut down and restart the entire container.  In addition, you can request
  an existing application to reload itself, even if you have not declared it
  to be codereloadable/code in the Tomcat 4 server
  configuration file./p
  
  pTo support these capabilities, Tomcat 4 includes a web application
  (installed by default on context path code/manager/code) that supports
  the following functions:/p
  ul
  liDeploy a new web application, on a specified context path, from a
  specified directory or WAR file pathname./li
  liList the currently deployed web applications, as well as the
  sessions that are currently active for those web apps./li
  liCause an existing application to be reloaded./li
  liUndeploy an existing web application./li
  liStop an existing application (so that it becomes unavailable), but
  do not undeploy it./li
  liStart a stopped application (thus making it available again)./li
  /ul
  
  pSince codeManager/code is itself a web application, it interacts with
  you using standard HTTP requests and responses.  However, it's user interface
  is minimal, because it is intended to be accessed from scripts set up by the
  system administrator.  For this reason, commands are given as part of the
  request URI, and responses are in the form of simple text that can be easily
  parsed and processed./p
  
  pFuture versions of Tomcat 4 will include administrative functionality that
  is presented in (at least) the following forms:/p
  ul
  liAs web services, so that Tomcat administration can be easily integrated
  into remote and/or non-Java mnagement environments./li
  liAs a web application with a nice user interface (built on top of the
  web services processing layer) for easy Tomcat administration via a
  web browser./li
  /ul
  
  /section
  
  section name=Configuring Manager Application Access
  
  pIt would be quite unsafe to ship Tomcat with default settings that allowed
  anyone on the Internet to execute the Manager application on your server.
  Therefore, the Manager application is shipped with the requirement 

cvs commit: jakarta-tomcat-4.0/webapps/tomcat-docs build.xml

2001-08-16 Thread craigmcc

craigmcc01/08/16 16:32:55

  Modified:webapps/tomcat-docs build.xml
  Log:
  Add back the build of the functional specs - to be checked in momentarily.
  
  Revision  ChangesPath
  1.8   +0 -4  jakarta-tomcat-4.0/webapps/tomcat-docs/build.xml
  
  Index: build.xml
  ===
  RCS file: /home/cvs/jakarta-tomcat-4.0/webapps/tomcat-docs/build.xml,v
  retrieving revision 1.7
  retrieving revision 1.8
  diff -u -r1.7 -r1.8
  --- build.xml 2001/08/16 20:21:54 1.7
  +++ build.xml 2001/08/16 23:32:55 1.8
  @@ -53,9 +53,7 @@
 file=appdev/build.xml.txt/
   
   !-- Catalina Functional Specifications --
  -!--
   mkdir dir=${webapps.build}/${webapp.name}/catalina/funcspecs/
  ---
   
   !-- Catalina Javadocs --
   mkdir dir=${webapps.build}/${webapp.name}/catalina/docs/api/
  @@ -115,7 +113,6 @@
   /style
   
   !-- Catalina Functional Specifications --
  -!--
   mkdir dir=${webapps.build}/${webapp.name}/catalina/
   mkdir dir=${webapps.build}/${webapp.name}/catalina/funcspecs/
   style basedir=funcspecs
  @@ -126,7 +123,6 @@
 includes=*.xml
 param name=relative-path expression=../../
   /style
  ---
   
   !-- Server Configuration Reference --
   style basedir=config
  
  
  



Re: New SSL HOWTOs

2001-08-16 Thread Jim Seach


--- Christopher Cain [EMAIL PROTECTED] wrote:
 While creating the 3.3 version of my SSL HOWTO, I also polished off
 the
 wording here and there and added a TOC and section marks for easier
 navigation. Attached are both the 3.3 and 4.0 versions of the file.
 Consider this 4.0 version to supercede the one I sent last night (or
 early this morning, as it were :-)
 
 If someone could please let me know for sure that adding extension
 JARs
 to the {JDK_HOME}/jre/lib/ext directory under JDK 1.1.8 effectively
 makes them installed extensions (makes them available without
 necessarily being in the CLASSPATH) just like in = JDK 1.2. Other
 than
 that, I'm pretty sure the TC 3.3 version of the doc is valid for JDK
 1.1.8 environments as well. If someone a little more familiar with
 1.1.8
 could maybe give it a quick once-over and see if anything jumps out,
 that would be great.
 
 - Christopher 
Tomcat 4.0 Standalone - SSL Configuration

Thanks!

I tried out your quickstart instructions with JDK 1.3 and Tomcat 3.2.3
on Windows 98 and it worked like a charm.  The background and detail
sections are well written and contain valuable information.

Nice Job!

Jim



__
Do You Yahoo!?
Make international calls for as low as $.04/minute with Yahoo! Messenger
http://phonecard.yahoo.com/



Re: New SSL HOWTOs

2001-08-16 Thread Christopher Cain

Quoting Jim Seach [EMAIL PROTECTED]:

 Thanks!
 
 I tried out your quickstart instructions with JDK 1.3 and Tomcat 3.2.3
 on Windows 98 and it worked like a charm.  The background and detail
 sections are well written and contain valuable information.
 
 Nice Job!

Cool, thanks =)

I can't really take credit for the quickstart steps, since I basically just 
cribbed what was already in the server.xml comments for that. I'm definitely 
glad you found the background and general info sections readable, as that's one 
of those areas where you can never really tell if people will get anything out 
of it or not.

It's also good to know that everything went according to plan on 3.2.3, since I 
hadn't even tested them against that branch. Thanks for the feedback!

- Christopher



cvs commit: jakarta-tomcat/src/share/org/apache/tomcat/modules/config ApacheConfig.java

2001-08-16 Thread larryi

larryi  01/08/16 20:53:24

  Modified:src/share/org/apache/tomcat/modules/config ApacheConfig.java
  Log:
  Update to make all contexts for a virtual host appear within a single
  Virtual Host block.  For a root context in a virtual host, set DocumentRoot
  instead of a using Alias /   For a root context outside of a virtual host,
  supply an appropriate message about DocumentRoot.  Can't override the
  one in httpd.conf.
  
  Revision  ChangesPath
  1.26  +86 -60
jakarta-tomcat/src/share/org/apache/tomcat/modules/config/ApacheConfig.java
  
  Index: ApacheConfig.java
  ===
  RCS file: 
/home/cvs/jakarta-tomcat/src/share/org/apache/tomcat/modules/config/ApacheConfig.java,v
  retrieving revision 1.25
  retrieving revision 1.26
  diff -u -r1.25 -r1.26
  --- ApacheConfig.java 2001/08/16 05:22:41 1.25
  +++ ApacheConfig.java 2001/08/17 03:53:24 1.26
  @@ -1,4 +1,4 @@
  -/* $Id: ApacheConfig.java,v 1.25 2001/08/16 05:22:41 larryi Exp $
  +/* $Id: ApacheConfig.java,v 1.26 2001/08/17 03:53:24 larryi Exp $
* 
*
* The Apache Software License, Version 1.1
  @@ -146,7 +146,7 @@
   @author Costin Manolache
   @author Larry Isaacs
   @author Mel Martinez
  - @version $Revision: 1.25 $ $Date: 2001/08/16 05:22:41 $
  + @version $Revision: 1.26 $ $Date: 2001/08/17 03:53:24 $
*/
   public class ApacheConfig  extends BaseJkConfig { 
   
  @@ -293,17 +293,44 @@
// XXX Make those options configurable in server.xml
generateSSLConfig( mod_jk );
   
  +Hashtable vhosts = new Hashtable();
  +
// Set up contexts
// XXX deal with Virtual host configuration 
Enumeration  enum = cm.getContexts();
while (enum.hasMoreElements()) {
   Context context = (Context)enum.nextElement();
  - if( forwardAll )
  - generateStupidMappings( context, mod_jk );
  - else
  - generateContextMappings( context, mod_jk );
  +String host = context.getHost();
  +if( host == null ) {
  +if( forwardAll )
  +generateStupidMappings( context, mod_jk );
  +else
  +generateContextMappings( context, mod_jk );
  +} else {
  +Vector vhostContexts = (Vector)vhosts.get(host);
  +if ( vhostContexts == null ) {
  +vhostContexts = new Vector();
  +vhosts.put(host,vhostContexts);
  +}
  +vhostContexts.addElement(context);
  +}
}
   
  +enum = vhosts.elements();
  +while( enum.hasMoreElements() ) {
  +Vector vhostContexts = (Vector)enum.nextElement();
  +for( int i = 0; i  vhostContexts.size(); i++ ) {
  +Context context = (Context)vhostContexts.elementAt(i);
  +if( i == 0 )
  +generateVhostHead( context, mod_jk );
  +if( forwardAll )
  +generateStupidMappings( context, mod_jk );
  +else
  +generateContextMappings( context, mod_jk );
  +}
  +generateVhostTail( mod_jk );
  +}
  +
mod_jk.close();
} catch( Exception ex ) {
   Log loghelper = Log.getLog(tc_log, this);
  @@ -367,6 +394,32 @@
}
return true;
   }
  +
  +private void generateVhostHead(Context context, PrintWriter mod_jk) {
  + String ctxPath  = context.getPath();
  + String vhost = context.getHost();
  +
  +mod_jk.println();
  +String vhostip = getVirtualHostAddress(vhost,
  +context.getHostAddress());
  +generateNameVirtualHost(mod_jk, vhostip);
  +mod_jk.println(VirtualHost + vhostip + );
  +mod_jk.println(ServerName  + vhost );
  +Enumeration aliases=context.getHostAliases();
  +if( aliases.hasMoreElements() ) {
  +mod_jk.print(ServerAlias  );
  +while( aliases.hasMoreElements() ) {
  +mod_jk.print( (String)aliases.nextElement() +   );
  +}
  +mod_jk.println();
  +}
  +indent=;
  +}
  +
  +private void generateVhostTail(PrintWriter mod_jk) {
  +mod_jk.println(/VirtualHost);
  +indent=;
  +}
   
   private void generateSSLConfig(PrintWriter mod_jk) {
if( ! sslExtract ) {
  @@ -405,36 +458,23 @@
   log(Ignoring root context in forward-all mode  );
   return;
   } 
  - if( vhost != 

cvs commit: jakarta-tomcat/src/share/org/apache/tomcat/core Context.java ContextManager.java

2001-08-16 Thread costin

costin  01/08/16 20:59:48

  Modified:src/share/org/apache/tomcat/core Context.java
ContextManager.java
  Log:
  Small changes ( but the diff is big ). I tried to put in order all the
  package/protected/final stuff.
  
  Having final methods and classes hava a tiny impact on performance but may
  affect our ability to do hot fixes via add-on modules, and to extend
  tomcat or tune it for special configurations.
  
  Let me know if this creates a problem for anyone - I believe removing the final
  doesn't affect in any way the code stability but provides a lot of flexibility.
  
  I also added few factory methods in CM, to completely allow specialized
  extensions to control the whole thing.
  
  Revision  ChangesPath
  1.148 +111 -98   jakarta-tomcat/src/share/org/apache/tomcat/core/Context.java
  
  Index: Context.java
  ===
  RCS file: /home/cvs/jakarta-tomcat/src/share/org/apache/tomcat/core/Context.java,v
  retrieving revision 1.147
  retrieving revision 1.148
  diff -u -r1.147 -r1.148
  --- Context.java  2001/08/16 04:50:30 1.147
  +++ Context.java  2001/08/17 03:59:48 1.148
  @@ -97,7 +97,7 @@
* @author [EMAIL PROTECTED]
* @author Gal Shachor [EMAIL PROTECTED]
*/
  -public final class Context {
  +public class Context {
   //  Constants 
   
   // Proprietary attribute names for contexts - defined
  @@ -147,6 +147,8 @@
   public static final int STATE_READY=3;
   
   //  internal properties
  +private String name;
  +
   // context id
   private String path = ;
   
  @@ -278,7 +280,7 @@
   /** Add a new container. Container define special properties for
a set of urls.
   */
  -public final void addContainer( Container ct )
  +public void addContainer( Container ct )
throws TomcatException
   {
// Notify interceptors that a new container is added
  @@ -300,7 +302,7 @@
* mapping.
* @deprecated Use addContainer
*/
  -public final  void addServletMapping(String path, String servletName)
  +public void addServletMapping(String path, String servletName)
throws TomcatException
   {
if( mappings.get( path )!= null) {
  @@ -314,7 +316,7 @@
// set it 
   Handler sw = getServletByName(servletName);

  - Container map=new Container();
  + Container map=contextM.createContainer();
map.setContext( this );
map.setHandlerName( servletName );
map.setHandler( sw );
  @@ -352,12 +354,12 @@
the request will have to pass the security constraints.
@deprecated Use addContainer
   */
  -public final  void addSecurityConstraint( String path[], String methods[],
  +public void addSecurityConstraint( String path[], String methods[],
   String roles[], String transport)
throws TomcatException
   {
for( int i=0; i path.length; i++ ) {
  - Container ct=new Container();
  + Container ct=contextM.createContainer();
ct.setContext( this );
ct.setTransport( transport );
ct.setRoles( roles );
  @@ -380,7 +382,7 @@
*   user application. Only trusted apps can get 
*   access to the implementation object.
*/
  -public final  boolean allowAttribute( String name ) {
  +public boolean allowAttribute( String name ) {
// check if we can access this attribute.
if( isTrusted() ) return true;
log( Attempt to access internal attribute in untrusted app,
  @@ -399,11 +401,11 @@
type of the facade, as a Context can be associated with a 2.2 ...
ServletContext.
*/
  -public final  Object getFacade() {
  +public Object getFacade() {
return contextFacade;
   }
   
  -public final  void setFacade(Object obj) {
  +public void setFacade(Object obj) {
   if(contextFacade!=null ) {
log( Changing facade  + contextFacade +   +obj);
}
  @@ -424,21 +426,30 @@
depend on the ContextManager, and will be adjusted
by interceptors ( DefaultCMSetter )
   */
  -public final  void setContextManager(ContextManager cm) {
  +public void setContextManager(ContextManager cm) {
if( contextM != null ) return;
contextM=cm;
  + if( defaultContainer==null ) {
  + defaultContainer=contextM.createContainer();
  + defaultContainer.setContext( this );
  + defaultContainer.setPath( null ); // default container
  + }
try {
attributeInfo=cm.getNoteId(ContextManager.REQUEST_NOTE,
   req.attribute);
} catch( TomcatException ex ) {
ex.printStackTrace();
}
  -
   }
   
  +protected 

cvs commit: jakarta-tomcat/src/share/org/apache/tomcat/core BaseInterceptor.java Container.java Handler.java OutputBuffer.java Request.java Response.java ServerSession.java

2001-08-16 Thread costin

costin  01/08/16 21:02:55

  Modified:src/share/org/apache/tomcat/core BaseInterceptor.java
Container.java Handler.java OutputBuffer.java
Request.java Response.java ServerSession.java
  Log:
  Same thing. Some fields were package, changed them to private.
  
  Now the core is consistent ( I hope ), at least from methods declaration
  point of view.
  
  Revision  ChangesPath
  1.51  +1 -1  
jakarta-tomcat/src/share/org/apache/tomcat/core/BaseInterceptor.java
  
  Index: BaseInterceptor.java
  ===
  RCS file: 
/home/cvs/jakarta-tomcat/src/share/org/apache/tomcat/core/BaseInterceptor.java,v
  retrieving revision 1.50
  retrieving revision 1.51
  diff -u -r1.50 -r1.51
  --- BaseInterceptor.java  2001/08/03 02:40:20 1.50
  +++ BaseInterceptor.java  2001/08/17 04:02:54 1.51
  @@ -567,7 +567,7 @@
debug=d;
   }
   
  -public final void setContextManager( ContextManager cm ) {
  +public void setContextManager( ContextManager cm ) {
this.cm=cm;
this.ct=cm.getContainer();
   }
  
  
  
  1.53  +15 -15jakarta-tomcat/src/share/org/apache/tomcat/core/Container.java
  
  Index: Container.java
  ===
  RCS file: /home/cvs/jakarta-tomcat/src/share/org/apache/tomcat/core/Container.java,v
  retrieving revision 1.52
  retrieving revision 1.53
  diff -u -r1.52 -r1.53
  --- Container.java2001/08/03 02:41:29 1.52
  +++ Container.java2001/08/17 04:02:54 1.53
  @@ -101,7 +101,7 @@
   private ContextManager contextM;
   
   // The webapp including this container, if any
  -Context context;
  +private Context context;
   
   // The type of the mapping
   public static final int UNKNOWN_MAP=0;
  @@ -109,14 +109,14 @@
   public static final int PREFIX_MAP=2;
   public static final int EXTENSION_MAP=3;
   public static final int DEFAULT_MAP=4;
  -int mapType=0;
  +private int mapType=0;
   
   
   // Common map parameters ( path prefix, ext, etc)
  -String transport;
  -String path;
  -String proto;
  -String vhosts[];
  +private String transport;
  +private String path;
  +private String proto;
  +private String vhosts[];
   
   // Container attributes - it's better to use
   // notes, as the access time is much smaller
  @@ -124,16 +124,16 @@
   
   /** The handler associated with this container.
*/
  -Handler handler;
  -String handlerName;
  +private Handler handler;
  +private String handlerName;
   
   /** Security constraints associated with this Container
*/
  -String roles[]=null;
  +private String roles[]=null;
   
  -String methods[]=null;
  +private String methods[]=null;
   
  -boolean special=false;
  +private boolean special=false;
   
   public Container() {
initHooks();
  @@ -417,9 +417,9 @@
   public static final int H_engineInit=16;
   public static final int H_COUNT=17;
   
  -Hooks hooks=new Hooks();
  -BaseInterceptor hooksCache[][]=null;
  -BaseInterceptor allHooksCache[]=null;
  +private Hooks hooks=new Hooks();
  +private BaseInterceptor hooksCache[][]=null;
  +private BaseInterceptor allHooksCache[]=null;
   
   private void initHooks() {
hooks.registerHook( postReadRequest, H_postReadRequest );
  @@ -536,7 +536,7 @@
   }
   
   // debug
  -public static final int dL=0;
  +private static final int dL=0;
   private void debug( String s ) {
System.out.println(Container:  + s );
   }
  
  
  
  1.41  +7 -7  jakarta-tomcat/src/share/org/apache/tomcat/core/Handler.java
  
  Index: Handler.java
  ===
  RCS file: /home/cvs/jakarta-tomcat/src/share/org/apache/tomcat/core/Handler.java,v
  retrieving revision 1.40
  retrieving revision 1.41
  diff -u -r1.40 -r1.41
  --- Handler.java  2001/08/03 02:47:32 1.40
  +++ Handler.java  2001/08/17 04:02:54 1.41
  @@ -126,8 +126,8 @@
   // Debug
   protected int debug=0;
   protected Log logger=null;
  -Handler next;
  -Handler prev;
  +protected Handler next;
  +protected Handler prev;
   
   
   private Object notes[]=new Object[ContextManager.MAX_NOTES];
  @@ -174,11 +174,11 @@
this.state=i;
   }
   
  -public final String getName() {
  +public String getName() {
return name;
   }
   
  -public final void setName(String handlerName) {
  +public void setName(String handlerName) {
   this.name=handlerName;
   }
   
  @@ -330,18 +330,18 @@
   
   /** Debug level for this handler.
*/
  -public final void setDebug( int d ) {
  +public void setDebug( int d ) {

cvs commit: jakarta-tomcat/src/share/org/apache/tomcat/modules/session SessionId.java

2001-08-16 Thread costin

costin  01/08/16 21:03:55

  Modified:src/share/org/apache/tomcat/modules/session SessionId.java
  Log:
  Fix NPE when debugging is enabled.
  
  Thanks to Bill Barker [EMAIL PROTECTED] for finding this.
  
  Revision  ChangesPath
  1.13  +0 -1  
jakarta-tomcat/src/share/org/apache/tomcat/modules/session/SessionId.java
  
  Index: SessionId.java
  ===
  RCS file: 
/home/cvs/jakarta-tomcat/src/share/org/apache/tomcat/modules/session/SessionId.java,v
  retrieving revision 1.12
  retrieving revision 1.13
  diff -u -r1.12 -r1.13
  --- SessionId.java2001/07/20 17:42:47 1.12
  +++ SessionId.java2001/08/17 04:03:55 1.13
  @@ -93,7 +93,6 @@
   {
   // GS, separates the session id from the jvm route
   static final char SESSIONID_ROUTE_SEP = '.';
  -ContextManager cm;
   boolean noCookies=false;
   boolean cookiesFirst=true;
   
  
  
  



cvs commit: jakarta-tomcat/src/share/org/apache/tomcat/util IntrospectionUtils.java

2001-08-16 Thread costin

costin  01/08/16 21:07:45

  Modified:src/share/org/apache/tomcat/util IntrospectionUtils.java
  Log:
  Started to implement the command line enhancements. Adding a command
  line option used to be pretty tricky, plus we want the object to be
  usable from ant or as a general bean.
  
  Now introspection util can handle all the command line processing by
  using the same code that deals with server.xml. Tomcat, StopTomcat,
  etc will be far simpler.
  
  ( I tried to implement the code to send options to ContextManager, but it
  got too complicated - reusing the well tested introspection code seems a
  bette idea than complicating things up )
  
  Revision  ChangesPath
  1.12  +114 -19   
jakarta-tomcat/src/share/org/apache/tomcat/util/IntrospectionUtils.java
  
  Index: IntrospectionUtils.java
  ===
  RCS file: 
/home/cvs/jakarta-tomcat/src/share/org/apache/tomcat/util/IntrospectionUtils.java,v
  retrieving revision 1.11
  retrieving revision 1.12
  diff -u -r1.11 -r1.12
  --- IntrospectionUtils.java   2001/06/28 07:11:14 1.11
  +++ IntrospectionUtils.java   2001/08/17 04:07:45 1.12
  @@ -93,6 +93,11 @@
   public static void setAttribute( Object proxy, String n, Object v)
throws Exception
   {
  + if( proxy instanceof AttributeHolder ) {
  + ((AttributeHolder)proxy).setAttribute( n, v );
  + return;
  + }
  + 
Method executeM=null;
Class c=proxy.getClass();
Class params[]=new Class[2];
  @@ -376,6 +381,15 @@
return new String(chars);
   }
   
  +public static String unCapitalize(String name) {
  + if (name == null || name.length() == 0) {
  + return name;
  + }
  + char chars[] = name.toCharArray();
  + chars[0] = Character.toLowerCase(chars[0]);
  + return new String(chars);
  +}
  +
   //  Class path tools 
   
   /** Add all the jar files in a dir to the classpath,
  @@ -487,35 +501,89 @@
   
   //  Mapping command line params to setters
   
  -public static void processArgs(Object proxy, String args[],
  -String args0[], String args1[])
  +public static boolean processArgs(Object proxy, String args[] ) 
throws Exception
   {
  + String args0[]=null;
  + if( null != findMethod( proxy.getClass(), getOptions1, new Class[] {} )) {
  + args0=(String[])callMethod0( proxy, getOptions1);
  + }
  + if( args0==null ) {
  + args0=findBooleanSetters(proxy.getClass());
  + }
  + Hashtable h=null;
  + if( null != findMethod( proxy.getClass(), getOptionAliases, new Class[] {} 
)) {
  + h=(Hashtable)callMethod0( proxy, getOptionAliases);
  + }
  + return processArgs( proxy, args, args0, null, h );
  +}
  +
  +public static boolean processArgs(Object proxy, String args[],
  +   String args0[], String args1[], Hashtable 
aliases )
  + throws Exception
  +{
for( int i=0; i args.length; i++ ) {
String arg=args[i];
if( arg.startsWith(-))
arg=arg.substring(1);
  + if( aliases != null  aliases.get( arg ) != null)
  + arg=(String)aliases.get(arg);
   
  - for( int j=0; j args0.length ; j++ ) {
  - if( args0[j].equalsIgnoreCase( arg )) {
  - IntrospectionUtils.setAttribute( proxy, args0[j], true);
  - break;
  + if( args0!=null ) {
  + boolean set=false;
  + for( int j=0; j args0.length ; j++ ) {
  + if( args0[j].equalsIgnoreCase( arg )) {
  + IntrospectionUtils.setProperty( proxy, args0[j], true);
  + set=true;
  + break;
  + }
}
  + if( set ) break;
}
  - for( int j=0; j args1.length ; j++ ) {
  - if( args1[j].equalsIgnoreCase( arg )) {
  - i++;
  - if( i  args.length )
  - IntrospectionUtils.setAttribute( proxy,
  -  args1[j], args[i]);
  - break;
  + if( args1!=null ) {
  + for( int j=0; j args1.length ; j++ ) {
  + if( args1[j].equalsIgnoreCase( arg )) {
  + i++;
  + if( i = args.length )
  + return false;
  + IntrospectionUtils.setProperty( proxy,
  + arg, args[i]);
  + break;
  + }
}
  + } else {
  + // if args1 is not specified, assume all other options have param
  + i++;
  + if( i = args.length )
  + 

cvs commit: jakarta-tomcat/src/share/org/apache/tomcat/startup EnableAdmin.java EmbededTomcat.java StopTomcat.java Tomcat.java

2001-08-16 Thread costin

costin  01/08/16 21:23:00

  Modified:src/share/org/apache/tomcat/startup EmbededTomcat.java
StopTomcat.java Tomcat.java
  Added:   src/share/org/apache/tomcat/startup EnableAdmin.java
  Log:
  The changes in the startup code.
  
  Revision  ChangesPath
  1.46  +1 -1  
jakarta-tomcat/src/share/org/apache/tomcat/startup/EmbededTomcat.java
  
  Index: EmbededTomcat.java
  ===
  RCS file: 
/home/cvs/jakarta-tomcat/src/share/org/apache/tomcat/startup/EmbededTomcat.java,v
  retrieving revision 1.45
  retrieving revision 1.46
  diff -u -r1.45 -r1.46
  --- EmbededTomcat.java2001/06/09 03:33:24 1.45
  +++ EmbededTomcat.java2001/08/17 04:23:00 1.46
  @@ -219,7 +219,7 @@
}
   
try {
  - Context ctx=new Context();
  + Context ctx=contextM.createContext();
ctx.setDebug( debug );
ctx.setContextManager( contextM );
ctx.setPath( ctxPath );
  
  
  
  1.9   +49 -53
jakarta-tomcat/src/share/org/apache/tomcat/startup/StopTomcat.java
  
  Index: StopTomcat.java
  ===
  RCS file: 
/home/cvs/jakarta-tomcat/src/share/org/apache/tomcat/startup/StopTomcat.java,v
  retrieving revision 1.8
  retrieving revision 1.9
  diff -u -r1.8 -r1.9
  --- StopTomcat.java   2001/07/19 21:52:48 1.8
  +++ StopTomcat.java   2001/08/17 04:23:00 1.9
  @@ -90,9 +90,14 @@
   }
   
   //  Parameters 
  -
   public void setSecretFile( String s ) {
secretFile=s;
  + commandLineParams=true;
  +}
  +
  +public void setAjpid( String s ) {
  + secretFile=s;
  + commandLineParams=true;
   }
   
   public void setH( String s ) {
  @@ -107,10 +112,12 @@
   
   public void setHost( String h ) {
host=h;
  + commandLineParams=true;
   }
   
   public void setPort( int port ) {
this.port=port;
  + commandLineParams=true;
   }
   
   /** When tomcat is started, a secret ( random ) key will be generated
  @@ -118,8 +125,14 @@
read the key and use it. If you run from a different host, you'll
have to specify it manually
   */
  +public void setPass( String s ) {
  + secret=s;
  + commandLineParams=true;
  +}
  +
   public void setSecret( String s ) {
secret=s;
  + commandLineParams=true;
   }
   
   //  Ant execute 
  @@ -251,64 +264,47 @@
   /** Process arguments - set object properties from the list of args.
*/
   public  boolean processArgs(String[] args) {
  - for (int i = 0; i  args.length; i++) {
  - String arg = args[i];
  - 
  - if (arg.equals(-?)) {
  - return false;
  - }
  - if (arg.equals(-h) || arg.equals(-home)) {
  - i++;
  - if (i  args.length)
  - System.getProperties().put(tomcat.home,
  - args[i]);
  - else
  - return false;
  - }
  - if (arg.equals(-host) ) {
  - i++;
  - commandLineParams=true;
  - if (i  args.length)
  - host=args[i];
  - else
  - return false;
  - }
  - if (arg.equals(-port) ) {
  - i++;
  - commandLineParams=true;
  - if (i  args.length)
  - port=Integer.parseInt( args[i] );
  - else
  - return false;
  - }
  - if (arg.equals(-pass) ) {
  - i++;
  - commandLineParams=true;
  - if (i  args.length) 
  - secret=args[i];
  - else
  - return false;
  - }
  - if (arg.equalsIgnoreCase(-ajpid) ) {
  - i++;
  - commandLineParams=true;
  - if (i  args.length) 
  - secretFile=args[i];
  - else
  - return false;
  - }
  + try {
  + return IntrospectionUtils.processArgs( this, args, getOptions1(),
  + null, getOptionAliases());
  + } catch( Exception ex ) {
  + ex.printStackTrace();
  + return false;
}
  - return true;
  +
  +}
  +
  +static String options1[]= { help, stop };
  +static Hashtable optionAliases=new Hashtable();
  +static Hashtable optionDescription=new Hashtable();
  +static {
  + optionAliases.put(h, home);
  + optionAliases.put(?, help);
  +}
  +
  +public String[] getOptions1() {
  + return options1;
   }
   
  +public Hashtable getOptionAliases() {
  + return optionAliases;
  +}
  +
  +public