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

This code example shows how to use the following methods:getMethod, getUri
    private ChatSession mChatSession;
 
    private DataListener mDataListener;
 
    public OtrDataHandler(ChatSession chatSession, DataListener dataListener) {
        this.mChatSession = chatSession;
        this.mDataListener = dataListener;
    } 
 
    public static class MyHttpRequestFactory implements HttpRequestFactory {
        public MyHttpRequestFactory() { 
            super(); 
        } 
 
        public HttpRequest newHttpRequest(final RequestLine requestline)
                throws MethodNotSupportedException { 
            if (requestline == null) {
                throw new IllegalArgumentException("Request line may not be null");
            } 
            //String method = requestline.getMethod(); 
7
CodeRank
Connect your IDE to all the code out there  Get Codota for Java
This code example shows how to use the following methods:getMethod, getProtocolVersion, getUri

6
CodeRank
Connect your IDE to all the code out there  Get Codota for Java
This code example shows how to use the following methods:getMethod, getProtocolVersion, getUri
 
        HttpRequest httprequest = (HttpRequest) parser.parse();
 
        RequestLine reqline = httprequest.getRequestLine();
        assertNotNull(reqline);
        assertEquals("GET", reqline.getMethod());
        assertEquals("/", reqline.getUri());
        assertEquals(HttpVersion.HTTP_1_1, reqline.getProtocolVersion());
        Header[] headers = httprequest.getAllHeaders();
        assertEquals(3, headers.length);
    } 
 
    public void testConnectionClosedException() throws Exception { 
        SessionInputBuffer inbuffer = new SessionInputBufferMockup(new byte[] {});
 
        HttpRequestParser parser = new HttpRequestParser(
                inbuffer,
                BasicLineParser.DEFAULT,
                new DefaultHttpRequestFactory(),
                new BasicHttpParams());
6
CodeRank
Connect your IDE to all the code out there  Get Codota for Java
This code example shows how to use the following methods:getMethod, getUri
     * 
     * @param requestline request line. 
     */ 
    public BasicHttpRequest(final RequestLine requestline) {
        super(); 
        this.requestline = Args.notNull(requestline, "Request line");
        this.method = requestline.getMethod();
        this.uri = requestline.getUri();
    } 
 
    /** 
     * Returns the HTTP protocol version to be used for this request. 
     * 
     * @see #BasicHttpRequest(String, String) 
     */ 
    public ProtocolVersion getProtocolVersion() {
        return getRequestLine().getProtocolVersion();
    } 
 
    /** 
6
CodeRank
Connect your IDE to all the code out there  Get Codota for Java
This code example shows how to use the following methods:getMethod, getProtocolVersion, getUri
     *                  never <code>null</code> 
     * @param reqline   the request line to format, never <code>null</code> 
     */ 
    protected void doFormatRequestLine(final CharArrayBuffer buffer,
                                       final RequestLine reqline) {
        final String method = reqline.getMethod();
        final String uri    = reqline.getUri();
 
        // room for "GET /index.html HTTP/1.1" 
        int len = method.length() + 1 + uri.length() + 1 +
            estimateProtocolVersionLen(reqline.getProtocolVersion());
        buffer.ensureCapacity(len);
 
        buffer.append(method);
        buffer.append(' ');
        buffer.append(uri);
        buffer.append(' ');
        appendProtocolVersion(buffer, reqline.getProtocolVersion());
    } 
 

6
CodeRank
Connect your IDE to all the code out there  Get Codota for Java
This code example shows how to use the following methods:getMethod, getProtocolVersion, getUri
                l1, l2));
    } 
 
    /* Assert.asserts that the components of two request lines match. */ 
    public static boolean equivalent(RequestLine l1, RequestLine l2) {
        return (l1.getMethod().equals(l2.getMethod())
                && l1.getProtocolVersion().equals(l2.getProtocolVersion()) && l1.getUri().equals(
                        l2.getUri()));
    } 
 
    /* 
     * Retrieves the full header value by combining multiple headers and 
     * separating with commas, canonicalizing whitespace along the way. 
     * 
     * @see http://www.w3.org/Protocols/rfc2616/rfc2616-sec4.html#sec4.2 
     */ 
    public static String getCanonicalHeaderValue(HttpMessage r, String name) {
        if (isSingleHeader(name)) {
            Header h = r.getFirstHeader(name);
            return (h != null) ? h.getValue() : null;
5
CodeRank
Connect your IDE to all the code out there  Get Codota for Java
This code example shows how to use the following methods:getUri
            } 
        } 
 
        private boolean isShutdownRequest(HttpRequest request) {
            RequestLine requestLine = request.getRequestLine();
            String uriString = requestLine.getUri();
            URI uri = URI.create(uriString);
            String path = uri.getPath();
            return path.equals(SHUTDOWN_PREFIX);
        } 
    } 
} 
4
CodeRank
Connect your IDE to all the code out there  Get Codota for Java
This code example shows how to use the following methods:getMethod, getUri
            this.method = ((HttpUriRequest) request).getMethod();
            this.version = null;
        } else { 
            RequestLine requestLine = request.getRequestLine();
            try { 
                this.uri = new URI(requestLine.getUri());
            } catch (URISyntaxException ex) {
                throw new ProtocolException("Invalid request URI: " 
                        + requestLine.getUri(), ex);
            } 
            this.method = requestLine.getMethod();
            this.version = request.getProtocolVersion();
        } 
        this.execCount = 0;
    } 
 
    public void resetHeaders() { 
        // Make a copy of original headers 
        this.headergroup.clear();
        setHeaders(this.original.getAllHeaders());
4
CodeRank
Connect your IDE to all the code out there  Get Codota for Java
This code example shows how to use the following methods:getMethod
			  throws HttpException, IOException 
			{ 
				RequestLine reqLine = request.getRequestLine(); 
				Log.v(TAG, "reqLine=" + reqLine); 
 
				String method = reqLine.getMethod().toUpperCase(Locale.ENGLISH); 
				if (method.equals("GET") == false) 
				{ 
					throw new MethodNotSupportedException(method + 
					  " method not supported"); 
				} 
 
				RandomAccessStream stream = mStream.newInstance(); 
 
				/* Side-effect: will open the stream, so we can seek if 
				 * necessary. */ 
				RandomAccessStreamEntity ent = 
				  new RandomAccessStreamEntity(stream); 
 
				interpretRangeThenSeek(request, stream); 
4
CodeRank
Connect your IDE to all the code out there  Get Codota for Java
This code example shows how to use the following methods:getMethod
			  throws HttpException, IOException 
			{ 
				RequestLine reqLine = request.getRequestLine(); 
				Log.v(TAG, "reqLine=" + reqLine); 
 
				String method = reqLine.getMethod().toUpperCase(Locale.ENGLISH); 
				if (method.equals("GET") == false) 
				{ 
					throw new MethodNotSupportedException(method + 
					  " method not supported"); 
				} 
 
				response.setEntity(new MyBoilerPlateEntity()); 
				response.setStatusCode(HttpStatus.SC_OK); 
			} 
		}; 
 
		public static class MyBoilerPlateEntity extends EntityTemplate
		{ 
			public MyBoilerPlateEntity() 
4
CodeRank
Connect your IDE to all the code out there  Get Codota for Java

Related Android RequestLine Questions & Answers:

See Code Examples for Android RequestLine Methods: