private static final Logger LOGGER = Logger.getLogger(GoogleURLShortener.class.getName());
@Override
public String shortURL(String url) throws NoSuchAlgorithmException, IOException {
// setup up the HTTP transport
HttpTransport transport = new NetHttpTransport();
// add default headers
GoogleHeaders headers = new GoogleHeaders();
headers.setApplicationName("Hirubila/1.0");
headers.put("Content-Type", "application/json");
transport.defaultHeaders = headers;
//JsonCParser parser = new JsonCParser();
JsonHttpParser parser = new JsonHttpParser();
parser.jsonFactory = new JacksonFactory();
transport.addParser(parser);
// build the HTTP POST request and URL
HttpRequest request = transport.buildPostRequest();
request.setUrl(GOOGL_URL);
GenericData data = new GenericData();
data.put("longUrl", url);
JsonHttpContent content = new JsonHttpContent();