Classes in this File | Line Coverage | Branch Coverage | Complexity | |||||||
XmlRpcServer |
|
| 1.0;1 |
1 | /* |
|
2 | * Copyright 1999,2005 The Apache Software Foundation. |
|
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 | package org.apache.xmlrpc.server; |
|
17 | ||
18 | import org.apache.xmlrpc.XmlRpcConfig; |
|
19 | import org.apache.xmlrpc.XmlRpcException; |
|
20 | import org.apache.xmlrpc.XmlRpcRequest; |
|
21 | import org.apache.xmlrpc.common.XmlRpcController; |
|
22 | import org.apache.xmlrpc.common.XmlRpcWorkerFactory; |
|
23 | ||
24 | ||
25 | /** A multithreaded, reusable XML-RPC server object. The name may |
|
26 | * be misleading because this does not open any server sockets. |
|
27 | * Instead it is fed by passing instances of |
|
28 | * {@link org.apache.xmlrpc.XmlRpcRequest} from |
|
29 | * a transport. |
|
30 | */ |
|
31 | 632 | public class XmlRpcServer extends XmlRpcController { |
32 | private XmlRpcHandlerMapping handlerMapping; |
|
33 | 316 | private XmlRpcServerConfig config = new XmlRpcServerConfigImpl(); |
34 | ||
35 | protected XmlRpcWorkerFactory getDefaultXmlRpcWorkerFactory() { |
|
36 | 316 | return new XmlRpcServerWorkerFactory(this); |
37 | } |
|
38 | ||
39 | /** Sets the servers configuration. |
|
40 | * @param pConfig The new server configuration. |
|
41 | */ |
|
42 | 0 | public void setConfig(XmlRpcServerConfig pConfig) { config = pConfig; } |
43 | 399 | public XmlRpcConfig getConfig() { return config; } |
44 | ||
45 | /** Sets the servers handler mapping. |
|
46 | * @param pMapping The servers handler mapping. |
|
47 | */ |
|
48 | public void setHandlerMapping(XmlRpcHandlerMapping pMapping) { |
|
49 | 294 | handlerMapping = pMapping; |
50 | 294 | } |
51 | ||
52 | /** Returns the servers handler mapping. |
|
53 | * @return The servers handler mapping. |
|
54 | */ |
|
55 | public XmlRpcHandlerMapping getHandlerMapping() { |
|
56 | 315 | return handlerMapping; |
57 | } |
|
58 | ||
59 | /** Performs the given request. |
|
60 | * @param pRequest The request being executed. |
|
61 | * @return The result object. |
|
62 | * @throws XmlRpcException The request failed. |
|
63 | */ |
|
64 | public Object execute(XmlRpcRequest pRequest) throws XmlRpcException { |
|
65 | 315 | return getWorkerFactory().getWorker().execute(pRequest); |
66 | } |
|
67 | } |