当前位置: 首页>>代码示例>>Java>>正文


Java URISupport.createRemainingURI方法代码示例

本文整理汇总了Java中org.apache.camel.util.URISupport.createRemainingURI方法的典型用法代码示例。如果您正苦于以下问题:Java URISupport.createRemainingURI方法的具体用法?Java URISupport.createRemainingURI怎么用?Java URISupport.createRemainingURI使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在org.apache.camel.util.URISupport的用法示例。


在下文中一共展示了URISupport.createRemainingURI方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: afterConfiguration

import org.apache.camel.util.URISupport; //导入方法依赖的package包/类
@Override
protected void afterConfiguration(String uri, String remaining, Endpoint endpoint, Map<String, Object> parameters) throws Exception {
    AtomEndpoint atom = (AtomEndpoint) endpoint;
    if (atom.getFeedUri() != null) {
        // already set so do not change it
        return;
    }

    // recreate feed uri after we have configured the endpoint so we can use the left over parameters
    // for the http feed
    String feedUri;
    if (!parameters.isEmpty()) {
        URI remainingUri = URISupport.createRemainingURI(new URI(remaining), parameters);
        feedUri = remainingUri.toString();
    } else {
        feedUri = remaining;
    }

    atom.setFeedUri(feedUri);
}
 
开发者ID:HydAu,项目名称:Camel,代码行数:21,代码来源:AtomComponent.java

示例2: createEndpoint

import org.apache.camel.util.URISupport; //导入方法依赖的package包/类
@Override
protected Endpoint createEndpoint(String uri, String remaining, Map<String, Object> parameters) throws Exception {
    URI uriHttpUriAddress = new URI(UnsafeUriCharactersEncoder.encodeHttpURI(remaining));
    URI endpointUri = URISupport.createRemainingURI(uriHttpUriAddress, parameters);

    // any additional channel options
    Map<String, Object> options = IntrospectionSupport.extractProperties(parameters, "option.");

    // create the endpoint first
    UndertowEndpoint endpoint = createEndpointInstance(endpointUri, this);
    // set options from component
    endpoint.setSslContextParameters(sslContextParameters);
    endpoint.setUndertowHttpBinding(undertowHttpBinding);
    // set options from parameters
    setProperties(endpoint, parameters);
    if (options != null) {
        endpoint.setOptions(options);
    }

    // then re-create the http uri with the remaining parameters which the endpoint did not use
    URI httpUri = URISupport.createRemainingURI(
        new URI(uriHttpUriAddress.getScheme(),
            uriHttpUriAddress.getUserInfo(),
            uriHttpUriAddress.getHost(),
            uriHttpUriAddress.getPort(),
            uriHttpUriAddress.getPath(),
            uriHttpUriAddress.getQuery(),
            uriHttpUriAddress.getFragment()),
        parameters);
    endpoint.setHttpURI(httpUri);

    return endpoint;
}
 
开发者ID:HydAu,项目名称:Camel,代码行数:34,代码来源:UndertowComponent.java

示例3: createEndpoint

import org.apache.camel.util.URISupport; //导入方法依赖的package包/类
@Override
protected Endpoint createEndpoint(String uri, String remaining, Map<String, Object> parameters) throws Exception {
    // must extract well known parameters before we create the endpoint
    Boolean throwExceptionOnFailure = getAndRemoveParameter(parameters, "throwExceptionOnFailure", Boolean.class);
    Boolean transferException = getAndRemoveParameter(parameters, "transferException", Boolean.class);
    Boolean bridgeEndpoint = getAndRemoveParameter(parameters, "bridgeEndpoint", Boolean.class);
    HttpBinding binding = resolveAndRemoveReferenceParameter(parameters, "httpBinding", HttpBinding.class);
    Boolean matchOnUriPrefix = getAndRemoveParameter(parameters, "matchOnUriPrefix", Boolean.class);
    String servletName = getAndRemoveParameter(parameters, "servletName", String.class, getServletName());
    String httpMethodRestrict = getAndRemoveParameter(parameters, "httpMethodRestrict", String.class);
    HeaderFilterStrategy headerFilterStrategy = resolveAndRemoveReferenceParameter(parameters, "headerFilterStrategy", HeaderFilterStrategy.class);
    Boolean async = getAndRemoveParameter(parameters, "async", Boolean.class);

    if (lenientContextPath()) {
        // the uri must have a leading slash for the context-path matching to work with servlet, and it can be something people
        // forget to add and then the servlet consumer cannot match the context-path as would have been expected
        String scheme = ObjectHelper.before(uri, ":");
        String after = ObjectHelper.after(uri, ":");
        // rebuild uri to have exactly one leading slash
        while (after.startsWith("/")) {
            after = after.substring(1);
        }
        after = "/" + after;
        uri = scheme + ":" + after;
    }

    // restructure uri to be based on the parameters left as we dont want to include the Camel internal options
    URI httpUri = URISupport.createRemainingURI(new URI(UnsafeUriCharactersEncoder.encodeHttpURI(uri)), parameters);

    ServletEndpoint endpoint = createServletEndpoint(uri, this, httpUri);
    endpoint.setServletName(servletName);
    if (async != null) {
        endpoint.setAsync(async);
    }
    if (headerFilterStrategy != null) {
        endpoint.setHeaderFilterStrategy(headerFilterStrategy);
    } else {
        setEndpointHeaderFilterStrategy(endpoint);
    }

    // prefer to use endpoint configured over component configured
    if (binding == null) {
        // fallback to component configured
        binding = getHttpBinding();
    }
    if (binding != null) {
        endpoint.setBinding(binding);
    }
    // should we use an exception for failed error codes?
    if (throwExceptionOnFailure != null) {
        endpoint.setThrowExceptionOnFailure(throwExceptionOnFailure);
    }
    // should we transfer exception as serialized object
    if (transferException != null) {
        endpoint.setTransferException(transferException);
    }
    if (bridgeEndpoint != null) {
        endpoint.setBridgeEndpoint(bridgeEndpoint);
    }
    if (matchOnUriPrefix != null) {
        endpoint.setMatchOnUriPrefix(matchOnUriPrefix);
    }
    if (httpMethodRestrict != null) {
        endpoint.setHttpMethodRestrict(httpMethodRestrict);
    }

    setProperties(endpoint, parameters);
    return endpoint;
}
 
