Package org.mule.session

Examples of org.mule.session.DefaultMuleSession


        }

        protected HttpResponse doBad(RequestLine requestLine) throws MuleException
        {
            MuleMessage message = createMuleMessage(null);
            MuleEvent event = new DefaultMuleEvent(message, (InboundEndpoint) endpoint, new DefaultMuleSession(connector.getMuleContext()));
            OptimizedRequestContext.unsafeSetEvent(event);
            HttpResponse response = new HttpResponse();
            response.setStatusLine(requestLine.getHttpVersion(), HttpConstants.SC_BAD_REQUEST);
            response.setBody(HttpMessages.malformedSyntax().toString() + HttpConstants.CRLF);
            return transformResponse(response, event);
View Full Code Here


                    if (HttpConstants.HEADER_EXPECT_CONTINUE_REQUEST_VALUE.equals(expectHeaderValue))
                    {
                        HttpResponse expected = new HttpResponse();
                        expected.setStatusLine(requestLine.getHttpVersion(), HttpConstants.SC_CONTINUE);
                        final DefaultMuleEvent event = new DefaultMuleEvent(new DefaultMuleMessage(expected,
                            connector.getMuleContext()), (InboundEndpoint) endpoint, new DefaultMuleSession(flowConstruct,
                            connector.getMuleContext()));
                        RequestContext.setEvent(event);
                        conn.writeResponse(transformResponse(expected, event));
                    }
                }
View Full Code Here

        {
            HttpResponse response = new HttpResponse();
            response.setStatusLine(version, statusCode);
            response.setBody(description);
            DefaultMuleEvent event = new DefaultMuleEvent(new DefaultMuleMessage(response, connector.getMuleContext()), (InboundEndpoint) endpoint,
                new DefaultMuleSession(flowConstruct, connector.getMuleContext()));
            RequestContext.setEvent(event);
            // The DefaultResponseTransformer will set the necessary headers
            return transformResponse(response, event);
        }
View Full Code Here

        return returnMessage(endpoint.process(createMuleEvent(message, endpoint)));
    }

    protected MuleEvent createMuleEvent(MuleMessage message, OutboundEndpoint endpoint) throws EndpointException
    {
        DefaultMuleSession session = new DefaultMuleSession(new MuleClientFlowConstruct(muleContext), muleContext);
        return new DefaultMuleEvent(message, endpoint.getExchangePattern(), session);
    }
View Full Code Here

        if (transformers != null)
        {
            trans = TransformerUtils.getTransformers(transformers, muleContext);
        }

        MuleSession session = new DefaultMuleSession(service, muleContext);
        InboundEndpoint endpoint = getDefaultClientEndpoint(service, message.getPayload(), true);
        MuleEvent event = new DefaultMuleEvent(message, endpoint, session);

        if (logger.isDebugEnabled())
        {
View Full Code Here

        Service service = muleContext.getRegistry().lookupService(componentName);
        if (service == null)
        {
            throw new ServiceException(CoreMessages.objectNotRegistered("Service", componentName));
        }
        MuleSession session = new DefaultMuleSession(service, muleContext);
        InboundEndpoint endpoint = getDefaultClientEndpoint(service, message.getPayload(), false);
        MuleEvent event = new DefaultMuleEvent(message, endpoint, session);

        if (logger.isDebugEnabled())
        {
View Full Code Here

        return request(url, timeout);
    }

    protected MuleEvent getEvent(MuleMessage message, MessageExchangePattern exchangePattern) throws MuleException
    {
        DefaultMuleSession session = new DefaultMuleSession(new DefaultLocalMuleClient.MuleClientFlowConstruct(muleContext), muleContext);

        if (user != null)
        {
            message.setOutboundProperty(MuleProperties.MULE_USER_PROPERTY, MuleCredentials.createHeader(user.getUsername(), user.getPassword()));
        }
View Full Code Here

            Object flowConstruct = muleContext.getRegistry().lookupObject(destComponent);
            if (!(flowConstruct instanceof FlowConstruct && flowConstruct instanceof MessageProcessor))
            {
                return handleException(null, new DefaultMuleException(ClientMessages.noSuchFlowConstruct(destComponent)));
            }
            MuleSession session = new DefaultMuleSession((FlowConstruct) flowConstruct, muleContext);
            // Need to do this otherise when the event is invoked the
            // transformer associated with the Mule Admin queue will be invoked, but
            // the message will not be of expected type

            EndpointBuilder builder = new EndpointURIEndpointBuilder(RequestContext.getEvent().getEndpoint());
View Full Code Here

        return t;
    }

    public static MuleSession getTestSession(FlowConstruct flowConstruct, MuleContext context)
    {
        return new DefaultMuleSession(flowConstruct, context);
    }
View Full Code Here

        client.initialise();
        for (int i = 0; i < iterations; i++)
        {
            MuleMessage msg = new DefaultMuleMessage("testPayload", muleContext);
            msg.addOutboundAttachment("testAttachment", new DataHandler(new StringDataSource("foo")));
            DefaultMuleSession session = new DefaultMuleSession(msg, ((AbstractConnector) ep.getConnector()).getSessionHandler(), muleContext);
            DefaultMuleEvent event = new DefaultMuleEvent(msg, getTestInboundEndpoint("test://test"), session);
            MuleMessage result = client.process(event).getMessage();
            assertNotNull(result);
            assertNotNull(result.getPayload());
            assertEquals(result.getPayloadAsString(), "Done");
View Full Code Here

TOP

Related Classes of org.mule.session.DefaultMuleSession

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.