Enable/disable kie logging #271

Allow to define a JMT token to give access to a project over reverse proxy #274
Hot deploy management #269 => UI for defiinition
This commit is contained in:
nheron 2021-07-24 22:11:11 +02:00
commit 488870e587
32 changed files with 664 additions and 167 deletions

View file

@ -32,7 +32,7 @@ import org.springframework.context.annotation.PropertySource;
@EnableAutoConfiguration
@PropertySource("classpath:application.properties")
public class Application {
public class SwimmingPoolApplication {
@Value(value = "${url.swimmingpool.calculate}")
private String url;
@ -42,7 +42,7 @@ public class Application {
private String password;
public static void main(String[] args) {
SpringApplication.run(Application.class, args);
SpringApplication.run(SwimmingPoolApplication.class, args);
}
@Bean

View file

@ -27,6 +27,6 @@ import org.springframework.boot.web.servlet.support.SpringBootServletInitializer
public class WebInitializer extends SpringBootServletInitializer {
@Override
protected SpringApplicationBuilder configure(SpringApplicationBuilder application) {
return application.sources(Application.class);
return application.sources(SwimmingPoolApplication.class);
}
}

View file

@ -17,6 +17,7 @@ package org.chtijbug.swimmingpool.web.controller;
import com.fasterxml.jackson.databind.ObjectMapper;
import org.chtijbug.drools.common.rest.Constants;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Value;
@ -52,10 +53,10 @@ public class QuoteController {
Quote responseMoteur=null;
try {
String completeurl = urlCalcul+"/"+containerid;
String completeurl = urlCalcul+"/";
logger.info("url moteur reco : " + completeurl);
ResponseEntity<Quote> response = restTemplateKieServer
.execute(completeurl, HttpMethod.PUT, requestCallback(quoteRequest), clientHttpResponse -> {
.execute(completeurl, HttpMethod.PUT, requestCallback(quoteRequest,containerid), clientHttpResponse -> {
Quote extractedResponse = null;
if (clientHttpResponse.getBody() != null) {
Scanner s = new Scanner(clientHttpResponse.getBody()).useDelimiter("\\A");
@ -79,7 +80,7 @@ public class QuoteController {
}
return responseMoteur;
}
private RequestCallback requestCallback(final Quote updatedInstance) {
private RequestCallback requestCallback(final Quote updatedInstance,String token) {
return clientHttpRequest -> {
ObjectMapper mapper = new ObjectMapper();
mapper.writeValue(clientHttpRequest.getBody(), updatedInstance);
@ -89,6 +90,8 @@ public class QuoteController {
"transactionId", updatedInstance.getSessionLogging());
}
clientHttpRequest.getHeaders().add(
Constants.AUTHORISATION_HEADER, token);
clientHttpRequest.getHeaders().add(
HttpHeaders.CONTENT_TYPE, MediaType.APPLICATION_JSON_VALUE);
clientHttpRequest.getHeaders().add(

View file

@ -1,7 +1,8 @@
# See http://docs.spring.io/spring-boot/docs/1.1.4.RELEASE/reference/htmlsingle/#boot-features-external-config-profile-specific-properties
# for more details about creating profile-specific property files
# See http://docs.spring.io/spring-boot/docs/1.1.4.RELEASE/reference/htmlsingle/#howto-initialize-a-database-using-jpa
url.swimmingpool.calculate=http://localhost:9500/
url.swimmingpool.calculate=http://localhost:9500
#url.swimmingpool.calculate=https://proxy.kie.infra.pymma-software.net
url.swimmingpool.calculate.username=kieserver
url.swimmingpool.calculate.password=kieserver1!
server.port=12099

View file

@ -36,7 +36,7 @@
<tr>
<td><label for="containerid" class="control-label">Container id :</label></td>
<td><input id="containerid" type="text" ng-model="containerid" ng-maxlength="30"/></td>
<td><input id="containerid" type="text" ng-model="containerid" ng-maxlength="20000"/></td>
<td><label for="aClassName" class="control-label">Class name :</label></td>
<td><input id="aClassName" type="text" ng-model="aClassName" ng-maxlength="50"/></td>

View file

@ -66,7 +66,7 @@ productManagerModule.controller('quoteManagerController', function ($scope, $htt
$scope.productSearch = "";
$http.defaults.headers.post["Content-Type"] = "application/json";
$scope.allSessionExecutionDetails = [];
$scope.containerid = "dev";
$scope.containerid = "eyJhbGciOiJIUzI1NiJ9.eyJqdGkiOiI2MDk5OWEyZGQ3YWUyODNmY2MyNWFhNzciLCJpYXQiOjE2MjY4NzkxMjUsInN1YiI6ImFwaSIsImlzcyI6InB5bW1hIiwiZ3JvdXBJRCI6ImNvbS5weW1tYXNvZnR3YXJlLmpicG0udHJhaW5pbmciLCJhcnRpZmFjdElEIjoic3dpbW1pbmdwb29sLXR1dG9yaWFsIiwicHJvamVjdFZlcnNpb24iOiIyLjAuMC1TTkFQU0hPVCIsImJyYW5jaCI6Im1hc3RlciIsIm1haW5DbGFzcyI6Im9yZy50cmFpbmluZy5sZWlzdXJlLnN3aW1taW5ncG9vbC5RdW90ZSIsImV4cCI6MTY1ODQxNTEyNX0.sKYOY98Hsk4JcS546f7xmj1tPNxdrqRtw5y6w0qdu88";
$scope.aClassName = "org.training.leisure.swimmingpool.Quote";
var _lastGoodResult = '';
$scope.toPrettyJSON = function (objStr, tabWidth) {