当前位置: 首页>>代码示例>>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;未经允许,请勿转载。