Codota Logo
HttpClientUtil.createPreemptiveBasicAuthentication
Code IndexAdd Codota to your IDE (free)

How to use
createPreemptiveBasicAuthentication
method
in
org.pentaho.di.core.util.HttpClientUtil

Best Java code snippets using org.pentaho.di.core.util.HttpClientUtil.createPreemptiveBasicAuthentication (Showing top 20 results out of 315)

  • Add the Codota plugin to your IDE and get smart completions
private void myMethod () {
Gson g =
  • Codota Iconnew Gson()
  • Codota IconGsonBuilder gsonBuilder;gsonBuilder.create()
  • Codota Iconnew GsonBuilder().create()
  • Smart code suggestions by Codota
}
origin: pentaho/pentaho-kettle

/**
 * Returns context with AuthCache or null in case of any exception was thrown.
 * Use "http" schema.
 *
 * @param host
 * @param port
 * @param user
 * @param password
 * @return {@link org.apache.http.client.protocol.HttpClientContext HttpClientContext}
 */
public static HttpClientContext createPreemptiveBasicAuthentication( String host, int port, String user,
                                   String password ) {
 return createPreemptiveBasicAuthentication( host, port, user, password, "http" );
}
origin: pentaho/pdi-sdk-plugins

public static void addPackageToServlet( String urlString, InputStream is, String authentication ) throws Exception {
 HttpPost method = new HttpPost( urlString );
 method.setEntity( new InputStreamEntity( is ) );
 HttpClientContext context = HttpClientUtil.createPreemptiveBasicAuthentication( host, port, user, password );
 method.addHeader( new BasicHeader( "Content-Type", "binary/zip" ) );
 //adding authorization token
 if ( authentication != null ) {
  method.addHeader( new BasicHeader( "Authorization", authentication ) );
 }
 //executing method
 HttpClient client = HttpClientManager.getInstance().createDefaultClient();
 HttpResponse httpResponse = context != null ? client.execute( method, context ) : client.execute( method );
 int code = httpResponse.getStatusLine().getStatusCode();
 String response = HttpClientUtil.responseToString( httpResponse );
 method.releaseConnection();
 if ( code >= HttpStatus.SC_BAD_REQUEST ) {
  System.out.println( "Error occurred during export submission." );
 }
 System.out.println( "Server response:" );
 System.out.println( response );
}
origin: pentaho/pdi-sdk-plugins

public static void allocateServerSocket( String urlString, String authentication ) throws Exception {
 HttpGet method = new HttpGet( urlString );
 HttpClientContext context = HttpClientUtil.createPreemptiveBasicAuthentication( host, port, user, password );
 method.addHeader( new BasicHeader( "Content-Type", "text/xml;charset=UTF-8" ) );
 //adding authorization token
 if ( authentication != null ) {
  method.addHeader( new BasicHeader( "Authorization", authentication ) );
 }
 //executing method
 HttpClient client = HttpClientManager.getInstance().createDefaultClient();
 HttpResponse httpResponse = context != null ? client.execute( method, context ) : client.execute( method );
 int code = httpResponse.getStatusLine().getStatusCode();
 String response = HttpClientUtil.responseToString( httpResponse );
 method.releaseConnection();
 if ( code >= HttpStatus.SC_BAD_REQUEST ) {
  System.out.println( "Error occurred during ports allocation." );
 }
 System.out.println( "Server response:" );
 System.out.println( response );
}
origin: pentaho/pdi-sdk-plugins

 public static void sendExecuteRequest( String urlString, String authentication ) throws Exception {
  HttpGet method = new HttpGet( urlString );
  HttpClientContext context = HttpClientUtil.createPreemptiveBasicAuthentication( host, port, user, password );
  method.addHeader( new BasicHeader( "Content-Type", "text/xml;charset=UTF-8" ) );
  //adding authorization token
  if ( authentication != null ) {
   method.addHeader( new BasicHeader( "Authorization", authentication ) );
  }

  //executing method
  HttpClient client = HttpClientManager.getInstance().createDefaultClient();
  HttpResponse httpResponse = context != null ? client.execute( method, context ) : client.execute( method );
  int code = httpResponse.getStatusLine().getStatusCode();
  String response = HttpClientUtil.responseToString( httpResponse );
  method.releaseConnection();
  if ( code >= HttpStatus.SC_BAD_REQUEST ) {
   System.out.println( "Error occurred during transformation execution." );
  }
  System.out.println( "Server response (expected to be empty):" );
  System.out.println( response );
 }
}
origin: pentaho/pdi-sdk-plugins

 public static void sendGetTransStatusRequest( String urlString, String authentication ) throws Exception {
  HttpGet method = new HttpGet( urlString );
  HttpClientContext context = HttpClientUtil.createPreemptiveBasicAuthentication( host, port, user, password );
  //adding authorization token
  if ( authentication != null ) {
   method.addHeader( new BasicHeader( "Authorization", authentication ) );
  }

  //executing method
  HttpClient client = HttpClientManager.getInstance().createDefaultClient();
  HttpResponse httpResponse = context != null ? client.execute( method, context ) : client.execute( method );
  int code = httpResponse.getStatusLine().getStatusCode();
  String response = HttpClientUtil.responseToString( httpResponse );
  method.releaseConnection();
  if ( code >= HttpStatus.SC_BAD_REQUEST ) {
   System.out.println( "Error occurred during getting job status." );
  }
  System.out.println( "Server response:" );
  System.out.println( response );
 }
}
origin: pentaho/pdi-sdk-plugins

