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:com.continuuity.http.TestHandler.java

@Path("facebook/{id}/message")
@PUT/*from  w  ww  .j  a v  a 2s  .co m*/
public void testPutMessage(HttpRequest request, HttpResponder responder, @PathParam("id") String id) {
    String message = String.format("Handled put in tweets end-point, id: %s. ", id);
    try {
        String data = getStringContent(request);
        message = message.concat(String.format("Content: %s", data));
    } catch (IOException e) {
        //This condition should never occur
        assertTrue(false);
    }
    JsonObject object = new JsonObject();
    object.addProperty("result", message);
    responder.sendJson(HttpResponseStatus.OK, object);
}

From source file:com.continuuity.http.TestHandler.java

@Path("facebook/{id}/message")
@POST/*  w ww.  j ava 2  s  . co  m*/
public void testPostMessage(HttpRequest request, HttpResponder responder, @PathParam("id") String id) {
    String message = String.format("Handled post in tweets end-point, id: %s. ", id);
    try {
        String data = getStringContent(request);
        message = message.concat(String.format("Content: %s", data));
    } catch (IOException e) {
        //This condition should never occur
        assertTrue(false);
    }
    JsonObject object = new JsonObject();
    object.addProperty("result", message);
    responder.sendJson(HttpResponseStatus.OK, object);
}

From source file:name.gumartinm.weather.information.notification.NotificationIntentService.java

private Current doInBackgroundThrowable(final WeatherLocation weatherLocation,
        final CustomHTTPClient HTTPClient, final ServiceCurrentParser weatherService)
        throws ClientProtocolException, MalformedURLException, URISyntaxException, JsonParseException,
        IOException {/*from  w ww.  j a v a  2s.c  o  m*/
    final SharedPreferences sharedPreferences = PreferenceManager
            .getDefaultSharedPreferences(this.getApplicationContext());
    final String APPID = sharedPreferences.getString(this.getString(R.string.weather_preferences_app_id_key),
            "");

    final String APIVersion = this.getResources().getString(R.string.api_version);

    final String urlAPI = this.getResources().getString(R.string.uri_api_weather_today);
    String url = weatherService.createURIAPICurrent(urlAPI, APIVersion, weatherLocation.getLatitude(),
            weatherLocation.getLongitude());
    if (!APPID.isEmpty()) {
        url = url.concat("&APPID=" + APPID);
    }
    final String jsonData = HTTPClient.retrieveDataAsString(new URL(url));

    return weatherService.retrieveCurrentFromJPOS(jsonData);
}

From source file:org.openmrs.module.admintoolsui.page.controller.account.AccountPageController.java

private String getMessageErrors(MessageSource messageSource, List<ObjectError> allErrors) {
    String message = "";
    for (ObjectError error : allErrors) {
        Object[] arguments = error.getArguments();
        String errorMessage = messageSource.getMessage(error.getCode(), arguments, Context.getLocale());
        message = message.concat(replaceArguments(errorMessage, arguments).concat("<br>"));
    }//from   w w w .j a v a 2 s.c  o  m
    return message;
}

From source file:fr.cnes.sitools.extensions.astro.application.MocDescription.java

/**
 * Computes MOC at order 13 from the SOLR server.
 * @throws Exception Error while processing MOC
 *///from  w w  w  . j  a v a2  s  . c om
protected void computeMoc() throws Exception {
    AbstractSolrQueryRequestFactory querySolr = AbstractSolrQueryRequestFactory.createInstance(queryParameters,
            CoordSystem.EQUATORIAL, getSolrBaseUrl(), Scheme.NESTED);
    querySolr.createQueryBuilder();
    String query = querySolr.getSolrQueryRequest();
    query = query.concat("&rows=0&facet=true&facet.field=order13&facet.limit=-1&facet.mincount=1");
    //ClientResource client = new ClientResource(getSolrBaseUrl() + "/select/?q=*:*&rows=0&facet=true&facet.field=order13&facet.limit=-1&facet.mincount=1&wt=json");
    ClientResource client = new ClientResource(query);
    String text = client.get().getText();
    JSONObject json = new JSONObject(text);
    json = json.getJSONObject("facet_counts");
    json = json.getJSONObject("facet_fields");
    JSONArray array = json.getJSONArray("order13");

    setMoc(new HealpixMoc());
    for (int i = 0; i < array.length(); i++) {
        MocCell mocCell = new MocCell();
        mocCell.set(ORDER_MAX, array.getLong(i));
        getMoc().add(mocCell);
    }
}

