Graphene Implementation 1.0.0.CR3

org.jboss.arquillian.ajocado.utils
Class URLUtils

java.lang.Object
  extended by org.jboss.arquillian.ajocado.utils.URLUtils

public final class URLUtils
extends Object

Provides URL manipulations and functionality.

Version:
$Revision$
Author:
Lukas Fryc

Method Summary
static URL buildUrl(String context, String... relocations)
          Use URL context and one or more relocations to build end URL.
static URL buildUrl(URL context, String... relocations)
          Use URL context and one or more relocations to build end URL.
static String encodeBase64Credentials(String username, String password)
          Encodes credentials using Base64 encoding, which can be used to build a header for HTTP Basic authorization
static String resourceMd5Digest(String url)
          Gets a MD5 digest of some resource obtains as input stream from connection to URL given by URL string.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

buildUrl

public static URL buildUrl(String context,
                           String... relocations)
Use URL context and one or more relocations to build end URL.

Parameters:
context - first URL used like a context root for all relocation changes
relocations - array of relocation URLs
Returns:
end url after all changes made on context with relocations
Throws:
AssertionError - when context or some of relocations are malformed URLs

buildUrl

public static URL buildUrl(URL context,
                           String... relocations)
Use URL context and one or more relocations to build end URL.

Parameters:
context - first URL used like a context root for all relocation changes
relocations - array of relocation URLs
Returns:
end url after all changes made on context with relocations
Throws:
AssertionError - when context or some of relocations are malformed URLs

resourceMd5Digest

public static String resourceMd5Digest(String url)
                                throws IOException
Gets a MD5 digest of some resource obtains as input stream from connection to URL given by URL string.

Parameters:
url - of the resource
Returns:
MD5 message digest of resource
Throws:
IOException - when connection to URL fails

encodeBase64Credentials

public static String encodeBase64Credentials(String username,
                                             String password)
Encodes credentials using Base64 encoding, which can be used to build a header for HTTP Basic authorization

Parameters:
username - User name to be encoded
password - Password to be encoded
Returns:
A string username:password encoded with Base64

Graphene Implementation 1.0.0.CR3

Copyright © 2012 JBoss by Red Hat. All Rights Reserved.