-
Notifications
You must be signed in to change notification settings - Fork 357
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
Browse the repository at this point in the history
…oviders involved not to get 406/415. Signed-off-by: jansupol <jan.supol@oracle.com>
- Loading branch information
Showing
6 changed files
with
199 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,62 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<!-- | ||
Copyright (c) 2021 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.34-SNAPSHOT</version> | ||
</parent> | ||
<modelVersion>4.0.0</modelVersion> | ||
|
||
<description> | ||
Reproducer of JERSEY-4722. | ||
|
||
When jersey-media-jaxb is not on a classpath, the providers for */* media types are not available. | ||
But they are not needed for void return type and/or when no entity argument. | ||
</description> | ||
|
||
<artifactId>jersey-4722</artifactId> | ||
|
||
<dependencies> | ||
<dependency> | ||
<groupId>jakarta.servlet</groupId> | ||
<artifactId>jakarta.servlet-api</artifactId> | ||
<version>${servlet4.version}</version> | ||
</dependency> | ||
|
||
<dependency> | ||
<groupId>org.glassfish.jersey.test-framework.providers</groupId> | ||
<artifactId>jersey-test-framework-provider-grizzly2</artifactId> | ||
<version>${project.version}</version> | ||
<exclusions> | ||
<exclusion> | ||
<groupId>org.glassfish.jersey.media</groupId> | ||
<artifactId>jersey-media-jaxb</artifactId> | ||
</exclusion> | ||
<exclusion> | ||
<groupId>jakarta.xml.bind</groupId> | ||
<artifactId>jakarta.xml.bind-api</artifactId> | ||
</exclusion> | ||
</exclusions> | ||
</dependency> | ||
</dependencies> | ||
|
||
</project> |
29 changes: 29 additions & 0 deletions
29
...4722/src/main/java/org/glassfish/jersey/tests/integration/jersey4722/Application4722.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
/* | ||
* Copyright (c) 2021 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.integration.jersey4722; | ||
|
||
import org.glassfish.jersey.CommonProperties; | ||
import org.glassfish.jersey.server.ResourceConfig; | ||
import org.glassfish.jersey.server.ServerProperties; | ||
|
||
public class Application4722 extends ResourceConfig { | ||
public Application4722() { | ||
register(Resource4722.class); | ||
property(ServerProperties.WADL_FEATURE_DISABLE, true); | ||
property(CommonProperties.PROVIDER_DEFAULT_DISABLE, "ALL"); | ||
} | ||
} |
30 changes: 30 additions & 0 deletions
30
...ey-4722/src/main/java/org/glassfish/jersey/tests/integration/jersey4722/Resource4722.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
/* | ||
* Copyright (c) 2021 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.integration.jersey4722; | ||
|
||
import javax.ws.rs.PUT; | ||
import javax.ws.rs.Path; | ||
import javax.ws.rs.core.Context; | ||
import javax.ws.rs.core.UriInfo; | ||
|
||
@Path("/") | ||
public class Resource4722 { | ||
@PUT | ||
public void test(@Context UriInfo uriInfo) { | ||
// return 204 | ||
} | ||
} |
66 changes: 66 additions & 0 deletions
66
...-4722/src/test/java/org/glassfish/jersey/tests/integration/jersey4722/Jersey4722Test.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,66 @@ | ||
/* | ||
* Copyright (c) 2021 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.integration.jersey4722; | ||
|
||
import org.glassfish.jersey.server.ResourceConfig; | ||
import org.glassfish.jersey.servlet.ServletContainer; | ||
import org.glassfish.jersey.test.DeploymentContext; | ||
import org.glassfish.jersey.test.JerseyTest; | ||
import org.glassfish.jersey.test.ServletDeploymentContext; | ||
import org.glassfish.jersey.test.grizzly.GrizzlyWebTestContainerFactory; | ||
import org.glassfish.jersey.test.spi.TestContainerFactory; | ||
import org.junit.Assert; | ||
import org.junit.Test; | ||
|
||
import javax.ws.rs.client.Entity; | ||
import javax.ws.rs.core.HttpHeaders; | ||
import javax.ws.rs.core.MediaType; | ||
import javax.ws.rs.core.Response; | ||
|
||
public class Jersey4722Test extends JerseyTest { | ||
@Override | ||
protected ResourceConfig configure() { | ||
return new Application4722(); | ||
} | ||
|
||
@Override | ||
protected TestContainerFactory getTestContainerFactory() { | ||
return new GrizzlyWebTestContainerFactory(); | ||
} | ||
|
||
@Override | ||
protected DeploymentContext configureDeployment() { | ||
return ServletDeploymentContext.forServlet(new ServletContainer(configure())).build(); | ||
} | ||
|
||
@Test | ||
public void testDefaultProducesMediaType() { | ||
try (Response response = target().request() | ||
.header(HttpHeaders.ACCEPT, MediaType.APPLICATION_JSON) | ||
.put(Entity.entity("ENTITY", MediaType.TEXT_PLAIN_TYPE))) { | ||
Assert.assertEquals(204, response.getStatus()); | ||
} | ||
} | ||
|
||
@Test | ||
public void testDefaultConsumesMediaType() { | ||
try (Response response = target().request() | ||
.put(Entity.entity("ENTITY", new MediaType("TEST", "TEST415")))) { | ||
Assert.assertEquals(204, response.getStatus()); | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters