Skip to content

Commit

Permalink
servlet
Browse files Browse the repository at this point in the history
  • Loading branch information
siqq committed Oct 14, 2014
1 parent d7ac525 commit c4294ed
Show file tree
Hide file tree
Showing 11 changed files with 155 additions and 4 deletions.
5 changes: 4 additions & 1 deletion Java-Missle/.classpath
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,9 @@
<classpathentry kind="src" path="src"/>
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/>
<classpathentry kind="lib" path="forms-1.3.0.jar" sourcepath="forms-1.3.0-src.zip"/>
<classpathentry kind="lib" path="C:/Users/DELL-PC/git/Java-Missle/Java-Missle/mysql-connector-java-5.1.33-bin.jar"/>
<classpathentry kind="lib" path="C:/Users/Andrey/Desktop/mysql-connector-java-5.1.33-bin.jar"/>
<classpathentry kind="con" path="org.eclipse.jst.j2ee.internal.web.container"/>
<classpathentry kind="con" path="org.eclipse.jst.j2ee.internal.module.container"/>
<classpathentry kind="lib" path="C:/Users/Andrey/Desktop/eclipse-jee-luna-SR1-win32-x86_64/tc/lib/servlet-api.jar"/>
<classpathentry kind="output" path="bin"/>
</classpath>
19 changes: 19 additions & 0 deletions Java-Missle/.project
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,32 @@
<projects>
</projects>
<buildSpec>
<buildCommand>
<name>org.eclipse.wst.jsdt.core.javascriptValidator</name>
<arguments>
</arguments>
</buildCommand>
<buildCommand>
<name>org.eclipse.wst.common.project.facet.core.builder</name>
<arguments>
</arguments>
</buildCommand>
<buildCommand>
<name>org.eclipse.jdt.core.javabuilder</name>
<arguments>
</arguments>
</buildCommand>
<buildCommand>
<name>org.eclipse.wst.validation.validationbuilder</name>
<arguments>
</arguments>
</buildCommand>
</buildSpec>
<natures>
<nature>org.eclipse.jem.workbench.JavaEMFNature</nature>
<nature>org.eclipse.wst.common.modulecore.ModuleCoreNature</nature>
<nature>org.eclipse.jdt.core.javanature</nature>
<nature>org.eclipse.wst.common.project.facet.core.nature</nature>
<nature>org.eclipse.wst.jsdt.core.jsNature</nature>
</natures>
</projectDescription>
12 changes: 12 additions & 0 deletions Java-Missle/.settings/.jsdtscope
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
<?xml version="1.0" encoding="UTF-8"?>
<classpath>
<classpathentry kind="src" path="WebContent"/>
<classpathentry kind="con" path="org.eclipse.wst.jsdt.launching.JRE_CONTAINER"/>
<classpathentry kind="con" path="org.eclipse.wst.jsdt.launching.WebProject">
<attributes>
<attribute name="hide" value="true"/>
</attributes>
</classpathentry>
<classpathentry kind="con" path="org.eclipse.wst.jsdt.launching.baseBrowserLibrary"/>
<classpathentry kind="output" path=""/>
</classpath>
6 changes: 3 additions & 3 deletions Java-Missle/.settings/org.eclipse.jdt.core.prefs
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
eclipse.preferences.version=1
org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled
org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.7
org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.8
org.eclipse.jdt.core.compiler.codegen.unusedLocal=preserve
org.eclipse.jdt.core.compiler.compliance=1.7
org.eclipse.jdt.core.compiler.compliance=1.8
org.eclipse.jdt.core.compiler.debug.lineNumber=generate
org.eclipse.jdt.core.compiler.debug.localVariable=generate
org.eclipse.jdt.core.compiler.debug.sourceFile=generate
org.eclipse.jdt.core.compiler.problem.assertIdentifier=error
org.eclipse.jdt.core.compiler.problem.enumIdentifier=error
org.eclipse.jdt.core.compiler.source=1.7
org.eclipse.jdt.core.compiler.source=1.8
8 changes: 8 additions & 0 deletions Java-Missle/.settings/org.eclipse.wst.common.component
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
<?xml version="1.0" encoding="UTF-8"?><project-modules id="moduleCoreId" project-version="1.5.0">
<wb-module deploy-name="Java-Missle">
<wb-resource deploy-path="/" source-path="/WebContent" tag="defaultRootSource"/>
<wb-resource deploy-path="/WEB-INF/classes" source-path="/src"/>
<property name="context-root" value="Java-Missle"/>
<property name="java-output-path" value="/Java-Missle/bin"/>
</wb-module>
</project-modules>
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?>
<faceted-project>
<fixed facet="wst.jsdt.web"/>
<installed facet="java" version="1.8"/>
<installed facet="jst.web" version="3.0"/>
<installed facet="wst.jsdt.web" version="1.0"/>
</faceted-project>
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
org.eclipse.wst.jsdt.launching.baseBrowserLibrary
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Window
3 changes: 3 additions & 0 deletions Java-Missle/WebContent/META-INF/MANIFEST.MF
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
Manifest-Version: 1.0
Class-Path:

30 changes: 30 additions & 0 deletions Java-Missle/WebContent/WarHtml.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
<!DOCTYPE html>
<html>
<head>
<meta charset="windows-1255">
<title>IDF CONTROL</title>
</head>
<body>
<form method="get" action="IdfControlServlet">
Enter Iron Dome ID <br>
<input type="text" name="ironDomeId" /></br>
Enter Missile ID to Intercept: <br>
<input type="text" name="missileId" /></br>
<br>
<input type="submit" name="interceptMissile" value="interceptMissile"><br>
<br>
<br>
Select Destroyer Type <br>
<input type="radio" name="destroyerType" value="plane">Plane<br>
<input type="radio" name="destroyerType" value="ship">Ship<br>
<br>
Enter Destroyer ID<br>
<input type="text" name="destroyerId" /></br>
<br>
Enter Launcher ID to Destroy<br>
<input type="text" name="launcherId" /></br>
<br>
<input type="submit" name="destroyLauncher" value="destroyLauncher" />
</form>
</body>
</html>
67 changes: 67 additions & 0 deletions Java-Missle/src/servlet/IdfControlServlet.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,67 @@
package servlet;
import java.io.IOException;
import java.io.PrintWriter;
import java.util.List;

import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import war.controller.WarUIEventsListener;
import main.Program;

@WebServlet(name = "IdfControlServlet", urlPatterns = { "/IdfControlServlet" })
public class IdfControlServlet extends HttpServlet {
private static final long serialVersionUID = 1L;


protected void doGet(HttpServletRequest request,
HttpServletResponse response) throws ServletException, IOException {

response.setContentType("text/html;charset=UTF-8");
PrintWriter out = response.getWriter();

// interceptMissile button was clicked
if (request.getParameter("interceptMissile") != null){
String ironDomeId = request.getParameter("ironDomeId");
String missileId = request.getParameter("missileId");
// do something
try {
out.println("<html>");
out.println("<h1>destroyLauncher button clicked</h1>");
out.println("</html>");
// for (WarUIEventsListener l : allListeners) {
// l.addInterceptionToUI(missileId, ironDomeId);
// }
} finally {
out.close();
}
}


// destroyLauncher button was clicked
else if (request.getParameter("destroyLauncher") != null){
// do something
try {
out.println("<html>");
out.println("<h1>destroyLauncher button clicked</h1>");
out.println("</html>");
} finally {
out.close();
}
}






}

protected void doPost(HttpServletRequest request,
HttpServletResponse response) throws ServletException, IOException {
doGet(request, response);
}
}

0 comments on commit c4294ed

Please sign in to comment.