本文整理汇总了Java中org.restlet.data.Form.getWebRepresentation方法的典型用法代码示例。如果您正苦于以下问题:Java Form.getWebRepresentation方法的具体用法?Java Form.getWebRepresentation怎么用?Java Form.getWebRepresentation使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.restlet.data.Form
的用法示例。
在下文中一共展示了Form.getWebRepresentation方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: createRWSRancidNode
import org.restlet.data.Form; //导入方法依赖的package包/类
public static void createRWSRancidNode(ConnectionProperties cp, RancidNode rnode) throws RancidApiException{
if (!inited){
throw(new RancidApiException("Error: Api not initialized"));
}
Form form = new Form();
form.add("deviceType", rnode.getDeviceType());
form.add("state", rnode.getState());
form.add("comment", rnode.getComment());
Representation rep = form.getWebRepresentation();
String url = cp.getUrl()+cp.getDirectory()+"/rancid/groups/"+rnode.getGroup()+"/"+rnode.getDeviceName();
putMethodRWS(cp, url,rep);
}
示例2: updateRWSRancidNode
import org.restlet.data.Form; //导入方法依赖的package包/类
public static void updateRWSRancidNode(ConnectionProperties cp, RancidNode rnode) throws RancidApiException{
if (!inited){
throw(new RancidApiException("Error: Api not initialized"));
}
Form form = new Form();
form.add("deviceType", rnode.getDeviceType());
form.add("state", rnode.getState());
form.add("comment", rnode.getComment());
Representation rep = form.getWebRepresentation();
String url = cp.getUrl()+cp.getDirectory()+"/rancid/groups/"+rnode.getGroup()+"/"+rnode.getDeviceName();
postMethodRWS(cp, url,rep);
}
示例3: createRWSAuthNode
import org.restlet.data.Form; //导入方法依赖的package包/类
public static void createRWSAuthNode(ConnectionProperties cp, RancidNodeAuthentication rnodea) throws RancidApiException{
if (!inited){
throw(new RancidApiException("Error: Api not initialized"));
}
Form form = new Form();
form.add("user", rnodea.getUser());
form.add("password", rnodea.getPassword());
form.add("enablepassword", rnodea.getEnablePass());
String autoenable = "0";
if (rnodea.isAutoEnable()){
autoenable="1";
}
form.add("autoenable", autoenable);
form.add("method", rnodea.getConnectionMethodString());
Representation rep = form.getWebRepresentation();
String url = cp.getUrl() + cp.getDirectory() + "/rancid/clogin/" +rnodea.getDeviceName();
putMethodRWS(cp, url,rep);
}
示例4: updateRWSAuthNode
import org.restlet.data.Form; //导入方法依赖的package包/类
public static void updateRWSAuthNode(ConnectionProperties cp, RancidNodeAuthentication rnodea) throws RancidApiException{
if (!inited){
throw(new RancidApiException("Error: Api not initialized"));
}
Form form = new Form();
form.add("user", rnodea.getUser());
form.add("password", rnodea.getPassword());
form.add("enablepassword", rnodea.getEnablePass());
String autoenable = "0";
if (rnodea.isAutoEnable()){
autoenable="1";
}
form.add("autoenable", autoenable);
form.add("method", rnodea.getConnectionMethodString());
Representation rep = form.getWebRepresentation();
String url = cp.getUrl() + cp.getDirectory() + "/rancid/clogin/" +rnodea.getDeviceName();
postMethodRWS(cp, url,rep);
}
示例5: runtimeParameterResourcePutNotExisting
import org.restlet.data.Form; //导入方法依赖的package包/类
@Test
public void runtimeParameterResourcePutNotExisting() throws IOException, SlipStreamException {
Run run = createAndStoreRunImage("runtimeParameterResourcePutNotExisting");
String key = "node.1:key";
Form form = new Form();
String value = "value of key";
form.add("value", value);
Representation entity = form.getWebRepresentation();
Request request = createPutRequest(run.getUuid(), key, entity);
Response response = executeRequest(request);
run.remove();
assertThat(response.getStatus(), is(Status.CLIENT_ERROR_NOT_FOUND));
}