Java implementation of an HTTP server without using the java.net.http package.
Java-HTTP was created as a learning exercise to more fully understand the HTTP protocol. The goal is to have a fully functional HTTP implementation that can serve static files as well as expose an API that servers JSON data.
- API data is stored on a PostgreSQL database
- Support for hosting and serving files. (HTML)
- Support for querying data from an API.
- Get requests on /api/members
- Support for parameters (name, role, age, name&age)
- Post requests on /api/members
- Submit with a json user object body
- Uses TCP sockets
- Processes responses and requests manually via text manipulations
- Build the jar
- The jar can either be a regular jar or a "fat jar".
- The "fat jar" contains all of the dependencies along with the server.
gradle build
orgradle shadowJar
- The jar can either be a regular jar or a "fat jar".
- Create a directory for static files named
HTML
- Inside the HTML file you are to place all of your different website pages
- Note) You must have a file named
404.html
that will be served when user tries to access and invalid path.
- Note) You must have a file named
- The directory should be on the same level as the JAR file
- Inside the HTML file you are to place all of your different website pages
- Start the server by running the jar file. You must enter the port the
server should listen on as a command line argument.
java -jar "java-http".jar 8080
- Multithreaded server implementation
- Process requests and send a response
- Serve JSON responses to specific queries
- Serve html pages
- GZIP before sending data files
- Save and load data from an SQL database
- Implement a connection pool for SQL connections.
- Create configuration file to change certain settings
- Ability to specify the static files folder
- Load images
- This should fix the /favicon.ico failed response
- Load external css
- Handle requests according to their HTTP method
- Add support for other file types.
- Right now the html file extension is hard coded. This will let me load javascript files from a PWA