01: package com.xoetrope.service;
02:
03: import java.util.Hashtable;
04: import net.xoetrope.optional.service.ServiceContext;
05:
06: import net.xoetrope.optional.service.ServiceProxy;
07: import net.xoetrope.optional.service.ServiceProxyException;
08:
09: /**
10: * A simple http service designed to accept incoming http requests. This is a
11: * dummy service at present and does nothing except forward of the call.
12: *
13: * <p> Copyright (c) Xoetrope Ltd., 2001-2006, This software is licensed under
14: * the GNU Public License (GPL), please see license.txt for more details. If
15: * you make commercial use of this software you must purchase a commercial
16: * license from Xoetrope.</p>
17: * <p> $Revision: 1.6 $</p>
18: */
19: public class XHttpServerServiceProxy extends ServiceProxy {
20: protected boolean urlEncode = true;
21:
22: public XHttpServerServiceProxy() {
23: status = OK;
24: }
25:
26: public void setAttributes(Hashtable attribs) {
27: setUrlEncoding((String) attribs.get("urlEncode"));
28: }
29:
30: public XHttpServerServiceProxy(ServiceProxy sp) {
31: nextProxy = sp;
32: }
33:
34: public void setUrlEncoding(String encode) {
35: if (encode.compareTo("false") == 0)
36: urlEncode = false;
37: else
38: urlEncode = true;
39: }
40:
41: /**
42: * Call this proxy with the specified arguments
43: * @return the result of the call
44: * @param context The ServiceContext contain pass and return parameters
45: * @param method the name of the service being called
46: * @throws net.xoetrope.optional.service.ServiceProxyException Throw an exception if there is a problem with the call
47: */
48: public Object call(String method, ServiceContext context)
49: throws ServiceProxyException {
50: try {
51: status = STARTED;
52: Object res = nextProxy.call(method, context);
53: status = COMPLETE;
54: return res;
55: } catch (ServiceProxyException ex) {
56: status = FAILED;
57: throw (ex);
58: }
59: }
60: }
|