cvs commit: jakarta-tomcat-connectors/coyote/src/java/org/apache/coyote/tomcat5 CoyoteConnector.java

2003-04-04 Thread costin
costin  2003/04/04 14:21:35

  Modified:coyote/src/java/org/apache/coyote/tomcat5
CoyoteConnector.java
  Log:
  Deal with the various registration orders.
  
  Revision  ChangesPath
  1.23  +26 -14
jakarta-tomcat-connectors/coyote/src/java/org/apache/coyote/tomcat5/CoyoteConnector.java
  
  Index: CoyoteConnector.java
  ===
  RCS file: 
/home/cvs/jakarta-tomcat-connectors/coyote/src/java/org/apache/coyote/tomcat5/CoyoteConnector.java,v
  retrieving revision 1.22
  retrieving revision 1.23
  diff -u -r1.22 -r1.23
  --- CoyoteConnector.java  25 Mar 2003 17:47:46 -  1.22
  +++ CoyoteConnector.java  4 Apr 2003 22:21:35 -   1.23
  @@ -526,7 +526,10 @@
* Connector.
*/
   public Container getContainer() {
  -
  +if( container==null ) {
  +// Lazy - maybe it was added later
  +findContainer(); 
  +}
   return (container);
   
   }
  @@ -1078,7 +1081,6 @@
   
   }
   
  -
   /**
* Initialize this connector (create ServerSocket here!)
*/
  @@ -1269,6 +1271,9 @@
   
   try {
   Registry.getRegistry().unregisterComponent(new 
ObjectName(domain,"type", "Mapper"));
  +Registry.getRegistry().unregisterComponent(new ObjectName(domain
  ++ ":type=protocolHandler,className="
  ++ protocolHandlerClassName));
   } catch (MalformedObjectNameException e) {
   log.info( "Error unregistering mapper ", e);
   }
  @@ -1391,18 +1396,13 @@
   log.error( "Unregistering - can't stop", t);
   }
   }
  -
  -public void init() throws Exception {
  -
  -if( this.getService() != null ) {
  -log.info( "Already configured" );
  -return;
  -}
  -if( container==null ) {
  +
  +private void findContainer() {
  +try {
   // Register to the service
   ObjectName parentName=new ObjectName( domain + ":" +
   "type=Service");
  -
  +
   log.info("Adding to " + parentName );
   if( mserver.isRegistered(parentName )) {
   mserver.invoke(parentName, "addConnector", new Object[] { this },
  @@ -1418,16 +1418,28 @@
   Object obj=mserver.getAttribute(engName, "managedResource");
   log.info("Found engine " + obj + " " + obj.getClass());
   container=(Container)obj;
  -
  +
   // Internal initialize - we now have the Engine
   initialize();
  -
  +
   log.info("Initialized");
   // As a side effect we'll get the container field set
   // Also initialize will be called
   return;
   }
  +} catch( Exception ex ) {
  +log.error( "Error finding container " + ex);
  +}
  +}
  +
  +public void init() throws Exception {
   
  +if( this.getService() != null ) {
  +log.info( "Already configured" );
  +return;
  +}
  +if( container==null ) {
  +findContainer();
   }
   }
   
  
  
  

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



cvs commit: jakarta-tomcat-connectors/coyote/src/java/org/apache/coyote/tomcat5 CoyoteConnector.java

2003-03-25 Thread costin
costin  2003/03/25 09:47:47

  Modified:coyote/src/java/org/apache/coyote/tomcat5
CoyoteConnector.java
  Log:
  Set the domain in the mapper - so it maps only for our engine ( ==domain )
  
  Register the mapper in JMX - we can see what's inside.
  
  Revision  ChangesPath
  1.22  +8 -2  
jakarta-tomcat-connectors/coyote/src/java/org/apache/coyote/tomcat5/CoyoteConnector.java
  
  Index: CoyoteConnector.java
  ===
  RCS file: 
/home/cvs/jakarta-tomcat-connectors/coyote/src/java/org/apache/coyote/tomcat5/CoyoteConnector.java,v
  retrieving revision 1.21
  retrieving revision 1.22
  diff -u -r1.21 -r1.22
  --- CoyoteConnector.java  17 Mar 2003 07:46:01 -  1.21
  +++ CoyoteConnector.java  25 Mar 2003 17:47:46 -  1.22
  @@ -1236,8 +1236,9 @@
("coyoteConnector.protocolHandlerStartFailed", e));
   }
   
  -mapperListener.init();
   if( this.domain != null ) {
  +mapperListener.setDomain( domain );
  +mapperListener.init();
   try {
   Registry.getRegistry().registerComponent
   (mapper, this.domain, "Mapper",
  @@ -1266,6 +1267,11 @@
   lifecycle.fireLifecycleEvent(STOP_EVENT, null);
   started = false;
   
  +try {
  +Registry.getRegistry().unregisterComponent(new 
ObjectName(domain,"type", "Mapper"));
  +} catch (MalformedObjectNameException e) {
  +log.info( "Error unregistering mapper ", e);
  +}
   try {
   protocolHandler.destroy();
   } catch (Exception e) {
  
  
  

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



cvs commit: jakarta-tomcat-connectors/coyote/src/java/org/apache/coyote/tomcat5 CoyoteConnector.java

2003-03-16 Thread costin
costin  2003/03/16 23:46:01

  Modified:coyote/src/java/org/apache/coyote/tomcat5
CoyoteConnector.java
  Log:
  Registration magic
  
  Revision  ChangesPath
  1.21  +74 -9 
jakarta-tomcat-connectors/coyote/src/java/org/apache/coyote/tomcat5/CoyoteConnector.java
  
  Index: CoyoteConnector.java
  ===
  RCS file: 
/home/cvs/jakarta-tomcat-connectors/coyote/src/java/org/apache/coyote/tomcat5/CoyoteConnector.java,v
  retrieving revision 1.20
  retrieving revision 1.21
  diff -u -r1.20 -r1.21
  --- CoyoteConnector.java  13 Mar 2003 10:04:21 -  1.20
  +++ CoyoteConnector.java  17 Mar 2003 07:46:01 -  1.21
  @@ -61,10 +61,12 @@
   package org.apache.coyote.tomcat5;
   
   import java.util.Vector;
  +import java.lang.reflect.Method;
   
   import javax.management.ObjectName;
   import javax.management.MBeanServer;
   import javax.management.MBeanRegistration;
  +import javax.management.MalformedObjectNameException;
   
   import org.apache.commons.modeler.Registry;
   import org.apache.commons.logging.Log;
  @@ -85,6 +87,9 @@
   import org.apache.catalina.Request;
   import org.apache.catalina.Response;
   import org.apache.catalina.Service;
  +import org.apache.catalina.Engine;
  +import org.apache.catalina.core.ContainerBase;
  +import org.apache.catalina.core.StandardEngine;
   import org.apache.catalina.net.DefaultServerSocketFactory;
   import org.apache.catalina.net.ServerSocketFactory;
   import org.apache.catalina.util.LifecycleSupport;
  @@ -867,7 +872,7 @@
   }
   
   /**
  - * Return the flag to see if we do a redirect to directories that don't 
  + * Return the flag to see if we do a redirect to directories that don't
* end in a '/'.
*/
   public boolean getRedirectDirectories() {
  @@ -1087,6 +1092,21 @@
   
   this.initialized = true;
   
  +if( oname == null && (container instanceof StandardEngine)) {
  +try {
  +// we are loaded directly, via API - and no name was given to us
  +StandardEngine cb=(StandardEngine)container;
  +String addSuffix=(getAddress()==null) ?"": ",address=" + 
getAddress();
  +oname=new ObjectName(cb.getName() + ":type=Connector,port="+
  +getPort() + addSuffix);
  +Registry.getRegistry().registerComponent(this, oname, null);
  +controller=oname;
  +} catch (Exception e) {
  +log.error( "Error registering connector ", e);
  +}
  +log.info("Creating name for connector " + oname);
  +}
  +
   // Initializa adapter
   adapter = new CoyoteAdapter(this);
   
  @@ -1291,10 +1311,48 @@
   coyoteFactory.setKeystoreFile(keystoreFile);
   }
   
  +/**
  + * Return keystorePass
  + *
  + * @exception Exception if an MBean cannot be created or registered
  + */
  +public String getKeystorePass()
  +throws Exception
  +{
  +ServerSocketFactory factory = getFactory();
  +if( factory instanceof CoyoteServerSocketFactory ) {
  +return ((CoyoteServerSocketFactory)factory).getKeystorePass();
  +}
  +return null;
  +}
  +
  +
  +/**
  + * Set keystorePass
  + *
  + * @exception Exception if an MBean cannot be created or registered
  + */
  +public void setKeystorePass(String keystorePass)
  +throws Exception
  +{
  +ServerSocketFactory factory = getFactory();
  +if( factory instanceof CoyoteServerSocketFactory ) {
  +((CoyoteServerSocketFactory)factory).setKeystorePass(keystorePass);
  +}
  +}
   //  JMX registration  
   protected String domain;
   protected ObjectName oname;
   protected MBeanServer mserver;
  +ObjectName controller;
  +
  +public ObjectName getController() {
  +return controller;
  +}
  +
  +public void setController(ObjectName controller) {
  +this.controller = controller;
  +}
   
   public ObjectName getObjectName() {
   return oname;
  @@ -1337,7 +1395,7 @@
   if( container==null ) {
   // Register to the service
   ObjectName parentName=new ObjectName( domain + ":" +
  -"type=Service,name=Tomcat-Standalone");
  +"type=Service");
   
   log.info("Adding to " + parentName );
   if( mserver.isRegistered(parentName )) {
  @@ -1345,15 +1403,17 @@
   new String[] {"org.apache.catalina.Connector"});
   // As a side effect we'll get the container field set
   // Also initialize will be called
  -return;
  +//return;
   }

cvs commit: jakarta-tomcat-connectors/coyote/src/java/org/apache/coyote/tomcat5 CoyoteConnector.java

2003-03-13 Thread remm
remm2003/03/13 02:04:21

  Modified:coyote/src/java/org/apache/coyote/tomcat5
CoyoteConnector.java
  Log:
  - I thought about it more, and there's a benefit to the flag, and doing the check
where it's done, although in theory it belongs to rule 6.
  
  Revision  ChangesPath
  1.20  +17 -1 
jakarta-tomcat-connectors/coyote/src/java/org/apache/coyote/tomcat5/CoyoteConnector.java
  
  Index: CoyoteConnector.java
  ===
  RCS file: 
/home/cvs/jakarta-tomcat-connectors/coyote/src/java/org/apache/coyote/tomcat5/CoyoteConnector.java,v
  retrieving revision 1.19
  retrieving revision 1.20
  diff -u -r1.19 -r1.20
  --- CoyoteConnector.java  13 Mar 2003 09:50:35 -  1.19
  +++ CoyoteConnector.java  13 Mar 2003 10:04:21 -  1.20
  @@ -859,6 +859,22 @@
}
   
   /**
  + * Set the flag to see if we do a redirect to directories that don't end
  + * in a '/'.
  + */
  +public void setRedirectDirectories(boolean rd) {
  +mapper.setRedirectDirectories(rd);
  +}
  +
  +/**
  + * Return the flag to see if we do a redirect to directories that don't 
  + * end in a '/'.
  + */
  +public boolean getRedirectDirectories() {
  +return mapper.getRedirectDirectories();
  +}
  +
  +/**
* Return the scheme that will be assigned to requests received
* through this connector.  Default value is "http".
*/
  
  
  

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



cvs commit: jakarta-tomcat-connectors/coyote/src/java/org/apache/coyote/tomcat5 CoyoteConnector.java

2003-03-13 Thread remm
remm2003/03/13 01:50:35

  Modified:coyote/src/java/org/apache/coyote/tomcat5
CoyoteConnector.java
  Log:
  - Remove the new flag.
  
  Revision  ChangesPath
  1.19  +1 -17 
jakarta-tomcat-connectors/coyote/src/java/org/apache/coyote/tomcat5/CoyoteConnector.java
  
  Index: CoyoteConnector.java
  ===
  RCS file: 
/home/cvs/jakarta-tomcat-connectors/coyote/src/java/org/apache/coyote/tomcat5/CoyoteConnector.java,v
  retrieving revision 1.18
  retrieving revision 1.19
  diff -u -r1.18 -r1.19
  --- CoyoteConnector.java  13 Mar 2003 06:24:10 -  1.18
  +++ CoyoteConnector.java  13 Mar 2003 09:50:35 -  1.19
  @@ -859,22 +859,6 @@
}
   
   /**
  - * Set the flag to see if we do a redirect to directories that don't end
  - * in a '/'.
  - */
  -public void setRedirectDirectories(boolean rd) {
  -mapper.setRedirectDirectories(rd);
  -}
  -
  -/**
  - * Return the flag to see if we do a redirect to directories that don't 
  - * end in a '/'.
  - */
  -public boolean getRedirectDirectories() {
  -return mapper.getRedirectDirectories();
  -}
  -
  -/**
* Return the scheme that will be assigned to requests received
* through this connector.  Default value is "http".
*/
  
  
  

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



cvs commit: jakarta-tomcat-connectors/coyote/src/java/org/apache/coyote/tomcat5 CoyoteConnector.java

2003-03-12 Thread billbarker
billbarker2003/03/12 22:24:10

  Modified:coyote/src/java/org/apache/coyote/tomcat5
CoyoteConnector.java
  Log:
  Make the Mapper 'redirectDirectories' setting configurable.
  
  Revision  ChangesPath
  1.18  +17 -1 
jakarta-tomcat-connectors/coyote/src/java/org/apache/coyote/tomcat5/CoyoteConnector.java
  
  Index: CoyoteConnector.java
  ===
  RCS file: 
/home/cvs/jakarta-tomcat-connectors/coyote/src/java/org/apache/coyote/tomcat5/CoyoteConnector.java,v
  retrieving revision 1.17
  retrieving revision 1.18
  diff -u -r1.17 -r1.18
  --- CoyoteConnector.java  8 Mar 2003 06:51:34 -   1.17
  +++ CoyoteConnector.java  13 Mar 2003 06:24:10 -  1.18
  @@ -859,6 +859,22 @@
}
   
   /**
  + * Set the flag to see if we do a redirect to directories that don't end
  + * in a '/'.
  + */
  +public void setRedirectDirectories(boolean rd) {
  +mapper.setRedirectDirectories(rd);
  +}
  +
  +/**
  + * Return the flag to see if we do a redirect to directories that don't 
  + * end in a '/'.
  + */
  +public boolean getRedirectDirectories() {
  +return mapper.getRedirectDirectories();
  +}
  +
  +/**
* Return the scheme that will be assigned to requests received
* through this connector.  Default value is "http".
*/
  
  
  

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



Re: cvs commit: jakarta-tomcat-connectors/coyote/src/java/org/apache/coyote/tomcat5 CoyoteConnector.java

2003-03-08 Thread Costin Manolache
Bill Barker wrote:

>>   Index: CoyoteConnector.java
>>   ===
>>   @@ -1062,11 +1062,12 @@
>> * Initialize this connector (create ServerSocket here!)
>> */
>>public void initialize()
>>   -throws LifecycleException {
>>   -
>>   -if (initialized)
>>   -throw new LifecycleException
>>   -(sm.getString("coyoteConnector.alreadyInitialized"));
>>   +throws LifecycleException
>>   +{
>>   +if (initialized) {
>>   +
> log.info(sm.getString("coyoteConnector.alreadyInitialized"));
>>   +return;
>>   +}
> 
> I'm not sure that I'm happy with this.  Throwing an exception seems much
> cleaner than logging at a low level and pretending to be happy with
> everything.
> 
> This isn't a veto, since I haven't looked into the callers enough (yet) to
> know what changes.  But it is a very big red-flag.

The problem is that right now init/start are called twice in JMX mode - 
and I couldn't find any simple way to avoid this ( that wouldn't break too
much ).

If you load a connector as a MBean, the JMX container will take care of its
lifecycle - this way the connector could be unloaded/reloaded under JMX
control just like any other jmx component. But tomcat requires the
connector to be registered in Service, and Service will also call
init/stat/stop on it.

I think supporting both operating modes is quite important, so please 
let's not throw exceptions for a while. Having init() called twice
is really not that bad - it may be a sign that the container is confused (
which is very true :-), but the component doesn't have to throw errors.

The best would be to find a better solution to deal with the lifecycle - 
if the JMX container manages a component, Service shouldn't be used.


Costin




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



Re: cvs commit: jakarta-tomcat-connectors/coyote/src/java/org/apache/coyote/tomcat5 CoyoteConnector.java

2003-03-08 Thread Bill Barker

- Original Message -
From: <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Friday, March 07, 2003 10:51 PM
Subject: cvs commit:
jakarta-tomcat-connectors/coyote/src/java/org/apache/coyote/tomcat5
CoyoteConnector.java


> costin  2003/03/07 22:51:34
>
>   Modified:coyote/src/java/org/apache/coyote/tomcat5
> CoyoteConnector.java
>   Log:
>   A bit more flexibility in starting ( init/start may end up beeing called
twice,
>   that shouldn't be treated as a catastrophic event ).
>
>   Improved self-registration. My understanding is that we only need an
Engine,
>   so if no Service exists, just go to the engine.
>
>   Revision  ChangesPath
>   1.17  +54 -21
jakarta-tomcat-connectors/coyote/src/java/org/apache/coyote/tomcat5/CoyoteCo
nnector.java
>
>   Index: CoyoteConnector.java
>   ===
>   @@ -1062,11 +1062,12 @@
> * Initialize this connector (create ServerSocket here!)
> */
>public void initialize()
>   -throws LifecycleException {
>   -
>   -if (initialized)
>   -throw new LifecycleException
>   -(sm.getString("coyoteConnector.alreadyInitialized"));
>   +throws LifecycleException
>   +{
>   +if (initialized) {
>   +
log.info(sm.getString("coyoteConnector.alreadyInitialized"));
>   +return;
>   +}

I'm not sure that I'm happy with this.  Throwing an exception seems much
cleaner than logging at a low level and pretending to be happy with
everything.

This isn't a veto, since I haven't looked into the callers enough (yet) to
know what changes.  But it is a very big red-flag.



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



cvs commit: jakarta-tomcat-connectors/coyote/src/java/org/apache/coyote/tomcat5 CoyoteConnector.java

2003-03-07 Thread costin
costin  2003/03/07 22:51:34

  Modified:coyote/src/java/org/apache/coyote/tomcat5
CoyoteConnector.java
  Log:
  A bit more flexibility in starting ( init/start may end up beeing called twice,
  that shouldn't be treated as a catastrophic event ).
  
  Improved self-registration. My understanding is that we only need an Engine,
  so if no Service exists, just go to the engine.
  
  Revision  ChangesPath
  1.17  +54 -21
jakarta-tomcat-connectors/coyote/src/java/org/apache/coyote/tomcat5/CoyoteConnector.java
  
  Index: CoyoteConnector.java
  ===
  RCS file: 
/home/cvs/jakarta-tomcat-connectors/coyote/src/java/org/apache/coyote/tomcat5/CoyoteConnector.java,v
  retrieving revision 1.16
  retrieving revision 1.17
  diff -u -r1.16 -r1.17
  --- CoyoteConnector.java  17 Feb 2003 05:07:30 -  1.16
  +++ CoyoteConnector.java  8 Mar 2003 06:51:34 -   1.17
  @@ -102,7 +102,7 @@
   
   public final class CoyoteConnector
   implements Connector, Lifecycle, MBeanRegistration
  - {
  +{
   private static Log log = LogFactory.getLog(CoyoteConnector.class);
   
   
  @@ -941,7 +941,7 @@
   
/**
 * Set the URI encoding to be used for the URI.
  -  * 
  +  *
 * @param URIEncoding The new URI character encoding.
 */
public void setURIEncoding(String URIEncoding) {
  @@ -1062,11 +1062,12 @@
* Initialize this connector (create ServerSocket here!)
*/
   public void initialize()
  -throws LifecycleException {
  -
  -if (initialized)
  -throw new LifecycleException
  -(sm.getString("coyoteConnector.alreadyInitialized"));
  +throws LifecycleException
  +{
  +if (initialized) {
  +log.info(sm.getString("coyoteConnector.alreadyInitialized"));
  +return;
  +}
   
   this.initialized = true;
   
  @@ -1162,11 +1163,14 @@
* @exception LifecycleException if a fatal startup error occurs
*/
   public void start() throws LifecycleException {
  +if( !initialized )
  +initialize();
   
   // Validate and update our current state
  -if (started)
  -throw new LifecycleException
  -(sm.getString("coyoteConnector.alreadyStarted"));
  +if (started) {
  +log.info(sm.getString("coyoteConnector.alreadyStarted"));
  +return;
  +}
   lifecycle.fireLifecycleEvent(START_EVENT, null);
   started = true;
   
  @@ -1177,7 +1181,7 @@
   try {
   Registry.getRegistry().registerComponent
   (protocolHandler, this.domain, "protocolHandler",
  - "type=protocolHandler,className=" 
  + "type=protocolHandler,className="
+ protocolHandlerClassName);
   } catch (Exception ex) {
   log.error(sm.getString
  @@ -1197,7 +1201,16 @@
   }
   
   mapperListener.init();
  -
  +if( this.domain != null ) {
  +try {
  +Registry.getRegistry().registerComponent
  +(mapper, this.domain, "Mapper",
  +"type=Mapper");
  +} catch (Exception ex) {
  +log.error(sm.getString
  +("coyoteConnector.protocolRegistrationFailed"), ex);
  +}
  +}
   }
   
   
  @@ -1305,15 +1318,35 @@
   log.info( "Already configured" );
   return;
   }
  +if( container==null ) {
  +// Register to the service
  +ObjectName parentName=new ObjectName( domain + ":" +
  +"type=Service,name=Tomcat-Standalone");
  +
  +log.info("Adding to " + parentName );
  +if( mserver.isRegistered(parentName )) {
  +mserver.invoke(parentName, "addConnector", new Object[] { this },
  +new String[] {"org.apache.catalina.Connector"});
  +// As a side effect we'll get the container field set
  +// Also initialize will be called
  +return;
  +}
  +// XXX Go directly to the Engine
  +// initialize(); - is called by addConnector
  +ObjectName engName=new ObjectName( domain + ":" +
  +"type=Engine,name=Tomcat-Standalone");
  +if( mserver.isRegistered(parentName )) {
  +container=(Container)mserver.getAttribute(parentName, 
"managedResource");
  +log.info("Found engine " + container);
  +initialize();
  +
  +log.info("Initialized");
  +// As a side effect we'll get the container field set
  +// Also initialize will 

cvs commit: jakarta-tomcat-connectors/coyote/src/java/org/apache/coyote/tomcat5 CoyoteConnector.java

2003-02-16 Thread billbarker
billbarker2003/02/16 21:07:31

  Modified:coyote/src/java/org/apache/coyote/tomcat5
CoyoteConnector.java
  Log:
  Add the 'processWelcomeResources' attribute to a place that it can be configured.
  
  Revision  ChangesPath
  1.16  +15 -1 
jakarta-tomcat-connectors/coyote/src/java/org/apache/coyote/tomcat5/CoyoteConnector.java
  
  Index: CoyoteConnector.java
  ===
  RCS file: 
/home/cvs/jakarta-tomcat-connectors/coyote/src/java/org/apache/coyote/tomcat5/CoyoteConnector.java,v
  retrieving revision 1.15
  retrieving revision 1.16
  diff -u -r1.15 -r1.16
  --- CoyoteConnector.java  17 Feb 2003 01:17:28 -  1.15
  +++ CoyoteConnector.java  17 Feb 2003 05:07:30 -  1.16
  @@ -844,6 +844,20 @@
   maxKeepAliveRequests = mkar;
   }
   
  + /**
  +  * Set the flag to see if we do internal redirects to welcome-files.
  +  */
  + public void setProcessWelcomeResources(boolean pwr) {
  + mapper.setProcessWelcomeResources(pwr);
  + }
  +
  + /**
  +  * Return the flag to see if we do internal redirects to welcome-files.
  +  */
  + public boolean getProcessWelcomeResources() {
  + return mapper.getProcessWelcomeResources();
  + }
  +
   /**
* Return the scheme that will be assigned to requests received
* through this connector.  Default value is "http".
  
  
  

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




cvs commit: jakarta-tomcat-connectors/coyote/src/java/org/apache/coyote/tomcat5 CoyoteConnector.java

2003-02-16 Thread costin
costin  2003/02/16 17:17:29

  Modified:coyote/src/java/org/apache/coyote/tomcat5
CoyoteConnector.java
  Log:
  More checks on start/stop - to deal with the dynamics of JMX
  
  Revision  ChangesPath
  1.15  +35 -4 
jakarta-tomcat-connectors/coyote/src/java/org/apache/coyote/tomcat5/CoyoteConnector.java
  
  Index: CoyoteConnector.java
  ===
  RCS file: 
/home/cvs/jakarta-tomcat-connectors/coyote/src/java/org/apache/coyote/tomcat5/CoyoteConnector.java,v
  retrieving revision 1.14
  retrieving revision 1.15
  diff -u -r1.14 -r1.15
  --- CoyoteConnector.java  10 Feb 2003 00:51:20 -  1.14
  +++ CoyoteConnector.java  17 Feb 2003 01:17:28 -  1.15
  @@ -1195,9 +1195,11 @@
   public void stop() throws LifecycleException {
   
   // Validate and update our current state
  -if (!started)
  -throw new LifecycleException
  -(sm.getString("coyoteConnector.notStarted"));
  +if (!started) {
  +log.error(sm.getString("coyoteConnector.notStarted"));
  +return;
  +
  +}
   lifecycle.fireLifecycleEvent(STOP_EVENT, null);
   started = false;
   
  @@ -1274,6 +1276,35 @@
   }
   
   public void postDeregister() {
  +try {
  +if( started ) {
  +stop();
  +}
  +} catch( Throwable t ) {
  +log.error( "Unregistering - can't stop", t);
  +}
  +}
  +
  +public void init() throws Exception {
  +
  +if( this.getService() != null ) {
  +log.info( "Already configured" );
  +return;
  +}
  +
  +// Register to the service
  +ObjectName parentName=new ObjectName( domain + ":" +
  +"type=Service,name=Tomcat-Standalone");
  +log.info("Adding to " + parentName );
  +
  +mserver.invoke(parentName, "addConnector", new Object[] { this },
  +new String[] {"org.apache.catalina.Connector"});
  +// initialize(); - is called by addConnector
   }
   
  +public void destroy() throws Exception {
  +if( getService() == null)
  +return;
  +getService().removeConnector(this);
  +}
   }
  
  
  

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




cvs commit: jakarta-tomcat-connectors/coyote/src/java/org/apache/coyote/tomcat5 CoyoteConnector.java LocalStrings.properties MapperListener.java

2003-02-09 Thread remm
remm2003/02/09 16:51:20

  Modified:coyote/src/java/org/apache/coyote/tomcat5
CoyoteConnector.java LocalStrings.properties
MapperListener.java
  Log:
  - Add some logging.
  
  Revision  ChangesPath
  1.14  +11 -8 
jakarta-tomcat-connectors/coyote/src/java/org/apache/coyote/tomcat5/CoyoteConnector.java
  
  Index: CoyoteConnector.java
  ===
  RCS file: 
/home/cvs/jakarta-tomcat-connectors/coyote/src/java/org/apache/coyote/tomcat5/CoyoteConnector.java,v
  retrieving revision 1.13
  retrieving revision 1.14
  diff -u -r1.13 -r1.14
  --- CoyoteConnector.java  8 Feb 2003 16:55:20 -   1.13
  +++ CoyoteConnector.java  10 Feb 2003 00:51:20 -  1.14
  @@ -1158,17 +1158,20 @@
   
   // We can't register earlier - the JMX registration of this happens
   // in Server.start callback
  -if( this.oname != null ) {
  +if ( this.oname != null ) {
   // We are registred - register the adapter as well.
   try {
  -Registry.getRegistry().registerComponent(protocolHandler,
  -this.domain, "protocolHandler",
  -"type=protocolHandler,className=" + 
protocolHandlerClassName);
  -} catch( Exception ex ) {
  -ex.printStackTrace();
  +Registry.getRegistry().registerComponent
  +(protocolHandler, this.domain, "protocolHandler",
  + "type=protocolHandler,className=" 
  + + protocolHandlerClassName);
  +} catch (Exception ex) {
  +log.error(sm.getString
  +  ("coyoteConnector.protocolRegistrationFailed"), ex);
   }
   } else {
  -log.info( "Coyote can't register jmx for protocol");
  +log.info(sm.getString
  + ("coyoteConnector.cannotRegisterProtocol"));
   }
   
   try {
  
  
  
  1.3   +14 -0 
jakarta-tomcat-connectors/coyote/src/java/org/apache/coyote/tomcat5/LocalStrings.properties
  
  Index: LocalStrings.properties
  ===
  RCS file: 
/home/cvs/jakarta-tomcat-connectors/coyote/src/java/org/apache/coyote/tomcat5/LocalStrings.properties,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- LocalStrings.properties   9 Aug 2002 02:10:10 -   1.2
  +++ LocalStrings.properties   10 Feb 2003 00:51:20 -  1.3
  @@ -5,11 +5,13 @@
   
   coyoteConnector.alreadyInitialized=The connector has already been initialized
   coyoteConnector.alreadyStarted=The connector has already been started
  +coyoteConnector.cannotRegisterProtocol=Cannot register MBean for the Protocol
   coyoteConnector.notStarted=Coyote connector has not been started
   coyoteConnector.protocolHandlerDestroyFailed=Protocol handler destroy failed: {0}
   coyoteConnector.protocolHandlerInitializationFailed=Protocol handler initialization 
failed: {0}
   coyoteConnector.protocolHandlerInstantiationFailed=Protocol handler instantiation 
failed: {0}
   coyoteConnector.protocolHandlerStartFailed=Protocol handler start failed: {0}
  +coyoteConnector.protocolRegistrationFailed=Protocol JMX registration failed
   
   #
   # CoyoteAdapter
  @@ -39,3 +41,15 @@
   coyoteRequest.listenerStart=Exception sending context initialized event to listener 
instance of class {0}
   coyoteRequest.listenerStop=Exception sending context destroyed event to listener 
instance of class {0}
   coyoteRequest.attributeEvent=Exception thrown by attributes event listener
  +
  +
  +#
  +# MapperListener
  +#
  +
  +mapperListener.registerContext=Register Context {0}
  +mapperListener.unregisterContext=Unregister Context {0}
  +mapperListener.registerWrapper=Register Wrapper {0} in Context {1}
  +
  +
  +
  
  
  
  1.4   +23 -0 
jakarta-tomcat-connectors/coyote/src/java/org/apache/coyote/tomcat5/MapperListener.java
  
  Index: MapperListener.java
  ===
  RCS file: 
/home/cvs/jakarta-tomcat-connectors/coyote/src/java/org/apache/coyote/tomcat5/MapperListener.java,v
  retrieving revision 1.3
  retrieving revision 1.4
  diff -u -r1.3 -r1.4
  --- MapperListener.java   30 Jan 2003 16:45:27 -  1.3
  +++ MapperListener.java   10 Feb 2003 00:51:20 -  1.4
  @@ -68,6 +68,8 @@
   import javax.management.ObjectInstance;
   import javax.management.ObjectName;
   
  +import org.apache.commons.logging.Log;
  +import org.apache.commons.logging.LogFactory;
   import org.apache.commons.modeler.Registry;
   
   import org.apache.tomcat.util.http.mapper.Mapper;
  @@ -78,6 +80,8 @@
   import org.apache.catalina.Host;
   import org.apache.catalina.ServerFactory;
   import org.apache.catalina.Wrapper;
  +import org.apa

cvs commit: jakarta-tomcat-connectors/coyote/src/java/org/apache/coyote/tomcat5 CoyoteConnector.java

2003-01-14 Thread remm
remm2003/01/14 13:50:41

  Modified:coyote/src/java/org/apache/coyote/tomcat5
CoyoteConnector.java
  Log:
  - Add an accessor for the protocol handler.
  
  Revision  ChangesPath
  1.8   +14 -4 
jakarta-tomcat-connectors/coyote/src/java/org/apache/coyote/tomcat5/CoyoteConnector.java
  
  Index: CoyoteConnector.java
  ===
  RCS file: 
/home/cvs/jakarta-tomcat-connectors/coyote/src/java/org/apache/coyote/tomcat5/CoyoteConnector.java,v
  retrieving revision 1.7
  retrieving revision 1.8
  diff -u -r1.7 -r1.8
  --- CoyoteConnector.java  23 Dec 2002 01:35:09 -  1.7
  +++ CoyoteConnector.java  14 Jan 2003 21:50:41 -  1.8
  @@ -688,6 +688,16 @@
   
   
   /**
  + * Return the protocol handler associated with the connector.
  + */
  +public ProtocolHandler getProtocolHandler() {
  +
  +return (this.protocolHandler);
  +
  +}
  +
  +
  +/**
* Return the proxy server name for this Connector.
*/
   public String getProxyName() {
  
  
  

--
To unsubscribe, e-mail:   
For additional commands, e-mail: 




cvs commit: jakarta-tomcat-connectors/coyote/src/java/org/apache/coyote/tomcat5 CoyoteConnector.java

2002-12-22 Thread billbarker
billbarker2002/12/22 17:35:09

  Modified:coyote/src/java/org/apache/coyote/tomcat5
CoyoteConnector.java
  Log:
  Port patch from tomcat4.
  
  Revision  ChangesPath
  1.7   +26 -4 
jakarta-tomcat-connectors/coyote/src/java/org/apache/coyote/tomcat5/CoyoteConnector.java
  
  Index: CoyoteConnector.java
  ===
  RCS file: 
/home/cvs/jakarta-tomcat-connectors/coyote/src/java/org/apache/coyote/tomcat5/CoyoteConnector.java,v
  retrieving revision 1.6
  retrieving revision 1.7
  diff -u -r1.6 -r1.7
  --- CoyoteConnector.java  18 Dec 2002 18:11:10 -  1.6
  +++ CoyoteConnector.java  23 Dec 2002 01:35:09 -  1.7
  @@ -281,6 +281,11 @@
*/
   private boolean disableUploadTimeout = false;
   
  +/**
  + * Maximum number of Keep-Alive requests to honor per connection.
  + */
  +private int maxKeepAliveRequests = 100;
  +
   
   /**
* Has this component been initialized yet?
  @@ -771,6 +776,21 @@
   disableUploadTimeout = isDisabled;
   }
   
  +
  +/**
  + * Return the maximum number of Keep-Alive requests to honor per connection.
  + */
  +public int getMaxKeepAliveRequests() {
  +return maxKeepAliveRequests;
  +}
  +
  +/**
  + * Set the maximum number of Keep-Alive requests to honor per connection.
  + */
  +public void setMaxKeepAliveRequests(int mkar) {
  +maxKeepAliveRequests = mkar;
  +}
  +
   /**
* Return the scheme that will be assigned to requests received
* through this connector.  Default value is "http".
  @@ -993,6 +1013,8 @@
  "" + connectionTimeout);
   IntrospectionUtils.setProperty(protocolHandler, "disableUploadTimeout", 
  "" + disableUploadTimeout);
  +IntrospectionUtils.setProperty(protocolHandler, "maxKeepAliveRequests",
  +   "" + maxKeepAliveRequests);
   IntrospectionUtils.setProperty(protocolHandler, "compression", 
  compression);
   if (address != null) {
  
  
  

--
To unsubscribe, e-mail:   
For additional commands, e-mail: 




cvs commit: jakarta-tomcat-connectors/coyote/src/java/org/apache/coyote/tomcat5 CoyoteConnector.java

2002-12-18 Thread remm
remm2002/12/18 10:11:11

  Modified:coyote/src/java/org/apache/coyote/tomcat4
CoyoteConnector.java
   coyote/src/java/org/apache/coyote/tomcat5
CoyoteConnector.java
  Log:
  - Add new compression attribute.
  
  Revision  ChangesPath
  1.19  +44 -11
jakarta-tomcat-connectors/coyote/src/java/org/apache/coyote/tomcat4/CoyoteConnector.java
  
  Index: CoyoteConnector.java
  ===
  RCS file: 
/home/cvs/jakarta-tomcat-connectors/coyote/src/java/org/apache/coyote/tomcat4/CoyoteConnector.java,v
  retrieving revision 1.18
  retrieving revision 1.19
  diff -u -r1.18 -r1.19
  --- CoyoteConnector.java  26 Nov 2002 03:26:56 -  1.18
  +++ CoyoteConnector.java  18 Dec 2002 18:11:10 -  1.19
  @@ -259,13 +259,6 @@
*/
   private boolean secure = false;
   
  -/**
  - * Flag to disable setting a seperate time-out for uploads.
  - * If true, then the timeout parameter is
  - * ignored.  If false, then the timeout
  - * parameter is used to control uploads.
  - */
  -private boolean disableUploadTimeout = false;
   
   /**
* The string manager for this package.
  @@ -305,6 +298,21 @@
   
   
   /**
  + * Flag to disable setting a seperate time-out for uploads.
  + * If true, then the timeout parameter is
  + * ignored.  If false, then the timeout
  + * parameter is used to control uploads.
  + */
  +private boolean disableUploadTimeout = false;
  +
  +
  +/**
  + * Compression value.
  + */
  +private String compression = "off";
  +
  +
  +/**
* Coyote Protocol handler class name.
* Defaults to the Coyote HTTP/1.1 protocolHandler.
*/
  @@ -478,6 +486,29 @@
   
   
   /**
  + * Get the value of compression.
  + */
  +public String getCompression() {
  +
  +return (compression);
  +
  +}
  +
  +
  +/**
  + * Set the value of compression.
  + * 
  + * @param compression The new compression value, which can be "on", "off"
  + * or "force"
  + */
  +public void setCompression(String compression) {
  +
  +this.compression = compression;
  +
  +}
  +
  +
  +/**
* Return the current number of processors that have been created.
*/
   public int getCurProcessors() {
  @@ -990,6 +1021,8 @@
  "" + connectionTimeout);
   IntrospectionUtils.setProperty(protocolHandler, "disableUploadTimeout", 
  "" + disableUploadTimeout);
  +IntrospectionUtils.setProperty(protocolHandler, "compression", 
  +   compression);
   if (address != null) {
   IntrospectionUtils.setProperty(protocolHandler, "address", 
  address);
  
  
  
  1.6   +35 -4 
jakarta-tomcat-connectors/coyote/src/java/org/apache/coyote/tomcat5/CoyoteConnector.java
  
  Index: CoyoteConnector.java
  ===
  RCS file: 
/home/cvs/jakarta-tomcat-connectors/coyote/src/java/org/apache/coyote/tomcat5/CoyoteConnector.java,v
  retrieving revision 1.5
  retrieving revision 1.6
  diff -u -r1.5 -r1.6
  --- CoyoteConnector.java  27 Nov 2002 20:14:43 -  1.5
  +++ CoyoteConnector.java  18 Dec 2002 18:11:10 -  1.6
  @@ -155,6 +155,12 @@
   
   
   /**
  + * Compression value.
  + */
  +private String compression = "off";
  +
  +
  +/**
* The set of processors that have ever been created.
*/
   private Vector created = new Vector();
  @@ -352,6 +358,29 @@
   
   
   /**
  + * Get the value of compression.
  + */
  +public String getCompression() {
  +
  +return (compression);
  +
  +}
  +
  +
  +/**
  + * Set the value of compression.
  + * 
  + * @param compression The new compression value, which can be "on", "off"
  + * or "force"
  + */
  +public void setCompression(String compression) {
  +
  +this.compression = compression;
  +
  +}
  +
  +
  +/**
* Return the connection timeout for this Connector.
*/
   public int getConnectionTimeout() {
  @@ -964,6 +993,8 @@
  "" + connectionTimeout);
   IntrospectionUtils.setProperty(protocolHandler, "disableUploadTimeout", 
  "" + disableUploadTimeout);
  +IntrospectionUtils.setProperty(protocolHandler, "compression", 
  +   compression);
   if (address != null) {
   IntrospectionUtils.setProperty(protocolHandler, "address", 
  address);
  
  
  

--
To unsubscribe, e-mai

cvs commit: jakarta-tomcat-connectors/coyote/src/java/org/apache/coyote/tomcat5 CoyoteConnector.java

2002-11-27 Thread remm
remm2002/11/27 12:14:44

  Modified:coyote/src/java/org/apache/coyote/tomcat5
CoyoteConnector.java
  Log:
  - Update version number.
  
  Revision  ChangesPath
  1.5   +7 -5  
jakarta-tomcat-connectors/coyote/src/java/org/apache/coyote/tomcat5/CoyoteConnector.java
  
  Index: CoyoteConnector.java
  ===
  RCS file: 
/home/cvs/jakarta-tomcat-connectors/coyote/src/java/org/apache/coyote/tomcat5/CoyoteConnector.java,v
  retrieving revision 1.4
  retrieving revision 1.5
  diff -u -r1.4 -r1.5
  --- CoyoteConnector.java  26 Nov 2002 03:26:56 -  1.4
  +++ CoyoteConnector.java  27 Nov 2002 20:14:43 -  1.5
  @@ -188,7 +188,7 @@
* Descriptive information about this Connector implementation.
*/
   private static final String info =
  -"org.apache.coyote.tomcat5.CoyoteConnector2/1.0";
  +"org.apache.coyote.tomcat5.CoyoteConnector/2.0";
   
   
   /**
  @@ -266,6 +266,7 @@
   private StringManager sm =
   StringManager.getManager(Constants.Package);
   
  +
   /**
* Flag to disable setting a seperate time-out for uploads.
* If true, then the timeout parameter is
  @@ -273,6 +274,7 @@
* parameter is used to control uploads.
*/
   private boolean disableUploadTimeout = false;
  +
   
   /**
* Has this component been initialized yet?
  
  
  

--
To unsubscribe, e-mail:   
For additional commands, e-mail: 




cvs commit: jakarta-tomcat-connectors/coyote/src/java/org/apache/coyote/tomcat5 CoyoteConnector.java

2002-11-25 Thread billbarker
billbarker2002/11/25 19:26:56

  Modified:coyote/src/java/org/apache/coyote/tomcat4
CoyoteConnector.java
   coyote/src/java/org/apache/coyote/tomcat5
CoyoteConnector.java
  Log:
  Add a configuration option to disable setting a seperate time-out for uploads.
  
  The effect of this is many fewer calls to setSoTimeout.  I can't see the difference 
myself (at least on Solaris), but it should be harmless as long as you don't expect to 
be doing large uploads.
  
  Revision  ChangesPath
  1.18  +30 -4 
jakarta-tomcat-connectors/coyote/src/java/org/apache/coyote/tomcat4/CoyoteConnector.java
  
  Index: CoyoteConnector.java
  ===
  RCS file: 
/home/cvs/jakarta-tomcat-connectors/coyote/src/java/org/apache/coyote/tomcat4/CoyoteConnector.java,v
  retrieving revision 1.17
  retrieving revision 1.18
  diff -u -r1.17 -r1.18
  --- CoyoteConnector.java  11 Oct 2002 02:38:22 -  1.17
  +++ CoyoteConnector.java  26 Nov 2002 03:26:56 -  1.18
  @@ -259,6 +259,13 @@
*/
   private boolean secure = false;
   
  +/**
  + * Flag to disable setting a seperate time-out for uploads.
  + * If true, then the timeout parameter is
  + * ignored.  If false, then the timeout
  + * parameter is used to control uploads.
  + */
  +private boolean disableUploadTimeout = false;
   
   /**
* The string manager for this package.
  @@ -721,6 +728,23 @@
   
   }
   
  +/**
  + * Return the flag that specifies upload time-out behavior.
  + */
  +public boolean getDisableUploadTimeout() {
  +return disableUploadTimeout;
  +}
  +
  +/**
  + * Set the flag to specify upload time-out behavior.
  + *
  + * @param isDisabled If true, then the timeout 
  + * parameter is ignored.  If false, then the 
  + * timeout parameter is used to control uploads.
  + */
  +public void setDisableUploadTimeout( boolean isDisabled ) {
  +disableUploadTimeout = isDisabled;
  +}
   
   /**
* Return the scheme that will be assigned to requests received
  @@ -964,6 +988,8 @@
  "" + connectionTimeout);
   IntrospectionUtils.setProperty(protocolHandler, "timeout", 
  "" + connectionTimeout);
  +IntrospectionUtils.setProperty(protocolHandler, "disableUploadTimeout", 
  +   "" + disableUploadTimeout);
   if (address != null) {
   IntrospectionUtils.setProperty(protocolHandler, "address", 
  address);
  
  
  
  1.4   +30 -4 
jakarta-tomcat-connectors/coyote/src/java/org/apache/coyote/tomcat5/CoyoteConnector.java
  
  Index: CoyoteConnector.java
  ===
  RCS file: 
/home/cvs/jakarta-tomcat-connectors/coyote/src/java/org/apache/coyote/tomcat5/CoyoteConnector.java,v
  retrieving revision 1.3
  retrieving revision 1.4
  diff -u -r1.3 -r1.4
  --- CoyoteConnector.java  18 Oct 2002 05:58:53 -  1.3
  +++ CoyoteConnector.java  26 Nov 2002 03:26:56 -  1.4
  @@ -266,6 +266,13 @@
   private StringManager sm =
   StringManager.getManager(Constants.Package);
   
  +/**
  + * Flag to disable setting a seperate time-out for uploads.
  + * If true, then the timeout parameter is
  + * ignored.  If false, then the timeout
  + * parameter is used to control uploads.
  + */
  +private boolean disableUploadTimeout = false;
   
   /**
* Has this component been initialized yet?
  @@ -715,6 +722,23 @@
   
   }
   
  +/**
  + * Return the flag that specifies upload time-out behavior.
  + */
  +public boolean getDisableUploadTimeout() {
  +return disableUploadTimeout;
  +}
  +
  +/**
  + * Set the flag to specify upload time-out behavior.
  + *
  + * @param isDisabled If true, then the timeout 
  + * parameter is ignored.  If false, then the 
  + * timeout parameter is used to control uploads.
  + */
  +public void setDisableUploadTimeout( boolean isDisabled ) {
  +disableUploadTimeout = isDisabled;
  +}
   
   /**
* Return the scheme that will be assigned to requests received
  @@ -936,6 +960,8 @@
  "" + connectionTimeout);
   IntrospectionUtils.setProperty(protocolHandler, "timeout", 
  "" + connectionTimeout);
  +IntrospectionUtils.setProperty(protocolHandler, "disableUploadTimeout", 
  +   "" + disableUploadTimeout);
   if (address != null) {
   IntrospectionUtils.setProperty(protocolHandler, "address", 
  

cvs commit: jakarta-tomcat-connectors/coyote/src/java/org/apache/coyote/tomcat5 CoyoteConnector.java

2002-10-18 Thread billbarker
billbarker2002/10/17 22:58:53

  Modified:coyote/src/java/org/apache/coyote/tomcat5
CoyoteConnector.java
  Log:
  Port from tomcat4, including Jon's suggested optimization.
  
  Revision  ChangesPath
  1.3   +9 -5  
jakarta-tomcat-connectors/coyote/src/java/org/apache/coyote/tomcat5/CoyoteConnector.java
  
  Index: CoyoteConnector.java
  ===
  RCS file: 
/home/cvs/jakarta-tomcat-connectors/coyote/src/java/org/apache/coyote/tomcat5/CoyoteConnector.java,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- CoyoteConnector.java  10 Oct 2002 09:07:33 -  1.2
  +++ CoyoteConnector.java  18 Oct 2002 05:58:53 -  1.3
  @@ -661,7 +661,11 @@
*/
   public void setProxyName(String proxyName) {
   
  -this.proxyName = proxyName;
  +if(proxyName != null && proxyName.length() > 0) {
  +this.proxyName = proxyName;
  +} else {
  +this.proxyName = null;
  +}
   
   }
   
  
  
  

--
To unsubscribe, e-mail:   
For additional commands, e-mail: