Skip to content

Instantly share code, notes, and snippets.

@federecio
Created November 7, 2011 19:57
Show Gist options
  • Select an option

  • Save federecio/1345980 to your computer and use it in GitHub Desktop.

Select an option

Save federecio/1345980 to your computer and use it in GitHub Desktop.
@Processor
public String getDistance(@Optional @Default("San+Francisco") String origin,
String destination) throws Exception
{
String effectiveUrl = String.format(PROTOTYPE_URL, origin, destination, distanceUnit);
InputStream responseStream = new URL(effectiveUrl).openConnection().getInputStream();
try
{
return getXPath(responseStream, DISTANCE_XPATH);
}
finally
{
IOUtils.closeQuietly(responseStream);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment