Accessing JCR from remote application (i.e. Hybris)
Hi,
I have written sling servlet to fetch DAM Asset from JCR Repository. Then retrieved InputStream from Rendition of an Asset, so that I can read an asset and write it to servlet response. I have attached servlet code. Code is working fine. When I hit URL http://localhost:4502/bin/testServlet?category=city browser redirects me to login page of CQ. After I enter credentials for login, browser displays an image which is returned from servlet response.
Can anyone please guide me how I can provide authentication in servlet itself, so that browser will not ask for credentials and will show image immediately after hitting URL?
I have also tried below code snippet but it gives me RepositoryException (Unable to access a repository with the following settings:
org.apache.jackrabbit.repository.uri: http://localhost:4502/crx/server).
String remoteURLLocation = "http://localhost:4502/crx/server";
repository = JcrUtils.getRepository(remoteURLLocation);
SimpleCredentials credential = new SimpleCredentials("admin","admin".toCharArray());
session = repository.login(credential);
Please suggest best approach to achieve the same.
Thanks,
Manju