You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I find that if I set 'timeouts' the second of the requests in the following code fails.
I cannot see why ?
With no timeout (which defaults to -1) it works fine,
except on the occasion that the server does not respond - hence I want to use a timeout.
However, adding the timeout(s), of any value, causes a socket read-timeout on the second request ('query.submit')
javax.ws.rs.ProcessingException: java.net.SocketTimeoutException: Read timed out
at org.glassfish.jersey.apache.connector.ApacheConnector.apply(ApacheConnector.java:531)
at org.glassfish.jersey.client.ClientRuntime.invoke(ClientRuntime.java:300)
at org.glassfish.jersey.client.JerseyInvocation.lambda$invoke$0(JerseyInvocation.java:662)
...
Caused by: java.net.SocketTimeoutException: Read timed out
at java.base/sun.nio.ch.NioSocketImpl.timedRead(NioSocketImpl.java:278)
at java.base/sun.nio.ch.NioSocketImpl.implRead(NioSocketImpl.java:304)
// Use HttpClient instead of the default HttpUrlConnection
final ClientConfig clientConfig = new ClientConfig().connectorProvider(new ApacheConnectorProvider());
// Fixes Invalid cookie header: ... Invalid 'expires' attribute: Thu, 01 Dec 1994 16:00:00 GMT
final var reqCfg = RequestConfig.custom() //
.setCookieSpec(CookieSpecs.STANDARD) //
.setConnectionRequestTimeout(timeout_ms.orElse(-1)) //
.setConnectTimeout(timeout_ms.orElse(-1)) //
.setSocketTimeout(timeout_ms.orElse(-1)) //
.build();
clientConfig.property(ApacheClientProperties.REQUEST_CONFIG, reqCfg);
clientConfig.register(MultiPartFeature.class);
final ClientBuilder clientBuilder = ClientBuilder.newBuilder();
clientBuilder.withConfig(clientConfig);
// IBM jazz-apps use JEE Form based authentication
clientBuilder.register(new JEEFormAuthenticator(baseUrl.toString(), userName, password));
final var oslcClient = new OslcClient(clientBuilder);
final var rootServicesUri = baseUrl + "/rootservices";
final Response response = oslcClient.getResource(rootServicesUri.toString(), OSLCConstants.CT_RDF);
final InputStream is = response.readEntity(InputStream.class);
final var rootServices = ModelFactory.createDefaultModel();
rootServices.read(is, rootServicesUri.toString());
final Property prop = rootServices.createProperty(OSLCConstants.OSLC_RM, RootServicesConstants.RM_ROOTSERVICES_CATALOG_PROP);
final Statement stmt = rootServices.getProperty((Resource) null, prop);
final var rmServiceCatalogUrl = stmt.getObject().toString();
final String serviceProviderUrl = oslcClient.lookupServiceProviderUrl(rmServiceCatalogUrl, projectName);
final String queryCapabilityUrl = oslcClient.lookupQueryCapability(serviceProviderUrl, OSLCConstants.OSLC_RM_V2, OSLCConstants.RM_REQUIREMENT_TYPE);
final OslcQueryParameters queryParams = new OslcQueryParameters();
queryParams.setSelect("*");
final OslcQuery query = new OslcQuery(oslcClient, queryCapabilityUrl, queryParams);
final OslcQueryResult result = query.submit();
System.out.println(result.getRawResponse().readEntity(String.class));
The text was updated successfully, but these errors were encountered:
I'm using version 5.1.1.Final
I find that if I set 'timeouts' the second of the requests in the following code fails.
I cannot see why ?
With no timeout (which defaults to -1) it works fine,
except on the occasion that the server does not respond - hence I want to use a timeout.
However, adding the timeout(s), of any value, causes a socket read-timeout on the second request ('query.submit')
The text was updated successfully, but these errors were encountered: