src/share/jaxws_classes/com/sun/xml/internal/ws/api/server/WebServiceContextDelegate.java

Tue, 09 Apr 2013 14:51:13 +0100

author
alanb
date
Tue, 09 Apr 2013 14:51:13 +0100
changeset 368
0989ad8c0860
parent 286
f50545b5e2f1
child 637
9c07ef4934dd
permissions
-rw-r--r--

8010393: Update JAX-WS RI to 2.2.9-b12941
Reviewed-by: alanb, erikj
Contributed-by: miroslav.kos@oracle.com, martin.grebac@oracle.com

ohair@286 1 /*
alanb@368 2 * Copyright (c) 1997, 2012, Oracle and/or its affiliates. All rights reserved.
ohair@286 3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
ohair@286 4 *
ohair@286 5 * This code is free software; you can redistribute it and/or modify it
ohair@286 6 * under the terms of the GNU General Public License version 2 only, as
ohair@286 7 * published by the Free Software Foundation. Oracle designates this
ohair@286 8 * particular file as subject to the "Classpath" exception as provided
ohair@286 9 * by Oracle in the LICENSE file that accompanied this code.
ohair@286 10 *
ohair@286 11 * This code is distributed in the hope that it will be useful, but WITHOUT
ohair@286 12 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
ohair@286 13 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
ohair@286 14 * version 2 for more details (a copy is included in the LICENSE file that
ohair@286 15 * accompanied this code).
ohair@286 16 *
ohair@286 17 * You should have received a copy of the GNU General Public License version
ohair@286 18 * 2 along with this work; if not, write to the Free Software Foundation,
ohair@286 19 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
ohair@286 20 *
ohair@286 21 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
ohair@286 22 * or visit www.oracle.com if you need additional information or have any
ohair@286 23 * questions.
ohair@286 24 */
ohair@286 25
ohair@286 26 package com.sun.xml.internal.ws.api.server;
ohair@286 27
ohair@286 28 import com.sun.istack.internal.NotNull;
ohair@286 29 import com.sun.istack.internal.Nullable;
ohair@286 30 import com.sun.xml.internal.ws.api.message.Packet;
ohair@286 31 import com.sun.xml.internal.ws.api.pipe.Pipe;
ohair@286 32
ohair@286 33 import javax.xml.ws.WebServiceContext;
ohair@286 34 import javax.xml.ws.WebServiceException;
ohair@286 35 import java.security.Principal;
ohair@286 36
ohair@286 37 /**
ohair@286 38 * This object is set to {@link Packet#webServiceContextDelegate}
ohair@286 39 * to serve {@link WebServiceContext} methods for a {@link Packet}.
ohair@286 40 *
ohair@286 41 * <p>
ohair@286 42 * When the user application calls a method on {@link WebServiceContext},
ohair@286 43 * the JAX-WS RI goes to the {@link Packet} that represents the request,
ohair@286 44 * then check {@link Packet#webServiceContextDelegate}, and forwards
ohair@286 45 * the method calls to {@link WebServiceContextDelegate}.
ohair@286 46 *
ohair@286 47 * <p>
ohair@286 48 * All the methods defined on this interface takes {@link Packet}
ohair@286 49 * (whose {@link Packet#webServiceContextDelegate} points to
ohair@286 50 * this object), so that a single stateless {@link WebServiceContextDelegate}
ohair@286 51 * can be used to serve multiple concurrent {@link Packet}s,
ohair@286 52 * if the implementation wishes to do so.
ohair@286 53 *
ohair@286 54 * <p>
ohair@286 55 * (It is also allowed to create one instance of
ohair@286 56 * {@link WebServiceContextDelegate} for each packet,
ohair@286 57 * and thus effectively ignore the packet parameter.)
ohair@286 58 *
ohair@286 59 * <p>
ohair@286 60 * Attaching this on a {@link Packet} allows {@link Pipe}s to
ohair@286 61 * intercept and replace them, if they wish.
ohair@286 62 *
ohair@286 63 *
ohair@286 64 * @author Kohsuke Kawaguchi
ohair@286 65 */
ohair@286 66 public interface WebServiceContextDelegate {
ohair@286 67 /**
ohair@286 68 * Implements {@link WebServiceContext#getUserPrincipal()}
ohair@286 69 * for the given packet.
ohair@286 70 *
ohair@286 71 * @param request
ohair@286 72 * Always non-null. See class javadoc.
ohair@286 73 * @see WebServiceContext#getUserPrincipal()
ohair@286 74 */
ohair@286 75 Principal getUserPrincipal(@NotNull Packet request);
ohair@286 76
ohair@286 77 /**
ohair@286 78 * Implements {@link WebServiceContext#isUserInRole(String)}
ohair@286 79 * for the given packet.
ohair@286 80 *
ohair@286 81 * @param request
ohair@286 82 * Always non-null. See class javadoc.
ohair@286 83 * @see WebServiceContext#isUserInRole(String)
ohair@286 84 */
ohair@286 85 boolean isUserInRole(@NotNull Packet request,String role);
ohair@286 86
ohair@286 87 /**
ohair@286 88 * Gets the address of the endpoint.
ohair@286 89 *
ohair@286 90 * <p>
ohair@286 91 * The "address" of endpoints is always affected by a particular
ohair@286 92 * client being served, hence it's up to transport to provide this
ohair@286 93 * information.
ohair@286 94 *
ohair@286 95 * @param request
ohair@286 96 * Always non-null. See class javadoc.
ohair@286 97 * @param endpoint
ohair@286 98 * The endpoint whose address will be returned.
ohair@286 99 *
ohair@286 100 * @throws WebServiceException
ohair@286 101 * if this method could not compute the address for some reason.
ohair@286 102 * @return
ohair@286 103 * Absolute URL of the endpoint. This shold be an address that the client
ohair@286 104 * can use to talk back to this same service later.
ohair@286 105 *
ohair@286 106 * @see WebServiceContext#getEndpointReference
ohair@286 107 */
ohair@286 108 @NotNull String getEPRAddress(@NotNull Packet request, @NotNull WSEndpoint endpoint);
ohair@286 109
ohair@286 110 /**
ohair@286 111 * Gets the address of the primary WSDL.
ohair@286 112 *
ohair@286 113 * <p>
ohair@286 114 * If a transport supports publishing of WSDL by itself (instead/in addition to MEX),
ohair@286 115 * then it should implement this method so that the rest of the JAX-WS RI can
ohair@286 116 * use that information.
ohair@286 117 *
ohair@286 118 * For example, HTTP transports often use the convention {@code getEPRAddress()+"?wsdl"}
ohair@286 119 * for publishing WSDL on HTTP.
ohair@286 120 *
ohair@286 121 * <p>
ohair@286 122 * Some transports may not have such WSDL publishing mechanism on its own.
ohair@286 123 * Those transports may choose to return null, indicating that WSDL
ohair@286 124 * is not published. If such transports are always used in conjunction with
ohair@286 125 * other transports that support WSDL publishing (such as SOAP/TCP used
ohair@286 126 * with Servlet transport), then such transport may
ohair@286 127 * choose to find the corresponding servlet endpoint by {@link Module#getBoundEndpoints()}
ohair@286 128 * and try to obtain the address from there.
ohair@286 129 *
ohair@286 130 * <p>
ohair@286 131 * This information is used to put a metadata reference inside an EPR,
ohair@286 132 * among other things. Clients that do not support MEX rely on this
ohair@286 133 * WSDL URL to retrieve metadata, it is desirable for transports to support
ohair@286 134 * this, but not mandatory.
ohair@286 135 *
ohair@286 136 * <p>
ohair@286 137 * This method will be never invoked if the {@link WSEndpoint}
ohair@286 138 * does not have a corresponding WSDL to begin with
ohair@286 139 * (IOW {@link WSEndpoint#getServiceDefinition() returning null}.
ohair@286 140 *
ohair@286 141 * @param request
ohair@286 142 * Always non-null. See class javadoc.
ohair@286 143 * @param endpoint
ohair@286 144 * The endpoint whose address will be returned.
ohair@286 145 *
ohair@286 146 * @return
ohair@286 147 * null if the implementation does not support the notion of
ohair@286 148 * WSDL publishing.
ohair@286 149 */
ohair@286 150 @Nullable String getWSDLAddress(@NotNull Packet request, @NotNull WSEndpoint endpoint);
ohair@286 151 }

mercurial