cxf

Apache Camel enrich message with file content on request

我只是一个虾纸丫 提交于 2020-01-12 05:36:08
问题 I'm implementing RESTful service (using CXFRS component) which should return files for some requests. Each file is fetched by its id and extension, i.e. restfulservice.com/path/file/1/pdf . Each file once added never changes. Files should not be moved or deleted after fetching and generally they should be accessible concurrently. Here is part of my Camel context: from("direct:fetchFile") .process(fetchFileProcessor) // set file.id & file.extension .bean(fileService, "fetchFile(${header.file

Is there a way to access the CXF message exchange from a JAX-RS REST Resource within CXF?

夙愿已清 提交于 2020-01-11 10:42:52
问题 Currently we have a a RESTful API using CXF 2.4.2. In one of my resource methods, I would like to process some query parameters and store the result in the CXF message exchange for an output interceptor to use later on. I've tried injecting the WebServiceContext as mentioned here, but it does not seem to work, probably because it is part of the JAX-WS specification, and we are using JAX-RS. Any help would be greatly appreciated! 回答1: The easiest, if using CXF, is to just do:

Is there a way to access the CXF message exchange from a JAX-RS REST Resource within CXF?

假如想象 提交于 2020-01-11 10:42:09
问题 Currently we have a a RESTful API using CXF 2.4.2. In one of my resource methods, I would like to process some query parameters and store the result in the CXF message exchange for an output interceptor to use later on. I've tried injecting the WebServiceContext as mentioned here, but it does not seem to work, probably because it is part of the JAX-WS specification, and we are using JAX-RS. Any help would be greatly appreciated! 回答1: The easiest, if using CXF, is to just do:

How to handle escape characters (pipe |) in URL (Spring, REST, CXF)?

跟風遠走 提交于 2020-01-11 06:24:44
问题 I am using Spring, CXF, Tomcat for developing web services. I have a problem sending characters such as pipes(|) in the URL? For example: http://localhost:9080/address/v1/countries/\ | throws a 500 error, is there a way to handle it and throw custom error code like 404 or even 400? I tried setting the URIEncoding="UTF-8" on the connector object in server.xml in tomcat. But it did not fix it. I also tried adding filter-mapping in the web.xml in my application like this:- <filter> <filter-name

how to deploy a jax-ws service to eclipse or tomcat?

£可爱£侵袭症+ 提交于 2020-01-11 05:37:09
问题 As a web services beginner, I have tried for 2 weeks to get a hello world webservice working with maven, eclipse and tomcat. I gave up trying to get any of the code/wsdl generators to work, and I followed this tutorial http://myarch.com/create-jax-ws-service-in-5-minutes to hand code an example, which is brilliant. This results in 4 class files and a WSDL file. So my stupid question is how to "run" the service in eclipse and/or on tomcat? I tried just deploying them as a webapp, but no joy -

Catching webservice exception with CXF: NoClassDefFoundError: SOAPFaultBuilder

不想你离开。 提交于 2020-01-11 05:22:24
问题 I've been using Apache CXF wsdl2java generated code to call methods from a webservice for some time now, which so far has been working fine.. The problem I'm having is that when the webservice (implemented just down the hall from me) legitimately throws a soap exception, CXF comes up with the following Error message: Could not initialize class com.sun.xml.internal.ws.fault.SOAPFaultBuilder I'm using Ubuntu 9.04, OpenJDK (IcedTea6 1.4.1) 6b14-1.1.1-0ubuntu11, Maven2 and CXF 2.2.3. I'm

Apache CXF - Set HTTP header

拟墨画扇 提交于 2020-01-11 04:28:46
问题 I have to set some http header fields in a Apache CXF client: I tried it via Interceptor: public class HttpHeaderInterceptor extends AbstractPhaseInterceptor<Message> { private String userId; private String xAuthorizeRoles; private String host; public HttpHeaderInterceptor() { super(Phase.POST_PROTOCOL); } @Override public void handleMessage(Message message) throws Fault { Map<String, List> headers = (Map<String, List>) message.get(Message.PROTOCOL_HEADERS); try { System.out.println(

Consuming a multipart/form-data via RESTful CXF

白昼怎懂夜的黑 提交于 2020-01-11 02:03:29
问题 I've been working in a webservice that consumes and produces JSON files using Apache CXF in conjuction with Jackson. However, one of the service's methods should be able to save an uploaded image from a mobile application that makes a multipart/form-data POST request to my webservice, and I don't know how to treat this kind of content-type within my context. We usually create "Request" and "Response" objects to consume and produce the JSON, however, I'm afraid this would not work for this

@JsonFilter throws “JsonMappingException: Can not resolve BeanPropertyFilter”

北慕城南 提交于 2020-01-10 01:03:06
问题 Is it possible to selectively determine when the @JsonFilter annotation gets used at runtime? I'm getting JsonMappingException exception (see below) when I don't provide the filter. Background: I learned from a recent StackOverflow post that I can use @JsonFilter to dynamically filter the bean properties getting serialized. This works great. After adding @JsonFilter("apiFilter") to my domain class and with the addition of this code in my jax-rs service (using the CXF implementation), I am

How to return a partial JSON response using Java?

廉价感情. 提交于 2020-01-09 03:02:26
问题 I'm building a RESTful API and want to provide developers with the option to choose which fields to return in the JSON response. This blog post shows examples of how several API's (Google, Facebook, LinkedIn) allow developers to customize the response. This is referred to as partial response. An example might look like this: /users/123?fields=userId,fullname,title In the example above the API should return the userId, fullName and title fields for User "123". I'm looking for ideas of how to