List of usage examples for java.lang String concat
public String concat(String str)
From source file:org.nuxeo.ecm.automation.client.jaxrs.spi.auth.BasicAuthInterceptor.java
public void setAuth(String username, String password) { String info = username.concat(":").concat(password); token = "Basic " + Base64.encode(info); }
From source file:edu.harvard.iq.dataverse.rserve.RemoteDataFrameService.java
private static String readLocalResource(String path) { dbgLog.fine(String.format("Data Frame Service: readLocalResource: reading local path \"%s\"", path)); // Get stream InputStream resourceStream = RemoteDataFrameService.class.getResourceAsStream(path); String resourceAsString = ""; // Try opening a buffered reader stream try {/* w w w .j av a2 s.com*/ BufferedReader rd = new BufferedReader(new InputStreamReader(resourceStream, "UTF-8")); String line = null; while ((line = rd.readLine()) != null) { resourceAsString = resourceAsString.concat(line + "\n"); } resourceStream.close(); } catch (IOException ex) { dbgLog.warning(String.format( "RDATAFileReader: (readLocalResource) resource stream from path \"%s\" was invalid", path)); } // Return string return resourceAsString; }
From source file:com.ckfinder.connector.utils.FileUtils.java
/** * creates file and all above folders that doesn"t exists. * @param file file to create./*from ww w . j a va 2 s. co m*/ * @param conf connector configuration * @param isFile if it is path to folder. * @throws IOException when io error occurs. */ public static void createPath(final File file, final IConfiguration conf, final boolean isFile) throws IOException { String path = file.getAbsolutePath(); // on Linux first path char - "/" is removed by StringTokenizer StringTokenizer st = new StringTokenizer(path, File.separator); // if path include "/" as a first char of path we have to add it manually String checkPath = (path.indexOf(File.separator) == 0) ? File.separator : ""; checkPath += (String) st.nextElement(); while (st.hasMoreElements()) { String string = (String) st.nextElement(); checkPath = checkPath.concat(File.separator + string); if (!(string.equals(file.getName()) && isFile)) { File dir = new File(checkPath); if (!dir.exists()) { mkdir(dir, conf); } } else { file.createNewFile(); } } }
From source file:UrlUtils.java
/** * Resolves a given relative URL against a base URL using the algorithm * depicted in <a href="http://www.faqs.org/rfcs/rfc1808.html">RFC1808</a>: * * Section 4: Resolving Relative URLs//from w ww.jav a 2 s . c om * * This section describes an example algorithm for resolving URLs within * a context in which the URLs may be relative, such that the result is * always a URL in absolute form. Although this algorithm cannot * guarantee that the resulting URL will equal that intended by the * original author, it does guarantee that any valid URL (relative or * absolute) can be consistently transformed to an absolute form given a * valid base URL. * * @param baseUrl The base URL in which to resolve the specification. * @param relativeUrl The relative URL to resolve against the base URL. * @return the resolved specification. */ private static Url resolveUrl(final Url baseUrl, final String relativeUrl) { final Url url = parseUrl(relativeUrl); // Step 1: The base URL is established according to the rules of // Section 3. If the base URL is the empty string (unknown), // the embedded URL is interpreted as an absolute URL and // we are done. if (baseUrl == null) { return url; } // Step 2: Both the base and embedded URLs are parsed into their // component parts as described in Section 2.4. // a) If the embedded URL is entirely empty, it inherits the // entire base URL (i.e., is set equal to the base URL) // and we are done. if (relativeUrl.length() == 0) { return new Url(baseUrl); } // b) If the embedded URL starts with a scheme name, it is // interpreted as an absolute URL and we are done. if (url.scheme_ != null) { return url; } // c) Otherwise, the embedded URL inherits the scheme of // the base URL. url.scheme_ = baseUrl.scheme_; // Step 3: If the embedded URL's <net_loc> is non-empty, we skip to // Step 7. Otherwise, the embedded URL inherits the <net_loc> // (if any) of the base URL. if (url.location_ != null) { return url; } url.location_ = baseUrl.location_; // Step 4: If the embedded URL path is preceded by a slash "/", the // path is not relative and we skip to Step 7. if ((url.path_ != null) && url.path_.startsWith("/")) { url.path_ = removeLeadingSlashPoints(url.path_); return url; } // Step 5: If the embedded URL path is empty (and not preceded by a // slash), then the embedded URL inherits the base URL path, // and if (url.path_ == null) { url.path_ = baseUrl.path_; // a) if the embedded URL's <params> is non-empty, we skip to // step 7; otherwise, it inherits the <params> of the base // URL (if any) and if (url.parameters_ != null) { return url; } url.parameters_ = baseUrl.parameters_; // b) if the embedded URL's <query> is non-empty, we skip to // step 7; otherwise, it inherits the <query> of the base // URL (if any) and we skip to step 7. if (url.query_ != null) { return url; } url.query_ = baseUrl.query_; return url; } // Step 6: The last segment of the base URL's path (anything // following the rightmost slash "/", or the entire path if no // slash is present) is removed and the embedded URL's path is // appended in its place. The following operations are // then applied, in order, to the new path: final String basePath = baseUrl.path_; String path = new String(); if (basePath != null) { final int lastSlashIndex = basePath.lastIndexOf('/'); if (lastSlashIndex >= 0) { path = basePath.substring(0, lastSlashIndex + 1); } } else { path = "/"; } path = path.concat(url.path_); // a) All occurrences of "./", where "." is a complete path // segment, are removed. int pathSegmentIndex; while ((pathSegmentIndex = path.indexOf("/./")) >= 0) { path = path.substring(0, pathSegmentIndex + 1).concat(path.substring(pathSegmentIndex + 3)); } // b) If the path ends with "." as a complete path segment, // that "." is removed. if (path.endsWith("/.")) { path = path.substring(0, path.length() - 1); } // c) All occurrences of "<segment>/../", where <segment> is a // complete path segment not equal to "..", are removed. // Removal of these path segments is performed iteratively, // removing the leftmost matching pattern on each iteration, // until no matching pattern remains. while ((pathSegmentIndex = path.indexOf("/../")) > 0) { final String pathSegment = path.substring(0, pathSegmentIndex); final int slashIndex = pathSegment.lastIndexOf('/'); if (slashIndex < 0) { continue; } if (!pathSegment.substring(slashIndex).equals("..")) { path = path.substring(0, slashIndex + 1).concat(path.substring(pathSegmentIndex + 4)); } } // d) If the path ends with "<segment>/..", where <segment> is a // complete path segment not equal to "..", that // "<segment>/.." is removed. if (path.endsWith("/..")) { final String pathSegment = path.substring(0, path.length() - 3); final int slashIndex = pathSegment.lastIndexOf('/'); if (slashIndex >= 0) { path = path.substring(0, slashIndex + 1); } } path = removeLeadingSlashPoints(path); url.path_ = path; // Step 7: The resulting URL components, including any inherited from // the base URL, are recombined to give the absolute form of // the embedded URL. return url; }
From source file:com.vmware.identity.idm.server.IdmLoginManager.java
private File getSecretFileLinux() { String filePath = LINUX_FILE_PATH; return new File(filePath.concat(SECRET_FILE)); }
From source file:eu.europa.ec.fisheries.uvms.spatial.service.util.MapConfigHelper.java
public static LayerDto convertToServiceLayer(ServiceLayerEntity serviceLayerEntity, String geoServerUrl, String bingApiKey, boolean isBaseLayer, Map<String, ReferenceDataPropertiesDto> referenceData) { LayerDto layerDto = new LayerDto(); String type = serviceLayerEntity.getProviderFormat().getServiceType(); layerDto.setType(type);/*from www.ja va 2s . co m*/ layerDto.setTitle(serviceLayerEntity.getName()); layerDto.setIsBaseLayer(isBaseLayer); layerDto.setShortCopyright(serviceLayerEntity.getShortCopyright()); layerDto.setLongCopyright(serviceLayerEntity.getLongCopyright()); if (!(type.equalsIgnoreCase("OSM") || type.equalsIgnoreCase("OSEA") || type.equalsIgnoreCase("BING"))) { layerDto.setUrl( geoServerUrl.concat(serviceLayerEntity.getProviderFormat().getServiceType().toLowerCase())); } if (type.equalsIgnoreCase("WMS") && !serviceLayerEntity.getIsInternal()) { layerDto.setUrl(serviceLayerEntity.getServiceUrl()); } layerDto.setServerType(serviceLayerEntity.getIsInternal() ? GEOSERVER : null); layerDto.setLayerGeoName(serviceLayerEntity.getGeoName()); layerDto.setAreaLocationTypeName(serviceLayerEntity.getAreaType().getTypeName()); if (!(StringUtils.isEmpty(serviceLayerEntity.getStyleGeom()) && StringUtils.isEmpty(serviceLayerEntity.getStyleLabel()) && StringUtils.isEmpty(serviceLayerEntity.getStyleLabelGeom()))) { layerDto.setStyles(new StylesDto(serviceLayerEntity.getStyleGeom(), serviceLayerEntity.getStyleLabel(), serviceLayerEntity.getStyleLabelGeom())); } if (type.equalsIgnoreCase("BING")) { layerDto.setApiKey(bingApiKey); } setCql(referenceData, layerDto, serviceLayerEntity.getAreaType()); layerDto.setTypeName(serviceLayerEntity.getAreaType().getTypeName()); return layerDto; }
From source file:com.ibm.zdu.ZduApplication.java
@RequestMapping(value = "/upload", method = RequestMethod.GET, produces = "application/json") @ApiOperation(value = "uploadToZendesk", nickname = "uploadToZendesk") @ApiResponses(value = { @ApiResponse(code = 200, message = "Success", response = String.class), @ApiResponse(code = 401, message = "Unauthorized"), @ApiResponse(code = 403, message = "Forbidden"), @ApiResponse(code = 404, message = "Not Found"), @ApiResponse(code = 500, message = "Failure") }) public String uploadToZendesk(@RequestParam(value = "configFile") String configFile) throws Exception { logger.info("Executing GET /upload?config={}", configFile); ZduConfig config = Utils.getConfiguration(configFile); //TODO read all CSV files that are placed in the path String csvPath = config.getInputCsvPath(); String fileName = csvPath.concat("\\people_anz_update.csv"); //Execute the batch process executeBatchProcess(config);//w w w . j a v a2s .c o m /* JobParameters jobParameters = new JobParametersBuilder().addDate("date", new Date()).toJobParameters(); JobStatusManager statusManager = BatchContextManager.getInstance().initializeStatusManager(job.getName(), config); jobLauncher.run(job, jobParameters);*/ // TODO Return appropriate report object String result = config.getInputCsvPath(); logger.info(result); return result; }
From source file:be.bittich.dynaorm.dialect.MySQLDialect.java
@Override public String where(String request) { return request.concat(WHERE); }
From source file:be.bittich.dynaorm.dialect.MySQLDialect.java
@Override public String andWhere(String request) { return request.concat(AND); }
From source file:com.htm.security.UserManagerBasicImpl.java
protected String createCredential(String userid, String password) { return userid.concat(CREDENTIAL_DELIMITER).concat(password); }