avalon-cvs mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From mcconn...@apache.org
Subject cvs commit: avalon/merlin/web/http/impl/src/java/org/apache/avalon/merlin/http JettyWebServer.java
Date Thu, 01 Jan 2004 16:27:38 GMT
mcconnell    2004/01/01 08:27:38

  Modified:    merlin/web/http/impl/src/java/org/apache/avalon/merlin/http
                        JettyWebServer.java
  Log:
  Clean up formatting.
  
  Revision  Changes    Path
  1.4       +288 -179  avalon/merlin/web/http/impl/src/java/org/apache/avalon/merlin/http/JettyWebServer.java
  
  Index: JettyWebServer.java
  ===================================================================
  RCS file: /home/cvs/avalon/merlin/web/http/impl/src/java/org/apache/avalon/merlin/http/JettyWebServer.java,v
  retrieving revision 1.3
  retrieving revision 1.4
  diff -u -r1.3 -r1.4
  --- JettyWebServer.java	2 Dec 2003 00:07:56 -0000	1.3
  +++ JettyWebServer.java	1 Jan 2004 16:27:38 -0000	1.4
  @@ -100,21 +100,11 @@
       extends AbstractLogEnabled
       implements Contextualizable, Configurable, Initializable, Serviceable,
       Startable, Disposable, WebServer
  - {
  -    /************************************************/
  -    protected Context m_context;
  -    protected Configuration m_config;
  -    protected Logger m_logger;
  -    protected HttpServer m_httpServer;
  -    protected ServiceManager m_serviceManager;
  -     
  -    /************************************************/
  -    //protected File m_appHome = null;
  -    protected HashMap m_listeners = new HashMap();
  -    protected String m_basedir = 
  -      System.getProperty("merlin.home", System.getProperty("user.dir"));
  -     
  -    /************************************************/
  +{
  +    //------------------------------------------------------------------
  +    // static
  +    //------------------------------------------------------------------
  +
       protected static final String CFG_LISTENER = "Listener";
       protected static final String CFG_LISTENER_NAME = "name";
       protected static final String CFG_LISTENER_PORT = "port";
  @@ -133,13 +123,23 @@
       protected static final String CFG_SERVLET_PATH = "path";
       protected static final String CFG_SERVLET_CLASSNAME = "classname";
       protected static final String CFG_WEB_CONTEXT = "WebContext";
  -    
  +
  +    //------------------------------------------------------------------
  +    // state
  +    //------------------------------------------------------------------
  +
  +    protected Configuration m_config;
  +    protected HttpServer m_httpServer;
  +    protected ServiceManager m_serviceManager;
  +    protected HashMap m_listeners = new HashMap();
  +    protected String m_basedir; 
  +     
  +    //------------------------------------------------------------------
  +    // lifecycle
  +    //------------------------------------------------------------------
  +
       /**
  -    * Contextualizes the component using an Avalon context. Specifically looks
  -    * for a home or working directory with the key "app.home" or "urn:avalon:home",
  -    * and sets this as the component's base directory. Otherwise, the component's
  -    * base directory will default to either the MERLIN_HOME environment setting
  -    * or the application's current working directory.
  +    * Contextualizes the component using an Avalon context.
       *
       * @param context an Avalon Context object
       * @throws <code>ContextException</code> if an error occurs while retrieving
  @@ -147,40 +147,10 @@
       *
       * @avalon.entry key="urn:avalon:home" type="java.io.File" alias="app.home"
       */
  -    public void contextualize(Context context) throws ContextException {
  -        m_context = context;
  -        
  -        // cache the component's logger
  -        m_logger = getLogger();
  -        if (m_logger.isInfoEnabled()) m_logger.info("Contextualizing...");
  -
  -        // attempt to find out the "home" directory of this component
  -        // if we find it, then set the basedir to this directory
  -        try {
  -            File home = null;
  -
  -         // First, we'll try 'app.home'; if that doesn't exist, then 'urn:avalon:home'
  -         try {
  -            home = (File) context.get("app.home");
  -         } catch (ContextException ce) {
  -            if (m_logger.isWarnEnabled())
  -                m_logger.warn("'app.home' key not found in context; trying 'urn:avalon:home'");
  -            try {
  -                home = (File) context.get("urn:avalon:home");
  -            } catch (ContextException cex) {
  -                if (m_logger.isWarnEnabled())
  -                    m_logger.warn("'urn:avalon:home' key not found in context; using default");
  -            }
  -         }
  -         if (home != null) {
  -            m_basedir = home.getAbsolutePath();
  -         }
  -         if (m_logger.isDebugEnabled())
  -            m_logger.debug("Setting home directory to: " + m_basedir);
  -        } catch (Exception e) {
  -            if (m_logger.isWarnEnabled())
  -                m_logger.warn("Error attempting to establish home directory. Using default.",
e);
  -        }
  +    public void contextualize(Context context) throws ContextException 
  +    {
  +        getLogger().info("Contextualizing...");
  +        m_basedir = ((File)context.get("app.home")).getAbsolutePath();
       }
        
       /**
  @@ -199,7 +169,10 @@
        * @see org.apache.avalon.framework.service.Serviceable#service(ServiceManager)
       */
       public void service(ServiceManager manager) throws ServiceException {
  -        if (m_logger.isInfoEnabled()) m_logger.info("Servicing...");
  +        if( getLogger().isInfoEnabled() )
  +        {
  +            getLogger().info( "servicing" );
  +        }
           m_serviceManager = manager;
       }
        
  @@ -273,8 +246,12 @@
        * this component
        * @see org.apache.avalon.framework.configuration.Configurable#configure(Configuration)
        */
  -    public void configure(Configuration config) throws ConfigurationException {
  -        if (m_logger.isInfoEnabled()) m_logger.info("Configuring...");
  +    public void configure(Configuration config) throws ConfigurationException 
  +    {
  +        if (getLogger().isInfoEnabled())
  +        {
  +            getLogger().info( "configuring" );
  +        }
           m_config = config;
       }
        
  @@ -287,10 +264,14 @@
        *
        * @throws <code>Exception</code> if an error occurs during initialization
of
        * this component
  -     * @see org.apache.avalon.framework.activity.Initializable#initialize()
  +     * @see Initializable#initialize()
        */
  -    public void initialize() throws Exception {
  -        if (m_logger.isInfoEnabled()) m_logger.info("Initializing...");
  +    public void initialize() throws Exception 
  +    {
  +        if( getLogger().isInfoEnabled() ) 
  +        {
  +            getLogger().info("initializing");
  +        }
   
           m_httpServer = new HttpServer();
           loadListeners();
  @@ -307,8 +288,12 @@
        * this component
        * @see org.apache.avalon.framework.activity.Startable#start()
        */
  -    public void start() throws Exception {
  -        if (m_logger.isInfoEnabled()) m_logger.info("Starting...");
  +    public void start() throws Exception 
  +    {
  +        if( getLogger().isInfoEnabled() ) 
  +        {
  +            getLogger().info("starting");
  +        }
           m_httpServer.start();
       }
   
  @@ -321,8 +306,12 @@
       * this component
       * @see org.apache.avalon.framework.activity.Startable#stop()
       */
  -    public void stop() throws Exception {
  -        if (m_logger.isInfoEnabled()) m_logger.info("Shutting down...");
  +    public void stop() throws Exception 
  +    {
  +        if( getLogger().isInfoEnabled() ) 
  +        {
  +            getLogger().info("stopping");
  +        }
           m_httpServer.stop(true);
       }
        
  @@ -333,39 +322,46 @@
        *
        * @see org.apache.avalon.framework.activity.Disposable#dispose()
        */
  -    public void dispose() {
  -        m_context = null;
  +    public void dispose() 
  +    {
           m_serviceManager = null;
           m_httpServer = null;
           m_listeners = null;
       }
        
       /**
  -     * @see org.apache.avalon.merlin.http.WebServer#deployWebApplication(java.lang.String,
java.lang.String)
  +     * @see WebServer#deployWebApplication(java.lang.String, java.lang.String)
        */
  -    public void deployWebApplication(String context, String appPath) {
  +    public void deployWebApplication(String context, String appPath) 
  +    {
           loadWebApplicationContext(context, appPath);
       }
   
       /**
  -     * @see org.apache.avalon.merlin.http.WebServer#removeWebApplication(java.lang.String)
  +     * @see WebServer#removeWebApplication(java.lang.String)
        */
  -    public boolean removeWebApplication(String context) {
  -        try {
  +    public boolean removeWebApplication(String context) 
  +    {
  +        try 
  +        {
               m_httpServer.stop();
               HttpContext ctx = m_httpServer.getContext(context);
               if (ctx != null) {
                   m_httpServer.removeContext(ctx);
               } else {
  -                m_logger.error("Could not find application to remove: " + context);
  +                getLogger().error("Could not find application to remove: " + context);
                   return false;
               }
               m_httpServer.start();
  -        } catch (InterruptedException e) {
  -            m_logger.error("Unable to remove web application due to: " + e.getMessage());
  +        } 
  +        catch (InterruptedException e) 
  +        {
  +            getLogger().error("Unable to remove web application due to: " + e.getMessage());
               return false;
  -        } catch (MultiException e) {
  -            m_logger.error("Unable to re-start web application due to: " + e.getMessage());
  +        } 
  +        catch (MultiException e) 
  +        {
  +            getLogger().error("Unable to re-start web application due to: " + e.getMessage());
               return false;
           }
           return true;
  @@ -376,42 +372,60 @@
        *
        * @param name the alias of the listener that has been defined in configuration file
        */
  -    public void startListener(String name) throws Exception {
  +    public void startListener(String name) throws Exception 
  +    {
           boolean found = false;
           boolean started = false;
               
  -        m_logger.debug("Attempting to start listener " + name);
  -        if (m_listeners.containsKey(name)) {
  -            m_logger.debug("Retrieving listener " + name + " from lookup table...");
  +        getLogger().debug("Attempting to start listener " + name);
  +        if (m_listeners.containsKey(name)) 
  +        {
  +            getLogger().debug("Retrieving listener " + name + " from lookup table...");
               HttpListener listener = (HttpListener) m_listeners.get(name);
  -            m_logger.debug("Listener " + name + " retrieved");
  +            getLogger().debug("Listener " + name + " retrieved");
                   
               // listener must be stopped before we can start it
  -            if (listener == null) {
  -                m_logger.debug("Listener " + name + " has not yet been created/started");
  +            if (listener == null) 
  +            {
  +                getLogger().debug("Listener " + name + " has not yet been created/started");
                       
                   // get the configuration for this listener...
                   Configuration[] listeners = m_config.getChildren(CFG_LISTENER);
  -                m_logger.debug("Searching for listener " + name + "'s configuration...");
  -                for (int i = 0; i < listeners.length; i++) {
  +                getLogger().debug("Searching for listener " + name + "'s configuration...");
  +                for (int i = 0; i < listeners.length; i++) 
  +                {
                       Configuration conf = listeners[i];
                       String alias = conf.getAttribute(CFG_LISTENER_NAME);
  -                    if (alias.equals(name)) {
  +                    if (alias.equals(name))
  +                    {
                           found = true;
  -                        m_logger.debug("Found configuration for listener " + name);
  -                        m_logger.debug("Loading listener " + name + "...");
  +                        getLogger().debug(
  +                          "Found configuration for listener " 
  +                          + name );
  +                        getLogger().debug(
  +                          "Loading listener " 
  +                          + name + "...");
                           listener = loadListener(conf);
  -                        if (listener != null) {
  -                            m_logger.debug("Listener " + name + " loaded");
  +                        if (listener != null)
  +                        {
  +                            getLogger().debug( 
  +                              "Listener " 
  +                              + name + " loaded" );
                               listener.setHttpServer(m_httpServer);
  -                            m_logger.debug("Registered the listener with Jetty...");
  -                            if (!listener.isStarted()) {
  -                                m_logger.debug("Starting listener " + name);
  +                            getLogger().debug(
  +                              "Registered the listener with Jetty...");
  +                            if (!listener.isStarted()) 
  +                            {
  +                                getLogger().debug(
  +                                  "Starting listener " + name);
                                   listener.start();
  -                                m_logger.debug("Listener " + name + " started");
  +                                getLogger().debug(
  +                                  "Listener " + name + " started");
                                   started = true;
                                   m_listeners.put(name, listener);
  -                                m_logger.debug("Listener " + name + " stored in lookup
table");
  +                                getLogger().debug(
  +                                  "Listener " + name 
  +                                  + " stored in lookup table");
                               }
                           }
                           break;
  @@ -419,23 +433,36 @@
                   }
                       
                   // did we find the listener in our lookup table?
  -                if (!found) {
  -                    String errmsg = "Listener name [" + name + "] cannot be started because
configuration not found";
  -                    m_logger.warn(errmsg);
  -                    throw new Exception(errmsg);
  -                } else if (!started) {
  -                    String errmsg = "Listener name [" + name + "] cannot be started because
of unknown listener name";
  -                    m_logger.warn(errmsg);
  -                    throw new Exception(errmsg);
  +                if (!found) 
  +                {
  +                    String errmsg = 
  +                      "Listener name [" + name 
  +                      + "] cannot be started because configuration not found";
  +                    throw new Exception( errmsg );
  +                } 
  +                else if (!started) 
  +                {
  +                    String errmsg = 
  +                      "Listener name [" 
  +                      + name 
  +                      + "] cannot be started because of unknown listener name";
  +                    throw new Exception( errmsg );
                   }
  -            } else {
  -                String errmsg = "Listener name [" + name + "] cannot be started because
it is already running";
  -                m_logger.warn(errmsg);
  -                throw new Exception(errmsg);
  +            } 
  +            else 
  +            {
  +                String errmsg = 
  +                  "Listener name [" + name 
  +                  + "] cannot be started because it is already running";
  +                throw new Exception( errmsg );
               }
  -        } else {
  -            String errmsg = "Listener name [" + name + "] cannot be started because of
unknown listener name";
  -            m_logger.warn(errmsg);
  +        } 
  +        else 
  +        {
  +            String errmsg = 
  +              "Listener name [" 
  +              + name 
  +              + "] cannot be started because of unknown listener name";
               throw new Exception(errmsg);
           }
       }
  @@ -445,13 +472,17 @@
        *
        * @param name the alias of the listener that has been defined in configuration file
        */
  -    public void stopListener(String name) throws Exception {
  -        if (m_listeners.containsKey(name)) {
  +    public void stopListener(String name) throws Exception 
  +    {
  +        if (m_listeners.containsKey(name)) 
  +        {
               HttpListener listener = (HttpListener) m_listeners.get(name);
   
               // listener must be started before we can stop it
  -            if (listener != null) {
  -                if (listener.isStarted()) {
  +            if (listener != null) 
  +            {
  +                if (listener.isStarted()) 
  +                {
                       listener.stop();
                       //httpServer.removeListener(listener);
                       m_listeners.put(name, null);
  @@ -467,27 +498,43 @@
        * overloaded method so that standard Jetty listeners will continue to be
        * loaded.
        */
  -    protected HttpListener loadListener(Configuration conf) throws Exception {
  +    protected HttpListener loadListener(Configuration conf) throws Exception 
  +    {
           HttpListener listener = null;
   
  -        String listenerType = conf.getAttribute(CFG_LISTENER_TYPE, CFG_LISTENER_TYPE_SOCKET);
  -        if (listenerType.equals(CFG_LISTENER_TYPE_AJP)) {
  +        String listenerType = 
  +          conf.getAttribute(CFG_LISTENER_TYPE, CFG_LISTENER_TYPE_SOCKET);
  +        if (listenerType.equals(CFG_LISTENER_TYPE_AJP)) 
  +        {
               listener = createAJP13Listener(conf);
               /* Need to set the correct default value here */
  -            listener.setPort(conf.getAttributeAsInteger(CFG_LISTENER_PORT, 2345));
  -            listener.setHost(conf.getAttribute(CFG_LISTENER_HOST, "0.0.0.0"));
  -        } else if (listenerType.equals(CFG_LISTENER_TYPE_JSSE)) {
  +            listener.setPort(
  +              conf.getAttributeAsInteger(CFG_LISTENER_PORT, 2345));
  +            listener.setHost(
  +              conf.getAttribute(CFG_LISTENER_HOST, "0.0.0.0"));
  +        }
  +        else if (listenerType.equals(CFG_LISTENER_TYPE_JSSE)) 
  +        {
               listener = createSunJsseListener(conf);
  -            listener.setPort(conf.getAttributeAsInteger(CFG_LISTENER_PORT, 8443));
  -            listener.setHost(conf.getAttribute(CFG_LISTENER_HOST, "0.0.0.0"));
  -        } else {
  +            listener.setPort(
  +              conf.getAttributeAsInteger(CFG_LISTENER_PORT, 8443));
  +            listener.setHost(
  +              conf.getAttribute(CFG_LISTENER_HOST, "0.0.0.0"));
  +        } 
  +        else 
  +        {
               listener = createSocketListener(conf);
  -            listener.setPort(conf.getAttributeAsInteger(CFG_LISTENER_PORT, 8080));
  -            listener.setHost(conf.getAttribute(CFG_LISTENER_HOST, "0.0.0.0"));
  +            listener.setPort(
  +              conf.getAttributeAsInteger(CFG_LISTENER_PORT, 8080));
  +            listener.setHost(
  +              conf.getAttribute(CFG_LISTENER_HOST, "0.0.0.0"));
           }
           m_httpServer.addListener(listener);
  -        m_logger.info("Loaded listener: " + listener.getClass().getName() +
  -                      " on " + listener.getHost() + ":" + listener.getPort());
  +        getLogger().info(
  +          "Loaded listener: " 
  +          + listener.getClass().getName() 
  +          + " on " + listener.getHost() 
  +          + ":" + listener.getPort());
           return listener;
       }
       
  @@ -496,31 +543,44 @@
        * invokes the <code>loadListener</code> method, which may be overloaded
in
        * a subclass in order to load custom Jetty listeners.
        */
  -    private void loadListeners() throws Exception {
  -        Configuration[] listeners = m_config.getChildren(CFG_LISTENER);
  -        for (int i = 0; i < listeners.length; i++) {
  +    private void loadListeners() throws Exception 
  +    {
  +        Configuration[] listeners = 
  +          m_config.getChildren(CFG_LISTENER);
  +        for (int i = 0; i < listeners.length; i++) 
  +        {
               Configuration conf = listeners[i];
               
               // Get the listener's alias
  -            String name = conf.getAttribute(CFG_LISTENER_NAME, null);
  +            String name = conf.getAttribute(
  +              CFG_LISTENER_NAME, null);
   
               // Add a NULL listener to our lookup table.
               if (name != null) m_listeners.put(name, null);
   
               // Do we auto-start this listener? defaults to true
  -            boolean isAutoStart = conf.getAttributeAsBoolean(CFG_LISTENER_AUTO, true);
  -            if (isAutoStart) {
  -                try {
  +            boolean isAutoStart = 
  +              conf.getAttributeAsBoolean(CFG_LISTENER_AUTO, true);
  +            if (isAutoStart) 
  +            {
  +                try 
  +                {
                       // load/start the listener
  -                    HttpListener listener = loadListener(conf);
  +                    HttpListener listener = loadListener( conf );
                       
                       // indicate the listener has been started
  -                    if (name != null) m_listeners.put(name, listener);
  -                } catch (Exception e) {
  -                    m_logger.error("Could not create listner", e);
  +                    if (name != null) m_listeners.put( name, listener );
  +                } 
  +                catch (Exception e) 
  +                {
  +                    getLogger().error(
  +                      "Could not create listner", e);
                   }
  -            } else {
  -                m_logger.error("Listener " + name + " will not be started");
  +            } 
  +            else 
  +            {
  +                getLogger().error(
  +                  "Listener " + name + " will not be started");
               }
           }
       }
  @@ -528,28 +588,41 @@
       /**
        * Loads all of the contexts defined in the component configuration
        */
  -    private void loadContexts() {
  +    private void loadContexts()
  +    {
           Configuration[] contexts = m_config.getChildren(CFG_CONTEXT);
           for (int i = 0; i < contexts.length; i++) {
               try {
                   Configuration conf = contexts[i];
                   HttpContext context = new HttpContext();
  -                context.setContextPath(conf.getAttribute(CFG_CONTEXT_PATH, "/*"));
  +                context.setContextPath( 
  +                  conf.getAttribute(CFG_CONTEXT_PATH, "/*"));
                   m_httpServer.addContext(context);
                   ServletHandler servletHandler = setSessionManager(context);
                   Configuration[] servlets = conf.getChildren(CFG_SERVLET);
  -                for (int j = 0; j < servlets.length; j++) {
  +                for (int j = 0; j < servlets.length; j++) 
  +                {
                       Configuration servletCfg = servlets[j];
                       servletHandler.addServlet(
  -                        servletCfg.getAttribute(CFG_SERVLET_NAME, servletCfg.getAttribute(CFG_SERVLET_CLASSNAME)),
  -                        servletCfg.getAttribute(CFG_SERVLET_PATH, "/servlets/*"),
  -                        servletCfg.getAttribute(CFG_SERVLET_CLASSNAME)
  -                        );
  +                        servletCfg.getAttribute(
  +                          CFG_SERVLET_NAME, 
  +                          servletCfg.getAttribute(
  +                            CFG_SERVLET_CLASSNAME)),
  +                        servletCfg.getAttribute(
  +                          CFG_SERVLET_PATH, 
  +                          "/servlets/*"),
  +                        servletCfg.getAttribute(
  +                          CFG_SERVLET_CLASSNAME ) );
                   }
  -                context.setResourceBase(m_basedir + "/" + conf.getAttribute(CFG_CONTEXT_NAME));
  -                context.addHandler(new ResourceHandler());
  -            } catch (Exception e) {
  -                m_logger.error("Could not construct context", e);
  +                context.setResourceBase(
  +                  m_basedir + "/" 
  +                  + conf.getAttribute(CFG_CONTEXT_NAME));
  +                context.addHandler(
  +                  new ResourceHandler() );
  +            } 
  +            catch( Exception e ) 
  +            {
  +                getLogger().error("Could not construct context", e);
               }
           }
       }
  @@ -557,13 +630,18 @@
       /**
        * Loads all the web application defined in the component configuration.
        */
  -    private void loadWebApplications() {
  -        Configuration[] confArr = m_config.getChildren(CFG_WEB_CONTEXT);
  -        for (int c = 0; c < confArr.length; c++) {
  +    private void loadWebApplications() 
  +    {
  +        Configuration[] confArr = 
  +          m_config.getChildren(CFG_WEB_CONTEXT);
  +        for (int c = 0; c < confArr.length; c++) 
  +        {
               Configuration conf = confArr[c];
               loadWebApplicationContext(
                   conf.getAttribute(CFG_CONTEXT_NAME, ""),
  -                new File(m_basedir, conf.getAttribute(CFG_CONTEXT_PATH, "")).toString()
  +                new File(
  +                  m_basedir, 
  +                  conf.getAttribute(CFG_CONTEXT_PATH, "")).toString()
                   );
           }
       }
  @@ -576,7 +654,8 @@
        * @return the created ServletHandler
        * @throws ServiceException
        */
  -    private ServletHandler setSessionManager(HttpContext context) throws ServiceException

  +    private ServletHandler setSessionManager( HttpContext context ) 
  +      throws ServiceException 
       {
           HttpHandler[] handlers = context.getHandlers();
           ServletHandler servletHandler = null;
  @@ -620,14 +699,17 @@
        * @param contextName The name to bind for the context (should not contain a leading
/ or trailing /*.
        * @param appURL The directory path to load as an application.
        */
  -    private void loadWebApplicationContext(String contextName, String appURL) {
  +    private void loadWebApplicationContext(String contextName, String appURL) 
  +    {
           WebApplicationContext wac;
  -        try {
  +        try 
  +        {
               wac = new WebApplicationContext(appURL);
               
               // Check to see if this is a WAR file, if so extract the WAR.
               File app = new File(appURL);
  -            if (app.isFile()) {
  +            if (app.isFile()) 
  +            {
                   String filename = app.getName();
                   int index = filename.lastIndexOf('.');
                   if (index != -1) {
  @@ -638,10 +720,15 @@
                   }
               }
               wac.setContextPath("/" + contextName + "/*");
  -            String clazzName = org.apache.avalon.merlin.http.SessionManager.class.getName();
  -            wac.getServletHandler().setSessionManager((SessionManager) m_serviceManager.lookup(clazzName));
  -        } catch (Exception e) {
  -            m_logger.error("Failed to load context: " + contextName);
  +            String clazzName = 
  +              org.apache.avalon.merlin.http.SessionManager.class.getName();
  +            wac.getServletHandler().setSessionManager(
  +              (SessionManager) m_serviceManager.lookup(clazzName) );
  +        }
  +        catch (Exception e) 
  +        {
  +            getLogger().error(
  +              "Failed to load context: " + contextName);
               return;
           }
           m_httpServer.addContext(wac);
  @@ -650,18 +737,26 @@
       /**
        * Creates a new AJP13 Listener
        */
  -    private HttpListener createAJP13Listener(Configuration config) {
  +    private HttpListener createAJP13Listener(Configuration config) 
  +    {
           AJP13Listener listener = new AJP13Listener();
  -        listener.setMaxIdleTimeMs(config.getAttributeAsInteger(CFG_LISTENER_TIMEOUT, 60000));
  +        listener.setMaxIdleTimeMs(
  +          config.getAttributeAsInteger( 
  +            CFG_LISTENER_TIMEOUT, 
  +            60000 ));
           return listener;
       }
           
       /**
        * Creates a new Socket Listener
        */
  -    private HttpListener createSocketListener(Configuration config) {
  +    private HttpListener createSocketListener(Configuration config) 
  +    {
           SocketListener listener = new SocketListener();
  -        listener.setMaxIdleTimeMs(config.getAttributeAsInteger(CFG_LISTENER_TIMEOUT, 60000));
  +        listener.setMaxIdleTimeMs(
  +          config.getAttributeAsInteger(
  +            CFG_LISTENER_TIMEOUT, 
  +            60000));
           return listener;
       }
   
  @@ -672,19 +767,33 @@
        * @return The newly created sun jsse listener
        * @throws Exception
        */
  -    private HttpListener createSunJsseListener(Configuration configuration) throws Exception
{
  +    private HttpListener createSunJsseListener(Configuration configuration) 
  +      throws Exception 
  +    {
           SunJsseListener listener = new SunJsseListener();
  -        listener.setMaxIdleTimeMs(configuration.getAttributeAsInteger(CFG_LISTENER_TIMEOUT,
60000));
  -        Configuration ksconfig = configuration.getChild("keystore");
  -        String fileName = ksconfig.getChild("file").getValue("conf/.keystore");
  -        File configuredFile = new File(fileName);
  -        if (!configuredFile.isAbsolute()) {
  -            listener.setKeystore(new File(m_basedir, fileName).getAbsolutePath());
  -        } else {
  -            listener.setKeystore(configuredFile.getAbsolutePath());
  +        listener.setMaxIdleTimeMs(
  +          configuration.getAttributeAsInteger(
  +            CFG_LISTENER_TIMEOUT, 
  +            60000));
  +        Configuration ksconfig = 
  +          configuration.getChild( "keystore" );
  +        String fileName = 
  +          ksconfig.getChild("file").getValue( "conf/.keystore" );
  +        File configuredFile = new File( fileName );
  +        if( !configuredFile.isAbsolute() )
  +        {
  +            listener.setKeystore(
  +              new File(m_basedir, fileName).getAbsolutePath());
  +        } 
  +        else 
  +        {
  +            listener.setKeystore(
  +              configuredFile.getAbsolutePath() );
           }
  -        listener.setPassword(ksconfig.getChild("password").getValue(null));
  -        listener.setKeyPassword(ksconfig.getChild("key-password").getValue(null));
  +        listener.setPassword(
  +          ksconfig.getChild("password").getValue(null) );
  +        listener.setKeyPassword(
  +          ksconfig.getChild("key-password").getValue(null) );
           return listener;
       }
   }
  
  
  

---------------------------------------------------------------------
To unsubscribe, e-mail: cvs-unsubscribe@avalon.apache.org
For additional commands, e-mail: cvs-help@avalon.apache.org


Mime
View raw message