Simple HttpServer web application prototype.
Clone this GitHub repository:
git clone https://github.com/agjacome/httpserver-web-test.git
Build and test through Gradle Wrapper:
cd httpserver-web-test
./gradlew build check -s -i
Construct JAR package and run it:
./gradlew jar
java -jar ./build/libs/httpserver-web-test.jar
The main example (see com.github.agjacome.httpserver.Main
) binds the HTTP
server to http://localhost:9000/httpserver
. The example application
contains four pages besides login, logout and a simple index, and a total of
six users with different roles to access those pages.
Current pages are correlated with their respective roles. So PAGE_1
role
implies that the user can access Page 1. Roles can be combined, so a user can
have access to multiple pages through his multiple roles. And page privileges
can also be combined, so a page can be accessed by multiple roles (see
page_23). There also exists an ADMIN
special role that can access any
page.
- username: admin - password: adminpass - role: ADMIN
- username: page1 - password: page1pass - role: PAGE_1
- username: page2 - password: page2pass - role: PAGE_2
- username: page3 - password: page3pass - role: PAGE_3
- username: page12 - password: page12pass - role: PAGE_1 and PAGE2
- username: page13 - password: page13pass - role: PAGE_1 and PAGE2
Usernames are case-insensitive, so admin
and ADMIN
are the same
user. Passwords, of course, are case sensitive.
- Tests, the code is almost completely untested at the moment.
- API for User resource, with read-only access for users and write access exclusive for ADMIN role.
- Content-negotiation on API resources (text/plain and application/json at least).