Example usage for java.lang String concat

List of usage examples for java.lang String concat

Introduction

In this page you can find the example usage for java.lang String concat.

Prototype

public String concat(String str) 

Source Link

Document

Concatenates the specified string to the end of this string.

Usage

From source file:it.govpay.ejb.ndp.util.wsclient.NodoPerPa.java

public PagamentiTelematiciRPT configuraClient(String azione) {
    PagamentiTelematiciRPT port = service.getPagamentiTelematiciRPTPort();

    if (ishttpBasicEnabled) {
        ((BindingProvider) port).getRequestContext().put(BindingProvider.USERNAME_PROPERTY, httpBasicUser);
        ((BindingProvider) port).getRequestContext().put(BindingProvider.PASSWORD_PROPERTY, httpBasicPassword);
    }/*from   w  w w.  j  ava2s.  co  m*/

    if (isSslEnabled) {
        ((BindingProvider) port).getRequestContext().put(
                "com.sun.xml.internal.ws.transport.https.client.SSLSocketFactory",
                sslContext.getSocketFactory());
    }

    String urlString = url.toExternalForm();
    if (this.isConnettoreServizioRPTAzioneInUrl) {
        if (!urlString.endsWith("/"))
            urlString = urlString.concat("/");
        ((BindingProvider) port).getRequestContext().put(BindingProvider.ENDPOINT_ADDRESS_PROPERTY,
                urlString.concat(azione));
    } else {
        ((BindingProvider) port).getRequestContext().put(BindingProvider.ENDPOINT_ADDRESS_PROPERTY, urlString);
    }
    return port;
}

From source file:com.microsoft.azure.management.samples.Utils.java

/**
 * This method creates a certificate for given password.
 *
 * @param certPath location of certificate file
 * @param pfxPath location of pfx file//from   w  w  w.j a v  a  2  s.com
 * @param alias User alias
 * @param password alias password
 * @param cnName domain name
 * @throws Exception exceptions from the creation
 */
public static void createCertificate(String certPath, String pfxPath, String alias, String password,
        String cnName) throws Exception {

    String validityInDays = "3650";
    String keyAlg = "RSA";
    String sigAlg = "SHA1withRSA";
    String keySize = "2048";
    String storeType = "pkcs12";
    String command = "keytool";
    String jdkPath = System.getProperty("java.home");
    if (jdkPath != null && !jdkPath.isEmpty()) {
        jdkPath = jdkPath.concat("\\bin");
    }
    if (new File(jdkPath).isDirectory()) {
        command = String.format("%s%s%s", jdkPath, File.separator, command);
    }

    // Create Pfx file
    String[] commandArgs = { command, "-genkey", "-alias", alias, "-keystore", pfxPath, "-storepass", password,
            "-validity", validityInDays, "-keyalg", keyAlg, "-sigalg", sigAlg, "-keysize", keySize,
            "-storetype", storeType, "-dname", "CN=" + cnName, "-ext", "EKU=1.3.6.1.5.5.7.3.1" };
    Utils.cmdInvocation(commandArgs, false);

    // Create cer file i.e. extract public key from pfx
    File pfxFile = new File(pfxPath);
    if (pfxFile.exists()) {
        String[] certCommandArgs = { command, "-export", "-alias", alias, "-storetype", storeType, "-keystore",
                pfxPath, "-storepass", password, "-rfc", "-file", certPath };
        // output of keytool export command is going to error stream
        // although command is
        // executed successfully, hence ignoring error stream in this case
        Utils.cmdInvocation(certCommandArgs, true);

        // Check if file got created or not
        File cerFile = new File(pfxPath);
        if (!cerFile.exists()) {
            throw new IOException(
                    "Error occurred while creating certificate" + StringUtils.join(" ", certCommandArgs));
        }
    } else {
        throw new IOException(
                "Error occurred while creating certificates" + StringUtils.join(" ", commandArgs));
    }
}

From source file:org.addhen.smssync.controllers.MessageResultsController.java

/**
 * This method for handling GET ?task=result
 *
 * @param syncUrl url to web server/*  w  w w . j  a v  a2  s  . co m*/
 * @return MessagesUUIDSResponse parsed server response whit information about request success
 * or failure and list of message uuids
 */
