/** * Sets the content type of the response the server sends to * the client. The content type may include the type of character * encoding used, for example, <code>text/html; charset=ISO-8859-4</code>. * * <p>You can only use this method once, and you should call it * before you obtain a <code>PrintWriter</code> or * {@link ServletOutputStream} object to return a response. **/ public void setContentType( String type ) { String[] typeAndEncoding = HttpUnitUtils.parseContentTypeHeader( type ); _contentType = typeAndEncoding[0]; if (typeAndEncoding[1] != null) _encoding = typeAndEncoding[1]; }
/** * Sets the content type of the response the server sends to * the client. The content type may include the type of character * encoding used, for example, <code>text/html; charset=ISO-8859-4</code>. * * <p>You can only use this method once, and you should call it * before you obtain a <code>PrintWriter</code> or * {@link ServletOutputStream} object to return a response. **/ public void setContentType( String type ) { String[] typeAndEncoding = HttpUnitUtils.parseContentTypeHeader( type ); _contentType = typeAndEncoding[0]; if (typeAndEncoding[1] != null) _encoding = typeAndEncoding[1]; }
/** * Sets the content type of the response the server sends to * the client. The content type may include the type of character * encoding used, for example, <code>text/html; charset=ISO-8859-4</code>. * * <p>You can only use this method once, and you should call it * before you obtain a <code>PrintWriter</code> or * {@link ServletOutputStream} object to return a response. **/ public void setContentType( String type ) { String[] typeAndEncoding = HttpUnitUtils.parseContentTypeHeader( type ); _contentType = typeAndEncoding[0]; if (typeAndEncoding[1] != null) _encoding = typeAndEncoding[1]; }
String contentTypeHeader = (String) _headers.get( "Content-Type" ); if (contentTypeHeader != null) { String[] res = HttpUnitUtils.parseContentTypeHeader( contentTypeHeader ); _contentType = res[0]; _charset = res[1];
String contentTypeHeader = (String) _headers.get( "Content-Type" ); if (contentTypeHeader != null) { String[] res = HttpUnitUtils.parseContentTypeHeader( contentTypeHeader ); _contentType = res[0]; _charset = res[1];
String contentTypeHeader = (String) _headers.get( "Content-Type" ); if (contentTypeHeader != null) { String[] res = HttpUnitUtils.parseContentTypeHeader( contentTypeHeader ); _contentType = res[0]; _charset = res[1];
private void readContentTypeHeader() { String contentHeader = (_contentHeader != null) ? _contentHeader : getHeaderField( "Content-type" ); if (contentHeader == null) { _contentType = HttpUnitOptions.getDefaultContentType(); setCharacterSet( HttpUnitOptions.getDefaultCharacterSet() ); _contentHeader = _contentType + ";charset=" + _characterSet; } else { String[] parts = HttpUnitUtils.parseContentTypeHeader( contentHeader ); if (null != _client && null != _client.getClientProperties().getOverrideContextType()) { _contentType = _client.getClientProperties().getOverrideContextType(); } else { _contentType = parts[0]; } if (parts[1] != null) setCharacterSet( parts[1] ); } }
private void readContentTypeHeader() { String contentHeader = (_contentHeader != null) ? _contentHeader : getHeaderField( "Content-type" ); if (contentHeader == null) { _contentType = HttpUnitOptions.getDefaultContentType(); setCharacterSet( HttpUnitOptions.getDefaultCharacterSet() ); _contentHeader = _contentType + ";charset=" + _characterSet; } else { String[] parts = HttpUnitUtils.parseContentTypeHeader( contentHeader ); if (null != _client && null != _client.getClientProperties().getOverrideContextType()) { _contentType = _client.getClientProperties().getOverrideContextType(); } else { _contentType = parts[0]; } if (parts[1] != null) setCharacterSet( parts[1] ); } }
private void readContentTypeHeader() { String contentHeader = (_contentHeader != null) ? _contentHeader : getHeaderField( "Content-type" ); if (contentHeader == null) { _contentType = HttpUnitOptions.getDefaultContentType(); setCharacterSet( HttpUnitOptions.getDefaultCharacterSet() ); _contentHeader = _contentType + ";charset=" + _characterSet; } else { String[] parts = HttpUnitUtils.parseContentTypeHeader( contentHeader ); if (null != _client && null != _client.getClientProperties().getOverrideContextType()) { _contentType = _client.getClientProperties().getOverrideContextType(); } else { _contentType = parts[0]; } if (parts[1] != null) setCharacterSet( parts[1] ); } }