我有驼峰蓝图和我的服务,我在JBoss Fuse中部署了我的捆绑包但是当我尝试点击URL时,我得到了pagenot。
我无法理解这个问题,因为我已成功部署了驼峰中的其余网址?
http://localhost:8181/camelcxfrestservice/rest/customerservice/customers/123
<?xml version="1.0" encoding="UTF-8"?>
<!--
JBoss, Home of Professional Open Source
Copyright 2014, Red Hat, Inc. and/or its affiliates, and individual
contributors by the @authors tag. See the copyright.txt in the
distribution for a full listing of individual contributors.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
-->
<!--
This is the OSGi Blueprint XML file defining the Camel context and routes. Because the file is in the
OSGI-INF/blueprint directory inside our JAR, it will be automatically activated as soon as the bundle is installed.
The root element for any OSGi Blueprint file is 'blueprint' - you also see the namespace definitions for both the Blueprint
and the Camel namespaces.
-->
<blueprint xmlns="http://www.osgi.org/xmlns/blueprint/v1.0.0"
xmlns:cxf="http://camel.apache.org/schema/cxf"
xmlns:jaxrs="http://cxf.apache.org/jaxrs"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.osgi.org/xmlns/blueprint/v1.0.0 https://www.osgi.org/xmlns/blueprint/v1.0.0/blueprint.xsd http://camel.apache.org/schema/blueprint http://camel.apache.org/schema/blueprint/camel-blueprint.xsd http://camel.apache.org/schema/cxf http://camel.apache.org/schema/cxf/camel-cxf.xsd http://cxf.apache.org/jaxrs http://cxf.apache.org/schemas/jaxrs.xsd">
<!--
The namespace for the camelContext element in Blueprint is 'https://camel.apache.org/schema/blueprint'. Additionally,
we can also define namespace prefixes we want to use them in the XPath expressions in our CBR.
While it is not required to assign id's to the <camelContext/> and <route/> elements, it is a good idea
to set those for runtime management purposes (logging, JMX MBeans, ...)
-->
<!-- Defined the real JAXRS back end service -->
<jaxrs:server address="/rest" id="restService" staticSubresourceResolution="true">
<jaxrs:serviceBeans>
<ref bean="customerService"/>
</jaxrs:serviceBeans>
</jaxrs:server>
<!-- JAXRS providers -->
<bean class="org.apache.cxf.jaxrs.provider.json.JSONProvider" id="jsonProvider"/>
<bean class="CustomerService" id="customerService"/>
<!-- Defined the server endpoint to create the cxf-rs consumer -->
<cxf:rsServer address="/route" id="rsServer"
loggingFeatureEnabled="true" loggingSizeLimit="20" serviceClass="CustomerService">
<cxf:providers>
<ref bean="jsonProvider"/>
</cxf:providers>
</cxf:rsServer>
<!-- Defined the client endpoint to create the cxf-rs producer -->
<!-- <cxf:rsClient
address="http://localhost:8181/CamelCXFRestService/rest"
id="rsClient" loggingFeatureEnabled="true" serviceClass="CustomerService">
<cxf:providers>
<ref bean="jsonProvider"/>
</cxf:providers>
</cxf:rsClient> -->
<camelContext id="_context1" xmlns="http://camel.apache.org/schema/blueprint">
<route id="route1">
<!-- Just need to ignoreDeleteMethodMessageBody -->
<from id="_from1" uri="cxfrs://bean://rsServer"/>
<to id="_to1" uri="log:body?level=INFO"/>
<!-- <to id="_to2" uri="cxfrs://bean://rsClient?ignoreDeleteMethodMessageBody=true&synchronous=true"/> -->
</route>
</camelContext>
</blueprint>
和我的服务
import javax.ws.rs.GET;
import javax.ws.rs.Path;
import javax.ws.rs.PathParam;
import javax.ws.rs.core.Response;
@Path("/customerservice/")
public class CustomerService implements CustomerServiceResource{
@Override
@GET
@Path("/customers/{id}/")
public Customer getCustomer(@PathParam("id") String id) {
Customer c = new Customer();
c.setId(id);
c.setName("Sarada");
return c;
}
@Override
public Response updateCustomer(Customer customer) {
// TODO Auto-generated method stub
return null;
}
@Override
public Object invoke(String id, String payload) {
// TODO Auto-generated method stub
return null;
}
}
答案 0 :(得分:0)