mirror of
https://github.com/Alfresco/alfresco-community-repo.git
synced 2025-07-31 17:39:05 +00:00
Merge branch 'feature/RM-5311_Fix_Swagger_Caching' into 'master'
RM-5311 - Fix the caching of swagger files See merge request !363
This commit is contained in:
@@ -1,10 +1,15 @@
|
|||||||
|
|
||||||
<!DOCTYPE html>
|
<!DOCTYPE html>
|
||||||
<html>
|
<html>
|
||||||
<head>
|
<head>
|
||||||
<meta charset="UTF-8">
|
<meta charset="UTF-8">
|
||||||
|
<meta http-equiv="cache-control" content="max-age=0"/>
|
||||||
|
<meta http-equiv="cache-control" content="no-cache"/>
|
||||||
|
<meta http-equiv="expires" content="0"/>
|
||||||
|
<meta http-equiv="expires" content="Tue, 01 Jan 1980 1:00:00 GMT"/>
|
||||||
|
<meta http-equiv="pragma" content="no-cache"/>
|
||||||
<title>Alfresco Governance Services REST API Explorer</title>
|
<title>Alfresco Governance Services REST API Explorer</title>
|
||||||
<link rel="shortcut icon" href="https://cdn-www.alfresco.com/sites/www.alfresco.com/themes/alfrescodotcom/favicon.ico" />
|
<link rel="shortcut icon"
|
||||||
|
href="https://cdn-www.alfresco.com/sites/www.alfresco.com/themes/alfrescodotcom/favicon.ico"/>
|
||||||
<link href='css/typography.css' media='screen' rel='stylesheet' type='text/css'/>
|
<link href='css/typography.css' media='screen' rel='stylesheet' type='text/css'/>
|
||||||
<link href='css/reset.css' media='screen' rel='stylesheet' type='text/css'/>
|
<link href='css/reset.css' media='screen' rel='stylesheet' type='text/css'/>
|
||||||
<link href='css/screen.css' media='screen' rel='stylesheet' type='text/css'/>
|
<link href='css/screen.css' media='screen' rel='stylesheet' type='text/css'/>
|
||||||
@@ -13,11 +18,19 @@
|
|||||||
<link href='css/alfresco.css' media='screen' rel='stylesheet' type='text/css'/>
|
<link href='css/alfresco.css' media='screen' rel='stylesheet' type='text/css'/>
|
||||||
<!-- Google Tag Manager -->
|
<!-- Google Tag Manager -->
|
||||||
<script>
|
<script>
|
||||||
(function(w,d,s,l,i){w[l]=w[l]||[];w[l].push({'gtm.start':
|
(function (w, d, s, l, i) {
|
||||||
new Date().getTime(),event:'gtm.js'});var f=d.getElementsByTagName(s)[0],
|
w[l] = w[l] || [];
|
||||||
j=d.createElement(s),dl=l!='dataLayer'?'&l='+l:'';j.async=true;j.src=
|
w[l].push({
|
||||||
'https://www.googletagmanager.com/gtm.js?id='+i+dl;f.parentNode.insertBefore(j,f);
|
'gtm.start': new Date().getTime(),
|
||||||
})(window,document,'script','dataLayer','GTM-W4HV22');
|
event: 'gtm.js'
|
||||||
|
});
|
||||||
|
var f = d.getElementsByTagName(s)[0],
|
||||||
|
j = d.createElement(s), dl = l != 'dataLayer' ? '&l=' + l : '';
|
||||||
|
j.async = true;
|
||||||
|
j.src =
|
||||||
|
'https://www.googletagmanager.com/gtm.js?id=' + i + dl;
|
||||||
|
f.parentNode.insertBefore(j, f);
|
||||||
|
})(window, document, 'script', 'dataLayer', 'GTM-W4HV22');
|
||||||
</script>
|
</script>
|
||||||
<!-- End Google Tag Manager -->
|
<!-- End Google Tag Manager -->
|
||||||
<script src='lib/jquery-1.8.0.min.js' type='text/javascript'></script>
|
<script src='lib/jquery-1.8.0.min.js' type='text/javascript'></script>
|
||||||
@@ -44,15 +57,15 @@
|
|||||||
url: "definitions/gs-core-api.yaml",
|
url: "definitions/gs-core-api.yaml",
|
||||||
dom_id: "swagger-ui-container",
|
dom_id: "swagger-ui-container",
|
||||||
supportedSubmitMethods: ['get', 'post', 'put', 'delete'],
|
supportedSubmitMethods: ['get', 'post', 'put', 'delete'],
|
||||||
onComplete: function(swaggerApi, swaggerUi){
|
onComplete: function (swaggerApi, swaggerUi) {
|
||||||
|
|
||||||
$('pre code').each(function(i, e) {
|
$('pre code').each(function (i, e) {
|
||||||
hljs.highlightBlock(e)
|
hljs.highlightBlock(e)
|
||||||
});
|
});
|
||||||
|
|
||||||
addAuthorization();
|
addAuthorization();
|
||||||
},
|
},
|
||||||
onFailure: function(data) {
|
onFailure: function (data) {
|
||||||
log("Unable to Load SwaggerUI");
|
log("Unable to Load SwaggerUI");
|
||||||
},
|
},
|
||||||
docExpansion: "none",
|
docExpansion: "none",
|
||||||
@@ -64,29 +77,42 @@
|
|||||||
validatorUrl: null
|
validatorUrl: null
|
||||||
});
|
});
|
||||||
|
|
||||||
function addAuthorization(){
|
function addAuthorization() {
|
||||||
var username = $('#input_username').val();
|
|
||||||
var password = $('#input_password').val();
|
var cacheA = new SwaggerClient.ApiKeyAuthorization("If-Modified-Since", "Mon, 26 Jul 1997 05:00:00 GMT", "header"),
|
||||||
if (username.trim() != "" && password.trim() != "") {
|
cacheB = new SwaggerClient.ApiKeyAuthorization("Cache-Control", "no-cache", "header"),
|
||||||
|
cacheC = new SwaggerClient.ApiKeyAuthorization("Pragma", "no-cache", "header"),
|
||||||
|
username = $('#input_username').val(),
|
||||||
|
password = $('#input_password').val();
|
||||||
|
|
||||||
|
if (username.trim() != "" && password.trim() != "")
|
||||||
|
{
|
||||||
var basicAuth = new SwaggerClient.PasswordAuthorization(username, password);
|
var basicAuth = new SwaggerClient.PasswordAuthorization(username, password);
|
||||||
window.swaggerUi.api.clientAuthorizations.remove("basicAuth");
|
window.swaggerUi.api.clientAuthorizations.remove("basicAuth");
|
||||||
window.swaggerUi.api.clientAuthorizations.add("basicAuth", basicAuth);
|
window.swaggerUi.api.clientAuthorizations.add("basicAuth", basicAuth);
|
||||||
log("authorization added: username = " + username + ", auth = " + basicAuth);
|
log("authorization added: username = " + username + ", auth = " + basicAuth);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
window.swaggerUi.api.clientAuthorizations.add("cacheA", cacheA);
|
||||||
|
window.swaggerUi.api.clientAuthorizations.add("cacheB", cacheB);
|
||||||
|
window.swaggerUi.api.clientAuthorizations.add("cacheC", cacheC);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
$('#input_username').change(addAuthorization);
|
$('#input_username').change(addAuthorization);
|
||||||
$('#input_password').change(addAuthorization);
|
$('#input_password').change(addAuthorization);
|
||||||
|
|
||||||
window.swaggerUi.load();
|
window.swaggerUi.load();
|
||||||
|
|
||||||
$('#select_baseUrl').change(function() {
|
$('#select_baseUrl').change(function () {
|
||||||
window.swaggerUi.headerView.trigger('update-swagger-ui', {
|
window.swaggerUi.headerView.trigger('update-swagger-ui', {
|
||||||
url: $('#select_baseUrl').val()
|
url: $('#select_baseUrl').val()
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
function log() {
|
function log() {
|
||||||
if ('console' in window) {
|
if ('console' in window)
|
||||||
|
{
|
||||||
console.log.apply(console, arguments);
|
console.log.apply(console, arguments);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -96,19 +122,24 @@
|
|||||||
|
|
||||||
<body class="swagger-section">
|
<body class="swagger-section">
|
||||||
<!-- Google Tag Manager (noscript) -->
|
<!-- Google Tag Manager (noscript) -->
|
||||||
<noscript><iframe src="https://www.googletagmanager.com/ns.html?id=GTM-W4HV22" height="0" width="0" style="display:none;visibility:hidden"></iframe></noscript>
|
<noscript>
|
||||||
|
<iframe src="https://www.googletagmanager.com/ns.html?id=GTM-W4HV22" height="0" width="0"
|
||||||
|
style="display:none;visibility:hidden"></iframe>
|
||||||
|
</noscript>
|
||||||
<!-- End Google Tag Manager (noscript) -->
|
<!-- End Google Tag Manager (noscript) -->
|
||||||
<div id='header'>
|
<div id='header'>
|
||||||
<div class="swagger-ui-wrap">
|
<div class="swagger-ui-wrap">
|
||||||
<a id="alflogo" href="#"><img src="images/logo.png" height="44px" width="160px" /></a>
|
<a id="alflogo" href="#"><img src="images/logo.png" height="44px" width="160px"/></a>
|
||||||
<form id="api_selector">
|
<form id="api_selector">
|
||||||
<div class="input" id="select-wrapper">
|
<div class="input" id="select-wrapper">
|
||||||
<select id="select_baseUrl" name="select_baseUrl">
|
<select id="select_baseUrl" name="select_baseUrl">
|
||||||
<option value="definitions/gs-core-api.yaml">GS Core API</option>
|
<option value="definitions/gs-core-api.yaml">GS Core API</option>
|
||||||
</select>
|
</select>
|
||||||
</div>
|
</div>
|
||||||
<div class="input"><input alt="Username" type="text" name="username" id="input_username" placeholder="username" size="10" value="admin"></div>
|
<div class="input"><input alt="Username" type="text" name="username" id="input_username" placeholder="username"
|
||||||
<div class="input"><input alt="Password" type="password" name="password" id="input_password" placeholder="password" size="10" value="admin"></div>
|
size="10" value="admin"></div>
|
||||||
|
<div class="input"><input alt="Password" type="password" name="password" id="input_password"
|
||||||
|
placeholder="password" size="10" value="admin"></div>
|
||||||
</form>
|
</form>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
Reference in New Issue
Block a user