01: package org.objectweb.celtix.geronimo.container;
02:
03: import java.io.IOException;
04: import java.io.OutputStream;
05:
06: import javax.xml.ws.handler.MessageContext;
07:
08: import org.apache.geronimo.webservices.WebServiceContainer.Response;
09: import org.objectweb.celtix.context.InputStreamMessageContext;
10: import org.objectweb.celtix.context.MessageContextWrapper;
11: import org.objectweb.celtix.context.OutputStreamMessageContext;
12:
13: public class GeronimoOutputStreamServerMessageContext extends
14: MessageContextWrapper implements OutputStreamMessageContext {
15:
16: private static final int ERROR_CODE = 400;
17: private static final int OK_CODE = 200;
18:
19: private final Response response;
20: private OutputStream outStream;
21: private boolean isOneWay;
22:
23: public GeronimoOutputStreamServerMessageContext(MessageContext ctx) {
24: super (ctx);
25: response = (Response) context
26: .get(GeronimoInputStreamMessageContext.RESPONSE);
27: assert response != null : "response not available in context";
28: outStream = response.getOutputStream();
29: response.setStatusCode(OK_CODE);
30: }
31:
32: public OutputStream getOutputStream() {
33: return outStream;
34: }
35:
36: public void setOutputStream(OutputStream out) {
37: outStream = out;
38: }
39:
40: public void setFault(boolean isFault) {
41: response.setStatusCode(ERROR_CODE);
42: }
43:
44: public boolean isFault() {
45: return response.getStatusCode() == ERROR_CODE;
46:
47: }
48:
49: public void setOneWay(boolean oneway) {
50: isOneWay = oneway;
51: }
52:
53: public boolean isOneWay() {
54: return isOneWay;
55: }
56:
57: public InputStreamMessageContext getCorrespondingInputStreamContext()
58: throws IOException {
59: return null;
60: }
61: }
|