org.apache.http.client.HttpClient
은 대상 호스트와 요청 매개 변수를 취하는 execute
메서드를 지정합니다.HttpClient가 지나치게 지정된 경로를 어떻게 처리합니까?
/**
* Executes a request to the target using the default context.
*
* @param target the target host for the request.
* Implementations may accept <code>null</code>
* if they can still determine a route, for example
* to a default target or by inspecting the request.
* @param request the request to execute
*
* @return the response to the request. This is always a final response,
* never an intermediate response with an 1xx status code.
* Whether redirects or authentication challenges will be returned
* or handled automatically depends on the implementation and
* configuration of this client.
* @throws IOException in case of a problem or the connection was aborted
* @throws ClientProtocolException in case of an http protocol error
*/
HttpResponse execute(HttpHost target, HttpRequest request)
throws IOException, ClientProtocolException;
나는 DefaultHttpClient
및 DefaultRequestDirector
소스 코드에 탐구 한, 그것은 간단한 execute(HttpRequest request)
방법은 HttpHost 객체에 요청하고 HttpRequest에 객체를 분리하고 실제로 (더 지정된 메소드에 호출을 전달 명백하게되었다 , HttpContext
개체도 허용하는 -하지만 지금은 상황에 신경 쓰지 않습니다.)
요청 및 호스트 모두 URI를 허용 할 수 있으므로 내 최종 질문은 어떻게 결정됩니까? 둘 다 절대 URI가 포함되어 있습니까? 충돌하는 경우? 둘 다 부분 경로가 있습니까?
감사합니다. 내가 그랬 으면 좋겠다. 그리고 편집에서 언급 된 관련'Http ... '클래스들을 조금 더 파고 들자면, 나는 당신의 설명이 항상 사실이라고 확신한다. 적어도 DefaultHttpClient 클래스는 . –