Merge branch 'jetty-9.2.x'

Conflicts:
	jetty-start/src/main/java/org/eclipse/jetty/start/Main.java
	jetty-start/src/test/java/org/eclipse/jetty/start/LicensingTest.java
This commit is contained in:
Joakim Erdfelt 2015-03-16 10:25:15 -07:00
commit 6e952d4618
6 changed files with 117 additions and 12 deletions

View File

@ -0,0 +1,56 @@
//
// ========================================================================
// Copyright (c) 1995-2015 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.embedded;
import java.lang.management.ManagementFactory;
import javax.management.remote.JMXServiceURL;
import org.eclipse.jetty.jmx.ConnectorServer;
import org.eclipse.jetty.jmx.MBeanContainer;
import org.eclipse.jetty.server.Server;
/**
* The simplest possible Jetty server.
*/
public class ServerWithJMX
{
public static void main( String[] args ) throws Exception
{
// === jetty-jmx.xml ===
MBeanContainer mbContainer = new MBeanContainer(
ManagementFactory.getPlatformMBeanServer());
Server server = new Server(8080);
server.addBean(mbContainer);
ConnectorServer jmx = new ConnectorServer(
new JMXServiceURL(
"rmi",
null,
1999,
"/jndi/rmi://localhost:1999/jmxrmi"),
"org.eclipse.jetty.jmx:name=rmiconnectorserver");
server.addBean(jmx);
server.start();
server.dumpStdErr();
server.join();
}
}

View File

@ -11,17 +11,19 @@
the RMI registry hostname and port number, that may need to be modified the RMI registry hostname and port number, that may need to be modified
in order to comply with the firewall requirements. in order to comply with the firewall requirements.
--> -->
<New id="ConnectorServer" class="org.eclipse.jetty.jmx.ConnectorServer"> <Call name="addBean">
<Arg> <Arg>
<New class="javax.management.remote.JMXServiceURL"> <New id="ConnectorServer" class="org.eclipse.jetty.jmx.ConnectorServer">
<Arg type="java.lang.String">rmi</Arg> <Arg>
<Arg type="java.lang.String" /> <New class="javax.management.remote.JMXServiceURL">
<Arg type="java.lang.Integer"><SystemProperty name="jetty.jmxrmiport" default="1099"/></Arg> <Arg type="java.lang.String">rmi</Arg>
<Arg type="java.lang.String">/jndi/rmi://<SystemProperty name="jetty.jmxrmihost" default="localhost"/>:<SystemProperty name="jetty.jmxrmiport" default="1099"/>/jmxrmi</Arg> <Arg type="java.lang.String" />
<Arg type="java.lang.Integer"><Property name="jetty.jmxrmiport" default="1099"/></Arg>
<Arg type="java.lang.String">/jndi/rmi://<Property name="jetty.jmxrmihost" default="localhost"/>:<Property name="jetty.jmxrmiport" default="1099"/>/jmxrmi</Arg>
</New>
</Arg>
<Arg>org.eclipse.jetty.jmx:name=rmiconnectorserver</Arg>
</New> </New>
</Arg> </Arg>
<Arg>org.eclipse.jetty.jmx:name=rmiconnectorserver</Arg> </Call>
<Call name="start" />
</New>
</Configure> </Configure>

View File

@ -114,8 +114,8 @@ public class TestJettyOSGiBootCore
res.add(mavenBundle().groupId( "org.eclipse.jetty" ).artifactId( "jetty-annotations" ).versionAsInProject().start()); res.add(mavenBundle().groupId( "org.eclipse.jetty" ).artifactId( "jetty-annotations" ).versionAsInProject().start());
res.add(mavenBundle().groupId( "org.eclipse.jetty.websocket" ).artifactId( "websocket-api" ).versionAsInProject().noStart()); res.add(mavenBundle().groupId( "org.eclipse.jetty.websocket" ).artifactId( "websocket-api" ).versionAsInProject().noStart());
res.add(mavenBundle().groupId( "org.eclipse.jetty.websocket" ).artifactId( "websocket-common" ).versionAsInProject().noStart()); res.add(mavenBundle().groupId( "org.eclipse.jetty.websocket" ).artifactId( "websocket-common" ).versionAsInProject().noStart());
res.add(mavenBundle().groupId( "org.eclipse.jetty.websocket" ).artifactId( "websocket-servlet" ).versionAsInProject().noStart()); res.add(mavenBundle().groupId( "org.eclipse.jetty.websocket" ).artifactId( "websocket-servlet" ).versionAsInProject());
res.add(mavenBundle().groupId( "org.eclipse.jetty.websocket" ).artifactId( "websocket-server" ).versionAsInProject().noStart()); res.add(mavenBundle().groupId( "org.eclipse.jetty.websocket" ).artifactId( "websocket-server" ).versionAsInProject());
res.add(mavenBundle().groupId( "org.eclipse.jetty.websocket" ).artifactId( "websocket-client" ).versionAsInProject().noStart()); res.add(mavenBundle().groupId( "org.eclipse.jetty.websocket" ).artifactId( "websocket-client" ).versionAsInProject().noStart());
res.add(mavenBundle().groupId( "javax.websocket" ).artifactId( "javax.websocket-api" ).versionAsInProject().noStart()); res.add(mavenBundle().groupId( "javax.websocket" ).artifactId( "javax.websocket-api" ).versionAsInProject().noStart());
res.add(mavenBundle().groupId( "org.eclipse.jetty.websocket" ).artifactId( "javax-websocket-client-impl").versionAsInProject().noStart()); res.add(mavenBundle().groupId( "org.eclipse.jetty.websocket" ).artifactId( "javax-websocket-client-impl").versionAsInProject().noStart());

