@Override protected PropertyHandlerMapping newPropertyHandlerMapping(URL url) throws IOException, XmlRpcException { PropertyHandlerMapping phm = new PropertyHandlerMapping() { @Override public XmlRpcHandler getHandler(String pHandlerName) throws XmlRpcNoSuchHandlerException, XmlRpcException { if (!pHandlerName.contains(".")) { return super.getHandler("default." + pHandlerName); } else { return super.getHandler(pHandlerName); } } }; phm.setRequestProcessorFactoryFactory(procfac); phm.addHandler("default", HomeMaticCalls.class); phm.addHandler("system", SystemCalls.class); phm.setVoidMethodEnabled(true); return phm; }
phm.addHandler("WNSim", WNSim.class); phm.addHandler("WordNetPathSim", WordNetPathSim.class); phm.addHandler("WordSim", WordSim.class); phm.addHandler("Paraphrase", Paraphrase.class);
public static void main(String[] args) { if (args.length != 1) System.err.println("Usage: ECServer port"); int port = (new Integer(args[0])).intValue(); try { System.out.println("Attempting to start XML-RPC Server..."); WebServer server = new WebServer(port); XmlRpcServer xmlRpcServer = server.getXmlRpcServer(); PropertyHandlerMapping phm = new PropertyHandlerMapping(); phm.addHandler("EntityComparison", EntityComparison.class); xmlRpcServer.setHandlerMapping(phm); XmlRpcServerConfigImpl serverConfig = (XmlRpcServerConfigImpl)xmlRpcServer.getConfig(); serverConfig.setEnabledForExtensions(true); serverConfig.setContentLengthOptional(false); server.start(); System.out.println("Started successfully."); System.out.println("Accepting requests. (Halt program to stop.)"); } catch (Exception exception) { System.err.println("ECServer: " + exception); } } }
/** * Adds an instance of this class to the given handler * mapping. */ public static void addSystemHandler(final PropertyHandlerMapping pMapping) throws XmlRpcException { final RequestProcessorFactoryFactory factory = pMapping.getRequestProcessorFactoryFactory(); final XmlRpcSystemImpl systemHandler = new XmlRpcSystemImpl(pMapping); pMapping.setRequestProcessorFactoryFactory(new RequestProcessorFactoryFactory(){ public RequestProcessorFactory getRequestProcessorFactory(Class pClass) throws XmlRpcException { if (XmlRpcSystemImpl.class.equals(pClass)) { return new RequestProcessorFactory(){ public Object getRequestProcessor(XmlRpcRequest request) throws XmlRpcException { return systemHandler; } }; } else { return factory.getRequestProcessorFactory(pClass); } } }); pMapping.addHandler("system", XmlRpcSystemImpl.class); } }
/** * Adds an instance of this class to the given handler * mapping. */ public static void addSystemHandler(final PropertyHandlerMapping pMapping) throws XmlRpcException { final RequestProcessorFactoryFactory factory = pMapping.getRequestProcessorFactoryFactory(); final XmlRpcSystemImpl systemHandler = new XmlRpcSystemImpl(pMapping); pMapping.setRequestProcessorFactoryFactory(new RequestProcessorFactoryFactory(){ public RequestProcessorFactory getRequestProcessorFactory(Class pClass) throws XmlRpcException { if (XmlRpcSystemImpl.class.equals(pClass)) { return new RequestProcessorFactory(){ public Object getRequestProcessor(XmlRpcRequest request) throws XmlRpcException { return systemHandler; } }; } else { return factory.getRequestProcessorFactory(pClass); } } }); pMapping.addHandler("system", XmlRpcSystemImpl.class); } }
/** * Adds an instance of this class to the given handler * mapping. */ public static void addSystemHandler(final PropertyHandlerMapping pMapping) throws XmlRpcException { final RequestProcessorFactoryFactory factory = pMapping.getRequestProcessorFactoryFactory(); final XmlRpcSystemImpl systemHandler = new XmlRpcSystemImpl(pMapping); pMapping.setRequestProcessorFactoryFactory(new RequestProcessorFactoryFactory(){ public RequestProcessorFactory getRequestProcessorFactory(Class pClass) throws XmlRpcException { if (XmlRpcSystemImpl.class.equals(pClass)) { return new RequestProcessorFactory(){ public Object getRequestProcessor(XmlRpcRequest request) throws XmlRpcException { return systemHandler; } }; } else { return factory.getRequestProcessorFactory(pClass); } } }); pMapping.addHandler("system", XmlRpcSystemImpl.class); } }
public static void server(String indexDirectory, int port) throws IOException, XmlRpcException { log.info( "Starting descartes server at port {}, with index directory {}", Integer.valueOf(port), indexDirectory); DescartesServer.indexDirectory = indexDirectory; WebServer webServer = new WebServer(port); XmlRpcServer xmlRpcServer = webServer.getXmlRpcServer(); PropertyHandlerMapping phm = new PropertyHandlerMapping(); phm.addHandler("DescartesServer", DescartesServer.class); xmlRpcServer.setHandlerMapping(phm); XmlRpcServerConfigImpl serverConfig = (XmlRpcServerConfigImpl) xmlRpcServer .getConfig(); serverConfig.setEnabledForExtensions(true); serverConfig.setContentLengthOptional(false); webServer.start(); log.info("Descartes is ready!"); }
phm.setRequestProcessorFactoryFactory(new NodeRequestProcessorFactoryFactory<T>(instance)); try { phm.addHandler("", instanceClass); } catch (XmlRpcException e) { throw new RosRuntimeException(e);