use of org.apache.cayenne.rop.http.JettyHttpROPConnector in project cayenne by apache.
the class JettyHttpClientConnectionProvider method createJettyHttpRopConnector.
protected JettyHttpROPConnector createJettyHttpRopConnector() {
String url = runtimeProperties.get(ClientConstants.ROP_SERVICE_URL_PROPERTY);
if (url == null) {
throw new ConfigurationException("No property defined for '%s', can't initialize connection", ClientConstants.ROP_SERVICE_URL_PROPERTY);
}
String username = runtimeProperties.get(ClientConstants.ROP_SERVICE_USERNAME_PROPERTY);
long readTimeout = runtimeProperties.getLong(ClientConstants.ROP_SERVICE_TIMEOUT_PROPERTY, -1L);
HttpClient httpClient = initJettyHttpClient();
addBasicAuthentication(httpClient, url, username);
JettyHttpROPConnector result = new JettyHttpROPConnector(httpClient, url, username);
if (readTimeout > 0) {
result.setReadTimeout(readTimeout);
}
return result;
}
use of org.apache.cayenne.rop.http.JettyHttpROPConnector in project cayenne by apache.
the class JettyHttpClientConnectionProvider method get.
@Override
public ClientConnection get() throws DIRuntimeException {
String sharedSession = runtimeProperties.get(ClientConstants.ROP_SERVICE_SHARED_SESSION_PROPERTY);
JettyHttpROPConnector ropConnector = createJettyHttpRopConnector();
ProxyRemoteService remoteService = new ProxyRemoteService(serializationService, ropConnector);
HttpClientConnection clientConnection = new HttpClientConnection(remoteService, sharedSession);
ropConnector.setClientConnection(clientConnection);
return clientConnection;
}
Aggregations