Package org.mule.api.transport

Examples of org.mule.api.transport.MessageReceiver


                MuleMessage returnMessage = endpoint.request(to);
                writeResponse(httpServletResponse, returnMessage);
            }
            else
            {
                MessageReceiver receiver = getReceiverForURI(httpServletRequest);
           
                httpServletRequest.setAttribute(PAYLOAD_PARAMETER_NAME, payloadParameterName);
               
                MuleMessage message = receiver.createMuleMessage(httpServletRequest);
                MuleEvent event = receiver.routeMessage(message);
                MuleMessage returnMessage = event == null ? null : event.getMessage();
                writeResponse(httpServletResponse, returnMessage);
            }
        }
        catch (Exception e)
View Full Code Here


    protected void doPost(HttpServletRequest httpServletRequest, HttpServletResponse httpServletResponse)
        throws ServletException, IOException
    {
        try
        {
            MessageReceiver receiver = getReceiverForURI(httpServletRequest);

            httpServletRequest.setAttribute(PAYLOAD_PARAMETER_NAME, payloadParameterName);

            MuleMessage message = receiver.createMuleMessage(httpServletRequest,
                receiver.getEndpoint().getEncoding());
           
            MuleEvent event = receiver.routeMessage(message);
            MuleMessage returnMessage = event == null ? null : event.getMessage();
            writeResponse(httpServletResponse, returnMessage);
        }
        catch (Exception e)
        {
View Full Code Here

    protected void doPut(HttpServletRequest httpServletRequest, HttpServletResponse httpServletResponse)
        throws ServletException, IOException
    {
        try
        {
            MessageReceiver receiver = getReceiverForURI(httpServletRequest);

            httpServletRequest.setAttribute(PAYLOAD_PARAMETER_NAME, payloadParameterName);

            MuleMessage message = receiver.createMuleMessage(httpServletRequest,
                receiver.getEndpoint().getEncoding());
            receiver.routeMessage(message);

            httpServletResponse.setStatus(HttpServletResponse.SC_CREATED);
            if (feedback)
            {
                httpServletResponse.getWriter().write(
                    "Item was created at endpointUri: " + receiver.getEndpointURI());
            }
        }
        catch (Exception e)
        {
            handleException(e, "Failed to Post event to Mule" + e.getMessage(), httpServletResponse);
View Full Code Here

        InboundEndpoint endpoint = muleContext.getEndpointFactory().getInboundEndpoint(endpointName);
        if (endpoint == null)
        {
            // if we dont find an endpoint for the given name, lets check the
            // servlet receivers
            MessageReceiver receiver = getReceivers().get(endpointName);
           
            if (receiver != null)
            {
                endpoint = receiver.getEndpoint();
            }
        }
        return endpoint;
    }
View Full Code Here

    @Test
    public void testCreate() throws Exception
    {
        Service service = getTestService("orange", Orange.class);
        InboundEndpoint endpoint = getTestInboundEndpoint("Test");
        MessageReceiver receiver = getMessageReceiver();

        assertNotNull(receiver.getEndpoint());

        try
        {
            receiver.setEndpoint(null);
            fail("Provider cannot be set to null");
        }
        catch (IllegalArgumentException e)
        {
            // expected
        }

        receiver.setEndpoint(endpoint);
        assertNotNull(receiver.getEndpoint());

        receiver.dispose();
    }
View Full Code Here

        {
            if (this.useCachedHttpServletRequest)
            {
                request = new CachedHttpServletRequest(request);
            }
            MessageReceiver receiver = getReceiverForURI(request);

            processHttpRequest(request, response, receiver);
        }
        catch (Exception e)
        {
View Full Code Here

        {
            throw new EndpointException(
                    HttpMessages.unableToGetEndpointUri(httpServletRequest.getRequestURI()));
        }

        MessageReceiver receiver = getReceivers().get(uri);

        // Lets see if the uri matches up with the last part of
        // any of the receiver keys.
        if (receiver == null)
        {
            receiver = HttpConnector.findReceiverByStem(connector.getReceivers(), uri);
        }

        if (receiver == null)
        {
            receiver = matchReceiverByWildcard(uri, receiver);
        }

        if (receiver == null)
        {
            throw new NoReceiverForEndpointException(uri);
        }

        InboundEndpoint endpoint = receiver.getEndpoint();

        // Ensure that this receiver is using a dynamic (mutable) endpoint
        if (!(endpoint instanceof DynamicURIInboundEndpoint))
        {
            endpoint = new DynamicURIInboundEndpoint(receiver.getEndpoint());
            receiver.setEndpoint(endpoint);
        }

        // Tell the dynamic endpoint about our new URL
        //Note we don't use the servlet: prefix since we need to be dealing with the raw endpoint here
        EndpointURI epURI = new MuleEndpointURI(getRequestUrl(httpServletRequest), muleContext);
View Full Code Here

    }

    @Test
    public void routeMessageOneWayReturnsNull() throws MuleException
    {
        MessageReceiver receiver = createMessageReciever(MessageExchangePattern.ONE_WAY);

        assertNull(receiver.routeMessage(createRequestMessage()));
    }
View Full Code Here

    }

    @Override
    public MessageReceiver createReceiver(FlowConstruct flowConstuct, InboundEndpoint endpoint) throws Exception
    {
        MessageReceiver receiver = new AbstractMessageReceiver(this, flowConstuct, endpoint)
        {

            @Override
            protected void doInitialise() throws InitialisationException
            {
View Full Code Here

    }

    @Test
    public void routeMessageRequestResponseReturnsEvent() throws MuleException
    {
        MessageReceiver receiver = createMessageReciever(MessageExchangePattern.REQUEST_RESPONSE);
        MuleMessage request = createRequestMessage();

        assertEquals(request, receiver.routeMessage(request).getMessage());
    }
View Full Code Here

TOP

Related Classes of org.mule.api.transport.MessageReceiver

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.