Code example for URI

Methods: toString

        values.put("longitude", location.getLongitude());
        values.put("latitude", location.getLatitude());
        values.put("accuracy", location.getAccuracy());
        values.put("limit", prefs.getPullLimit());
        URI uri = uriTemplate.expand(values);
        Log.d(TAG, "Calling " + uri.toString());
        DisplayGeoMessage[] forObject = restTemplate.getForObject(uri, DisplayGeoMessage[].class);
        return Arrays.asList(forObject);
     * Submits a message to the server 
     * @param location GPS location 
     * @param content message to post 
     * @return Result with state and accepted message 
    public Result composeMessage(Location location, String content) {
        String url = prefs.getApiUrl() + "/messages";
        ComposeGeoMessage message = new ComposeGeoMessage(content, location.getLongitude(), location.getLatitude(), location.getAccuracy(), prefs.getUsername(), prefs.getIdentificationToken());
        return restTemplate.postForObject(url, message, Result.class);
Experience pair programming with AI  Get Codota for Java