Code example for BasicHttpContext

Methods: setAttribute

	 * web requests. The returned context will have a cookie store 
	 * attached for persisting cookies created during the request. 
	 * @return {@link HttpContext} for use with web requests. 
	protected HttpContext getRequestContext() {
		HttpContext context = new BasicHttpContext();
		CookieStore cookieStore = new PreferenceCookieStore(this.getContext());
		context.setAttribute(ClientContext.COOKIE_STORE, cookieStore);
		return context;
	 * Gets the user agent string for use with tasks that make web requests. 
	 * By default this returns the application name and version code. 
	 * @return User agent string for use with web requests. 
	protected String getUserAgent() {
		Context context = this.getContext();
		Assert.assertTrue(context != null);