@Override public QueryDefinition replaceQuery(QueryDefinition queryDefinition) { CommandScript script = new CommandScript(Collections.singletonList((KieServerCommand) new DescriptorCommand("QueryDataService", "replaceQuery", WebSocketUtils.marshal(queryDefinition), MarshallingFormat.JSON.toString(), new Object[]{queryDefinition.getName()}))); sendCommandToAllSessions(script, new WebSocketServiceResponse(true, (message) -> { WebSocketUtils.unmarshal(message, ServiceResponsesList.class); return null; })).getResponses(); return queryDefinition; }
protected KieServerHttpRequest newRequest(String uri) { KieServerHttpRequest httpRequest = KieServerHttpRequest.newRequest( uri ).followRedirects( true ).timeout( config.getTimeout() ); httpRequest.accept( getMediaType( config.getMarshallingFormat() ) ); httpRequest.header(KieServerConstants.KIE_CONTENT_TYPE_HEADER, config.getMarshallingFormat().toString()); if (config.getHeaders() != null) { for (Map.Entry<String, String> header : config.getHeaders().entrySet()) { httpRequest.header(header.getKey(), header.getValue()); logger.debug("Adding additional header {} value {}", header.getKey(), header.getValue()); } } // apply authorization if (config.getCredentialsProvider() != null) { String authorization = config.getCredentialsProvider().getAuthorization(); // add authorization only when it's not empty to allow anonymous requests if (authorization != null && !authorization.isEmpty()) { httpRequest.header(config.getCredentialsProvider().getHeaderName(), authorization); } } // apply conversationId if (owner.getConversationId() != null) { httpRequest.header(KieServerConstants.KIE_CONVERSATION_ID_TYPE_HEADER, owner.getConversationId()); } return httpRequest; }