类org.apache.http.protocol.BasicHttpContext源码实例Demo

下面列出了怎么用org.apache.http.protocol.BasicHttpContext的API类实例代码及写法,或者点击链接到github查看源代码。

源代码1 项目: docs-apim   文件: 103335311.java
@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;
    }
}
 
源代码2 项目: jeeves   文件: StatefullRestTemplate.java
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);
        }
    }
}
 
源代码3 项目: neembuu-uploader   文件: DropBoxAccount.java
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");
}
 
源代码4 项目: neembuu-uploader   文件: ZShareAccount.java
@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);
    }
}
 
源代码5 项目: neembuu-uploader   文件: JheBergAccount.java
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!");
    }
}
 
源代码6 项目: neembuu-uploader   文件: FileHootAccount.java
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);
}
 
源代码7 项目: neembuu-uploader   文件: SendSpaceAccount.java
private void initialize() throws Exception {
    RemoveCryptographyRestrictions.removeCryptographyRestrictions();
    httpContext = new BasicHttpContext();
    cookieStore = new BasicCookieStore();
    httpContext.setAttribute(ClientContext.COOKIE_STORE, cookieStore);

    NULogger.getLogger().info("Getting startup cookies & link from SendSpace.com");
    responseString = NUHttpClientUtils.getData("https://www.sendspace.com/", httpContext);
    doc = Jsoup.parse(responseString);
    target = doc.select("form").eq(1).select("input[name=target]").attr("value");
}
 
源代码8 项目: neembuu-uploader   文件: AsfileAccount.java
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 Asfile.com");
    //responseString = NUHttpClientUtils.getData("http://asfile.com", httpContext);
}
 
源代码9 项目: neembuu-uploader   文件: UploadHeroAccount.java
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 UploadHero.co");
    responseString = NUHttpClientUtils.getData("http://uploadhero.co/connection", httpContext);
}
 
源代码10 项目: neembuu-uploader   文件: IndiShareAccount.java
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 IndiShare.com");
    //responseString = NUHttpClientUtils.getData("http://www.indishare.com/", httpContext);
}
 
源代码11 项目: neembuu-uploader   文件: MediaFireAccount.java
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 MediaFire.com");
    //responseString = NUHttpClientUtils.getData("MediaFire.com", httpContext);
}
 
源代码12 项目: neembuu-uploader   文件: GoFourUpAccount.java
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 Go4Up.com");
    //responseString = NUHttpClientUtils.getData("", httpContext);
}
 
源代码13 项目: neembuu-uploader   文件: UltraMegaBitAccount.java
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 UltraMegaBit.com");
    responseString = NUHttpClientUtils.getData("https://ultramegabit.com/login", httpContext);
    csrf_token = Jsoup.parse(responseString).select("input[name=csrf_token]").val();
}
 
源代码14 项目: neembuu-uploader   文件: LunaticFilesAccount.java
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 LunaticFiles.com");
    //responseString = NUHttpClientUtils.getData("LunaticFiles.com", httpContext);
}
 
@Override
protected HttpContext createHttpContext(HttpMethod httpMethod, URI uri) {
	final AuthCache authCache = new BasicAuthCache();

	final BasicScheme basicAuth = new BasicScheme();
	authCache.put(host, basicAuth);

	final BasicHttpContext localcontext = new BasicHttpContext();
	localcontext.setAttribute(HttpClientContext.AUTH_CACHE, authCache);
	return localcontext;
}
 
源代码16 项目: neembuu-uploader   文件: UpaFileAccount.java
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 UpaFile.com");
    //responseString = NUHttpClientUtils.getData("http://upafile.com", httpContext);
}
 
源代码17 项目: neembuu-uploader   文件: SpeedVideoAccount.java
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 SpeedVideo.net");
    //responseString = NUHttpClientUtils.getData("http://speedvideo.net/", httpContext);
}
 
源代码18 项目: neembuu-uploader   文件: UsersFilesAccount.java
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 UsersFiles.com");
    responseString = NUHttpClientUtils.getData("https://usersfiles.com/", httpContext);
    
    doc = Jsoup.parse(responseString);
    rand = doc.select("form[name=FL]").select("input[name=rand]").attr("value");
}
 