public static String sendRegisterSlaveRequest( String urlString, String authentication, String xml )
 throws Exception {
 HttpPost method = new HttpPost( urlString );
 method.setEntity( new ByteArrayEntity( xml.getBytes( "UTF-8" ) ) );
 HttpClientContext context = HttpClientUtil.createPreemptiveBasicAuthentication( host, port, user, password );
 //adding authorization token
 if ( authentication != null ) {
  method.addHeader( new BasicHeader( "Authorization", authentication ) );
 }
 //executing method
 HttpClient client = HttpClientManager.getInstance().createDefaultClient();
 HttpResponse httpResponse = context != null ? client.execute( method, context ) : client.execute( method );
 int code = httpResponse.getStatusLine().getStatusCode();
 String response = HttpClientUtil.responseToString( httpResponse );
 method.releaseConnection();
 if ( code >= HttpStatus.SC_BAD_REQUEST ) {
  System.out.println( "Error occurred during registering slave." );
  return null;
 }
 return response;
}
origin: pentaho/pdi-sdk-plugins

public static void sendGetSlavesRequest( String urlString, String authentication ) throws Exception {
 HttpGet method = new HttpGet( urlString );
 HttpClientContext context = HttpClientUtil.createPreemptiveBasicAuthentication( host, port, user, password );
 //adding authorization token
 if ( authentication != null ) {
  method.addHeader( new BasicHeader( "Authorization", authentication ) );
 }
 //executing method
 HttpClient client = HttpClientManager.getInstance().createDefaultClient();
 HttpResponse httpResponse = context != null ? client.execute( method, context ) : client.execute( method );
 int code = httpResponse.getStatusLine().getStatusCode();
 String response = HttpClientUtil.responseToString( httpResponse );
 method.releaseConnection();
 if ( code >= HttpStatus.SC_BAD_REQUEST ) {
  System.out.println( "Error occurred during getting slave servers." );
 }
 System.out.println( "Server response:" );
 System.out.println( response );
}
origin: pentaho/pdi-sdk-plugins

public static String sendStartJobRequest( String urlString, String authentication ) throws Exception {
 HttpGet method = new HttpGet( urlString );
 HttpClientContext context = HttpClientUtil.createPreemptiveBasicAuthentication( host, port, user, password );
 //adding authorization token
 if ( authentication != null ) {
  method.addHeader( new BasicHeader( "Authorization", authentication ) );
 }
 //executing method
 HttpClient client = HttpClientManager.getInstance().createDefaultClient();
 HttpResponse httpResponse = context != null ? client.execute( method, context ) : client.execute( method );
 int code = httpResponse.getStatusLine().getStatusCode();
 String response = HttpClientUtil.responseToString( httpResponse );
 method.releaseConnection();
 if ( code >= HttpStatus.SC_BAD_REQUEST ) {
  System.out.println( "Error occurred during starting job." );
  return null;
 }
 return response;
}
origin: pentaho/pdi-sdk-plugins

