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

Websocket Component的更多相关文章

  1. java使用websocket,并且获取HttpSession,源码分析

    转载请在页首注明作者与出处 http://www.cnblogs.com/zhuxiaojie/p/6238826.html 一:本文使用范围 此文不仅仅局限于spring boot,普通的sprin ...

  2. websocket+rabbitmq实战

    1. websocket+rabbitmq实战 1.1. 前言   接到的需求是后台定向给指定web登录用户推送消息,且可能同一账号会登录多个客户端都要接收到消息 1.2. 遇坑 基于springbo ...

  3. springboot - websocket实现及原理

    本文章包括websocket面试相关问题以及spring boot如何整合webSocket. 参考文档 https://blog.csdn.net/prayallforyou/article/det ...

  4. springboot+websocket 归纳收集

    websocket是h5后的技术,主要实现是一个长连接跟tomcat的comet技术差不多,但websocket是基于web协议的,有更广泛的支持.当然,在处理高并发的情况下,可以结合tomcat的a ...

  5. 使用spring boot +WebSocket实现(后台主动)消息推送

    言:使用此webscoket务必确保生产环境能兼容/支持!使用此webscoket务必确保生产环境能兼容/支持!使用此webscoket务必确保生产环境能兼容/支持!主要是tomcat的兼容与支持. ...

  6. spring boot 下websocket实现的两种方法

    websocket前台实现代码,保存为html执行就好 html代码来自:https://blog.csdn.net/M348915654/article/details/53616837 <h ...

  7. spring boot 使用WebSocket与前端进行byte字节数组交互

    一.装逼前先热热身 无论是比较传统的 web项目 还是近几年流行的前后端分离,后端只独立提供数据交互接口服务的项目,都避免不了数据之间交互格式的选择. 从很早之前的 xml 格式 到现在最火热的jso ...

  8. 微服务-springboot+websocket在线聊天室

    一.引入依赖 <dependency> <groupId>org.springframework.boot</groupId> <artifactId> ...

  9. SpringBoot2.0集成WebSocket,实现后台向前端推送信息

    感谢作者,支持原创: https://blog.csdn.net/moshowgame/article/details/80275084 什么是WebSocket? WebSocket协议是基于TCP ...

随机推荐

  1. Appium学习路—Android定位元素与操作

    一.常用识别元素的工具 uiautomator:Android SDK自带的一个工具,在tools目录下 monitor:Android SDK自带的一个工具,在tools目录下 Appium Ins ...

  2. tesseract配置过程

    tesseract配置过程: 1. 为了避免配置环境变量,可以先下载一个 tesseract-ocr-setup-3.02.02.exe(tesseract配置文件夹里有),然后安装(假设安装目录为D ...

  3. 关于SharpZipLib压缩分散的文件及整理文件夹的方法

    今天为了解决压缩分散的文件时,发现想通过压缩对象直接进行文件夹整理很麻烦,因为SharpZipLib没有提供压缩进某个指定文件夹的功能,在反复分析了SharpZipLib提供的各个接口方法后,终于找到 ...

  4. Android Studio线下版和线上版都使用正式签名脚本(保证keysore签名文件和项目在同级目录),不用再因为繁琐的发正式版而烦恼

    场景:调用微信等第三方应用时如果生成的版本不是正式签名的可能会调用失败,使用如下脚本不用再为繁琐的发正式签名版而烦恼 app项目中的build.gradle追加如下代码: //使用正式签名脚本(保证k ...

  5. MVC4.0 扩展辅助方法

    新年第一天上班,写个博客开头吧! 在MVC中,辅助类是很常见的,比如说,Html.TextBox().Html.DropDownListFor()等,这些都是微软帮我们封装好的,可以直接调用的,它们解 ...

  6. 持续集成工具Jenkins学习总结

    概述 持续集成(Continuous Integration,简称CI)是一种软件开发实践,团队开发人员每次都通过自动化的构建(编译.发布.自动化测试)来验证,从而尽早的发现集成错误.持续集成最大的优 ...

  7. 火狐通行证升级为Firefox Sync后,如何在多设备间同步书签等信息

    一直在使用Firefox的一个比较重要的原因是习惯了它的书签同步功能,之前一直是使用火狐通行证来实现多设备间同步的,最近新装了WIN8.1系统来学习,结果装上新版Firefox之后,发现无论怎么弄也没 ...

  8. 兼容ie8 rgba()用法

    今天遇到了一个问题,要在一个页面中设置一个半透明的白色div.这个貌似不是难题,只需要给这个div设置如下的属性即可: background: rgba(255,255,255,.1); 但是要兼容到 ...

  9. MCMC and Bayesian Data Analysis(PPT在文件模块)

    How to generate a sample from $p(x)$? Let's first see how Matlab samples from a $p(x)$. In Matlab, t ...

  10. scrot使用

    在Linux中安装Scrot 在 Debian,Ubuntu 或 Linux Mint 上安装Scrot: $ sudo apt-get install scrot 在 Fedora 上安装Scrot ...