Merged branch 'jetty-10.0.x' into 'jetty-10.0.x-WebSocketUpgradeFilter'.
This commit is contained in:
commit
d52c1fc478
|
@ -25,7 +25,7 @@ pipeline {
|
|||
',**/org/eclipse/jetty/demo/**' +
|
||||
// special environments / late integrations
|
||||
',**/org/eclipse/jetty/gcloud/**' + ',**/org/eclipse/jetty/infinispan/**' +
|
||||
',**/org/eclipse/jetty/osgi/**' + ',**/org/eclipse/jetty/spring/**' +
|
||||
',**/org/eclipse/jetty/osgi/**' +
|
||||
',**/org/eclipse/jetty/http/spi/**' +
|
||||
// test classes
|
||||
',**/org/eclipse/jetty/tests/**' + ',**/org/eclipse/jetty/test/**',
|
||||
|
|
|
@ -330,12 +330,6 @@
|
|||
<version>${project.version}</version>
|
||||
<scope>provided</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.eclipse.jetty</groupId>
|
||||
<artifactId>jetty-spring</artifactId>
|
||||
<version>${project.version}</version>
|
||||
<scope>provided</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.eclipse.jetty</groupId>
|
||||
<artifactId>jetty-start</artifactId>
|
||||
|
|
|
@ -292,11 +292,6 @@
|
|||
<artifactId>jetty-servlets</artifactId>
|
||||
<version>10.0.0-SNAPSHOT</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.eclipse.jetty</groupId>
|
||||
<artifactId>jetty-spring</artifactId>
|
||||
<version>10.0.0-SNAPSHOT</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.eclipse.jetty</groupId>
|
||||
<artifactId>jetty-unixsocket-common</artifactId>
|
||||
|
|
|
@ -21,6 +21,5 @@
|
|||
|
||||
include::cdi.adoc[]
|
||||
include::weld.adoc[]
|
||||
include::spring-usage.adoc[]
|
||||
include::osgi.adoc[]
|
||||
include::metro.adoc[]
|
||||
|
|
|
@ -1,104 +0,0 @@
|
|||
//
|
||||
// ========================================================================
|
||||
// Copyright (c) 1995-2020 Mort Bay Consulting Pty Ltd and others.
|
||||
//
|
||||
// This program and the accompanying materials are made available under
|
||||
// the terms of the Eclipse Public License 2.0 which is available at
|
||||
// https://www.eclipse.org/legal/epl-2.0
|
||||
//
|
||||
// This Source Code may also be made available under the following
|
||||
// Secondary Licenses when the conditions for such availability set
|
||||
// forth in the Eclipse Public License, v. 2.0 are satisfied:
|
||||
// the Apache License v2.0 which is available at
|
||||
// https://www.apache.org/licenses/LICENSE-2.0
|
||||
//
|
||||
// SPDX-License-Identifier: EPL-2.0 OR Apache-2.0
|
||||
// ========================================================================
|
||||
//
|
||||
|
||||
[[framework-jetty-spring]]
|
||||
=== Spring Setup
|
||||
|
||||
You can assemble and configure Jetty in code or with almost any IoC style framework including Spring.
|
||||
If all you want to do is setup a Jetty server in your stock Spring usage, simply look at the xml snippet below as an example.
|
||||
If you want to replace the jetty-xml being used to start the normal Jetty distribution with spring, you may do so however currently it will not leverage the rest of the module system.
|
||||
|
||||
==== Jetty-Spring Module
|
||||
|
||||
The skeleton of a jetty spring module can be enabled from the jetty-distribution via the link:#startup-modules[module mechanism].
|
||||
For example:
|
||||
|
||||
[source, screen, subs="{sub-order}"]
|
||||
....
|
||||
$ java -jar start.jar --add-to-start=spring
|
||||
....
|
||||
|
||||
This (or the alternative link:#start-jar[--add-to-start]=spring command) creates a `${jetty.home}/lib/spring` directory and populates it with the jetty-spring integration jar.
|
||||
It does NOT supply the spring jars and their dependencies.
|
||||
You will need to download these and place them into jetty's classpath - you can use the `${jetty.home}/lib/spring` directory created by spring.mod for this purpose.
|
||||
|
||||
==== Using Spring to Configure Jetty
|
||||
|
||||
Configuring Jetty via Spring is simply a matter of calling the API as Spring beans.
|
||||
The following is an example mimicking the default jetty startup configuration.
|
||||
|
||||
[source, xml, subs="{sub-order}"]
|
||||
----
|
||||
|
||||
<?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. -->
|
||||
<!-- =============================================================== -->
|
||||
|
||||
<beans>
|
||||
<bean id="contexts" class="org.eclipse.jetty.server.handler.ContextHandlerCollection"/>
|
||||
<bean id="server" name="Main" class="org.eclipse.jetty.server.Server" init-method="start" destroy-method="stop">
|
||||
<constructor-arg>
|
||||
<bean id="threadPool" class="org.eclipse.jetty.util.thread.QueuedThreadPool">
|
||||
<property name="minThreads" value="10"/>
|
||||
<property name="maxThreads" value="50"/>
|
||||
</bean>
|
||||
</constructor-arg>
|
||||
<property name="connectors">
|
||||
<list>
|
||||
<bean id="connector" class="org.eclipse.jetty.server.ServerConnector">
|
||||
<constructor-arg ref="server"/>
|
||||
<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="deploymentManager" class="org.eclipse.jetty.deploy.DeploymentManager">
|
||||
<property name="contexts" ref="contexts"/>
|
||||
<property name="appProviders">
|
||||
<list>
|
||||
<bean id="webAppProvider" class="org.eclipse.jetty.deploy.providers.WebAppProvider">
|
||||
<property name="monitoredDirName" value="webapps"/>
|
||||
<property name="scanInterval" value="1"/>
|
||||
<property name="extractWars" value="true"/>
|
||||
</bean>
|
||||
</list>
|
||||
</property>
|
||||
</bean>
|
||||
</list>
|
||||
</property>
|
||||
</bean>
|
||||
</beans>
|
||||
|
||||
|
||||
----
|
|
@ -126,7 +126,7 @@
|
|||
org.eclipse.jetty.orbit,org.eclipse.jetty.http2,org.eclipse.jetty.websocket,org.eclipse.jetty.fcgi,org.eclipse.jetty.toolchain,org.apache.taglibs
|
||||
</excludeGroupIds>
|
||||
<excludeArtifactIds>
|
||||
apache-jsp,apache-jstl,jetty-start,jetty-spring,jetty-slf4j-impl
|
||||
apache-jsp,apache-jstl,jetty-start,jetty-slf4j-impl
|
||||
</excludeArtifactIds>
|
||||
<includeTypes>jar</includeTypes>
|
||||
<outputDirectory>${assembly-directory}/lib</outputDirectory>
|
||||
|
@ -144,7 +144,7 @@
|
|||
org.eclipse.jetty.orbit,org.eclipse.jetty.http2,org.eclipse.jetty.websocket,org.eclipse.jetty.fcgi,org.eclipse.jetty.toolchain,org.apache.taglibs
|
||||
</excludeGroupIds>
|
||||
<excludeArtifactIds>
|
||||
apache-jsp,apache-jstl,jetty-start,jetty-spring
|
||||
apache-jsp,apache-jstl,jetty-start
|
||||
</excludeArtifactIds>
|
||||
<includeTypes>jar</includeTypes>
|
||||
<classifier>sources</classifier>
|
||||
|
@ -282,33 +282,6 @@
|
|||
<outputDirectory>${source-assembly-directory}/lib/fcgi</outputDirectory>
|
||||
</configuration>
|
||||
</execution>
|
||||
<execution>
|
||||
<id>copy-lib-spring-deps</id>
|
||||
<phase>generate-resources</phase>
|
||||
<goals>
|
||||
<goal>copy-dependencies</goal>
|
||||
</goals>
|
||||
<configuration>
|
||||
<includeGroupIds>org.eclipse.jetty</includeGroupIds>
|
||||
<includeArtifactIds>jetty-spring</includeArtifactIds>
|
||||
<includeTypes>jar</includeTypes>
|
||||
<outputDirectory>${assembly-directory}/lib/spring</outputDirectory>
|
||||
</configuration>
|
||||
</execution>
|
||||
<execution>
|
||||
<id>copy-lib-spring-src-deps</id>
|
||||
<phase>generate-resources</phase>
|
||||
<goals>
|
||||
<goal>copy-dependencies</goal>
|
||||
</goals>
|
||||
<configuration>
|
||||
<includeGroupIds>org.eclipse.jetty</includeGroupIds>
|
||||
<includeArtifactIds>jetty-spring</includeArtifactIds>
|
||||
<includeTypes>jar</includeTypes>
|
||||
<classifier>sources</classifier>
|
||||
<outputDirectory>${source-assembly-directory}/lib/spring</outputDirectory>
|
||||
</configuration>
|
||||
</execution>
|
||||
<execution>
|
||||
<id>copy-servlet-api-deps</id>
|
||||
<phase>generate-resources</phase>
|
||||
|
@ -702,12 +675,6 @@
|
|||
<version>${project.version}</version>
|
||||
<optional>true</optional>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.eclipse.jetty</groupId>
|
||||
<artifactId>jetty-spring</artifactId>
|
||||
<version>${project.version}</version>
|
||||
<optional>true</optional>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.jboss.logging</groupId>
|
||||
<artifactId>jboss-logging</artifactId>
|
||||
|
|
|
@ -175,6 +175,8 @@ public class ByteArrayEndPoint extends AbstractEndPoint
|
|||
throw new ClosedChannelException();
|
||||
|
||||
ByteBuffer in = _inQ.peek();
|
||||
if (LOG.isDebugEnabled())
|
||||
LOG.debug("{} needsFillInterest EOF={} {}", this, in == EOF, BufferUtil.toDetailString(in));
|
||||
if (BufferUtil.hasContent(in) || isEOF(in))
|
||||
execute(_runFillable);
|
||||
}
|
||||
|
@ -201,11 +203,15 @@ public class ByteArrayEndPoint extends AbstractEndPoint
|
|||
boolean wasEmpty = _inQ.isEmpty();
|
||||
if (in == null)
|
||||
{
|
||||
if (LOG.isDebugEnabled())
|
||||
LOG.debug("{} addEOFAndRun=true", this);
|
||||
_inQ.add(EOF);
|
||||
fillable = true;
|
||||
}
|
||||
if (BufferUtil.hasContent(in))
|
||||
{
|
||||
if (LOG.isDebugEnabled())
|
||||
LOG.debug("{} addInputAndRun={} {}", this, wasEmpty, BufferUtil.toDetailString(in));
|
||||
_inQ.add(in);
|
||||
fillable = wasEmpty;
|
||||
}
|
||||
|
@ -234,11 +240,15 @@ public class ByteArrayEndPoint extends AbstractEndPoint
|
|||
boolean wasEmpty = _inQ.isEmpty();
|
||||
if (in == null)
|
||||
{
|
||||
if (LOG.isDebugEnabled())
|
||||
LOG.debug("{} addEOFAndExecute=true", this);
|
||||
_inQ.add(EOF);
|
||||
fillable = true;
|
||||
}
|
||||
if (BufferUtil.hasContent(in))
|
||||
{
|
||||
if (LOG.isDebugEnabled())
|
||||
LOG.debug("{} addInputAndExecute={} {}", this, wasEmpty, BufferUtil.toDetailString(in));
|
||||
_inQ.add(in);
|
||||
fillable = wasEmpty;
|
||||
}
|
||||
|
|
|
@ -126,6 +126,7 @@
|
|||
<groupId>org.apache.directory.api</groupId>
|
||||
<artifactId>api-ldap-schema-data</artifactId>
|
||||
<version>2.0.0</version>
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
<!-- because directory server do not have yet junit5 extensions -->
|
||||
<dependency>
|
||||
|
|
|
@ -308,10 +308,6 @@
|
|||
<groupId>org.eclipse.jetty.fcgi</groupId>
|
||||
<artifactId>fcgi-server</artifactId>
|
||||
</exclusion>
|
||||
<exclusion>
|
||||
<groupId>org.eclipse.jetty</groupId>
|
||||
<artifactId>jetty-spring</artifactId>
|
||||
</exclusion>
|
||||
<exclusion>
|
||||
<groupId>org.eclipse.jetty</groupId>
|
||||
<artifactId>jetty-start</artifactId>
|
||||
|
|
|
@ -77,7 +77,7 @@ class AsyncContentProducer implements ContentProducer
|
|||
HttpInput.Content content = nextTransformedContent();
|
||||
int available = content == null ? 0 : content.remaining();
|
||||
if (LOG.isDebugEnabled())
|
||||
LOG.debug("available = {}", available);
|
||||
LOG.debug("available = {} {}", available, this);
|
||||
return available;
|
||||
}
|
||||
|
||||
|
@ -86,7 +86,7 @@ class AsyncContentProducer implements ContentProducer
|
|||
{
|
||||
boolean hasContent = _rawContent != null;
|
||||
if (LOG.isDebugEnabled())
|
||||
LOG.debug("hasContent = {}", hasContent);
|
||||
LOG.debug("hasContent = {} {}", hasContent, this);
|
||||
return hasContent;
|
||||
}
|
||||
|
||||
|
@ -94,7 +94,7 @@ class AsyncContentProducer implements ContentProducer
|
|||
public boolean isError()
|
||||
{
|
||||
if (LOG.isDebugEnabled())
|
||||
LOG.debug("isError = {}", _error);
|
||||
LOG.debug("isError = {} {}", _error, this);
|
||||
return _error;
|
||||
}
|
||||
|
||||
|
@ -103,7 +103,7 @@ class AsyncContentProducer implements ContentProducer
|
|||
{
|
||||
long minRequestDataRate = _httpChannel.getHttpConfiguration().getMinRequestDataRate();
|
||||
if (LOG.isDebugEnabled())
|
||||
LOG.debug("checkMinDataRate [m={},t={}]", minRequestDataRate, _firstByteTimeStamp);
|
||||
LOG.debug("checkMinDataRate [m={},t={}] {}", minRequestDataRate, _firstByteTimeStamp, this);
|
||||
if (minRequestDataRate > 0 && _firstByteTimeStamp != Long.MIN_VALUE)
|
||||
{
|
||||
long period = System.nanoTime() - _firstByteTimeStamp;
|
||||
|
@ -113,13 +113,13 @@ class AsyncContentProducer implements ContentProducer
|
|||
if (getRawContentArrived() < minimumData)
|
||||
{
|
||||
if (LOG.isDebugEnabled())
|
||||
LOG.debug("checkMinDataRate check failed");
|
||||
LOG.debug("checkMinDataRate check failed {}", this);
|
||||
BadMessageException bad = new BadMessageException(HttpStatus.REQUEST_TIMEOUT_408,
|
||||
String.format("Request content data rate < %d B/s", minRequestDataRate));
|
||||
if (_httpChannel.getState().isResponseCommitted())
|
||||
{
|
||||
if (LOG.isDebugEnabled())
|
||||
LOG.debug("checkMinDataRate aborting channel");
|
||||
LOG.debug("checkMinDataRate aborting channel {}", this);
|
||||
_httpChannel.abort(bad);
|
||||
}
|
||||
failCurrentContent(bad);
|
||||
|
@ -133,7 +133,7 @@ class AsyncContentProducer implements ContentProducer
|
|||
public long getRawContentArrived()
|
||||
{
|
||||
if (LOG.isDebugEnabled())
|
||||
LOG.debug("getRawContentArrived = {}", _rawContentArrived);
|
||||
LOG.debug("getRawContentArrived = {} {}", _rawContentArrived, this);
|
||||
return _rawContentArrived;
|
||||
}
|
||||
|
||||
|
@ -141,7 +141,7 @@ class AsyncContentProducer implements ContentProducer
|
|||
public boolean consumeAll(Throwable x)
|
||||
{
|
||||
if (LOG.isDebugEnabled())
|
||||
LOG.debug("consumeAll [e={}]", (Object)x);
|
||||
LOG.debug("consumeAll [e={}] {}", x, this);
|
||||
failCurrentContent(x);
|
||||
// A specific HttpChannel mechanism must be used as the following code
|
||||
// does not guarantee that the channel will synchronously deliver all
|
||||
|
@ -156,14 +156,14 @@ class AsyncContentProducer implements ContentProducer
|
|||
// deliver the content asynchronously. Tests in StreamResetTest cover this.
|
||||
boolean atEof = _httpChannel.failAllContent(x);
|
||||
if (LOG.isDebugEnabled())
|
||||
LOG.debug("failed all content of http channel; at EOF? {}", atEof);
|
||||
LOG.debug("failed all content of http channel EOF={} {}", atEof, this);
|
||||
return atEof;
|
||||
}
|
||||
|
||||
private void failCurrentContent(Throwable x)
|
||||
{
|
||||
if (LOG.isDebugEnabled())
|
||||
LOG.debug("failing currently held content [r={},t={}]", _rawContent, _transformedContent, x);
|
||||
LOG.debug("failing currently held content {}", this, x);
|
||||
if (_transformedContent != null && !_transformedContent.isSpecial())
|
||||
{
|
||||
if (_transformedContent != _rawContent)
|
||||
|
@ -186,7 +186,7 @@ class AsyncContentProducer implements ContentProducer
|
|||
public boolean onContentProducible()
|
||||
{
|
||||
if (LOG.isDebugEnabled())
|
||||
LOG.debug("onContentProducible");
|
||||
LOG.debug("onContentProducible {}", this);
|
||||
return _httpChannel.getState().onReadReady();
|
||||
}
|
||||
|
||||
|
@ -195,7 +195,7 @@ class AsyncContentProducer implements ContentProducer
|
|||
{
|
||||
HttpInput.Content content = nextTransformedContent();
|
||||
if (LOG.isDebugEnabled())
|
||||
LOG.debug("nextContent = {}", content);
|
||||
LOG.debug("nextContent = {} {}", content, this);
|
||||
if (content != null)
|
||||
_httpChannel.getState().onReadIdle();
|
||||
return content;
|
||||
|
@ -205,7 +205,7 @@ class AsyncContentProducer implements ContentProducer
|
|||
public void reclaim(HttpInput.Content content)
|
||||
{
|
||||
if (LOG.isDebugEnabled())
|
||||
LOG.debug("reclaim {} [t={}]", content, _transformedContent);
|
||||
LOG.debug("reclaim {} {}", content, this);
|
||||
if (_transformedContent == content)
|
||||
{
|
||||
content.succeeded();
|
||||
|
@ -219,39 +219,43 @@ class AsyncContentProducer implements ContentProducer
|
|||
public boolean isReady()
|
||||
{
|
||||
HttpInput.Content content = nextTransformedContent();
|
||||
if (content == null)
|
||||
if (content != null)
|
||||
{
|
||||
_httpChannel.getState().onReadUnready();
|
||||
if (_httpChannel.needContent())
|
||||
if (LOG.isDebugEnabled())
|
||||
LOG.debug("isReady(), got transformed content {} {}", content, this);
|
||||
_httpChannel.getState().onContentAdded();
|
||||
return true;
|
||||
}
|
||||
|
||||
_httpChannel.getState().onReadUnready();
|
||||
while (_httpChannel.needContent())
|
||||
{
|
||||
content = nextTransformedContent();
|
||||
if (LOG.isDebugEnabled())
|
||||
LOG.debug("isReady(), got transformed content after needContent retry {} {}", content, this);
|
||||
if (content != null)
|
||||
{
|
||||
content = nextTransformedContent();
|
||||
if (LOG.isDebugEnabled())
|
||||
LOG.debug("isReady got transformed content after needContent retry {}", content);
|
||||
if (content != null)
|
||||
_httpChannel.getState().onContentAdded();
|
||||
_httpChannel.getState().onContentAdded();
|
||||
return true;
|
||||
}
|
||||
else
|
||||
{
|
||||
// We could have read some rawContent but not enough to generate
|
||||
// transformed content, so we need to call needContent() again
|
||||
// to tell the channel that more content is needed.
|
||||
if (LOG.isDebugEnabled())
|
||||
LOG.debug("isReady has no transformed content after needContent");
|
||||
LOG.debug("isReady(), could not transform content after needContent retry {}", this);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if (LOG.isDebugEnabled())
|
||||
LOG.debug("isReady got transformed content {}", content);
|
||||
_httpChannel.getState().onContentAdded();
|
||||
}
|
||||
boolean ready = content != null;
|
||||
if (LOG.isDebugEnabled())
|
||||
LOG.debug("isReady = {}", ready);
|
||||
return ready;
|
||||
LOG.debug("isReady(), no content for needContent retry {}", this);
|
||||
return false;
|
||||
}
|
||||
|
||||
private HttpInput.Content nextTransformedContent()
|
||||
{
|
||||
if (LOG.isDebugEnabled())
|
||||
LOG.debug("nextTransformedContent [r={},t={}]", _rawContent, _transformedContent);
|
||||
LOG.debug("nextTransformedContent {}", this);
|
||||
if (_rawContent == null)
|
||||
{
|
||||
_rawContent = produceRawContent();
|
||||
|
@ -264,7 +268,7 @@ class AsyncContentProducer implements ContentProducer
|
|||
if (_transformedContent != _rawContent)
|
||||
_transformedContent.succeeded();
|
||||
if (LOG.isDebugEnabled())
|
||||
LOG.debug("nulling depleted transformed content");
|
||||
LOG.debug("nulling depleted transformed content {}", this);
|
||||
_transformedContent = null;
|
||||
}
|
||||
|
||||
|
@ -276,20 +280,20 @@ class AsyncContentProducer implements ContentProducer
|
|||
|
||||
_error = _rawContent.getError() != null;
|
||||
if (LOG.isDebugEnabled())
|
||||
LOG.debug("raw content is special (with error = {}), returning it", _error);
|
||||
LOG.debug("raw content is special (with error = {}), returning it {}", _error, this);
|
||||
return _rawContent;
|
||||
}
|
||||
|
||||
if (_interceptor != null)
|
||||
{
|
||||
if (LOG.isDebugEnabled())
|
||||
LOG.debug("using interceptor {} to transform raw content", _interceptor);
|
||||
LOG.debug("using interceptor to transform raw content {}", this);
|
||||
_transformedContent = _interceptor.readFrom(_rawContent);
|
||||
}
|
||||
else
|
||||
{
|
||||
if (LOG.isDebugEnabled())
|
||||
LOG.debug("null interceptor, transformed content = raw content");
|
||||
LOG.debug("null interceptor, transformed content = raw content {}", this);
|
||||
_transformedContent = _rawContent;
|
||||
}
|
||||
|
||||
|
@ -298,7 +302,7 @@ class AsyncContentProducer implements ContentProducer
|
|||
if (_transformedContent != _rawContent)
|
||||
_transformedContent.succeeded();
|
||||
if (LOG.isDebugEnabled())
|
||||
LOG.debug("nulling depleted transformed content");
|
||||
LOG.debug("nulling depleted transformed content {}", this);
|
||||
_transformedContent = null;
|
||||
}
|
||||
|
||||
|
@ -309,30 +313,30 @@ class AsyncContentProducer implements ContentProducer
|
|||
_rawContent.succeeded();
|
||||
_rawContent = null;
|
||||
if (LOG.isDebugEnabled())
|
||||
LOG.debug("nulling depleted raw content");
|
||||
LOG.debug("nulling depleted raw content {}", this);
|
||||
_rawContent = produceRawContent();
|
||||
if (_rawContent == null)
|
||||
{
|
||||
if (LOG.isDebugEnabled())
|
||||
LOG.debug("produced null raw content, returning null");
|
||||
LOG.debug("produced null raw content, returning null, {}", this);
|
||||
return null;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if (LOG.isDebugEnabled())
|
||||
LOG.debug("raw content is not empty");
|
||||
LOG.debug("raw content is not empty {}", this);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if (LOG.isDebugEnabled())
|
||||
LOG.debug("transformed content is not empty");
|
||||
LOG.debug("transformed content is not empty {}", this);
|
||||
}
|
||||
}
|
||||
|
||||
if (LOG.isDebugEnabled())
|
||||
LOG.debug("returning transformed content {}", _transformedContent);
|
||||
LOG.debug("returning transformed content {}", this);
|
||||
return _transformedContent;
|
||||
}
|
||||
|
||||
|
@ -345,10 +349,24 @@ class AsyncContentProducer implements ContentProducer
|
|||
if (_firstByteTimeStamp == Long.MIN_VALUE)
|
||||
_firstByteTimeStamp = System.nanoTime();
|
||||
if (LOG.isDebugEnabled())
|
||||
LOG.debug("produceRawContent updated rawContentArrived to {} and firstByteTimeStamp to {}", _rawContentArrived, _firstByteTimeStamp);
|
||||
LOG.debug("produceRawContent updated rawContentArrived to {} and firstByteTimeStamp to {} {}", _rawContentArrived, _firstByteTimeStamp, this);
|
||||
}
|
||||
if (LOG.isDebugEnabled())
|
||||
LOG.debug("produceRawContent produced {}", content);
|
||||
LOG.debug("produceRawContent produced {} {}", content, this);
|
||||
return content;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString()
|
||||
{
|
||||
return String.format("%s@%x[r=%s,t=%s,i=%s,error=%b,c=%s]",
|
||||
getClass().getSimpleName(),
|
||||
hashCode(),
|
||||
_rawContent,
|
||||
_transformedContent,
|
||||
_interceptor,
|
||||
_error,
|
||||
_httpChannel
|
||||
);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -83,7 +83,7 @@ public class HttpInput extends ServletInputStream implements Runnable
|
|||
public void setInterceptor(Interceptor interceptor)
|
||||
{
|
||||
if (LOG.isDebugEnabled())
|
||||
LOG.debug("setting interceptor to {}", interceptor);
|
||||
LOG.debug("setting interceptor to {} on {}", interceptor, this);
|
||||
_contentProducer.setInterceptor(interceptor);
|
||||
}
|
||||
|
||||
|
@ -99,14 +99,14 @@ public class HttpInput extends ServletInputStream implements Runnable
|
|||
if (currentInterceptor == null)
|
||||
{
|
||||
if (LOG.isDebugEnabled())
|
||||
LOG.debug("adding single interceptor: {}", interceptor);
|
||||
LOG.debug("adding single interceptor: {} on {}", interceptor, this);
|
||||
_contentProducer.setInterceptor(interceptor);
|
||||
}
|
||||
else
|
||||
{
|
||||
ChainedInterceptor chainedInterceptor = new ChainedInterceptor(currentInterceptor, interceptor);
|
||||
if (LOG.isDebugEnabled())
|
||||
LOG.debug("adding chained interceptor: {}", chainedInterceptor);
|
||||
LOG.debug("adding chained interceptor: {} on {}", chainedInterceptor, this);
|
||||
_contentProducer.setInterceptor(chainedInterceptor);
|
||||
}
|
||||
}
|
||||
|
@ -131,7 +131,7 @@ public class HttpInput extends ServletInputStream implements Runnable
|
|||
public boolean consumeAll()
|
||||
{
|
||||
if (LOG.isDebugEnabled())
|
||||
LOG.debug("consume all");
|
||||
LOG.debug("consumeAll {}", this);
|
||||
boolean atEof = _contentProducer.consumeAll(new IOException("Unconsumed content"));
|
||||
if (atEof)
|
||||
_consumedEof = true;
|
||||
|
@ -146,14 +146,14 @@ public class HttpInput extends ServletInputStream implements Runnable
|
|||
{
|
||||
boolean error = _contentProducer.isError();
|
||||
if (LOG.isDebugEnabled())
|
||||
LOG.debug("isError = {}", error);
|
||||
LOG.debug("isError={} {}", error, this);
|
||||
return error;
|
||||
}
|
||||
|
||||
public boolean isAsync()
|
||||
{
|
||||
if (LOG.isDebugEnabled())
|
||||
LOG.debug("isAsync read listener = " + _readListener);
|
||||
LOG.debug("isAsync read listener {} {}", _readListener, this);
|
||||
return _readListener != null;
|
||||
}
|
||||
|
||||
|
@ -164,7 +164,7 @@ public class HttpInput extends ServletInputStream implements Runnable
|
|||
{
|
||||
boolean finished = _consumedEof;
|
||||
if (LOG.isDebugEnabled())
|
||||
LOG.debug("isFinished? {}", finished);
|
||||
LOG.debug("isFinished={} {}", finished, this);
|
||||
return finished;
|
||||
}
|
||||
|
||||
|
@ -172,23 +172,16 @@ public class HttpInput extends ServletInputStream implements Runnable
|
|||
public boolean isReady()
|
||||
{
|
||||
boolean ready = _contentProducer.isReady();
|
||||
if (!ready)
|
||||
{
|
||||
if (LOG.isDebugEnabled())
|
||||
LOG.debug("isReady? false");
|
||||
return false;
|
||||
}
|
||||
|
||||
if (LOG.isDebugEnabled())
|
||||
LOG.debug("isReady? true");
|
||||
return true;
|
||||
LOG.debug("isReady={} {}", ready, this);
|
||||
return ready;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setReadListener(ReadListener readListener)
|
||||
{
|
||||
if (LOG.isDebugEnabled())
|
||||
LOG.debug("setting read listener to {}", readListener);
|
||||
LOG.debug("setting read listener to {} {}", readListener, this);
|
||||
if (_readListener != null)
|
||||
throw new IllegalStateException("ReadListener already set");
|
||||
_readListener = Objects.requireNonNull(readListener);
|
||||
|
@ -229,7 +222,7 @@ public class HttpInput extends ServletInputStream implements Runnable
|
|||
{
|
||||
int read = get(content, b, off, len);
|
||||
if (LOG.isDebugEnabled())
|
||||
LOG.debug("read produced {} byte(s)", read);
|
||||
LOG.debug("read produced {} byte(s) {}", read, this);
|
||||
if (content.isEmpty())
|
||||
_contentProducer.reclaim(content);
|
||||
return read;
|
||||
|
@ -237,7 +230,7 @@ public class HttpInput extends ServletInputStream implements Runnable
|
|||
|
||||
Throwable error = content.getError();
|
||||
if (LOG.isDebugEnabled())
|
||||
LOG.debug("read error = " + error);
|
||||
LOG.debug("read error={} {}", error, this);
|
||||
if (error != null)
|
||||
{
|
||||
if (error instanceof IOException)
|
||||
|
@ -248,7 +241,7 @@ public class HttpInput extends ServletInputStream implements Runnable
|
|||
if (content.isEof())
|
||||
{
|
||||
if (LOG.isDebugEnabled())
|
||||
LOG.debug("read at EOF, setting consumed EOF to true");
|
||||
LOG.debug("read at EOF, setting consumed EOF to true {}", this);
|
||||
_consumedEof = true;
|
||||
// If EOF do we need to wake for allDataRead callback?
|
||||
if (onContentProducible())
|
||||
|
@ -276,7 +269,7 @@ public class HttpInput extends ServletInputStream implements Runnable
|
|||
// which is forbidden by this method's contract.
|
||||
boolean hasContent = _contentProducer.hasContent();
|
||||
if (LOG.isDebugEnabled())
|
||||
LOG.debug("hasContent = {}", hasContent);
|
||||
LOG.debug("hasContent={} {}", hasContent, this);
|
||||
return hasContent;
|
||||
}
|
||||
|
||||
|
@ -285,7 +278,7 @@ public class HttpInput extends ServletInputStream implements Runnable
|
|||
{
|
||||
int available = _contentProducer.available();
|
||||
if (LOG.isDebugEnabled())
|
||||
LOG.debug("available = {}", available);
|
||||
LOG.debug("available={} {}", available, this);
|
||||
return available;
|
||||
}
|
||||
|
||||
|
@ -298,19 +291,22 @@ public class HttpInput extends ServletInputStream implements Runnable
|
|||
@Override
|
||||
public void run()
|
||||
{
|
||||
// Call isReady() to make sure that if not ready we register for fill interest.
|
||||
if (!_contentProducer.isReady())
|
||||
{
|
||||
if (LOG.isDebugEnabled())
|
||||
LOG.debug("running but not ready {}", this);
|
||||
return;
|
||||
}
|
||||
Content content = _contentProducer.nextContent();
|
||||
if (LOG.isDebugEnabled())
|
||||
LOG.debug("running on content {}", content);
|
||||
// The nextContent() call could return null if the transformer ate all
|
||||
// the raw bytes without producing any transformed content.
|
||||
if (content == null)
|
||||
return;
|
||||
LOG.debug("running on content {} {}", content, this);
|
||||
|
||||
// This check is needed when a request is started async but no read listener is registered.
|
||||
if (_readListener == null)
|
||||
{
|
||||
if (LOG.isDebugEnabled())
|
||||
LOG.debug("running without a read listener");
|
||||
LOG.debug("running without a read listener {}", this);
|
||||
onContentProducible();
|
||||
return;
|
||||
}
|
||||
|
@ -321,7 +317,7 @@ public class HttpInput extends ServletInputStream implements Runnable
|
|||
if (error != null)
|
||||
{
|
||||
if (LOG.isDebugEnabled())
|
||||
LOG.debug("running has error: {}", (Object)error);
|
||||
LOG.debug("running error={} {}", error, this);
|
||||
// TODO is this necessary to add here?
|
||||
_channelState.getHttpChannel().getResponse().getHttpFields().add(HttpConnection.CONNECTION_CLOSE);
|
||||
_readListener.onError(error);
|
||||
|
@ -331,13 +327,13 @@ public class HttpInput extends ServletInputStream implements Runnable
|
|||
try
|
||||
{
|
||||
if (LOG.isDebugEnabled())
|
||||
LOG.debug("running at EOF");
|
||||
LOG.debug("running at EOF {}", this);
|
||||
_readListener.onAllDataRead();
|
||||
}
|
||||
catch (Throwable x)
|
||||
{
|
||||
if (LOG.isDebugEnabled())
|
||||
LOG.debug("running failed onAllDataRead", x);
|
||||
LOG.debug("running failed onAllDataRead {}", this, x);
|
||||
_readListener.onError(x);
|
||||
}
|
||||
}
|
||||
|
@ -345,7 +341,7 @@ public class HttpInput extends ServletInputStream implements Runnable
|
|||
else
|
||||
{
|
||||
if (LOG.isDebugEnabled())
|
||||
LOG.debug("running has content");
|
||||
LOG.debug("running has content {}", this);
|
||||
try
|
||||
{
|
||||
_readListener.onDataAvailable();
|
||||
|
@ -353,7 +349,7 @@ public class HttpInput extends ServletInputStream implements Runnable
|
|||
catch (Throwable x)
|
||||
{
|
||||
if (LOG.isDebugEnabled())
|
||||
LOG.debug("running failed onDataAvailable", x);
|
||||
LOG.debug("running failed onDataAvailable {}", this, x);
|
||||
_readListener.onError(x);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,81 +0,0 @@
|
|||
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
|
||||
<parent>
|
||||
<groupId>org.eclipse.jetty</groupId>
|
||||
<artifactId>jetty-project</artifactId>
|
||||
<version>10.0.0-SNAPSHOT</version>
|
||||
</parent>
|
||||
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
<artifactId>jetty-spring</artifactId>
|
||||
<name>Example :: Jetty Spring</name>
|
||||
|
||||
<properties>
|
||||
<dependencies>target/dependencies</dependencies>
|
||||
<bundle-symbolic-name>${project.groupId}.spring</bundle-symbolic-name>
|
||||
</properties>
|
||||
|
||||
<build>
|
||||
<defaultGoal>install</defaultGoal>
|
||||
<plugins>
|
||||
<plugin>
|
||||
<groupId>org.jacoco</groupId>
|
||||
<artifactId>jacoco-maven-plugin</artifactId>
|
||||
<configuration>
|
||||
<skip>true</skip>
|
||||
</configuration>
|
||||
</plugin>
|
||||
<plugin>
|
||||
<groupId>org.apache.felix</groupId>
|
||||
<artifactId>maven-bundle-plugin</artifactId>
|
||||
<extensions>true</extensions>
|
||||
<configuration>
|
||||
<instructions>
|
||||
<Require-Capability>osgi.extender; filter:="(osgi.extender=osgi.serviceloader.registrar)";resolution:=optional
|
||||
</Require-Capability>
|
||||
<Provide-Capability>
|
||||
osgi.serviceloader;osgi.serviceloader=org.eclipse.jetty.xml.ConfigurationProcessorFactory
|
||||
</Provide-Capability>
|
||||
</instructions>
|
||||
</configuration>
|
||||
</plugin>
|
||||
</plugins>
|
||||
</build>
|
||||
<dependencies>
|
||||
<dependency>
|
||||
<groupId>org.eclipse.jetty</groupId>
|
||||
<artifactId>jetty-xml</artifactId>
|
||||
<version>${project.version}</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.eclipse.jetty</groupId>
|
||||
<artifactId>jetty-util</artifactId>
|
||||
<version>${project.version}</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.springframework</groupId>
|
||||
<artifactId>spring-beans</artifactId>
|
||||
<version>${spring-version}</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.slf4j</groupId>
|
||||
<artifactId>slf4j-api</artifactId>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.eclipse.jetty</groupId>
|
||||
<artifactId>jetty-server</artifactId>
|
||||
<version>${project.version}</version>
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>org.eclipse.jetty</groupId>
|
||||
<artifactId>jetty-slf4j-impl</artifactId>
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.eclipse.jetty.toolchain</groupId>
|
||||
<artifactId>jetty-test-helper</artifactId>
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
</project>
|
|
@ -1,61 +0,0 @@
|
|||
<?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. -->
|
||||
<!-- =============================================================== -->
|
||||
|
||||
<beans>
|
||||
|
||||
<bean id="contexts" class="org.eclipse.jetty.server.handler.ContextHandlerCollection"/>
|
||||
|
||||
<bean id="server" name="Main" class="org.eclipse.jetty.server.Server" init-method="start" destroy-method="stop">
|
||||
<constructor-arg>
|
||||
<bean id="threadPool" class="org.eclipse.jetty.util.thread.QueuedThreadPool">
|
||||
<property name="minThreads" value="10"/>
|
||||
<property name="maxThreads" value="50"/>
|
||||
</bean>
|
||||
</constructor-arg>
|
||||
|
||||
<property name="connectors">
|
||||
<list>
|
||||
<bean id="connector" class="org.eclipse.jetty.server.ServerConnector">
|
||||
<constructor-arg ref="server"/>
|
||||
<property name="port" value="8080"/>
|
||||
</bean>
|
||||
</list>
|
||||
</property>
|
||||
|
||||
<property name="handler">
|
||||
<bean id="handlers" class="org.eclipse.jetty.server.handler.HandlerList">
|
||||
<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="deploymentManager" class="org.eclipse.jetty.deploy.DeploymentManager">
|
||||
<property name="contexts" ref="contexts"/>
|
||||
<property name="appProviders">
|
||||
<list>
|
||||
<bean id="webAppProvider" class="org.eclipse.jetty.deploy.providers.WebAppProvider">
|
||||
<property name="monitoredDirName" value="webapps"/>
|
||||
<property name="scanInterval" value="1"/>
|
||||
<property name="extractWars" value="true"/>
|
||||
</bean>
|
||||
</list>
|
||||
</property>
|
||||
</bean>
|
||||
</list>
|
||||
</property>
|
||||
|
||||
</bean>
|
||||
|
||||
</beans>
|
|
@ -1,16 +0,0 @@
|
|||
# DO NOT EDIT - See: https://www.eclipse.org/jetty/documentation/current/startup-modules.html
|
||||
|
||||
[description]
|
||||
Enables Spring configuration processing of Jetty XML files.
|
||||
All Jetty-style XML files can optionally be written as Spring beans.2
|
||||
|
||||
[depend]
|
||||
server
|
||||
|
||||
[lib]
|
||||
lib/spring/*.jar
|
||||
|
||||
[ini-template]
|
||||
## See https://eclipse.org/jetty/documentation/current/frameworks.html#framework-jetty-spring
|
||||
## for information on how to complete spring configuration
|
||||
|
|
@ -1,32 +0,0 @@
|
|||
//
|
||||
// ========================================================================
|
||||
// Copyright (c) 1995-2020 Mort Bay Consulting Pty Ltd and others.
|
||||
//
|
||||
// This program and the accompanying materials are made available under
|
||||
// the terms of the Eclipse Public License 2.0 which is available at
|
||||
// https://www.eclipse.org/legal/epl-2.0
|
||||
//
|
||||
// This Source Code may also be made available under the following
|
||||
// Secondary Licenses when the conditions for such availability set
|
||||
// forth in the Eclipse Public License, v. 2.0 are satisfied:
|
||||
// the Apache License v2.0 which is available at
|
||||
// https://www.apache.org/licenses/LICENSE-2.0
|
||||
//
|
||||
// SPDX-License-Identifier: EPL-2.0 OR Apache-2.0
|
||||
// ========================================================================
|
||||
//
|
||||
|
||||
import org.eclipse.jetty.spring.SpringConfigurationProcessorFactory;
|
||||
import org.eclipse.jetty.xml.ConfigurationProcessorFactory;
|
||||
|
||||
module org.eclipse.jetty.spring
|
||||
{
|
||||
exports org.eclipse.jetty.spring;
|
||||
|
||||
requires transitive org.eclipse.jetty.xml;
|
||||
requires org.slf4j;
|
||||
requires spring.beans;
|
||||
requires spring.core;
|
||||
|
||||
provides ConfigurationProcessorFactory with SpringConfigurationProcessorFactory;
|
||||
}
|
|
@ -1,34 +0,0 @@
|
|||
//
|
||||
// ========================================================================
|
||||
// Copyright (c) 1995-2020 Mort Bay Consulting Pty Ltd and others.
|
||||
//
|
||||
// This program and the accompanying materials are made available under
|
||||
// the terms of the Eclipse Public License 2.0 which is available at
|
||||
// https://www.eclipse.org/legal/epl-2.0
|
||||
//
|
||||
// This Source Code may also be made available under the following
|
||||
// Secondary Licenses when the conditions for such availability set
|
||||
// forth in the Eclipse Public License, v. 2.0 are satisfied:
|
||||
// the Apache License v2.0 which is available at
|
||||
// https://www.apache.org/licenses/LICENSE-2.0
|
||||
//
|
||||
// SPDX-License-Identifier: EPL-2.0 OR Apache-2.0
|
||||
// ========================================================================
|
||||
//
|
||||
|
||||
package org.eclipse.jetty.spring;
|
||||
|
||||
import org.eclipse.jetty.util.resource.Resource;
|
||||
import org.eclipse.jetty.xml.XmlConfiguration;
|
||||
|
||||
/**
|
||||
* Runs Jetty from a Spring configuration file passed as argument.
|
||||
*/
|
||||
public class Main
|
||||
{
|
||||
public static void main(String[] args) throws Exception
|
||||
{
|
||||
Resource config = Resource.newResource(args.length == 1 ? args[0] : "etc/jetty-spring.xml");
|
||||
XmlConfiguration.main(config.getFile().getAbsolutePath());
|
||||
}
|
||||
}
|
|
@ -1,170 +0,0 @@
|
|||
//
|
||||
// ========================================================================
|
||||
// Copyright (c) 1995-2020 Mort Bay Consulting Pty Ltd and others.
|
||||
//
|
||||
// This program and the accompanying materials are made available under
|
||||
// the terms of the Eclipse Public License 2.0 which is available at
|
||||
// https://www.eclipse.org/legal/epl-2.0
|
||||
//
|
||||
// This Source Code may also be made available under the following
|
||||
// Secondary Licenses when the conditions for such availability set
|
||||
// forth in the Eclipse Public License, v. 2.0 are satisfied:
|
||||
// the Apache License v2.0 which is available at
|
||||
// https://www.apache.org/licenses/LICENSE-2.0
|
||||
//
|
||||
// SPDX-License-Identifier: EPL-2.0 OR Apache-2.0
|
||||
// ========================================================================
|
||||
//
|
||||
|
||||
package org.eclipse.jetty.spring;
|
||||
|
||||
import java.nio.charset.StandardCharsets;
|
||||
import java.util.Arrays;
|
||||
import java.util.Map;
|
||||
import java.util.ServiceLoader;
|
||||
|
||||
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.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.springframework.beans.BeanWrapper;
|
||||
import org.springframework.beans.PropertyValues;
|
||||
import org.springframework.beans.factory.config.BeanDefinition;
|
||||
import org.springframework.beans.factory.support.DefaultListableBeanFactory;
|
||||
import org.springframework.beans.factory.xml.XmlBeanDefinitionReader;
|
||||
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 DefaultListableBeanFactory#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
|
||||
{
|
||||
private static final Logger LOG = LoggerFactory.getLogger(SpringConfigurationProcessor.class);
|
||||
|
||||
private XmlConfiguration _configuration;
|
||||
private DefaultListableBeanFactory _beanFactory;
|
||||
private String _main;
|
||||
|
||||
@Override
|
||||
public void init(org.eclipse.jetty.util.resource.Resource jettyResource, XmlParser.Node config, XmlConfiguration configuration)
|
||||
{
|
||||
try
|
||||
{
|
||||
_configuration = configuration;
|
||||
|
||||
Resource springResource;
|
||||
|
||||
if (jettyResource != null)
|
||||
{
|
||||
springResource = new UrlResource(jettyResource.getURI());
|
||||
}
|
||||
else
|
||||
{
|
||||
springResource = 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(StandardCharsets.UTF_8));
|
||||
}
|
||||
|
||||
_beanFactory = new DefaultListableBeanFactory()
|
||||
{
|
||||
@Override
|
||||
protected void applyPropertyValues(String beanName, BeanDefinition mbd, BeanWrapper bw, PropertyValues pvs)
|
||||
{
|
||||
_configuration.initializeDefaults(bw.getWrappedInstance());
|
||||
super.applyPropertyValues(beanName, mbd, bw, pvs);
|
||||
}
|
||||
};
|
||||
|
||||
new XmlBeanDefinitionReader(_beanFactory).loadBeanDefinitions(springResource);
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
throw new RuntimeException(e);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
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()
|
||||
*/
|
||||
@Override
|
||||
public Object configure() throws Exception
|
||||
{
|
||||
doConfigure();
|
||||
return _beanFactory.getBean(_main);
|
||||
}
|
||||
|
||||
private void doConfigure()
|
||||
{
|
||||
_beanFactory.registerSingleton("properties", _configuration.getProperties());
|
||||
|
||||
// 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
|
||||
Map<String, Object> idMap = _configuration.getIdMap();
|
||||
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));
|
||||
}
|
||||
}
|
||||
}
|
|
@ -1,43 +0,0 @@
|
|||
//
|
||||
// ========================================================================
|
||||
// Copyright (c) 1995-2020 Mort Bay Consulting Pty Ltd and others.
|
||||
//
|
||||
// This program and the accompanying materials are made available under
|
||||
// the terms of the Eclipse Public License 2.0 which is available at
|
||||
// https://www.eclipse.org/legal/epl-2.0
|
||||
//
|
||||
// This Source Code may also be made available under the following
|
||||
// Secondary Licenses when the conditions for such availability set
|
||||
// forth in the Eclipse Public License, v. 2.0 are satisfied:
|
||||
// the Apache License v2.0 which is available at
|
||||
// https://www.apache.org/licenses/LICENSE-2.0
|
||||
//
|
||||
// SPDX-License-Identifier: EPL-2.0 OR Apache-2.0
|
||||
// ========================================================================
|
||||
//
|
||||
|
||||
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 java.util.ServiceLoader} for {@link ConfigurationProcessorFactory}.
|
||||
*
|
||||
* @see SpringConfigurationProcessor
|
||||
* @see XmlConfiguration
|
||||
*/
|
||||
public class SpringConfigurationProcessorFactory implements ConfigurationProcessorFactory
|
||||
{
|
||||
@Override
|
||||
public ConfigurationProcessor getConfigurationProcessor(String dtd, String tag)
|
||||
{
|
||||
if ("beans".equals(tag))
|
||||
return new SpringConfigurationProcessor();
|
||||
return null;
|
||||
}
|
||||
}
|
|
@ -1,23 +0,0 @@
|
|||
//
|
||||
// ========================================================================
|
||||
// Copyright (c) 1995-2020 Mort Bay Consulting Pty Ltd and others.
|
||||
//
|
||||
// This program and the accompanying materials are made available under
|
||||
// the terms of the Eclipse Public License 2.0 which is available at
|
||||
// https://www.eclipse.org/legal/epl-2.0
|
||||
//
|
||||
// This Source Code may also be made available under the following
|
||||
// Secondary Licenses when the conditions for such availability set
|
||||
// forth in the Eclipse Public License, v. 2.0 are satisfied:
|
||||
// the Apache License v2.0 which is available at
|
||||
// https://www.apache.org/licenses/LICENSE-2.0
|
||||
//
|
||||
// SPDX-License-Identifier: EPL-2.0 OR Apache-2.0
|
||||
// ========================================================================
|
||||
//
|
||||
|
||||
/**
|
||||
* Jetty Spring : Spring IoC Configuration for Jetty
|
||||
*/
|
||||
package org.eclipse.jetty.spring;
|
||||
|
|
@ -1 +0,0 @@
|
|||
org.eclipse.jetty.spring.SpringConfigurationProcessorFactory
|
|
@ -1,163 +0,0 @@
|
|||
//
|
||||
// ========================================================================
|
||||
// Copyright (c) 1995-2020 Mort Bay Consulting Pty Ltd and others.
|
||||
//
|
||||
// This program and the accompanying materials are made available under
|
||||
// the terms of the Eclipse Public License 2.0 which is available at
|
||||
// https://www.eclipse.org/legal/epl-2.0
|
||||
//
|
||||
// This Source Code may also be made available under the following
|
||||
// Secondary Licenses when the conditions for such availability set
|
||||
// forth in the Eclipse Public License, v. 2.0 are satisfied:
|
||||
// the Apache License v2.0 which is available at
|
||||
// https://www.apache.org/licenses/LICENSE-2.0
|
||||
//
|
||||
// SPDX-License-Identifier: EPL-2.0 OR Apache-2.0
|
||||
// ========================================================================
|
||||
//
|
||||
|
||||
package org.eclipse.jetty.spring;
|
||||
|
||||
import java.net.URL;
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
import java.util.concurrent.atomic.AtomicInteger;
|
||||
import java.util.regex.Matcher;
|
||||
import java.util.regex.Pattern;
|
||||
|
||||
import org.eclipse.jetty.server.Server;
|
||||
import org.eclipse.jetty.util.resource.Resource;
|
||||
import org.eclipse.jetty.xml.XmlConfiguration;
|
||||
import org.junit.jupiter.api.BeforeEach;
|
||||
import org.junit.jupiter.api.Test;
|
||||
|
||||
import static org.junit.jupiter.api.Assertions.assertEquals;
|
||||
import static org.junit.jupiter.api.Assumptions.assumeTrue;
|
||||
|
||||
public class SpringXmlConfigurationTest
|
||||
{
|
||||
protected String _configure = "org/eclipse/jetty/spring/configure.xml";
|
||||
|
||||
@BeforeEach
|
||||
public void init()
|
||||
{
|
||||
// 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);
|
||||
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(Resource.newResource(url));
|
||||
|
||||
Map<String, String> properties = new HashMap<>();
|
||||
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
|
||||
{
|
||||
final String newDefaultValue = "NEW DEFAULT";
|
||||
TestConfiguration.VALUE = 71;
|
||||
|
||||
URL url = SpringXmlConfigurationTest.class.getClassLoader().getResource(_configure);
|
||||
final AtomicInteger count = new AtomicInteger(0);
|
||||
XmlConfiguration configuration = new XmlConfiguration(Resource.newResource(url))
|
||||
{
|
||||
@Override
|
||||
public void initializeDefaults(Object object)
|
||||
{
|
||||
super.initializeDefaults(object);
|
||||
if (object instanceof TestConfiguration)
|
||||
{
|
||||
count.incrementAndGet();
|
||||
((TestConfiguration)object).setTestString0(newDefaultValue);
|
||||
((TestConfiguration)object).setTestString1("WILL BE OVERRIDDEN");
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
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(3, count.get());
|
||||
|
||||
assertEquals(newDefaultValue, tc.getTestString0());
|
||||
assertEquals(-1, tc.getTestInt0());
|
||||
assertEquals("SetValue", tc.getTestString1());
|
||||
assertEquals(1, tc.getTestInt1());
|
||||
|
||||
assertEquals(newDefaultValue, tc.getNested().getTestString0());
|
||||
assertEquals("nested", tc.getNested().getTestString1());
|
||||
assertEquals(newDefaultValue, 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/eclipse/jetty/spring/jetty.xml");
|
||||
XmlConfiguration configuration = new XmlConfiguration(Resource.newResource(url));
|
||||
|
||||
Server server = (Server)configuration.configure();
|
||||
|
||||
server.dumpStdErr();
|
||||
}
|
||||
|
||||
@Test
|
||||
public void xmlConfigurationMain() throws Exception
|
||||
{
|
||||
XmlConfiguration.main("src/test/resources/org/eclipse/jetty/spring/jetty.xml");
|
||||
}
|
||||
}
|
|
@ -1,154 +0,0 @@
|
|||
//
|
||||
// ========================================================================
|
||||
// Copyright (c) 1995-2020 Mort Bay Consulting Pty Ltd and others.
|
||||
//
|
||||
// This program and the accompanying materials are made available under
|
||||
// the terms of the Eclipse Public License 2.0 which is available at
|
||||
// https://www.eclipse.org/legal/epl-2.0
|
||||
//
|
||||
// This Source Code may also be made available under the following
|
||||
// Secondary Licenses when the conditions for such availability set
|
||||
// forth in the Eclipse Public License, v. 2.0 are satisfied:
|
||||
// the Apache License v2.0 which is available at
|
||||
// https://www.apache.org/licenses/LICENSE-2.0
|
||||
//
|
||||
// SPDX-License-Identifier: EPL-2.0 OR Apache-2.0
|
||||
// ========================================================================
|
||||
//
|
||||
|
||||
package org.eclipse.jetty.spring;
|
||||
|
||||
import java.net.URL;
|
||||
|
||||
import org.junit.jupiter.api.Disabled;
|
||||
|
||||
@Disabled
|
||||
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;
|
||||
}
|
||||
}
|
|
@ -1,34 +0,0 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<beans xmlns="http://www.springframework.org/schema/beans"
|
||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd">
|
||||
|
||||
<!-- 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" class="org.springframework.beans.factory.config.MethodInvokingFactoryBean">
|
||||
<property name="targetObject"><ref bean="properties" /></property>
|
||||
<property name="targetMethod" value="get" />
|
||||
<property name="arguments"><list><value>test</value></list></property>
|
||||
</bean>
|
||||
|
||||
<bean id="root" name="Some,Names,Main" class="org.eclipse.jetty.spring.TestConfiguration">
|
||||
<property name="testString1" value="SetValue" />
|
||||
<property name="testInt1" value="1" />
|
||||
<property name="nested" ref="nested" />
|
||||
<property name="testString2" ref="testProperty"/>
|
||||
</bean>
|
||||
|
||||
<bean id="nested" class="org.eclipse.jetty.spring.TestConfiguration">
|
||||
<property name="testInt2" value="2" />
|
||||
<property name="testString1" value="nested" />
|
||||
<property name="nested" ref="nestedDeep" />
|
||||
</bean>
|
||||
|
||||
<bean id="nestedDeep" class="org.eclipse.jetty.spring.TestConfiguration">
|
||||
<property name="testString1" value="deep" />
|
||||
<property name="testInt2" value="2" />
|
||||
</bean>
|
||||
|
||||
</beans>
|
|
@ -1,40 +0,0 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<beans xmlns="http://www.springframework.org/schema/beans"
|
||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd">
|
||||
|
||||
<bean id="contexts" class="org.eclipse.jetty.server.handler.ContextHandlerCollection"/>
|
||||
<bean id="server" name="Main" class="org.eclipse.jetty.server.Server">
|
||||
<constructor-arg type="org.eclipse.jetty.util.thread.ThreadPool">
|
||||
<bean id="threadPool" class="org.eclipse.jetty.util.thread.QueuedThreadPool">
|
||||
<property name="minThreads" value="10"/>
|
||||
<property name="maxThreads" value="200"/>
|
||||
</bean>
|
||||
</constructor-arg>
|
||||
|
||||
<property name="connectors">
|
||||
<list>
|
||||
<bean id="connector" class="org.eclipse.jetty.server.ServerConnector">
|
||||
<constructor-arg type="org.eclipse.jetty.server.Server" ref="server" />
|
||||
</bean>
|
||||
</list>
|
||||
</property>
|
||||
|
||||
<property name="handler">
|
||||
<bean id="handlers" class="org.eclipse.jetty.server.handler.HandlerList">
|
||||
<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="stopTimeout" value="1000"/>
|
||||
<property name="dumpAfterStart" value="true"/>
|
||||
<property name="dumpBeforeStop" value="false"/>
|
||||
|
||||
</bean>
|
||||
</beans>
|
40
pom.xml
40
pom.xml
|
@ -126,7 +126,6 @@
|
|||
<module>jetty-jndi</module>
|
||||
<module>jetty-jaas</module>
|
||||
<module>jetty-cdi</module>
|
||||
<module>jetty-spring</module>
|
||||
<module>jetty-client</module>
|
||||
<module>jetty-proxy</module>
|
||||
<module>jetty-jaspi</module>
|
||||
|
@ -734,6 +733,45 @@
|
|||
<groupId>org.asciidoctor</groupId>
|
||||
<artifactId>asciidoctor-maven-plugin</artifactId>
|
||||
<version>2.1.0</version>
|
||||
<dependencies>
|
||||
<dependency>
|
||||
<groupId>org.asciidoctor</groupId>
|
||||
<artifactId>asciidoctorj-diagram</artifactId>
|
||||
<version>2.0.5</version>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
<configuration>
|
||||
<backend>html5</backend>
|
||||
<requires>
|
||||
<require>asciidoctor-diagram</require>
|
||||
</requires>
|
||||
<attributes>
|
||||
<JDURL>http://www.eclipse.org/jetty/javadoc/${project.version}</JDURL>
|
||||
<JXURL>http://download.eclipse.org/jetty/stable-9/xref</JXURL>
|
||||
<SRCDIR>${basedir}/..</SRCDIR>
|
||||
<GITBROWSEURL>https://github.com/eclipse/jetty.project/tree/jetty-9.4.x</GITBROWSEURL>
|
||||
<GITDOCURL>https://github.com/eclipse/jetty.project/tree/jetty-10.0.x-doc-refactor/jetty-documentation/src/main/asciidoc</GITDOCURL>
|
||||
<MVNCENTRAL>http://central.maven.org/maven2</MVNCENTRAL>
|
||||
<VERSION>${project.version}</VERSION>
|
||||
<TIMESTAMP>${maven.build.timestamp}</TIMESTAMP>
|
||||
<toc>left</toc>
|
||||
<icons>font</icons>
|
||||
</attributes>
|
||||
</configuration>
|
||||
<executions>
|
||||
<execution>
|
||||
<id>index</id>
|
||||
<phase>generate-resources</phase>
|
||||
<goals>
|
||||
<goal>process-asciidoc</goal>
|
||||
</goals>
|
||||
<configuration>
|
||||
<sourceDirectory>src/main/asciidoc</sourceDirectory>
|
||||
<sourceDocumentName>index.adoc</sourceDocumentName>
|
||||
<outputDirectory>${project.build.directory}/html</outputDirectory>
|
||||
</configuration>
|
||||
</execution>
|
||||
</executions>
|
||||
</plugin>
|
||||
<plugin>
|
||||
<groupId>org.codehaus.mojo</groupId>
|
||||
|
|
|
@ -90,7 +90,7 @@ public class HttpInputIntegrationTest
|
|||
__server.addConnector(local);
|
||||
|
||||
ServerConnector http = new ServerConnector(__server, new HttpConnectionFactory(__config), new HTTP2CServerConnectionFactory(__config));
|
||||
http.setIdleTimeout(4000);
|
||||
http.setIdleTimeout(5000);
|
||||
__server.addConnector(http);
|
||||
|
||||
// SSL Context Factory for HTTPS and HTTP/2
|
||||
|
@ -119,7 +119,7 @@ public class HttpInputIntegrationTest
|
|||
|
||||
// HTTP/2 Connector
|
||||
ServerConnector http2 = new ServerConnector(__server, ssl,/*TODO alpn,h2,*/ h1);
|
||||
http2.setIdleTimeout(4000);
|
||||
http2.setIdleTimeout(5000);
|
||||
__server.addConnector(http2);
|
||||
|
||||
ServletContextHandler context = new ServletContextHandler(__server, "/ctx");
|
||||
|
@ -336,7 +336,7 @@ public class HttpInputIntegrationTest
|
|||
|
||||
for (int i = 0; i < threads; i++)
|
||||
{
|
||||
t[i] = new Thread(run);
|
||||
t[i] = new Thread(run, "client-" + i);
|
||||
t[i].start();
|
||||
}
|
||||
for (int i = 0; i < threads; i++)
|
||||
|
|
Loading…
Reference in New Issue