Switched to jersey 2.3.5 due to jakarta being shit

master
Edward M. Kagan 4 years ago
parent 82d5d46fb3
commit 687cd0d4fb

@ -8,7 +8,7 @@ import org.apache.cxf.jaxrs.JAXRSServerFactoryBean;
public class Bench {
public static final String BASE_URI = "http://localhost:8080";
public static final String BASE_URI = "http://0.0.0.0:8080";
public static void main(String[] args) throws IOException, InterruptedException {
JAXRSServerFactoryBean factoryBean = new JAXRSServerFactoryBean();

@ -8,7 +8,7 @@ import org.apache.cxf.jaxrs.JAXRSServerFactoryBean;
public class Bench {
public static final String BASE_URI = "http://localhost:8080";
public static final String BASE_URI = "http://0.0.0.0:8080";
public static void main(String[] args) throws IOException, InterruptedException {
JAXRSServerFactoryBean factoryBean = new JAXRSServerFactoryBean();

@ -8,7 +8,7 @@ import org.apache.cxf.jaxrs.JAXRSServerFactoryBean;
public class Bench {
public static final String BASE_URI = "http://localhost:8080";
public static final String BASE_URI = "http://0.0.0.0:8080";
public static void main(String[] args) throws IOException, InterruptedException {
JAXRSServerFactoryBean factoryBean = new JAXRSServerFactoryBean();

@ -1,17 +1,16 @@
package twopm.tech.bench.jaxrs;
import jakarta.ws.rs.GET;
import jakarta.ws.rs.POST;
import jakarta.ws.rs.Path;
import jakarta.ws.rs.PathParam;
import jakarta.ws.rs.Produces;
import jakarta.ws.rs.core.MediaType;
import javax.ws.rs.GET;
import javax.ws.rs.POST;
import javax.ws.rs.Path;
import javax.ws.rs.PathParam;
import javax.ws.rs.Produces;
import javax.ws.rs.core.MediaType;
@Path("/test")
public class TestResource {
@GET
@Path("/")
@Produces(MediaType.APPLICATION_JSON)
public String index() {
return "{ \"status\" : \"OK\", \"method\" : \"GET\" }";

@ -1,33 +1,31 @@
package twopm.tech.bench.jaxrs;
import jakarta.ws.rs.GET;
import jakarta.ws.rs.POST;
import jakarta.ws.rs.Path;
import jakarta.ws.rs.PathParam;
import jakarta.ws.rs.Produces;
import javax.ws.rs.GET;
import javax.ws.rs.POST;
import javax.ws.rs.Path;
import javax.ws.rs.PathParam;
import javax.ws.rs.Produces;
import javax.ws.rs.core.MediaType;
@Path("test")
@Path("/test")
public class TestResource {
@GET
// @Path("/")
@Produces("application/json")
@Produces(MediaType.APPLICATION_JSON)
public String index() {
return "{ \"status\" : \"OK\", \"method\" : \"GET\" }";
}
@GET
@Path("{id}")
@Produces("application/json")
@Path("/{id}")
@Produces(MediaType.APPLICATION_JSON)
public String get(@PathParam("id") Long id) {
return "{ \"status\" : \"OK\", \"method\" : \"GET\", \"test\" : " + String.valueOf(id) + " }";
}
@POST
@Path("{id}")
@Produces("application/json")
@Path("/{id}")
@Produces(MediaType.APPLICATION_JSON)
public String post(@PathParam("id") Long id) {
return "{ \"status\" : \"OK\", \"method\" : \"POST\", \"test\" : " + String.valueOf(id) + " }";
}

@ -20,14 +20,18 @@
<artifactId>jersey-hk2</artifactId>
<version>${jersey.version}</version>
</dependency>
<dependency>
<groupId>jakarta.servlet</groupId>
<artifactId>jakarta.servlet-api</artifactId>
<version>${jakarta.servlet-api.version}</version>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.8.1</version>
<configuration>
<source>11</source>
<target>11</target>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-shade-plugin</artifactId>

@ -1,6 +1,5 @@
package twopm.tech.bench.jaxrs;
import com.sun.net.httpserver.HttpServer;
import java.io.IOException;
import java.net.URI;
import java.util.logging.Level;

@ -1,17 +1,16 @@
package twopm.tech.bench.jaxrs;
import jakarta.ws.rs.GET;
import jakarta.ws.rs.POST;
import jakarta.ws.rs.Path;
import jakarta.ws.rs.PathParam;
import jakarta.ws.rs.Produces;
import jakarta.ws.rs.core.MediaType;
import javax.ws.rs.GET;
import javax.ws.rs.POST;
import javax.ws.rs.Path;
import javax.ws.rs.PathParam;
import javax.ws.rs.Produces;
import javax.ws.rs.core.MediaType;
@Path("/test")
public class TestResource {
@GET
@Path("/")
@Produces(MediaType.APPLICATION_JSON)
public String index() {
return "{ \"status\" : \"OK\", \"method\" : \"GET\" }";

@ -1,17 +1,16 @@
package twopm.tech.bench.jaxrs;
import jakarta.ws.rs.GET;
import jakarta.ws.rs.POST;
import jakarta.ws.rs.Path;
import jakarta.ws.rs.PathParam;
import jakarta.ws.rs.Produces;
import jakarta.ws.rs.core.MediaType;
import javax.ws.rs.GET;
import javax.ws.rs.POST;
import javax.ws.rs.Path;
import javax.ws.rs.PathParam;
import javax.ws.rs.Produces;
import javax.ws.rs.core.MediaType;
@Path("/test")
public class TestResource {
@GET
@Path("/")
@Produces(MediaType.APPLICATION_JSON)
public String index() {
return "{ \"status\" : \"OK\", \"method\" : \"GET\" }";

@ -1,17 +1,16 @@
package twopm.tech.bench.jaxrs;
import jakarta.ws.rs.GET;
import jakarta.ws.rs.POST;
import jakarta.ws.rs.Path;
import jakarta.ws.rs.PathParam;
import jakarta.ws.rs.Produces;
import jakarta.ws.rs.core.MediaType;
import javax.ws.rs.GET;
import javax.ws.rs.POST;
import javax.ws.rs.Path;
import javax.ws.rs.PathParam;
import javax.ws.rs.Produces;
import javax.ws.rs.core.MediaType;
@Path("/test")
public class TestResource {
@GET
@Path("/")
@Produces(MediaType.APPLICATION_JSON)
public String index() {
return "{ \"status\" : \"OK\", \"method\" : \"GET\" }";

@ -1,6 +1,5 @@
package twopm.tech.bench.jaxrs;
import com.sun.net.httpserver.HttpContext;
import com.sun.net.httpserver.HttpServer;
import java.io.IOException;
import java.net.InetSocketAddress;
@ -12,7 +11,6 @@ public class Bench {
HttpServer server = HttpServer.create(new InetSocketAddress(8080), 10);
HttpContextBuilder contextBuilder = new HttpContextBuilder();
contextBuilder.getDeployment().getActualResourceClasses().add(TestResource.class);
HttpContext context = contextBuilder.bind(server);
server.start();
Runtime.getRuntime().addShutdownHook(new Thread(() -> {

Loading…
Cancel
Save