View Javadoc

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.mapping;
18  
19  import javax.xml.namespace.QName;
20  import javax.xml.transform.TransformerException;
21  import javax.xml.transform.TransformerFactory;
22  
23  import org.springframework.ws.context.MessageContext;
24  import org.springframework.ws.server.endpoint.support.PayloadRootUtils;
25  
26  /**
27   * Implementation of the <code>EndpointMapping</code> interface to map from the qualified name of the request payload
28   * root element. Supports both mapping to bean instances and mapping to bean names: the latter is required for prototype
29   * endpoints.
30   * <p/>
31   * The <code>endpointMap</code> property is suitable for populating the endpoint map with bean references, e.g. via the
32   * map element in XML bean definitions.
33   * <p/>
34   * Mappings to bean names can be set via the <code>mappings</code> property, in a form accepted by the
35   * <code>java.util.Properties</code> class, like as follows:
36   * <pre>
37   * {http://www.springframework.org/spring-ws/samples/airline/schemas}BookFlight=bookFlightEndpoint
38   * {http://www.springframework.org/spring-ws/samples/airline/schemas}GetFlights=getFlightsEndpoint
39   * </pre>
40   * The syntax is QNAME=ENDPOINT_BEAN_NAME. Qualified names are parsed using the syntax described in
41   * <code>QNameEditor</code>.
42   *
43   * @author Arjen Poutsma
44   * @see org.springframework.xml.namespace.QNameEditor
45   * @since 1.0.0
46   * @deprecated as of Spring Web Services 2.0, in favor of {@link PayloadRootAnnotationMethodEndpointMapping}.
47   */
48  @Deprecated
49  public class PayloadRootQNameEndpointMapping extends AbstractQNameEndpointMapping {
50  
51      private static TransformerFactory transformerFactory;
52  
53      static {
54          transformerFactory = TransformerFactory.newInstance();
55      }
56  
57      @Override
58      protected QName resolveQName(MessageContext messageContext) throws TransformerException {
59          return PayloadRootUtils.getPayloadRootQName(messageContext.getRequest().getPayloadSource(), transformerFactory);
60      }
61  
62  }