List of usage examples for java.lang String concat
public String concat(String str)
From source file:info.ajaxplorer.client.http.AjxpAPI.java
public URI getMkdirUri(String file) throws URISyntaxException { String url = getGetActionUrl("mkdir"); try {//from w ww .j a v a 2 s .c o m url = url.concat("dir=" + java.net.URLEncoder .encode(RestStateHolder.getInstance().getDirectory().getPath(true), "UTF-8")); url = url + "&dirname=" + java.net.URLEncoder.encode(file, "UTF-8"); return returnUriFromString(url); } catch (UnsupportedEncodingException e) { e.printStackTrace(); return null; } }
From source file:info.ajaxplorer.client.http.AjxpAPI.java
public URI getRenameUri(Node targetNode, String newName) throws URISyntaxException { String url = getGetActionUrl("rename"); try {/*www .ja va2 s . com*/ url = url.concat("file=" + java.net.URLEncoder.encode(targetNode.getPath(true), "UTF-8")); url = url + "&filename_new=" + java.net.URLEncoder.encode(newName, "UTF-8"); return returnUriFromString(url); } catch (UnsupportedEncodingException e) { e.printStackTrace(); return null; } }
From source file:info.ajaxplorer.client.http.AjxpAPI.java
public URI getRenameUri(Node targetNode, Node destNode) throws URISyntaxException { String url = getGetActionUrl("rename"); try {/*from w w w. j a v a2 s . c o m*/ url = url.concat("file=" + java.net.URLEncoder.encode(targetNode.getPath(true), "UTF-8")); url = url + "&dest=" + java.net.URLEncoder.encode(destNode.getPath(true), "UTF-8"); return returnUriFromString(url); } catch (UnsupportedEncodingException e) { e.printStackTrace(); return null; } }
From source file:org.jasig.portlet.newsreader.dao.HibernateNewsStore.java
public List<PredefinedNewsDefinition> getHiddenPredefinedNewsDefinitions(Long setId, Set<String> roles) { try {/*from www. j a v a 2 s . c om*/ String query = "from PredefinedNewsDefinition def " + "where :setId not in (select config.newsSet.id " + "from def.userConfigurations config) "; for (int i = 0; i < roles.size(); i++) { query = query.concat("and :role" + i + " not in elements(def.defaultRoles) "); } Query q = this.getSession().createQuery(query); q.setLong("setId", setId); int count = 0; for (String role : roles) { q.setString("role" + count, role); count++; } return (List<PredefinedNewsDefinition>) q.list(); } catch (HibernateException ex) { throw convertHibernateAccessException(ex); } }
From source file:info.ajaxplorer.client.http.AjxpAPI.java
public URI getDeleteUri(String path) throws URISyntaxException { String url = getGetActionUrl("delete"); try {/*from ww w. ja va 2 s . c om*/ url = url.concat("dir=" + java.net.URLEncoder .encode(RestStateHolder.getInstance().getDirectory().getPath(true), "UTF-8")); url = url.concat("&file=" + java.net.URLEncoder.encode(path, "UTF-8")); return returnUriFromString(url); } catch (UnsupportedEncodingException e) { e.printStackTrace(); return null; } }
From source file:info.ajaxplorer.client.http.AjxpAPI.java
public URI getMkfileUri(String file) throws URISyntaxException { String url = getGetActionUrl("mkfile"); try {//from w w w. j av a 2s .c o m url = url.concat("dir=" + java.net.URLEncoder .encode(RestStateHolder.getInstance().getDirectory().getPath(true), "UTF-8")); url = url + "&filename=" + java.net.URLEncoder.encode(file, "UTF-8"); return returnUriFromString(url); } catch (UnsupportedEncodingException e) { e.printStackTrace(); return null; } }
From source file:de.hpi.fgis.hdrs.Triple.java
/** * Create a pattern. Pass null for wild cards (*) *///from w ww . j a va2 s .co m private static Triple newInstance(String subject, String predicate, String object, int multiplicity) { String buf = ""; int slen, plen, olen; if (null != subject) { buf = buf.concat(subject); slen = subject.length(); } else { slen = -1; } if (null != predicate) { buf = buf.concat(predicate); plen = predicate.length(); } else { plen = -1; } if (null != object) { buf = buf.concat(object); olen = object.length(); } else { olen = -1; } return new Triple(buf.getBytes(), 0, (short) slen, (short) plen, olen, multiplicity); }
From source file:businesslayer.businesslogic.PortofolioforuserDelegation.java
public String photo() throws FileNotFoundException, IOException { String imageDataString = ""; for (int i = 0; i < 3; i++) { String fileName = "1.png"; String filePath = "D:\\king\\" + fileName; File file = new File(filePath); FileInputStream imageInFile = new FileInputStream(file); byte imageData[] = new byte[(int) file.length()]; imageInFile.read(imageData);//from www. j ava 2 s . co m imageDataString = imageDataString.concat("," + encodeImage(imageData)); //inputStream.read(imageBytes); } return imageDataString; }
From source file:com.klarna.checkout.stubs.HttpClientStub.java
/** * Uppercase data to simulate it having passed on to the server. * * @throws IOException in case of an IO error. *///from w w w.j av a 2 s .co m private void fixData() throws IOException { if (this.httpUriReq.getMethod().equals("POST")) { HttpEntityEnclosingRequest h = (HttpEntityEnclosingRequest) this.httpUriReq; InputStream is = h.getEntity().getContent(); java.util.Scanner s = new java.util.Scanner(is).useDelimiter("\\A"); String str = ""; while (s.hasNext()) { str = str.concat(s.next()); } JSONParser jsonParser = new JSONParser(); HashMap<String, String> obj = null; try { obj = (HashMap<String, String>) jsonParser.parse(str); } catch (ParseException ex) { Logger.getLogger(HttpClientStub.class.getName()).log(Level.SEVERE, null, ex); } if (obj != null && obj.containsKey("test")) { str = obj.get("test").toUpperCase(); this.data.put("test", str); } ByteArrayInputStream in = new ByteArrayInputStream(JSONObject.toJSONString(this.data).getBytes()); this.lastResponse.setEntity(new InputStreamEntity(in, in.available())); } }
From source file:com.guess.license.plate.Task.LoadingTaskConn.java
private ServerError tryToGetEntity(String conn, String objJSName, String extension, ArrayList<HttpEntity> objJSEntities) { // Building string for URI String uriPath = WebConf.URI_PATH; String uriFile = WebConf.URI_FILE; String uriSeparator = WebConf.URI_SEP; String uri = uriPath.concat(uriFile).concat(uriSeparator); // Building string for Parameters String firstPar = WebConf.PARAMETER[0].concat(objJSName); String separator = WebConf.PAR_SEP; String secondPar = WebConf.PARAMETER[1].concat(extension); String parameters = firstPar.concat(separator).concat(secondPar); HttpClient client = ThreadSafeHttpClientFactory.INSTANCE.getThreadSafeHttpClient(); HttpGet httpGet = new HttpGet(conn.concat(uri).concat(parameters)); try {//from w ww. j a v a2 s. c o m HttpResponse response = client.execute(httpGet); StatusLine statusLine = response.getStatusLine(); int statusCode = statusLine.getStatusCode(); if (statusCode == WebConf.STATUS_CODE) { HttpEntity entity = response.getEntity(); objJSEntities.add(entity); } else { return ServerError.CONNECTION; } } catch (ClientProtocolException ee) { return ServerError.PROTOCOL; } catch (IOException ee) { return ServerError.STREAM; } return ServerError.NO_ERROR; }