protected void showRenderedResponse(String response, SampleResult res, boolean embedded) { if (response == null) { results.setText(""); return; } int htmlIndex = response.indexOf("<HTML"); // could be <HTML lang=""> // $NON-NLS-1$ // Look for a case variation if (htmlIndex < 0) { htmlIndex = response.indexOf("<html"); // ditto // $NON-NLS-1$ } // If we still can't find it, just try using all of the text if (htmlIndex < 0) { htmlIndex = 0; } String html = response.substring(htmlIndex); /* * To disable downloading and rendering of images and frames, enable the * editor-kit. The Stream property can then be */ // Must be done before setContentType results.setEditorKitForContentType(TEXT_HTML, embedded ? defaultHtmlEditor : customisedEditor); results.setContentType(TEXT_HTML); if (embedded) { // Allow JMeter to render frames (and relative images) // Must be done after setContentType [Why?] results.getDocument().putProperty(Document.StreamDescriptionProperty, res.getURL()); } /* * Get round problems parsing <META http-equiv='content-type' * content='text/html; charset=utf-8'> See * http://issues.apache.org/bugzilla/show_bug.cgi?id=23315 * * Is this due to a bug in Java? */ results.getDocument().putProperty("IgnoreCharsetDirective", Boolean.TRUE); // $NON-NLS-1$ results.setText(html); results.setCaretPosition(0); resultsScrollPane.setViewportView(results); }