List of usage examples for java.lang String concat
public String concat(String str)
From source file:cc.gospy.core.util.StringHelper.java
public static String toAbsoluteUrl(final String protocol, final String host, final String parentUrl, final String anyUrl) { String res, path = anyUrl.trim(); if (path.matches("^https?://.*")) { res = path;//from w w w .ja va 2 s . c o m } else if (path.startsWith("//")) { res = protocol.concat(":").concat(path); } else if (path.startsWith("/")) { res = protocol.concat("://").concat(host).concat(path); } else { res = parentUrl != null ? getNavigateTargetUrl(parentUrl, path) : protocol.concat("://").concat(host).concat("/".concat(path)); } res = res.indexOf('#') != -1 ? res.substring(0, res.indexOf('#')) : res; // remove in-page jump res = res.endsWith("/") ? res.substring(0, res.length() - 1) : res; // avoid duplicate links return res; }
From source file:de.ingrid.portal.global.UtilsMapServiceManager.java
/** * Get tmp directory//from w w w . jav a2s . c o m * * @return tmp directory * @throws ConfigurationException * @throws Exception */ public static String getTmpDirectory(String path) throws ConfigurationException, Exception { if (tmpDirectory == null) { setTmpDirectory(path.concat("/")); } return tmpDirectory; }
From source file:bs.ws1.dm.itg.App.java
private static void readIdoc() throws FileNotFoundException { LOG.info("############################################# read iDOC"); String path2xml = "src/main/resources/xml/"; String path2output = "src/main/resources/output/"; Delvry03IdocStrategy delvry03IdocStrategy = new Delvry03IdocStrategy(); FileInputStream fileInputStream = new FileInputStream(path2xml + "DESADV_49502236.xml"); //FileInputStream fileInputStream = new FileInputStream(path2xml + "DESADV_ch4.xml"); String output = ""; String separator = "|"; try {/*from www . ja v a 2s . c om*/ IDOC idoc = delvry03IdocStrategy.getIdoc(fileInputStream, Helper.IsToValidateXsd.TRUE); EDIDC40 edidc40 = idoc.getEDIDC40(); LOG.info("docType=" + edidc40.getIDOCTYP()); output = output.concat(edidc40.getIDOCTYP() + separator); LOG.info("docNum=" + edidc40.getDOCNUM()); output = output.concat(edidc40.getDOCNUM()); output = output.concat("\n"); output = output.concat("MATNR" + separator); output = output.concat("POSNR" + separator); output = output.concat("BSTNR" + separator); output = output.concat("BSTDT" + separator); output = output.concat("POSEX" + separator); output = output.concat("\n"); output = output.concat(edidc40.getDOCNUM() + separator); List<E1EDL20> e1edl20s = idoc.getE1EDL20(); for (E1EDL20 e1edl20 : e1edl20s) { List<E1EDL24> e1edl24s = e1edl20.getE1EDL24(); for (E1EDL24 e1edl24 : e1edl24s) { List<E1EDL41> e1edl41s = e1edl24.getE1EDL41(); LOG.info("MATNR=" + e1edl24.getMATNR()); output = output.concat(e1edl24.getMATNR() + separator); LOG.info("POSNR=" + e1edl24.getPOSNR()); output = output.concat(e1edl24.getPOSNR() + separator); for (E1EDL41 e1edl41 : e1edl41s) { LOG.info("BSTNR=" + e1edl41.getBSTNR()); output = output.concat(e1edl41.getBSTNR() + separator); LOG.info("BSTDT=" + e1edl41.getBSTDT()); output = output.concat(e1edl41.getBSTDT() + separator); LOG.info("POSEX=" + e1edl41.getPOSEX()); output = output.concat(e1edl41.getPOSEX()); } output = output.concat("\n"); } } writeToFile(output, path2output + "delvry03_report.csv"); } catch (ServiceException ex) { Logger.getLogger(App.class.getName()).log(Level.SEVERE, null, ex); } }
From source file:co.cask.cdap.security.server.ExternalAuthenticationServerSSLTest.java
@BeforeClass public static void beforeClass() throws Exception { URL certUrl = ExternalAuthenticationServerSSLTest.class.getClassLoader().getResource("cert.jks"); Assert.assertNotNull(certUrl);/*from w w w.j av a2s . c o m*/ String authHandlerConfigBase = Constants.Security.AUTH_HANDLER_CONFIG_BASE; CConfiguration cConf = CConfiguration.create(); SConfiguration sConf = SConfiguration.create(); cConf.set(Constants.Security.AUTH_SERVER_BIND_ADDRESS, "127.0.0.1"); cConf.set(Constants.Security.SSL_ENABLED, "true"); cConf.set(Constants.Security.AuthenticationServer.SSL_PORT, "0"); cConf.set(authHandlerConfigBase.concat("useLdaps"), "true"); cConf.set(authHandlerConfigBase.concat("ldapsVerifyCertificate"), "false"); sConf.set(Constants.Security.AuthenticationServer.SSL_KEYSTORE_PATH, certUrl.getPath()); configuration = cConf; sConfiguration = sConf; String keystorePassword = sConf.get(Constants.Security.AuthenticationServer.SSL_KEYSTORE_PASSWORD); KeyStoreKeyManager keyManager = new KeyStoreKeyManager(certUrl.getFile(), keystorePassword.toCharArray()); SSLUtil sslUtil = new SSLUtil(keyManager, new TrustAllTrustManager()); ldapListenerConfig = InMemoryListenerConfig.createLDAPSConfig("LDAP", InetAddress.getByName("127.0.0.1"), ldapPort, sslUtil.createSSLServerSocketFactory(), sslUtil.createSSLSocketFactory()); setup(); }
From source file:org.fiware.apps.repository.it.IntegrationTestHelper.java
public static String resourceToJson(Resource resource) { String resourceString = "{\n"; if (resource.getContentFileName() != null) { resourceString = resourceString .concat("\"contentFileName\" : \"" + resource.getContentFileName() + "\",\n"); }//from w w w. j a v a2 s. co m if (resource.getContentMimeType() != null) { resourceString = resourceString .concat("\"contentMimeType\" : \"" + resource.getContentMimeType() + "\",\n"); } if (resource.getContentUrl() != null) { resourceString = resourceString.concat("\"contentUrl\" : \"" + resource.getContentUrl() + "\",\n"); } if (resource.getCreationDate() != null) { resourceString = resourceString .concat("\"creationDate\" : \"" + resource.getCreationDate().toString() + "\",\n"); } if (resource.getCreator() != null) { resourceString = resourceString.concat("\"creator\" : \"" + resource.getCreator() + "\",\n"); } if (resource.getId() != null) { resourceString = resourceString.concat("\"id\" : \"" + resource.getId() + "\",\n"); } if (resource.getModificationDate() != null) { resourceString = resourceString .concat("\"modificationDate\" : \"" + resource.getModificationDate().toString() + "\",\n"); } if (resource.getName() != null) { resourceString = resourceString.concat("\"name\" : \"" + resource.getName() + "\",\n"); } resourceString = resourceString.concat("\"type\" : \"resource\"\n"); return resourceString.concat("\n}"); }
From source file:com.asual.summer.core.util.RequestUtils.java
public static String contextRelative(String uri, boolean contextRelative) { if (uri != null && uri.startsWith("/")) { String contextPath = getRequest().getContextPath(); uri = uri.replaceFirst("^" + contextPath + "/?", "/"); if (contextRelative) { uri = contextPath.concat(uri); }/*from w w w. j a va 2 s . com*/ } return uri; }
From source file:org.gvnix.service.roo.addon.addon.security.WSServiceSecurityMetadata.java
/** * Compute certificate keystore file path (relative to classpath) for a * serviceClass and certificateFileName//from ww w . jav a 2s. co m * * @param serviceClass * @param certificateFileName * @return */ public static String getCertificatePath(JavaType serviceClass, String certificateFileName) { String path = serviceClass.getFullyQualifiedTypeName(); path = path.replace('.', '/'); path = path.substring(0, path.lastIndexOf('/') + 1); return path.concat(certificateFileName); }
From source file:co.cask.cdap.security.server.ExternalLDAPAuthenticationServerSSLTest.java
@BeforeClass public static void beforeClass() throws Exception { URL certUrl = ExternalLDAPAuthenticationServerSSLTest.class.getClassLoader().getResource("cert.jks"); Assert.assertNotNull(certUrl);/*w w w . j av a 2s. c o m*/ String authHandlerConfigBase = Constants.Security.AUTH_HANDLER_CONFIG_BASE; CConfiguration cConf = CConfiguration.create(); SConfiguration sConf = SConfiguration.create(); cConf.set(Constants.Security.AUTH_SERVER_BIND_ADDRESS, "127.0.0.1"); cConf.set(Constants.Security.SSL.EXTERNAL_ENABLED, "true"); cConf.set(Constants.Security.AuthenticationServer.SSL_PORT, "0"); cConf.set(authHandlerConfigBase.concat("useLdaps"), "true"); cConf.set(authHandlerConfigBase.concat("ldapsVerifyCertificate"), "false"); sConf.set(Constants.Security.AuthenticationServer.SSL_KEYSTORE_PATH, certUrl.getPath()); configuration = cConf; sConfiguration = sConf; String keystorePassword = sConf.get(Constants.Security.AuthenticationServer.SSL_KEYSTORE_PASSWORD); KeyStoreKeyManager keyManager = new KeyStoreKeyManager(certUrl.getFile(), keystorePassword.toCharArray()); SSLUtil sslUtil = new SSLUtil(keyManager, new TrustAllTrustManager()); ldapListenerConfig = InMemoryListenerConfig.createLDAPSConfig("LDAP", InetAddress.getByName("127.0.0.1"), ldapPort, sslUtil.createSSLServerSocketFactory(), sslUtil.createSSLSocketFactory()); testServer = new ExternalLDAPAuthenticationServerSSLTest(); testServer.setup(); }
From source file:dynamicrefactoring.util.io.FileManager.java
/** * Obtiene la ruta completa de un fichero determinado, sin la extensin del * fichero.//from ww w .j a v a 2s .c o m * * @param filePath * la ruta del fichero. * * @return la ruta del fichero con el nombre del fichero sin extensin. */ public static String getFilePathWithoutExtension(String filePath) { String temp = new String(); if (filePath.lastIndexOf(".") >= 0) //$NON-NLS-1$ temp = temp.concat(filePath.substring(0, filePath.lastIndexOf("."))); //$NON-NLS-1$ // Si es un fichero sin extensin. else temp = temp.concat(filePath); return temp; }
From source file:dynamicrefactoring.util.io.FileManager.java
/** * Genera un nombre comprensible para un fichero determinado. * /* w w w. ja v a 2 s .c o m*/ * @param fileName el nombre del fichero. * * @return el nombre comprensible generado. */ public static String getReadableName(String fileName) { String temp = new String(); if (fileName.lastIndexOf(".") >= 0) { //$NON-NLS-1$ temp = temp.concat(fileName.substring(0, fileName.lastIndexOf("."))); //$NON-NLS-1$ temp = temp.concat(" (" + fileName + ")"); //$NON-NLS-1$ //$NON-NLS-2$ } else temp = temp.concat(fileName); return temp; }