


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.
Views
Replies
Sign in to like this content
Total Likes
Hi
Please have a look at the Adobe Helps article Scott shared [1].
To read valued, we can use OSGI configurations. OSGI configuration can be a place to input/configure the properties.
Some more ways to do so are: Link:- http://help-forums.adobe.com/content/adobeforums/en/experience-manager-forum/adobe-experience-manage...
// Read property from OSGI configuration in AEM
[1] https://helpx.adobe.com/experience-manager/using/osgi_config.html
~kautuk
Views
Replies
Sign in to like this content
Total Likes
By this term -- I need to provide input from the felix console
I am assuming you mean you want to know how to read OSGi configuration values.
Read this article -
https://helpx.adobe.com/experience-manager/using/osgi_config.html.
Hope this helps
Views
Replies
Sign in to like this content
Total Likes
Hi
Please have a look at the Adobe Helps article Scott shared [1].
To read valued, we can use OSGI configurations. OSGI configuration can be a place to input/configure the properties.
Some more ways to do so are: Link:- http://help-forums.adobe.com/content/adobeforums/en/experience-manager-forum/adobe-experience-manage...
// Read property from OSGI configuration in AEM
[1] https://helpx.adobe.com/experience-manager/using/osgi_config.html
~kautuk
Views
Replies
Sign in to like this content
Total Likes