<?xml version="1.0" encoding="UTF-8"?>
<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">
<modelVersion>4.0.0</modelVersion>
<prerequisites>
<maven>3.0.0</maven>
</prerequisites>
<groupId>practice</groupId>
<artifactId>dwtest</artifactId>
<version>1.0-SNAPSHOT</version>
<packaging>jar</packaging>
<name>dw</name>
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
<dropwizard.version>1.0.6</dropwizard.version>
<mainClass>practice.dwApplication</mainClass>
</properties>
<dependencyManagement>
<dependencies>
<dependency>
<groupId>io.dropwizard</groupId>
<artifactId>dropwizard-bom</artifactId>
<version>${dropwizard.version}</version>
<type>pom</type>
<scope>import</scope>
</dependency>
</dependencies>
</dependencyManagement>
<dependencies>
<dependency>
<groupId>io.dropwizard</groupId>
<artifactId>dropwizard-core</artifactId>
</dependency>
<dependency>
<groupId>io.dropwizard</groupId>
<artifactId>dropwizard-http2</artifactId>
</dependency>
</dependencies>
<!-- Note that more content goes here, but I decided to hide it for simplicity -->
</project>
logging:
level: INFO
loggers:
practice: DEBUG
server:
applicationConnectors:
- type: h2c
port: 8446
maxConcurrentStreams: 1024
initialStreamRecvWindow: 65535
public static void main(final String[] args) throws Exception {
new dwApplication().run(args);
}
@Override
public String getName() {
return "dw";
}
@Override
public void initialize(final Bootstrap<dwConfiguration> bootstrap) {
// TODO: application initialization
}
@Override
public void run(final dwConfiguration configuration,
final Environment environment) {
final HelloWorldResource resource = new HelloWorldResource();
environment.jersey().register(resource);
}
@Path("/hello-world")
@Produces(MediaType.APPLICATION_JSON)
public class HelloWorldResource {
private final AtomicLong counter;
public HelloWorldResource() {
this.counter = new AtomicLong();
}
@GET
public String sayHello(@QueryParam("name") Optional<String> name) {
return "dummy-test";
}
}
curl -I --http2 http://localhost:8446/hello-worldHTTP/1.1 101 Switching Protocols
HTTP/2 200
date: Tue, 07 Feb 2017 04:13:37 GMT
content-length: 10
content-type: application/jsonAnd the logs of my dw instance display:
0:0:0:0:0:0:0:1 - - [07/Feb/2017:04:13:38 +0000] "HEAD /hello-world HTTP/1.1" 200 0 "-" "curl/7.52.1" 77So the questions are:
1- Is the request handled as HTTP/2? I'm inclined to say no, based on the logs, but figured it is better to ask
2- Is there any missing configuration in my setup?
3- Is the request I'm issuing to the server wrong?
Thanks in advance
1- Is the request handled as HTTP/2? I'm inclined to say no, based on the logs, but figured it is better to ask