From source file:com.ebiznext.flume.elasticsearch.client.SearchGuardElasticSearchTransportClient.java

@Override
public void configure(Context context) {
    String username = context.getString(SEARCH_GUARD_USERNAME);
    String password = context.getString(SEARCH_GUARD_PASSWORD);
    if (StringUtils.isNotEmpty(username) && StringUtils.isNotEmpty(password)) {
        credentials = Base64.encodeBase64String(username.concat(":").concat(password).getBytes());
    }/*from  w  ww.  jav a 2 s. c o  m*/
}

From source file:fr.natoine.model_annotation.Annotation.java

public String toHTML() {
    String _html = super.toHTML();
    _html = _html.concat(
            "Status : <span class=status title=" + status.getComment() + ">" + status.getLabel() + "</span>");
    return _html;
}

From source file:org.jenkinsci.plugins.url_auth.UrlSecurityRealm.java

@Override
protected UserDetails authenticate(String username, String password) throws AuthenticationException {
    try {/*from  ww  w. jav  a2s. co m*/
        if (username == null || password == null || username.trim().isEmpty() || password.trim().isEmpty()) {
            throw new BadCredentialsException("Username or password can't be empty.");
        }
        String urlString = loginUrl.replace("[username]", username).replace("[password]", password);
        //System.out.println(urlString);
        URL iurl = new URL(urlString);
        HttpURLConnection uc;
        if (testConnection == null) {
            uc = (HttpURLConnection) iurl.openConnection();
        } else {
            uc = testConnection;
        }
        uc.connect();
        if (this.useResponseCode) {
            int response = uc.getResponseCode();
            uc.disconnect();
            if (response != successResponse) {
                throw new BadCredentialsException(
                        String.format("Response %d didn't match %d", response, this.successResponse));
            }
        } else {
            BufferedReader in = new BufferedReader(new InputStreamReader(uc.getInputStream()));

            String matchLine = in.readLine().toLowerCase();
            String inputLine;
            while ((inputLine = in.readLine()) != null) {
                System.out.println(inputLine);
                matchLine = matchLine.concat(inputLine);
            }
            matchLine = matchLine.trim().toLowerCase();
            System.out.println(matchLine);
            in.close();
            uc.disconnect();
            if (matchLine == null ? this.successString.toLowerCase() != null
                    : !matchLine.equals(this.successString.toLowerCase())) {
                throw new BadCredentialsException(
                        String.format("Response %s didn't match %s", matchLine, this.successString));
            }
        }
        GrantedAuthority[] groups = new GrantedAuthority[0];
        UserDetails d = new User(username, password, true, true, true, true, groups);
        return d;
    } catch (Exception e) {
        throw new AuthenticationServiceException("Failed", e);
    }
}

From source file:com.interacciones.mxcashmarketdata.mama.queue.SendMessageToMama.java

private void msgE(Parser message) {
    if (_pubNormal) {
        mamaMsg.clear();/*from   w w w. j a  v  a  2  s .  c  om*/
        String emisora = message.Emisora().trim();
        mamaMsg.addString("PublisherTopic", 10002, emisora.concat(message.Serie().concat(message.TypeValue())));
        mamaMsg.addString("QouteTimestamp", 10004, format.format(new Date()));

        publisher = listPublisher.get(_topicNormal);
        publisher.send(mamaMsg);
    }
    if (_pubSetrib) {
        mamaMsgSetrib.clear();
        mamaMsgSetrib.addString("MessageNo", 10001, message.getCompleteMsg());

        publisher = listPublisher.get(_topicSetrib);
        publisher.send(mamaMsgSetrib);
    }
}

From source file:com.interacciones.mxcashmarketdata.mama.queue.SendMessageToMama.java

private void msgP_DP(Parser message) {
    if (_pubNormal) {
        mamaMsg.clear();/*  w  ww.ja v a  2s .co m*/
        String emisora = message.Emisora().trim();
        mamaMsg.addString("PublisherTopic", 10002, emisora.concat(message.Serie().concat(message.TypeValue())));
        mamaMsg.addString("QouteTimestamp", 10004, format.format(new Date()));

        publisher = listPublisher.get(_topicNormal);
        publisher.send(mamaMsg);
    }
    if (_pubSetrib) {
        mamaMsgSetrib.clear();
        mamaMsgSetrib.addString("MessageNo", 10001, message.getCompleteMsg());

        publisher = listPublisher.get(_topicSetrib);
        publisher.send(mamaMsgSetrib);
    }
}