Created
November 7, 2011 19:57
-
-
Save federecio/1345980 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| @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