this is my service="http://api.openweathermap.org/data/2.5/weather?q=London,uk&APPID=2707cfaa99b15c9d63d10a91ad164b49"
I need to provide input from the felix console and get the weather info of the location using the appID.
Following is my servlet class:
import java.io.IOException;
import org.apache.felix.scr.annotations.Component;
import org.apache.felix.scr.annotations.Properties;
import org.apache.felix.scr.annotations.Property;
import org.apache.felix.scr.annotations.Reference;
import org.apache.felix.scr.annotations.sling.SlingServlet;
import org.apache.sling.api.SlingHttpServletRequest;
import org.apache.sling.api.SlingHttpServletResponse;
import org.apache.sling.api.servlets.SlingSafeMethodsServlet;
import com.adobe.philips.core.services.Weather;
@SlingServlet(paths="/bin/WeatherInfo/calc", metatype = true)
@Properties({
@Property(name = "AppId", value = "2707cfaa99b15c9d63d10a91ad164b49")
})
public class WeatherInfoServlet extends SlingSafeMethodsServlet {
@Reference
private Weather weather;
public void doGet(SlingHttpServletRequest request, SlingHttpServletResponse response) throws IOException
{
response.setContentType("application/json");
response.getWriter().write(weather.getWeatherInfo());
}
}
I am able to edit the value in the felix console, I need to know how to read it back in the servlet and provide input in the felix console.