Package org.pentaho.di.core
Class HTTPProtocol
- java.lang.Object
-
- org.pentaho.di.core.HTTPProtocol
-
public class HTTPProtocol extends Object
HTTPThis class contains HTTP protocol properties such as request headers. Response headers and other properties of the HTTP protocol can be added to this class.
- Author:
- sflatley
-
-
Constructor Summary
Constructors Constructor Description HTTPProtocol()
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description String
get(String urlAsString, String username, String password)
Performs a get on urlAsString using username and password as credentials.static String[]
getRequestHeaders()
-
-
-
Method Detail
-
getRequestHeaders
public static String[] getRequestHeaders()
- Returns:
- array of HTTP request headers
-
get
public String get(String urlAsString, String username, String password) throws IOException, org.apache.http.auth.AuthenticationException
Performs a get on urlAsString using username and password as credentials.If the status code returned not -1 and 401 then the contents are returned. If the status code is 401 an AuthenticationException is thrown.
All other values of status code are not dealt with but logic can be added as needed.
- Parameters:
urlAsString
- The url to connect tousername
- Basic Authentication usernamepassword
- Basic Authentication password- Returns:
- If the status code returned not -1 and 401 then the contents are returned. If the status code is 401 an AuthenticationException is thrown.
- Throws:
org.apache.http.auth.AuthenticationException
IOException
-
-