osgi3——camel配置restlet
来源:互联网 发布:织金网络推广专员招聘 编辑:程序博客网 时间:2024/04/29 18:25
restlet是rest一种轻量级框架实现,弥补servlet的不足之处
下面请看blueprint.xml配置
<?xml version="1.0" encoding="UTF-8"?><blueprint xmlns="http://www.osgi.org/xmlns/blueprint/v1.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:cm="http://aries.apache.org/blueprint/xmlns/blueprint-cm/v1.1.0" xmlns:camel-cxf="http://camel.apache.org/schema/blueprint/cxf" xmlns:cxfcore="http://cxf.apache.org/blueprint/core" xsi:schemaLocation="http://www.osgi.org/xmlns/blueprint/v1.0.0 http://www.osgi.org/xmlns/blueprint/v1.0.0/blueprint.xsd http://camel.apache.org/schema/blueprint/cxf http://camel.apache.org/schema/blueprint/cxf/camel-cxf.xsd http://cxf.apache.org/blueprint/core http://cxf.apache.org/schemas/blueprint/core.xsd http://aries.apache.org/blueprint/xmlns/blueprint-cm/v1.1.0 http://aries.apache.org/schemas/blueprint-cm/blueprint-cm-1.1.0.xsd"> <camelContext xmlns="http://camel.apache.org/schema/blueprint" > <restConfiguration component="restlet" port="9011" host="0.0.0.0" > <componentProperty key="restletMethods" value="GET,POST,PUT,DELETE"/> </restConfiguration> <rest path="/RS"> <get uri="/Test/{resources}/{param}"> <to uri="vm:Test"/> </get> <post uri="/Test/{resources}"> <to uri="vm:Test"/> </post> <delete uri="/Test/{resources}"> <to uri="vm:Test"/> </delete> </rest></camelContext></blueprint>Test.xml<?xml version="1.0" encoding="UTF-8"?><blueprint xmlns="http://www.osgi.org/xmlns/blueprint/v1.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:cm="http://aries.apache.org/blueprint/xmlns/blueprint-cm/v1.1.0" xmlns:camel-cxf="http://camel.apache.org/schema/blueprint/cxf" xmlns:cxfcore="http://cxf.apache.org/blueprint/core" xsi:schemaLocation="http://www.osgi.org/xmlns/blueprint/v1.0.0 http://www.osgi.org/xmlns/blueprint/v1.0.0/blueprint.xsd http://camel.apache.org/schema/blueprint/cxf http://camel.apache.org/schema/blueprint/cxf/camel-cxf.xsd http://cxf.apache.org/blueprint/core http://cxf.apache.org/schemas/blueprint/core.xsd http://aries.apache.org/blueprint/xmlns/blueprint-cm/v1.1.0 http://aries.apache.org/schemas/blueprint-cm/blueprint-cm-1.1.0.xsd"> <bean id="test" class="com.cn.yyc.Test"> </bean> <camelContext xmlns="http://camel.apache.org/schema/blueprint" > <route> <from uri="vm:Test"/> <to uri="bean:test"/> </route> </camelContext></blueprint>
import org.apache.camel.Exchange;import org.apache.commons.lang.StringUtils;import org.slf4j.Logger;import org.slf4j.LoggerFactory;public class Test implements Processor { @Override public void process(Exchange exchange) throws Exception { String method = exchange.getIn().getHeader("CamelHttpMethod", String.class); switch (method) { case "GET": break; case "POST": break; case "DELETE": break; case "PUT": break; } }}
pom.xml需要导入的包
<dependency>
<groupId>org.apache.camel</groupId>
<artifactId>camel-restlet</artifactId>
<version>2.14.1</version>
</dependency>
如果部署在servicemix服务器需要,安装下面插件 rest.xml
<?xml version="1.0" encoding="UTF-8"?><features xmlns="http://karaf.apache.org/xmlns/features/v1.0.0"xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"xsi:schemaLocation="http://karaf.apache.org/xmlns/features/v1.0.0 http://karaf.apache.org/xmlns/features/v1.0.0"> <feature name='yyc-Camel-restlet' version='1.0.0' install="auto"> <bundle start-level='50'>mvn:commons-codec/commons-codec/1.9</bundle><bundle start-level='50'>mvn:org.apache.httpcomponents/httpcore-osgi/4.3.2</bundle><bundle start-level='50'>mvn:org.apache.httpcomponents/httpclient-osgi/4.3.3</bundle><bundle start-level='50'>http://maven.restlet.com/org/restlet/osgi/org.restlet/2.2.1/org.restlet-2.2.1.jar</bundle> <bundle start-level='50'>http://maven.restlet.com/org/restlet/osgi/org.restlet.ext.httpclient/2.2.1/org.restlet.ext.httpclient-2.2.1.jar</bundle><bundle start-level='50'>mvn:org.apache.camel/camel-restlet/2.14.1</bundle> </feature> </features>
0 0
- osgi3——camel配置restlet
- camel发布restlet
- osgi6——camel配置学习
- restlet jax-rs配置
- osgi8——camel activitimq
- Uniform、Restlet以及子类之间的关系——Restlet 2.2
- Camel Spring配置参考
- Camel事务配置!!
- camel配置webService
- camel配置(1)
- camel配置(2)
- camel读取配置信息
- restlet
- restlet
- Restlet
- osgi5——camel整合activiti
- osgi7——camel发送rabbitmq
- osgi9——camel动态路由
- Linux 下crontab管理RMAN一周自动增量备份
- 离去
- selenium:你必须知道的七件事
- hash(哈希,散列)
- AndroidStudio更换黑色主题方法
- osgi3——camel配置restlet
- Java--基础类
- 计算机蓝屏需要如何解决
- 【hdoj 4617】Weapon
- 迭代器源码
- Kafka集群配置
- hibernate 批量处理操作
- 全球最大中文IT社区,为IT专业技术人员提供最全面的...
- 网关和路由的区别