Here are some notes if you want to get started building a basic Jersey / Grizzly REST framework. The information here should be enough to get you started with the application launcher and a couple of resources which you can then test in a browser.
I got started by following the notes here as much as possible and then tried to boil the information down in order to give myself the most basic understanding of how these frameworks could be used in projects:
https://jersey.dev.java.net/use/getting-started.html
I created a new project in my favourite editor (IntelliJ IDEA) and then placed the following .jar files in my lib directory:
In the src folder, I created the following files (note: you'll need to edit the line containing "YOUR.NAMESPACE.HERE" and replace it with your namespace:
LaunchApp.java:
I placed the next two files in a folder called resources (src/YOUR/NAMESPACE/resources), so the config class could find and register them:
HelloWorldResource.java:
GreetPersonResource.java:
Once they're all in place and you have imported the jar folder into the project, you should be able to run LaunchApp and visit the following URIs:
And finally, I got myself up and running by looking at this page and downloading the project:
http://docs.sun.com/app/docs/doc/820-4867/ggqzb?a=view
I hope this helps someone get started quickly.
Subscribe to:
Post Comments (Atom)
Blog Archive
-
►
2011
(35)
-
►
June
(6)
- MarkLogic/XCC: Copying a Module with User Content ...
- MarkLogic: clearing a forest in a database program...
- MarkLogic: Enabling debug options when using the S...
- Linux: SCP syntax and structure note
- MarkLogic/XCC: Installing Modules Programatically
- Eclipse: Installing XQDT (and DLTK) on Eclipse Ind...
-
►
June
(6)
-
►
2010
(43)
-
►
September
(7)
- MarkLogic: Creating Multiple Range Element Indexes...
- MarkLogic: Listing all Collections in a Database
- MarkLogic: Basic Database Cloning Script
- MarkLogic: Estimating the number of documents cont...
- MarkLogic: Search: Compound OR Queries
- MarkLogic: XQuery: Check for the presence of an el...
- MarkLogic: XQuery: Type Validation using xsi:type
-
►
September
(7)
1 comments:
I have a quesiton about this post.
Is that important to use the path your.domain.resources
and the suffixe Resource for the resources?
Post a Comment