Home > Java > javaTutorial > First experience with Jersey framework

First experience with Jersey framework

高洛峰
Release: 2016-12-17 14:53:27
Original
2085 people have browsed it

2. Preface

This article is mainly about Jersey experience. You will experience the charm of Jersey framework without doing any coding! This article also assumes that you have the Maven plug-in installed in eclipse!

Three steps

1. Create a new Maven project

First experience with Jersey framework

First experience with Jersey framework

First experience with Jersey framework

2. Select the Maven prototype of the project (jersey-quickstart-grizzly), this is based on the 1.7 version of Jersey

First experience with Jersey framework

3. Fill in the project information of this project and click "Finish" after filling in

First experience with Jersey framework

4. You can see that the project is being generated in the lower right corner of the Eclipse address bar

First experience with Jersey framework

5. The generated project structure is as shown below, among which Main.java is a small Java application launched by grizzly web server.
MyResource is the first REST Resource class that is automatically generated, including a simple GET request for resources.

First experience with Jersey framework

6. Execute Main.java, grizzly web server will start.

First experience with Jersey framework

7. Visit http://localhost:9998/application.wadl, as shown in the figure below. This is the generated REST resource description language

First experience with Jersey framework

8. Visit the generated test resources, as shown in the figure below , seeing "Got it" means you have successfully experienced Jersey's first Hello World program!

First experience with Jersey framework

Summary:

1. Currently, most open source projects are managed using Maven. Being able to master Maven is essential for learning an open source project, otherwise you won’t know how to start!

2. Using Maven can automatically download the source code and Javadocs corresponding to the Jar. This provides an easy way to deeply study an open source project. Otherwise, after downloading the binary jar, you have to find the source code, which is not only a waste of time, but also may be found. The source code does not match the version.

3. It is best to use the Eclipse maven plug-in. Some operations can be performed visually, which is much simpler than the command line. Otherwise, you have to remember a lot of commands, which is also very troublesome. I understand this deeply! I hope everyone can get started as soon as possible and avoid detours.



For more articles related to the first experience of Jersey framework, please pay attention to the PHP Chinese website!

Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template