public static String sendPauseTransRequest( String urlString, String authentication ) throws Exception {
 HttpGet method = new HttpGet( urlString );
 HttpClientContext context = HttpClientUtil.createPreemptiveBasicAuthentication( host, port, user, password );
 //adding authorization token
 if ( authentication != null ) {
  method.addHeader( new BasicHeader( "Authorization", authentication ) );
 }
 //executing method
 HttpClient client = HttpClientManager.getInstance().createDefaultClient();
 HttpResponse httpResponse = context != null ? client.execute( method, context ) : client.execute( method );
 int code = httpResponse.getStatusLine().getStatusCode();
 String response = HttpClientUtil.responseToString( httpResponse );
 method.releaseConnection();
 if ( code >= HttpStatus.SC_BAD_REQUEST ) {
  System.out.println( "Error occurred during pausing transformation." );
  return null;
 }
 return response;
}
origin: pentaho/pdi-sdk-plugins

public static String sendPrepareExecutionTransRequest( String urlString, String authentication ) throws Exception {
 HttpGet method = new HttpGet( urlString );
 HttpClientContext context = HttpClientUtil.createPreemptiveBasicAuthentication( host, port, user, password );
 //adding authorization token
 if ( authentication != null ) {
  method.addHeader( new BasicHeader( "Authorization", authentication ) );
 }
 //executing method
 HttpClient client = HttpClientManager.getInstance().createDefaultClient();
 HttpResponse httpResponse = context != null ? client.execute( method, context ) : client.execute( method );
 int code = httpResponse.getStatusLine().getStatusCode();
 String response = HttpClientUtil.responseToString( httpResponse );
 method.releaseConnection();
 if ( code >= HttpStatus.SC_BAD_REQUEST ) {
  System.out.println( "Error occurred during preparing transformation execution." );
  return null;
 }
 return response;
}
origin: pentaho/pdi-sdk-plugins

public static String sendRemoveTransRequest( String urlString, String authentication ) throws Exception {
 HttpGet method = new HttpGet( urlString );
 HttpClientContext context = HttpClientUtil.createPreemptiveBasicAuthentication( host, port, user, password );
 //adding authorization token
 if ( authentication != null ) {
  method.addHeader( new BasicHeader( "Authorization", authentication ) );
 }
 //executing method
 HttpClient client = HttpClientManager.getInstance().createDefaultClient();
 HttpResponse httpResponse = context != null ? client.execute( method, context ) : client.execute( method );
 int code = httpResponse.getStatusLine().getStatusCode();
 String response = HttpClientUtil.responseToString( httpResponse );
 method.releaseConnection();
 if ( code >= HttpStatus.SC_BAD_REQUEST ) {
  System.out.println( "Error occurred during removing transformation." );
  return null;
 }
 return response;
}
origin: pentaho/pdi-sdk-plugins

public static String sendStartTransRequest( String urlString, String authentication ) throws Exception {
 HttpGet method = new HttpGet( urlString );
 HttpClientContext context = HttpClientUtil.createPreemptiveBasicAuthentication( host, port, user, password );
 //adding authorization token
 if ( authentication != null ) {
  method.addHeader( new BasicHeader( "Authorization", authentication ) );
 }
 //executing method
 HttpClient client = HttpClientManager.getInstance().createDefaultClient();
 HttpResponse httpResponse = context != null ? client.execute( method, context ) : client.execute( method );
 int code = httpResponse.getStatusLine().getStatusCode();
 String response = HttpClientUtil.responseToString( httpResponse );
 method.releaseConnection();
 if ( code >= HttpStatus.SC_BAD_REQUEST ) {
  System.out.println( "Error occurred during starting transformation." );
  return null;
 }
 return response;
}
origin: pentaho/pdi-sdk-plugins

public static String sendGetJobStatusRequest( String urlString, String authentication ) throws Exception {
 HttpGet method = new HttpGet( urlString );
 HttpClientContext context = HttpClientUtil.createPreemptiveBasicAuthentication( host, port, user, password );
 //adding authorization token
 if ( authentication != null ) {
  method.addHeader( new BasicHeader( "Authorization", authentication ) );
 }
 //executing method
 HttpClient client = HttpClientManager.getInstance().createDefaultClient();
 HttpResponse httpResponse = context != null ? client.execute( method, context ) : client.execute( method );
 int code = httpResponse.getStatusLine().getStatusCode();
 String response = HttpClientUtil.responseToString( httpResponse );
 method.releaseConnection();
 if ( code >= HttpStatus.SC_BAD_REQUEST ) {
  System.out.println( "Error occurred during getting job status." );
  return null;
 }
 return response;
}
origin: pentaho/pdi-sdk-plugins

