com.owtelse.util
Class UrlSigner

java.lang.Object
  extended by com.owtelse.util.UrlSigner

public class UrlSigner
extends Object

Used to create signed URL's suitable for use with Google's Enterprise API's. Unlike Google's examples this class can be used by Code compiled to at Lang level 1.5 (Java 5) see the examples at https://developers.google.com/maps/documentation/business/webservices to see how to structure suitable URL arguments.


Constructor Summary
UrlSigner(String keyString)
           
 
Method Summary
 String _doSigning(String path, String query)
          Does the actual signing.
 String signURL(URL url)
          Constuct a URL and pass it to thismethod and it will create a SHA1 signature Base64 encode it at append it to this URL as a signature parameter for more explanation see Google's doco at https://developers.google.com/maps/documentation/business/webservices.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

UrlSigner

public UrlSigner(String keyString)
          throws IOException
Parameters:
keyString - Base64 encoded signing key, as provided by Google when you purchase an Enterprise License.
Throws:
IOException
Method Detail

_doSigning

public String _doSigning(String path,
                         String query)
                  throws NoSuchAlgorithmException,
                         InvalidKeyException,
                         UnsupportedEncodingException,
                         URISyntaxException
Does the actual signing.

Parameters:
path -
query -
Returns:
Throws:
NoSuchAlgorithmException
InvalidKeyException
UnsupportedEncodingException
URISyntaxException

signURL

public String signURL(URL url)
               throws InvalidKeyException,
                      NoSuchAlgorithmException,
                      UnsupportedEncodingException,
                      URISyntaxException
Constuct a URL and pass it to thismethod and it will create a SHA1 signature Base64 encode it at append it to this URL as a signature parameter for more explanation see Google's doco at https://developers.google.com/maps/documentation/business/webservices.

Parameters:
url - must have your client id as param as well as sensor true or false
Returns:
Throws:
InvalidKeyException
NoSuchAlgorithmException
UnsupportedEncodingException
URISyntaxException


Copyright © 2013. All Rights Reserved.