Restlet Development Examples

Source: Internet
Author: User

Transferred from Lifeba,http://www.lifeba.org/arch/restlet_develop_application_component_2.html
But there are changes, the main changes are:
1. The <servlet-mapping/> section of Web. XML is modified so that the project can access the rest service and access the normal page resources without having to deploy a separate page project like the original author.
2. Because of "1" changes, only URLs that start with/rest can be mapped to a resource, and when you use the rest service, you must add/rest.
3. Due to "1" Changes, the Restcomponent class registers the application with the resource string/rest.
4. Due to the change of "1" and the different port number of my web server, the related resource string of the client test class has been changed accordingly.
Click here to download the project file, which contains the use of the Jar package, published directly to run, easy to learn.

Directory structure:


Jar Package used:

How to use:
1, download the project documents;
2, import the project files to eclipse, etc., or directly to the release, such as directly put the project into the "Tomcat"/webapps/.
3, search the entire project file, the string 8080 is changed to your own server IP;
4, start the server.

Test method:
1. Main function test
Open the client class and run the main function to test the post and delete methods;
2. Perform a single application test:
1) Return all student information: http://localhost:8080/RestApplication/rest/student
2) Execute the main function of the client class and add a student information;
3) repeat 1);
4) Get individual student information for id=1: HTTP://LOCALHOST:8080/RESTAPPLICATION/REST/STUDENT/1
5) Open http://localhost:8080/restapplication/update.jsp page, enter relevant information, submit; If the submission fails, please check the page <form/> form The value of the Action property is correct;
6) Repeat 4) to see if the information has been modified;
3. use component to bind multiple application
Modify the Web. xml file so that it supports multiple application, while testing the relevant URL path, please refer to the original.

Restlet Development Examples

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.