The goal of this task is to perform a web crawl on a URL string provided by the user. From the crawl, you will need to parse out all of the images on that web page and return a JSON array of strings that represent the URLs of all images on the page. Jsoup is a great basic library for crawling and is already included as a maven dependency in this project, however you are welcome to use whatever library you would like.
The ImageFinder servlet is found in src/main/java/com/eulerity/hackathon/imagefinder/ImageFinder.java
. This is the only provided Java class. Feel free to add more classes or packages as you see fit.
The main landing page for this project can be found in src/main/webapp/index.html
. This page contains more instructions and serves as the starting page for the web application. You may edit this page as much as it suits you, and/or add other pages.
Finally, in the root directory of this project, you will find the pom.xml
. This contains the project configuration details used by maven to build the project. If you want/need to use outside dependencies, you should add them to this file.
Here we will detail how to setup and run this project so you may get started, as well as the requirements needed to do so.
Before beginning, make sure you have the following installed and ready to use
- Maven 3.5 or higher
- Java 8
- Exact version, NOT Java 9+ - the build will fail with a newer version of Java
To start, open a terminal window and navigate to wherever you unzipped to the root directory imagefinder
. To build the project, run the command:
mvn package
If all goes well you should see some lines that end with "BUILD SUCCESS". When you build your project, maven should build it in the target
directory. To clear this, you may run the command:
mvn clean
To run the project, use the following command to start the server:
mvn clean test package jetty:run
You should see a line at the bottom that says "Started Jetty Server". Now, if you enter localhost:8080
into your browser, you should see the index.html
welcome page! If all has gone well to this point, you're ready to begin!