View File

@ -58,6 +58,7 @@ public class LicensingTest
int len = cmds.size(); int len = cmds.size();
String args[] = cmds.toArray(new String[len]); String args[] = cmds.toArray(new String[len]);
System.err.printf("%n## Exec: %s%n", Utils.join(cmds,", "));
Main main = new Main(); Main main = new Main();
StartArgs startArgs = main.processCommandLine(args); StartArgs startArgs = main.processCommandLine(args);
main.start(startArgs); main.start(startArgs);
@ -115,6 +116,31 @@ public class LicensingTest
assertThat("Contents",contents,containsString("--module=http2"+System.lineSeparator())); assertThat("Contents",contents,containsString("--module=http2"+System.lineSeparator()));
} }
@Test
public void testAdd_Http_Http2_Then_Deploy() throws Exception
{
File basePath = testdir.getEmptyDir();
List<String> cmds = getBaseCommandLine(basePath);
cmds.add("-Dorg.eclipse.jetty.start.ack.license.protonego-impl=true");
cmds.add("--add-to-start=http,http2");
execMain(cmds);
String contents = assertFileExists(basePath, "start.ini");
assertThat("Contents",contents,containsString("--module=http"+System.lineSeparator()));
assertThat("Contents",contents,containsString("--module=http2"+System.lineSeparator()));
// now request deploy (no license check should occur)
List<String> cmds2 = getBaseCommandLine(basePath);
cmds2.add("--add-to-start=deploy");
execMain(cmds2);
contents = assertFileExists(basePath, "start.ini");
assertThat("Contents",contents,containsString("--module=deploy"+System.lineSeparator()));
}
@Test @Test
public void testCreate_HTTP2_Licensed() throws Exception public void testCreate_HTTP2_Licensed() throws Exception
{ {

View File

@ -16,6 +16,26 @@
<build> <build>
<plugins> <plugins>
<plugin>
<groupId>org.apache.felix</groupId>
<artifactId>maven-bundle-plugin</artifactId>
<extensions>true</extensions>
<executions>
<execution>
<id>generate-manifest</id>
<goals>
<goal>manifest</goal>
</goals>
<configuration>
<instructions>
<Require-Capability>osgi.extender; filter:="(osgi.extender=osgi.serviceloader.registrar)"</Require-Capability>
<Provide-Capability>osgi.serviceloader; osgi.serviceloader=org.eclipse.jetty.websocket.servlet.WebSocketServletFactory</Provide-Capability>
<_nouses>true</_nouses>
</instructions>
</configuration>
</execution>
</executions>
</plugin>
<plugin> <plugin>
<groupId>org.apache.maven.plugins</groupId> <groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-jar-plugin</artifactId> <artifactId>maven-jar-plugin</artifactId>

View File

@ -25,6 +25,7 @@
<Bundle-Classpath /> <Bundle-Classpath />
<_nouses>true</_nouses> <_nouses>true</_nouses>
<DynamicImport-Package>org.eclipse.jetty.websocket.server.*;version="${parsedVersion.majorVersion}.${parsedVersion.minorVersion}",org.eclipse.jetty.websocket.server.pathmap.*;version="${parsedVersion.majorVersion}.${parsedVersion.minorVersion}"</DynamicImport-Package> <DynamicImport-Package>org.eclipse.jetty.websocket.server.*;version="${parsedVersion.majorVersion}.${parsedVersion.minorVersion}",org.eclipse.jetty.websocket.server.pathmap.*;version="${parsedVersion.majorVersion}.${parsedVersion.minorVersion}"</DynamicImport-Package>
<Require-Capability>osgi.serviceloader; filter:="(osgi.serviceloader=org.eclipse.jetty.websocket.servlet.WebSocketServletFactory)";cardinality:=multiple, osgi.extender; filter:="(osgi.extender=osgi.serviceloader.processor)"</Require-Capability>
</instructions> </instructions>
</configuration> </configuration>
</plugin> </plugin>