Start line:  
End line:  

Snippet Preview

Snippet HTML Code

Stack Overflow Questions
  package com.paypal.base;
  
  import java.util.Map;
  
  
Wrapper class for api calls
 
 public class APIService {
 
 	private static final Logger log = LogManager.getLogger(APIService.class);

Service Endpoint

Deprecated:
 
 	private String endPoint;

Map used for to override ConfigManager configurations
 
 	private Map<StringStringconfigurationMap = null;

Deprecated:
Configuration Manager
 
 	private ConfigManager config = null;

HttpConfiguration
 
 	private HttpConfiguration httpConfiguration = null;

APISerice

Deprecated:
 
 	public APIService() {
 		 = ConfigManager.getInstance();
 		}
 	}

APIService configured through java.util.Map

Parameters:
configurationMap java.util.Map to over-ride default Config Manager configuration
 
 	public APIService(Map<StringStringconfigurationMap) {
 		if (configurationMap == null) {
 					"ConfigurationMap cannot be null");
 		}
 		this. = configurationMap;
 		if (Boolean.parseBoolean((Stringthis.
		}
	}

	public String makeRequestUsing(APICallPreHandler apiCallPreHandler)
		/*
		 * The implementation is transparent to API request format NVP or SOAP,
		 * the headers, payload and endpoints are fed by the corresponding
		 * apiCallPreHandlers
		 */
		String response = null;
		apiCallPreHandler.validate();
		Map<StringStringheaders = null;
		ConnectionManager connectionMgr = ConnectionManager.getInstance();
		HttpConnection connection = connectionMgr
		String url = apiCallPreHandler.getEndPoint();
		if (url == null || url.trim().length() <= 0) {
			throw new HttpErrorException(
					"Unable to retrieve a valid end-point from configuration");
		}
		headers = apiCallPreHandler.getHeaderMap();
		String payLoad = apiCallPreHandler.getPayLoad();
		if (apiCallPreHandler.getCredential() instanceof CertificateCredential) {
			CertificateCredential credential = (CertificateCredentialapiCallPreHandler
			connection.setupClientSSL(credential.getCertificatePath(),
					credential.getCertificateKey());
		}
		// null values are not permitted for headers. But empty values are
		// accepted
		if (.getIpAddress() != null) {
		}
		response = connection.execute(urlpayLoadheaders);
		.info(response);
		return response;
	}
	private String payLoadToLog(String payload) {
		Pattern p= Pattern.compile("(<(ebl:(Username|Password|Subject|Signature|CreditCardNumber|CVV2))>)[\\W\\w]+(</\\2>)");
		String passSubp.matcher(payload).replaceAll("$1****************$4");
		return passSub;
	}

Deprecated:
Returns:
	public String getEndPoint() {
		return ;
	}
New to GrepCode? Check out our FAQ X