Deal of The Day! Hurry Up, Grab the Special Discount - Save 25% - Ends In 00:00:00 Coupon code: SAVE25
Welcome to Pass4Success

- Free Preparation Discussions

Adobe Exam AD0-E137 Topic 1 Question 5 Discussion

Actual exam question for Adobe's AD0-E137 exam
Question #: 5
Topic #: 1
[All AD0-E137 Questions]

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 getStoresByZipCode(String zipCode) {

List storeLocations = new ArrayList<>();

// 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 getStoresByZipCode(String zipCode) {

List storeLocations = new ArrayList<>();

// 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 getStoresByZipCode(String zipCode) {

List storeLocations = new ArrayList<>();

// Create an HTTP client

try (CloseableHttpClient httpClient = HttpClients.createDefault()) {

// Processing logic to get all the locations from external api

} catch (IOException e) {

}

return storeLocations;

}

}

Show Suggested Answer Hide Answer
Suggested Answer: B

Contribute your Thoughts:

Currently there are no comments in this discussion, be the first to comment!


Save Cancel