List of usage examples for com.itextpdf.xmp.impl Base64 encode
public static final String encode(String src)
From source file:be.roots.taconic.pricingguide.util.HttpUtil.java
License:Open Source License
private static HttpURLConnection getInputStreamFor(String urlAsString, String userName, String password) throws IOException { LOGGER.info(//from w ww. j a va 2 s . co m REQUEST_METHOD + "ting data from url: " + urlAsString + " with timeout set to " + CONNECT_TIMEOUT); final URL url = new URL(urlAsString); final HttpURLConnection con = (HttpURLConnection) url.openConnection(); con.setRequestMethod(REQUEST_METHOD); con.setConnectTimeout(CONNECT_TIMEOUT); if (userName != null || password != null) { final String encoded = Base64.encode(userName + ":" + password); con.setRequestProperty("Authorization", "Basic " + encoded); } final int responseCode = con.getResponseCode(); LOGGER.info("Response code: " + responseCode); return con; }
From source file:com.isa.firma.FirmaPDFController.java
public void validarFirma(byte[] pdffirmado) throws AppletException { try {//from w ww . j a v a 2s . co m VerificarDocumentoPDF verificarpdf = UtilesWS.getInstancePortWSVerify(); byte[] pdfbase64firmando = Base64.encode(pdffirmado); VerifyResponse response = verificarpdf.validarDocumentoByDoc(pdfbase64firmando); if (!response.isValida()) { //String msj, String stacktrace, Throwable cause throw new AppletException(UtilesMsg.ERROR_UNA_FIRMA_NO_VALIDA, null, null); } } catch (WServiceTXException_Exception ex) { Logger.getLogger(FirmaPDFController.class.getName()).log(Level.SEVERE, null, ex); throw new AppletException(UtilesMsg.ERROR_WS_EXCEPTION_VALIDACION, null, ex.getCause()); } }