Package org.mule.api.transport

Examples of org.mule.api.transport.OutputHandler


    {
        try
        {
            final Base e = (Base) src;

            return new OutputHandler()
            {
                public void write(MuleEvent event, OutputStream out) throws IOException
                {
                    FOMWriterOptions opts = new FOMWriterOptions();
                    opts.setCharset(event.getEncoding());
View Full Code Here


        }

        private MuleMessage output(final MuleMessage request,
                                   final ResponseContext context, final MuleContext muleContext) throws IOException
        {
            OutputHandler payload = new OutputHandler()
            {

                public void write(MuleEvent event, OutputStream out) throws IOException
                {
                    if (context.hasEntity())
View Full Code Here

            writer.println();
            writer.flush();

            if (response.hasBody())
            {
                OutputHandler handler = response.getBody();
                Header transferenc = response.getFirstHeader(HttpConstants.HEADER_TRANSFER_ENCODING);
                if (transferenc != null)
                {
                    response.removeHeaders(HttpConstants.HEADER_CONTENT_LENGTH);
                    if (transferenc.getValue().indexOf(HttpConstants.TRANSFER_ENCODING_CHUNKED) != -1)
                    {
                        outstream = new ChunkedOutputStream(outstream);
                    }
                }

                handler.write(RequestContext.getEvent(), outstream);

                if (outstream instanceof ChunkedOutputStream)
                {
                    ((ChunkedOutputStream)outstream).finish();
                }
View Full Code Here

    }

    @Override
    public Object doTransform(final Object src, String encoding) throws TransformerException
    {
            return new OutputHandler()
            {
                public void write(MuleEvent event, OutputStream out) throws IOException
                {
                    InputStream is = ((HttpServletRequest) src).getInputStream();
                    try
View Full Code Here

            writer.print(header.toExternalForm());
        }
        writer.println();
        writer.flush();

        OutputHandler content = response.getBody();
        if (content != null)
        {
            Header transferenc = response.getFirstHeader(HttpConstants.HEADER_TRANSFER_ENCODING);
            if (transferenc != null)
            {
                response.removeHeaders(HttpConstants.HEADER_CONTENT_LENGTH);
                if (transferenc.getValue().indexOf(HttpConstants.TRANSFER_ENCODING_CHUNKED) != -1)
                {
                    outstream = new ChunkedOutputStream(outstream);
                }
            }

            content.write(RequestContext.getEvent(), outstream);

            if (outstream instanceof ChunkedOutputStream)
            {
                ((ChunkedOutputStream) outstream).finish();
            }
View Full Code Here

        if (!containsHeader(HttpConstants.HEADER_TRANSFER_ENCODING))
        {
            setHeader(new Header(HttpConstants.HEADER_CONTENT_LENGTH, Long.toString(raw.length)));
        }       
       
        this.outputHandler = new OutputHandler() {

            public void write(MuleEvent event, OutputStream out) throws IOException
            {
                out.write(raw);
            }
View Full Code Here

            {
                return new ByteArrayInputStream((byte[]) src);
            }
            else if (src instanceof OutputHandler)
            {
                OutputHandler oh = (OutputHandler) src;

                ByteArrayOutputStream out = new ByteArrayOutputStream();
                oh.write(RequestContext.getEvent(), out);

                return new ByteArrayInputStream(out.toByteArray());
            }
            else
            {
View Full Code Here

            if (!(body instanceof OutputHandler))
            {
                body = event.transformMessage(DataTypeFactory.create(OutputHandler.class));
            }

            OutputHandler outputHandler = (OutputHandler) body;
            postMethod.setRequestEntity(new StreamPayloadRequestEntity(outputHandler, event));
            postMethod.setContentChunked(true);
            httpMethod = postMethod;
        }
View Full Code Here

        final MuleResponseWriter writer = new MuleResponseWriter(event, request.getMethod(), backgroundScheduler);

        request.setWriter(writer);
        application.handle(request);

        return new OutputHandler()
        {
            @Override
            public void write(MuleEvent event, OutputStream out) throws IOException
            {
                writer.getOutputStream().setDelegate(out);
View Full Code Here

                m.marshal(src, out);
                return out;
            }
            else if (OutputHandler.class.equals(getReturnClass()))
            {
                return new OutputHandler()
                {
                    public void write(MuleEvent event, OutputStream out) throws IOException
                    {
                        try
                        {
View Full Code Here

TOP

Related Classes of org.mule.api.transport.OutputHandler

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.