Added basis for servlet stuff.

This commit is contained in:
Andrew Lalis 2022-04-02 21:50:00 +02:00
parent 8033024b13
commit 98e177c413
5 changed files with 109 additions and 2 deletions

Binary file not shown.

After

Width:  |  Height:  |  Size: 17 KiB

View File

@ -0,0 +1,62 @@
{
"name": "Corvette",
"components": [
{
"type": "panel",
"name": "Main Fuselage",
"mass": 5000,
"points": [
{"x": 0.3, "y": 0.6},
{"x": 0.2, "y": 0.1},
{"x": 0.1, "y": 0.5},
{"x": 0.2, "y": 0.8},
{"x": 0.8, "y": 0.8},
{"x": 0.9, "y": 0.5},
{"x": 0.8, "y": 0.1},
{"x": 0.7, "y": 0.6}
]
},
{
"type": "panel",
"name": "Front Cargo Bay",
"mass": 1000,
"points": [
{"x": 0.4, "y": 0.2},
{"x": 0.35, "y": 0.6},
{"x": 0.65, "y": 0.6},
{"x": 0.6, "y": 0.2}
]
},
{
"type": "cockpit",
"mass": 800,
"points": [
{"x": 0.5, "y": 0.0},
{"x": 0.4, "y": 0.2},
{"x": 0.6, "y": 0.2}
]
},
{
"type": "gun",
"name": "Port-Side Machine Gun",
"mass": 500,
"location": {"x": 0.15, "y": 0.35},
"rotation": 0,
"minRotation": -160,
"maxRotation": 5,
"barrelWidth": 0.02,
"barrelLength": 0.2
},
{
"type": "gun",
"name": "Starboard-Side Machine Gun",
"mass": 500,
"location": {"x": 0.85, "y": 0.35},
"rotation": 0,
"minRotation": -5,
"maxRotation": 160,
"barrelWidth": 0.02,
"barrelLength": 0.2
}
]
}

View File

@ -23,5 +23,18 @@
<artifactId>core</artifactId>
<version>${project.parent.version}</version>
</dependency>
<!-- https://mvnrepository.com/artifact/org.eclipse.jetty/jetty-servlet -->
<dependency>
<groupId>org.eclipse.jetty</groupId>
<artifactId>jetty-servlet</artifactId>
<version>11.0.8</version>
</dependency>
<!-- https://mvnrepository.com/artifact/org.slf4j/slf4j-jdk14 -->
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-jdk14</artifactId>
<version>2.0.0-alpha7</version>
<scope>runtime</scope>
</dependency>
</dependencies>
</project>

View File

@ -1,7 +1,23 @@
package nl.andrewl.starship_arena.server;
public class StarshipArenaServer {
public static void main(String[] args) {
import nl.andrewl.starship_arena.server.servlet.ArenasServlet;
import org.eclipse.jetty.server.Connector;
import org.eclipse.jetty.server.Server;
import org.eclipse.jetty.server.ServerConnector;
import org.eclipse.jetty.servlet.ServletContextHandler;
import org.eclipse.jetty.servlet.ServletHolder;
public class StarshipArenaServer {
public static void main(String[] args) throws Exception {
Server jettyServer = new Server(8080);
Connector connector = new ServerConnector(jettyServer);
jettyServer.addConnector(connector);
ServletContextHandler servletContext = new ServletContextHandler();
servletContext.setContextPath("/");
servletContext.addServlet(new ServletHolder(new ArenasServlet()), "/arenas");
jettyServer.setHandler(servletContext);
jettyServer.start();
}
}

View File

@ -0,0 +1,16 @@
package nl.andrewl.starship_arena.server.servlet;
import jakarta.servlet.ServletException;
import jakarta.servlet.http.HttpServlet;
import jakarta.servlet.http.HttpServletRequest;
import jakarta.servlet.http.HttpServletResponse;
import java.io.IOException;
public class ArenasServlet extends HttpServlet {
@Override
protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
super.doGet(req, resp);
// TODO: Return the list of available arenas.
}
}