I am setting up a HttpClient object (DefaultHttpClient to be precise) and then using this HttpClient object to make Http requests using the execute(HttpUriRequest request) method, which “executes a (Http) request using the default context”.
Firstly, is it possible in any way to get hold of this context (HttpContext object I’m guessing)?
Secondly, is it possible to extract information from this context in a manner similar to the calls below?
HttpContext.Current.Request.ServerVariables("HTTP_VIA")
HttpContext.Current.Request.ServerVariables("HTTP_X_UP_CALLING_LINE_ID")
You extend DefaultHttpClient and override the createHttpContext() method. You can implement this method by returning a BasicHttpContext, whose reference you can save in your class.