Setup servlet project. Setup docker

This commit is contained in:
William Lewis 2024-11-21 05:50:06 -06:00
parent bf92fa36fb
commit 50332fba11
7 changed files with 72 additions and 11 deletions

2
.gitignore vendored Normal file
View File

@ -0,0 +1,2 @@
target/
.vscode/

3
Dockerfile Normal file
View File

@ -0,0 +1,3 @@
FROM tomcat
COPY ./target/amazon-scrapi*.war /usr/local/tomcat/webapps/

View File

@ -0,0 +1,8 @@
services:
amazon-scrapi:
container_name: amazon-scrapi
ports:
- 8080:8080
#volumes:
#- ./dir:/dir
image: amazon-scrapi:alpha

31
pom.xml
View File

@ -1,13 +1,27 @@
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" <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"> xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
<modelVersion>4.0.0</modelVersion> <modelVersion>4.0.0</modelVersion>
<groupId>com.veritablevalor.blizliam</groupId> <groupId>com.veritablevalor.blizliam</groupId>
<artifactId>amazon-scrapi</artifactId> <artifactId>amazon-scrapi</artifactId>
<packaging>jar</packaging> <packaging>war</packaging>
<version>1.0-SNAPSHOT</version> <version>1.0-SNAPSHOT</version>
<name>amazon-scrapi</name> <name>amazon-scrapi</name>
<url>http://maven.apache.org</url> <url>http://maven.apache.org</url>
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<maven.compiler.source>11</maven.compiler.source>
<maven.compiler.target>11</maven.compiler.target>
</properties>
<dependencies> <dependencies>
<dependency>
<groupId>jakarta.servlet</groupId>
<artifactId>jakarta.servlet-api</artifactId>
<version>6.0.0</version>
<scope>provided</scope>
</dependency>
<dependency> <dependency>
<groupId>junit</groupId> <groupId>junit</groupId>
<artifactId>junit</artifactId> <artifactId>junit</artifactId>
@ -15,4 +29,19 @@
<scope>test</scope> <scope>test</scope>
</dependency> </dependency>
</dependencies> </dependencies>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-war-plugin</artifactId>
<version>3.3.2</version>
<configuration>
<webappDirectory>src/main/webapp</webappDirectory>
<webXml>src/main/webapp/WEB-INF/web.xml</webXml>
</configuration>
</plugin>
</plugins>
</build>
</project> </project>

View File

@ -1,13 +1,18 @@
package com.veritablevalor.blizliam; package com.veritablevalor.blizliam;
/** import jakarta.servlet.ServletException;
* Hello world! import jakarta.servlet.http.HttpServlet;
* import jakarta.servlet.http.HttpServletRequest;
*/ import jakarta.servlet.http.HttpServletResponse;
public class App
{ import java.io.IOException;
public static void main( String[] args ) import java.io.PrintWriter;
{
System.out.println( "Hello World!" ); public class App extends HttpServlet {
@Override
protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
PrintWriter out = resp.getWriter();
out.println("Hello!");
out.close();
} }
} }

View File

@ -0,0 +1,14 @@
<!DOCTYPE web-app PUBLIC
"-//Sun Microsystems, Inc.//DTD Web Application 2.3//EN"
"http://java.sun.com/dtd/web-app_2_3.dtd" >
<web-app>
<servlet>
<servlet-name>hello</servlet-name>
<servlet-class>com.veritablevalor.blizliam.App</servlet-class>
</servlet>
<servlet-mapping>
<servlet-name>hello</servlet-name>
<url-pattern>/hello</url-pattern>
</servlet-mapping>
</web-app>