Coverage Report - org.mule.transport.http.StreamPayloadRequestEntity
 
Classes in this File Line Coverage Branch Coverage Complexity
StreamPayloadRequestEntity
0%
0/10
N/A
1
 
 1  
 /*
 2  
  * Copyright (c) MuleSoft, Inc.  All rights reserved.  http://www.mulesoft.com
 3  
  * The software in this package is published under the terms of the CPAL v1.0
 4  
  * license, a copy of which has been included with this distribution in the
 5  
  * LICENSE.txt file.
 6  
  */
 7  
 package org.mule.transport.http;
 8  
 
 9  
 import org.mule.api.MuleEvent;
 10  
 import org.mule.api.transport.OutputHandler;
 11  
 
 12  
 import java.io.IOException;
 13  
 import java.io.OutputStream;
 14  
 
 15  
 import org.apache.commons.httpclient.methods.RequestEntity;
 16  
 
 17  
 public class StreamPayloadRequestEntity implements RequestEntity
 18  
 {
 19  
     private OutputHandler outputHandler;
 20  
     private MuleEvent event;
 21  
 
 22  
     public StreamPayloadRequestEntity(OutputHandler outputHandler, MuleEvent event)
 23  0
     {
 24  0
         this.outputHandler = outputHandler;
 25  0
         this.event = event;
 26  0
     }
 27  
 
 28  
     public boolean isRepeatable()
 29  
     {
 30  0
         return false;
 31  
     }
 32  
 
 33  
     public void writeRequest(OutputStream outputStream) throws IOException
 34  
     {
 35  0
         outputHandler.write(event, outputStream);
 36  0
         outputStream.flush();
 37  0
     }
 38  
 
 39  
     public long getContentLength()
 40  
     {
 41  0
         return -1L;
 42  
     }
 43  
 
 44  
     public String getContentType()
 45  
     {
 46  0
         return event.getMessage().getOutboundProperty(HttpConstants.HEADER_CONTENT_TYPE, HttpConstants.DEFAULT_CONTENT_TYPE);
 47  
     }
 48  
 }
 49