You are viewing a plain text version of this content. The canonical link for it is here.
Posted to cactus-dev@jakarta.apache.org by vm...@apache.org on 2004/05/14 12:33:36 UTC
cvs commit: jakarta-cactus/framework/src/java/j2ee13/org/apache/cactus/internal/configuration DefaultFilterConfiguration.java FilterConfiguration.java
vmassol 2004/05/14 03:33:36
Modified: framework build.xml build.properties.sample
framework/src/java/share/org/apache/cactus/internal/configuration
ServletConfiguration.java JspConfiguration.java
framework/src/java/share/org/apache/cactus
ServletTestCase.java JspTestCase.java
framework/src/test/share/org/apache/cactus
TestNoNameTestCase.java TestWebRequest.java
framework/src/java/j2ee13/org/apache/cactus/extension/jetty
JettyTestSetup.java
documentation/docs/xdocs changes.xml
. build.properties.sample build.properties.vmassol
framework/src/test/share/org/apache/cactus/internal
AbstractTestAbstractCactusTestCase.java
framework/src/java/j2ee13/org/apache/cactus
FilterTestCase.java
framework/src/java/j2ee13/org/apache/cactus/internal/configuration
FilterConfiguration.java
Added: framework/src/java/share/org/apache/cactus/internal/configuration
DefaultJspConfiguration.java
DefaultServletConfiguration.java
framework/src/test/j2ee13/org/apache/cactus/extension/jetty
TestJettyTestSetup.java
framework/src/test/j2ee12/org/apache/cactus TestAll.java
framework/src/test/j2ee13/org/apache/cactus TestAll.java
framework/src/test/share/org/apache/cactus TestShareAll.java
framework/src/java/j2ee13/org/apache/cactus/internal/configuration
DefaultFilterConfiguration.java
Removed: framework/src/test/share/org/apache/cactus TestAll.java
Log:
- The <code>JettyTestSetup</code> class now checks if the Jetty server is already started and only starts it if it isn't running. It also does not stops it if it was running before <code>JettyTestSetup</code> was called. This is useful when you have a master test suite and when you also wish to run your tests one by one.
- Refactored ServletConfiguration/JspConfiguration/FilterConfiguration by transforming them into interfaces. This was required to be able to mock them and perform unit test of the modified JettyTestSetup
- Added Jetty.jar to the framework build (now required for the unit tests)
Revision Changes Path
1.84 +16 -3 jakarta-cactus/framework/build.xml
Index: build.xml
===================================================================
RCS file: /home/cvs/jakarta-cactus/framework/build.xml,v
retrieving revision 1.83
retrieving revision 1.84
diff -u -r1.83 -r1.84
--- build.xml 11 May 2004 19:25:14 -0000 1.83
+++ build.xml 14 May 2004 10:33:34 -0000 1.84
@@ -48,7 +48,9 @@
location="${src.java.dir}/j2ee${j2ee.api}"/>
<property name="src.test.dir" location="${src.dir}/test"/>
<property name="src.test.share.dir" location="${src.test.dir}/share"/>
- <property name="src.aspect.dir" location="${src.dir}/aspect"/>
+ <property name="src.test.specific.dir"
+ location="${src.test.dir}/j2ee${j2ee.api}"/>
+ <property name="src.aspect.dir" location="${src.dir}/aspect"/>
<property name="build.dir" location="${base.dir}/."/>
<property name="conf.dir" location="${base.dir}/conf"/>
<property name="web.dir" location="${base.dir}/web"/>
@@ -65,6 +67,9 @@
<property name="target.doc.dir" location="${target.dir}/doc"/>
<property name="target.doc.api.dir" location="${target.doc.dir}/api"/>
+ <!-- Ensure that there is always a default for the container port -->
+ <property name="cactus.port" value="8080"/>
+
</target>
<!--
@@ -100,13 +105,15 @@
<echo> j2ee.jar = [${j2ee.jar}]</echo>
<echo> junit.jar = [${junit.jar}]</echo>
<echo> mockobjects.jar = [${mockobjects.jar}]</echo>
+ <echo> jetty.jar = [${jetty.jar}]</echo>
<echo> log4j.jar (optional) = [${log4j.jar}]</echo>
<echo> xmlapis.jar (optional) = [${xmlapis.jar}]</echo>
<echo/>
<echo>Options:</echo>
<echo> clover.enable = ${clover.enable}</echo>
<echo> clover.jar = [${clover.jar}]</echo>
-
+ <echo> cactus.port = [${cactus.port}]</echo>
+
<path id="project.classpath">
<pathelement location="${aspectjrt.jar}"/>
<pathelement location="${commons.logging.jar}"/>
@@ -126,6 +133,7 @@
<available file="${j2ee.jar}"/>
<available file="${junit.jar}"/>
<available file="${mockobjects.jar}"/>
+ <available file="${jetty.jar}"/>
<!-- Check for a TraX class instead of the xmlapis.jar file so that
the build works on JDK 1.4 without needing to define the
xmlapis.jar property -->
@@ -210,10 +218,12 @@
debug="${debug}" deprecation="${deprecation}"
optimize="${optimize}">
<src path="${src.test.share.dir}"/>
+ <src path="${src.test.specific.dir}"/>
<classpath>
<path path="${target.classes.java.dir}"/>
<path refid="project.classpath"/>
<pathelement location="${mockobjects.jar}"/>
+ <pathelement location="${jetty.jar}"/>
</classpath>
</javac>
@@ -408,6 +418,7 @@
<pathelement location="${clover.jar}"/>
<pathelement location="${log4j.jar}"/>
<pathelement location="${mockobjects.jar}"/>
+ <pathelement location="${jetty.jar}"/>
<path refid="project.classpath"/>
</path>
@@ -421,6 +432,7 @@
<pathelement path="${target.classes.test.dir}"/>
<pathelement location="${log4j.jar}"/>
<pathelement location="${mockobjects.jar}"/>
+ <pathelement location="${jetty.jar}"/>
<path refid="project.classpath"/>
</path>
@@ -453,6 +465,7 @@
<junit printsummary="yes" haltonfailure="yes" fork="yes">
<sysproperty key="cactus.logging.config"
value="${target.dir.normalized}/logging.properties"/>
+ <sysproperty key="cactus.port" value="${cactus.port}"/>
<classpath>
<path refid="test.class.path"/>
</classpath>
1.38 +5 -1 jakarta-cactus/framework/build.properties.sample
Index: build.properties.sample
===================================================================
RCS file: /home/cvs/jakarta-cactus/framework/build.properties.sample,v
retrieving revision 1.37
retrieving revision 1.38
diff -u -r1.37 -r1.38
--- build.properties.sample 11 May 2004 19:25:14 -0000 1.37
+++ build.properties.sample 14 May 2004 10:33:35 -0000 1.38
@@ -42,6 +42,10 @@
# The location of the MockObjects jar (needed for our unit tests)
mockobjects.jar = ${lib.repo}/mockobjects/jars/mockobjects-core-0.09.jar
+# The location of the Jetty jar (used for compiling and running the unit tests
+# only)
+jetty.jar = ${lib.repo}/jetty/jars/org.mortbay.jetty-4.2.11.jar
+
# -----------------------------------------------------------------------------
# Optional properties
# -----------------------------------------------------------------------------
1.2 +3 -29 jakarta-cactus/framework/src/java/share/org/apache/cactus/internal/configuration/ServletConfiguration.java
Index: ServletConfiguration.java
===================================================================
RCS file: /home/cvs/jakarta-cactus/framework/src/java/share/org/apache/cactus/internal/configuration/ServletConfiguration.java,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- ServletConfiguration.java 10 Apr 2004 14:59:59 -0000 1.1
+++ ServletConfiguration.java 14 May 2004 10:33:35 -0000 1.2
@@ -1,7 +1,7 @@
/*
* ========================================================================
*
- * Copyright 2001-2004 The Apache Software Foundation.
+ * Copyright 2004 The Apache Software Foundation.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -19,38 +19,12 @@
*/
package org.apache.cactus.internal.configuration;
-
/**
* Provides access to the Cactus configuration parameters related to the
* Servlet Redirector.
*
* @version $Id$
- *
- * @see Configuration
*/
-public class ServletConfiguration extends AbstractWebConfiguration
+public interface ServletConfiguration extends WebConfiguration
{
- /**
- * Name of the cactus property that specifies the name of the Servlet
- * redirector.
- */
- public static final String CACTUS_SERVLET_REDIRECTOR_NAME_PROPERTY =
- "cactus.servletRedirectorName";
-
- /**
- * @see WebConfiguration#getDefaultRedirectorName()
- */
- public String getDefaultRedirectorName()
- {
- String redirectorName =
- System.getProperty(CACTUS_SERVLET_REDIRECTOR_NAME_PROPERTY);
-
- if (redirectorName == null)
- {
- redirectorName = "ServletRedirector";
- }
-
- return redirectorName;
- }
-
}
1.2 +3 -27 jakarta-cactus/framework/src/java/share/org/apache/cactus/internal/configuration/JspConfiguration.java
Index: JspConfiguration.java
===================================================================
RCS file: /home/cvs/jakarta-cactus/framework/src/java/share/org/apache/cactus/internal/configuration/JspConfiguration.java,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- JspConfiguration.java 10 Apr 2004 14:59:59 -0000 1.1
+++ JspConfiguration.java 14 May 2004 10:33:35 -0000 1.2
@@ -1,7 +1,7 @@
/*
* ========================================================================
*
- * Copyright 2001-2004 The Apache Software Foundation.
+ * Copyright 2004 The Apache Software Foundation.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -19,36 +19,12 @@
*/
package org.apache.cactus.internal.configuration;
-
/**
* Provides access to the Cactus configuration parameters related to the
* JSP Redirector.
*
* @version $Id$
*/
-public class JspConfiguration extends AbstractWebConfiguration
+public interface JspConfiguration extends WebConfiguration
{
- /**
- * Name of the cactus property that specifies the name of the JSP
- * redirector.
- */
- public static final String CACTUS_JSP_REDIRECTOR_NAME_PROPERTY =
- "cactus.jspRedirectorName";
-
- /**
- * @see WebConfiguration#getDefaultRedirectorName()
- */
- public String getDefaultRedirectorName()
- {
- String redirectorName =
- System.getProperty(CACTUS_JSP_REDIRECTOR_NAME_PROPERTY);
-
- if (redirectorName == null)
- {
- redirectorName = "JspRedirector";
- }
-
- return redirectorName;
- }
-
}
1.1 jakarta-cactus/framework/src/java/share/org/apache/cactus/internal/configuration/DefaultJspConfiguration.java
Index: DefaultJspConfiguration.java
===================================================================
/*
* ========================================================================
*
* Copyright 2001-2004 The Apache Software Foundation.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
* ========================================================================
*/
package org.apache.cactus.internal.configuration;
/**
* Provides access to the Cactus configuration parameters related to the
* JSP Redirector.
*
* @version $Id: DefaultJspConfiguration.java,v 1.1 2004/05/14 10:33:35 vmassol Exp $
*/
public class DefaultJspConfiguration
extends AbstractWebConfiguration implements JspConfiguration
{
/**
* Name of the cactus property that specifies the name of the JSP
* redirector.
*/
public static final String CACTUS_JSP_REDIRECTOR_NAME_PROPERTY =
"cactus.jspRedirectorName";
/**
* @see WebConfiguration#getDefaultRedirectorName()
*/
public String getDefaultRedirectorName()
{
String redirectorName =
System.getProperty(CACTUS_JSP_REDIRECTOR_NAME_PROPERTY);
if (redirectorName == null)
{
redirectorName = "JspRedirector";
}
return redirectorName;
}
}
1.1 jakarta-cactus/framework/src/java/share/org/apache/cactus/internal/configuration/DefaultServletConfiguration.java
Index: DefaultServletConfiguration.java
===================================================================
/*
* ========================================================================
*
* Copyright 2001-2004 The Apache Software Foundation.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
* ========================================================================
*/
package org.apache.cactus.internal.configuration;
/**
* Provides access to the Cactus configuration parameters related to the
* Servlet Redirector.
*
* @version $Id: DefaultServletConfiguration.java,v 1.1 2004/05/14 10:33:35 vmassol Exp $
*/
public class DefaultServletConfiguration
extends AbstractWebConfiguration implements ServletConfiguration
{
/**
* Name of the cactus property that specifies the name of the Servlet
* redirector.
*/
public static final String CACTUS_SERVLET_REDIRECTOR_NAME_PROPERTY =
"cactus.servletRedirectorName";
/**
* @see WebConfiguration#getDefaultRedirectorName()
*/
public String getDefaultRedirectorName()
{
String redirectorName =
System.getProperty(CACTUS_SERVLET_REDIRECTOR_NAME_PROPERTY);
if (redirectorName == null)
{
redirectorName = "ServletRedirector";
}
return redirectorName;
}
}
1.1 jakarta-cactus/framework/src/test/j2ee13/org/apache/cactus/extension/jetty/TestJettyTestSetup.java
Index: TestJettyTestSetup.java
===================================================================
/*
* ========================================================================
*
* Copyright 2004 The Apache Software Foundation.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
* ========================================================================
*/
package org.apache.cactus.extension.jetty;
import java.net.URL;
import org.apache.cactus.internal.configuration.Configuration;
import org.apache.cactus.internal.configuration.FilterConfiguration;
import org.apache.cactus.internal.configuration.ServletConfiguration;
import com.mockobjects.dynamic.Mock;
import junit.framework.TestCase;
/**
* Unit tests of the {@link JettyTestSetup} class.
*
* Note: For this test to work, it must be passed the <code>cactus.port</code>
* system property. If not it will default to 8080.
*
* @version $Id: TestJettyTestSetup.java,v 1.1 2004/05/14 10:33:35 vmassol Exp $
*/
public class TestJettyTestSetup extends TestCase
{
/**
* Control mock for {@link Configuration}.
*/
private Mock mockConfiguration;
/**
* Mock for {@link Configuration}.
*/
private Configuration configuration;
/**
* Control mock for {@link ServletConfiguration}.
*/
private Mock mockServletConfiguration;
/**
* Mock for {@link ServletConfiguration}.
*/
private ServletConfiguration servletConfiguration;
/**
* Control mock for {@link FilterConfiguration}.
*/
private Mock mockFilterConfiguration;
/**
* Mock for {@link FilterConfiguration}.
*/
private FilterConfiguration filterConfiguration;
/**
* URL pointing to the test context. Note that if the port is not
* passed as a system property it defaults to 8080.
*/
private static final String CONTEXT_URL =
"http://localhost:" + System.getProperty("cactus.port", "8080");
/**
* Object to unit test.
*/
private JettyTestSetup jettyTestSetup;
/**
* Fake test case object used only to construct an instance of
* {@link JettyTestSetup}.
*/
public class SampleTestCase extends TestCase
{
}
/**
* @see TestCase#setUp()
*/
protected void setUp() throws Exception
{
mockConfiguration = new Mock(Configuration.class);
configuration = (Configuration) mockConfiguration.proxy();
mockServletConfiguration = new Mock(ServletConfiguration.class);
servletConfiguration =
(ServletConfiguration) mockServletConfiguration.proxy();
mockFilterConfiguration = new Mock(FilterConfiguration.class);
filterConfiguration =
(FilterConfiguration) mockFilterConfiguration.proxy();
mockConfiguration.matchAndReturn("getContextURL", CONTEXT_URL);
mockServletConfiguration.matchAndReturn("getDefaultRedirectorName",
"ServletRedirector");
URL testURL = new URL(CONTEXT_URL + "/"
+ servletConfiguration.getDefaultRedirectorName());
mockServletConfiguration.matchAndReturn("getDefaultRedirectorURL",
testURL.getPath());
jettyTestSetup = new JettyTestSetup(new SampleTestCase(),
configuration, servletConfiguration, filterConfiguration);
// Ensure that the Jetty server is not already started.
if (jettyTestSetup.isAvailable(
jettyTestSetup.testConnectivity(testURL)))
{
fail("No server serving the [" + testURL.getPath()
+ "] URL should be started.");
}
}
/**
* @see TestCase#tearDown()
*/
protected void tearDown() throws Exception
{
// Ensure that the server is stopped after each test
jettyTestSetup.tearDown();
mockConfiguration.verify();
mockServletConfiguration.verify();
mockFilterConfiguration.verify();
}
/**
* Verify that calling the {@link JettyTestSetup#setUp()} method
* works when Jetty is not already started.
*
* @throws Exception in case of error
*/
public void testSetUpWhenServerNotAlreadyStarted() throws Exception
{
jettyTestSetup.setUp();
assertTrue(jettyTestSetup.isRunning());
}
/**
* Verify that calling the {@link JettyTestSetup#setUp()} method
* does not start Jetty a second time if Jetty is already started.
*
* @throws Exception in case of error
*/
public void testSetUpWhenServerIsAlreadyStarted() throws Exception
{
jettyTestSetup.setUp();
// If we succeed calling a second time setUp(), it means that it's
// not starting the container again as otherwise it would fail to
// bind to an already bound port.
jettyTestSetup.setUp();
// Ensure that tearDown will shutdown the container
jettyTestSetup.setForceShutdown(true);
}
}
1.1 jakarta-cactus/framework/src/test/j2ee12/org/apache/cactus/TestAll.java
Index: TestAll.java
===================================================================
/*
* ========================================================================
*
* Copyright 2004 The Apache Software Foundation.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
* ========================================================================
*/
package org.apache.cactus;
import junit.framework.Test;
import junit.framework.TestSuite;
/**
* Run all the Cactus unit tests related to J2EE API 1.2.
*
* @version $Id: TestAll.java,v 1.1 2004/05/14 10:33:35 vmassol Exp $
*/
public class TestAll
{
/**
* @return a test suite (<code>TestSuite</code>) that includes all methods
* starting with "test"
* @exception Exception on failure to load the cactus properties file
*/
public static Test suite() throws Exception
{
TestSuite suite = new TestSuite(
"Cactus unit tests for J2EE 1.2");
// Add shared tests
suite.addTest(TestShareAll.suite());
return suite;
}
}
1.1 jakarta-cactus/framework/src/test/j2ee13/org/apache/cactus/TestAll.java
Index: TestAll.java
===================================================================
/*
* ========================================================================
*
* Copyright 2004 The Apache Software Foundation.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
* ========================================================================
*/
package org.apache.cactus;
import org.apache.cactus.extension.jetty.TestJettyTestSetup;
import junit.framework.Test;
import junit.framework.TestSuite;
/**
* Run all the Cactus unit tests related to J2EE API 1.3.
*
* @version $Id: TestAll.java,v 1.1 2004/05/14 10:33:35 vmassol Exp $
*/
public class TestAll
{
/**
* @return a test suite (<code>TestSuite</code>) that includes all methods
* starting with "test"
* @exception Exception on failure to load the cactus properties file
*/
public static Test suite() throws Exception
{
TestSuite suite = new TestSuite(
"Cactus unit tests for J2EE 1.3");
// Add shared tests
suite.addTest(TestShareAll.suite());
// Add tests specific to the J2EE 1.3 API
suite.addTestSuite(TestJettyTestSetup.class);
return suite;
}
}
1.27 +3 -3 jakarta-cactus/framework/src/java/share/org/apache/cactus/ServletTestCase.java
Index: ServletTestCase.java
===================================================================
RCS file: /home/cvs/jakarta-cactus/framework/src/java/share/org/apache/cactus/ServletTestCase.java,v
retrieving revision 1.26
retrieving revision 1.27
diff -u -r1.26 -r1.27
--- ServletTestCase.java 10 Apr 2004 14:59:59 -0000 1.26
+++ ServletTestCase.java 14 May 2004 10:33:35 -0000 1.27
@@ -27,7 +27,7 @@
import org.apache.cactus.internal.AbstractCactusTestCase;
import org.apache.cactus.internal.CactusTestCase;
import org.apache.cactus.internal.client.connector.http.HttpProtocolHandler;
-import org.apache.cactus.internal.configuration.ServletConfiguration;
+import org.apache.cactus.internal.configuration.DefaultServletConfiguration;
import org.apache.cactus.server.ServletConfigWrapper;
import org.apache.cactus.spi.client.connector.ProtocolHandler;
@@ -106,6 +106,6 @@
*/
protected ProtocolHandler createProtocolHandler()
{
- return new HttpProtocolHandler(new ServletConfiguration());
+ return new HttpProtocolHandler(new DefaultServletConfiguration());
}
}
1.23 +3 -3 jakarta-cactus/framework/src/java/share/org/apache/cactus/JspTestCase.java
Index: JspTestCase.java
===================================================================
RCS file: /home/cvs/jakarta-cactus/framework/src/java/share/org/apache/cactus/JspTestCase.java,v
retrieving revision 1.22
retrieving revision 1.23
diff -u -r1.22 -r1.23
--- JspTestCase.java 10 Apr 2004 14:59:59 -0000 1.22
+++ JspTestCase.java 14 May 2004 10:33:35 -0000 1.23
@@ -24,7 +24,7 @@
import junit.framework.Test;
import org.apache.cactus.internal.client.connector.http.HttpProtocolHandler;
-import org.apache.cactus.internal.configuration.JspConfiguration;
+import org.apache.cactus.internal.configuration.DefaultJspConfiguration;
import org.apache.cactus.server.PageContextWrapper;
import org.apache.cactus.spi.client.connector.ProtocolHandler;
@@ -84,6 +84,6 @@
*/
protected ProtocolHandler createProtocolHandler()
{
- return new HttpProtocolHandler(new JspConfiguration());
+ return new HttpProtocolHandler(new DefaultJspConfiguration());
}
}
1.6 +3 -3 jakarta-cactus/framework/src/test/share/org/apache/cactus/TestNoNameTestCase.java
Index: TestNoNameTestCase.java
===================================================================
RCS file: /home/cvs/jakarta-cactus/framework/src/test/share/org/apache/cactus/TestNoNameTestCase.java,v
retrieving revision 1.5
retrieving revision 1.6
diff -u -r1.5 -r1.6
--- TestNoNameTestCase.java 10 Apr 2004 15:52:16 -0000 1.5
+++ TestNoNameTestCase.java 14 May 2004 10:33:35 -0000 1.6
@@ -23,7 +23,7 @@
import org.apache.cactus.internal.AbstractCactusTestCase;
import org.apache.cactus.internal.client.connector.http.HttpProtocolHandler;
import org.apache.cactus.internal.configuration.BaseConfiguration;
-import org.apache.cactus.internal.configuration.ServletConfiguration;
+import org.apache.cactus.internal.configuration.DefaultServletConfiguration;
import org.apache.cactus.internal.util.TestCaseImplementError;
import org.apache.cactus.spi.client.connector.ProtocolHandler;
@@ -69,7 +69,7 @@
*/
protected ProtocolHandler createProtocolHandler()
{
- return new HttpProtocolHandler(new ServletConfiguration());
+ return new HttpProtocolHandler(new DefaultServletConfiguration());
}
/**
1.22 +15 -24 jakarta-cactus/framework/src/test/share/org/apache/cactus/TestWebRequest.java
Index: TestWebRequest.java
===================================================================
RCS file: /home/cvs/jakarta-cactus/framework/src/test/share/org/apache/cactus/TestWebRequest.java,v
retrieving revision 1.21
retrieving revision 1.22
diff -u -r1.21 -r1.22
--- TestWebRequest.java 10 Apr 2004 14:59:59 -0000 1.21
+++ TestWebRequest.java 14 May 2004 10:33:35 -0000 1.22
@@ -24,7 +24,7 @@
import junit.framework.TestCase;
import org.apache.cactus.internal.WebRequestImpl;
-import org.apache.cactus.internal.configuration.ServletConfiguration;
+import org.apache.cactus.internal.configuration.DefaultServletConfiguration;
import org.apache.cactus.util.ChainedRuntimeException;
/**
@@ -35,13 +35,24 @@
public class TestWebRequest extends TestCase
{
/**
+ * Object to unit test.
+ */
+ private WebRequest request;
+
+ /**
+ * @see TestCase#setUp()
+ */
+ protected void setUp()
+ {
+ request = new WebRequestImpl(new DefaultServletConfiguration());
+ }
+
+ /**
* Verify that an exception is thrown when an invalid HTTP METHOD is used
* when adding an HTTP parameter.
*/
public void testAddParameterInvalidMethod()
{
- WebRequest request = new WebRequestImpl(new ServletConfiguration());
-
try
{
request.addParameter("param1", "value1", "INVALIDMETHOD");
@@ -60,8 +71,6 @@
*/
public void testGetParametersGetOk()
{
- WebRequest request = new WebRequestImpl(new ServletConfiguration());
-
request.addParameter("param1", "value1", WebRequest.GET_METHOD);
request.addParameter("param1", "value2", WebRequest.GET_METHOD);
@@ -76,8 +85,6 @@
*/
public void testGetParameterGetNull()
{
- WebRequest request = new WebRequestImpl(new ServletConfiguration());
-
request.addParameter("param1", "value1", WebRequest.POST_METHOD);
String result = request.getParameterGet("param1");
@@ -91,8 +98,6 @@
*/
public void testGetParametersPostOk()
{
- WebRequest request = new WebRequestImpl(new ServletConfiguration());
-
request.addParameter("param1", "value1", WebRequest.POST_METHOD);
request.addParameter("param1", "value2", WebRequest.POST_METHOD);
@@ -107,8 +112,6 @@
*/
public void testGetParameterPostNull()
{
- WebRequest request = new WebRequestImpl(new ServletConfiguration());
-
request.addParameter("param1", "value1", WebRequest.GET_METHOD);
String result = request.getParameterPost("param1");
@@ -122,8 +125,6 @@
*/
public void testGetHeaderOk()
{
- WebRequest request = new WebRequestImpl(new ServletConfiguration());
-
request.addHeader("header1", "value1");
request.addHeader("header2", "value2");
@@ -138,8 +139,6 @@
*/
public void testGetHeaderNull()
{
- WebRequest request = new WebRequestImpl(new ServletConfiguration());
-
String result = request.getHeader("header1");
assertNull(result);
@@ -151,8 +150,6 @@
*/
public void testToString()
{
- WebRequest request = new WebRequestImpl(new ServletConfiguration());
-
request.addHeader("header1", "value1");
request.addHeader("header1", "value2");
request.addParameter("param1", "value1", WebRequest.GET_METHOD);
@@ -183,8 +180,6 @@
*/
public void testSetURLBadQueryString()
{
- WebRequest request = new WebRequestImpl(new ServletConfiguration());
-
try
{
request.setURL("jakarta.apache.org:80", "/catalog", "/garden",
@@ -203,8 +198,6 @@
*/
public void testGetPostParametersSeveral()
{
- WebRequest request = new WebRequestImpl(new ServletConfiguration());
-
request.addParameter("param1", "value1", WebRequest.POST_METHOD);
request.addParameter("param2", "value2", WebRequest.POST_METHOD);
request.addParameter("param3", "value3", WebRequest.POST_METHOD);
@@ -225,6 +218,4 @@
}
}
}
-
-
}
1.1 jakarta-cactus/framework/src/test/share/org/apache/cactus/TestShareAll.java
Index: TestShareAll.java
===================================================================
/*
* ========================================================================
*
* Copyright 2001-2004 The Apache Software Foundation.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
* ========================================================================
*/
package org.apache.cactus;
import org.apache.cactus.internal.TestAbstractCactusTestCase;
import org.apache.cactus.internal.TestWebTestResult;
import org.apache.cactus.internal.client.TestWebTestResultParser;
import org.apache.cactus.internal.configuration.ConfigurationInitializer;
import org.apache.cactus.internal.server.TestServletUtil;
import org.apache.cactus.internal.server.runner.TestXMLFormatter;
import org.apache.cactus.internal.util.TestCookieUtil;
import org.apache.cactus.internal.util.TestIoUtil;
import org.apache.cactus.internal.util.TestStringUtil;
import org.apache.cactus.internal.util.TestTestCaseImplementChecker;
import org.apache.cactus.internal.util.TestUniqueGenerator;
import org.apache.cactus.server.runner.TestServletTestRunner;
import junit.framework.Test;
import junit.framework.TestSuite;
/**
* Run all the unit tests of Cactus that do not need a servlet
* environment to run. These other tests will be exercised in the sample
* application.
*
* @version $Id: TestShareAll.java,v 1.1 2004/05/14 10:33:35 vmassol Exp $
*/
public class TestShareAll
{
/**
* @return a test suite (<code>TestSuite</code>) that includes all shared
* tests
* @exception Exception on failure to load the cactus properties file
*/
public static Test suite() throws Exception
{
TestSuite suite = new TestSuite(
"Cactus unit tests for all J2EE APIs");
// Make sure logging configuration properties are initialized so
// that it is possible to control logging from the outside of the
// tests.
ConfigurationInitializer.initialize();
suite.addTestSuite(TestNoNameTestCase.class);
suite.addTestSuite(TestServletURL.class);
suite.addTestSuite(TestWebRequest.class);
suite.addTestSuite(TestAbstractCactusTestCase.class);
suite.addTestSuite(TestWebTestResult.class);
suite.addTestSuite(TestWebTestResultParser.class);
suite.addTestSuite(TestServletUtil.class);
suite.addTestSuite(TestXMLFormatter.class);
suite.addTestSuite(TestCookieUtil.class);
suite.addTestSuite(TestIoUtil.class);
suite.addTestSuite(TestStringUtil.class);
suite.addTestSuite(TestTestCaseImplementChecker.class);
suite.addTestSuite(TestUniqueGenerator.class);
suite.addTestSuite(TestServletTestRunner.class);
return suite;
}
}
1.10 +180 -10 jakarta-cactus/framework/src/java/j2ee13/org/apache/cactus/extension/jetty/JettyTestSetup.java
Index: JettyTestSetup.java
===================================================================
RCS file: /home/cvs/jakarta-cactus/framework/src/java/j2ee13/org/apache/cactus/extension/jetty/JettyTestSetup.java,v
retrieving revision 1.9
retrieving revision 1.10
diff -u -r1.9 -r1.10
--- JettyTestSetup.java 10 Apr 2004 15:52:16 -0000 1.9
+++ JettyTestSetup.java 14 May 2004 10:33:35 -0000 1.10
@@ -20,6 +20,9 @@
package org.apache.cactus.extension.jetty;
import java.io.File;
+import java.io.IOException;
+import java.io.InputStream;
+import java.net.HttpURLConnection;
import java.net.URL;
import junit.extensions.TestSetup;
@@ -29,6 +32,8 @@
import org.apache.cactus.internal.configuration.BaseConfiguration;
import org.apache.cactus.internal.configuration.Configuration;
+import org.apache.cactus.internal.configuration.DefaultFilterConfiguration;
+import org.apache.cactus.internal.configuration.DefaultServletConfiguration;
import org.apache.cactus.internal.configuration.FilterConfiguration;
import org.apache.cactus.internal.configuration.ServletConfiguration;
import org.apache.cactus.internal.util.ClassLoaderUtils;
@@ -80,14 +85,68 @@
private Object server;
/**
+ * Whether the container had already been running before.
+ */
+ private boolean alreadyRunning;
+
+ /**
+ * Whether the container is running or not.
+ */
+ private boolean isRunning = false;
+
+ /**
+ * Whether the container should be stopped on tearDown even though
+ * it was not started by us.
+ */
+ private boolean forceShutdown = false;
+
+ /**
+ * The Servlet configuration object used to configure Jetty.
+ */
+ private ServletConfiguration servletConfiguration;
+
+ /**
+ * The Filter configuration object used to configure Jetty.
+ */
+ private FilterConfiguration filterConfiguration;
+
+ /**
+ * The base configuration object used to configure Jetty.
+ */
+ private Configuration baseConfiguration;
+
+ /**
* @param theTest the test we are decorating (usually a test suite)
*/
public JettyTestSetup(Test theTest)
{
super(theTest);
+ this.baseConfiguration = new BaseConfiguration();
+ this.servletConfiguration = new DefaultServletConfiguration();
+ this.filterConfiguration = new DefaultFilterConfiguration();
}
/**
+ * @param theTest the test we are decorating (usually a test suite)
+ * @param theBaseConfiguration the base configuration object used to
+ * configure Jetty
+ * @param theServletConfiguration the servlet configuration object used
+ * to configure Jetty
+ * @param theFilterConfiguration the filter configuration object used
+ * to configure Jetty
+ */
+ public JettyTestSetup(Test theTest,
+ Configuration theBaseConfiguration,
+ ServletConfiguration theServletConfiguration,
+ FilterConfiguration theFilterConfiguration)
+ {
+ this(theTest);
+ this.baseConfiguration = theBaseConfiguration;
+ this.servletConfiguration = theServletConfiguration;
+ this.filterConfiguration = theFilterConfiguration;
+ }
+
+ /**
* Make sure that {@link #tearDown} is called if {@link #setUp} fails
* to start the container properly. The default
* {@link TestSetup#run(TestResult)} method does not provide this feature
@@ -125,6 +184,20 @@
*/
protected void setUp() throws Exception
{
+ // Try connecting in case the server is already running. If so, does
+ // nothing
+ URL contextURL = new URL(this.baseConfiguration.getContextURL()
+ + "/" + this.servletConfiguration.getDefaultRedirectorName()
+ + "?Cactus_Service=RUN_TEST");
+ this.alreadyRunning = isAvailable(testConnectivity(contextURL));
+ if (this.alreadyRunning)
+ {
+ // Server is already running. Record this information so that we
+ // don't stop it afterwards.
+ this.isRunning = true;
+ return;
+ }
+
// Note: We are currently using reflection in order not to need Jetty
// to compile Cactus. If the code becomes more complex or we need to
// add other initializer, it will be worth considering moving them
@@ -132,25 +205,20 @@
// in its classpath (using the same mechanism as the Ant project is
// using to conditionally compile tasks).
- // Create configuration objects
- BaseConfiguration baseConfig = new BaseConfiguration();
- ServletConfiguration servletConfig = new ServletConfiguration();
- FilterConfiguration filterConfig = new FilterConfiguration();
-
// Create a Jetty Server object and configure a listener
- this.server = createServer(baseConfig);
+ this.server = createServer(this.baseConfiguration);
// Create a Jetty context.
- Object context = createContext(this.server, baseConfig);
+ Object context = createContext(this.server, this.baseConfiguration);
// Add the Cactus Servlet redirector
- addServletRedirector(context, servletConfig);
+ addServletRedirector(context, this.servletConfiguration);
// Add the Cactus Jsp redirector
addJspRedirector(context);
// Add the Cactus Filter redirector
- addFilterRedirector(context, filterConfig);
+ addFilterRedirector(context, this.filterConfiguration);
// Configure Jetty with an XML file if one has been specified on the
// command line.
@@ -164,6 +232,8 @@
// Start the Jetty server
this.server.getClass().getMethod("start", null).invoke(
this.server, null);
+
+ this.isRunning = true;
}
/**
@@ -173,6 +243,12 @@
*/
protected void tearDown() throws Exception
{
+ // Don't shut down a container that has not been started by us
+ if (!this.forceShutdown && this.alreadyRunning)
+ {
+ return;
+ }
+
if (this.server != null)
{
// First, verify if the server is running
@@ -186,6 +262,8 @@
this.server, null);
}
}
+
+ this.isRunning = false;
}
/**
@@ -210,6 +288,15 @@
}
/**
+ * @param isForcedShutdown if true the container will be stopped even
+ * if it has not been started by us
+ */
+ public final void setForceShutdown(boolean isForcedShutdown)
+ {
+ this.forceShutdown = isForcedShutdown;
+ }
+
+ /**
* @return The resource directory, or <code>null</code> if it has not been
* set
*/
@@ -406,4 +493,87 @@
}
}
+ /**
+ * Tests whether we are able to connect to the HTTP server identified by the
+ * specified URL.
+ *
+ * @param theUrl The URL to check
+ * @return the HTTP response code or -1 if no connection could be
+ * established
+ */
+ protected int testConnectivity(URL theUrl)
+ {
+ int code;
+ try
+ {
+ HttpURLConnection connection =
+ (HttpURLConnection) theUrl.openConnection();
+ connection.setRequestProperty("Connection", "close");
+ connection.connect();
+ readFully(connection);
+ connection.disconnect();
+ code = connection.getResponseCode();
+ }
+ catch (IOException e)
+ {
+ code = -1;
+ }
+ return code;
+ }
+
+ /**
+ * Tests whether an HTTP return code corresponds to a valid connection
+ * to the test URL or not. Success is 200 up to but excluding 300.
+ *
+ * @param theCode the HTTP response code to verify
+ * @return <code>true</code> if the test URL could be called without error,
+ * <code>false</code> otherwise
+ */
+ protected boolean isAvailable(int theCode)
+ {
+ boolean result;
+ if ((theCode != -1) && (theCode < 300))
+ {
+ result = true;
+ }
+ else
+ {
+ result = false;
+ }
+ return result;
+ }
+
+ /**
+ * Fully reads the input stream from the passed HTTP URL connection to
+ * prevent (harmless) server-side exception.
+ *
+ * @param theConnection the HTTP URL connection to read from
+ * @exception IOException if an error happens during the read
+ */
+ protected void readFully(HttpURLConnection theConnection)
+ throws IOException
+ {
+ // Only read if there is data to read ... The problem is that not
+ // all servers return a content-length header. If there is no header
+ // getContentLength() returns -1. It seems to work and it seems
+ // that all servers that return no content-length header also do
+ // not block on read() operations!
+ if (theConnection.getContentLength() != 0)
+ {
+ byte[] buf = new byte[256];
+ InputStream in = theConnection.getInputStream();
+ while (in.read(buf) != -1)
+ {
+ // Make sure we read all the data in the stream
+ }
+ }
+ }
+
+ /**
+ * @return true if the server is running or false otherwise
+ */
+ protected boolean isRunning()
+ {
+ return this.isRunning;
+ }
}
1.189 +7 -0 jakarta-cactus/documentation/docs/xdocs/changes.xml
Index: changes.xml
===================================================================
RCS file: /home/cvs/jakarta-cactus/documentation/docs/xdocs/changes.xml,v
retrieving revision 1.188
retrieving revision 1.189
diff -u -r1.188 -r1.189
--- changes.xml 11 May 2004 20:54:22 -0000 1.188
+++ changes.xml 14 May 2004 10:33:35 -0000 1.189
@@ -90,6 +90,13 @@
</devs>
<release version="1.7dev" date="in CVS">
+ <action dev="VMA" type="update">
+ The <code>JettyTestSetup</code> class now checks if the Jetty server
+ is already started and only starts it if it isn't running. It also
+ does not stops it if it was running before <code>JettyTestSetup</code>
+ was called. This is useful when you have a master test suite and when
+ you also wish to run your tests one by one.
+ </action>
</release>
<release version="1.6.1" date="in CVS">
1.108 +4 -10 jakarta-cactus/build.properties.sample
Index: build.properties.sample
===================================================================
RCS file: /home/cvs/jakarta-cactus/build.properties.sample,v
retrieving revision 1.107
retrieving revision 1.108
diff -u -r1.107 -r1.108
--- build.properties.sample 12 Apr 2004 10:48:30 -0000 1.107
+++ build.properties.sample 14 May 2004 10:33:35 -0000 1.108
@@ -91,6 +91,9 @@
# XML Parsers API (required by HttpUnit)
xmlapis.jar = ${lib.repo}/xerces/jars/xmlParserAPIs-2.2.1.jar
+# The location of the Jetty jar
+jetty.jar = ${lib.repo}/jetty/jars/org.mortbay.jetty-4.2.11.jar
+
# -----------------------------------------------------------------------------
# Mandatory properties for the Sample Servlet project.
# -----------------------------------------------------------------------------
@@ -98,15 +101,6 @@
# Location of the Servlet API jar.
servlet.jar = ${lib.repo}/servletapi/jars/servletapi-2.3.jar
#servlet.jar = ${lib.repo}/servletapi/jars/servletapi-2.2.jar
-
-# -----------------------------------------------------------------------------
-# Mandatory properties for the Eclipse plugin ant the Jetty Sample
-# -----------------------------------------------------------------------------
-# The Jetty container is packaged in the Eclipse plugin and is used as the
-# default container in which to run the Cactus tests
-
-# The location of the Jetty jar
-jetty.jar = ${lib.repo}/jetty/jars/org.mortbay.jetty-4.2.11.jar
# -----------------------------------------------------------------------------
# Mandatory properties for the Jetty Sample
1.19 +4 -10 jakarta-cactus/build.properties.vmassol
Index: build.properties.vmassol
===================================================================
RCS file: /home/cvs/jakarta-cactus/build.properties.vmassol,v
retrieving revision 1.18
retrieving revision 1.19
diff -u -r1.18 -r1.19
--- build.properties.vmassol 18 Apr 2004 12:22:33 -0000 1.18
+++ build.properties.vmassol 14 May 2004 10:33:35 -0000 1.19
@@ -59,6 +59,9 @@
# XML Parsers API (required by HttpUnit)
xmlapis.jar = ${lib.repo}/xerces/jars/xmlParserAPIs-2.2.1.jar
+# The location of the Jetty jar
+jetty.jar = ${lib.repo}/jetty/jars/org.mortbay.jetty-4.2.11.jar
+
# -----------------------------------------------------------------------------
# Mandatory properties for the Sample Servlet project.
# -----------------------------------------------------------------------------
@@ -66,15 +69,6 @@
# Location of the Servlet API jar.
servlet.jar = ${lib.repo}/servletapi/jars/servletapi-2.3.jar
#servlet.jar = ${lib.repo}/servletapi/jars/servletapi-2.2.jar
-
-# -----------------------------------------------------------------------------
-# Mandatory properties for the Eclipse plugin ant the Jetty Sample
-# -----------------------------------------------------------------------------
-# The Jetty container is packaged in the Eclipse plugin and is used as the
-# default container in which to run the Cactus tests
-
-# The location of the Jetty jar
-jetty.jar = ${lib.repo}/jetty/jars/org.mortbay.jetty-4.2.11.jar
# -----------------------------------------------------------------------------
# Mandatory properties for the Jetty Sample
1.2 +6 -4 jakarta-cactus/framework/src/test/share/org/apache/cactus/internal/AbstractTestAbstractCactusTestCase.java
Index: AbstractTestAbstractCactusTestCase.java
===================================================================
RCS file: /home/cvs/jakarta-cactus/framework/src/test/share/org/apache/cactus/internal/AbstractTestAbstractCactusTestCase.java,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- AbstractTestAbstractCactusTestCase.java 10 Apr 2004 18:18:58 -0000 1.1
+++ AbstractTestAbstractCactusTestCase.java 14 May 2004 10:33:35 -0000 1.2
@@ -31,7 +31,7 @@
import org.apache.cactus.internal.client.ClientTestCaseCaller;
import org.apache.cactus.internal.client.WebResponseObjectFactory;
import org.apache.cactus.internal.client.connector.http.HttpProtocolHandler;
-import org.apache.cactus.internal.configuration.ServletConfiguration;
+import org.apache.cactus.internal.configuration.DefaultServletConfiguration;
import org.apache.cactus.internal.util.JUnitVersionHelper;
import org.apache.cactus.mock.MockHttpURLConnection;
@@ -67,12 +67,14 @@
protected void runTest() throws Throwable
{
ClientTestCaseCaller delegator = new ClientTestCaseCaller(
- this, this, new HttpProtocolHandler(new ServletConfiguration()));
+ this, this,
+ new HttpProtocolHandler(new DefaultServletConfiguration()));
try
{
// Call the begin method
- WebRequest request = new WebRequestImpl(new ServletConfiguration());
+ WebRequest request =
+ new WebRequestImpl(new DefaultServletConfiguration());
delegator.callBeginMethod(request);
1.30 +3 -3 jakarta-cactus/framework/src/java/j2ee13/org/apache/cactus/FilterTestCase.java
Index: FilterTestCase.java
===================================================================
RCS file: /home/cvs/jakarta-cactus/framework/src/java/j2ee13/org/apache/cactus/FilterTestCase.java,v
retrieving revision 1.29
retrieving revision 1.30
diff -u -r1.29 -r1.30
--- FilterTestCase.java 10 Apr 2004 15:25:29 -0000 1.29
+++ FilterTestCase.java 14 May 2004 10:33:35 -0000 1.30
@@ -27,7 +27,7 @@
import org.apache.cactus.internal.AbstractCactusTestCase;
import org.apache.cactus.internal.CactusTestCase;
import org.apache.cactus.internal.client.connector.http.HttpProtocolHandler;
-import org.apache.cactus.internal.configuration.FilterConfiguration;
+import org.apache.cactus.internal.configuration.DefaultFilterConfiguration;
import org.apache.cactus.server.FilterConfigWrapper;
import org.apache.cactus.spi.client.connector.ProtocolHandler;
@@ -106,6 +106,6 @@
*/
protected ProtocolHandler createProtocolHandler()
{
- return new HttpProtocolHandler(new FilterConfiguration());
+ return new HttpProtocolHandler(new DefaultFilterConfiguration());
}
}
1.2 +3 -25 jakarta-cactus/framework/src/java/j2ee13/org/apache/cactus/internal/configuration/FilterConfiguration.java
Index: FilterConfiguration.java
===================================================================
RCS file: /home/cvs/jakarta-cactus/framework/src/java/j2ee13/org/apache/cactus/internal/configuration/FilterConfiguration.java,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- FilterConfiguration.java 10 Apr 2004 15:25:29 -0000 1.1
+++ FilterConfiguration.java 14 May 2004 10:33:35 -0000 1.2
@@ -1,7 +1,7 @@
/*
* ========================================================================
*
- * Copyright 2001-2004 The Apache Software Foundation.
+ * Copyright 2004 The Apache Software Foundation.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -25,28 +25,6 @@
*
* @version $Id$
*/
-public class FilterConfiguration extends AbstractWebConfiguration
+public interface FilterConfiguration extends WebConfiguration
{
- /**
- * Name of the cactus property that specifies the name of the JSP
- * redirector.
- */
- public static final String CACTUS_FILTER_REDIRECTOR_NAME_PROPERTY =
- "cactus.filterRedirectorName";
-
- /**
- * @see AbstractWebConfiguration#getDefaultRedirectorName()
- */
- public String getDefaultRedirectorName()
- {
- String redirectorName =
- System.getProperty(CACTUS_FILTER_REDIRECTOR_NAME_PROPERTY);
-
- if (redirectorName == null)
- {
- redirectorName = "FilterRedirector";
- }
-
- return redirectorName;
- }
}
1.1 jakarta-cactus/framework/src/java/j2ee13/org/apache/cactus/internal/configuration/DefaultFilterConfiguration.java
Index: DefaultFilterConfiguration.java
===================================================================
/*
* ========================================================================
*
* Copyright 2001-2004 The Apache Software Foundation.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
* ========================================================================
*/
package org.apache.cactus.internal.configuration;
/**
* Provides access to the Cactus configuration parameters related to the
* Filter Redirector.
*
* @version $Id: DefaultFilterConfiguration.java,v 1.1 2004/05/14 10:33:35 vmassol Exp $
*/
public class DefaultFilterConfiguration
extends AbstractWebConfiguration implements FilterConfiguration
{
/**
* Name of the cactus property that specifies the name of the JSP
* redirector.
*/
public static final String CACTUS_FILTER_REDIRECTOR_NAME_PROPERTY =
"cactus.filterRedirectorName";
/**
* @see AbstractWebConfiguration#getDefaultRedirectorName()
*/
public String getDefaultRedirectorName()
{
String redirectorName =
System.getProperty(CACTUS_FILTER_REDIRECTOR_NAME_PROPERTY);
if (redirectorName == null)
{
redirectorName = "FilterRedirector";
}
return redirectorName;
}
}
---------------------------------------------------------------------
To unsubscribe, e-mail: cactus-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: cactus-dev-help@jakarta.apache.org