Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
Diffstat (limited to 'jetty-spring/src')
-rw-r--r--jetty-spring/src/main/config/etc/jetty-spring.xml76
-rw-r--r--jetty-spring/src/main/java/org/eclipse/jetty/spring/Main.java38
-rw-r--r--jetty-spring/src/main/java/org/eclipse/jetty/spring/Server.java39
-rw-r--r--jetty-spring/src/main/java/org/eclipse/jetty/spring/SpringConfigurationProcessor.java141
-rw-r--r--jetty-spring/src/main/java/org/eclipse/jetty/spring/SpringConfigurationProcessorFactory.java43
-rw-r--r--jetty-spring/src/main/resources/META-INF/services/org.eclipse.jetty.xml.ConfigurationProcessorFactory1
-rw-r--r--jetty-spring/src/test/java/org/eclipse/jetty/spring/SpringXmlConfigurationTest.java141
-rw-r--r--jetty-spring/src/test/java/org/eclipse/jetty/spring/TestConfiguration.java137
-rw-r--r--jetty-spring/src/test/resources/org/mortbay/jetty/spring/configure.xml33
-rw-r--r--jetty-spring/src/test/resources/org/mortbay/jetty/spring/jetty-deploy.xml36
-rw-r--r--jetty-spring/src/test/resources/org/mortbay/jetty/spring/jetty.xml44
11 files changed, 729 insertions, 0 deletions
diff --git a/jetty-spring/src/main/config/etc/jetty-spring.xml b/jetty-spring/src/main/config/etc/jetty-spring.xml
new file mode 100644
index 0000000000..282a3a76e9
--- /dev/null
+++ b/jetty-spring/src/main/config/etc/jetty-spring.xml
@@ -0,0 +1,76 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE beans PUBLIC "-//SPRING//DTD BEAN//EN" "http://www.springframework.org/dtd/spring-beans.dtd">
+
+<!-- =============================================================== -->
+<!-- Configure the Jetty Server with Spring -->
+<!-- This file is the similar to jetty.xml, but written in spring -->
+<!-- XmlBeanFactory format. -->
+<!-- -->
+<!-- This file may be run with: -->
+<!-- java -jar start.jar OPTIONS=Server,spring \ -->
+<!-- start.class=org.mortbay.jetty.spring.Main \ -->
+<!-- etc/jetty-spring.xml -->
+<!-- -->
+<!-- The spring and commons-logging jars may need to be added -->
+<!-- to the classpath -->
+<!-- =============================================================== -->
+
+<beans>
+
+ <bean id="contexts" class="org.eclipse.jetty.server.handler.ContextHandlerCollection"/>
+
+ <bean id="Server" name="Main" class="org.eclipse.jetty.spring.Server" init-method="start" destroy-method="stop">
+
+ <property name="threadPool">
+ <bean id="ThreadPool" class="org.eclipse.jetty.util.thread.QueuedThreadPool">
+ <property name="minThreads" value="10"/>
+ <property name="maxThreads" value="50"/>
+ </bean>
+ </property>
+
+ <property name="connectors">
+ <list>
+ <bean id="Connector" class="org.eclipse.jetty.server.nio.SelectChannelConnector">
+ <property name="port" value="8080"/>
+ </bean>
+ </list>
+ </property>
+
+ <property name="handler">
+ <bean id="handlers" class="org.eclipse.jetty.server.handler.HandlerCollection">
+ <property name="handlers">
+ <list>
+ <ref bean="contexts"/>
+ <bean id="defaultHandler" class="org.eclipse.jetty.server.handler.DefaultHandler"/>
+ </list>
+ </property>
+ </bean>
+ </property>
+
+ <property name="beans">
+ <list>
+ <bean id="ContextDeployer" class="org.eclipse.jetty.deploy.ContextDeployer">
+ <property name="contexts" ref="contexts"/>
+ <property name="directory" value="contexts"/>
+ <property name="scanInterval" value="5"/>
+ </bean>
+
+ <bean id="WebAppDeployer" class="org.eclipse.jetty.deploy.WebAppDeployer">
+ <property name="contexts" ref="contexts"/>
+ <property name="webAppDir" value="webapps"/>
+ <property name="extract" value="true"/>
+ <property name="defaultsDescriptor" value="etc/webdefault.xml"/>
+ </bean>
+
+ <bean class="org.eclipse.jetty.security.HashLoginService">
+ <property name="name" value="Test Realm"/>
+ <property name="config" value="etc/realm.properties"/>
+ <property name="refreshInterval" value="0"/>
+ </bean>
+
+ </list>
+ </property>
+
+ </bean>
+
+</beans>
diff --git a/jetty-spring/src/main/java/org/eclipse/jetty/spring/Main.java b/jetty-spring/src/main/java/org/eclipse/jetty/spring/Main.java
new file mode 100644
index 0000000000..f2dd4611b2
--- /dev/null
+++ b/jetty-spring/src/main/java/org/eclipse/jetty/spring/Main.java
@@ -0,0 +1,38 @@
+//
+// ========================================================================
+// Copyright (c) 1995-2012 Mort Bay Consulting Pty. Ltd.
+// ------------------------------------------------------------------------
+// All rights reserved. This program and the accompanying materials
+// are made available under the terms of the Eclipse Public License v1.0
+// and Apache License v2.0 which accompanies this distribution.
+//
+// The Eclipse Public License is available at
+// http://www.eclipse.org/legal/epl-v10.html
+//
+// The Apache License v2.0 is available at
+// http://www.opensource.org/licenses/apache2.0.php
+//
+// You may elect to redistribute this code under either of these licenses.
+// ========================================================================
+//
+
+
+package org.eclipse.jetty.spring;
+
+import org.eclipse.jetty.util.resource.Resource;
+import org.eclipse.jetty.xml.XmlConfiguration;
+
+
+/* ------------------------------------------------------------ */
+/** Run Jetty from Spring configuration.
+ * @see <a href="http://svn.codehaus.org/jetty/jetty/trunk/jetty-spring/src/main/config/etc/jetty-spring.xml">jetty-spring.xml</a>
+ */
+public class Main
+{
+ public static void main(String[] args) throws Exception
+ {
+ Resource config = Resource.newResource(args.length == 1?args[0]:"src/main/config/etc/jetty-spring.xml");
+ XmlConfiguration.main(new String[]{config.getFile().getAbsolutePath()});
+
+ }
+}
diff --git a/jetty-spring/src/main/java/org/eclipse/jetty/spring/Server.java b/jetty-spring/src/main/java/org/eclipse/jetty/spring/Server.java
new file mode 100644
index 0000000000..d9a86ca2fb
--- /dev/null
+++ b/jetty-spring/src/main/java/org/eclipse/jetty/spring/Server.java
@@ -0,0 +1,39 @@
+//
+// ========================================================================
+// Copyright (c) 1995-2012 Mort Bay Consulting Pty. Ltd.
+// ------------------------------------------------------------------------
+// All rights reserved. This program and the accompanying materials
+// are made available under the terms of the Eclipse Public License v1.0
+// and Apache License v2.0 which accompanies this distribution.
+//
+// The Eclipse Public License is available at
+// http://www.eclipse.org/legal/epl-v10.html
+//
+// The Apache License v2.0 is available at
+// http://www.opensource.org/licenses/apache2.0.php
+//
+// You may elect to redistribute this code under either of these licenses.
+// ========================================================================
+//
+
+
+package org.eclipse.jetty.spring;
+
+import java.util.Collection;
+
+
+/* ------------------------------------------------------------ */
+/**
+ * Convenience class for jetty with Spring.
+ * This class provides a setBeans method as an alternate
+ * access to the {@link #addBean(Object)} API.
+ */
+public class Server extends org.eclipse.jetty.server.Server
+{
+ public void setBeans(Collection<Object> beans)
+ {
+ for (Object o:beans)
+ addBean(o);
+ }
+
+}
diff --git a/jetty-spring/src/main/java/org/eclipse/jetty/spring/SpringConfigurationProcessor.java b/jetty-spring/src/main/java/org/eclipse/jetty/spring/SpringConfigurationProcessor.java
new file mode 100644
index 0000000000..4158c0b680
--- /dev/null
+++ b/jetty-spring/src/main/java/org/eclipse/jetty/spring/SpringConfigurationProcessor.java
@@ -0,0 +1,141 @@
+//
+// ========================================================================
+// Copyright (c) 1995-2012 Mort Bay Consulting Pty. Ltd.
+// ------------------------------------------------------------------------
+// All rights reserved. This program and the accompanying materials
+// are made available under the terms of the Eclipse Public License v1.0
+// and Apache License v2.0 which accompanies this distribution.
+//
+// The Eclipse Public License is available at
+// http://www.eclipse.org/legal/epl-v10.html
+//
+// The Apache License v2.0 is available at
+// http://www.opensource.org/licenses/apache2.0.php
+//
+// You may elect to redistribute this code under either of these licenses.
+// ========================================================================
+//
+
+
+package org.eclipse.jetty.spring;
+
+import java.net.URL;
+import java.util.Arrays;
+import java.util.Map;
+
+import org.eclipse.jetty.util.log.Logger;
+import org.eclipse.jetty.xml.ConfigurationProcessor;
+import org.eclipse.jetty.xml.ConfigurationProcessorFactory;
+import org.eclipse.jetty.xml.XmlConfiguration;
+import org.eclipse.jetty.xml.XmlParser;
+import org.springframework.beans.factory.xml.XmlBeanFactory;
+import org.springframework.core.io.ByteArrayResource;
+import org.springframework.core.io.Resource;
+import org.springframework.core.io.UrlResource;
+
+/**
+ * Spring ConfigurationProcessor
+ * <p>
+ * A {@link ConfigurationProcessor} that uses a spring XML file to emulate the {@link XmlConfiguration} format.
+ * <p>
+ * {@link XmlConfiguration} expects a primary object that is either passed in to a call to {@link #configure(Object)}
+ * or that is constructed by a call to {@link #configure()}. This processor looks for a bean definition
+ * with an id, name or alias of "Main" as uses that as the primary bean.
+ * <p>
+ * The objects mapped by {@link XmlConfiguration#getIdMap()} are set as singletons before any configuration calls
+ * and if the spring configuration file contains a definition for the singleton id, the the singleton is updated
+ * with a call to {@link XmlBeanFactory#configureBean(Object, String)}.
+ * <p>
+ * The property map obtained via {@link XmlConfiguration#getProperties()} is set as a singleton called "properties"
+ * and values can be accessed by somewhat verbose
+ * usage of {@link org.springframework.beans.factory.config.MethodInvokingFactoryBean}.
+ * <p>
+ * This processor is returned by the {@link SpringConfigurationProcessorFactory} for any XML document whos first
+ * element is "beans". The factory is discovered by a {@link ServiceLoader} for {@link ConfigurationProcessorFactory}.
+ */
+public class SpringConfigurationProcessor implements ConfigurationProcessor
+{
+ static final Logger __log = org.eclipse.jetty.util.log.Log.getLogger(SpringConfigurationProcessor.class.getName());
+
+ Map<String, Object> _idMap;
+ Map<String, String> _propertyMap;
+ XmlBeanFactory _beanFactory;
+ String _main;
+
+ public void init(URL url, XmlParser.Node config, Map<String, Object> idMap, Map<String, String> properties)
+ {
+ try
+ {
+ _idMap=idMap;
+ _propertyMap=properties;
+
+ Resource resource = (url!=null)
+ ?new UrlResource(url)
+ :new ByteArrayResource(("<?xml version=\"1.0\" encoding=\"UTF-8\"?><!DOCTYPE beans PUBLIC \"-//SPRING//DTD BEAN//EN\" \"http://www.springframework.org/dtd/spring-beans.dtd\">"+config).getBytes("UTF-8"));
+
+ _beanFactory=new XmlBeanFactory(resource);
+
+ }
+ catch(Exception e)
+ {
+ throw new RuntimeException(e);
+ }
+ }
+
+ public Object configure(Object obj) throws Exception
+ {
+ doConfigure();
+ return _beanFactory.configureBean(obj,_main);
+ }
+
+ /**
+ * Return a configured bean. If a bean has the id or alias of "Main", then it is returned, otherwise the first bean in the file is returned.
+ * @see org.eclipse.jetty.xml.ConfigurationProcessor#configure()
+ */
+ public Object configure() throws Exception
+ {
+ doConfigure();
+ return _beanFactory.getBean(_main);
+ }
+
+ private void doConfigure()
+ {
+ _beanFactory.registerSingleton("properties",_propertyMap);
+
+ // Look for the main bean;
+ for (String bean : _beanFactory.getBeanDefinitionNames())
+ {
+ __log.debug("{} - {}",bean,Arrays.asList(_beanFactory.getAliases(bean)));
+ String[] aliases = _beanFactory.getAliases(bean);
+ if ("Main".equals(bean) || aliases!=null && Arrays.asList(aliases).contains("Main"))
+ {
+ _main=bean;
+ break;
+ }
+ }
+ if (_main==null)
+ _main=_beanFactory.getBeanDefinitionNames()[0];
+
+ // Register id beans as singletons
+ __log.debug("idMap {}",_idMap);
+ for (String id : _idMap.keySet())
+ {
+ __log.debug("register {}",id);
+ _beanFactory.registerSingleton(id,_idMap.get(id));
+ }
+
+ // Apply configuration to existing singletons
+ for (String id : _idMap.keySet())
+ {
+ if (_beanFactory.containsBeanDefinition(id))
+ {
+ __log.debug("reconfigure {}",id);
+ _beanFactory.configureBean(_idMap.get(id),id);
+ }
+ }
+
+ // Extract id's for next time.
+ for (String id : _beanFactory.getSingletonNames())
+ _idMap.put(id,_beanFactory.getBean(id));
+ }
+}
diff --git a/jetty-spring/src/main/java/org/eclipse/jetty/spring/SpringConfigurationProcessorFactory.java b/jetty-spring/src/main/java/org/eclipse/jetty/spring/SpringConfigurationProcessorFactory.java
new file mode 100644
index 0000000000..44a35e957e
--- /dev/null
+++ b/jetty-spring/src/main/java/org/eclipse/jetty/spring/SpringConfigurationProcessorFactory.java
@@ -0,0 +1,43 @@
+//
+// ========================================================================
+// Copyright (c) 1995-2012 Mort Bay Consulting Pty. Ltd.
+// ------------------------------------------------------------------------
+// All rights reserved. This program and the accompanying materials
+// are made available under the terms of the Eclipse Public License v1.0
+// and Apache License v2.0 which accompanies this distribution.
+//
+// The Eclipse Public License is available at
+// http://www.eclipse.org/legal/epl-v10.html
+//
+// The Apache License v2.0 is available at
+// http://www.opensource.org/licenses/apache2.0.php
+//
+// You may elect to redistribute this code under either of these licenses.
+// ========================================================================
+//
+
+
+package org.eclipse.jetty.spring;
+
+import org.eclipse.jetty.xml.ConfigurationProcessor;
+import org.eclipse.jetty.xml.ConfigurationProcessorFactory;
+import org.eclipse.jetty.xml.XmlConfiguration;
+
+/**
+ * Spring ConfigurationProcessor Factory
+ * <p>
+ * Create a {@link SpringConfigurationProcessor} for XML documents with a "beans" element.
+ * The factory is discovered by a {@link ServiceLoader} for {@link ConfigurationProcessorFactory}.
+ * @see SpringConfigurationProcessor
+ * @see XmlConfiguration
+ *
+ */
+public class SpringConfigurationProcessorFactory implements ConfigurationProcessorFactory
+{
+ public ConfigurationProcessor getConfigurationProcessor(String dtd, String tag)
+ {
+ if ("beans".equals(tag))
+ return new SpringConfigurationProcessor();
+ return null;
+ }
+}
diff --git a/jetty-spring/src/main/resources/META-INF/services/org.eclipse.jetty.xml.ConfigurationProcessorFactory b/jetty-spring/src/main/resources/META-INF/services/org.eclipse.jetty.xml.ConfigurationProcessorFactory
new file mode 100644
index 0000000000..0289454079
--- /dev/null
+++ b/jetty-spring/src/main/resources/META-INF/services/org.eclipse.jetty.xml.ConfigurationProcessorFactory
@@ -0,0 +1 @@
+org.eclipse.jetty.spring.SpringConfigurationProcessorFactory
diff --git a/jetty-spring/src/test/java/org/eclipse/jetty/spring/SpringXmlConfigurationTest.java b/jetty-spring/src/test/java/org/eclipse/jetty/spring/SpringXmlConfigurationTest.java
new file mode 100644
index 0000000000..50db77baa7
--- /dev/null
+++ b/jetty-spring/src/test/java/org/eclipse/jetty/spring/SpringXmlConfigurationTest.java
@@ -0,0 +1,141 @@
+// ========================================================================
+// Copyright (c) 2006-2009 Mort Bay Consulting Pty. Ltd.
+// ------------------------------------------------------------------------
+// All rights reserved. This program and the accompanying materials
+// are made available under the terms of the Eclipse Public License v1.0
+// and Apache License v2.0 which accompanies this distribution.
+// The Eclipse Public License is available at
+// http://www.eclipse.org/legal/epl-v10.html
+// The Apache License v2.0 is available at
+// http://www.opensource.org/licenses/apache2.0.php
+// You may elect to redistribute this code under either of these licenses.
+// ========================================================================
+
+package org.eclipse.jetty.spring;
+
+import java.net.URL;
+import java.util.HashMap;
+import java.util.Map;
+import java.util.regex.Matcher;
+import java.util.regex.Pattern;
+
+import org.eclipse.jetty.spring.Server;
+import org.eclipse.jetty.xml.XmlConfiguration;
+import org.junit.Assume;
+import org.junit.Before;
+import org.junit.Test;
+
+import static junit.framework.Assert.assertEquals;
+
+public class SpringXmlConfigurationTest
+{
+ protected String _configure="org/mortbay/jetty/spring/configure.xml";
+
+ @Before
+ public void init() throws Exception
+ {
+ // Jetty's XML configuration will make use of java.util.ServiceLoader
+ // to load the proper ConfigurationProcessorFactory, so these tests
+ // will always fail in JDK 5.
+
+ String javaVersion = System.getProperty("java.version");
+ Pattern regexp = Pattern.compile("1\\.(\\d{1})\\..*");
+ Matcher matcher = regexp.matcher(javaVersion);
+ if (matcher.matches())
+ {
+ String minor = matcher.group(1);
+ Assume.assumeTrue(Integer.parseInt(minor) > 5);
+ }
+ }
+
+ @Test
+ public void testPassedObject() throws Exception
+ {
+ TestConfiguration.VALUE=77;
+
+ URL url = SpringXmlConfigurationTest.class.getClassLoader().getResource(_configure);
+ XmlConfiguration configuration = new XmlConfiguration(url);
+
+ Map<String,String> properties = new HashMap<String,String>();
+ properties.put("test", "xxx");
+
+ TestConfiguration nested = new TestConfiguration();
+ nested.setTestString0("nested");
+ configuration.getIdMap().put("nested",nested);
+
+ TestConfiguration tc = new TestConfiguration();
+ tc.setTestString0("preconfig");
+ tc.setTestInt0(42);
+ configuration.getProperties().putAll(properties);
+
+ tc=(TestConfiguration)configuration.configure(tc);
+
+ assertEquals("preconfig",tc.getTestString0());
+ assertEquals(42,tc.getTestInt0());
+ assertEquals("SetValue",tc.getTestString1());
+ assertEquals(1,tc.getTestInt1());
+
+ assertEquals("nested",tc.getNested().getTestString0());
+ assertEquals("nested",tc.getNested().getTestString1());
+ assertEquals("default",tc.getNested().getNested().getTestString0());
+ assertEquals("deep",tc.getNested().getNested().getTestString1());
+
+ assertEquals("deep",((TestConfiguration)configuration.getIdMap().get("nestedDeep")).getTestString1());
+ assertEquals(2,((TestConfiguration)configuration.getIdMap().get("nestedDeep")).getTestInt2());
+
+ assertEquals("xxx",tc.getTestString2());
+ }
+
+ @Test
+ public void testNewObject() throws Exception
+ {
+ TestConfiguration.VALUE=71;
+
+ URL url = SpringXmlConfigurationTest.class.getClassLoader().getResource(_configure);
+ XmlConfiguration configuration = new XmlConfiguration(url);
+
+ Map<String,String> properties = new HashMap<String,String>();
+ properties.put("test", "xxx");
+
+ TestConfiguration nested = new TestConfiguration();
+ nested.setTestString0("nested");
+ configuration.getIdMap().put("nested",nested);
+
+ configuration.getProperties().putAll(properties);
+ TestConfiguration tc = (TestConfiguration)configuration.configure();
+
+ assertEquals("default",tc.getTestString0());
+ assertEquals(-1,tc.getTestInt0());
+ assertEquals("SetValue",tc.getTestString1());
+ assertEquals(1,tc.getTestInt1());
+
+ assertEquals("nested",tc.getNested().getTestString0());
+ assertEquals("nested",tc.getNested().getTestString1());
+ assertEquals("default",tc.getNested().getNested().getTestString0());
+ assertEquals("deep",tc.getNested().getNested().getTestString1());
+
+ assertEquals("deep",((TestConfiguration)configuration.getIdMap().get("nestedDeep")).getTestString1());
+ assertEquals(2,((TestConfiguration)configuration.getIdMap().get("nestedDeep")).getTestInt2());
+
+ assertEquals("xxx",tc.getTestString2());
+ }
+
+ @Test
+ public void testJettyXml() throws Exception
+ {
+ URL url = SpringXmlConfigurationTest.class.getClassLoader().getResource("org/mortbay/jetty/spring/jetty.xml");
+ XmlConfiguration configuration = new XmlConfiguration(url);
+
+ Server server = (Server)configuration.configure();
+
+ server.dumpStdErr();
+
+ }
+
+ @Test
+ public void XmlConfigurationMain() throws Exception
+ {
+ XmlConfiguration.main(new String[]{"src/test/resources/org/mortbay/jetty/spring/jetty.xml"});
+
+ }
+}
diff --git a/jetty-spring/src/test/java/org/eclipse/jetty/spring/TestConfiguration.java b/jetty-spring/src/test/java/org/eclipse/jetty/spring/TestConfiguration.java
new file mode 100644
index 0000000000..e3300b6096
--- /dev/null
+++ b/jetty-spring/src/test/java/org/eclipse/jetty/spring/TestConfiguration.java
@@ -0,0 +1,137 @@
+//
+// ========================================================================
+// Copyright (c) 1995-2012 Mort Bay Consulting Pty. Ltd.
+// ------------------------------------------------------------------------
+// All rights reserved. This program and the accompanying materials
+// are made available under the terms of the Eclipse Public License v1.0
+// and Apache License v2.0 which accompanies this distribution.
+//
+// The Eclipse Public License is available at
+// http://www.eclipse.org/legal/epl-v10.html
+//
+// The Apache License v2.0 is available at
+// http://www.opensource.org/licenses/apache2.0.php
+//
+// You may elect to redistribute this code under either of these licenses.
+// ========================================================================
+//
+
+package org.eclipse.jetty.spring;
+
+import java.net.URL;
+
+import org.junit.Ignore;
+
+@Ignore
+public class TestConfiguration
+{
+ public static int VALUE=77;
+
+ public TestConfiguration nested;
+ public String testString0="default";
+ public String testString1;
+ public String testString2;
+ public int testInt0=-1;
+ public int testInt1;
+ public int testInt2;
+ public URL url;
+ public Object[] objArray;
+ public int[] intArray;
+
+
+ public static int getVALUE()
+ {
+ return VALUE;
+ }
+ public static void setVALUE(int vALUE)
+ {
+ VALUE = vALUE;
+ }
+
+ public TestConfiguration()
+ {
+ }
+
+ public TestConfiguration getNested()
+ {
+ return nested;
+ }
+ public void setNested(TestConfiguration nested)
+ {
+ this.nested = nested;
+ }
+ public String getTestString0()
+ {
+ return testString0;
+ }
+ public void setTestString0(String testString0)
+ {
+ this.testString0 = testString0;
+ }
+ public String getTestString1()
+ {
+ return testString1;
+ }
+ public void setTestString1(String testString1)
+ {
+ this.testString1 = testString1;
+ }
+ public String getTestString2()
+ {
+ return testString2;
+ }
+ public void setTestString2(String testString2)
+ {
+ this.testString2 = testString2;
+ }
+ public int getTestInt0()
+ {
+ return testInt0;
+ }
+ public void setTestInt0(int testInt0)
+ {
+ this.testInt0 = testInt0;
+ }
+ public int getTestInt1()
+ {
+ return testInt1;
+ }
+ public void setTestInt1(int testInt1)
+ {
+ this.testInt1 = testInt1;
+ }
+ public int getTestInt2()
+ {
+ return testInt2;
+ }
+ public void setTestInt2(int testInt2)
+ {
+ this.testInt2 = testInt2;
+ }
+ public URL getUrl()
+ {
+ return url;
+ }
+ public void setUrl(URL url)
+ {
+ this.url = url;
+ }
+ public Object[] getObjArray()
+ {
+ return objArray;
+ }
+ public void setObjArray(Object[] objArray)
+ {
+ this.objArray = objArray;
+ }
+ public int[] getIntArray()
+ {
+ return intArray;
+ }
+ public void setIntArray(int[] intArray)
+ {
+ this.intArray = intArray;
+ }
+
+
+}
diff --git a/jetty-spring/src/test/resources/org/mortbay/jetty/spring/configure.xml b/jetty-spring/src/test/resources/org/mortbay/jetty/spring/configure.xml
new file mode 100644
index 0000000000..d55b645321
--- /dev/null
+++ b/jetty-spring/src/test/resources/org/mortbay/jetty/spring/configure.xml
@@ -0,0 +1,33 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE beans PUBLIC "-//SPRING//DTD BEAN//EN" "http://www.springframework.org/dtd/spring-beans.dtd">
+
+<beans>
+ <!-- define the singleton properties Map, filled in with XmlConfiguration.getProperties() -->
+ <bean id="properties" class="java.util.Map"/>
+
+ <!-- extract a value from the property map -->
+ <bean id="testProperty" singleton="false" class="org.springframework.beans.factory.config.MethodInvokingFactoryBean">
+ <property name="targetObject"><ref local="properties" /></property>
+ <property name="targetMethod"><value>get</value></property>
+ <property name="arguments"><list><value>test</value></list></property>
+ </bean>
+
+ <bean id="root" name="Some,Names,Main" class="org.mortbay.jetty.spring.TestConfiguration">
+ <property name="testString1"><value>SetValue</value></property>
+ <property name="testInt1"><value>1</value></property>
+ <property name="nested" ref="nested"/>
+ <property name="testString2" ref="testProperty"/>
+ </bean>
+
+ <bean id="nested" class="org.mortbay.jetty.spring.TestConfiguration">
+ <property name="testInt2"><value>2</value></property>
+ <property name="testString1"><value>nested</value></property>
+ <property name="nested" ref="nestedDeep"/>
+ </bean>
+
+ <bean id="nestedDeep" class="org.mortbay.jetty.spring.TestConfiguration">
+ <property name="testString1"><value>deep</value></property>
+ <property name="testInt2"><value>2</value></property>
+ </bean>
+
+</beans>
diff --git a/jetty-spring/src/test/resources/org/mortbay/jetty/spring/jetty-deploy.xml b/jetty-spring/src/test/resources/org/mortbay/jetty/spring/jetty-deploy.xml
new file mode 100644
index 0000000000..88258fd108
--- /dev/null
+++ b/jetty-spring/src/test/resources/org/mortbay/jetty/spring/jetty-deploy.xml
@@ -0,0 +1,36 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE beans PUBLIC "-//SPRING//DTD BEAN//EN" "http://www.springframework.org/dtd/spring-beans.dtd">
+
+<beans>
+ <bean id="Server" name="Main" class="org.mortbay.jetty.spring.Server">
+
+ <!--
+ <property name="beans">
+ <list>
+ <bean id="ContextDeployer" class="org.mortbay.jetty.spring.ContextDeployer">
+ <property name="contexts" ref="contexts"/>
+ <property name="contextsDir" value="contexts"/>
+ <property name="scanInterval" value="5"/>
+ </bean>
+
+ <bean id="WebAppDeployer" class="org.eclipse.jetty.deploy.WebAppDeployer">
+ <property name="contexts" ref="contexts"/>
+ <property name="webAppDir" value="webapps"/>
+ <property name="extract" value="true"/>
+ <property name="defaultsDescriptor" value="etc/webdefault.xml"/>
+ </bean>
+
+ <bean class="org.eclipse.jetty.security.HashLoginService">
+ <property name="name" value="Test Realm"/>
+ <property name="config" value="etc/realm.properties"/>
+ <property name="refreshInterval" value="0"/>
+ </bean>
+
+ </list>
+ </property>
+ -->
+
+ </bean>
+</beans>
+
+
diff --git a/jetty-spring/src/test/resources/org/mortbay/jetty/spring/jetty.xml b/jetty-spring/src/test/resources/org/mortbay/jetty/spring/jetty.xml
new file mode 100644
index 0000000000..cf7dafe16a
--- /dev/null
+++ b/jetty-spring/src/test/resources/org/mortbay/jetty/spring/jetty.xml
@@ -0,0 +1,44 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE beans PUBLIC "-//SPRING//DTD BEAN//EN" "http://www.springframework.org/dtd/spring-beans.dtd">
+
+<beans>
+ <bean id="Contexts" class="org.eclipse.jetty.server.handler.ContextHandlerCollection"/>
+ <bean id="Server" name="Main" class="org.mortbay.jetty.spring.Server">
+
+ <property name="threadPool">
+ <bean id="ThreadPool" class="org.eclipse.jetty.util.thread.QueuedThreadPool">
+ <property name="minThreads" value="10"/>
+ <property name="maxThreads" value="200"/>
+ </bean>
+ </property>
+
+ <property name="connectors">
+ <list>
+ <bean id="Connector" class="org.eclipse.jetty.server.nio.SelectChannelConnector">
+ <property name="port" value="0"/>
+ </bean>
+ </list>
+ </property>
+
+ <property name="handler">
+ <bean id="handlers" class="org.eclipse.jetty.server.handler.HandlerCollection">
+ <property name="handlers">
+ <list>
+ <ref bean="Contexts"/>
+ <bean id="defaultHandler" class="org.eclipse.jetty.server.handler.DefaultHandler"/>
+ </list>
+ </property>
+ </bean>
+ </property>
+
+ <property name="stopAtShutdown" value="true"/>
+ <property name="sendServerVersion" value="true"/>
+ <property name="sendDateHeader" value="true"/>
+ <property name="gracefulShutdown" value="1000"/>
+ <property name="dumpAfterStart" value="true"/>
+ <property name="dumpBeforeStop" value="false"/>
+
+ </bean>
+</beans>
+
+

Back to the top