public static String sendStopJobRequest( String urlString, String authentication ) throws Exception {
 HttpGet method = new HttpGet( urlString );
 HttpClientContext context = HttpClientUtil.createPreemptiveBasicAuthentication( host, port, user, password );
 //adding authorization token
 if ( authentication != null ) {
  method.addHeader( new BasicHeader( "Authorization", authentication ) );
 }
 //executing method
 HttpClient client = HttpClientManager.getInstance().createDefaultClient();
 HttpResponse httpResponse = context != null ? client.execute( method, context ) : client.execute( method );
 int code = httpResponse.getStatusLine().getStatusCode();
 String response = HttpClientUtil.responseToString( httpResponse );
 method.releaseConnection();
 if ( code >= HttpStatus.SC_BAD_REQUEST ) {
  System.out.println( "Error occurred during stopping job." );
  return null;
 }
 return response;
}
origin: pentaho/pdi-sdk-plugins

public static String sendSniffStepRequest( String urlString, String authentication ) throws Exception {
 HttpGet method = new HttpGet( urlString );
 HttpClientContext context = HttpClientUtil.createPreemptiveBasicAuthentication( host, port, user, password );
 //adding authorization token
 if ( authentication != null ) {
  method.addHeader( new BasicHeader( "Authorization", authentication ) );
 }
 //executing method
 HttpClient client = HttpClientManager.getInstance().createDefaultClient();
 HttpResponse httpResponse = context != null ? client.execute( method, context ) : client.execute( method );
 int code = httpResponse.getStatusLine().getStatusCode();
 String response = HttpClientUtil.responseToString( httpResponse );
 method.releaseConnection();
 if ( code >= HttpStatus.SC_BAD_REQUEST ) {
  System.out.println( "Error occurred during starting job." );
  return null;
 }
 return response;
}
origin: pentaho/pdi-sdk-plugins

public static String sendStopTransRequest( String urlString, String authentication ) throws Exception {
 HttpGet method = new HttpGet( urlString );
 HttpClientContext context = HttpClientUtil.createPreemptiveBasicAuthentication( host, port, user, password );
 //adding authorization token
 if ( authentication != null ) {
  method.addHeader( new BasicHeader( "Authorization", authentication ) );
 }
 //executing method
 HttpClient client = HttpClientManager.getInstance().createDefaultClient();
 HttpResponse httpResponse = context != null ? client.execute( method, context ) : client.execute( method );
 int code = httpResponse.getStatusLine().getStatusCode();
 String response = HttpClientUtil.responseToString( httpResponse );
 method.releaseConnection();
 if ( code >= HttpStatus.SC_BAD_REQUEST ) {
  System.out.println( "Error occurred during stopping transformation." );
  return null;
 }
 return response;
}
origin: pentaho/pdi-sdk-plugins

public static String sendNextSequenceRequest( String urlString, String authentication ) throws Exception {
 HttpGet method = new HttpGet( urlString );
 HttpClientContext context = HttpClientUtil.createPreemptiveBasicAuthentication( host, port, user, password );
 //adding authorization token
 if ( authentication != null ) {
  method.addHeader( new BasicHeader( "Authorization", authentication ) );
 }
 //executing method
 HttpClient client = HttpClientManager.getInstance().createDefaultClient();
 HttpResponse httpResponse = context != null ? client.execute( method, context ) : client.execute( method );
 int code = httpResponse.getStatusLine().getStatusCode();
 String response = HttpClientUtil.responseToString( httpResponse );
 method.releaseConnection();
 if ( code >= HttpStatus.SC_BAD_REQUEST ) {
  System.out.println( "Error occurred during sequense allocation. "
   + "Most probably you don't have the sequence configured for your Carte server." );
  return null;
 }
 return response;
}
origin: pentaho/pdi-sdk-plugins