源代码19 项目: neembuu-uploader   文件: GriftHostAccount.java
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 GriftHost.com");
    //responseString = NUHttpClientUtils.getData("http://grifthost.com", httpContext);
}
 
源代码20 项目: jeeves   文件: HttpRestConfig.java
@Bean
public RestTemplate restTemplate() {
    CookieStore cookieStore = new BasicCookieStore();
    HttpContext httpContext = new BasicHttpContext();
    httpContext.setAttribute(HttpClientContext.COOKIE_STORE, cookieStore);
    httpContext.setAttribute(HttpClientContext.REQUEST_CONFIG, RequestConfig.custom().setRedirectsEnabled(false).build());
    return new StatefullRestTemplate(httpContext);
}
 
源代码21 项目: neembuu-uploader   文件: BayFilesAccount.java
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 ArabLoads.com");
    //responseString = NUHttpClientUtils.getData("http://arabloads.com", httpContext);
}
 
源代码22 项目: neembuu-uploader   文件: TeraFileAccount.java
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 TeraFile.co");
    //responseString = NUHttpClientUtils.getData("http://terafile.co", httpContext);
}
 
源代码23 项目: neembuu-uploader   文件: UploadAbleAccount.java
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 UploadAble.ch");
    responseString = NUHttpClientUtils.getData("https://www.uploadable.ch/login.php", httpContext);
}
 
源代码24 项目: neembuu-uploader   文件: NovaFileAccount.java
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 NovaFile.com");
    //responseString = NUHttpClientUtils.getData("http://novafile.com", httpContext);
}
 
源代码25 项目: neembuu-uploader   文件: IguanaShareAccount.java
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 IguanaShare.com");
    //responseString = NUHttpClientUtils.getData("", httpContext);
}
 
源代码26 项目: neembuu-uploader   文件: PutStreamAccount.java
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 PutStream.com");
    //responseString = NUHttpClientUtils.getData("", httpContext);
}
 
源代码27 项目: neembuu-uploader   文件: RainUploadAccount.java
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 RainUpload.net");
    //responseString = NUHttpClientUtils.getData("http://rainupload.net", httpContext);
}
 
源代码28 项目: nexus-public   文件: RestClientFactoryImpl.java
@Override
public Client create(final RestClientConfiguration configuration) {
  checkNotNull(configuration);

  try (TcclBlock tccl = TcclBlock.begin(ResteasyClientBuilder.class)) {
    HttpContext httpContext = new BasicHttpContext();
    if (configuration.getUseTrustStore()) {
        httpContext.setAttribute(SSLContextSelector.USE_TRUST_STORE, true);
    }
    HttpClient client;
    if (configuration.getHttpClient() != null) {
      client = checkNotNull(configuration.getHttpClient().get());
    }
    else {
      client = httpClient.get();
    }
    ClientHttpEngine httpEngine = new ApacheHttpClient4Engine(client, httpContext);

    ResteasyClientBuilder builder = new ResteasyClientBuilder().httpEngine(httpEngine);

    if (configuration.getCustomizer() != null) {
      configuration.getCustomizer().apply(builder);
    }

    return builder.build();
  }
}
 
private HttpResponse login(BonitaCredentials credentials) throws IOException {
    BasicHttpContext httpContext = new BasicHttpContext();
    BasicCookieStore cookieStore = new BasicCookieStore();
    httpContext.setAttribute("http.cookie-store", cookieStore);
    List<NameValuePair> urlParameters = new ArrayList<NameValuePair>();
    urlParameters.add(new BasicNameValuePair("username", credentials.username));
    urlParameters.add(new BasicNameValuePair("password", credentials.password));
    urlParameters.add(new BasicNameValuePair("redirect", "false"));
    UrlEncodedFormEntity entity = new UrlEncodedFormEntity(urlParameters, "utf-8");
    HttpPost postRequest = new HttpPost(credentials.loginServletURI);
    postRequest.setEntity(entity);
    return getProxyClient().execute(postRequest, httpContext);
}
 
源代码30 项目: neembuu-uploader   文件: YaVideoAccount.java
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 YaVideo.tv");
    //responseString = NUHttpClientUtils.getData("", httpContext);
}
 
 类所在包
 类方法
 同包方法