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


Java URIUtil.encodePath方法代码示例

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


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

示例1: getPackageZipFileUrl

import org.apache.commons.httpclient.util.URIUtil; //导入方法依赖的package包/类
@Override
public URI getPackageZipFileUrl(Item item, Attachment attachment)
{
	try
	{
		// Need the_IMS folder, not the _SCORM folder ...?
		String zipFileUrl = institutionService.institutionalise("file/" + item.getItemId() + '/')
			+ FileSystemConstants.IMS_FOLDER + '/'
			+ URIUtil.encodePath(attachment.getUrl(), Charsets.UTF_8.toString());
		return new URI(zipFileUrl);
	}
	catch( URISyntaxException | URIException e )
	{
		throw new RuntimeException(e);
	}
}
 
开发者ID:equella,项目名称:Equella,代码行数:17,代码来源:AttachmentResourceServiceImpl.java

示例2: getContainerReference

import org.apache.commons.httpclient.util.URIUtil; //导入方法依赖的package包/类
@Override
public CloudBlobContainerWrapper getContainerReference(String name)
    throws URISyntaxException, StorageException {
  String fullUri;
  try {
    fullUri = baseUriString + "/" + URIUtil.encodePath(name);
  } catch (URIException e) {
    throw new RuntimeException("problem encoding fullUri", e);
  }

  MockCloudBlobContainerWrapper container = new MockCloudBlobContainerWrapper(
      fullUri, name);
  // Check if we have a pre-existing container with that name, and prime
  // the wrapper with that knowledge if it's found.
  for (PreExistingContainer existing : preExistingContainers) {
    if (fullUri.equalsIgnoreCase(existing.containerUri)) {
      // We have a pre-existing container. Mark the wrapper as created and
      // make sure we use the metadata for it.
      container.created = true;
      backingStore.setContainerMetadata(existing.containerMetadata);
      break;
    }
  }
  return container;
}
 
开发者ID:naver,项目名称:hadoop,代码行数:26,代码来源:MockStorageInterface.java

示例3: fullUriString

import org.apache.commons.httpclient.util.URIUtil; //导入方法依赖的package包/类
private String fullUriString(String relativePath, boolean withTrailingSlash) {
  String fullUri;

  String baseUri = this.baseUri;
  if (!baseUri.endsWith("/")) {
    baseUri += "/";
  }
  if (withTrailingSlash && !relativePath.equals("")
      && !relativePath.endsWith("/")) {
    relativePath += "/";
  }

  try {
    fullUri = baseUri + URIUtil.encodePath(relativePath);
  } catch (URIException e) {
    throw new RuntimeException("problem encoding fullUri", e);
  }

  return fullUri;
}
 
开发者ID:naver,项目名称:hadoop,代码行数:21,代码来源:MockStorageInterface.java

示例4: checkinMethod

import org.apache.commons.httpclient.util.URIUtil; //导入方法依赖的package包/类
/**
 * Execute the CHECKIN method for the given path.
 *
 * @param path the server relative path of the resource to check in
 * @return true if the method is succeeded.
 * @exception HttpException
 * @exception IOException
 */
public boolean checkinMethod(String path)
    throws HttpException, IOException {

    setClient();
    CheckinMethod method = new CheckinMethod(URIUtil.encodePath(path));
    method.setDebug(debug);
    method.setFollowRedirects(this.followRedirects);

    generateIfHeader(method);
    generateTransactionHeader(method);
    int statusCode = client.executeMethod(method);

    setStatusCode(statusCode);

    return (statusCode >= 200 && statusCode < 300) ? true : false;
}
 
开发者ID:integrated,项目名称:jakarta-slide-webdavclient,代码行数:25,代码来源:WebdavResource.java

示例5: uncheckoutMethod

import org.apache.commons.httpclient.util.URIUtil; //导入方法依赖的package包/类
/**
 * Execute the CHECKOUT method for the given path.
 *
 * @param path the server relative path of the resource to act on
 * @return true if the method is succeeded.
 * @exception HttpException
 * @exception IOException
 */
public boolean uncheckoutMethod(String path)
    throws HttpException, IOException {

    setClient();
    UncheckoutMethod method =
        new UncheckoutMethod(URIUtil.encodePath(path));
    method.setDebug(debug);
    method.setFollowRedirects(this.followRedirects);

    generateIfHeader(method);
    generateTransactionHeader(method);
    int statusCode = client.executeMethod(method);

    setStatusCode(statusCode);

    return (statusCode >= 200 && statusCode < 300) ? true : false;
}
 
开发者ID:integrated,项目名称:jakarta-slide-webdavclient,代码行数:26,代码来源:WebdavResource.java

