Advertisement
Guest User

Untitled

a guest
Nov 20th, 2019
107
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 0.80 KB | None | 0 0
  1. public static void main(String[] args) {
  2.         context.getLogger().log("\nfunction-name: " + context.getFunctionName());
  3.         context.getLogger().log("\ncity: " + input.getCity());
  4.  
  5.         Client client = ClientBuilder.newClient();
  6.         WebTarget webTarget
  7.           = client.target("https://api.openweathermap.org/data/2.5/weather?q=London,uk&appid=555852debfe15e7053e83ba408d23e2f");
  8.         Invocation.Builder invocationBuilder
  9.           = webTarget.request(MediaType.APPLICATION_JSON);
  10.         WeatherResponse response
  11.           = invocationBuilder.get(WeatherResponse.class);
  12.        
  13.         for(Weather w: response.getWeather()) {
  14.             System.out.println("weather detail:" + w.getDescription());
  15.         }
  16.        
  17.         context.getLogger().log("\nreturning: " + response);
  18.         context.getLogger().log("\n\n");
  19.        
  20.         return new HandlerResponse(response);
  21.    
  22.         }
  23.     }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement