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

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


                        responseMediaType = getContentTypeNormaliser().getNormalisedResponseMediaType(request);
                    } catch (CougarValidationException e) {
                        responseMediaType = MediaType.APPLICATION_XML_TYPE;
                    }
                    response.setContentType(responseMediaType.toString());
                    DataBindingFactory dataBindingFactory = DataBindingManager.getInstance().getFactory(responseMediaType);
                    FaultMarshaller marshaller = dataBindingFactory.getFaultMarshaller();
                    ByteCountingOutputStream out = null;
                    try {
                        out = new ByteCountingOutputStream(response.getOutputStream());
                        marshaller.marshallFault(out, error.getFault(), getContentTypeNormaliser().getNormalisedEncoding(request));
                        bytesWritten = out.getCount();
View Full Code Here


                                null, ResponseCode.Ok);
                    } 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());
View Full Code Here

    }

    public RescriptBody resolveBody(InputStream inputStream, MediaType mediaType, String encoding) {
        // First of all deserialise the body to get the basics of the request
        if (mediaType != null) {
            DataBindingFactory factory = DataBindingManager.getInstance().getFactory(mediaType);
            if(factory == null) {
                throw new CougarFrameworkException("Invalid content type " + mediaType);
            }
            UnMarshaller unMarshaller = factory.getUnMarshaller();
            return (RescriptBody)unMarshaller.unmarshall(inputStream,
                        bindingDescriptor.getBodyClass(),
                        encoding, false);
        }
        return null;
View Full Code Here

    }

    public RescriptBody resolveBody(InputStream inputStream, MediaType mediaType, String encoding) {
        // First of all deserialise the body to get the basics of the request
        if (mediaType != null) {
            DataBindingFactory factory = DataBindingManager.getInstance().getFactory(mediaType);
            if(factory == null) {
                throw new CougarFrameworkException("Invalid content type " + mediaType);
            }
            UnMarshaller unMarshaller = factory.getUnMarshaller();
            return (RescriptBody)unMarshaller.unmarshall(inputStream,
                        bindingDescriptor.getBodyClass(),
                        encoding);
        }
        return null;
View Full Code Here

                        responseMediaType = getContentTypeNormaliser().getNormalisedResponseMediaType(request);
                    } catch (CougarValidationException e) {
                        responseMediaType = MediaType.APPLICATION_XML_TYPE;
                    }
                    response.setContentType(responseMediaType.toString());
                    DataBindingFactory dataBindingFactory = DataBindingManager.getInstance().getFactory(responseMediaType);
                    FaultMarshaller marshaller = dataBindingFactory.getFaultMarshaller();
                    ByteCountingOutputStream out = null;
                    try {
                        out = new ByteCountingOutputStream(response.getOutputStream());
                        marshaller.marshallFault(out, error.getFault(), getContentTypeNormaliser().getNormalisedEncoding(request));
                        bytesWritten = out.getCount();
View Full Code Here

                                null, ResponseCode.Ok);
                    } 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());
View Full Code Here

TOP

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

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.