Package com.betfair.cougar.marshalling.api.databinding

Examples of com.betfair.cougar.marshalling.api.databinding.Marshaller


    private DataBindingFactory dataBindingFactory;


    public String marshallEventBody(Event event) throws CougarException {
        Marshaller marshaller = dataBindingFactory.getMarshaller();
        ByteArrayOutputStream outputStream = new ByteArrayOutputStream();
        marshaller.marshall(outputStream, event, characterEncoding);
        return outputStream.toString();
    }
View Full Code Here


                    } else {
                        RescriptResponse responseWrapper = binding.getBindingDescriptor().getResponseClass().newInstance();
                        responseWrapper.setResult(result);
                        MediaType responseMediaType = getContentTypeNormaliser().getNormalisedResponseMediaType(request);
                        DataBindingFactory dataBindingFactory = DataBindingManager.getInstance().getFactory(responseMediaType);
                        Marshaller marshaller = dataBindingFactory.getMarshaller();
                        String encoding = getContentTypeNormaliser().getNormalisedEncoding(request);
                        response.setContentType(responseMediaType.toString());
                        ByteCountingOutputStream out = null;
                        try {
                            out = new ByteCountingOutputStream(response.getOutputStream());
                            Object toMarshall = responseWrapper;
                            if (responseMediaType.getSubtype().equals("json")) {
                                toMarshall = responseWrapper.getResult();
                            }
                            marshaller.marshall(out, toMarshall, encoding, false);
                            logAccess(command,
                                    context, bytesRead,
                                    out.getCount(), requestMediaType,
                                    responseMediaType, ResponseCode.Ok);
                        } finally {
View Full Code Here

    private DataBindingFactory dataBindingFactory;


    public String marshallEventBody(Event event) throws CougarException {
        Marshaller marshaller = dataBindingFactory.getMarshaller();
        ByteArrayOutputStream outputStream = new ByteArrayOutputStream();
        marshaller.marshall(outputStream, event, characterEncoding, false);
        return outputStream.toString();
    }
View Full Code Here

                    } else {
                        RescriptResponse responseWrapper = binding.getBindingDescriptor().getResponseClass().newInstance();
                        responseWrapper.setResult(result);
                        MediaType responseMediaType = getContentTypeNormaliser().getNormalisedResponseMediaType(request);
                        DataBindingFactory dataBindingFactory = DataBindingManager.getInstance().getFactory(responseMediaType);
                        Marshaller marshaller = dataBindingFactory.getMarshaller();
                        String encoding = getContentTypeNormaliser().getNormalisedEncoding(request);
                        response.setContentType(responseMediaType.toString());
                        ByteCountingOutputStream out = null;
                        try {
                            out = new ByteCountingOutputStream(response.getOutputStream());
                            Object toMarshall = responseWrapper;
                            if (responseMediaType.getSubtype().equals("json")) {
                                toMarshall = responseWrapper.getResult();
                            }
                            marshaller.marshall(out, toMarshall, encoding);
                            logAccess(command,
                                    context, bytesRead,
                                    out.getCount(), requestMediaType,
                                    responseMediaType, ResponseCode.Ok);
                        } finally {
View Full Code Here

TOP

Related Classes of com.betfair.cougar.marshalling.api.databinding.Marshaller

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.