org.apache.http.protocol.BasicHttpContext Java Examples
The following examples show how to use
org.apache.http.protocol.BasicHttpContext.
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: 103335311.java From docs-apim with Apache License 2.0 | 6 votes |
@Override public boolean deleteFromStore(APIIdentifier apiId, APIStore store) throws APIManagementException { boolean deleted = false; if (store.getEndpoint() == null || store.getUsername() == null || store.getPassword() == null) { String msg = "External APIStore endpoint URL or credentials are not defined.Cannot proceed with publishing API to the APIStore - " + store.getDisplayName(); throw new APIManagementException(msg); } else { CookieStore cookieStore = new BasicCookieStore(); HttpContext httpContext = new BasicHttpContext(); httpContext.setAttribute(ClientContext.COOKIE_STORE, cookieStore); boolean authenticated = authenticateAPIM(store,httpContext); if (authenticated) { deleted = deleteWSO2Store(apiId, store.getUsername(), store.getEndpoint(), httpContext,store.getDisplayName()); logoutFromExternalStore(store, httpContext); } return deleted; } }
Example #2
Source File: DropBoxAccount.java From neembuu-uploader with GNU General Public License v3.0 | 6 votes |
private void initialize() throws Exception { httpContext = new BasicHttpContext(); cookieStore = new BasicCookieStore(); httpContext.setAttribute(ClientContext.COOKIE_STORE, cookieStore); NULogger.getLogger().info("Getting startup cookies & link from DropBox.com"); responseString = NUHttpClientUtils.getData("https://www.dropbox.com/login", httpContext); doc = Jsoup.parse(responseString); cont = doc.select("form").first().select("input[name=cont]").attr("value"); signup_data = doc.select("form").first().select("input[name=signup_data]").attr("value"); signup_tag = doc.select("form").first().select("input[name=signup_data]").attr("value"); recaptcha_resp = doc.select("form").first().select("input[name=recaptcha_response_field]").attr("value"); recaptcha_key = doc.select("form").first().select("input[name=recaptcha_public_key]").attr("value"); db_t_val = doc.select("input[name=t]").attr("value"); }
Example #3
Source File: ZShareAccount.java From neembuu-uploader with GNU General Public License v3.0 | 6 votes |
@Override public void login() { httpContext = new BasicHttpContext(); cookieStore = new BasicCookieStore(); httpContext.setAttribute(ClientContext.COOKIE_STORE, cookieStore); try { initialize(); loginZShare(); } catch(NUException ex){ ex.printError(); resetLogin(); accountUIShow().setVisible(true); } catch (Exception e) { NULogger.getLogger().log(Level.SEVERE, "Error in ZShare.net Login: {0}", e); resetLogin(); showWarningMessage( Translation.T().loginerror(), HOSTNAME); accountUIShow().setVisible(true); } }
Example #4
Source File: StatefullRestTemplate.java From jeeves with MIT License | 6 votes |
StatefullRestTemplate(HttpContext httpContext) { super(); HttpClient httpClient = HttpClientBuilder.create().build(); this.httpContext = httpContext == null ? new BasicHttpContext() : httpContext; StatefullHttpComponentsClientHttpRequestFactory statefullHttpComponentsClientHttpRequestFactory = new StatefullHttpComponentsClientHttpRequestFactory(httpClient, httpContext); super.setRequestFactory(statefullHttpComponentsClientHttpRequestFactory); List<HttpMessageConverter<?>> converters = this.getMessageConverters(); for (HttpMessageConverter<?> converter : converters) { if (converter instanceof MappingJackson2HttpMessageConverter) { List<MediaType> mediaTypes = converter.getSupportedMediaTypes(); List<MediaType> newMediaTypes = new ArrayList<>(mediaTypes); newMediaTypes.add(MediaType.TEXT_HTML); ((MappingJackson2HttpMessageConverter) converter).setSupportedMediaTypes(newMediaTypes); } } }
Example #5
Source File: JheBergAccount.java From neembuu-uploader with GNU General Public License v3.0 | 6 votes |
private void initialize() throws Exception { httpContext = new BasicHttpContext(); cookieStore = new BasicCookieStore(); httpContext.setAttribute(ClientContext.COOKIE_STORE, cookieStore); NULogger.getLogger().info("** JheBerg.net ** => Initiating plugin, please wait ..."); responseString = NUHttpClientUtils.getData("http://www.jheberg.net/", httpContext); doc = Jsoup.parse(responseString); csrfmiddlewaretoken = doc.select("form").first().select("input[name=csrfmiddlewaretoken]").attr("value"); if (!csrfmiddlewaretoken.isEmpty()){ NULogger.getLogger().info("** JheBerg.net ** => Login token found successfully, proceeding ..."); } else { NULogger.getLogger().info("** JheBerg.net ** => Error! Unable to find the login token!"); } }
Example #6
Source File: FileStormAccount.java From neembuu-uploader with GNU General Public License v3.0 | 5 votes |
private void initialize() throws Exception { httpContext = new BasicHttpContext(); cookieStore = new BasicCookieStore(); httpContext.setAttribute(ClientContext.COOKIE_STORE, cookieStore); //NULogger.getLogger().info("Getting startup cookies & link from FileStorm.to"); //responseString = NUHttpClientUtils.getData("http://filestorm.to", httpContext); }
Example #7
Source File: AndroidHttpClient.java From travelguide with Apache License 2.0 | 5 votes |
private AndroidHttpClient(ClientConnectionManager ccm, HttpParams params) { this.delegate = new DefaultHttpClient(ccm, params) { @Override protected BasicHttpProcessor createHttpProcessor() { // Add interceptor to prevent making requests from main thread. BasicHttpProcessor processor = super.createHttpProcessor(); processor.addRequestInterceptor(sThreadCheckInterceptor); processor.addRequestInterceptor(new CurlLogger()); return processor; } @Override protected HttpContext createHttpContext() { // Same as DefaultHttpClient.createHttpContext() minus the // cookie store. HttpContext context = new BasicHttpContext(); context.setAttribute( ClientContext.AUTHSCHEME_REGISTRY, getAuthSchemes()); context.setAttribute( ClientContext.COOKIESPEC_REGISTRY, getCookieSpecs()); context.setAttribute( ClientContext.CREDS_PROVIDER, getCredentialsProvider()); return context; } }; }
Example #8
Source File: ClickToWatchAccount.java From neembuu-uploader with GNU General Public License v3.0 | 5 votes |
private void initialize() throws Exception { httpContext = new BasicHttpContext(); cookieStore = new BasicCookieStore(); httpContext.setAttribute(ClientContext.COOKIE_STORE, cookieStore); //NULogger.getLogger().info("Getting startup cookies & link from ClickToWatch.net"); //responseString = NUHttpClientUtils.getData("http://clicktowatch.net", httpContext); }
Example #9
Source File: FileHootAccount.java From neembuu-uploader with GNU General Public License v3.0 | 5 votes |
private void initialize() throws Exception { httpContext = new BasicHttpContext(); cookieStore = new BasicCookieStore(); httpContext.setAttribute(ClientContext.COOKIE_STORE, cookieStore); //NULogger.getLogger().info("Getting startup cookies & link from FileHoot.com"); //responseString = NUHttpClientUtils.getData("http://filehoot.com", httpContext); }
Example #10
Source File: FilesBombAccount.java From neembuu-uploader with GNU General Public License v3.0 | 5 votes |
private void initialize() throws Exception { httpContext = new BasicHttpContext(); cookieStore = new BasicCookieStore(); httpContext.setAttribute(ClientContext.COOKIE_STORE, cookieStore); //NULogger.getLogger().info("Getting startup cookies & link from FilesBomb.in"); //responseString = NUHttpClientUtils.getData("", httpContext); }
Example #11
Source File: FilesTwoShareAccount.java From neembuu-uploader with GNU General Public License v3.0 | 5 votes |
private void initialize() throws Exception { httpContext = new BasicHttpContext(); cookieStore = new BasicCookieStore(); httpContext.setAttribute(ClientContext.COOKIE_STORE, cookieStore); //NULogger.getLogger().info("Getting startup cookies & link from Files2Share.ch"); //responseString = NUHttpClientUtils.getData("http://files2share.ch", httpContext); }
Example #12
Source File: ClicknUploadAccount.java From neembuu-uploader with GNU General Public License v3.0 | 5 votes |
private void initialize() throws Exception { httpContext = new BasicHttpContext(); cookieStore = new BasicCookieStore(); httpContext.setAttribute(ClientContext.COOKIE_STORE, cookieStore); //NULogger.getLogger().info("Getting startup cookies & link from ClicknUpload.com"); //responseString = NUHttpClientUtils.getData("http://clicknupload.com", httpContext); }
Example #13
Source File: FileRioAccount.java From neembuu-uploader with GNU General Public License v3.0 | 5 votes |
private void initialize() throws Exception { httpContext = new BasicHttpContext(); cookieStore = new BasicCookieStore(); httpContext.setAttribute(ClientContext.COOKIE_STORE, cookieStore); //NULogger.getLogger().info("Getting startup cookies & link from FileRio.in"); //responseString = NUHttpClientUtils.getData("http://filerio.in", httpContext); }
Example #14
Source File: YourVideoHostAccount.java From neembuu-uploader with GNU General Public License v3.0 | 5 votes |
private void initialize() throws Exception { httpContext = new BasicHttpContext(); cookieStore = new BasicCookieStore(); httpContext.setAttribute(ClientContext.COOKIE_STORE, cookieStore); //NULogger.getLogger().info("Getting startup cookies & link from YourVideoHost.com"); //responseString = NUHttpClientUtils.getData("http://yourvideohost.com", httpContext); }
Example #15
Source File: OboomAccount.java From neembuu-uploader with GNU General Public License v3.0 | 5 votes |
private void initialize() throws Exception { httpContext = new BasicHttpContext(); cookieStore = new BasicCookieStore(); httpContext.setAttribute(ClientContext.COOKIE_STORE, cookieStore); //NULogger.getLogger().info("Getting startup cookies & link from Oboom.com"); //responseString = NUHttpClientUtils.getData("http://www.oboom.com/", httpContext); }
Example #16
Source File: SDKConnection.java From BotLibre with Eclipse Public License 1.0 | 5 votes |
public String GET(String url) { if (this.debug) { System.out.println("GET: " + url); } String xml = null; try { HttpClient httpClient = new DefaultHttpClient(); HttpContext localContext = new BasicHttpContext(); HttpGet httpGet = new HttpGet(url); HttpResponse response = httpClient.execute(httpGet, localContext); HttpEntity entity = response.getEntity(); xml = EntityUtils.toString(entity, HTTP.UTF_8); if (response.getStatusLine().getStatusCode() != 200) { this.exception = new SDKException("" + response.getStatusLine().getStatusCode() + " : " + xml); return ""; } } catch (Exception exception) { if (this.debug) { exception.printStackTrace(); } this.exception = new SDKException(exception); throw this.exception; } return xml; }
Example #17
Source File: VideoWoodAccount.java From neembuu-uploader with GNU General Public License v3.0 | 5 votes |
private void initialize() throws Exception { httpContext = new BasicHttpContext(); cookieStore = new BasicCookieStore(); httpContext.setAttribute(ClientContext.COOKIE_STORE, cookieStore); NULogger.getLogger().info("Getting startup cookies & link from VideoWood.tv"); responseString = NUHttpClientUtils.getData("http://videowood.tv/login", httpContext); doc = Jsoup.parse(responseString); vdwood_token = doc.select("form").select("input[name=_token]").attr("value"); }
Example #18
Source File: NowDownloadAccount.java From neembuu-uploader with GNU General Public License v3.0 | 5 votes |
private void initialize() throws Exception { httpContext = new BasicHttpContext(); cookieStore = new BasicCookieStore(); httpContext.setAttribute(ClientContext.COOKIE_STORE, cookieStore); //NULogger.getLogger().info("Getting startup cookies & link from NowDownload.to"); //responseString = NUHttpClientUtils.getData("http://www.nowdownload.to", httpContext); }
Example #19
Source File: CloudyEcAccount.java From neembuu-uploader with GNU General Public License v3.0 | 5 votes |
private void initialize() throws Exception { httpContext = new BasicHttpContext(); cookieStore = new BasicCookieStore(); httpContext.setAttribute(ClientContext.COOKIE_STORE, cookieStore); //NULogger.getLogger().info("Getting startup cookies & link from Cloudy.ec"); //responseString = NUHttpClientUtils.getData("http://www.cloudy.ec", httpContext); }
Example #20
Source File: OpenLoadAccount.java From neembuu-uploader with GNU General Public License v3.0 | 5 votes |
private void initialize() throws Exception { httpContext = new BasicHttpContext(); cookieStore = new BasicCookieStore(); httpContext.setAttribute(ClientContext.COOKIE_STORE, cookieStore); NULogger.getLogger().info("Getting startup cookies & link from OpenLoad.co"); responseString = NUHttpClientUtils.getData("https://openload.co/login", httpContext); doc = Jsoup.parse(responseString); csrfToken = doc.select("form[id=login-form]").first().select("input[name=_csrf]").attr("value"); }
Example #21
Source File: FourUpFilesAccount.java From neembuu-uploader with GNU General Public License v3.0 | 5 votes |
private void initialize() throws Exception { httpContext = new BasicHttpContext(); cookieStore = new BasicCookieStore(); httpContext.setAttribute(ClientContext.COOKIE_STORE, cookieStore); //NULogger.getLogger().info("Getting startup cookies & link from 4upFiles.com"); //responseString = NUHttpClientUtils.getData("http://4upfiles.com", httpContext); }
Example #22
Source File: SDKConnection.java From BotLibre with Eclipse Public License 1.0 | 5 votes |
public String GET(String url) { if (this.debug) { System.out.println("GET: " + url); } String xml = null; try { HttpClient httpClient = new DefaultHttpClient(); HttpContext localContext = new BasicHttpContext(); HttpGet httpGet = new HttpGet(url); HttpResponse response = httpClient.execute(httpGet, localContext); HttpEntity entity = response.getEntity(); xml = EntityUtils.toString(entity, HTTP.UTF_8); if (response.getStatusLine().getStatusCode() != 200) { this.exception = new SDKException("" + response.getStatusLine().getStatusCode() + " : " + xml); return ""; } } catch (Exception exception) { if (this.debug) { exception.printStackTrace(); } this.exception = new SDKException(exception); throw this.exception; } return xml; }
Example #23
Source File: FileJokerAccount.java From neembuu-uploader with GNU General Public License v3.0 | 5 votes |
private void initialize() throws Exception { httpContext = new BasicHttpContext(); cookieStore = new BasicCookieStore(); httpContext.setAttribute(ClientContext.COOKIE_STORE, cookieStore); //NULogger.getLogger().info("Getting startup cookies & link from FileJoker.net"); //responseString = NUHttpClientUtils.getData("https://filejoker.net", httpContext); }
Example #24
Source File: UsersCloudAccount.java From neembuu-uploader with GNU General Public License v3.0 | 5 votes |
private void initialize() throws Exception { httpContext = new BasicHttpContext(); cookieStore = new BasicCookieStore(); httpContext.setAttribute(ClientContext.COOKIE_STORE, cookieStore); //NULogger.getLogger().info("Getting startup cookies & link from UsersCloud.com"); //responseString = NUHttpClientUtils.getData("https://userscloud.com/", httpContext); }
Example #25
Source File: TurboBitAccount.java From neembuu-uploader with GNU General Public License v3.0 | 5 votes |
private void initialize() throws Exception { httpContext = new BasicHttpContext(); cookieStore = new BasicCookieStore(); httpContext.setAttribute(ClientContext.COOKIE_STORE, cookieStore); //NULogger.getLogger().info("Getting startup cookies & link from TurboBit.net"); //responseString = NUHttpClientUtils.getData("http://turbobit.net/", httpContext); }
Example #26
Source File: HTTP.java From redalert-android with Apache License 2.0 | 5 votes |
public static String post(String url, String json) throws Exception { // Get custom http client HttpClient client = new DefaultHttpClient(); // Create post request HttpPost request = new HttpPost(url); // Set content type to JSON request.addHeader("Content-Type", "application/json"); // Send JSON as string request.setEntity(new StringEntity(json)); // Execute the request HttpResponse response = client.execute(request, new BasicHttpContext()); // Return response as string String responseText = EntityUtils.toString(response.getEntity()); // Failed? if (response.getStatusLine() == null || response.getStatusLine().getStatusCode() != 200) { // Throw it out throw new Exception(response.getStatusLine().toString() + "\n" + responseText); } // We're good return responseText; }
Example #27
Source File: HttpComponentsClientHttpRequestFactoryBasicAuth.java From spring-hmac-rest with MIT License | 5 votes |
private HttpContext createHttpContext() { // Create AuthCache instance AuthCache authCache = new BasicAuthCache(); // Generate BASIC scheme object and add it to the local auth cache BasicScheme basicAuth = new BasicScheme(); authCache.put(host, basicAuth); // Add AuthCache to the execution context BasicHttpContext localcontext = new BasicHttpContext(); localcontext.setAttribute(HttpClientContext.AUTH_CACHE, authCache); localcontext.setAttribute(HttpClientContext.CREDS_PROVIDER, credentialsProvider); return localcontext; }
Example #28
Source File: RapidSonicAccount.java From neembuu-uploader with GNU General Public License v3.0 | 5 votes |
private void initialize() throws Exception { httpContext = new BasicHttpContext(); cookieStore = new BasicCookieStore(); httpContext.setAttribute(ClientContext.COOKIE_STORE, cookieStore); //NULogger.getLogger().info("Getting startup cookies & link from RapidSonic.com"); //responseString = NUHttpClientUtils.getData("RapidSonic.com", httpContext); }
Example #29
Source File: BeStreamTvAccount.java From neembuu-uploader with GNU General Public License v3.0 | 5 votes |
private void initialize() throws Exception { httpContext = new BasicHttpContext(); cookieStore = new BasicCookieStore(); httpContext.setAttribute(ClientContext.COOKIE_STORE, cookieStore); //NULogger.getLogger().info("Getting startup cookies & link from BeStream.tv"); //responseString = NUHttpClientUtils.getData("", httpContext); }
Example #30
Source File: VShareAccount.java From neembuu-uploader with GNU General Public License v3.0 | 5 votes |
private void initialize() throws Exception { httpContext = new BasicHttpContext(); cookieStore = new BasicCookieStore(); httpContext.setAttribute(ClientContext.COOKIE_STORE, cookieStore); NULogger.getLogger().info("Getting startup cookies & link from VShare.eu"); responseString = NUHttpClientUtils.getData("http://vshare.eu/login.html", httpContext); redirect = StringUtils.stringBetweenTwoStrings(responseString, "name=\"redirect\" value=\"", "\""); }