01: /**
02: * Licensed to the Apache Software Foundation (ASF) under one
03: * or more contributor license agreements. See the NOTICE file
04: * distributed with this work for additional information
05: * regarding copyright ownership. The ASF licenses this file
06: * to you under the Apache License, Version 2.0 (the
07: * "License"); you may not use this file except in compliance
08: * with the License. You may obtain a copy of the License at
09: *
10: * http://www.apache.org/licenses/LICENSE-2.0
11: *
12: * Unless required by applicable law or agreed to in writing,
13: * software distributed under the License is distributed on an
14: * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
15: * KIND, either express or implied. See the License for the
16: * specific language governing permissions and limitations
17: * under the License.
18: */package org.apache.cxf.systest.clustering;
19:
20: import javax.annotation.Resource;
21: import javax.jws.WebService;
22: import javax.xml.ws.WebServiceContext;
23:
24: import org.apache.cxf.greeter_control.AbstractGreeterImpl;
25: import org.apache.cxf.ws.addressing.AddressingProperties;
26: import org.apache.cxf.ws.addressing.JAXWSAConstants;
27:
28: @WebService(serviceName="GreeterService",portName="ReplicatedPortA",endpointInterface="org.apache.cxf.greeter_control.Greeter",targetNamespace="http://cxf.apache.org/greeter_control",wsdlLocation="testutils/greeter_control.wsdl")
29: public class GreeterImplA extends AbstractGreeterImpl {
30: @Resource
31: private WebServiceContext context;
32:
33: private String address;
34:
35: GreeterImplA() {
36: address = FailoverTest.REPLICA_A;
37: }
38:
39: public String greetMe(String s) {
40: return super .greetMe(s) + " on message: " + getMessageID()
41: + " from: " + address;
42: }
43:
44: private String getMessageID() {
45: String id = null;
46: if (context.getMessageContext() != null) {
47: String property = JAXWSAConstants.SERVER_ADDRESSING_PROPERTIES_INBOUND;
48: AddressingProperties maps = (AddressingProperties) context
49: .getMessageContext().get(property);
50: id = maps != null && maps.getMessageID() != null ? maps
51: .getMessageID().getValue() : null;
52: }
53: return id;
54: }
55: }
|