1 | |
|
2 | |
|
3 | |
|
4 | |
|
5 | |
|
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 | |
|