public static String sendStartExecutionTransRequest( String urlString, String authentication ) throws Exception {
 HttpGet method = new HttpGet( urlString );
 HttpClientContext context = HttpClientUtil.createPreemptiveBasicAuthentication( host, port, user, password );
 //adding authorization token
 if ( authentication != null ) {
  method.addHeader( new BasicHeader( "Authorization", authentication ) );
 }
 //executing method
 HttpClient client = HttpClientManager.getInstance().createDefaultClient();
 HttpResponse httpResponse = context != null ? client.execute( method, context ) : client.execute( method );
 int code = httpResponse.getStatusLine().getStatusCode();
 String response = HttpClientUtil.responseToString( httpResponse );
 method.releaseConnection();
 if ( code >= HttpStatus.SC_BAD_REQUEST ) {
  System.out.println( "Error occurred during starting transformation execution." );
  return null;
 }
 return response;
}
origin: pentaho/pdi-sdk-plugins

public static String sendCleanupTransRequest( String urlString, String authentication ) throws Exception {
 HttpGet method = new HttpGet( urlString );
 HttpClientContext context = HttpClientUtil.createPreemptiveBasicAuthentication( host, port, user, password );
 //adding authorization token
 if ( authentication != null ) {
  method.addHeader( new BasicHeader( "Authorization", authentication ) );
 }
 //executing method
 HttpClient client = HttpClientManager.getInstance().createDefaultClient();
 HttpResponse httpResponse = context != null ? client.execute( method, context ) : client.execute( method );
 int code = httpResponse.getStatusLine().getStatusCode();
 String response = HttpClientUtil.responseToString( httpResponse );
 method.releaseConnection();
 if ( code >= HttpStatus.SC_BAD_REQUEST ) {
  System.out.println( "Error occurred during transformation preparation for execution." );
  return null;
 }
 return response;
}
origin: pentaho/pdi-sdk-plugins

public static String sendRemoveJobRequest( String urlString, String authentication ) throws Exception {
 HttpGet method = new HttpGet( urlString );
 HttpClientContext context = HttpClientUtil.createPreemptiveBasicAuthentication( host, port, user, password );
 //adding authorization token
 if ( authentication != null ) {
  method.addHeader( new BasicHeader( "Authorization", authentication ) );
 }
 //executing method
 HttpClient client = HttpClientManager.getInstance().createDefaultClient();
 HttpResponse httpResponse = context != null ? client.execute( method, context ) : client.execute( method );
 int code = httpResponse.getStatusLine().getStatusCode();
 String response = HttpClientUtil.responseToString( httpResponse );
 method.releaseConnection();
 if ( code >= HttpStatus.SC_BAD_REQUEST ) {
  System.out.println( "Error occurred during removing job." );
  return null;
 }
 return response;
}
org.pentaho.di.core.utilHttpClientUtilcreatePreemptiveBasicAuthentication

Javadoc

Returns context with AuthCache or null in case of any exception was thrown. Use "http" schema.

Popular methods of HttpClientUtil

  • responseToString
  • responseToByteArray

Popular in Java

  • Reactive rest calls using spring rest template
  • setRequestProperty (URLConnection)
  • setContentView (Activity)
  • compareTo (BigDecimal)
    Compares this BigDecimal with the specified BigDecimal. Two BigDecimal objects that are equal in val
  • FileInputStream (java.io)
    A FileInputStream obtains input bytes from a file in a file system. What files are available depends
  • Proxy (java.net)
    This class represents proxy server settings. A created instance of Proxy stores a type and an addres
  • Collection (java.util)
    Collection is the root of the collection hierarchy. It defines operations on data collections and t
  • Collections (java.util)
    This class consists exclusively of static methods that operate on or return collections. It contains
  • Semaphore (java.util.concurrent)
    A counting semaphore. Conceptually, a semaphore maintains a set of permits. Each #acquire blocks if
  • DataSource (javax.sql)
    A factory for connections to the physical data source that this DataSource object represents. An alt
Codota Logo
  • Products

    Search for Java codeSearch for JavaScript codeEnterprise
  • IDE Plugins

    IntelliJ IDEAWebStormAndroid StudioEclipseVisual Studio CodePyCharmSublime TextPhpStormVimAtomGoLandRubyMineEmacsJupyter
  • Company

    About UsContact UsCareers
  • Resources

    FAQBlogCodota Academy Plugin user guide Terms of usePrivacy policyJava Code IndexJavascript Code Index
Get Codota for your IDE now