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.geronimo.test;
19:
20: import javax.xml.ws.handler.MessageContext;
21: import javax.xml.ws.handler.LogicalMessageContext;
22: import javax.xml.ws.WebServiceContext;
23:
24: import javax.annotation.PreDestroy;
25: import javax.annotation.PostConstruct;
26: import javax.annotation.Resource;
27:
28: import java.util.Set;
29: import java.util.TreeSet;
30: import java.util.Map;
31:
32: import javax.xml.namespace.QName;
33:
34: import javax.xml.soap.*;
35:
36: public class GreeterLogicalHandler implements
37: javax.xml.ws.handler.LogicalHandler<LogicalMessageContext> {
38:
39: @Resource
40: WebServiceContext context;
41:
42: @Resource(name="greeting")
43: private String greeting;
44:
45: public boolean handleMessage(LogicalMessageContext context) {
46: System.out.println(this + " HandleMessage: "
47: + context.get(MessageContext.MESSAGE_OUTBOUND_PROPERTY)
48: + " " + greeting);
49: System.out.println(context.getMessage().getPayload());
50: return true;
51: }
52:
53: @PostConstruct
54: public void init() {
55: System.out.println(this + " init " + context);
56: }
57:
58: @PreDestroy
59: public void destroy() {
60: System.out.println(this + " destroy");
61: }
62:
63: public void init(Map<String, Object> config) {
64: }
65:
66: public boolean handleFault(LogicalMessageContext context) {
67: System.out.println(this + " handleFault");
68: return true;
69: }
70:
71: public void close(MessageContext context) {
72: System.out.println(this + " close");
73: }
74:
75: }
|