ResponseWriter writer = context.getResponseWriter();
YahooWeather yahooWeather = (YahooWeather) component;
String locationCode = yahooWeather.getLocationCode();
String temperatureType = yahooWeather.getTemperatureType();
List<ServiceParameter> parameters = new ArrayList<ServiceParameter>();
YahooWeatherService yahooWeatherService = YahooServicesFactory.getYahooWeatherService();
parameters.add(new ServiceParameter(YahooWeatherServiceParameters.ZIP_CODE, locationCode));
parameters.add(new ServiceParameter(YahooWeatherServiceParameters.TEMPERATURE_TYPE, temperatureType));
try {
YahooWeatherServiceStatus status = yahooWeatherService.getWeatherStatus(parameters);
writer.write(status.toString());
} catch (InvalidLocationException exception) {
writer.write("");
} catch (Exception exception) {