Android DefaultHttpResponseFactory - 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 DefaultHttpResponseFactory class.

This code example shows how to use the following methods:
                new ResponseDate(),
                new ResponseServer(),
                new ResponseContent(),
                new ResponseConnControl()
        }); 
        BufferingHttpServiceHandler serviceHandler = new BufferingHttpServiceHandler(
                httpproc,
                new DefaultHttpResponseFactory(),
                new DefaultConnectionReuseStrategy(),
                this.server.getParams());
 
        serviceHandler.setHandlerResolver(
                new SimpleHttpRequestHandlerResolver(requestHandler));
        serviceHandler.setExpectationVerifier(expectationVerifier);
        serviceHandler.setEventListener(eventListener);
 
        return serviceHandler;
    } 
 
    private TrustManagerFactory createTrustManagerFactory() throws NoSuchAlgorithmException {
5
CodeRank
This code example shows how to use the following methods:
 
            // Set up the HTTP service 
            this.httpService = new HttpService(
                    inhttpproc,
                    new DefaultConnectionReuseStrategy(),
                    new DefaultHttpResponseFactory(),
                    reqistry,
                    this.params);
        } 
 
        @Override 
        public void run() { 
            System.out.println("Listening on port " + this.serversocket.getLocalPort());
            while (!Thread.interrupted()) {
                try { 
                    // Set up incoming HTTP connection 
                    Socket insocket = this.serversocket.accept();
                    DefaultHttpServerConnection inconn = new DefaultHttpServerConnection();
                    System.out.println("Incoming connection from " + insocket.getInetAddress());
                    inconn.bind(insocket, this.params);
3
CodeRank
This code example shows how to use the following methods:
			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();
3
CodeRank
This code example shows how to use the following methods:
                    // 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) {
3
CodeRank
This code example shows how to use the following methods:
            // 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());
3
CodeRank
This code example shows how to use the following methods:
			// Set up request handlers 
			HttpRequestHandlerRegistry reqistry = new HttpRequestHandlerRegistry();
			reqistry.register( "*", new HttpFileHandler( docroot ) );
 
			// Set up the HTTP service 
			this.httpService = new HttpService( httpproc, new DefaultConnectionReuseStrategy(), new DefaultHttpResponseFactory(),
					reqistry, this.params );
		} 
 
 
		@Override 
		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();
4
CodeRank
This code example shows how to use the following methods:
 
            // Set up the HTTP service 
            this.httpService = new HttpService(
                    httpproc,
                    new DefaultConnectionReuseStrategy(),
                    new DefaultHttpResponseFactory());
            this.httpService.setParams(this.params);
            this.httpService.setHandlerResolver(reqistry);
 
            workers = new ArrayList<Worker>();
        } 
 
        @Override 
        public void run() { 
            running = new AtomicBoolean(true);
 
            while (running.get()) {
                try { 
                    // Set up HTTP connection 
                    Socket socket = this.serversocket.accept();
4
CodeRank
This code example shows how to use the following methods:
This code example shows how to use the following methods:
    } 
 
    public void testParsingInvalidStatusLine() throws Exception { 
        HttpParams params = new BasicHttpParams();
        SessionInputBuffer inbuf = new SessionInputBufferImpl(1024, 128, params);
        HttpResponseFactory responseFactory = new DefaultHttpResponseFactory();
        NHttpMessageParser<HttpResponse> responseParser = new DefaultHttpResponseParser(inbuf, null, responseFactory, params);
 
        ReadableByteChannel channel = newChannel("HTTP 200 OK\r\n");
        responseParser.fillBuffer(channel);
        try { 
            responseParser.parse();
            fail("HttpException should have been thrown");
        } catch (HttpException ex) {
            // expected 
        } 
    } 
 
    public void testParsingInvalidHeader() throws Exception { 
        HttpParams params = new BasicHttpParams();
5
CodeRank
This code example shows how to use the following methods:
See Code Examples for Android DefaultHttpResponseFactory Methods: