Android HttpService - top ranked examples from Open Source projects

These code examples were ranked by Codota’s semantic indexing as the best open source examples for Android HttpService class.

This code example shows how to use the following methods:setHandlerResolver, setParams
            // Set up request handlers 
            HttpRequestHandlerRegistry reqistry = new HttpRequestHandlerRegistry();
            reqistry.register("*", new HttpFileHandler(docroot));
 
            // Set up the HTTP service 
            this.httpService = new HttpService(httpproc, new NoConnectionReuseStrategy(), new DefaultHttpResponseFactory());
            this.httpService.setParams(this.params);
            this.httpService.setHandlerResolver(reqistry);
        } 
 
        public void run() { 
            System.out.println("Listening on port " + this.serversocket.getLocalPort());
            System.out.println("Point your browser to http://localhost:8088/tutorial/js/tutorial.html");
             
            while (!Thread.interrupted()) {
                try { 
                    // Set up HTTP connection 
                    Socket socket = this.serversocket.accept();
                    DefaultHttpServerConnection conn = new DefaultHttpServerConnection();
                    System.out.println("Incoming connection from " + socket.getInetAddress());
6
CodeRank
This code example shows how to use the following methods:setHandlerResolver
This code example shows how to use the following methods:setHandlerResolver, setParams
            // Set up request handlers 
            HttpRequestHandlerRegistry reqistry = new HttpRequestHandlerRegistry();
            reqistry.register("*", new HttpFileHandler(docroot));
 
            // Set up the HTTP service 
            this.httpService = new HttpService(httpproc, new NoConnectionReuseStrategy(), new DefaultHttpResponseFactory());
            this.httpService.setParams(this.params);
            this.httpService.setHandlerResolver(reqistry);
        } 
 
        public void run() { 
            System.out.println("Listening on port " + this.serversocket.getLocalPort());
            System.out.println("Point your browser to http://localhost:8088/test/test.html");
             
            while (!Thread.interrupted()) {
                try { 
                    // Set up HTTP connection 
                    Socket socket = this.serversocket.accept();
                    DefaultHttpServerConnection conn = new DefaultHttpServerConnection();
                    System.out.println("Incoming connection from " + socket.getInetAddress());
5
CodeRank
This code example shows how to use the following methods:setHandlerResolver, setParams
			HttpRequestHandlerRegistry reqistry = new HttpRequestHandlerRegistry();
			reqistry.register( "*", new HttpFileHandler( docroot ) );
 
			// Set up the HTTP service 
			this.httpService = new HttpService( httpproc, new DefaultConnectionReuseStrategy(),
					new DefaultHttpResponseFactory() );
			this.httpService.setParams( this.params );
			this.httpService.setHandlerResolver( reqistry );
		} 
 
 
		public void run() 
		{ 
			System.out.println( "Listening on port " + this.serversocket.getLocalPort() );
			while (!Thread.interrupted())
			{ 
				try 
				{ 
					// Set up HTTP connection 
					Socket socket = this.serversocket.accept();
5
CodeRank
This code example shows how to use the following methods:setHandlerResolver, setParams
			HttpRequestHandlerRegistry reqistry = new HttpRequestHandlerRegistry();
			reqistry.register( "*", new HttpFileHandler( docroot ) );
 
			// Set up the HTTP service 
			this.httpService = new HttpService( httpproc, new DefaultConnectionReuseStrategy(),
					new DefaultHttpResponseFactory() );
			this.httpService.setParams( this.params );
			this.httpService.setHandlerResolver( reqistry );
		} 
 
 
		public void run() 
		{ 
			System.out.println( "Listening on port " + this.serversocket.getLocalPort() );
			while (!Thread.interrupted())
			{ 
				try 
				{ 
					// Set up HTTP connection 
					Socket socket = this.serversocket.accept();
5
CodeRank
This code example shows how to use the following methods:setHandlerResolver, setParams
                    // Start worker thread 
                    Thread t = new WorkerThread(this.httpService, conn);
                    t.setDaemon(true);
                    t.start();
                } catch (InterruptedIOException ex) {
                    break; 
                } catch (IOException e) {
                    System.err.println("I/O error initialising connection thread: " + e.getMessage());
                    break; 
                } 
            } 
        } 
    } 
 
    static class WorkerThread extends Thread {
 
        private final HttpService httpservice;
        private final HttpServerConnection conn;
 
        public WorkerThread(final HttpService httpservice, final HttpServerConnection conn) {
5
CodeRank
This code example shows how to use the following methods:setHandlerResolver, setParams
            // Set up request handlers 
            HttpRequestHandlerRegistry reqistry = new HttpRequestHandlerRegistry();
            reqistry.register("*", new HttpFileHandler(docroot));
 
            // Set up the HTTP service 
            this.httpService = new HttpService(httpproc, new NoConnectionReuseStrategy(), new DefaultHttpResponseFactory());
            this.httpService.setParams(this.params);
            this.httpService.setHandlerResolver(reqistry);
        } 
 
        public void run() { 
            System.out.println("Listening on port " + this.serversocket.getLocalPort());
            System.out.println("Point your browser to http://localhost:8088/tutorial/js/tutorial.html");
             
            while (!Thread.interrupted()) {
                try { 
                    // Set up HTTP connection 
                    Socket socket = this.serversocket.accept();
                    DefaultHttpServerConnection conn = new DefaultHttpServerConnection();
                    System.out.println("Incoming connection from " + socket.getInetAddress());
5
CodeRank
This code example shows how to use the following methods:setHandlerResolver
        httpProcessor.addInterceptor(new ResponseContent());
        httpProcessor.addInterceptor(new ResponseConnControl());
 
        HttpRequestHandlerRegistry registry = new HttpRequestHandlerRegistry();
 
        this.httpService = new HttpService(httpProcessor, new DefaultConnectionReuseStrategy(), new DefaultHttpResponseFactory());
        this.httpService.setHandlerResolver(registry);
 
        registry.register(ALL_PATTERN, new HomePageHandler(context));
        registry.register(ENDPOINT_PATTERN, new EndpointHandler(context, notificationSenderService));
        Log.i("SMS-SERVER", "Http server is ready to start");
    } 
 
 
    @Override 
    public void run() { 
        try { 
            Log.i("SMS-SERVER", "starting http server");
            ServerSocket serverSocket = new ServerSocket(this.serverPort);
 
4
CodeRank
This code example shows how to use the following methods:setHandlerResolver
This code example shows how to use the following methods:setHandlerResolver
See Code Examples for Android HttpService Methods: