Home>

This article is mainly a jersey experience, you will not do any coding,Experience the charm of the jersey frame! This article also assumes that you have the maven plugin installed in eclipse

I. Background

Recently, the jersey learning group has more and more friends.Many friends ask some very basic questions,I think this phenomenon is widespread,The reason is that most of the students in the group are beginners in Jersey.more than this,May be a beginner in java,With curiosity about rest webservice, they broke into the learning field of the jersey framework,However, as a novice,Feeling tiger eating day,Unable to lower the paw! To guide novices to learn,I will write a few blogs about Jersey in the future.Stay tuned!

Foreword

This article is mainly a jersey experience, you will not do any coding,Experience the charm of the jersey frame! This article also assumes that you have the maven plugin installed in eclipse!

Steps

1.New maven project

2, select the project's maven prototype (jersey-quickstart-grizzly), this is based on Jersey version 1.7

3. Fill in the project information for this project,Fill in and click "finish"

4.You can see that the project is being generated at the bottom right of the eclipse address bar

5. The generated project structure is shown below.Where main.java is a java applet started by the grizzly web server,

myresource automatically generates the first rest resource class, which contains a simple get request resource.

6, execute main.java, grizzly web server will start.

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

8. Access the generated test resources,As shown below,If you see "got it", you have successfully experienced the first Hello World program in Jersey!

to sum up:

1. At present, most open source projects use maven management. Being able to master maven is essential for learning an open source project.Otherwise, I don't know how to start!

2. Use maven to automatically download the source code and javadocs corresponding to the jar. This provides an easy way to learn more about an open source project.Otherwise, if you download the binary jar, you have to find the source code.Not only wasting time,And the source code you might find is not the correct version.

3. It is best to use the eclipse maven plugin, some operations are performed visually,Much simpler than the command line,Otherwise you have to remember a lot of commands,It ’s also troublesome,I know it! Hope everyone can get started as soon as possible,to avoid detours.

  • Previous Automatically generate business cards with user information using PHP
  • Next Detailed ng-checked instructions for AngularJS introductory tutorial