private static HttpHeaders convertResponse(Response coyoteRes) { final HttpHeaders headers = HttpHeaders.of(HttpStatus.valueOf(coyoteRes.getStatus())); final String contentType = coyoteRes.getContentType(); if (contentType != null && !contentType.isEmpty()) { headers.set(HttpHeaderNames.CONTENT_TYPE, contentType); } final long contentLength = coyoteRes.getBytesWritten(true); // 'true' will trigger flush. final String method = coyoteRes.getRequest().method().toString(); if (!"HEAD".equals(method)) { headers.setLong(HttpHeaderNames.CONTENT_LENGTH, contentLength); } final MimeHeaders cHeaders = coyoteRes.getMimeHeaders(); final int numHeaders = cHeaders.size(); for (int i = 0; i < numHeaders; i++) { final AsciiString name = toHeaderName(cHeaders.getName(i)); if (name == null) { continue; } final String value = toHeaderValue(cHeaders.getValue(i)); if (value == null) { continue; } headers.add(name.toLowerCase(), value); } return headers; }
/** * Return the content type that was set or calculated for this response, * or <code>null</code> if no content type was set. */ public String getContentType() { return (coyoteResponse.getContentType()); }
/** * Return the content type that was set or calculated for this response, * or <code>null</code> if no content type was set. */ public String getContentType() { return (coyoteResponse.getContentType()); }
/** * Return the content type that was set or calculated for this response, * or <code>null</code> if no content type was set. */ public String getContentType() { return (coyoteResponse.getContentType()); }
/** * Return the content type that was set or calculated for this response, * or <code>null</code> if no content type was set. */ @Override public String getContentType() { return (coyoteResponse.getContentType()); }
/** * Return the content type that was set or calculated for this response, * or <code>null</code> if no content type was set. */ @Override public String getContentType() { return (coyoteResponse.getContentType()); }
/* */ public String getContentType() /* */ { /* 503 */ return this.coyoteResponse.getContentType(); /* */ } /* */
/** * Return the content type that was set or calculated for this response, * or <code>null</code> if no content type was set. */ @Override public String getContentType() { return (coyoteResponse.getContentType()); }
/** * Return the content type that was set or calculated for this response, * or <code>null</code> if no content type was set. */ @Override public String getContentType() { return (coyoteResponse.getContentType()); }
/** * Return the content type that was set or calculated for this response, * or <code>null</code> if no content type was set. */ @Override public String getContentType() { return (coyoteResponse.getContentType()); }
/** * Return the content type that was set or calculated for this response, * or <code>null</code> if no content type was set. */ @Override public String getContentType() { return (coyoteResponse.getContentType()); }
/** * @return the content type that was set or calculated for this response, * or <code>null</code> if no content type was set. */ @Override public String getContentType() { return getCoyoteResponse().getContentType(); }
/** * @return the content type that was set or calculated for this response, * or <code>null</code> if no content type was set. */ @Override public String getContentType() { return getCoyoteResponse().getContentType(); }
/* */ public boolean containsHeader(String name) /* */ { /* 1056 */ char cc = name.charAt(0); /* 1057 */ if ((cc == 'C') || (cc == 'c')) { /* 1058 */ if (name.equalsIgnoreCase("Content-Type")) /* */ { /* 1060 */ return this.coyoteResponse.getContentType() != null; /* */ } /* 1062 */ if (name.equalsIgnoreCase("Content-Length")) /* */ { /* 1064 */ return this.coyoteResponse.getContentLengthLong() != -1L; /* */ } /* */ } /* */ /* 1068 */ return this.coyoteResponse.containsHeader(name); /* */ } /* */
/** * Has the specified header been set already in this response? * * @param name Name of the header to check */ public boolean containsHeader(String name) { // Need special handling for Content-Type and Content-Length due to // special handling of these in coyoteResponse char cc=name.charAt(0); if(cc=='C' || cc=='c') { if(name.equalsIgnoreCase("Content-Type")) { // Will return null if this has not been set return (coyoteResponse.getContentType() != null); } if(name.equalsIgnoreCase("Content-Length")) { // -1 means not known and is not sent to client return (coyoteResponse.getContentLengthLong() != -1); } } return coyoteResponse.containsHeader(name); }
/** * Has the specified header been set already in this response? * * @param name Name of the header to check */ public boolean containsHeader(String name) { // Need special handling for Content-Type and Content-Length due to // special handling of these in coyoteResponse char cc=name.charAt(0); if(cc=='C' || cc=='c') { if(name.equalsIgnoreCase("Content-Type")) { // Will return null if this has not been set return (coyoteResponse.getContentType() != null); } if(name.equalsIgnoreCase("Content-Length")) { // -1 means not known and is not sent to client return (coyoteResponse.getContentLengthLong() != -1); } } return coyoteResponse.containsHeader(name); }
/** * Has the specified header been set already in this response? * * @param name Name of the header to check */ public boolean containsHeader(String name) { // Need special handling for Content-Type and Content-Length due to // special handling of these in coyoteResponse char cc=name.charAt(0); if(cc=='C' || cc=='c') { if(name.equalsIgnoreCase("Content-Type")) { // Will return null if this has not been set return (coyoteResponse.getContentType() != null); } if(name.equalsIgnoreCase("Content-Length")) { // -1 means not known and is not sent to client return (coyoteResponse.getContentLengthLong() != -1); } } return coyoteResponse.containsHeader(name); }
/** * Has the specified header been set already in this response? * * @param name Name of the header to check */ @Override public boolean containsHeader(String name) { // Need special handling for Content-Type and Content-Length due to // special handling of these in coyoteResponse char cc=name.charAt(0); if(cc=='C' || cc=='c') { if(name.equalsIgnoreCase("Content-Type")) { // Will return null if this has not been set return (coyoteResponse.getContentType() != null); } if(name.equalsIgnoreCase("Content-Length")) { // -1 means not known and is not sent to client return (coyoteResponse.getContentLengthLong() != -1); } } return coyoteResponse.containsHeader(name); }
/** * Has the specified header been set already in this response? * * @param name Name of the header to check */ @Override public boolean containsHeader(String name) { // Need special handling for Content-Type and Content-Length due to // special handling of these in coyoteResponse char cc=name.charAt(0); if(cc=='C' || cc=='c') { if(name.equalsIgnoreCase("Content-Type")) { // Will return null if this has not been set return (coyoteResponse.getContentType() != null); } if(name.equalsIgnoreCase("Content-Length")) { // -1 means not known and is not sent to client return (coyoteResponse.getContentLengthLong() != -1); } } return coyoteResponse.containsHeader(name); }
/** * Has the specified header been set already in this response? * * @param name Name of the header to check * @return <code>true</code> if the header has been set */ @Override public boolean containsHeader(String name) { // Need special handling for Content-Type and Content-Length due to // special handling of these in coyoteResponse char cc=name.charAt(0); if(cc=='C' || cc=='c') { if(name.equalsIgnoreCase("Content-Type")) { // Will return null if this has not been set return (getCoyoteResponse().getContentType() != null); } if(name.equalsIgnoreCase("Content-Length")) { // -1 means not known and is not sent to client return (getCoyoteResponse().getContentLengthLong() != -1); } } return getCoyoteResponse().containsHeader(name); }