本文整理匯總了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));
}