Java Code Examples for org.apache.tomcat.util.buf.MessageBytes#toString()
The following examples show how to use
org.apache.tomcat.util.buf.MessageBytes#toString() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: TestCoyoteAdapter.java From Tomcat8-Source-Read with MIT License | 5 votes |
private void doTestNormalize(String input, String expected) { MessageBytes mb = MessageBytes.newInstance(); byte[] b = input.getBytes(StandardCharsets.UTF_8); mb.setBytes(b, 0, b.length); boolean result = CoyoteAdapter.normalize(mb); mb.toString(); if (expected == null) { Assert.assertFalse(result); } else { Assert.assertTrue(result); Assert.assertEquals(expected, mb.toString()); } }
Example 2
Source File: AbstractHttp11Processor.java From Tomcat7.0.67 with Apache License 2.0 | 5 votes |
/** * Check if compression should be used for this resource. Already checked * that the resource could be compressed if the client supports it. */ private boolean useCompression() { // Check if browser support gzip encoding MessageBytes acceptEncodingMB = request.getMimeHeaders().getValue("accept-encoding"); if ((acceptEncodingMB == null) || (acceptEncodingMB.indexOf("gzip") == -1)) { return false; } // If force mode, always compress (test purposes only) if (compressionLevel == 2) { return true; } // Check for incompatible Browser if (noCompressionUserAgents != null) { MessageBytes userAgentValueMB = request.getMimeHeaders().getValue("user-agent"); if(userAgentValueMB != null) { String userAgentValue = userAgentValueMB.toString(); if (noCompressionUserAgents != null && noCompressionUserAgents.matcher(userAgentValue).matches()) { return false; } } } return true; }
Example 3
Source File: AbstractHttp11Processor.java From tomcatsrc with Apache License 2.0 | 5 votes |
/** * Check if compression should be used for this resource. Already checked * that the resource could be compressed if the client supports it. */ private boolean useCompression() { // Check if browser support gzip encoding MessageBytes acceptEncodingMB = request.getMimeHeaders().getValue("accept-encoding"); if ((acceptEncodingMB == null) || (acceptEncodingMB.indexOf("gzip") == -1)) { return false; } // If force mode, always compress (test purposes only) if (compressionLevel == 2) { return true; } // Check for incompatible Browser if (noCompressionUserAgents != null) { MessageBytes userAgentValueMB = request.getMimeHeaders().getValue("user-agent"); if(userAgentValueMB != null) { String userAgentValue = userAgentValueMB.toString(); if (noCompressionUserAgents.matcher(userAgentValue).matches()) { return false; } } } return true; }
Example 4
Source File: MimeHeaders.java From Tomcat8-Source-Read with MIT License | 4 votes |
public String getHeader(String name) { MessageBytes mh = getValue(name); return mh != null ? mh.toString() : null; }
Example 5
Source File: MimeHeaders.java From Tomcat8-Source-Read with MIT License | 4 votes |
@Override public String nextElement() { MessageBytes current=next; findNext(); return current.toString(); }
Example 6
Source File: MimeHeaders.java From Tomcat7.0.67 with Apache License 2.0 | 4 votes |
public String getHeader(String name) { MessageBytes mh = getValue(name); return mh != null ? mh.toString() : null; }
Example 7
Source File: MimeHeaders.java From Tomcat7.0.67 with Apache License 2.0 | 4 votes |
@Override public String nextElement() { MessageBytes current=next; findNext(); return current.toString(); }
Example 8
Source File: MimeHeaders.java From tomcatsrc with Apache License 2.0 | 4 votes |
public String getHeader(String name) { MessageBytes mh = getValue(name); return mh != null ? mh.toString() : null; }
Example 9
Source File: MimeHeaders.java From tomcatsrc with Apache License 2.0 | 4 votes |
@Override public String nextElement() { MessageBytes current=next; findNext(); return current.toString(); }