src/share/jaxws_classes/com/sun/xml/internal/ws/util/pipe/StandaloneTubeAssembler.java

changeset 0
373ffda63c9a
child 637
9c07ef4934dd
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/src/share/jaxws_classes/com/sun/xml/internal/ws/util/pipe/StandaloneTubeAssembler.java	Wed Apr 27 01:27:09 2016 +0800
     1.3 @@ -0,0 +1,93 @@
     1.4 +/*
     1.5 + * Copyright (c) 1997, 2012, Oracle and/or its affiliates. All rights reserved.
     1.6 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
     1.7 + *
     1.8 + * This code is free software; you can redistribute it and/or modify it
     1.9 + * under the terms of the GNU General Public License version 2 only, as
    1.10 + * published by the Free Software Foundation.  Oracle designates this
    1.11 + * particular file as subject to the "Classpath" exception as provided
    1.12 + * by Oracle in the LICENSE file that accompanied this code.
    1.13 + *
    1.14 + * This code is distributed in the hope that it will be useful, but WITHOUT
    1.15 + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
    1.16 + * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
    1.17 + * version 2 for more details (a copy is included in the LICENSE file that
    1.18 + * accompanied this code).
    1.19 + *
    1.20 + * You should have received a copy of the GNU General Public License version
    1.21 + * 2 along with this work; if not, write to the Free Software Foundation,
    1.22 + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
    1.23 + *
    1.24 + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
    1.25 + * or visit www.oracle.com if you need additional information or have any
    1.26 + * questions.
    1.27 + */
    1.28 +
    1.29 +package com.sun.xml.internal.ws.util.pipe;
    1.30 +
    1.31 +import com.sun.istack.internal.NotNull;
    1.32 +import com.sun.xml.internal.ws.api.pipe.ClientTubeAssemblerContext;
    1.33 +import com.sun.xml.internal.ws.api.pipe.ServerTubeAssemblerContext;
    1.34 +import com.sun.xml.internal.ws.api.pipe.Tube;
    1.35 +import com.sun.xml.internal.ws.api.pipe.TubelineAssembler;
    1.36 +
    1.37 +/**
    1.38 + * Default Pipeline assembler for JAX-WS client and server side runtimes. It
    1.39 + * assembles various pipes into a pipeline that a message needs to be passed
    1.40 + * through.
    1.41 + *
    1.42 + * @author Jitendra Kotamraju
    1.43 + */
    1.44 +public class StandaloneTubeAssembler implements TubelineAssembler {
    1.45 +
    1.46 +    @NotNull
    1.47 +    public Tube createClient(ClientTubeAssemblerContext context) {
    1.48 +        Tube head = context.createTransportTube();
    1.49 +        head = context.createSecurityTube(head);
    1.50 +        if (dump) {
    1.51 +            // for debugging inject a dump pipe. this is left in the production code,
    1.52 +            // as it would be very handy for a trouble-shooting at the production site.
    1.53 +            head = context.createDumpTube("client", System.out, head);
    1.54 +        }
    1.55 +        head = context.createWsaTube(head);
    1.56 +        head = context.createClientMUTube(head);
    1.57 +        head = context.createValidationTube(head);
    1.58 +        return context.createHandlerTube(head);
    1.59 +    }
    1.60 +
    1.61 +    /**
    1.62 +     * On Server-side, HandlerChains cannot be changed after it is deployed.
    1.63 +     * During assembling the Pipelines, we can decide if we really need a
    1.64 +     * SOAPHandlerPipe and LogicalHandlerPipe for a particular Endpoint.
    1.65 +     */
    1.66 +    public Tube createServer(ServerTubeAssemblerContext context) {
    1.67 +        Tube head = context.getTerminalTube();
    1.68 +        head = context.createValidationTube(head);
    1.69 +        head = context.createHandlerTube(head);
    1.70 +        head = context.createMonitoringTube(head);
    1.71 +        head = context.createServerMUTube(head);
    1.72 +        head = context.createWsaTube(head);
    1.73 +        if (dump) {
    1.74 +            // for debugging inject a dump pipe. this is left in the production code,
    1.75 +            // as it would be very handy for a trouble-shooting at the production site.
    1.76 +            head = context.createDumpTube("server", System.out, head);
    1.77 +        }
    1.78 +        head = context.createSecurityTube(head);
    1.79 +        return head;
    1.80 +    }
    1.81 +
    1.82 +    /**
    1.83 +     * Are we going to dump the message to System.out?
    1.84 +     */
    1.85 +    public static final boolean dump;
    1.86 +
    1.87 +    static {
    1.88 +        boolean b = false;
    1.89 +        try {
    1.90 +            b = Boolean.getBoolean(StandaloneTubeAssembler.class.getName()+".dump");
    1.91 +        } catch (Throwable t) {
    1.92 +            // treat it as false
    1.93 +        }
    1.94 +        dump = b;
    1.95 +    }
    1.96 +}

mercurial