def __init__(self, port, debug=False): # HTTP server declaration self.server = HttpServer.create(InetSocketAddress(int(port)), 0) self.server.createContext("/cmd", self.MyHandler(self)).getFilters().add( self.ParameterParser()) self.server.setExecutor(None) self.server.start() logger.info("SlaveHttp - Server is listening on port %d" % (int(port))) self.token = HttpToken(10) self.sleeperQueue = SetQueue()
def __init__(self, initStr, debug=False): try: tps,port = initStr.split(',') except: logger.error( 'Invalid - format : <tps>,<port>') raise self.set(tps) # HTTP server declaration self.server = HttpServer.create(InetSocketAddress(int(port)), 0); self.server.createContext("/cmd", self.MyHandler(self)).getFilters().add(self.ParameterParser()) self.server.setExecutor(None) self.server.start() logger.info("HttpCadencer - Server is listening on port %d" % (port))
def __init__(self): """ generated source for method __init__ """ super(LocalGameRepository, self).__init__() with lock_for_object(LocalGameRepository.__class__): if self.theLocalRepoServer == None: try: self.theLocalRepoServer = HttpServer.create(InetSocketAddress(self.REPO_SERVER_PORT), 0) self.theLocalRepoServer.createContext("/", LocalRepoServer()) self.theLocalRepoServer.setExecutor(None) # creates a default executor self.theLocalRepoServer.start() except IOException as e: raise RuntimeException(e) self.theRealRepo = RemoteGameRepository(self.theLocalRepoURL)
def start(cls): try: inetSocketAddress = InetSocketAddress(cls.host, cls.port) cls.httpServer = HttpServer.create(inetSocketAddress, cls.socketBackLog) cls.httpServer.createContext("/callback", CallbackHandler()) cls.httpServer.createContext("/start", StartHandler()) cls.httpServer.setExecutor( Executors.newFixedThreadPool(cls.poolsize)) cls.httpServer.start() logger.info("HTTPServerCallback is listening on %s %s" % (cls.host, cls.port)) except IOException, e: logger.error('(start) %s : stacktrace=%s' % (cls.__name__, e)) raise UnboundLocalError('(start) %s : stacktrace=%s' % (cls.__name__, e))
def __init__(self, port, request_handler): """ Initialize and start an HTTP server. Uses a native HTTP server implementation, in this case the com.sun.net.httpserver.HttpServer. @param port: The port on which the server should listen. @type port: int @param request_handler: The request handler class from our generic code. @type request_handler: Any class with a 'handle()' method that can take a RestxHttpRequest. In our case, this is normally the RequestDispatcher class. """ self.request_handler = request_handler self.__native_server = HttpServer.create(InetSocketAddress(port), 5) self.__native_server.createContext(settings.DOCUMENT_ROOT if settings.DOCUMENT_ROOT != "" else "/", __HttpHandler(request_handler)) self.__native_server.setExecutor(Executors.newCachedThreadPool()) self.__native_server.start() log("Listening for HTTP requests on port %d..." % port)
def __init__(self, port, request_handler): """ Initialize and start an HTTP server. Uses a native HTTP server implementation, in this case the com.sun.net.httpserver.HttpServer. @param port: The port on which the server should listen. @type port: int @param request_handler: The request handler class from our generic code. @type request_handler: Any class with a 'handle()' method that can take a RestxHttpRequest. In our case, this is normally the RequestDispatcher class. """ self.request_handler = request_handler self.__native_server = HttpServer.create(InetSocketAddress(port), 5) self.__native_server.createContext( settings.DOCUMENT_ROOT if settings.DOCUMENT_ROOT != "" else "/", __HttpHandler(request_handler)) self.__native_server.setExecutor(Executors.newCachedThreadPool()) self.__native_server.start() log("Listening for HTTP requests on port %d..." % port)