org.apache.openejb.util
Class URISupport

java.lang.Object
  extended by org.apache.openejb.util.URISupport

public class URISupport
extends Object

Swiped verbatim from ActiveMQ... the URI kings. URI relativize(URI, URI) added afterwards to deal with the non-functional URI.relativize(URI) method


Nested Class Summary
static class URISupport.CompositeData
           
 
Constructor Summary
URISupport()
           
 
Method Summary
static URI changeScheme(URI bindAddr, String scheme)
           
static boolean checkParenthesis(String str)
           
static String createQueryString(Map options)
           
static URI createRemainingURI(URI originalURI, Map params)
          Creates a URI from the original URI and the remaining paramaters
static URI createURIWithQuery(URI uri, String query)
          Creates a URI with the given query
 int indexOfParenthesisMatch(String str)
           
static URISupport.CompositeData parseComposite(URI uri)
           
static Map<String,String> parseParamters(URI uri)
           
static Map<String,String> parseQuery(String uri)
           
static URI relativize(URI a, URI b)
          URI absoluteA = new URI("/Users/dblevins/work/openejb3/container/openejb-jee/apple/"); URI absoluteB = new URI("/Users/dblevins/work/openejb3/container/openejb-core/foo.jar"); URI relativeB = URISupport.relativize(absoluteA, absoluteB); assertEquals("../../openejb-core/foo.jar", relativeB.toString()); URI resolvedB = absoluteA.resolve(relativeB); assertTrue(resolvedB.equals(absoluteB));
static URI removeQuery(URI uri)
          Removes any URI query from the given uri
static String stripPrefix(String value, String prefix)
           
static URI stripScheme(URI uri)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

URISupport

public URISupport()
Method Detail

relativize

public static URI relativize(URI a,
                             URI b)
URI absoluteA = new URI("/Users/dblevins/work/openejb3/container/openejb-jee/apple/"); URI absoluteB = new URI("/Users/dblevins/work/openejb3/container/openejb-core/foo.jar"); URI relativeB = URISupport.relativize(absoluteA, absoluteB); assertEquals("../../openejb-core/foo.jar", relativeB.toString()); URI resolvedB = absoluteA.resolve(relativeB); assertTrue(resolvedB.equals(absoluteB));

Parameters:
a -
b -
Returns:
relative b

parseQuery

public static Map<String,String> parseQuery(String uri)
                                     throws URISyntaxException
Throws:
URISyntaxException

parseParamters

public static Map<String,String> parseParamters(URI uri)
                                         throws URISyntaxException
Throws:
URISyntaxException

removeQuery

public static URI removeQuery(URI uri)
                       throws URISyntaxException
Removes any URI query from the given uri

Throws:
URISyntaxException

createURIWithQuery

public static URI createURIWithQuery(URI uri,
                                     String query)
                              throws URISyntaxException
Creates a URI with the given query

Throws:
URISyntaxException

parseComposite

public static URISupport.CompositeData parseComposite(URI uri)
                                               throws URISyntaxException
Throws:
URISyntaxException

stripPrefix

public static String stripPrefix(String value,
                                 String prefix)

stripScheme

public static URI stripScheme(URI uri)
                       throws URISyntaxException
Throws:
URISyntaxException

createQueryString

public static String createQueryString(Map options)
                                throws URISyntaxException
Throws:
URISyntaxException

createRemainingURI

public static URI createRemainingURI(URI originalURI,
                                     Map params)
                              throws URISyntaxException
Creates a URI from the original URI and the remaining paramaters

Throws:
URISyntaxException

changeScheme

public static URI changeScheme(URI bindAddr,
                               String scheme)
                        throws URISyntaxException
Throws:
URISyntaxException

checkParenthesis

public static boolean checkParenthesis(String str)

indexOfParenthesisMatch

public int indexOfParenthesisMatch(String str)


Copyright © 1999-2011 The Apache OpenEJB development community. All Rights Reserved.