开发者ID:HydAu,项目名称:Camel,代码行数:70,代码来源:ServletComponent.java

示例4: createEndpoint

import org.apache.camel.util.URISupport; //导入方法依赖的package包/类
@Override
protected Endpoint createEndpoint(String uri, String remaining, Map<String, Object> parameters) throws Exception {
    String addressUri = createAddressUri(uri, remaining);

    // Do not set the HTTP URI because we still have all of the Camel internal
    // parameters in the URI at this point.
    AhcEndpoint endpoint = createAhcEndpoint(uri, this, null);
    setEndpointHeaderFilterStrategy(endpoint);
    endpoint.setClient(getClient());
    endpoint.setClientConfig(getClientConfig());
    endpoint.setBinding(getBinding());
    endpoint.setSslContextParameters(getSslContextParameters());
    
    setProperties(endpoint, parameters);

    if (IntrospectionSupport.hasProperties(parameters, CLIENT_CONFIG_PREFIX)) {
        AsyncHttpClientConfig.Builder builder = endpoint.getClientConfig() == null 
                ? new AsyncHttpClientConfig.Builder() : AhcComponent.cloneConfig(endpoint.getClientConfig());
        
        if (endpoint.getClient() != null) {
            LOG.warn("The user explicitly set an AsyncHttpClient instance on the component or "
                     + "endpoint, but this endpoint URI contains client configuration parameters.  "
                     + "Are you sure that this is what was intended?  The AsyncHttpClient will be used"
                     + " and the URI parameters will be ignored.");
        } else if (endpoint.getClientConfig() != null) {
            LOG.warn("The user explicitly set an AsyncHttpClientConfig instance on the component or "
                     + "endpoint, but this endpoint URI contains client configuration parameters.  "
                     + "Are you sure that this is what was intended?  The URI parameters will be applied"
                     + " to a clone of the supplied AsyncHttpClientConfig in order to prevent unintended modification"
                     + " of the explicitly configured AsyncHttpClientConfig.  That is, the URI parameters override the"
                     + " settings on the explicitly configured AsyncHttpClientConfig for this endpoint.");
        }

        // special for realm builder
        Realm.RealmBuilder realmBuilder = null;
        if (IntrospectionSupport.hasProperties(parameters, CLIENT_REALM_CONFIG_PREFIX)) {
            realmBuilder = new Realm.RealmBuilder();

            // set and validate additional parameters on client config
            Map<String, Object> realmParams = IntrospectionSupport.extractProperties(parameters, CLIENT_REALM_CONFIG_PREFIX);
            setProperties(realmBuilder, realmParams);
            validateParameters(uri, realmParams, null);
        }

        // set and validate additional parameters on client config
        Map<String, Object> clientParams = IntrospectionSupport.extractProperties(parameters, CLIENT_CONFIG_PREFIX);
        setProperties(builder, clientParams);
        validateParameters(uri, clientParams, null);

        if (realmBuilder != null) {
            builder.setRealm(realmBuilder.build());
        }
        endpoint.setClientConfig(builder.build());
    }

    // restructure uri to be based on the parameters left as we dont want to include the Camel internal options
    addressUri = UnsafeUriCharactersEncoder.encodeHttpURI(addressUri);
    URI httpUri = URISupport.createRemainingURI(new URI(addressUri), parameters);
    endpoint.setHttpUri(httpUri);
    
    return endpoint;
}
 
开发者ID:HydAu,项目名称:Camel,代码行数:63,代码来源:AhcComponent.java


注:本文中的org.apache.camel.util.URISupport.createRemainingURI方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。