Improve display of syntaxt highlighting

This commit is contained in:
James Agnew 2017-07-12 09:47:10 -04:00
parent a337d282e3
commit 45b05326c5
3 changed files with 13 additions and 7 deletions

View File

@ -65,8 +65,8 @@ public class ResponseHighlighterInterceptor extends InterceptorAdapter {
public static final String PARAM_RAW_TRUE = "true";
public static final String PARAM_TRUE = "true";
private boolean myShowRequestHeaders;
private boolean myShowResponseHeaders;
private boolean myShowRequestHeaders = false;
private boolean myShowResponseHeaders = true;
/**
* Constructor
@ -267,7 +267,7 @@ public class ResponseHighlighterInterceptor extends InterceptorAdapter {
}
/**
* If set to <code>true</code> (default is <code>false</code>) response will include the
* If set to <code>true</code> (default is <code>true</code>) response will include the
* response headers
*/
public boolean isShowResponseHeaders() {
@ -356,7 +356,7 @@ public class ResponseHighlighterInterceptor extends InterceptorAdapter {
}
/**
* If set to <code>true</code> (default is <code>false</code>) response will include the
* If set to <code>true</code> (default is <code>true</code>) response will include the
* response headers
*
* @return Returns a reference to this for easy method chaining
@ -437,7 +437,8 @@ public class ResponseHighlighterInterceptor extends InterceptorAdapter {
b.append(" font-weight: bold;");
b.append("}");
b.append(".hlQuot { color: #88F; }\n");
b.append(".hlQuot a { text-decoration: none; color: #88F; }\n");
b.append(".hlQuot a { text-decoration: underline; text-decoration-color: #CCC; }\n");
b.append(".hlQuot a:HOVER { text-decoration: underline; text-decoration-color: #008; }\n");
b.append(".hlQuot .uuid, .hlQuot .dateTime {\n");
b.append(" user-select: all;\n");
b.append(" -moz-user-select: all;\n");
@ -580,12 +581,13 @@ public class ResponseHighlighterInterceptor extends InterceptorAdapter {
b.append("<div class=\"lineAnchor\" id=\"anchor");
b.append(i);
b.append("\">");
;
b.append("<a href=\"#L");
b.append(i);
b.append("\" name=\"L");
b.append(i);
b.append("\" id=\"L");
b.append(i);
b.append("\">");
b.append(i);
b.append("</a></div>");

View File

@ -23,7 +23,11 @@ function updateHighlightedLine() {
for (var next in selectedLines) {
// Prevent us from scrolling to the selected line
document.getElementById('L' + selectedLines[next]).name = '';
// Select the line number column
document.getElementById('line' + selectedLines[next]).className = 'selectedLine';
// Select the response body column
document.getElementById('anchor' + selectedLines[next]).className = 'lineAnchor selectedLine';
}

View File

@ -198,7 +198,7 @@ public class TestRestfulServer extends RestfulServer {
* makes things a little easier for testers.
*/
ResponseHighlighterInterceptor responseHighlighterInterceptor = new ResponseHighlighterInterceptor();
responseHighlighterInterceptor.setShowRequestHeaders(true);
responseHighlighterInterceptor.setShowRequestHeaders(false);
responseHighlighterInterceptor.setShowResponseHeaders(true);
registerInterceptor(responseHighlighterInterceptor);