Code example for HttpRequestHandlerRegistry

Methods: register

0
	 * All HttpRequestHandlers added after start() will be ignored 
	 * @param pattern Patterns may have three formats: * or *<uri> or <uri>* 
	 * @param handler A request handler 
	 */  
	public void addRequestHandler(String pattern, HttpRequestHandler handler) {
		registry.register(pattern, handler);
	} 
 
	public void start() throws IOException { 
		if (running) return;
		requestListenerThread = new RequestListenerThread(port, registry);
		requestListenerThread.start();
		running = true;
	} 
 
	public void stop() { 
		if (!running) return;
		try { 
			requestListenerThread.serversocket.close();
			requestListenerThread = null;
		} catch (Exception e) {