Exam AD0-E103 All QuestionsBrowse all questions from this exam
Question 42

A developer is writing Java code using the Sling API that needs to work with the JCR directly. The code needs to obtain a Session object.

A service user named "reposervice" may be mapped outside the code.

Which two methods could a developer use to obtain a Session without using a deprecated API? (Choose two.)

A.

B.

C.

D.

E.

    Correct Answer:

    To obtain a Session object in Java using the Sling API without using a deprecated API, a developer should avoid methods like getAdministrativeResourceResolver() and loginAdministrative(), which have both been deprecated due to security concerns. Therefore, the suitable approaches can be found in options B and D. Option B uses repo.loginService, which is not deprecated, and option D uses getServiceResourceResolver, which also is not deprecated. Both of these methods provide ways to obtain a Session object securely without relying on deprecated methods.

Discussion
AkashD

Answer is B & D. As AdministrativeseriveResoolver and LoginService both are deprecated

mazbor

it is loginAdministrative witch is deperated but not LoginService ! Ok fot Answer : B & D