ich Apache Camel und Jboss Sicherung verwende, habe ich eine Probe Route blau drucken unten inwie maßgeschneiderte Antwort auf Ausnahme zurück in Apache Kamel
<?xml version="1.0" encoding="UTF-8"?>
<blueprint xmlns="http://www.osgi.org/xmlns/blueprint/v1.0.0"
xmlns:camel="http://camel.apache.org/schema/blueprint"
xmlns:cxf="http://camel.apache.org/schema/blueprint/cxf"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
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 http://camel.apache.org/schema/blueprint/camel-blueprint.xsd">
<cxf:rsServer address="/testservice" id="testserver" serviceClass="com.company.HelloBean">
<camelContext id="testContext" trace="false" xmlns="http://camel.apache.org/schema/blueprint">
<route id="testRoute" >
<from id="_from1" uri="cxfrs:bean:testserver"/>
<bean beanType="com.company.HelloBean"
id="_bean1" method="hello"/>
</route>
</camelContext>
</blueprint>
und Java-Klasse aufgelistet erstellt, die es
@Path("/testservicenew")
public class HelloBean {
@POST
@Path("/test")
@Produces(MediaType.APPLICATION_JSON)
@Consumes(MediaType.APPLICATION_JSON)
public String hello(Person name) {
return "Hello:"+name.getName();
}
}
implementiert
aber wenn ich falsch JSON senden gibt es schlechte Anfrage, ich einige benutzerdefinierte Interceptor so kann ich die die zurückgegebene Antwort mit meinem Körper angepasst und Kopf steuern
weiter zu fragen, fühlen Sie sich frei, wenn es funktioniert nicht löscht i kompiliert haben, nur kopiert es von meinem älteren Projekten –
danke ich verstehe –