use of org.apache.jackrabbit.webdav.client.methods.HttpSubscribe in project jackrabbit by apache.
the class RepositoryServiceImpl method subscribe.
private String subscribe(String uri, SubscriptionInfo subscriptionInfo, String subscriptionId, SessionInfo sessionInfo, String batchId) throws RepositoryException {
HttpSubscribe request = null;
try {
request = new HttpSubscribe(uri, subscriptionInfo, subscriptionId);
initMethod(request, sessionInfo);
if (batchId != null) {
// add batchId as separate header
CodedUrlHeader ch = new CodedUrlHeader(TransactionConstants.HEADER_TRANSACTIONID, batchId);
request.setHeader(ch.getHeaderName(), ch.getHeaderValue());
}
HttpResponse response = executeRequest(sessionInfo, request);
request.checkSuccess(response);
org.apache.jackrabbit.webdav.observation.Subscription[] subs = request.getResponseBodyAsSubscriptionDiscovery(response).getValue();
if (subs.length == 1) {
this.remoteServerProvidesNodeTypes = subs[0].eventsProvideNodeTypeInformation();
this.remoteServerProvidesNoLocalFlag = subs[0].eventsProvideNoLocalFlag();
}
return request.getSubscriptionId(response);
} catch (IOException e) {
throw new RepositoryException(e);
} catch (DavException e) {
throw ExceptionConverter.generate(e);
} finally {
if (request != null) {
request.releaseConnection();
}
}
}
Aggregations