Skip to content

Commit

Permalink
ajout TP servlet
Browse files Browse the repository at this point in the history
  • Loading branch information
jetoile committed Dec 20, 2015
1 parent 496b7ee commit 039328c
Show file tree
Hide file tree
Showing 5 changed files with 73 additions and 0 deletions.
30 changes: 30 additions & 0 deletions catalog-servlet-sample/pom.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
<?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>
<artifactId>catalog-servlet-sample</artifactId>
<name>catalog-servlet-sample</name>
<packaging>war</packaging>

<parent>
<groupId>com.store.catalog</groupId>
<artifactId>catalog</artifactId>
<version>2.0-SNAPSHOT</version>
</parent>


<dependencies>
<dependency>
<groupId>javax.servlet</groupId>
<artifactId>servlet-api</artifactId>
<scope>provided</scope>
</dependency>

</dependencies>

<build>
<finalName>sample</finalName>
</build>


</project>
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
package com.store.catalog.servlet;

import javax.servlet.http.HttpServlet;

public class MyFirstServlet extends HttpServlet {

}
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
package com.store.catalog.servlet;

import javax.servlet.GenericServlet;
import javax.servlet.ServletException;
import javax.servlet.ServletRequest;
import javax.servlet.ServletResponse;
import javax.servlet.http.HttpServletRequest;
import java.io.IOException;
import java.io.PrintWriter;

public class Ping extends GenericServlet {
@Override
public void service(ServletRequest servletRequest, ServletResponse servletResponse) throws ServletException, IOException {
PrintWriter writer = servletResponse.getWriter();
writer.println("pong");
}
}
18 changes: 18 additions & 0 deletions catalog-servlet-sample/src/main/webapp/WEB-INF/web.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
<?xml version="1.0" encoding="UTF-8"?>
<web-app version="2.5" xmlns="http://java.sun.com/xml/ns/javaee"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd">



<servlet>
<servlet-name>Ping</servlet-name>
<servlet-class>com.store.catalog.servlet.Ping</servlet-class>

<load-on-startup>1</load-on-startup>
</servlet>
<servlet-mapping>
<servlet-name>Ping</servlet-name>
<url-pattern>/ping</url-pattern>
</servlet-mapping>
</web-app>
1 change: 1 addition & 0 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -718,6 +718,7 @@
<module>./catalog-rdbms</module>
<module>./catalog-rest-jersey</module>
<module>./catalog-resource</module>
<module>./catalog-servlet-sample</module>
<!--
<module>./catalog-nosql</module>
-->
Expand Down

0 comments on commit 039328c

Please sign in to comment.