Home > front end >  Rest architecture, more than writing the get method in a class problem
Rest architecture, more than writing the get method in a class problem

Time:03-06

Recent research rest, according to the online demo build a rest framework, but the problem also appeared, Daniel, please help!
-- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
Problem description:
In the same class for two or more get (get here can also switch to other post, for example), but can only identify a get method, other methods of recognition, namely inside I write demo, in a class with respect to the manner of every request can be achieved only a method, multiple a get or post, can recognize only a get or post,
-- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
* * * * * * * * * * * * * the restlet - servlet. The content of the XML configuration * * * * * * * * * * * * *
 & lt; ? The XML version="1.0" encoding="utf-8"?> 



















* * * * * * * * * * * * * web. The content of the XML configuration * * * * * * * * * * * * *
 & lt; ? The XML version="1.0" encoding="utf-8"?> 
XMLNS="http://java.sun.com/xml/ns/j2ee"
XMLNS: xsi="http://www.w3.org/2001/XMLSchema-instance"
Xsi: schemaLocation="http://java.sun.com/xml/ns/j2ee http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd"


Restlet


Org. The restlet. Ext. Spring. RestletFrameworkServlet

2 & lt;/load - on - startup>



Restlet
/* & lt;/url - pattern>

DEMO

Org. Springframework. Web. Context. ContextLoaderListener



ContextConfigLocation

The classpath: resources/spring/applicationContext *. XML



InitServerContext

cn.net.sinodata.framework.servlet.InitServlet

ServersInit

Cn.net.sinodata.example.init.PreLoadService


10 & lt;/load - on - startup>


InitServerContext
/InitServerContext


Index. Jsp


30 & lt;/session - timeout>



* * * * * * * * * * * * implementation class * * * * * * * * * * *
 package org. Lifeba. Ws. The resource; 

import java.util.List;

The import javax.mail. Ws. Rs. Path;

The import net. Sf. Json. JSONArray;
The import net. Sf. Json. JSONObject;

Import org, apache log4j. Logger;
The import org. Lifeba. Ws. Model. Student;
The import org. The restlet. Data. The Form;
The import org. The restlet. Representation. Representation;
The import org. The restlet. Representation. StringRepresentation;
The import org. The restlet. Resource. Delete;
The import org. The restlet. Resource. Get;
The import org. The restlet. Resource. Put;
The import org. The restlet. Resource. ResourceException;
The import org. The restlet. Resource. ServerResource;
The import org. Springframework. Beans. Factory. The annotation. Autowired;
The import org. Springframework. Web. Bind. The annotation. RequestMapping;
The import org. Springframework. Web. Bind. The annotation. RequestParam;

The import cn.net.sinodata.framework.util.PageUntils;
The import cn.net.sinodata.webservice.service.CommTransService;


/* * *
*
* @ author Steven
* http://www.lifeba.org
*/
Public class StudentResource extends ServerResource {

Private static Logger _log=Logger. GetLogger (StudentResource. Class);
nullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnull
  • Related