1 /*
2 * Copyright 2005-2010 the original author or authors.
3 *
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
7 *
8 * http://www.apache.org/licenses/LICENSE-2.0
9 *
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
15 */
16
17 package org.springframework.ws.server.endpoint.adapter;
18
19 import java.lang.reflect.Method;
20
21 import org.springframework.ws.context.MessageContext;
22 import org.springframework.ws.server.MessageDispatcher;
23 import org.springframework.ws.server.endpoint.MethodEndpoint;
24 import org.springframework.ws.soap.server.SoapMessageDispatcher;
25
26 /**
27 * Adapter that supports endpoint methods with message contexts. Supports methods with the following signature:
28 * <pre>
29 * void handleMyMessage(MessageContext request);
30 * </pre>
31 * I.e. methods that take a single {@link MessageContext} parameter, and return <code>void</code>. The method can have
32 * any name, as long as it is mapped by an {@link org.springframework.ws.server.EndpointMapping}.
33 * <p/>
34 * This adapter is registered by default by the {@link MessageDispatcher} and {@link SoapMessageDispatcher}.
35 *
36 * @author Arjen Poutsma
37 * @since 1.0.0
38 * @deprecated as of Spring Web Services 2.0, in favor of {@link DefaultMethodEndpointAdapter} and {@link
39 * org.springframework.ws.server.endpoint.adapter.method.MessageContextMethodArgumentResolver
40 * MessageContextMethodArgumentResolver}.
41 */
42 @Deprecated
43 public class MessageMethodEndpointAdapter extends AbstractMethodEndpointAdapter {
44
45 @Override
46 protected boolean supportsInternal(MethodEndpoint methodEndpoint) {
47 Method method = methodEndpoint.getMethod();
48 return Void.TYPE.isAssignableFrom(method.getReturnType()) && method.getParameterTypes().length == 1 &&
49 MessageContext.class.isAssignableFrom(method.getParameterTypes()[0]);
50 }
51
52 @Override
53 protected void invokeInternal(MessageContext messageContext, MethodEndpoint methodEndpoint) throws Exception {
54 methodEndpoint.invoke(messageContext);
55 }
56
57 }