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


Java DeleteMethod.getResponseBody方法代碼示例

本文整理匯總了Java中org.apache.commons.httpclient.methods.DeleteMethod.getResponseBody方法的典型用法代碼示例。如果您正苦於以下問題:Java DeleteMethod.getResponseBody方法的具體用法?Java DeleteMethod.getResponseBody怎麽用?Java DeleteMethod.getResponseBody使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在org.apache.commons.httpclient.methods.DeleteMethod的用法示例。


在下文中一共展示了DeleteMethod.getResponseBody方法的4個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: delete

import org.apache.commons.httpclient.methods.DeleteMethod; //導入方法依賴的package包/類
/**
 * Send a DELETE request
 * @param cluster the cluster definition
 * @param path the path or URI
 * @return a Response object with response detail
 * @throws IOException
 */
public Response delete(Cluster cluster, String path) throws IOException {
  DeleteMethod method = new DeleteMethod();
  try {
    int code = execute(cluster, method, null, path);
    Header[] headers = method.getResponseHeaders();
    byte[] content = method.getResponseBody();
    return new Response(code, headers, content);
  } finally {
    method.releaseConnection();
  }
}
 
開發者ID:fengchen8086,項目名稱:ditb,代碼行數:19,代碼來源:Client.java

示例2: deleteSiteComponent

import org.apache.commons.httpclient.methods.DeleteMethod; //導入方法依賴的package包/類
/**
 * Deletes component from site
 * 
 * @param httpClient HTTP client
 * @param siteName name of the site
 * @param user current user
 * @param componentName name of the component
 */
private void deleteSiteComponent(HttpClient httpClient, String siteName, SessionUser user, String componentName)
        {
    DeleteMethod deleteTitleMethod = new DeleteMethod(getAlfrescoHostWithPort() + getAlfrescoContext() + "/s/remoteadm/delete/alfresco/site-data/components/page." + componentName
            + ".site~" + siteName + "~dashboard.xml?s=sitestore&alf_ticket=" + user.getTicket());
    try
    {
        if (logger.isDebugEnabled())
            logger.debug("Trying to delete site component with name: " + siteName);

        int status = httpClient.executeMethod(deleteTitleMethod);
        deleteTitleMethod.getResponseBody();

        if (logger.isDebugEnabled())
            logger.debug("Delete site component method returned status: " + status);
    }
    catch (Exception e)
    {
        if (logger.isDebugEnabled())
            logger.debug("Fail to delete component from site with name: " + siteName);
        throw new RuntimeException(e);
    }
    finally
    {
        deleteTitleMethod.releaseConnection();
    }
}
 
開發者ID:Alfresco,項目名稱:community-edition-old,代碼行數:35,代碼來源:ShareUtils.java

示例3: deleteSiteDashboard

import org.apache.commons.httpclient.methods.DeleteMethod; //導入方法依賴的package包/類
/**
 * Deletes site dashboard
 * 
 * @param httpClient HTTP client
 * @param siteName name of the site
 * @param user current user
 */
private void deleteSiteDashboard(HttpClient httpClient, String siteName, SessionUser user)
{
    DeleteMethod deleteDashboardMethod = new DeleteMethod(getAlfrescoHostWithPort() + getAlfrescoContext() + "/s/remoteadm/delete/alfresco/site-data/pages/site/" + siteName
            + "/dashboard.xml?s=sitestore&alf_ticket=" + user.getTicket());
    try
    {
        if (logger.isDebugEnabled())
            logger.debug("Trying to delete dashboard from site with name: " + siteName);

        int status = httpClient.executeMethod(deleteDashboardMethod);
        deleteDashboardMethod.getResponseBody();

        if (logger.isDebugEnabled())
            logger.debug("Delete dashboard from site method returned status: " + status);
    }
    catch (Exception e)
    {
        if (logger.isDebugEnabled())
            logger.debug("Fail to delete dashboard from site with name: " + siteName);
        throw new RuntimeException(e);
    }
    finally
    {
        deleteDashboardMethod.releaseConnection();
    }
}
 
開發者ID:Alfresco,項目名稱:community-edition-old,代碼行數:34,代碼來源:ShareUtils.java

示例4: deleteSite

import org.apache.commons.httpclient.methods.DeleteMethod; //導入方法依賴的package包/類
/**
 * Deletes site using REST API, http method is sent to appropriate web script
 * 
 * @param user current user
 * @param shortName shortName of site we are going to delete
 * @throws HttpException
 * @throws IOException
 */
public void deleteSite(SessionUser user, String shortName) throws HttpException, IOException
{
    HttpClient httpClient = new HttpClient();
    DeleteMethod deleteSiteMethod = new DeleteMethod(getAlfrescoHostWithPort() + getAlfrescoContext() + "/s/api/sites/" + shortName + "?alf_ticket=" + user.getTicket());
    try
    {
        if (logger.isDebugEnabled())
            logger.debug("Trying to delete site with name: " + shortName);

        int status = httpClient.executeMethod(deleteSiteMethod);
        if (logger.isDebugEnabled())
            logger.debug("Delete site method returned status: " + status);
        if (status != HttpStatus.SC_OK) 
        {
            throw new RuntimeException("Failed to delete site with name: " + shortName + ". Returned status is: " + status +
                    ". \n Response from server :\n" + deleteSiteMethod.getResponseBodyAsString()); 
        }
        deleteSiteMethod.getResponseBody();
    }
    catch (Exception e)
    {
        if (logger.isDebugEnabled())
            logger.debug("Fail to delete site with name: " + shortName);
        throw new RuntimeException(e);
    }
    finally
    {
        deleteSiteMethod.releaseConnection();
    }

    // deletes site dashboard
    deleteSiteDashboard(httpClient, shortName, user);

    // deletes title component
    deleteSiteComponent(httpClient, shortName, user, "title");

    // deletes navigation component
    deleteSiteComponent(httpClient, shortName, user, "navigation");

    // deletes component-2-2 component
    deleteSiteComponent(httpClient, shortName, user, "component-2-2");

    // deletes component-1-1 component
    deleteSiteComponent(httpClient, shortName, user, "component-1-1");

    // deletes component-2-1 component
    deleteSiteComponent(httpClient, shortName, user, "component-2-1");

    // deletes component-1-2 component
    deleteSiteComponent(httpClient, shortName, user, "component-1-2");
}
 
開發者ID:Alfresco,項目名稱:community-edition-old,代碼行數:60,代碼來源:ShareUtils.java


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