Make highlighting optional
This commit is contained in:
parent
5152f0ba9b
commit
f4b8f18a8a
|
@ -493,7 +493,9 @@ public class RestfulTesterServlet extends HttpServlet {
|
||||||
requestBody = StringEscapeUtils.escapeHtml4(requestBody);
|
requestBody = StringEscapeUtils.escapeHtml4(requestBody);
|
||||||
theContext.setVariable("requestBody", requestBody);
|
theContext.setVariable("requestBody", requestBody);
|
||||||
theContext.setVariable("requestSyntaxHighlighterClass", requestSyntaxHighlighterClass);
|
theContext.setVariable("requestSyntaxHighlighterClass", requestSyntaxHighlighterClass);
|
||||||
theContext.setVariable("resultBody", StringEscapeUtils.escapeHtml4(resultBody));
|
String resultBodyText = StringEscapeUtils.escapeHtml4(resultBody);
|
||||||
|
theContext.setVariable("resultBody", resultBodyText);
|
||||||
|
theContext.setVariable("resultBodyIsLong", resultBodyText.length() > 1000);
|
||||||
theContext.setVariable("resultSyntaxHighlighterClass", resultSyntaxHighlighterClass);
|
theContext.setVariable("resultSyntaxHighlighterClass", resultSyntaxHighlighterClass);
|
||||||
theContext.setVariable("requestHeaders", requestHeaders);
|
theContext.setVariable("requestHeaders", requestHeaders);
|
||||||
theContext.setVariable("responseHeaders", responseHeaders);
|
theContext.setVariable("responseHeaders", responseHeaders);
|
||||||
|
|
|
@ -927,13 +927,25 @@
|
||||||
<td rowspan="2">Result Body</td>
|
<td rowspan="2">Result Body</td>
|
||||||
<td>
|
<td>
|
||||||
<span th:text="${resultDescription}"/>
|
<span th:text="${resultDescription}"/>
|
||||||
|
<button th:if="${resultBodyIsLong}" class="btn btn-info btn-sm" type="button" id="format-result-btn">
|
||||||
|
<span class="glyphicon glyphicon-eye-open"></span>
|
||||||
|
Colour
|
||||||
|
</button>
|
||||||
|
<script type="text/javascript" th:if="${resultBodyIsLong}">
|
||||||
|
$('#format-result-btn').click(function() {
|
||||||
|
//$('#resultBodyActualPre').setClass('<th:block th:text="${resultSyntaxHighlighterClass}"/>');
|
||||||
|
document.getElementById('resultBodyActualPre').className='<th:block th:text="${resultSyntaxHighlighterClass}"/>';
|
||||||
|
document.getElementById('format-result-btn').disabled ='disabled';
|
||||||
|
SyntaxHighlighter.highlight();
|
||||||
|
});
|
||||||
|
</script>
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
<tr th:if="${!#strings.isEmpty(resultBody)}">
|
<tr th:if="${!#strings.isEmpty(resultBody)}">
|
||||||
<td valign="top" style="margin: 0px; padding: 0px;">
|
<td valign="top" style="margin: 0px; padding: 0px;">
|
||||||
<pre class="resultBodyPre resultBodyPlaceholder" id="resultBodyPlaceholder">...loading...</pre>
|
<pre class="resultBodyPre resultBodyPlaceholder" id="resultBodyPlaceholder">...loading...</pre>
|
||||||
<div id="resultBodyActual" class="resultBodyActual">
|
<div id="resultBodyActual" class="resultBodyActual" style="display: none;">
|
||||||
<pre th:text="${resultBody}" th:class="${resultSyntaxHighlighterClass} + ' resultBodyPre pre-scrollable'" style="display: none;">{}</pre>
|
<pre id="resultBodyActualPre" th:text="${resultBody}" th:class="(${resultBodyIsLong} ? '' : ${resultSyntaxHighlighterClass}) + ' resultBodyPre pre-scrollable'">{}</pre>
|
||||||
</div>
|
</div>
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
|
|
|
@ -91,6 +91,7 @@ PRE.resultBodyPre {
|
||||||
line-height: 0.9em;
|
line-height: 0.9em;
|
||||||
font-size: 0.8em;
|
font-size: 0.8em;
|
||||||
border: none;
|
border: none;
|
||||||
|
background-color: transparent;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
|
Loading…
Reference in New Issue