Every service meant to be public work now on port 80 #205
@@ -9,11 +9,11 @@ import Parser
|
|||||||
|
|
||||||
app = Flask(__name__)
|
app = Flask(__name__)
|
||||||
CORS(app)
|
CORS(app)
|
||||||
cors = CORS(app, resource={
|
# cors = CORS(app, resource={
|
||||||
r"/*":{
|
# r"/*":{
|
||||||
"origins":"*"
|
# "origins":"*"
|
||||||
}
|
# }
|
||||||
})
|
# })
|
||||||
|
|
||||||
def process_xml(request: request, type: str) -> str:
|
def process_xml(request: request, type: str) -> str:
|
||||||
"""Function to process
|
"""Function to process
|
||||||
|
|||||||
@@ -4,7 +4,7 @@ var json = {};
|
|||||||
var jsonIndex = 0;
|
var jsonIndex = 0;
|
||||||
var lastId = 1;
|
var lastId = 1;
|
||||||
var htable_row = 0;
|
var htable_row = 0;
|
||||||
var host = window.location.protocol + "//" + window.location.hostname + ":8097";
|
var host = window.location.protocol + "//" + window.location.hostname + "/mock";
|
||||||
var dataModified = false;
|
var dataModified = false;
|
||||||
const addMessageName = 'addMessage';
|
const addMessageName = 'addMessage';
|
||||||
const loadMessageName = 'changeMessage';
|
const loadMessageName = 'changeMessage';
|
||||||
|
|||||||
@@ -78,7 +78,8 @@ function showHeadersHistory(element){
|
|||||||
}
|
}
|
||||||
|
|
||||||
async function formatJSON(json) {
|
async function formatJSON(json) {
|
||||||
const address = window.location.protocol + "//" + window.location.hostname + ":" + 8081 + "/json/formatting";
|
const backend = "java";
|
||||||
|
const address = window.location.protocol + "//" + window.location.hostname + "/" + backend + "/json/formatting";
|
||||||
|
|
||||||
var init = {
|
var init = {
|
||||||
body: json,
|
body: json,
|
||||||
@@ -98,7 +99,8 @@ async function formatJSON(json) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
async function formatXML(xml) {
|
async function formatXML(xml) {
|
||||||
const address = window.location.protocol + "//" + window.location.hostname + ":" + 8082 + "/prettify";
|
const backend = "libxml";
|
||||||
|
const address = window.location.protocol + "//" + window.location.hostname + "/" + backend + "/prettify";
|
||||||
var data = {
|
var data = {
|
||||||
data: xml,
|
data: xml,
|
||||||
process: "",
|
process: "",
|
||||||
@@ -140,7 +142,7 @@ function showRequestBody(element){
|
|||||||
});
|
});
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case "application/xml":{
|
case "application/xml": {
|
||||||
formatXML(historyRequestBody).then(function(result) {
|
formatXML(historyRequestBody).then(function(result) {
|
||||||
if (result.status == "OK") {
|
if (result.status == "OK") {
|
||||||
popupContent.innerText = result.result;
|
popupContent.innerText = result.result;
|
||||||
|
|||||||
@@ -76,7 +76,7 @@ function clearDataField() {
|
|||||||
*/
|
*/
|
||||||
function fillDefaultXML(element) {
|
function fillDefaultXML(element) {
|
||||||
if (element.classList.contains("active")) {
|
if (element.classList.contains("active")) {
|
||||||
const serverAddress = window.location.protocol + "//" + window.location.hostname + ":8086";
|
const serverAddress = window.location.protocol + "//" + window.location.hostname;
|
||||||
clearDefaultContent(document.getElementById("xmlArea"), "Insert XML here");
|
clearDefaultContent(document.getElementById("xmlArea"), "Insert XML here");
|
||||||
fetch(serverAddress + "/assets/samples/sampleXml.xml")
|
fetch(serverAddress + "/assets/samples/sampleXml.xml")
|
||||||
.then(response => response.text())
|
.then(response => response.text())
|
||||||
@@ -100,7 +100,7 @@ function fillDefaultXML(element) {
|
|||||||
* @returns {void}
|
* @returns {void}
|
||||||
*/
|
*/
|
||||||
function fillDefaultXSD(){
|
function fillDefaultXSD(){
|
||||||
const serverAddress = window.location.protocol + "//" + window.location.hostname + ":8086";
|
const serverAddress = window.location.protocol + "//" + window.location.hostname;
|
||||||
fetch(serverAddress + "/assets/samples/sampleXSD.xsd")
|
fetch(serverAddress + "/assets/samples/sampleXSD.xsd")
|
||||||
.then( response => response.text() )
|
.then( response => response.text() )
|
||||||
.then( (XSDSchema) => {
|
.then( (XSDSchema) => {
|
||||||
@@ -126,7 +126,7 @@ function fillDefaultXSD(){
|
|||||||
* @returns {void}
|
* @returns {void}
|
||||||
*/
|
*/
|
||||||
function fillDefaultXSLT() {
|
function fillDefaultXSLT() {
|
||||||
const serverAddress = window.location.protocol + "//" + window.location.hostname + ":8086";
|
const serverAddress = window.location.protocol + "//" + window.location.hostname;
|
||||||
fetch(serverAddress + "/assets/samples/XSLTTemplate.xslt")
|
fetch(serverAddress + "/assets/samples/XSLTTemplate.xslt")
|
||||||
.then( response => response.text() )
|
.then( response => response.text() )
|
||||||
.then( (XSTLTemplate) => {
|
.then( (XSTLTemplate) => {
|
||||||
@@ -277,9 +277,9 @@ function performRequest(endpoint, checkXML, checkTransform) {
|
|||||||
var xmlData = document.getElementById(sourceId).innerText.trim();
|
var xmlData = document.getElementById(sourceId).innerText.trim();
|
||||||
var transformData = document.getElementById(transformId).innerText.trim();
|
var transformData = document.getElementById(transformId).innerText.trim();
|
||||||
|
|
||||||
var port = 8081;
|
var backend = "java";
|
||||||
if (getProcessor() == "libxml") {
|
if (getProcessor() == "libxml") {
|
||||||
port = 8082;
|
backend = "libxml";
|
||||||
}
|
}
|
||||||
|
|
||||||
var empty = false;
|
var empty = false;
|
||||||
@@ -293,7 +293,7 @@ function performRequest(endpoint, checkXML, checkTransform) {
|
|||||||
empty = true;
|
empty = true;
|
||||||
}
|
}
|
||||||
if (!empty) {
|
if (!empty) {
|
||||||
restRequest(port, endpoint, xmlData, transformData).then(function (result) {
|
restRequest(backend, endpoint, xmlData, transformData).then(function (result) {
|
||||||
document.getElementById("resultArea").innerText = result.result;
|
document.getElementById("resultArea").innerText = result.result;
|
||||||
highlightSyntax("resultArea");
|
highlightSyntax("resultArea");
|
||||||
document.getElementById("procinfo").innerText = ' Computed using ' + result.processor;
|
document.getElementById("procinfo").innerText = ' Computed using ' + result.processor;
|
||||||
@@ -333,7 +333,7 @@ function performFormatRequest(endpoint, checkXML, sourceId, targetId) {
|
|||||||
const sourceElement = document.getElementById(sourceId);
|
const sourceElement = document.getElementById(sourceId);
|
||||||
const targetElement = document.getElementById(targetId);
|
const targetElement = document.getElementById(targetId);
|
||||||
const infoElement = document.getElementById("formatinfo");
|
const infoElement = document.getElementById("formatinfo");
|
||||||
const port = 8082;
|
const backend = "libxml";
|
||||||
var xmlData = sourceElement.innerText.trim();
|
var xmlData = sourceElement.innerText.trim();
|
||||||
|
|
||||||
var empty = false;
|
var empty = false;
|
||||||
@@ -344,7 +344,7 @@ function performFormatRequest(endpoint, checkXML, sourceId, targetId) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (!empty) {
|
if (!empty) {
|
||||||
restRequest(port, endpoint, xmlData, "").then(function (result) {
|
restRequest(backend, endpoint, xmlData, "").then(function (result) {
|
||||||
if (result.status == "OK") {
|
if (result.status == "OK") {
|
||||||
targetElement.innerText = result.result.trim();
|
targetElement.innerText = result.result.trim();
|
||||||
highlightSyntax(targetElement.id);
|
highlightSyntax(targetElement.id);
|
||||||
@@ -374,16 +374,15 @@ function performFormatRequest(endpoint, checkXML, sourceId, targetId) {
|
|||||||
* @function
|
* @function
|
||||||
* @name restRequest
|
* @name restRequest
|
||||||
* @kind function
|
* @kind function
|
||||||
* @param {any} port of target service
|
* @param {any} backend target backend
|
||||||
* @param {any} endpoint of target service
|
* @param {any} endpoint of target service
|
||||||
* @param {any} xmlData XML that will be sent
|
* @param {any} xmlData XML that will be sent
|
||||||
* @param {any} transformData data used to transform given XML
|
* @param {any} transformData data used to transform given XML
|
||||||
* @returns {Promise<any>}
|
* @returns {Promise<any>}
|
||||||
*/
|
*/
|
||||||
async function restRequest(port, endpoint, xmlData, transformData) {
|
async function restRequest(backend, endpoint, xmlData, transformData) {
|
||||||
const escapeChar = "specialEscapeChar";
|
|
||||||
|
|
||||||
const addr = window.location.protocol + "//" + window.location.hostname + ":" + port + "/" + endpoint;
|
const addr = window.location.protocol + "//" + window.location.hostname + "/" + backend + "/" + endpoint;
|
||||||
|
|
||||||
if (defaultStrings.includes(xmlData)) {
|
if (defaultStrings.includes(xmlData)) {
|
||||||
xmlData = "<empty/>";
|
xmlData = "<empty/>";
|
||||||
|
|||||||
@@ -12,8 +12,26 @@ server {
|
|||||||
add_header Cache-Control "private, no-store, no-cache, must-revalidate, proxy-revalidate, max-age=0";
|
add_header Cache-Control "private, no-store, no-cache, must-revalidate, proxy-revalidate, max-age=0";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
location /java/ {
|
||||||
|
proxy_pass http://xmltools-backend:8081/;
|
||||||
|
proxy_set_header Host $host;
|
||||||
|
}
|
||||||
|
|
||||||
|
location /libxml/ {
|
||||||
|
proxy_pass http://xmltools-libxml-backend/;
|
||||||
|
proxy_set_header Host $host;
|
||||||
|
}
|
||||||
|
|
||||||
|
location /mock/ {
|
||||||
|
proxy_pass http://xmltools-mocked-services:8097/;
|
||||||
|
proxy_set_header Host $host;
|
||||||
|
proxy_set_header Content-Type $http_content_type;
|
||||||
|
}
|
||||||
|
|
||||||
#error_page 404 /404.html;
|
#error_page 404 /404.html;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
# redirect server error pages to the static page /50x.html
|
# redirect server error pages to the static page /50x.html
|
||||||
#
|
#
|
||||||
error_page 500 502 503 504 /50x.html;
|
error_page 500 502 503 504 /50x.html;
|
||||||
|
|||||||
@@ -31,7 +31,7 @@
|
|||||||
<button class="action-button active" id="clearXMLButton" style="padding: 3px 10px;"
|
<button class="action-button active" id="clearXMLButton" style="padding: 3px 10px;"
|
||||||
onclick="clearJsonData()">Clear</button>
|
onclick="clearJsonData()">Clear</button>
|
||||||
<button class="action-button active" id="defaultXMLButton" style="padding: 3px 10px;"
|
<button class="action-button active" id="defaultXMLButton" style="padding: 3px 10px;"
|
||||||
onclick="insertDefaultJson()">Insert default XML</button>
|
onclick="insertDefaultJson()">Insert default JSON</button>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<pre>
|
<pre>
|
||||||
|
|||||||
@@ -1,3 +1,3 @@
|
|||||||
url = "http://localhost:5000/minimize"
|
url = "http://localhost/libxml/minimize"
|
||||||
data = "@minimize.json"
|
data = "@minimize.json"
|
||||||
request = POST
|
request = POST
|
||||||
|
|||||||
@@ -1,3 +1,3 @@
|
|||||||
url = "http://localhost:5000/prettify"
|
url = "http://localhost:5000/libxml/prettify"
|
||||||
data = "@prettify.json"
|
data = "@prettify.json"
|
||||||
request = POST
|
request = POST
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
#url = "localhost:8081/xpath"
|
url = "localhost/java/xpath"
|
||||||
url = "localhost:5000/xpath"
|
#url = "localhost/libxml/xpath"
|
||||||
request = "POST"
|
request = "POST"
|
||||||
data = "@data.json"
|
data = "@data.json"
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
#url = "localhost:8081/xpath"
|
url = "localhost/java/xpath"
|
||||||
url = "localhost:5000/xpath"
|
#url = "localhost/libxml/xpath"
|
||||||
request = "POST"
|
request = "POST"
|
||||||
data = "@dataNS.json"
|
data = "@dataNS.json"
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
#url = "http://localhost:8081/xsd"
|
url = "localhost/java/xsd"
|
||||||
url = "http://localhost:5000/xsd"
|
#url = "localhost/libxml/xsd"
|
||||||
data = "@xsd.json"
|
data = "@xsd.json"
|
||||||
request = POST
|
request = POST
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
#url = "http://localhost:8081/xslt"
|
url = "localhost/java/xslt"
|
||||||
url = "http://localhost:5000/xslt"
|
#url = "localhost/libxml/xslt"
|
||||||
data = "@xslt.json"
|
data = "@xslt.json"
|
||||||
request = POST
|
request = POST
|
||||||
|
|||||||
@@ -10,7 +10,7 @@ services:
|
|||||||
container_name: xmltools-frontend
|
container_name: xmltools-frontend
|
||||||
image: xmltools-frontend
|
image: xmltools-frontend
|
||||||
ports:
|
ports:
|
||||||
- 8086:80
|
- 80:80
|
||||||
|
|
||||||
xmltools-backend:
|
xmltools-backend:
|
||||||
build: ./Backend/tools-services
|
build: ./Backend/tools-services
|
||||||
|
|||||||
Reference in New Issue
Block a user