Skip to content

Commit

Permalink
Updated GF, Jetty, Mimepull, Moxy, Yasson dependencies (eclipse-ee4j#…
Browse files Browse the repository at this point in the history
…4425)

* Updated GF, Jetty, Mimepull, Moxy, Yasson dependencies

Signed-off-by: Jan Supol <jan.supol@oracle.com>
  • Loading branch information
jansupol authored and senivam committed Apr 24, 2020
1 parent ea32073 commit ff8b2bb
Show file tree
Hide file tree
Showing 9 changed files with 253 additions and 32 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,8 @@

import java.io.IOException;
import java.io.OutputStream;
import java.lang.reflect.InvocationTargetException;
import java.lang.reflect.Method;
import java.lang.reflect.Type;
import java.net.URI;
import java.net.URISyntaxException;
Expand Down Expand Up @@ -323,7 +325,7 @@ public void setSuspendTimeout(final long timeOut, final TimeUnit timeUnit) throw
@Override
public void commit() {
try {
response.closeOutput();
closeOutput(response);
} catch (final IOException e) {
LOGGER.log(Level.WARNING, LocalizationMessages.UNABLE_TO_CLOSE_RESPONSE(), e);
} finally {
Expand All @@ -334,6 +336,22 @@ public void commit() {
}
}

private void closeOutput(Response response) throws IOException {
try {
response.completeOutput();
} catch (final IOException e) {
throw e;
} catch (NoSuchMethodError e) {
// try older Jetty Response#closeOutput
try {
Method method = response.getClass().getMethod("closeOutput");
method.invoke(response);
} catch (NoSuchMethodException | InvocationTargetException | IllegalAccessException ex) {
throw new IOException(ex);
}
}
}

@Override
public void failure(final Throwable error) {
try {
Expand Down
63 changes: 36 additions & 27 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -1953,6 +1953,12 @@
<version>4.12</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.junit.jupiter</groupId>
<artifactId>junit-jupiter-engine</artifactId>
<version>${junit5.version}</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.testng</groupId>
<artifactId>testng</artifactId>
Expand Down Expand Up @@ -2073,7 +2079,6 @@
<checkstyle.version>8.28</checkstyle.version>
<easymock.version>3.3</easymock.version>
<ejb.version>3.2.5</ejb.version>
<gf.impl.version>5.1.0-RC2</gf.impl.version>
<fasterxml.classmate.version>1.3.3</fasterxml.classmate.version>
<findbugs.glassfish.version>1.7</findbugs.glassfish.version>
<findbugs.version>3.0.4</findbugs.version>
Expand All @@ -2090,45 +2095,21 @@
<hk2.jvnet.osgi.version>org.jvnet.hk2.*;version="[2.5,4)"</hk2.jvnet.osgi.version>
<hk2.config.version>5.1.0</hk2.config.version>
<httpclient.version>4.5.9</httpclient.version>
<istack.commons.runtime.version>3.0.8</istack.commons.runtime.version>
<jackson.version>2.10.1</jackson.version>
<jackson1.version>1.9.13</jackson1.version>
<jakarta.activation-api.version>2.0.0-RC3</jakarta.activation-api.version>
<jakarta.activation.version>2.0.0-RC3</jakarta.activation.version>
<javassist.version>3.25.0-GA</javassist.version>
<javax.annotation.osgi.version>javax.annotation.*;version="[1.2,3)"</javax.annotation.osgi.version>
<jakarta.annotation.osgi.version>jakarta.annotation.*;version="[1.2,3)"</jakarta.annotation.osgi.version>
<jakarta.annotation.version>2.0.0-RC1</jakarta.annotation.version>
<javax.annotation.version>1.3.5</javax.annotation.version>
<javax.el.version>3.0.3</javax.el.version>
<javax.el.impl.version>3.0.2</javax.el.impl.version>
<javax.interceptor.version>1.2.5</javax.interceptor.version>
<javax.persistence.version>2.2.3</javax.persistence.version>
<javax.validation.api.version>2.0.2</javax.validation.api.version>
<jaxb.api.version>3.0.0-RC2</jaxb.api.version>
<javax.jaxb.api.version>2.3.2</javax.jaxb.api.version>
<jaxb.ri.version>3.0.0-M1</jaxb.ri.version>
<jsonb.api.version>1.0.2</jsonb.api.version>
<jaxrs.api.spec.version>3.0</jaxrs.api.spec.version>
<jaxrs.api.impl.version>3.0.0-M1</jaxrs.api.impl.version>
<jboss.logging.version>3.3.0.Final</jboss.logging.version>
<jersey1.version>1.19.3</jersey1.version>
<jersey1.last.final.version>${jersey1.version}</jersey1.last.final.version>
<jettison.version>1.3.7</jettison.version> <!-- TODO: 1.3.8 doesn't work; AbstractJsonTest complexBeanWithAttributes -->
<jetty.plugin.version>6.1.26</jetty.plugin.version>
<jetty.version>9.4.17.v20190418</jetty.version>
<jetty.servlet.api.25.version>6.1.14</jetty.servlet.api.25.version>
<jmh.version>1.10.2</jmh.version>
<jmockit.version>1.44</jmockit.version>
<jsonp.ri.version>1.1.5</jsonp.ri.version>
<jsonp.jaxrs.version>1.1.5</jsonp.jaxrs.version>
<jsp.version>2.3.6</jsp.version>
<jstl.version>1.2.7</jstl.version>
<jta.api.version>1.3.3</jta.api.version>
<junit5.version>5.6.0</junit5.version>
<kryo.version>4.0.1</kryo.version>
<mimepull.version>1.9.11</mimepull.version>
<mockito.version>1.10.19</mockito.version>
<moxy.version>2.7.4</moxy.version>
<mustache.version>0.8.17</mustache.version>
<netty.version>4.1.43.Final</netty.version>
<nexus-staging.mvn.plugin.version>1.6.7</nexus-staging.mvn.plugin.version>
Expand All @@ -2153,6 +2134,34 @@
<weld.version>2.2.14.Final</weld.version> <!-- 2.4.1 doesn't work - bv tests -->
<weld3.version>3.0.0.Final</weld3.version>
<xerces.version>2.11.0</xerces.version>
<yasson.version>1.0.3</yasson.version>

<!-- do not need CQs -->
<gf.impl.version>5.1.0</gf.impl.version>
<istack.commons.runtime.version>3.0.8</istack.commons.runtime.version>
<jakarta.activation-api.version>2.0.0-RC3</jakarta.activation-api.version>
<jakarta.activation.version>2.0.0-RC3</jakarta.activation.version>
<javax.el.version>3.0.3</javax.el.version>
<javax.el.impl.version>3.0.3</javax.el.impl.version>
<javax.annotation.osgi.version>javax.annotation.*;version="[1.2,3)"</javax.annotation.osgi.version>
<jakarta.annotation.osgi.version>jakarta.annotation.*;version="[1.2,3)"</jakarta.annotation.osgi.version>
<jakarta.annotation.version>2.0.0-RC1</jakarta.annotation.version>
<javax.annotation.version>1.3.5</javax.annotation.version>
<javax.interceptor.version>1.2.5</javax.interceptor.version>
<javax.persistence.version>2.2.3</javax.persistence.version>
<javax.validation.api.version>2.0.2</javax.validation.api.version>
<jaxb.api.version>3.0.0-RC2</jaxb.api.version>
<javax.jaxb.api.version>2.3.2</javax.jaxb.api.version>
<jaxb.ri.version>3.0.0-M1</jaxb.ri.version>
<jaxrs.api.spec.version>3.0</jaxrs.api.spec.version>
<jaxrs.api.impl.version>3.0.0-M1</jaxrs.api.impl.version>
<jetty.plugin.version>6.1.26</jetty.plugin.version>
<jetty.version>9.4.27.v20200227</jetty.version>
<jetty.servlet.api.25.version>6.1.14</jetty.servlet.api.25.version>
<jsonb.api.version>1.0.2</jsonb.api.version>
<jsonp.ri.version>1.1.6</jsonp.ri.version>
<jsonp.jaxrs.version>1.1.6</jsonp.jaxrs.version>
<mimepull.version>1.9.13</mimepull.version>
<moxy.version>2.7.6</moxy.version>
<yasson.version>1.0.6</yasson.version>
</properties>
</project>
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ public boolean equals(Object obj) {
public int hashCode() {
int hash = 3;
hash = 19 * hash + (this.a1 != null ? this.a1.hashCode() : 0);
hash = 19 * hash + this.a2;
hash = 19 * hash + (this.a2 != null ? this.a2.hashCode() : 0);
hash = 19 * hash + (this.b != null ? this.b.hashCode() : 0);
hash = 19 * hash + (this.filler1 != null ? this.filler1.hashCode() : 0);
hash = 19 * hash + (this.filler2 != null ? this.filler2.hashCode() : 0);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,9 @@ public int hashCode() {
if (null != uri) {
hash += 17 * uri.hashCode();
}
hash += 13 * i;
if (null != i) {
hash += 13 * i;
}
return hash;
}

Expand Down
62 changes: 62 additions & 0 deletions tests/integration/jetty-response-close/pom.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
<?xml version="1.0" encoding="UTF-8"?>
<!--
Copyright (c) 2020 Oracle and/or its affiliates. All rights reserved.
This program and the accompanying materials are made available under the
terms of the Eclipse Public License v. 2.0, which is available at
http://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: GNU General Public License,
version 2 with the GNU Classpath Exception, which is available at
https://www.gnu.org/software/classpath/license.html.
SPDX-License-Identifier: EPL-2.0 OR GPL-2.0 WITH Classpath-exception-2.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/xsd/maven-4.0.0.xsd">
<parent>
<artifactId>project</artifactId>
<groupId>org.glassfish.jersey.tests.integration</groupId>
<version>2.31-SNAPSHOT</version>
</parent>
<modelVersion>4.0.0</modelVersion>

<artifactId>jetty-response-close</artifactId>

<dependencies>
<dependency>
<groupId>org.glassfish.jersey.containers</groupId>
<artifactId>jersey-container-jetty-http</artifactId>
<version>${project.version}</version>
<scope>test</scope>
<exclusions>
<exclusion>
<groupId>org.eclipse.jetty</groupId>
<artifactId>jetty-server</artifactId>
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>org.eclipse.jetty</groupId>
<artifactId>jetty-server</artifactId>
<!-- Test Backward compatibility with this version -->
<version>9.4.17.v20190418</version>
</dependency>

<dependency>
<groupId>org.junit.jupiter</groupId>
<artifactId>junit-jupiter-engine</artifactId>
<scope>test</scope>
</dependency>
</dependencies>

<properties>
<surefire.security.argline>-Djava.security.manager -Djava.security.policy=${project.build.directory}/test-classes/surefire.policy</surefire.security.argline>
</properties>

</project>
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
/*
* Copyright (c) 2020 Oracle and/or its affiliates. All rights reserved.
*
* This program and the accompanying materials are made available under the
* terms of the Eclipse Public License v. 2.0, which is available at
* http://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: GNU General Public License,
* version 2 with the GNU Classpath Exception, which is available at
* https://www.gnu.org/software/classpath/license.html.
*
* SPDX-License-Identifier: EPL-2.0 OR GPL-2.0 WITH Classpath-exception-2.0
*/

package org.glassfish.jersey.tests.jettyresponseclose;

import javax.ws.rs.GET;
import javax.ws.rs.Path;

@Path("/")
public class Resource {
@GET
public String get() {
return Resource.class.getName();
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
/*
* Copyright (c) 2020 Oracle and/or its affiliates. All rights reserved.
*
* This program and the accompanying materials are made available under the
* terms of the Eclipse Public License v. 2.0, which is available at
* http://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: GNU General Public License,
* version 2 with the GNU Classpath Exception, which is available at
* https://www.gnu.org/software/classpath/license.html.
*
* SPDX-License-Identifier: EPL-2.0 OR GPL-2.0 WITH Classpath-exception-2.0
*/

package org.glassfish.jersey.tests.jettyresponseclose;

import org.eclipse.jetty.server.Server;
import org.glassfish.jersey.jetty.JettyHttpContainer;
import org.glassfish.jersey.jetty.JettyHttpContainerFactory;
import org.glassfish.jersey.server.ResourceConfig;
import org.junit.jupiter.api.AfterAll;
import org.junit.jupiter.api.Assertions;
import org.junit.jupiter.api.BeforeAll;
import org.junit.jupiter.api.Test;

import javax.ws.rs.client.ClientBuilder;
import javax.ws.rs.core.Response;
import java.net.URI;

public class JettyHttpContainerCloseTest {

private static Server server;
private static JettyHttpContainer container;
private static final String URL = "http://localhost:9080";

@BeforeAll
public static void setup() {
server = JettyHttpContainerFactory.createServer(URI.create(URL),
new ResourceConfig(Resource.class));
container = (JettyHttpContainer) server.getHandler();
}

@AfterAll
public static void teardown() throws Exception {
container.doStop();
}

@Test
public void testResponseClose() {
try (Response response = ClientBuilder.newClient().target(URL).request().get()) {
Assertions.assertEquals(200, response.getStatus());
Assertions.assertEquals(Resource.class.getName(), response.readEntity(String.class));

}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
/*
* Copyright (c) 2020 Oracle and/or its affiliates. All rights reserved.
*
* This program and the accompanying materials are made available under the
* terms of the Eclipse Public License v. 2.0, which is available at
* http://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: GNU General Public License,
* version 2 with the GNU Classpath Exception, which is available at
* https://www.gnu.org/software/classpath/license.html.
*
* SPDX-License-Identifier: EPL-2.0 OR GPL-2.0 WITH Classpath-exception-2.0
*/

// we do not care about java lib itself
grant codebase "file:${java.home}/-" {
permission java.security.AllPermission;
};

// we do not care about our dependencies
grant codebase "file:${settings.localRepository}/-" {
permission java.security.AllPermission;
};

grant codebase "file:${user.home}/-" {
permission java.io.FilePermission "<<ALL FILES>>", "read";
};

grant {
permission java.lang.management.ManagementPermission "monitor";
permission java.util.PropertyPermission "*", "read, write";
permission java.util.logging.LoggingPermission "control";
permission java.lang.RuntimePermission "setIO";
permission java.lang.reflect.ReflectPermission "suppressAccessChecks";

permission java.lang.RuntimePermission "accessDeclaredMembers";
permission java.lang.RuntimePermission "modifyThread";
permission java.io.FilePermission "<<ALL FILES>>", "read";

permission java.lang.RuntimePermission "getenv.JETTY_AVAILABLE_PROCESSORS";
permission java.net.SocketPermission "localhost", "accept,connect,listen,resolve";
permission java.lang.RuntimePermission "setContextClassLoader";
};
3 changes: 1 addition & 2 deletions tests/integration/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -84,8 +84,7 @@
<module>jersey-3992</module>
<module>jersey-4099</module>
<module>jersey-4321</module>
<!-- <module>portability-jersey-1</module>-->
<!-- <module>portability-jersey-2</module>-->
<module>jetty-response-close</module>
<module>microprofile</module>
<module>portability-jersey-1</module>
<module>portability-jersey-2</module>
Expand Down

0 comments on commit ff8b2bb

Please sign in to comment.