zoukankan      html  css  js  c++  java
  • 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
    本文版权归作者和博客园共有,欢迎转载,但未经作者同意必须保留此段声明,且在文章页面明显位置给出原文连接,否则保留追究法律责任的权利。

  • 相关阅读:
    c++链表实现学生成绩管理系统(简易版)
    IOS动画讲解
    栈的实现
    Masonry的使用
    二叉树详解-2
    二叉树详解-1
    CoreData的使用-2
    NSPredicate 详解
    CoreData的使用-1
    IOS常用手势用法
  • 原文地址:https://www.cnblogs.com/huyh/p/4174218.html
Copyright © 2011-2022 走看看