Inputs from felix console | Community
Skip to main content
New Participant
January 24, 2017
Solved

Inputs from felix console

  • January 24, 2017
  • 2 replies
  • 1193 views

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.

This post is no longer active and is closed to new replies. Need help? Start a new post to ask your question.
Best answer by kautuk_sahni

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-manager.topic.html/forum__pg8f-i_am_extendingmymo.html

// Read property from OSGI configuration in AEM

[1] https://helpx.adobe.com/experience-manager/using/osgi_config.html

~kautuk

2 replies

kautuk_sahni
kautuk_sahniAccepted solution
Employee
January 25, 2017

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-manager.topic.html/forum__pg8f-i_am_extendingmymo.html

// Read property from OSGI configuration in AEM

[1] https://helpx.adobe.com/experience-manager/using/osgi_config.html

~kautuk

Kautuk Sahni
smacdonald2008
New Participant
January 24, 2017

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