Search in sources :

Example 46 with HTTPBasicAuthFilter

use of com.sun.jersey.api.client.filter.HTTPBasicAuthFilter in project data-access by pentaho.

the class TestDataSourceResource method init.

private static void init() {
    ClientConfig clientConfig = new DefaultClientConfig();
    client = Client.create(clientConfig);
    client.addFilter(new HTTPBasicAuthFilter("joe", "password"));
}
Also used : DefaultClientConfig(com.sun.jersey.api.client.config.DefaultClientConfig) DefaultClientConfig(com.sun.jersey.api.client.config.DefaultClientConfig) ClientConfig(com.sun.jersey.api.client.config.ClientConfig) HTTPBasicAuthFilter(com.sun.jersey.api.client.filter.HTTPBasicAuthFilter)

Example 47 with HTTPBasicAuthFilter

use of com.sun.jersey.api.client.filter.HTTPBasicAuthFilter in project pentaho-platform by pentaho.

the class CommandLineProcessor method initRestService.

/**
 * Used only for REST Jersey calls
 *
 * @param contextURL The Pentaho server web application base URL.
 */
private void initRestService(String contextURL) throws ParseException, KettleException, URISyntaxException {
    ClientConfig clientConfig = new DefaultClientConfig();
    clientConfig.getFeatures().put(JSONConfiguration.FEATURE_POJO_MAPPING, Boolean.TRUE);
    client = Client.create(clientConfig);
    client.addFilter(new HTTPBasicAuthFilter(getUsername(), getPassword()));
    client.addFilter(new SessionCookiesFilter(new CookieManager()));
    client.addFilter(new CsrfTokenFilter(new URI(contextURL + API_CSRF_TOKEN)));
}
Also used : DefaultClientConfig(com.sun.jersey.api.client.config.DefaultClientConfig) CsrfTokenFilter(com.hitachivantara.security.web.impl.client.csrf.jaxrsv1.CsrfTokenFilter) SessionCookiesFilter(com.hitachivantara.security.web.impl.client.csrf.jaxrsv1.util.SessionCookiesFilter) ClientConfig(com.sun.jersey.api.client.config.ClientConfig) DefaultClientConfig(com.sun.jersey.api.client.config.DefaultClientConfig) HTTPBasicAuthFilter(com.sun.jersey.api.client.filter.HTTPBasicAuthFilter) URI(java.net.URI) CookieManager(java.net.CookieManager)

Aggregations

HTTPBasicAuthFilter (com.sun.jersey.api.client.filter.HTTPBasicAuthFilter)47 Client (com.sun.jersey.api.client.Client)32 WebResource (com.sun.jersey.api.client.WebResource)19 ClientResponse (com.sun.jersey.api.client.ClientResponse)15 ClientConfig (com.sun.jersey.api.client.config.ClientConfig)15 DefaultClientConfig (com.sun.jersey.api.client.config.DefaultClientConfig)15 LoggingFilter (com.sun.jersey.api.client.filter.LoggingFilter)7 ArrayList (java.util.ArrayList)7 ClientFilter (com.sun.jersey.api.client.filter.ClientFilter)6 ApacheHttpClient (com.sun.jersey.client.apache.ApacheHttpClient)5 HTTPSProperties (com.sun.jersey.client.urlconnection.HTTPSProperties)5 URI (java.net.URI)4 HostnameVerifier (javax.net.ssl.HostnameVerifier)4 SSLSession (javax.net.ssl.SSLSession)4 ClientHandlerException (com.sun.jersey.api.client.ClientHandlerException)3 ClientRequest (com.sun.jersey.api.client.ClientRequest)3 MultivaluedMapImpl (com.sun.jersey.core.util.MultivaluedMapImpl)3 FormDataMultiPart (com.sun.jersey.multipart.FormDataMultiPart)3 FileInputStream (java.io.FileInputStream)3 KeyStore (java.security.KeyStore)3