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&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&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的更多相关文章
- java使用websocket,并且获取HttpSession,源码分析
转载请在页首注明作者与出处 http://www.cnblogs.com/zhuxiaojie/p/6238826.html 一:本文使用范围 此文不仅仅局限于spring boot,普通的sprin ...
- websocket+rabbitmq实战
1. websocket+rabbitmq实战 1.1. 前言 接到的需求是后台定向给指定web登录用户推送消息,且可能同一账号会登录多个客户端都要接收到消息 1.2. 遇坑 基于springbo ...
- springboot - websocket实现及原理
本文章包括websocket面试相关问题以及spring boot如何整合webSocket. 参考文档 https://blog.csdn.net/prayallforyou/article/det ...
- springboot+websocket 归纳收集
websocket是h5后的技术,主要实现是一个长连接跟tomcat的comet技术差不多,但websocket是基于web协议的,有更广泛的支持.当然,在处理高并发的情况下,可以结合tomcat的a ...
- 使用spring boot +WebSocket实现(后台主动)消息推送
言:使用此webscoket务必确保生产环境能兼容/支持!使用此webscoket务必确保生产环境能兼容/支持!使用此webscoket务必确保生产环境能兼容/支持!主要是tomcat的兼容与支持. ...
- spring boot 下websocket实现的两种方法
websocket前台实现代码,保存为html执行就好 html代码来自:https://blog.csdn.net/M348915654/article/details/53616837 <h ...
- spring boot 使用WebSocket与前端进行byte字节数组交互
一.装逼前先热热身 无论是比较传统的 web项目 还是近几年流行的前后端分离,后端只独立提供数据交互接口服务的项目,都避免不了数据之间交互格式的选择. 从很早之前的 xml 格式 到现在最火热的jso ...
- 微服务-springboot+websocket在线聊天室
一.引入依赖 <dependency> <groupId>org.springframework.boot</groupId> <artifactId> ...
- SpringBoot2.0集成WebSocket,实现后台向前端推送信息
感谢作者,支持原创: https://blog.csdn.net/moshowgame/article/details/80275084 什么是WebSocket? WebSocket协议是基于TCP ...
随机推荐
- Linux(Centos) 安装windows字体
有时候在Linux中需要用到windows字体,比如微软雅黑字体,这个时候,可能就需要我们手动去安装字体了(当然,如果服务器上没装过),简单几步如下: 1.在$WINDOWS/Fonts目录中找到对应 ...
- Java数据类型转换
一.Date与String相互转换 1.Date转换成String SimpleDateFormat dd = new SimpleDateFormat("yyyy-MM-dd HH:mm& ...
- linux服务器TCP并发连接数优化
1.查看用户单一进程最大文件打开数 [root@localhost ~]# ulimit -n 1024 2.修改/etc/security/limits.conf文件,添加下面两行, [root@l ...
- 关于MySQL的CRUD操作
一.清除mysql表中数据 delete from 表名; truncate table 表名; 不带where参数的delete语句可以删除mysql表中所有内容,使用truncate table也 ...
- 我的Android笔记--我对安卓系统的一些了解
敲了这么长时间代码,记录一下我对Android的一些概念,下面大部分内容来源自网络资料和官方给的文档. 1,Android操作系统的核心属于Linux的一个分支,具有典型的Linux调度和功能 ...
- XE3随想14:关于 SO 与 SA 函数
通过 SuperObject 的公用函数 SO 实现一个 ISuperObject 接口非常方便; 前面都是给它一个字符串参数, 它的参数可以是任一类型甚至是常数数组. SA 和 SO 都是返回一 I ...
- Use Apache HttpClient to Post json data
import org.apache.commons.io.IOUtils;import org.apache.http.HttpResponse;import org.apache.http.clie ...
- hibernate存储过程 3
hibernate存储过程 User.hbm.xml文件的内容如下: <?xml version="1.0"?> <!DOCTYPE hibe ...
- python configparser模块
来看一个好多软件的常见文档格式如下: [DEFAULT] ServerAliveInterval = 45 Compression = yes CompressionLevel = 9 Forward ...
- Keras Installation
#Install numpy and scipy sudo apt-get install gfortran libopenblas-dev liblapack-dev libatlas-base-d ...