Skip to content

boldt/Simple-Jersey-Example

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

18 Commits
 
 
 
 
 
 

Repository files navigation

Example project

This project uses

Howto

Get the sources

git clone git@github.com:boldt/Simple-Jersey-Example.git

Eclipse

Import as Maven project with Maven Integration (m2e).

Run the Main:

  • The first argument defines the Server. It can be grizzly or netty.
  • The second argument is the port, which is 9999 by default.

One-jar standalone

Go to the project folder and run mvn clean package. The file target/Simple-Jersey-Example-1.0.jar will be created

Run as Netty server on port 5000:

  • java -jar target/Simple-Jersey-Example-1.0.jar netty 5000

Run as Grizzly server on port 5000:

  • java -jar target/Simple-Jersey-Example-1.0.jar grizzly 5000

Test:

  • curl -X GET curl -X GET http://localhost:5000/users/xml

The result

<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<users>
	<user>
		<userId>100</userId>
		<username>test</username>
	</user>
</users>
  • curl -X GET curl -X GET http://localhost:5000/users/json

The result

[{"username":"test","userId":100}]

Thanks to

References

About

Maven+Netty+Grizzly+Jersey+JAXB-JSON

Resources

Stars

Watchers

Forks

Packages

No packages published

Languages