1 package org.objectweb.celtix.geronimo.container; 2 3 import java.io.IOException ; 4 import java.io.OutputStream ; 5 6 import javax.xml.ws.handler.MessageContext; 7 8 import org.apache.geronimo.webservices.WebServiceContainer.Response; 9 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 MessageContextWrapper implements 14 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.get(GeronimoInputStreamMessageContext.RESPONSE); 26 assert response != null : "response not available in context"; 27 outStream = response.getOutputStream(); 28 response.setStatusCode(OK_CODE); 29 } 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 } 62 | Popular Tags |