public MessagesUUIDSResponse sendMessageResultGETRequest(SyncUrl syncUrl) {
    MessagesUUIDSResponse response = null;
    String newEndPointURL = syncUrl.getUrl().concat(TASK_RESULT_URL_PARAM);

    final String urlSecret = syncUrl.getSecret();

    if (!TextUtils.isEmpty(urlSecret)) {
        String urlSecretEncoded = urlSecret;
        newEndPointURL = newEndPointURL.concat("&secret=");
        try {
            urlSecretEncoded = URLEncoder.encode(urlSecret, "UTF-8");
        } catch (java.io.UnsupportedEncodingException e) {
            mUtil.log(e.getMessage());
        }
        newEndPointURL = newEndPointURL.concat(urlSecretEncoded);
    }

    MainHttpClient client = new MainHttpClient(newEndPointURL, mContext);
    try {
        client.setMethod(HttpMethod.GET);
        client.execute();
    } catch (JSONException e) {
        mUtil.log(mContext.getString(R.string.message_processed_json_failed));
        Util.logActivities(mContext,
                mContext.getString(R.string.message_processed_json_failed) + " " + e.getMessage());
    } catch (Exception e) {
        mUtil.log(mContext.getString(R.string.message_processed_failed));
        Util.logActivities(mContext,
                mContext.getString(R.string.message_processed_failed) + " " + e.getMessage());
    } finally {
        if (client != null) {
            if (HttpStatus.SC_OK == client.responseCode()) {
                response = parseMessagesUUIDSResponse(client);
                response.setSuccess(true);
            } else {
                response = new MessagesUUIDSResponse(client.responseCode());
                Util.logActivities(mContext, mContext.getString(R.string.messages_result_request_status,
                        client.responseCode(), client.getResponse()));
            }
        }
    }
    return response;
}

From source file:com.ibm.sbt.services.endpoints.FormEndpoint.java

public boolean login(String user, String password) throws AuthenticationException {
    boolean validAuthentication = false;
    String requestUrl = getUrl();
    setUser(user);//from ww w . j av  a 2 s. co  m
    setPassword(password);

    try {
        if (!(getLoginFormUrl().startsWith("/"))) {
            requestUrl = requestUrl.concat("/");
        }
        requestUrl = requestUrl.concat(getLoginFormUrl());
        BasicCookieStore cookieStore = new BasicCookieStore();
        DefaultHttpClient defaultHttpClient = new DefaultHttpClient();

        if (isForceTrustSSLCertificate()) {
            defaultHttpClient = SSLUtil.wrapHttpClient(defaultHttpClient); // Configure httpclient to accept all SSL certificates
        }
        if (isForceDisableExpectedContinue()) {
            defaultHttpClient.getParams().setParameter(CoreProtocolPNames.USE_EXPECT_CONTINUE, false);
        }
        if (StringUtil.isNotEmpty(getHttpProxy())) {
            defaultHttpClient = ProxyDebugUtil.wrapHttpClient(defaultHttpClient, getHttpProxy()); // Configure httpclient to direct all traffic through proxy clients
        }

        defaultHttpClient.setCookieStore(cookieStore);
        HttpPost httpost = new HttpPost(requestUrl);
        List<NameValuePair> formParams = getLoginFormParameters(); // retrieve platform specific login parameters
        httpost.setEntity(new UrlEncodedFormEntity(formParams, "UTF-8"));

        //getting to interface to avoid 
        //java.lang.NoSuchMethodError: org/apache/http/impl/client/DefaultHttpClient.execute(Lorg/apache/http/client/methods/HttpUriRequest;)Lorg/apache/http/client/methods/CloseableHttpResponse;
        //when run from different version of HttpClient (that's why it is deprecated)
        HttpClient httpClient = defaultHttpClient;

        HttpResponse resp = httpClient.execute(httpost);
        int code = resp.getStatusLine().getStatusCode();
        if (code == HttpStatus.SC_OK) {
            validAuthentication = true;
        }
        List<Cookie> cookies = cookieStore.getCookies();
        setCookieCache(cookies);

    } catch (IOException e) {
        throw new AuthenticationException(e, "FormEndpoint failed to authenticate");
    }
    return validAuthentication;

}

From source file:es.juntadeandalucia.panelGestion.negocio.utiles.geosearch.GeosearchDataImportWriter.java

