src/share/jaxws_classes/com/sun/xml/internal/ws/addressing/v200408/MemberSubmissionWsaServerTube.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.addressing.v200408;
27
28 import com.sun.istack.internal.NotNull;
29 import com.sun.xml.internal.ws.addressing.WsaServerTube;
30 import com.sun.xml.internal.ws.addressing.model.MissingAddressingHeaderException;
31 import com.sun.xml.internal.ws.api.WSBinding;
32 import com.sun.xml.internal.ws.api.message.Packet;
33 import com.sun.xml.internal.ws.api.model.wsdl.WSDLBoundOperation;
34 import com.sun.xml.internal.ws.api.model.wsdl.WSDLPort;
35 import com.sun.xml.internal.ws.api.pipe.Tube;
36 import com.sun.xml.internal.ws.api.pipe.TubeCloner;
37 import com.sun.xml.internal.ws.api.server.WSEndpoint;
38 import com.sun.xml.internal.ws.developer.MemberSubmissionAddressing;
39 import com.sun.xml.internal.ws.developer.MemberSubmissionAddressingFeature;
40
41 /**
42 * @author Rama Pulavarthi
43 */
44 public class MemberSubmissionWsaServerTube extends WsaServerTube {
45 private final MemberSubmissionAddressing.Validation validation;
46 public MemberSubmissionWsaServerTube(WSEndpoint endpoint, @NotNull WSDLPort wsdlPort, WSBinding binding, Tube next) {
47 super(endpoint, wsdlPort, binding, next);
48 validation = binding.getFeature(MemberSubmissionAddressingFeature.class).getValidation();
49 }
50
51 public MemberSubmissionWsaServerTube(MemberSubmissionWsaServerTube that, TubeCloner cloner) {
52 super(that, cloner);
53 this.validation = that.validation;
54 }
55
56 @Override
57 public MemberSubmissionWsaServerTube copy(TubeCloner cloner) {
58 return new MemberSubmissionWsaServerTube(this, cloner);
59 }
60
61 @Override
62 protected void checkMandatoryHeaders(Packet packet, boolean foundAction, boolean foundTo, boolean foundReplyTo,
63 boolean foundFaultTo, boolean foundMessageId, boolean foundRelatesTo) {
64
65 super.checkMandatoryHeaders(packet, foundAction, foundTo, foundReplyTo,
66 foundFaultTo, foundMessageId, foundRelatesTo);
67
68 // if no wsa:To header is found
69 if (!foundTo)
70 throw new MissingAddressingHeaderException(addressingVersion.toTag,packet);
71
72 //we can find Req/Response or Oneway only with WSDLModel
73 if (wsdlPort != null) {
74 WSDLBoundOperation wbo = getWSDLBoundOperation(packet);
75 // if two-way, must contain wsa:ReplyTo
76 // Unlike W3C version, we cannot assume default value as anonymous if not present.
77 // For protocol messages, don't check as they do not have any corresponding wsdl operations
78 if (wbo != null && !wbo.getOperation().isOneWay() && !foundReplyTo) {
79 throw new MissingAddressingHeaderException(addressingVersion.replyToTag,packet);
80 }
81 }
82 if (!validation.equals(MemberSubmissionAddressing.Validation.LAX)) {
83 // wsa:MessageId is required if wsa:ReplyTo is present.
84 if ((foundReplyTo || foundFaultTo) && !foundMessageId)
85 throw new MissingAddressingHeaderException(addressingVersion.messageIDTag,packet);
86 }
87 }
88 }

mercurial