当前位置: 首页>>代码示例>>Java>>正文


Java HttpURL.getEscapedPath方法代码示例

本文整理汇总了Java中org.apache.commons.httpclient.HttpURL.getEscapedPath方法的典型用法代码示例。如果您正苦于以下问题:Java HttpURL.getEscapedPath方法的具体用法?Java HttpURL.getEscapedPath怎么用?Java HttpURL.getEscapedPath使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在org.apache.commons.httpclient.HttpURL的用法示例。


在下文中一共展示了HttpURL.getEscapedPath方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: reportMethod

import org.apache.commons.httpclient.HttpURL; //导入方法依赖的package包/类
/**
 * Execute the REPORT method.
 */
public Enumeration reportMethod(HttpURL httpURL, int depth)

    throws HttpException, IOException {
    setClient();
    // Default depth=0, type=by_name
    ReportMethod method = new ReportMethod(httpURL.getEscapedPath(),
                                           depth);
    method.setDebug(debug);
    method.setFollowRedirects(this.followRedirects);
    generateTransactionHeader(method);
    client.executeMethod(method);

    Vector results = new Vector();

    Enumeration responses = method.getResponses();
    while (responses.hasMoreElements()) {
        ResponseEntity response = (ResponseEntity) responses.nextElement();
        String href = response.getHref();
        String sResult = href;

        // Set status code for this resource.
        if ((thisResource == true) && (response.getStatusCode() > 0))
            setStatusCode(response.getStatusCode());
        thisResource = false;

        Enumeration responseProperties = method.getResponseProperties(href);
        while (responseProperties.hasMoreElements()) {
            Property property = (Property) responseProperties.nextElement();
            sResult += "\n" + property.getName() + ":\t" +
                DOMUtils.getTextValue(property.getElement());

        }
        results.addElement(sResult);
    }

    return results.elements();
}
 
开发者ID:integrated,项目名称:jakarta-slide-webdavclient,代码行数:41,代码来源:WebdavResource.java

示例2: optionsMethod

import org.apache.commons.httpclient.HttpURL; //导入方法依赖的package包/类
/**
 * Execute OPTIONS method for the given http URL.
 *
 * @param httpURL the http URL.
 * @return the allowed methods and capabilities.
 * @exception HttpException
 * @exception IOException
 */
public Enumeration optionsMethod(HttpURL httpURL)
    throws HttpException, IOException {

    HttpClient client = getSessionInstance(httpURL, true);

    OptionsMethod method = new OptionsMethod(httpURL.getEscapedPath());
    method.setDebug(debug);
    method.setFollowRedirects(this.followRedirects);

    generateTransactionHeader(method);
    client.executeMethod(method);

    Vector options = new Vector();
    int statusCode = method.getStatusLine().getStatusCode();
    if (statusCode >= 200 && statusCode < 300) {
        // check if the specific method is possbile
        Enumeration allowedMethods = method.getAllowedMethods();
        while (allowedMethods.hasMoreElements()) {
            options.addElement(allowedMethods.nextElement());
        }
        // check WebDAV capabilities.
        Enumeration davCapabilities = method.getDavCapabilities();
        while (davCapabilities.hasMoreElements()) {
            options.addElement(davCapabilities.nextElement());
        }
        Enumeration responses = method.getResponses();
        if (responses.hasMoreElements()) {
            ResponseEntity response =
                (ResponseEntity) responses.nextElement();
            Enumeration workspaces = response.getWorkspaces();
            String sResult="";
            while (workspaces.hasMoreElements()){
                sResult += workspaces.nextElement().toString();
            }
            Enumeration histories = response.getHistories();
            while (histories.hasMoreElements()){
                sResult += histories.nextElement().toString();
            }
            // Set status code for this resource.
            if ((thisResource == true) && (response.getStatusCode() > 0))
                setStatusCode(response.getStatusCode());
            thisResource = false;
            options.addElement(sResult);
        }
    }

    return options.elements();
}
 
开发者ID:integrated,项目名称:jakarta-slide-webdavclient,代码行数:57,代码来源:WebdavResource.java


注:本文中的org.apache.commons.httpclient.HttpURL.getEscapedPath方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。