@Test public void buildConversationIdHeaderWithoutContainer() { Header conversationIdHeader = RestUtils.buildConversationIdHeader(CONTAINER_ID, registry, headers); assertNull(conversationIdHeader); }
public static Header buildConversationIdHeader(String containerId, KieServerRegistry registry, HttpHeaders headers) { List<String> conversationIdHeader = headers.getRequestHeader(KieServerConstants.KIE_CONVERSATION_ID_TYPE_HEADER); if (conversationIdHeader != null && !conversationIdHeader.isEmpty()) { return new Header(KieServerConstants.KIE_CONVERSATION_ID_TYPE_HEADER, conversationIdHeader.get(0)); } KieContainerInstanceImpl container = registry.getContainer(containerId); if (container != null && KieContainerStatus.STARTED.equals(container.getStatus())) { ReleaseId releaseId = container.getResource().getResolvedReleaseId(); if (releaseId == null) { releaseId = container.getResource().getReleaseId(); } String conversationId = ConversationId.from(KieServerEnvironment.getServerId(), containerId, releaseId).toString(); return new Header(KieServerConstants.KIE_CONVERSATION_ID_TYPE_HEADER, conversationId); } return null; }
RestUtils { public static Header buildConversationIdHeader(String containerId, KieServerRegistry registry, HttpHeaders headers) { List<String> conversationIdHeader = headers.getRequestHeader(KieServerConstants.KIE_CONVERSATION_ID_TYPE_HEADER); if (conversationIdHeader != null && !conversationIdHeader.isEmpty()) { return new Header(KieServerConstants.KIE_CONVERSATION_ID_TYPE_HEADER, conversationIdHeader.get(0)); } KieContainerInstanceImpl container = registry.getContainer(containerId); if (container != null && KieContainerStatus.STARTED.equals(container.getStatus())) { ReleaseId releaseId = container.getResource().getResolvedReleaseId(); if (releaseId == null) { releaseId = container.getResource().getReleaseId(); } String conversationId = ConversationId.from(KieServerEnvironment.getServerId(), containerId, releaseId).toString(); return new Header(KieServerConstants.KIE_CONVERSATION_ID_TYPE_HEADER, conversationId); } return null; } }
RestUtils { public static Header buildConversationIdHeader(String containerId, KieServerRegistry registry, HttpHeaders headers) { List<String> conversationIdHeader = headers.getRequestHeader(KieServerConstants.KIE_CONVERSATION_ID_TYPE_HEADER); if (conversationIdHeader != null && !conversationIdHeader.isEmpty()) { return new Header(KieServerConstants.KIE_CONVERSATION_ID_TYPE_HEADER, conversationIdHeader.get(0)); } KieContainerInstanceImpl container = registry.getContainer(containerId); if (container != null && KieContainerStatus.STARTED.equals(container.getStatus())) { ReleaseId releaseId = container.getResource().getResolvedReleaseId(); if (releaseId == null) { releaseId = container.getResource().getReleaseId(); } String conversationId = ConversationId.from(KieServerEnvironment.getServerId(), containerId, releaseId).toString(); return new Header(KieServerConstants.KIE_CONVERSATION_ID_TYPE_HEADER, conversationId); } return null; }  }
RestUtils { public static Header buildConversationIdHeader(String containerId, KieServerRegistry registry, HttpHeaders headers) { List<String> conversationIdHeader = headers.getRequestHeader(KieServerConstants.KIE_CONVERSATION_ID_TYPE_HEADER); if (conversationIdHeader != null && !conversationIdHeader.isEmpty()) { return new Header(KieServerConstants.KIE_CONVERSATION_ID_TYPE_HEADER, conversationIdHeader.get(0)); } KieContainerInstanceImpl container = registry.getContainer(containerId); if (container != null && KieContainerStatus.STARTED.equals(container.getStatus())) { ReleaseId releaseId = container.getResource().getResolvedReleaseId(); if (releaseId == null) { releaseId = container.getResource().getReleaseId(); } String conversationId = ConversationId.from(KieServerEnvironment.getServerId(), containerId, releaseId).toString(); return new Header(KieServerConstants.KIE_CONVERSATION_ID_TYPE_HEADER, conversationId); } return null; }  static Response createCorrectVariant(Object responseObj, HttpHeaders headers, Header... customHeaders); static Response createCorrectVariant(Object responseObj, HttpHeaders headers, javax.ws.rs.core.Response.Status status, Header... customHeaders); static Response createCorrectVariant(MarshallerHelper marshallerHelper, String containerId, Object responseObj, HttpHeaders headers, javax.ws.rs.core.Response.Status status, Header... customHeaders); static Response createResponse(Object responseObj, Variant v, javax.ws.rs.core.Response.Status status, Header... customHeaders); static Variant getVariant(HttpHeaders headers); static Variant getVariant(HttpHeaders headers, Object obj); static String getClassType(HttpHeaders headers); static String getContentType(HttpHeaders headers); static MediaType getMediaType(HttpHeaders httpHeaders); static Response permissionDenied(String message, Variant v, Header... customHeaders); static Response notFound(String message, Variant v, Header... customHeaders); static Response internalServerError(String message, Variant v, Header... customHeaders); static Response alreadyExists(String message, Variant v, Header... customHeaders); static Response badRequest(String reason, Variant v, Header... customHeaders); static Response forbidden(String reason, Variant v, Header... customHeaders); static Response noContent(Variant v, Header... customHeaders); static Response serviceUnavailable(Header... customHeaders); static Header buildConversationIdHeader(String containerId, KieServerRegistry registry, HttpHeaders headers); static String errorMessage(Throwable e, String defaultMessage); static String errorMessage(Throwable e); }
RestUtils { public static Header buildConversationIdHeader(String containerId, KieServerRegistry registry, HttpHeaders headers) { List<String> conversationIdHeader = headers.getRequestHeader(KieServerConstants.KIE_CONVERSATION_ID_TYPE_HEADER); if (conversationIdHeader != null && !conversationIdHeader.isEmpty()) { return new Header(KieServerConstants.KIE_CONVERSATION_ID_TYPE_HEADER, conversationIdHeader.get(0)); } KieContainerInstanceImpl container = registry.getContainer(containerId); if (container != null && KieContainerStatus.STARTED.equals(container.getStatus())) { ReleaseId releaseId = container.getResource().getResolvedReleaseId(); if (releaseId == null) { releaseId = container.getResource().getReleaseId(); } String conversationId = ConversationId.from(KieServerEnvironment.getServerId(), containerId, releaseId).toString(); return new Header(KieServerConstants.KIE_CONVERSATION_ID_TYPE_HEADER, conversationId); } return null; }  static Response createCorrectVariant(Object responseObj, HttpHeaders headers, Header... customHeaders); static Response createCorrectVariant(Object responseObj, HttpHeaders headers, javax.ws.rs.core.Response.Status status, Header... customHeaders); static Response createCorrectVariant(MarshallerHelper marshallerHelper, String containerId, Object responseObj, HttpHeaders headers, javax.ws.rs.core.Response.Status status, Header... customHeaders); static Response createResponse(Object responseObj, Variant v, javax.ws.rs.core.Response.Status status, Header... customHeaders); static Variant getVariant(HttpHeaders headers); static Variant getVariant(HttpHeaders headers, Object obj); static String getClassType(HttpHeaders headers); static String getContentType(HttpHeaders headers); static MediaType getMediaType(HttpHeaders httpHeaders); static Response permissionDenied(String message, Variant v, Header... customHeaders); static Response notFound(String message, Variant v, Header... customHeaders); static Response internalServerError(String message, Variant v, Header... customHeaders); static Response alreadyExists(String message, Variant v, Header... customHeaders); static Response badRequest(String reason, Variant v, Header... customHeaders); static Response forbidden(String reason, Variant v, Header... customHeaders); static Response noContent(Variant v, Header... customHeaders); static Response serviceUnavailable(Header... customHeaders); static Header buildConversationIdHeader(String containerId, KieServerRegistry registry, HttpHeaders headers); static String errorMessage(Throwable e, String defaultMessage); static String errorMessage(Throwable e);  }