cxf-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Ioel Shem-Tov <ioel.shem...@gmail.com>
Subject Re: CXF treats empty and blank Strings as null
Date Thu, 04 Jan 2018 11:07:08 GMT
Hi Stefan,

If I understand your problem correctly, I think you need to add an
interceptor that escapes those spaces to your InIntercpetors.

One possible way, if you do use XML, is to use
org.apache.cxf.interceptor.transform.TransformInInterceptor:

1. Instantiate a TransformInInterceptor
2. On the new interceptor define transformations that escape the spaces
(like " " -> "| |", "  " -> "|  |", or perhaps " " -> "&20;")
3. Add the configured interceptor to your InInterceptos.
4. Interpret the escaped spaces back to spaces.

I hope this helps.
Joel

On 25 December 2017 at 23:12, Andrei Shakirin <ashakirin@talend.com> wrote:

> Hi,
>
> Which media type are you using by communication, is it XML / JSON/
> something different ?
>
> Regards,
> Andrei.
>
> > -----Original Message-----
> > From: stefan.goebel@sdv-it.de [mailto:stefan.goebel@sdv-it.de]
> > Sent: Mittwoch, 20. Dezember 2017 11:47
> > To: users@cxf.apache.org
> > Subject: CXF treats empty and blank Strings as null
> >
> > Hi
> >
> > We are facing an issue with CXF regarding the marshalling of empty/blank
> > string.
> >
> > By default CXF treats empty and blank Strings as null. Unfortunately we
> are
> > consuming a legacy service where a String with containing spaces
> actually has
> > meaning and therefore should not be treated as null.
> >
> > Is there a way to configure the marshaller to differentiate between and
> empty-
> > string "" and a blank-string " "? So that the blank-string is preserved?
> >
> >
> >
> > best regards
> >
> > Stefan Goebel
>

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message