src/share/jaxws_classes/com/sun/xml/internal/ws/server/provider/SyncProviderInvokerTube.java

changeset 286
f50545b5e2f1
child 368
0989ad8c0860
equal deleted inserted replaced
284:88b85470e72c 286:f50545b5e2f1
1 /*
2 * Copyright (c) 1997, 2010, Oracle and/or its affiliates. All rights reserved.
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4 *
5 * This code is free software; you can redistribute it and/or modify it
6 * under the terms of the GNU General Public License version 2 only, as
7 * published by the Free Software Foundation. Oracle designates this
8 * particular file as subject to the "Classpath" exception as provided
9 * by Oracle in the LICENSE file that accompanied this code.
10 *
11 * This code is distributed in the hope that it will be useful, but WITHOUT
12 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
13 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
14 * version 2 for more details (a copy is included in the LICENSE file that
15 * accompanied this code).
16 *
17 * You should have received a copy of the GNU General Public License version
18 * 2 along with this work; if not, write to the Free Software Foundation,
19 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
20 *
21 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
22 * or visit www.oracle.com if you need additional information or have any
23 * questions.
24 */
25
26 package com.sun.xml.internal.ws.server.provider;
27
28 import com.sun.istack.internal.NotNull;
29 import com.sun.xml.internal.ws.api.WSBinding;
30 import com.sun.xml.internal.ws.api.message.Packet;
31 import com.sun.xml.internal.ws.api.model.wsdl.WSDLPort;
32 import com.sun.xml.internal.ws.api.pipe.NextAction;
33 import com.sun.xml.internal.ws.api.server.Invoker;
34
35 import javax.xml.ws.Provider;
36 import java.util.logging.Level;
37 import java.util.logging.Logger;
38
39 /**
40 * This tube is used to invoke the {@link Provider} endpoints.
41 *
42 * @author Jitendra Kotamraju
43 */
44 class SyncProviderInvokerTube<T> extends ProviderInvokerTube<T> {
45
46 private static final Logger LOGGER = Logger.getLogger(
47 com.sun.xml.internal.ws.util.Constants.LoggingDomain + ".server.SyncProviderInvokerTube");
48
49 public SyncProviderInvokerTube(Invoker invoker, ProviderArgumentsBuilder<T> argsBuilder) {
50 super(invoker, argsBuilder);
51 }
52
53 /*
54 * This binds the parameter for Provider endpoints and invokes the
55 * invoke() method of {@linke Provider} endpoint. The return value from
56 * invoke() is used to create a new {@link Message} that traverses
57 * through the Pipeline to transport.
58 */
59 public NextAction processRequest(Packet request) {
60 WSDLPort port = getEndpoint().getPort();
61 WSBinding binding = getEndpoint().getBinding();
62 T param = argsBuilder.getParameter(request);
63
64 LOGGER.fine("Invoking Provider Endpoint");
65
66 T returnValue;
67 try {
68 returnValue = getInvoker(request).invokeProvider(request, param);
69 } catch(Exception e) {
70 LOGGER.log(Level.SEVERE, e.getMessage(), e);
71 Packet response = argsBuilder.getResponse(request,e,port,binding);
72 return doReturnWith(response);
73 }
74 if (returnValue == null) {
75 // Oneway. Send response code immediately for transports(like HTTP)
76 // Don't do this above, since close() may generate some exceptions
77 if (request.transportBackChannel != null) {
78 request.transportBackChannel.close();
79 }
80 }
81 Packet response = argsBuilder.getResponse(request,returnValue,port,binding);
82 return doReturnWith(response);
83 }
84
85 public NextAction processResponse(Packet response) {
86 throw new IllegalStateException("InovkerPipe's processResponse shouldn't be called.");
87 }
88
89 public NextAction processException(@NotNull Throwable t) {
90 throw new IllegalStateException("InovkerPipe's processException shouldn't be called.");
91 }
92
93 }

mercurial