cxf-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Dan Diephouse" <>
Subject Re: Difference between XML and HTTP bindings
Date Thu, 25 Jan 2007 16:57:37 GMT
Hi Sergey,

The XMLBinding was designed with transporting xml over any transport. The
HTTP Binding is focused on ways to build RESTful services over HTTP only. I
wrote some documentation on it here:

So you're looking for ways to serve non-xml content - i.e return a JPEG on a
GET request? I would absolutely love this feature. It requires a bit of work
to our databinding code to make this work, and to be honest I haven't
thought about it too much quite yet. Are you interested in helping with this
feature? I will put together some thoughts and help out if so...

FWIW I have written code to serve out static resources on the HTTP Transport
before. Here it is if you're interested:

    private static void serveHTML() throws Exception {
        Bus bus = BusFactoryHelper.newInstance().getDefaultBus();
        DestinationFactoryManager dfm = bus.getExtension(
        DestinationFactory df = dfm.getDestinationFactory("");

        EndpointInfo ei = new EndpointInfo();

        Destination d = df.getDestination(ei);
        d.setMessageObserver(new MessageObserver() {

            public void onMessage(Message message) {
                try {
                    // HTTP seems to need this right now...
                    ExchangeImpl ex = new ExchangeImpl();

                    Conduit backChannel = message.getDestination().
                        getBackChannel(message, null, null);

                    MessageImpl res = new MessageImpl();
                    res.put(Message.CONTENT_TYPE, "text/html");

                    OutputStream out = res.getContent(OutputStream.class);
                    FileInputStream is = new FileInputStream("test.html");
                    IOUtils.copy(is, out, 2048);



                } catch (Exception e) {


- Dan

On 1/25/07, Sergey Beryozkin <> wrote:
> Hi,
> Just thinking aloud... So it appears there's no difference between these
> bindings, right ?
> Would it make sense to differentiate between them like this :
> * XMLBinding : used by Provider<Source> providers. Specifically GET
> requests are served by returning Source (XMLs).
> * HTTPBinding : providers are dealing with request InputStream, response
> OutputStream directly.
> They implement an interface like handleRequest(InputData, ResponseData),
> where InputData/ResponseData encapsulate the underlying engine's details so
> that such providers can run on Jetty/Tomcat/etc...
> For ex, I need a provider which saves (binary) attachments and then can
> serve them through simple GET requests issued from browsers, etc.. I can
> implement an XMLBinding (HTTPBinding) provider, but this provider can not
> handle GET requests which would just return some non-XML data. Well, it can
> return XOP multipart/related packages, but that is not something I need.
> Any thoughts ?
> Thanks, Sergey
> Hi
> What is the difference between XML and HTTP bindings from the perspective
> of the provider and the client ?
> I'm looking at the org.apache.cxf.systest.test , I can see
> RestSourcePayloadProvider and RestSourcePayloadProviderHTTPBinding
> providers, both are absolutely identical except that the former one has one
> extra annotation,
> =
> Corresponding test clients exercising these both providers are absoultely
> identical between each other. Are there any subtle differences ?
> Thanks, Sergey

Dan Diephouse
Envoi Solutions |

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