cxfrs

Camel JAX-RS and Cross Domain Request

妖精的绣舞 提交于 2019-12-05 19:21:44
I'd like to be able to do HTTP requests on my localhost Camel instance (just for development purpose, I know this is bad practice). For now, I'm stuck with : Origin http://localhost:8000 is not allowed by Access-Control-Allow-Origin. I've search how can I tell Camel to allow such requests, but didn't find an answer. I'm using camel-cxf and the rsServer to create my endpoint. I've got an endpoint looking like that : public class LoginEndpoint { @GET @Path(LOGIN) @Produces(MediaType.APPLICATION_JSON) public Customer login(@QueryParam("email") String email, @QueryParam("password") String password

Apache Camel + Spring (war) + Tomcat + REST

做~自己de王妃 提交于 2019-12-02 13:08:43
I am trying to develp a rest service using apache camel. My project is a spring mvc war deployed on tomcat. I dont want to use apache cxf (cxf servlet). public class SampleRouter extends RouteBuilder { @override public void configure() throws Exception { from("cxfrs://http://localhost:1234/sample") .process (new Processor() { public void process(Exchange exchange) throws Exception { System.out.println("test"); } })).setBody(constant("SUCCESS")); } } @Path("/sample") public class SampleResource { @GET public void test() { } } web.xml has dispatcherservlet, contextloaderlistener. dispatcher

Camel cxfrs RESTful client / ProducerTemplate ConnectionTimeout

允我心安 提交于 2019-12-01 06:43:27
问题 I am trying to set the 'connectionTimeout' for a Camel CXF-RS component here which produces a RESTful requests on a 3rd party service. The default 30000 miliseconds is to long. Exchange exchange = template.send("cxfrs://" + url, new Processor() { public void process(Exchange exchange) throws Exception { exchange.setPattern(ExchangePattern.InOut); Message inMessage = exchange.getIn(); setupDestinationURL(inMessage); // using the http central client API inMessage.setHeader(CxfConstants.CAMEL

No message body writer found : JSON : Apache CXF : RestFul Webservices

前提是你 提交于 2019-12-01 05:23:42
I am using Apache CXF for making a simple restful application. I have a client class which posts a JSON object to the server and server returns back a JSON after some manipulation. but when i execute the code i get "org.apache.cxf.interceptor.Fault: .No message body writer has been found for class: class org.codehaus.jettison.json.JSONObject, ContentType : application/json." My client code : public class Client { public static void main(String[] args) { try{ URI uri = new URI("http://localhost:8022/RestDemo"); WebClient client = WebClient.create(uri); String ret = client.path("rest").path(

JSON String to Object Mapping

余生长醉 提交于 2019-11-29 11:38:14
I am having an JSON Response and what I need is to Map the corresponding JSON String to the particular Response class.Is there any tools or framework to do the same. Response class is: import javax.xml.bind.annotation.XmlAccessType; import javax.xml.bind.annotation.XmlAccessorType; import javax.xml.bind.annotation.XmlElement; import javax.xml.bind.annotation.XmlRootElement; @XmlRootElement(name = "0") @XmlAccessorType(XmlAccessType.FIELD) public class Student { @XmlElement(name="0") private String firstName; @XmlElement(name="1") private String lastName; public String getFirstName() { return

JAX-RS - JSON without root node in apache CXF

倖福魔咒の 提交于 2019-11-28 11:21:29
问题 If we return collection object in the REST response, then the JSON (it will have the root element node as the collections object name - employees in this case) will be in the following format: { "employees": [{ "id": "1", "name": "employee name1", "company": "ABC Company" }, { "id": "2", "name": "employee name2", "company": "XYZ Company" }] } Here is a snipper for our JsonProvider config in application context <bean id="jsonProvider" class="org.apache.cxf.jaxrs.provider.json.JSONProvider">

No message body writer has been found for response class ArrayList

折月煮酒 提交于 2019-11-28 09:12:12
While I am trying to return List its throwing No message body writer has been found for response class ArrayList. I have code as follows: @POST @Path("/{scope}/{application}/tables") @Produces("application/xml") public List<String> getTableNames(@PathParam("scope") String scope, @PathParam("application") String application, Request request) { // For example, I am returning a list of String return new ArrayList<String>(4); } Please help me. Thanks in advance To return a list, best wrap it into a container annotated @XmlRootElement and give that container your list as a field, annotated as

JSON String to Object Mapping

风流意气都作罢 提交于 2019-11-28 05:18:21
问题 I am having an JSON Response and what I need is to Map the corresponding JSON String to the particular Response class.Is there any tools or framework to do the same. Response class is: import javax.xml.bind.annotation.XmlAccessType; import javax.xml.bind.annotation.XmlAccessorType; import javax.xml.bind.annotation.XmlElement; import javax.xml.bind.annotation.XmlRootElement; @XmlRootElement(name = "0") @XmlAccessorType(XmlAccessType.FIELD) public class Student { @XmlElement(name="0") private