Package com.betfair.cougar.transport.api.protocol.http.rescript

Examples of com.betfair.cougar.transport.api.protocol.http.rescript.RescriptResponse


                        logAccess(command,
                                context, bytesRead,
                                0, requestMediaType,
                                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());
                            Object toMarshall = responseWrapper;
                            if (responseMediaType.getSubtype().equals("json")) {
                                toMarshall = responseWrapper.getResult();
                            }
                            marshaller.marshall(out, toMarshall, encoding, false);
                            logAccess(command,
                                    context, bytesRead,
                                    out.getCount(), requestMediaType,
View Full Code Here


                        logAccess(command,
                                context, bytesRead,
                                0, requestMediaType,
                                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());
                            Object toMarshall = responseWrapper;
                            if (responseMediaType.getSubtype().equals("json")) {
                                toMarshall = responseWrapper.getResult();
                            }
                            marshaller.marshall(out, toMarshall, encoding);
                            logAccess(command,
                                    context, bytesRead,
                                    out.getCount(), requestMediaType,
View Full Code Here

TOP

Related Classes of com.betfair.cougar.transport.api.protocol.http.rescript.RescriptResponse

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.