Package org.mule.endpoint

Examples of org.mule.endpoint.MuleEndpointURI


                                                     EndpointSource source,
                                                     Connector connector) throws Exception
    {
        final Map<String, Object> props = new HashMap<String, Object>();
        props.put("name", name);
        props.put("endpointURI", new MuleEndpointURI("test://test", context));
        props.put("connector", "testConnector");
        if (connector == null)
        {
            // need to build endpoint this way to avoid depenency to any endpoint
            // jars
View Full Code Here


    public Connector createConnector(String uri) throws TransportFactoryException
    {
        try
        {
            return createConnector(new MuleEndpointURI(uri, muleContext));
        }
        catch (EndpointException e)
        {
            throw new TransportFactoryException(e);
        }
View Full Code Here

{

    @Test
    public void testUrlWithProvider() throws Exception
    {
        EndpointURI url = new MuleEndpointURI("vm://some.queue?endpointName=vmProvider", muleContext);
        url.initialise();
        assertEquals(VMConnector.VM, url.getScheme());
        assertEquals("some.queue", url.getAddress());
        assertEquals("vmProvider", url.getEndpointName());
        assertEquals("vm://some.queue?endpointName=vmProvider", url.toString());
        assertEquals(1, url.getParams().size());
    }
View Full Code Here

    protected Flow flow = mock(Flow.class);

    @Before
    public void setupMocks() throws EndpointException
    {
        when(endpoint.getEndpointURI()).thenReturn(new MuleEndpointURI("test://test", muleContext));
        when(endpoint.getTransactionConfig()).thenReturn(new MuleTransactionConfig());
        when(endpoint.getExchangePattern()).thenReturn(MessageExchangePattern.ONE_WAY);
        when(flow.getProcessingStrategy()).thenReturn(new SynchronousProcessingStrategy());
        when(muleContext.getConfiguration()).thenReturn(mock(MuleConfiguration.class));
    }
View Full Code Here

                {
                    logger.debug("Uri after parsing is: " + uri);
                }
                try
                {
                    EndpointURI newUri = new MuleEndpointURI(newUriString, muleContext);
                    EndpointURI endpointURI = ep.getEndpointURI();
                    if (endpointURI != null && !newUri.getScheme().equalsIgnoreCase(endpointURI.getScheme()))
                    {
                        throw new CouldNotRouteOutboundMessageException(
                            CoreMessages.schemeCannotChangeForRouter(ep.getEndpointURI().getScheme(),
                                newUri.getScheme()), event, ep);
                    }
                    newUri.initialise();

                    return new DynamicURIOutboundEndpoint(ep, newUri);
                }
                catch (EndpointException e)
                {
View Full Code Here

        try
        {
            // We parse a new uri based on the listening host and port with the
            // request parameters appended
            // Using the soap prefix ensures that we use a soap endpoint builder
            EndpointURI endpointUri = new MuleEndpointURI(context.getEndpointURI().toString(), context.getMuleContext());
            //We need to re-parse the URI here because we are only give the listening endpoint, not the actual
            //request endpoint. The request endpoint needs to have the query parameters from the client
            //There is no need to do this for Servlet because it does things differently
            if (!"true".equalsIgnoreCase((String) context.getMessage().getInvocationProperty("servlet.endpoint")))
            {
                String uri = SoapConstants.SOAP_ENDPOINT_PREFIX + context.getEndpointURI().getScheme()
                                + "://" + context.getEndpointURI().getHost() + ":"
                                + context.getEndpointURI().getPort();
                uri += context.getMessage().getInboundProperty(HttpConnector.HTTP_REQUEST_PROPERTY, StringUtils.EMPTY);
                endpointUri = new MuleEndpointURI(uri, context.getMuleContext());
            }

            endpointUri.initialise();

            AxisEngine engine = getAxis();
            String pathInfo = endpointUri.getPath();
            boolean wsdlRequested = false;
            boolean listRequested = false;

            if (endpointUri.getAddress().endsWith(".jws"))
            {
                throw new AxisFault("Jws not supported by the Mule Axis service");
            }

            String queryString = endpointUri.getQuery();
            if (queryString != null)
            {
                if (queryString.equalsIgnoreCase(SoapConstants.WSDL_PROPERTY))
                {
                    wsdlRequested = true;
                }
                else
                {
                    if (queryString.equalsIgnoreCase(SoapConstants.LIST_PROPERTY))
                    {
                        listRequested = true;
                    }
                }
            }

            boolean hasNoPath = (StringUtils.isEmpty(pathInfo) || pathInfo.equals("/"));
            if (!wsdlRequested && !listRequested && hasNoPath)
            {
                reportAvailableServices(context, response);
            }
            else
            {
                MessageContext msgContext = new MessageContext(engine);
                populateMessageContext(msgContext, context, endpointUri);

                msgContext.setProperty("transport.url", endpointUri.toString());
                if (wsdlRequested)
                {
                    processWsdlRequest(msgContext, response);
                }
                else if (listRequested)
View Full Code Here

        MessageContext msgContext = new MessageContext(engine);

        String contentType;
        try
        {
            EndpointURI endpointUri = new MuleEndpointURI(context.getEndpointURI().toString(), context.getMuleContext());
            endpointUri.initialise();
            populateMessageContext(msgContext, context, endpointUri);
            if (securityProvider != null)
            {
                if (logger.isDebugEnabled())
                {
                    logger.debug("securityProvider:" + securityProvider);
                }
                msgContext.setProperty("securityProvider", securityProvider);
            }

            Object request = context.getMessage().getPayload();
            if (request instanceof File)
            {
                request = new FileInputStream((File)request);
            }
            else if (request instanceof byte[])
            {
                request = new ByteArrayInputStream((byte[])request);
            }

            final String cType = context.getMessage().getInboundProperty(HTTPConstants.HEADER_CONTENT_TYPE);
            final String cLocation = context.getMessage().getInboundProperty(HTTPConstants.HEADER_CONTENT_LOCATION);
            Message requestMsg = new Message(request, false, cType, cLocation);

            if (logger.isDebugEnabled())
            {
                logger.debug("Request Message:" + requestMsg);
            }
            msgContext.setRequestMessage(requestMsg);
            msgContext.setProperty("transport.url", endpointUri.toString());

            soapAction = getSoapAction(context);
            if (soapAction != null)
            {
                msgContext.setUseSOAPAction(true);
View Full Code Here

        if (StringUtils.isEmpty(soapAction))
        {
            EndpointURI endpointUri;
            try
            {
                endpointUri = new MuleEndpointURI(context.getEndpointURI().toString(), context.getMuleContext());
                endpointUri.initialise();
            }
            catch (Exception e)
            {
                throw new AxisFault(e.getMessage(), e);
View Full Code Here

            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);

        try
        {
            epURI.initialise();
            epURI.getParams().setProperty("servlet.endpoint", "true");
            ((DynamicURIInboundEndpoint) endpoint).setEndpointURI(epURI);
        }
        catch (InitialisationException e)
        {
            throw new EndpointException(e);
View Full Code Here

    {
        EndpointBuilder builder = muleContext.getEndpointFactory().getEndpointBuilder(serviceAddress);

        if (connector != null)
        {
            String protocol = new MuleEndpointURI(serviceAddress, muleContext).getScheme();
            if (!connector.supportsProtocol(protocol))
            {
                throw new IllegalStateException(String.format("Connector %s does not support protocol: %s", connector.getName(), protocol));
            }
View Full Code Here

TOP

Related Classes of org.mule.endpoint.MuleEndpointURI

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.