proyal 2003/02/13 06:19:41
Modified: sevak/src/java/org/apache/avalon/apps/sevak/blocks/jetty
SevakWebApplicationHandler.java
SevakWebApplicationContext.java
Log:
* Add full apache license
* Reduce visiblity to package
* Add SevakContext support
Revision Changes Path
1.2 +65 -21
avalon-apps/sevak/src/java/org/apache/avalon/apps/sevak/blocks/jetty/SevakWebApplicationHandler.java
Index: SevakWebApplicationHandler.java
===================================================================
RCS file:
/home/cvs/avalon-apps/sevak/src/java/org/apache/avalon/apps/sevak/blocks/jetty/SevakWebApplicationHandler.java,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- SevakWebApplicationHandler.java 9 Jan 2003 07:42:49 -0000 1.1
+++ SevakWebApplicationHandler.java 13 Feb 2003 14:19:39 -0000 1.2
@@ -1,15 +1,58 @@
/*
- * Copyright (C) The Apache Software Foundation. All rights reserved.
- *
- * This software is published under the terms of the Apache Software License
- * version 1.1, a copy of which has been included with this distribution in
- * the LICENSE file.
- */
+
+ ============================================================================
+ The Apache Software License, Version 1.1
+ ============================================================================
+
+ Copyright (C) @year@ The Apache Software Foundation. All rights reserved.
+
+ Redistribution and use in source and binary forms, with or without modifica-
+ tion, are permitted provided that the following conditions are met:
+
+ 1. Redistributions of source code must retain the above copyright notice,
+ this list of conditions and the following disclaimer.
+
+ 2. Redistributions in binary form must reproduce the above copyright notice,
+ this list of conditions and the following disclaimer in the documentation
+ and/or other materials provided with the distribution.
+
+ 3. The end-user documentation included with the redistribution, if any, must
+ include the following acknowledgment: "This product includes software
+ developed by the Apache Software Foundation (http://www.apache.org/)."
+ Alternately, this acknowledgment may appear in the software itself, if
+ and wherever such third-party acknowledgments normally appear.
+
+ 4. The names "Jakarta", "Avalon", "Excalibur" and "Apache Software Foundation"
+ must not be used to endorse or promote products derived from this software
+ without prior written permission. For written permission, please contact
+ [EMAIL PROTECTED]
+
+ 5. Products derived from this software may not be called "Apache", nor may
+ "Apache" appear in their name, without prior written permission of the
+ Apache Software Foundation.
+
+ THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED WARRANTIES,
+ INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
+ FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+ APACHE SOFTWARE FOUNDATION OR ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
+ INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLU-
+ DING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+ OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
+ ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
+ THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+
+ This software consists of voluntary contributions made by many individuals
+ on behalf of the Apache Software Foundation. For more information on the
+ Apache Software Foundation, please see <http://www.apache.org/>.
+
+*/
package org.apache.avalon.apps.sevak.blocks.jetty;
-import org.mortbay.jetty.servlet.WebApplicationHandler;
+import org.apache.avalon.apps.sevak.SevakContext;
+
import org.mortbay.jetty.servlet.ServletHolder;
-import org.apache.avalon.framework.service.ServiceManager;
+import org.mortbay.jetty.servlet.WebApplicationHandler;
/**
*
@@ -21,26 +64,27 @@
* @author Paul Hammant
* @version 1.0
*/
-public class SevakWebApplicationHandler extends WebApplicationHandler {
+class SevakWebApplicationHandler extends WebApplicationHandler
+{
- ServiceManager m_serviceManager;
+ private SevakContext m_sevakContext;
- public SevakWebApplicationHandler(ServiceManager serviceManager)
+ public SevakWebApplicationHandler( SevakContext sevakContext )
{
- m_serviceManager = serviceManager;
+ m_sevakContext = sevakContext;
}
- public ServletHolder newServletHolder(String name, String servletClass, String
forcedPath)
+ public ServletHolder newServletHolder( String name, String servletClass, String
forcedPath )
{
- if(_nameMap.containsKey(name)) {
- throw new IllegalArgumentException("Named servlet already exists: " +
name);
- } else {
- ServletHolder holder = new SevakServletHolder(m_serviceManager, this,
name, servletClass, forcedPath);
- _nameMap.put(holder.getName(), holder);
+ if( _nameMap.containsKey( name ) )
+ {
+ throw new IllegalArgumentException( "Named servlet already exists: " +
name );
+ }
+ else
+ {
+ ServletHolder holder = new SevakServletHolder( m_sevakContext, this,
name, servletClass, forcedPath );
+ _nameMap.put( holder.getName(), holder );
return holder;
}
-
}
-
-
}
1.4 +65 -27
avalon-apps/sevak/src/java/org/apache/avalon/apps/sevak/blocks/jetty/SevakWebApplicationContext.java
Index: SevakWebApplicationContext.java
===================================================================
RCS file:
/home/cvs/avalon-apps/sevak/src/java/org/apache/avalon/apps/sevak/blocks/jetty/SevakWebApplicationContext.java,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -r1.3 -r1.4
--- SevakWebApplicationContext.java 10 Jan 2003 00:33:32 -0000 1.3
+++ SevakWebApplicationContext.java 13 Feb 2003 14:19:39 -0000 1.4
@@ -1,19 +1,60 @@
/*
- * Copyright (C) The Apache Software Foundation. All rights reserved.
- *
- * This software is published under the terms of the Apache Software License
- * version 1.1, a copy of which has been included with this distribution in
- * the LICENSE file.
- */
-package org.apache.avalon.apps.sevak.blocks.jetty;
-import org.mortbay.jetty.servlet.WebApplicationContext;
-import org.mortbay.jetty.servlet.ServletHandler;
-import org.mortbay.jetty.servlet.WebApplicationHandler;
-import org.apache.avalon.framework.service.ServiceManager;
+ ============================================================================
+ The Apache Software License, Version 1.1
+ ============================================================================
+
+ Copyright (C) @year@ The Apache Software Foundation. All rights reserved.
+
+ Redistribution and use in source and binary forms, with or without modifica-
+ tion, are permitted provided that the following conditions are met:
+
+ 1. Redistributions of source code must retain the above copyright notice,
+ this list of conditions and the following disclaimer.
+
+ 2. Redistributions in binary form must reproduce the above copyright notice,
+ this list of conditions and the following disclaimer in the documentation
+ and/or other materials provided with the distribution.
+
+ 3. The end-user documentation included with the redistribution, if any, must
+ include the following acknowledgment: "This product includes software
+ developed by the Apache Software Foundation (http://www.apache.org/)."
+ Alternately, this acknowledgment may appear in the software itself, if
+ and wherever such third-party acknowledgments normally appear.
+
+ 4. The names "Jakarta", "Avalon", "Excalibur" and "Apache Software Foundation"
+ must not be used to endorse or promote products derived from this software
+ without prior written permission. For written permission, please contact
+ [EMAIL PROTECTED]
+
+ 5. Products derived from this software may not be called "Apache", nor may
+ "Apache" appear in their name, without prior written permission of the
+ Apache Software Foundation.
+
+ THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED WARRANTIES,
+ INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
+ FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+ APACHE SOFTWARE FOUNDATION OR ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
+ INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLU-
+ DING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+ OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
+ ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
+ THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+
+ This software consists of voluntary contributions made by many individuals
+ on behalf of the Apache Software Foundation. For more information on the
+ Apache Software Foundation, please see <http://www.apache.org/>.
+
+*/
+package org.apache.avalon.apps.sevak.blocks.jetty;
-import java.io.IOException;
import java.io.File;
+import java.io.IOException;
+
+import org.apache.avalon.apps.sevak.SevakContext;
+
+import org.mortbay.jetty.servlet.WebApplicationContext;
/**
*
@@ -26,23 +67,21 @@
* @author Jules Gosnell
* @version 1.0
*/
-
-public class SevakWebApplicationContext extends WebApplicationContext
+class SevakWebApplicationContext extends WebApplicationContext
{
-
private File m_sarRoot;
private File m_phoenixLib;
- private ServiceManager m_serviceManager;
+ private SevakContext m_sevakContext;
- public SevakWebApplicationContext(ServiceManager serviceManager, File sarRoot,
String webAppURL) throws IOException
+ public SevakWebApplicationContext( SevakContext sevakContext, File sarRoot,
String webAppURL )
+ throws IOException
{
- super(webAppURL);
+ super( webAppURL );
m_sarRoot = sarRoot;
- m_phoenixLib = new File(sarRoot.getParentFile().getParentFile(),"lib");
- m_serviceManager = serviceManager;
-
- addHandler(0, new SevakWebApplicationHandler(m_serviceManager));
+ m_phoenixLib = new File( sarRoot.getParentFile().getParentFile(), "lib" );
+ m_sevakContext = sevakContext;
+ addHandler( 0, new SevakWebApplicationHandler( m_sevakContext ) );
}
/**
@@ -52,11 +91,10 @@
public String getFileClassPath()
{
String classpath = "";
- classpath += new File(m_sarRoot, "jsplibs" + File.separator +
"jasper-runtime.jar") + File.pathSeparator;
- classpath += new File(m_sarRoot, "jsplibs" + File.separator +
"jasper-compile.jar") + File.pathSeparator;
- classpath += new File(m_sarRoot, "jsplibs" + File.separator +
"javax.servlet.jar") + File.pathSeparator;
- classpath += new File(m_phoenixLib, "tools.jar");
+ classpath += new File( m_sarRoot, "jsplibs" + File.separator +
"jasper-runtime.jar" ) + File.pathSeparator;
+ classpath += new File( m_sarRoot, "jsplibs" + File.separator +
"jasper-compile.jar" ) + File.pathSeparator;
+ classpath += new File( m_sarRoot, "jsplibs" + File.separator +
"javax.servlet.jar" ) + File.pathSeparator;
+ classpath += new File( m_phoenixLib, "tools.jar" );
return classpath;
}
-
}
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]