1 | |
|
2 | |
|
3 | |
|
4 | |
|
5 | |
|
6 | |
|
7 | |
|
8 | |
|
9 | |
|
10 | |
|
11 | |
package org.mule.transport.http; |
12 | |
|
13 | |
import org.mule.api.MuleEvent; |
14 | |
import org.mule.api.transport.OutputHandler; |
15 | |
|
16 | |
import java.io.IOException; |
17 | |
import java.io.OutputStream; |
18 | |
|
19 | |
import org.apache.commons.httpclient.methods.RequestEntity; |
20 | |
|
21 | |
public class StreamPayloadRequestEntity implements RequestEntity |
22 | |
{ |
23 | |
private OutputHandler outputHandler; |
24 | |
private MuleEvent event; |
25 | |
|
26 | |
public StreamPayloadRequestEntity(OutputHandler outputHandler, MuleEvent event) |
27 | 0 | { |
28 | 0 | this.outputHandler = outputHandler; |
29 | 0 | this.event = event; |
30 | 0 | } |
31 | |
|
32 | |
public boolean isRepeatable() |
33 | |
{ |
34 | 0 | return true; |
35 | |
} |
36 | |
|
37 | |
public void writeRequest(OutputStream outputStream) throws IOException |
38 | |
{ |
39 | 0 | outputHandler.write(event, outputStream); |
40 | 0 | } |
41 | |
|
42 | |
public long getContentLength() |
43 | |
{ |
44 | 0 | return -1L; |
45 | |
} |
46 | |
|
47 | |
public String getContentType() |
48 | |
{ |
49 | 0 | return event.getMessage().getStringProperty(HttpConstants.HEADER_CONTENT_TYPE, |
50 | |
HttpConstants.DEFAULT_CONTENT_TYPE); |
51 | |
} |
52 | |
} |
53 | |
|