當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。