private String getEntityName(Table table) {
    String dataBaseName = table.getSchema().getDataBase().getAlias();
    String schemaName = table.getSchema().getName();
    String tableName = table.getName();

    return dataBaseName.concat("_").concat(schemaName).concat("_").concat(tableName);
}

From source file:org.n52.sos.soe.GetObservationAQDTest.java

@Test
@Override/*ww w. j a  va 2s  .  c o  m*/
public void validateGetObservation()
        throws ClientProtocolException, IllegalStateException, IOException, XmlException {
    Configuration config = Configuration.instance();
    String url = HttpUtil.resolveServiceURL().concat(String.format(
            "GetObservation?service=SOS&version=2.0.0&request=GetObservation&observedProperty=%s&procedure=%s&f=xml&responseFormat=%s",
            config.getObservedProperty(), config.getProcedure(),
            "http%3A%2F%2Faqd.ec.europa.eu%2Faqd%2F0.3.7c"));

    if (config.getTemporalFilter() != null) {
        url = url.concat("&temporalFilter=").concat(config.getTemporalFilter());
    }

    XmlObject xo = HttpUtil.executeGetAndParseAsXml(url);

    Assert.assertTrue("Not a FeatureCollection: " + xo.getClass(), xo instanceof FeatureCollectionDocument);

    registerLaxValidationForAbstractFeatures();

    validateXml(xo);

    FeatureCollectionDocument obs = (FeatureCollectionDocument) xo;

    for (FeaturePropertyType fpt : obs.getFeatureCollection().getFeatureMemberArray()) {
        AQDReportingHeaderDocument aqd = AQDReportingHeaderDocument.Factory.parse(fpt.xmlText());

        logger.info("Got an AQD_ReportingHeader: " + aqd.getAQDReportingHeader().getDomNode().getLocalName());

        validateXml(aqd);

        for (FeaturePropertyType content : aqd.getAQDReportingHeader().getContentArray()) {
            OMObservationDocument om = OMObservationDocument.Factory.parse(content.xmlText());

            validateXml(om);

            validateContentsAndReturnValueCount(om.getOMObservation());
        }
    }
}

From source file:be.bittich.dynaorm.repository.GenericDynaRepository.java

@Override
public Boolean delete(T t) throws EntityDoesNotExistException {
    try {//from   w w w  .j  a va 2 s.  c o m
        T tFromDB = this.findById(t);
        if (tFromDB == null) {
            throw new EntityDoesNotExistException();
        }
        Map<Field, PrimaryKey> fieldPrimary = getAnnotedFields(t, PrimaryKey.class);
        String req = dialect.delete(tableColumn.getTableName());
        KeyValue<String, List<String>> pkBuilt = conditionPrimaryKeysBuilder(t, fieldPrimary, dialect);
        req = req.concat(pkBuilt.getKey());
        runner.update(req, pkBuilt.getValue().toArray());
        return true;
    } catch (RequestInvalidException ex) {
        LOG.log(Level.SEVERE, null, ex);
    } catch (SQLException ex) {
        LOG.log(Level.SEVERE, ex.getSQLState(), ex);
    }
    return false;
}

From source file:org.hsweb.concureent.cache.monitor.RedisMonitorCache.java

public RedisMonitorCache(String name, byte[] prefix,
        RedisOperations<? extends Object, ? extends Object> redisOperations, long expiration) {
    super(name, prefix, redisOperations, expiration);
    this.expiration = expiration;
    this.redisOperations = redisOperations;
    this.keySetKey = (name + "~keys").getBytes();
    this.totalTimeKey = name.concat(":total-times").getBytes();
    this.hitTimeKey = name.concat(":hit-times").getBytes();
    this.putTimeKey = name.concat(":put-times").getBytes();
}

From source file:is.idega.idegaweb.egov.gumbo.bpm.violation.ViolationService.java

public String getSelectedLabelsForValue(List<Item> items, Collection<?> values) {
    String value = CoreConstants.EMPTY;
    if (!ListUtil.isEmpty(values)) {
        for (Iterator<?> iter = values.iterator(); iter.hasNext();) {
            value = value.concat(iter.next().toString());
            if (iter.hasNext())
                value = value.concat(CoreConstants.SPACE);
        }//w  w  w  .j a va  2 s  . c  o  m
    }
    return getSelectedLabelsForValue(items, value);
}