Aides REST
Tips
- If you get an error Address NOPORT already in use, it means a process is listening on this port.
To obtain the PID of this process you can use the command lsof:
lsof -n -i :NOPORT
Then you can kill this process
kill -9 THISPID
Get the REST operations URL and more generally logs
- To debug your REST clients and servers it may be helpfull to see the complete URLs.
For this purpose you can use the logging.
- In src/main/resourses,
add a logging property file logging.properties
# log to System.err handlers=java.util.logging.ConsoleHandler java.util.logging.ConsoleHandler.level=FINEST java.util.logging.SimpleFormatter.format=%4$-7s [%3$s] %5$s%6$s%n #All log level details .level=FINE org.glassfish.jersey.level=FINE org.glassfish.jersey.tracing.level=FINE - Execute your client/server with the logging file path : mvn exec:java@client -Djava.util.logging.config.file=src/main/resources/logging.properties
- In src/main/resourses,
add a logging property file logging.properties
Some links
- Roy Thomas Fielding's Phd: dissertation, and more particularly CHAPTER 5: Representational State Transfer (REST)
- Web browser REST Client plug-in: restclient
- REST with Glassfish: blog
- JSON 2 JAVA with google gson: user guide
- JAXB oracle introduction
- retrofit annotations to write REST client: library
- swagger language-agnostic interface to REST APIs: getting started
- Jersey user guide
- The Java EE tutorial: home, and more particularly: