A client has a requirement to get the location of stores based on the zip code authored in the component dialog. Location needs to be pulled from an external API using OSGi services.
Which OSGi Service code snippet should be used to represent the requirement?
A)
@OSGIService(component = Service.class)
public class ServiceImpl implements Service {
@Override
public List
List
// Create an HTTP client
try (CloseableHttpClient httpClient = HttpClients.createDefault()) {
// Processing logic to get all the locations from external api
} catch (IOException e) {
}
return storeLocations;
}
}
B)
@Component(service = Service.class)
public class ServiceImpl implements Service {
@Override
public List
List
// Create an HTTP client
try (CloseableHttpClient httpClient = HttpClients.createDefault()) {
// Processing logic to get all the locations from external api
} catch (IOException e) {
}
return storeLocations;
}
}
C)
@Service(service = Component.class)
public class ServiceImpl implements Service {
@Override
public List
List
// Create an HTTP client
try (CloseableHttpClient httpClient = HttpClients.createDefault()) {
// Processing logic to get all the locations from external api
} catch (IOException e) {
}
return storeLocations;
}
}
Currently there are no comments in this discussion, be the first to comment!