• Websocket Component


    As of Camel 2.10, the Websocket component supports SSL/TLS configuration through the Camel JSSE Configuration Utility. So to use wss:// protocol, the SSLContextParameters must be defined:
    <to uri="websocket://0.0.0.0:8443/notification?sslContextParameters=#sslContextParameters&amp;sendToAll=true"/>
    <camel:sslContextParameters id="sslContextParameters">
        <camel:keyManagers keyPassword="666666">
          <camel:keyStore resource="{{keystore.url}}" password="{{keystore.pwd}}" type="{{keystore.type}}"/>
        </camel:keyManagers>
        <camel:trustManagers>
          <camel:keyStore resource="{{keystore.url}}" password="{{keystore.pwd}}" type="{{keystore.type}}"/>
        </camel:trustManagers>
    </camel:sslContextParameters>
    There is a built-in default keystore implementation type known as "jks" that is provided by Sun Microsystems. There are two other types of keystores that come with the Sun JDK implementation: jceks, pkcs12.
    // properties
    websocket.url=0.0.0.0:8443
    keystore.url=file:c:/demo/key.jceks
    keystore.pwd=666666
    keystore.type=jceks

    Configuring in Spring XML

    <bean id="bridgePropertyPlaceholder" class="org.apache.camel.spring.spi.BridgePropertyPlaceholderConfigurer">
      <property name="location" value="file:C:/demo/etc/settings.cfg"/>
    </bean>
    <camel:camelContext xmlns="http://camel.apache.org/schema/spring">
         … 
         <to uri="websocket://{{websocket.url}}/notification?sslContextParameters=#sslContextParameters&amp;sendToAll=true"/>
         …
    </camel:camelContext>
    Note: Using the <propertyPlaceholder> tag in camelContext makes the configuration a bit more fresh such as: <propertyPlaceholder id="properties" location="file:C:/demo/etc/settings.cfg"/>

    Configuring in Blueprint

    When using Blueprint property placeholder in the Blueprint XML file, you can declare the properties in a .properties or .cfg file. If you use Apache ServieMix / Karaf then this container has a convention that it loads the properties from a file in the etc directory with the naming etc/pid.cfg, where pid is the persistence-id.
    <!-- OSGI blueprint property placeholder -->
    <cm:property-placeholder id="my.placeholder" persistent-id="com.example.demo">
        <!-- list some properties for this test -->
        <cm:default-properties>
            <cm:property name="result" value="mock:result"/>
        </cm:default-properties>
    </cm:property-placeholder>
    Reference

    http://camel.apache.org/websocket.html

    http://docs.oracle.com/javase/6/docs/technotes/guides/security/StandardNames.html

    http://camel.apache.org/using-propertyplaceholder.html

    作者:Hans.Hu
    出处:http://huyh.cnblogs.com
    本文版权归作者和博客园共有,欢迎转载,但未经作者同意必须保留此段声明,且在文章页面明显位置给出原文连接,否则保留追究法律责任的权利。

  • 相关阅读:
    在thinkphp中批量生成Word并压缩打包下载
    使用phpExcel实现Excel数据的导入导出(完全步骤)
    HTML的几种触发
    IOS上iframe的滚动条失效的解决办法。
    VC6下安装与配置OpenCV1.0
    VS2010+Opencv2.4.0的配置攻略
    could not find the main class
    Makefile 教程
    第一个小程序——显示图像
    自建CDib类库
  • 原文地址:https://www.cnblogs.com/huyh/p/4174218.html
Copyright © 2020-2023  润新知