I'm using this simplest code to connect to AEM. This is working when I am not behind the proxy but it is not working with proxy. I do not see any option to give proxy while making connection. -
Jcr2davRepositoryFactory repositoryFactory = new Jcr2davRepositoryFactory();
Map<String, Object> parameters = new HashMap();
parameters.put("org.apache.jackrabbit.repository.uri", remoteURL);
repository = repositoryFactory.getRepository(parameters);
Here repository is coming as null when I am behind the proxy server. Any solution?
Solved! Go to Solution.
Views
Replies
Total Likes
You can specify the proxy server using the following code snippet. Just add these lines before you make the connection.
System.setProperty("http.proxyHost", "<host-add>");
System.setProperty("http.proxyPort", "<port-number>");
Or you can pass them in arguments as system properties to the java program-
java -Dhttp.proxyHost=<hostname> -Dhttp.proxyPort=<portname> <FQN of main class>
Views
Replies
Total Likes
You can specify the proxy server using the following code snippet. Just add these lines before you make the connection.
System.setProperty("http.proxyHost", "<host-add>");
System.setProperty("http.proxyPort", "<port-number>");
Or you can pass them in arguments as system properties to the java program-
java -Dhttp.proxyHost=<hostname> -Dhttp.proxyPort=<portname> <FQN of main class>
Views
Replies
Total Likes
Hi,
so you want to create JCR connection to a remote repository using Davex? I don't know if the provided API supports the usage of a proxy. It might work, but I've never tried it. Have you already checked the available source code of jackrabbit, if this feature is supported?
kind regards,
Jörg
Views
Replies
Total Likes
I had tried this before, it does not work
Views
Replies
Total Likes
Hi Jorg,
The provided JCR API does not support this-
In the getClient() method, if I add proxy code then I think it will work, I will have to try
if (client == null) { client = new HttpClient(connectionManager); client.setHostConfiguration(hostConfig); // NOTE: null credentials only work if 'missing-auth-mapping' param is // set on the server org.apache.commons.httpclient.Credentials creds = null; if (sessionInfo != null) { checkSessionInfo(sessionInfo); creds = ((SessionInfoImpl) sessionInfo).getCredentials().getCredentials(); // always send authentication not waiting for 401 client.getParams().setAuthenticationPreemptive(true); } client.getState().setCredentials(AuthScope.ANY, creds); /* client.getState().setProxyCredentials(authScope, creds); */clients.put(clientKey, client);
Views
Replies
Total Likes
Views
Like
Replies