Project developed during the university course WEB Programming, where Node.js is strictly forbidden.
Since the project isn't compiled or bundled, Vue has to compile the templates into VDOM at runtime. This can cause the application to work slower than expected.
- The refresh token is set as an
HTTPOnlycookie to mitigate CSRF - Axios interceptors silently fetch a new access token using the provided refresh token cookie
- The access token should only be held in-memory, never in local storage, to mitigate XSS
- Axios interceptors handle other cross-cutting concerns such as detecting whether a user has been banned or their refresh token was revoked
OpenAPI Specification (Access Swagger UI at http://localhost:8080/api/swagger-ui)
-
Install the Extension Pack for Java
If vscode doesn't recognize the java project, open any
.javafile contained in thesrc/main/javadirectory to kick off the Java Language Server. -
Install the Tomcat for Java extension
-
Add the following to
settings.json- Command Palette (Ctrl + Shift + P) > Preferences: Open Settings (JSON)Note: Replace
C:/Projectswith the path where the project is located on your machineNote: The path should be absolute and point to
server/jre1.8.0_231"java.configuration.runtimes": [ { "name": "JavaSE-1.8", "path": "C:/Projects/web/server/jre1.8.0_231", "default": true } ] -
Command Palette (Ctrl + Shift + P) > Add Tomcat Server > Select
server/apache-tomcat-8.0.47
-
Command Palette (Ctrl + Shift + P) > Java: Force Java Compilation > Full
Note: A successful compilation should generate a
classesdirectory insidedist/WEB-INFcontaining.classfiles. -
Optionally enable automatic compilation on source code changes by checking the Java > Autobuild: Enabled option in settings, or by adding the following option to
settings.json:"java.autobuild.enabled": true
- Right click
distand selectRun on Tomcat Server - Access the project root at
http://localhost:8080 - Access the REST API at
http://localhost:8080/api
-
Right click
distand selectDebug on Tomcat Server -
Access the project root at
http://localhost:8080 -
Access the REST API at
http://localhost:8080/api -
Change some code in
src/main/java -
Save the changes, then hit the ⚡ icon in the debugging toolbar to hot-reload the code into Tomcat.
Note: Due to the nature of the JVM not all types of changes can be hot-reloaded. If this happens recompile the project and debug again.
-
The changes should be reflected in the next request.
-
Test the debugger by inserting a breakpoint anywhere in the source code.
-
Always stop the tomcat server before exiting VSCode. Otherwise tomcat will not release the port
8080and you will not be able to run it again.You can stop it by using Command Palette (Ctrl + Shift + P) > Stop Tomcat Server.
If this does not work you can use the command
./catalina.bat stopinsideserver/apache-tomcat-8.0.47/bin -
The controllers use GSON to serdes api requests and responses
- The api base path
/apiis defined with
@ApplicationPath("/api")
public class JerseyConfig extends ResourceConfig { }- Register dependency injection classes with
register(MediaService.class);
register(new AbstractBinder() {
@Override
protected void configure() {
bindAsContract(MediaService.class).in(Immediate.class);
}
});- Register the package for controller resolution, the server won't start without this (change this if you change the controllers package name):
packages("controllers");server/apache-tomcat-8.0.47/conf/server.xml
- You can change the api port here
<Connector port="8080" protocol="HTTP/1.1" connectionTimeout="20000" redirectPort="8443" />








