Package org.objectweb.celtix.context

Examples of org.objectweb.celtix.context.OutputStreamMessageContext


                                                               : 5);
        bindingImpl.createBindingMessageContext(contexts.get(i));
        MessageContext bindingContext =
            control.createMock(MessageContext.class);
        EasyMock.expectLastCall().andReturn(bindingContext);
        OutputStreamMessageContext outputStreamContext =
            control.createMock(OutputStreamMessageContext.class);
        transport.createOutputStreamContext(bindingContext);
        EasyMock.expectLastCall().andReturn(outputStreamContext);
       
        if (isRequestor) {
View Full Code Here


    }
   
    public OutputStreamMessageContext rebase(MessageContext context,
                                             EndpointReferenceType decoupledResponseEndpoint)
        throws IOException {
        OutputStreamMessageContext octx =  new JMSOutputStreamContext(context);
      
        String  replyTo = decoupledResponseEndpoint.getAddress().getValue();
        replyTo  = replyTo.substring(replyTo.indexOf('#') + 1);
        octx.put(JMSConstants.JMS_REBASED_REPLY_TO, replyTo);
        return octx;
    }
View Full Code Here

    }
   
    public OutputStreamMessageContext rebase(MessageContext context,
                                             EndpointReferenceType decoupledResponseEndpoint)
        throws IOException {
        OutputStreamMessageContext outputContext = null;
        HttpRequest request =
            (HttpRequest)context.get(HTTPServerInputStreamContext.HTTP_REQUEST);
        HttpResponse response =
            (HttpResponse)context.get(HTTPServerInputStreamContext.HTTP_RESPONSE);
        if (response != null) {
View Full Code Here

     * @param context The associated MessageContext.
     * @return the context that will be used to obtain the OutputStream
     */
    public OutputStreamMessageContext createOutputStreamContext(MessageContext context)
        throws IOException {
        OutputStreamMessageContext ret = null;
        // REVISIT: move isRequestor to BindingContextUtils
        if (ContextUtils.isRequestor(context)) {
            // create client output stream context
            ret = new AbstractHTTPRequestorOutputStreamContext(context) {
                protected URLConnection getConnection(URL url) throws IOException {
View Full Code Here

     *
     * @param context the message context
     */
    private void clientResend(ObjectMessageContext context) throws IOException {
        Request request = createClientRequest(context);
        OutputStreamMessageContext outputStreamContext =
            request.process(null, true, true);
        ClientTransport transport = handler.getClientTransport();
        if (transport != null) {
            // decoupled response channel always being used with RM,
            // hence a partial response must be processed
View Full Code Here

        maps.exposeAs(inMAPs.getNamespaceURI());
        storeMAPs(maps, context, true, true, true, true);

        if (serverTransport != null && serverBinding != null) {
            try {
                OutputStreamMessageContext outputContext =
                    serverTransport.rebase(context, inMAPs.getReplyTo());
                if (outputContext != null) {
                    serverBinding.partialResponse(outputContext,
                                                  getDataBindingCallback());
                }
View Full Code Here

    public void testCreateOutputStreamContext() throws IOException {

        MessageContext messageContext = EasyMock.createMock(MessageContext.class);
        OutputStreamMessageContext ret = clientTransport.createOutputStreamContext(messageContext);
       
        assertNotNull("OutputStreamMessageContext must not be null", ret);
        assertEquals("OutputStreamMessageContext of incorrect type",
                     JBIOutputStreamMessageContext.class, ret.getClass());
    }
View Full Code Here

       
        EasyMock.expect(mc.get("foo")).andReturn("ret");
        EasyMock.replay(mc);
        EasyMock.replay(resp);
       
        OutputStreamMessageContext outctx = transport.createOutputStreamContext(mc);
       
        assertNotNull("received null context from the transoprt", outctx);
        assertTrue("incorrect type for context" + outctx.getClass(),
                   outctx instanceof GeronimoOutputStreamServerMessageContext);

        assertNotNull("no outputstream in context", outctx.getOutputStream());
       
        // check that context passed in has been wrapped.
       
        outctx.get("foo");
        EasyMock.verify(mc);
       
    }
View Full Code Here

        binding.getBindingImpl().updateMessageContext(replyBindingCtx);

        try {

            OutputStreamMessageContext ostreamCtx = st.createOutputStreamContext(replyBindingCtx);
            ostreamCtx.setOneWay(isOneway());

            if (isOneway()) {
                st.finalPrepareOutputStreamContext(ostreamCtx);
            } else {
               
                if (binding.getBindingImpl().hasFault(replyBindingCtx)) {
                    ostreamCtx.setFault(true);
                }

                handlerInvoker.invokeStreamHandlers(ostreamCtx);
                st.finalPrepareOutputStreamContext(ostreamCtx);
                binding.getBindingImpl().write(replyBindingCtx, ostreamCtx);
                OutputStream os = ostreamCtx.getOutputStream();
                os.flush();
            }

            LOG.fine("postDispatch from binding on thread : " + Thread.currentThread());
            st.postDispatch(replyBindingCtx, ostreamCtx);
            if (ostreamCtx.getOutputStream() != null) {
                ostreamCtx.getOutputStream().close();
            }
        } catch (IOException ex) {
            LOG.log(Level.SEVERE, "RESPONSE_UNWRITABLE_MSG", ex);
            throw new WebServiceException(ex);
        } finally {
View Full Code Here

        throws IOException {
        ObjectMessageContext objectCtx = request.getObjectMessageContext();
        BindingContextUtils.storeDataBindingCallback(objectCtx, callback);
       
        try {
            OutputStreamMessageContext ostreamCtx = request.process(null);

            if (null != ostreamCtx) {
                if (BindingContextUtils.isOnewayTransport(ostreamCtx)
                    || transport instanceof ServerTransport) {
                    // REVISIT: replace with Transport.send()
                    ostreamCtx.getOutputStream().close();
                    ostreamCtx.getCorrespondingInputStreamContext().getInputStream().close();
                } else {
                    ostreamCtx.getOutputStream().close();
                    // handle partial reponse
                    InputStreamMessageContext istreamCtx =
                        ostreamCtx.getCorrespondingInputStreamContext();
                    Response response = new Response(request);    
                    response.processProtocol(istreamCtx);
                    response.processLogical(null);
                }
            }
View Full Code Here

TOP

Related Classes of org.objectweb.celtix.context.OutputStreamMessageContext

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.