示例6: aclMethod

import org.apache.commons.httpclient.util.URIUtil; //导入方法依赖的package包/类
/**
 * Updates the resource with a new set of aces.
 *
 * @param path the server relative path of the resource to which the given
 *        ACEs shall be applied
 * @param aces the ACEs to apply
 * @return true if the method succeeded
 */
public boolean aclMethod(String path, Ace[] aces)
    throws HttpException, IOException {

    setClient();

    AclMethod method = new AclMethod(URIUtil.encodePath(path));
    method.setDebug(debug);
    method.setFollowRedirects(this.followRedirects);

    generateIfHeader(method);
    for (int i=0; i<aces.length ; i++) {
        Ace ace = aces[i];
        method.addAce(ace);
    }

    generateTransactionHeader(method);
    int statusCode = client.executeMethod(method);

    setStatusCode(statusCode);

    return (statusCode >= 200 && statusCode < 300) ? true : false;
}
 
开发者ID:integrated,项目名称:jakarta-slide-webdavclient,代码行数:31,代码来源:WebdavResource.java

示例7: checkoutMethod

import org.apache.commons.httpclient.util.URIUtil; //导入方法依赖的package包/类
/**
 * Execute the CHECKOUT method for the given path.
 *
 * @param path the server relative path of the resource to check out
 * @return true if the method is succeeded.
 * @exception HttpException
 * @exception IOException
 */
public boolean checkoutMethod(String path)
    throws HttpException, IOException {

    setClient();
    CheckoutMethod method = new CheckoutMethod(URIUtil.encodePath(path));
    method.setDebug(debug);
    method.setFollowRedirects(this.followRedirects);

    generateIfHeader(method);
    generateTransactionHeader(method);
    int statusCode = client.executeMethod(method);

    setStatusCode(statusCode);

    return (statusCode >= 200 && statusCode < 300) ? true : false;
}
 
开发者ID:integrated,项目名称:jakarta-slide-webdavclient,代码行数:25,代码来源:WebdavResource.java

示例8: deleteMethod

import org.apache.commons.httpclient.util.URIUtil; //导入方法依赖的package包/类
/**
 * Execute the DELETE method for the given path.
 *
 * @param path the server relative path of the resource to delete
 * @return true if the method is succeeded.
 * @exception HttpException
 * @exception IOException
 */
public boolean deleteMethod(String path)
    throws HttpException, IOException {

    setClient();
    DeleteMethod method = new DeleteMethod(URIUtil.encodePath(path));
    method.setDebug(debug);
    method.setFollowRedirects(this.followRedirects);

    generateIfHeader(method);
    generateTransactionHeader(method);
    int statusCode = client.executeMethod(method);

    setStatusCode(statusCode);
    return (statusCode >= 200 && statusCode < 300) ? true : false;
}
 
开发者ID:integrated,项目名称:jakarta-slide-webdavclient,代码行数:24,代码来源:WebdavResource.java

示例9: moveMethod

import org.apache.commons.httpclient.util.URIUtil; //导入方法依赖的package包/类
/**
 * Execute the MOVE method for the given source and destination.
 *
 * @param source the source resource as a server relativ path
 * @param destination the destination to move to as a server relative path
 * @return true if the method is succeeded.
 * @exception HttpException
 * @exception IOException
 */
public boolean moveMethod(String source, String destination)
    throws HttpException, IOException {

    setClient();
    MoveMethod method = new MoveMethod(URIUtil.encodePath(source),
                                       URIUtil.encodePath(destination));
    method.setDebug(debug);
    method.setFollowRedirects(this.followRedirects);
    generateIfHeader(method);
    method.setOverwrite(overwrite);
    generateTransactionHeader(method);
    int statusCode = client.executeMethod(method);

    // Possbile MOVE Status Codes => SC_CREATED, SC_NO_CONTENT
    // WebdavStatus.SC_FORBIDDEN, SC_CONFLICT, SC_PRECONDITION_FAILED,
    // SC_LOCKED, SC_BAD_GATEWAY
    setStatusCode(statusCode);
    return (statusCode >= 200 && statusCode < 300) ? true : false;
}
 
开发者ID:integrated,项目名称:jakarta-slide-webdavclient,代码行数:29,代码来源:WebdavResource.java

示例10: unbindMethod

import org.apache.commons.httpclient.util.URIUtil; //导入方法依赖的package包/类
/**
 * Execute the UNBIND method given the resource to Unbind.
 *
 * @param binding  the server relative path of the resource to unbind
 * @return true if the method is succeeded.
 * @exception HttpException
 * @exception IOException
 */
