use of com.sun.jersey.api.client.config.DefaultClientConfig in project pentaho-platform by pentaho.
the class CommandLineProcessor method initRestService.
/**
* Used only for REST Jersey calls
*
* @throws ParseException
*/
private void initRestService() throws ParseException, InitializationException {
// get information about the remote connection
String username = getOptionValue(INFO_OPTION_USERNAME_NAME, true, false);
String password = getOptionValue(INFO_OPTION_PASSWORD_NAME, true, false);
password = KettleTwoWayPasswordEncoder.decryptPasswordOptionallyEncrypted(password);
ClientConfig clientConfig = new DefaultClientConfig();
clientConfig.getFeatures().put(JSONConfiguration.FEATURE_POJO_MAPPING, Boolean.TRUE);
client = Client.create(clientConfig);
client.addFilter(new HTTPBasicAuthFilter(username, password));
}
use of com.sun.jersey.api.client.config.DefaultClientConfig in project tez by apache.
the class ATSImportTool method getHttpClient.
private Client getHttpClient() {
if (httpClient == null) {
ClientConfig config = new DefaultClientConfig(JSONRootElementProvider.App.class);
HttpURLConnectionFactory urlFactory = new PseudoAuthenticatedURLConnectionFactory();
return new Client(new URLConnectionClientHandler(urlFactory), config);
}
return httpClient;
}
use of com.sun.jersey.api.client.config.DefaultClientConfig in project ApiEE by avraampiperidis.
the class ApiHttp method postFile.
public static ClientResponse postFile(String url, String name, String filename, byte[] data, String auth) {
DefaultClientConfig clientConfig = new DefaultClientConfig();
clientConfig.getClasses().add(MultiPartWriter.class);
Client client = Client.create(clientConfig);
WebResource webResource = client.resource(url);
FormDataMultiPart formDataMultiPart = new FormDataMultiPart();
formDataMultiPart.field(name, filename);
FormDataBodyPart bodyPart = new FormDataBodyPart(name, new ByteArrayInputStream(data), MediaType.APPLICATION_OCTET_STREAM_TYPE);
formDataMultiPart.bodyPart(bodyPart);
ClientResponse response = webResource.type(MediaType.MULTIPART_FORM_DATA_TYPE).header("Authorization", auth).post(ClientResponse.class, formDataMultiPart);
return response;
}
use of com.sun.jersey.api.client.config.DefaultClientConfig in project atlas by apache.
the class SecureEmbeddedServerTestBase method setup.
@BeforeMethod
public void setup() throws Exception {
jksPath = new Path(Files.createTempDirectory("tempproviders").toString(), "test.jks");
providerUrl = JavaKeyStoreProvider.SCHEME_NAME + "://file/" + jksPath.toUri();
String baseUrl = String.format("https://localhost:%d/", securePort);
DefaultClientConfig config = new DefaultClientConfig();
Client client = Client.create(config);
client.resource(UriBuilder.fromUri(baseUrl).build());
service = client.resource(UriBuilder.fromUri(baseUrl).build());
}
use of com.sun.jersey.api.client.config.DefaultClientConfig in project ff4j by ff4j.
the class AbstractWebResourceTestIT method configure.
/**
* {@inheritDoc}
*/
@Override
public WebAppDescriptor configure() {
ClientConfig cc = new DefaultClientConfig();
cc.getFeatures().put(JSONConfiguration.FEATURE_POJO_MAPPING, Boolean.TRUE);
return new WebAppDescriptor.Builder().initParam(WebComponent.APPLICATION_CONFIG_CLASS, //
SimpleFF4jProvider.class.getName()).clientConfig(cc).build();
}
Aggregations