Author: markt Date: Mon Apr 27 13:10:36 2015 New Revision: 1676250 URL: http://svn.apache.org/r1676250 Log: Use getter to access coyoteResponse to make it easier to sub-class.
Modified: tomcat/trunk/java/org/apache/catalina/connector/Response.java Modified: tomcat/trunk/java/org/apache/catalina/connector/Response.java URL: http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/catalina/connector/Response.java?rev=1676250&r1=1676249&r2=1676250&view=diff ============================================================================== --- tomcat/trunk/java/org/apache/catalina/connector/Response.java (original) +++ tomcat/trunk/java/org/apache/catalina/connector/Response.java Mon Apr 27 13:10:36 2015 @@ -320,7 +320,7 @@ public class Response // Ignore - the client has probably closed the connection } } - return coyoteResponse.getBytesWritten(flush); + return getCoyoteResponse().getBytesWritten(flush); } /** @@ -457,7 +457,7 @@ public class Response * Return the content length that was set or calculated for this Response. */ public int getContentLength() { - return coyoteResponse.getContentLength(); + return getCoyoteResponse().getContentLength(); } @@ -467,7 +467,7 @@ public class Response */ @Override public String getContentType() { - return coyoteResponse.getContentType(); + return getCoyoteResponse().getContentType(); } @@ -524,7 +524,7 @@ public class Response */ @Override public String getCharacterEncoding() { - return (coyoteResponse.getCharacterEncoding()); + return (getCoyoteResponse().getCharacterEncoding()); } @@ -558,7 +558,7 @@ public class Response */ @Override public Locale getLocale() { - return (coyoteResponse.getLocale()); + return (getCoyoteResponse().getLocale()); } @@ -608,7 +608,7 @@ public class Response */ @Override public boolean isCommitted() { - return coyoteResponse.isCommitted(); + return getCoyoteResponse().isCommitted(); } @@ -625,7 +625,7 @@ public class Response return; } - coyoteResponse.reset(); + getCoyoteResponse().reset(); outputBuffer.reset(); usingOutputStream = false; usingWriter = false; @@ -722,7 +722,7 @@ public class Response return; } - coyoteResponse.setContentLength(length); + getCoyoteResponse().setContentLength(length); } @@ -745,7 +745,7 @@ public class Response } if (type == null) { - coyoteResponse.setContentType(null); + getCoyoteResponse().setContentType(null); return; } @@ -753,16 +753,16 @@ public class Response if (m == null) { // Invalid - Assume no charset and just pass through whatever // the user provided. - coyoteResponse.setContentTypeNoCharset(type); + getCoyoteResponse().setContentTypeNoCharset(type); return; } - coyoteResponse.setContentTypeNoCharset(m[0]); + getCoyoteResponse().setContentTypeNoCharset(m[0]); if (m[1] != null) { // Ignore charset if getWriter() has already been called if (!usingWriter) { - coyoteResponse.setCharacterEncoding(m[1]); + getCoyoteResponse().setCharacterEncoding(m[1]); isCharacterEncodingSet = true; } } @@ -794,7 +794,7 @@ public class Response return; } - coyoteResponse.setCharacterEncoding(charset); + getCoyoteResponse().setCharacterEncoding(charset); isCharacterEncodingSet = true; } @@ -817,7 +817,7 @@ public class Response return; } - coyoteResponse.setLocale(locale); + getCoyoteResponse().setLocale(locale); // Ignore any call made after the getWriter has been invoked. // The default should be used @@ -831,7 +831,7 @@ public class Response String charset = getContext().getCharset(locale); if (charset != null) { - coyoteResponse.setCharacterEncoding(charset); + getCoyoteResponse().setCharacterEncoding(charset); } } @@ -841,14 +841,14 @@ public class Response @Override public String getHeader(String name) { - return coyoteResponse.getMimeHeaders().getHeader(name); + return getCoyoteResponse().getMimeHeaders().getHeader(name); } @Override public Collection<String> getHeaderNames() { - MimeHeaders headers = coyoteResponse.getMimeHeaders(); + MimeHeaders headers = getCoyoteResponse().getMimeHeaders(); int n = headers.size(); List<String> result = new ArrayList<>(n); for (int i = 0; i < n; i++) { @@ -863,7 +863,7 @@ public class Response public Collection<String> getHeaders(String name) { Enumeration<String> enumeration = - coyoteResponse.getMimeHeaders().values(name); + getCoyoteResponse().getMimeHeaders().values(name); Vector<String> result = new Vector<>(); while (enumeration.hasMoreElements()) { result.addElement(enumeration.nextElement()); @@ -877,13 +877,13 @@ public class Response * for this Response. */ public String getMessage() { - return coyoteResponse.getMessage(); + return getCoyoteResponse().getMessage(); } @Override public int getStatus() { - return coyoteResponse.getStatus(); + return getCoyoteResponse().getStatus(); } @@ -927,7 +927,7 @@ public class Response final String startsWith = name + "="; String header = generateCookieString(cookie); boolean set = false; - MimeHeaders headers = coyoteResponse.getMimeHeaders(); + MimeHeaders headers = getCoyoteResponse().getMimeHeaders(); int n = headers.size(); for (int i = 0; i < n; i++) { if (headers.getName(i).toString().equals(headername)) { @@ -1026,7 +1026,7 @@ public class Response return; } - coyoteResponse.addHeader(name, value, charset); + getCoyoteResponse().addHeader(name, value, charset); } @@ -1088,15 +1088,15 @@ public class Response if(cc=='C' || cc=='c') { if(name.equalsIgnoreCase("Content-Type")) { // Will return null if this has not been set - return (coyoteResponse.getContentType() != null); + return (getCoyoteResponse().getContentType() != null); } if(name.equalsIgnoreCase("Content-Length")) { // -1 means not known and is not sent to client - return (coyoteResponse.getContentLengthLong() != -1); + return (getCoyoteResponse().getContentLengthLong() != -1); } } - return coyoteResponse.containsHeader(name); + return getCoyoteResponse().containsHeader(name); } @@ -1199,7 +1199,7 @@ public class Response return; } - coyoteResponse.action(ActionCode.ACK, null); + getCoyoteResponse().action(ActionCode.ACK, null); } @@ -1244,8 +1244,8 @@ public class Response setError(); - coyoteResponse.setStatus(status); - coyoteResponse.setMessage(message); + getCoyoteResponse().setStatus(status); + getCoyoteResponse().setMessage(message); // Clear any data content that has been buffered resetBuffer(); @@ -1368,7 +1368,7 @@ public class Response return; } - coyoteResponse.setHeader(name, value); + getCoyoteResponse().setHeader(name, value); } @@ -1433,8 +1433,8 @@ public class Response return; } - coyoteResponse.setStatus(status); - coyoteResponse.setMessage(message); + getCoyoteResponse().setStatus(status); + getCoyoteResponse().setMessage(message); } --------------------------------------------------------------------- To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org For additional commands, e-mail: dev-h...@tomcat.apache.org