当前位置: 首页>>代码示例>>Java>>正文


Java RequestLine.getUri方法代码示例

本文整理汇总了Java中org.apache.http.RequestLine.getUri方法的典型用法代码示例。如果您正苦于以下问题:Java RequestLine.getUri方法的具体用法?Java RequestLine.getUri怎么用?Java RequestLine.getUri使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在org.apache.http.RequestLine的用法示例。


在下文中一共展示了RequestLine.getUri方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: RequestWrapper

import org.apache.http.RequestLine; //导入方法依赖的package包/类
public RequestWrapper(final HttpRequest request) throws ProtocolException {
    super();
    if (request == null) {
        throw new IllegalArgumentException("HTTP request may not be null");
    }
    this.original = request;
    setParams(request.getParams());
    setHeaders(request.getAllHeaders());
    // Make a copy of the original URI
    if (request instanceof HttpUriRequest) {
        this.uri = ((HttpUriRequest) request).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;
}
 
开发者ID:lamsfoundation,项目名称:lams,代码行数:27,代码来源:RequestWrapper.java

示例2: doFormatRequestLine

import org.apache.http.RequestLine; //导入方法依赖的package包/类
/**
 * Actually formats a request line.
 * Called from {@link #formatRequestLine}.
 *
 * @param buffer    the empty buffer into which to format,
 *                  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());
}
 
开发者ID:lamsfoundation,项目名称:lams,代码行数:25,代码来源:BasicLineFormatter.java

示例3: doFormatRequestLine

import org.apache.http.RequestLine; //导入方法依赖的package包/类
/**
 * Actually formats a request line.
 * Called from {@link #formatRequestLine}.
 *
 * @param buffer    the empty buffer into which to format,
 *                  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"
    final 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());
}
 
开发者ID:xxonehjh,项目名称:remote-files-sync,代码行数:25,代码来源:BasicLineFormatterHC4.java

示例4: RequestWrapper

import org.apache.http.RequestLine; //导入方法依赖的package包/类
public RequestWrapper(final HttpRequest request) throws ProtocolException {
    super();
    Args.notNull(request, "HTTP request");
    this.original = request;
    setParams(request.getParams());
    setHeaders(request.getAllHeaders());
    // Make a copy of the original URI
    if (request instanceof HttpUriRequest) {
        this.uri = ((HttpUriRequest) request).getURI();
        this.method = ((HttpUriRequest) request).getMethod();
        this.version = null;
    } else {
        final RequestLine requestLine = request.getRequestLine();
        try {
            this.uri = new URI(requestLine.getUri());
        } catch (final URISyntaxException ex) {
            throw new ProtocolException("Invalid request URI: "
                    + requestLine.getUri(), ex);
        }
        this.method = requestLine.getMethod();
        this.version = request.getProtocolVersion();
    }
    this.execCount = 0;
}
 
开发者ID:MyPureCloud,项目名称:purecloud-iot,代码行数:25,代码来源:RequestWrapper.java

示例5: RequestWrapper

import org.apache.http.RequestLine; //导入方法依赖的package包/类
public RequestWrapper(final HttpRequest request) throws ProtocolException {
    super();
    if (request == null) {
        throw new IllegalArgumentException("HTTP request may not be null");
    }
    this.original = request;
    setParams(request.getParams());
    // Make a copy of the original URI 
    if (request instanceof HttpUriRequest) {
        this.uri = ((HttpUriRequest) request).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;
}
 
开发者ID:tdopires,项目名称:cJUnit-mc626,代码行数:26,代码来源:RequestWrapper.java

示例6: authenticate

import org.apache.http.RequestLine; //导入方法依赖的package包/类
public Header authenticate(Credentials credentials, HttpRequest request)
		throws AuthenticationException {
	String uri;
	String method;
	HttpUriRequest uriRequest = getHttpUriRequest(request);
	if (uriRequest != null) {
		uri = uriRequest.getURI().toString();
		method = uriRequest.getMethod();
	} else {
		// Some requests don't include the server name in the URL.
		RequestLine requestLine = request.getRequestLine();
		uri = requestLine.getUri();
		method = requestLine.getMethod();
	}
	try {
		OAuthMessage message = new OAuthMessage(method, uri, null);
		OAuthAccessor accessor = getAccessor(credentials);
		message.addRequiredParameters(accessor);
		String authorization = message.getAuthorizationHeader(getRealm());
		return new BasicHeader("Authorization", authorization);
	} catch (Exception e) {
		throw new AuthenticationException(null, e);
	}
}
 
开发者ID:Simbacode,项目名称:mobipayments,代码行数:25,代码来源:OAuthScheme.java

示例7: authenticate

import org.apache.http.RequestLine; //导入方法依赖的package包/类
public Header authenticate(Credentials credentials, HttpRequest request) throws AuthenticationException {
    String uri;
    String method;
    HttpUriRequest uriRequest = getHttpUriRequest(request);
    if (uriRequest != null) {
        uri = uriRequest.getURI().toString();
        method = uriRequest.getMethod();
    } else {
        // Some requests don't include the server name in the URL.
        RequestLine requestLine = request.getRequestLine();
        uri = requestLine.getUri();
        method = requestLine.getMethod();
    }
    try {
        OAuthMessage message = new OAuthMessage(method, uri, null);
        OAuthAccessor accessor = getAccessor(credentials);
        message.addRequiredParameters(accessor);
        String authorization = message.getAuthorizationHeader(getRealm());
        return new BasicHeader("Authorization", authorization);
    } catch (Exception e) {
        throw new AuthenticationException(null, e);
    }
}
 
开发者ID:groovenauts,项目名称:jmeter_oauth_plugin,代码行数:24,代码来源:OAuthScheme.java

示例8: BasicHttpRequest

import org.apache.http.RequestLine; //导入方法依赖的package包/类
/**
 * Creates an instance of this class using the given request line.
 *
 * @param requestline request line.
 */
public BasicHttpRequest(final RequestLine requestline) {
    super();
    if (requestline == null) {
        throw new IllegalArgumentException("Request line may not be null");
    }
    this.requestline = requestline;
    this.method = requestline.getMethod();
    this.uri = requestline.getUri();
}
 
开发者ID:lamsfoundation,项目名称:lams,代码行数:15,代码来源:BasicHttpRequest.java

示例9: getSubspanSpanName

import org.apache.http.RequestLine; //导入方法依赖的package包/类
/**
 * Returns the name that should be used for the subspan surrounding the given request. This method returns {@code
 * apachehttpclient_downstream_call-[HTTP_METHOD]_[REQUEST_URI]} with any query string stripped, e.g. for a GET
 * call to https://foo.bar/baz?stuff=things, this would return {@code
 * "apachehttpclient_downstream_call-GET_https://foo.bar/baz"}.
 *
 * @param request The request that is about to be executed.
 * @return The name that should be used for the subspan surrounding the request.
 */
public static String getSubspanSpanName(HttpRequest request) {
    RequestLine requestLine = request.getRequestLine();
    String uri = requestLine.getUri();

    if (request instanceof HttpRequestWrapper && uri.startsWith("/")) {
        HttpRequestWrapper wrapper = (HttpRequestWrapper) request;
        uri = wrapper.getTarget().toURI() + uri;
    }

    return HttpRequestTracingUtils.getSubspanSpanNameForHttpRequest(
        "apachehttpclient_downstream_call", requestLine.getMethod(), uri
    );
}
 
开发者ID:Nike-Inc,项目名称:wingtips,代码行数:23,代码来源:WingtipsApacheHttpClientUtil.java

示例10: newHttpRequest

import org.apache.http.RequestLine; //导入方法依赖的package包/类
public HttpRequest newHttpRequest(final RequestLine requestline)
        throws MethodNotSupportedException {
    if (requestline == null) {
        throw new IllegalArgumentException("Request line may not be null");
    }
    String method = requestline.getMethod();
    String uri = requestline.getUri();
    return newHttpRequest(method, uri);
}
 
开发者ID:offbye,项目名称:DroidDLNA,代码行数:10,代码来源:UpnpHttpRequestFactory.java

示例11: HttpRequestParcel

import org.apache.http.RequestLine; //导入方法依赖的package包/类
public HttpRequestParcel(HttpUriRequest request){
	RequestLine line = request.getRequestLine();
	uri = line.getUri();
	method = line.getMethod();
	headers = new Bundle();
	for(Header header:request.getAllHeaders()){
		headers.putString(header.getName(), header.getValue());
	}
	params = new Bundle();
	entity = null;
	files = new Bundle();
}
 
开发者ID:SanaMobile,项目名称:sana.mobile,代码行数:13,代码来源:HttpRequestParcel.java

示例12: newHttpRequest

import org.apache.http.RequestLine; //导入方法依赖的package包/类
@Override
public HttpRequest newHttpRequest(RequestLine requestLine)
		throws MethodNotSupportedException {
	String method = requestLine.getMethod();
	String uri = requestLine.getUri();
	return this.newHttpRequest(method, uri);
}
 
开发者ID:SanaMobile,项目名称:sana.mobile,代码行数:8,代码来源:DispatchRequestFactory.java

示例13: getUri

import org.apache.http.RequestLine; //导入方法依赖的package包/类
private static String getUri(RequestLine requestLine) {
    if (requestLine.getUri().charAt(0) != '/') {
        return "/" + requestLine.getUri();
    }
    return requestLine.getUri();
}
 
开发者ID:justor,项目名称:elasticsearch_my,代码行数:7,代码来源:RequestLogger.java

示例14: getHttpMessage

import org.apache.http.RequestLine; //导入方法依赖的package包/类
private HttpMessage getHttpMessage(final byte[] data) {
    final HttpParams httpParams = new BasicHttpParams();
    final AbstractSessionInputBuffer inputBuffer = new AbstractSessionInputBuffer() {
        {
            init(new ByteArrayInputStream(data), 128, httpParams);
        }

        @Override
        public boolean isDataAvailable(int i) throws IOException {
            return this.hasBufferedData();
        }
    };
    final HttpRequestFactory msearchRequestFactory = new HttpRequestFactory() {
        @Override
        public HttpRequest newHttpRequest(RequestLine requestLine) throws MethodNotSupportedException {
            if (!requestLine.getMethod().equalsIgnoreCase("m-search"))
                throw new MethodNotSupportedException("Invalid method: " + requestLine.getMethod());
            if (!requestLine.getUri().equals("*"))
                throw new MethodNotSupportedException("Invalid URI: " + requestLine.getUri());

            return new BasicHttpRequest(requestLine);
        }

        @Override
        public HttpRequest newHttpRequest(String method, String uri) throws MethodNotSupportedException {
            if (!method.equalsIgnoreCase("m-search"))
                throw new MethodNotSupportedException("Invalid method: " + method);
            if (!uri.equals("*"))
                throw new MethodNotSupportedException("Invalid URI: " + uri);

            return new BasicHttpRequest(method, uri);
        }
    };

    HttpRequestParser requestParser = new HttpRequestParser(inputBuffer, null, msearchRequestFactory, httpParams);
    try {
        return requestParser.parse();
    } catch (Exception e) {
        e.printStackTrace();
    }
    return null;
}
 
开发者ID:arktronic,项目名称:cameraserve,代码行数:43,代码来源:SsdpAdvertiser.java

示例15: newHttpRequest

import org.apache.http.RequestLine; //导入方法依赖的package包/类
public HttpRequest newHttpRequest(RequestLine requestLine)
		throws MethodNotSupportedException {
	String method = requestLine.getMethod();
	String uri = requestLine.getUri();
	return newHttpRequest(method, uri);
}
 
开发者ID:SanaMobile,项目名称:sana.mobile,代码行数:7,代码来源:HttpRequestBuilder.java


注:本文中的org.apache.http.RequestLine.getUri方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。