Skip to content

Commit 98bde76

Browse files
committed
Start application with basic servlet.
0 parents  commit 98bde76

File tree

6 files changed

+107
-0
lines changed

6 files changed

+107
-0
lines changed

.classpath

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<classpath>
3+
<classpathentry kind="src" path="src"/>
4+
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.launching.macosx.MacOSXType/Java SE 6 (MacOS X Default)">
5+
<attributes>
6+
<attribute name="owner.project.facets" value="java"/>
7+
</attributes>
8+
</classpathentry>
9+
<classpathentry kind="con" path="org.eclipse.jst.server.core.container/org.eclipse.jst.server.tomcat.runtimeTarget/Apache Tomcat v6.0">
10+
<attributes>
11+
<attribute name="owner.project.facets" value="jst.web"/>
12+
</attributes>
13+
</classpathentry>
14+
<classpathentry kind="con" path="org.eclipse.jst.j2ee.internal.web.container"/>
15+
<classpathentry kind="con" path="org.eclipse.jst.j2ee.internal.module.container"/>
16+
<classpathentry kind="output" path="build/classes"/>
17+
</classpath>

.gitignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
.settings
2+
build

.project

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<projectDescription>
3+
<name>LDF-Server</name>
4+
<comment></comment>
5+
<projects>
6+
</projects>
7+
<buildSpec>
8+
<buildCommand>
9+
<name>org.eclipse.wst.jsdt.core.javascriptValidator</name>
10+
<arguments>
11+
</arguments>
12+
</buildCommand>
13+
<buildCommand>
14+
<name>org.eclipse.jdt.core.javabuilder</name>
15+
<arguments>
16+
</arguments>
17+
</buildCommand>
18+
<buildCommand>
19+
<name>org.eclipse.wst.common.project.facet.core.builder</name>
20+
<arguments>
21+
</arguments>
22+
</buildCommand>
23+
<buildCommand>
24+
<name>org.eclipse.wst.validation.validationbuilder</name>
25+
<arguments>
26+
</arguments>
27+
</buildCommand>
28+
</buildSpec>
29+
<natures>
30+
<nature>org.eclipse.jem.workbench.JavaEMFNature</nature>
31+
<nature>org.eclipse.wst.common.modulecore.ModuleCoreNature</nature>
32+
<nature>org.eclipse.wst.common.project.facet.core.nature</nature>
33+
<nature>org.eclipse.jdt.core.javanature</nature>
34+
<nature>org.eclipse.wst.jsdt.core.jsNature</nature>
35+
</natures>
36+
</projectDescription>

WebContent/META-INF/MANIFEST.MF

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
Manifest-Version: 1.0
2+
Class-Path:
3+

WebContent/WEB-INF/web.xml

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<web-app xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
3+
xmlns="http://java.sun.com/xml/ns/javaee"
4+
xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd"
5+
id="WebApp_ID" version="2.5">
6+
<display-name>Linked Data Fragments Server</display-name>
7+
<servlet>
8+
<display-name>FragmentServlet</display-name>
9+
<servlet-name>FragmentServlet</servlet-name>
10+
<servlet-class>org.linkeddatafragments.servlets.FragmentServlet</servlet-class>
11+
</servlet>
12+
<servlet-mapping>
13+
<servlet-name>FragmentServlet</servlet-name>
14+
<url-pattern>/*</url-pattern>
15+
</servlet-mapping>
16+
</web-app>
Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
package org.linkeddatafragments.servlets;
2+
3+
import java.io.PrintWriter;
4+
5+
import javax.servlet.ServletConfig;
6+
import javax.servlet.ServletException;
7+
import javax.servlet.http.HttpServlet;
8+
import javax.servlet.http.HttpServletRequest;
9+
import javax.servlet.http.HttpServletResponse;
10+
11+
/**
12+
* Servlet that responds with a Linked Data Fragment.
13+
* @author Ruben Verborgh
14+
*/
15+
public class FragmentServlet extends HttpServlet {
16+
17+
@Override
18+
public void init(ServletConfig config) {
19+
}
20+
21+
@Override
22+
public void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException {
23+
try {
24+
String path = request.getRequestURI().substring(request.getContextPath().length());
25+
PrintWriter writer = response.getWriter();
26+
writer.println(path);
27+
writer.close();
28+
}
29+
catch (Exception e) {
30+
throw new ServletException(e);
31+
}
32+
}
33+
}

0 commit comments

Comments
 (0)