use of org.apache.chemistry.opencmis.commons.server.CallContext in project alfresco-repository by Alfresco.
the class AbstractEventsService method getAlfrescoClient.
protected Client getAlfrescoClient(Client knownClientType) {
// The following is a HACK in order to fix MNT-17302:
//
// "RuleServiceImpl.ExecutedRules" is a resource bond to the transaction by RuleServiceImpl;
// We can use this information to avoid setting "alfrescoClientId" in this case, otherwise its presence
// will cause the filtering-out of the events that are generated as a result of a rule execution;
//
// We should find a better, cleaner solution in the future...
Object noAlfrescoClientIdHint = AlfrescoTransactionSupport.getResource("RuleServiceImpl.ExecutedRules");
if (noAlfrescoClientIdHint != null) {
return null;
}
CallContext context = AlfrescoCmisServiceCall.get();
if (context != null) {
HttpServletRequest request = (HttpServletRequest) context.get(CallContext.HTTP_SERVLET_REQUEST);
if (request != null) {
String alfrescoClientId = (String) request.getHeader("alfrescoClientId");
return new Client(Client.ClientType.cmis, alfrescoClientId);
}
}
return knownClientType;
}
Aggregations