Fixed up some gitignore. Added readme info

This commit is contained in:
William Lewis 2024-11-21 19:05:05 -06:00
parent 68ec9d52ed
commit f2c8aff951
14 changed files with 31 additions and 4 deletions

5
.gitignore vendored
View File

@ -1,3 +1,6 @@
target/ target/
.vscode/ .vscode/
tomcat-binaries/ tomcat-binaries/
src/main/amazon-scrapi/WEB-INF/classes/
src/main/amazon-scrapi/WEB-INF/lib/

View File

@ -2,6 +2,9 @@
An API interface with Amazon, that uses webscraping An API interface with Amazon, that uses webscraping
# Development Resources
- [Intro to servlets](https://dev.to/dilanka-rathnasiri/introduction-to-java-servlets-32oc)
# Development Environment Setup # Development Environment Setup
## VSCode / VSCodium ## VSCode / VSCodium

View File

@ -42,8 +42,9 @@
<artifactId>maven-war-plugin</artifactId> <artifactId>maven-war-plugin</artifactId>
<version>3.3.2</version> <version>3.3.2</version>
<configuration> <configuration>
<webappDirectory>src/main/webapp</webappDirectory> <webappDirectory>src/main/amazon-scrapi</webappDirectory>
<webXml>src/main/webapp/WEB-INF/web.xml</webXml> <webXml>src/main/amazon-scrapi/WEB-INF/web.xml</webXml>
<failOnMissingWebXml>false</failOnMissingWebXml>
</configuration> </configuration>
</plugin> </plugin>
</plugins> </plugins>

View File

@ -1,6 +1,7 @@
package com.veritablevalor.blizliam; package com.veritablevalor.blizliam;
import jakarta.servlet.ServletException; import jakarta.servlet.ServletException;
import jakarta.servlet.annotation.WebServlet;
import jakarta.servlet.http.HttpServlet; import jakarta.servlet.http.HttpServlet;
import jakarta.servlet.http.HttpServletRequest; import jakarta.servlet.http.HttpServletRequest;
import jakarta.servlet.http.HttpServletResponse; import jakarta.servlet.http.HttpServletResponse;
@ -12,6 +13,10 @@ import com.microsoft.playwright.Browser;
import com.microsoft.playwright.Page; import com.microsoft.playwright.Page;
import com.microsoft.playwright.Playwright; import com.microsoft.playwright.Playwright;
@WebServlet(
value = "/hello",
name = "hello"
)
public class App extends HttpServlet { public class App extends HttpServlet {
@Override @Override
protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException { protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
@ -24,10 +29,20 @@ public class App extends HttpServlet {
Page page = browser.newPage(); Page page = browser.newPage();
page.navigate(url); page.navigate(url);
page.
boolean loggedIn = page.getByText("Hello, sign in").count() <= 0;
System.out.println(page.title()); System.out.println(page.title());
out.println("Here is the page.title: " + page.title()); out.println("Here is the page.title: " + page.title());
if (loggedIn)
{
out.println("Logged in");
}
else
{
out.println("Logged out");
}
} }
out.close(); out.close();

View File

@ -0,0 +1,5 @@
package com.veritablevalor.blizliam;
public class Login {
}