當前位置: 首頁>>代碼示例>>Java>>正文


Java Form.getWebRepresentation方法代碼示例

本文整理匯總了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);
    
}
 
開發者ID:OpenNMS,項目名稱:rancid-api,代碼行數:18,代碼來源:RWSClientApi.java

示例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);
        
    }
 
開發者ID:OpenNMS,項目名稱:rancid-api,代碼行數:18,代碼來源:RWSClientApi.java

示例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);        
}
 
開發者ID:OpenNMS,項目名稱:rancid-api,代碼行數:23,代碼來源:RWSClientApi.java

示例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);        
}
 
開發者ID:OpenNMS,項目名稱:rancid-api,代碼行數:23,代碼來源:RWSClientApi.java

示例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));
}
 
開發者ID:slipstream,項目名稱:SlipStreamServer,代碼行數:20,代碼來源:RuntimeParameterResourceTest.java


注:本文中的org.restlet.data.Form.getWebRepresentation方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。