public boolean unbindMethod(String binding)
    throws HttpException, IOException {

    setClient();
    UnbindMethod method =
        new UnbindMethod(URIUtil.encodePath(binding));
    method.setDebug(debug);
    generateTransactionHeader(method);
    int statusCode = client.executeMethod(method);

    // Possbile BIND Status Codes => SC_CREATED, SC_NOT_FOUND
    // WebdavStatus.SC_FORBIDDEN, SC_CONFLICT, SC_PRECONDITION_FAILED,
    // SC_LOCKED, SC_BAD_GATEWAY
    setStatusCode(statusCode);
    return statusCode >= 200 && statusCode < 300;
}
 
开发者ID:integrated,项目名称:jakarta-slide-webdavclient,代码行数:25,代码来源:WebdavResource.java

示例11: mkcolMethod

import org.apache.commons.httpclient.util.URIUtil; //导入方法依赖的package包/类
/**
 * Execute the MKCOL method for the given path.
 *
 * @param path the server relative path at which to create a new collection
 *        resource
 * @return true if the method is succeeded.
 * @exception HttpException
 * @exception IOException
 */
public boolean mkcolMethod(String path)
    throws HttpException, IOException {

    setClient();
    MkcolMethod method = new MkcolMethod(URIUtil.encodePath(path));

    generateIfHeader(method);
    generateTransactionHeader(method);
    int statusCode = client.executeMethod(method);

    // Possbile MKCOL Status Codes => SC_CREATED
    // WebdavStatus.SC_FORBIDDEN, SC_METHOD_NOT_ALLOWED, SC_CONFLICT,
    // SC_LOCKED, SC_UNSUPPORTED_MEDIA_TYPE, SC_INSUFFICIENT_STORAGE
    setStatusCode(statusCode);
    return (statusCode >= 200 && statusCode < 300) ? true : false;
}
 
开发者ID:integrated,项目名称:jakarta-slide-webdavclient,代码行数:26,代码来源:WebdavResource.java

示例12: versionControlMethod

import org.apache.commons.httpclient.util.URIUtil; //导入方法依赖的package包/类
public boolean versionControlMethod(String path)
    throws HttpException, IOException {

    setClient();

    VersionControlMethod method = new VersionControlMethod(
                                        URIUtil.encodePath(path));
    method.setDebug(debug);
    method.setFollowRedirects(this.followRedirects);
    generateIfHeader(method);
    generateTransactionHeader(method);
    int statusCode = client.executeMethod(method);

    setStatusCode(statusCode);

    return (statusCode >= 200 && statusCode < 300) ? true : false;
}
 
开发者ID:integrated,项目名称:jakarta-slide-webdavclient,代码行数:18,代码来源:WebdavResource.java

示例13: updateMethod

import org.apache.commons.httpclient.util.URIUtil; //导入方法依赖的package包/类
/**
 * Update the specified resource to the specified target
 *
 * @param path the server relative path of the resource to update
 * @param target path of the target to update from (history resource)
 * @return true if the method has succeeded
 * @exception HttpException
 * @exception IOException
 */
public boolean updateMethod(String path, String target)
    throws HttpException, IOException {

    setClient();
    UpdateMethod method = new UpdateMethod(URIUtil.encodePath(path),
                                           URIUtil.encodePath(target));
    method.setDebug(debug);
    method.setFollowRedirects(this.followRedirects);

    generateIfHeader(method);
    generateTransactionHeader(method);
    int statusCode = client.executeMethod(method);

    setStatusCode(statusCode);

    return (statusCode >= 200 && statusCode < 300) ? true : false;
}
 
开发者ID:integrated,项目名称:jakarta-slide-webdavclient,代码行数:27,代码来源:WebdavResource.java

示例14: encodePath

import org.apache.commons.httpclient.util.URIUtil; //导入方法依赖的package包/类
/**
 * Escape and encode a string regarded as the path component of an URI.
 * @param path the path component to encode
 * @return encoded path, null if UTF-8 is not supported
 */
public static String encodePath(final String path) {
  try {
    return URIUtil.encodePath(path, "UTF-8");
  } catch (URIException e) {
    throw new AssertionError("JVM does not support UTF-8"); // should never happen!
  }
}
 
开发者ID:naver,项目名称:hadoop,代码行数:13,代码来源:ServletUtil.java

示例15: getUrl

import org.apache.commons.httpclient.util.URIUtil; //导入方法依赖的package包/类
protected String getUrl() {
	try {
		return URIUtil.encodePath(url);
	} catch (URIException e) {
		LOG.error("Can't encode URL " + url);
	}

	return url;
}
 
开发者ID:jorcox,项目名称:GeoCrawler,代码行数:10,代码来源:AbstractCommonCrawlFormat.java


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