Skip to content
Permalink
Browse files
empty jersey container
  • Loading branch information
dspavlov committed Aug 4, 2017
1 parent 49e19f1 commit 0731d53ca434a32f7df9c2e2905c9dd8b4c6fed3
Show file tree
Hide file tree
Showing 5 changed files with 67 additions and 4 deletions.
@@ -22,6 +22,10 @@ dependencies {
def jerseyVer = '2.25.1'
compile group: 'org.glassfish.jersey.containers', name: 'jersey-container-servlet-core', version: jerseyVer

compile group: 'org.glassfish.jersey.core', name: 'jersey-client', version: jerseyVer
compile group: 'org.glassfish.jersey.media', name: 'jersey-media-json-jackson', version: jerseyVer
compile group: 'org.glassfish.jersey.media', name: 'jersey-media-multipart', version: jerseyVer


testCompile group: 'junit', name: 'junit', version: '4.+'
}
@@ -28,10 +28,20 @@ public static void main(String[] args) throws Exception {
Preconditions.checkState(webResDir.exists(),
"Resource directory [" + webResDir.getAbsolutePath() + "] does not exist");

WebAppContext webapp = new WebAppContext();
webapp.setContextPath("/");
webapp.setWar("build/libs/ignite-teamcity-helper.war");
server.setHandler(webapp);
WebAppContext context = new WebAppContext();

boolean dev = true;
if(dev) {
context.setDescriptor(context+"/WEB-INF/web.xml");
context.setResourceBase("./src/main/webapp");
context.setContextPath("/");
context.setParentLoaderPriority(true);
} else {

context.setContextPath("/");
context.setWar("build/libs/ignite-teamcity-helper.war");
}
server.setHandler(context);

System.out.println("Starting server at [" + port + "]");

@@ -0,0 +1,21 @@
package org.apache.ignite.ci.web.rest;

import javax.ws.rs.GET;
import javax.ws.rs.Path;
import javax.ws.rs.PathParam;
import javax.ws.rs.core.Response;

@Path("/hello")
public class Hello {

@GET
@Path("/{param}")
public Response getMsg(@PathParam("param") String msg) {

String output = "Jersey say : " + msg;

return Response.status(200).entity(output).build();

}

}
@@ -0,0 +1,23 @@
<web-app id="TcHelper" version="2.4"
xmlns="http://java.sun.com/xml/ns/j2ee"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee
http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd">
<display-name>Restful Web Application</display-name>

<servlet>
<servlet-name>jersey-serlvet</servlet-name>
<servlet-class>org.glassfish.jersey.servlet.ServletContainer</servlet-class>
<init-param>
<param-name>jersey.config.server.provider.packages</param-name>
<param-value>org.apache.ignite.ci.web.rest</param-value>
</init-param>
<load-on-startup>1</load-on-startup>
</servlet>

<servlet-mapping>
<servlet-name>jersey-serlvet</servlet-name>
<url-pattern>/rest/*</url-pattern>
</servlet-mapping>

</web-app>
@@ -0,0 +1,5 @@
<html>
<body>
Hi
</body>
</html>

0 comments on commit 0731d53

Please sign in to comment.