if (requestEntity != null && requestEntity.getContentType() != null) { setRequestHeader("Content-Type", requestEntity.getContentType());
/** * Returns the length of the request body. * * @return number of bytes in the request body */ protected long getRequestContentLength() { LOG.trace("enter EntityEnclosingMethod.getRequestContentLength()"); if (!hasRequestContent()) { return 0; } if (this.chunked) { return -1; } if (this.requestEntity == null) { this.requestEntity = generateRequestEntity(); } return (this.requestEntity == null) ? 0 : this.requestEntity.getContentLength(); }
if ((this.repeatCount > 0) && !requestEntity.isRepeatable()) { throw new ProtocolException( "Unbuffered entity enclosing request can not be repeated."); requestEntity.writeRequest(outstream);
wire.debug(h.getName() + ": " + h.getValue()); wire.debug("Content-length: " + post.getRequestEntity().getContentLength()); wire.debug("Content-type: " + post.getRequestEntity().getContentType()); wire.debug(""); wire.debug(((StringRequestEntity)post.getRequestEntity()).getContent());
public InputStream getMessagePayload() throws IOException { InputStream body = null; if(httpMethod instanceof PostMethod){ PostMethod postMethod = (PostMethod) httpMethod; ByteArrayOutputStream out = new ByteArrayOutputStream(); postMethod.getRequestEntity().writeRequest(out); body = new ByteArrayInputStream(out.toByteArray()); }else{ throw new IllegalStateException("HTTP method " + httpMethod.getName() + " not supported"); } return body; }
wire.debug(h.getName() + ": " + h.getValue()); wire.debug("Content-length: " + post.getRequestEntity().getContentLength()); wire.debug("Content-type: " + post.getRequestEntity().getContentType()); wire.debug(""); wire.debug(((StringRequestEntity)post.getRequestEntity()).getContent());
try { ByteArrayOutputStream requestOut = new ByteArrayOutputStream(); ((EntityEnclosingMethod) m).getRequestEntity().writeRequest(requestOut); LOG.debug("Http Request Body : {}", requestOut.toString()); } catch (IOException e) {
wire.debug(h.getName() + ": " + h.getValue()); wire.debug("Content-length: " + post.getRequestEntity().getContentLength()); wire.debug("Content-type: " + post.getRequestEntity().getContentType()); wire.debug(""); wire.debug(((StringRequestEntity)post.getRequestEntity()).getContent());
/** * Returns the request's charset. The charset is parsed from the request entity's * content type, unless the content type header has been set manually. * * @see RequestEntity#getContentType() * * @since 3.0 */ public String getRequestCharSet() { if (getRequestHeader("Content-Type") == null) { // check the content type from request entity // We can't call getRequestEntity() since it will probably call // this method. if (this.requestEntity != null) { return getContentCharSet( new Header("Content-Type", requestEntity.getContentType())); } else { return super.getRequestCharSet(); } } else { return super.getRequestCharSet(); } }
if ((this.repeatCount > 0) && !requestEntity.isRepeatable()) { throw new ProtocolException( "Unbuffered entity enclosing request can not be repeated."); requestEntity.writeRequest(outstream);
/** * Returns the length of the request body. * * @return number of bytes in the request body */ protected long getRequestContentLength() { LOG.trace("enter EntityEnclosingMethod.getRequestContentLength()"); if (!hasRequestContent()) { return 0; } if (this.chunked) { return -1; } if (this.requestEntity == null) { this.requestEntity = generateRequestEntity(); } return (this.requestEntity == null) ? 0 : this.requestEntity.getContentLength(); }
method.addRequestHeader(HEADER_CONTENT_TYPE, entity.getContentType()); if (entity.getContentLength() < 0) { method.removeRequestHeader(HEADER_CONTENT_LENGTH); } else { method.setRequestHeader(HEADER_CONTENT_LENGTH, Long.toString(entity.getContentLength()));
public String getContentType() { String type = null; if(httpMethod instanceof PostMethod){ PostMethod postMethod = (PostMethod) httpMethod; type = postMethod.getRequestEntity().getContentType(); }else{ Header header = httpMethod.getRequestHeader("Content-Type"); type = (header == null) ? null : header.getValue(); } return type; }
if ((this.repeatCount > 0) && !requestEntity.isRepeatable()) { throw new ProtocolException( "Unbuffered entity enclosing request can not be repeated."); requestEntity.writeRequest(outstream);
/** * Returns the length of the request body. * * @return number of bytes in the request body */ protected long getRequestContentLength() { LOG.trace("enter EntityEnclosingMethod.getRequestContentLength()"); if (!hasRequestContent()) { return 0; } if (this.chunked) { return -1; } if (this.requestEntity == null) { this.requestEntity = generateRequestEntity(); } return (this.requestEntity == null) ? 0 : this.requestEntity.getContentLength(); }
if (requestEntity != null && requestEntity.getContentType() != null) { setRequestHeader("Content-Type", requestEntity.getContentType());
if ((this.repeatCount > 0) && !requestEntity.isRepeatable()) { throw new ProtocolException( "Unbuffered entity enclosing request can not be repeated."); requestEntity.writeRequest(outstream);
/** * Returns the length of the request body. * * @return number of bytes in the request body */ protected long getRequestContentLength() { LOG.trace("enter EntityEnclosingMethod.getRequestContentLength()"); if (!hasRequestContent()) { return 0; } if (this.chunked) { return -1; } if (this.requestEntity == null) { this.requestEntity = generateRequestEntity(); } return (this.requestEntity == null) ? 0 : this.requestEntity.getContentLength(); }
if (requestEntity != null && requestEntity.getContentType() != null) { setRequestHeader("Content-Type", requestEntity.getContentType());
if ((this.repeatCount > 0) && !requestEntity.isRepeatable()) { throw new ProtocolException( "Unbuffered entity enclosing request can not be repeated."); requestEntity.writeRequest(outstream);