List of usage examples for org.apache.commons.lang StringUtils substringAfterLast
public static String substringAfterLast(String str, String separator)
Gets the substring after the last occurrence of a separator.
From source file:org.beangle.ems.security.nav.model.MenuBean.java
public String getIndexno() { String indexno = StringUtils.substringAfterLast(code, "."); if (StringUtils.isEmpty(indexno)) { indexno = code;//from w ww . j av a2 s . c o m } return indexno; }
From source file:org.beangle.emsapp.system.action.FileMimeType.java
public String getMimeType(File file) { String ext = StringUtils.substringAfterLast(file.getName(), "."); String mimeType = mimeTypeProvider.getMimeType(ext, "application/x-msdownload"); return StringUtils.replace(mimeType, "/", "-"); }
From source file:org.beangle.emsapp.system.action.FileMimeType.java
public boolean isTextType(File file) { String ext = StringUtils.substringAfterLast(file.getName(), "."); String mimeType = mimeTypeProvider.getMimeType(ext, "application/x-msdownload"); boolean text = mimeType.contains("text"); if (!text) {//from w ww . j a v a 2 s . c o m return texts.contains(ext); } else { return text; } }
From source file:org.beangle.model.transfer.importer.MultiEntityImporter.java
private boolean isForeigner(String attr) { String property = StringUtils.substringAfterLast(attr, "."); return foreignerKeys.contains(property); }
From source file:org.beangle.struts2.view.component.Component.java
public <T> T getBean(Class<T> cls) { try {/*from w w w . j a v a2 s . c o m*/ ApplicationContext ctx = WebApplicationContextUtils .getWebApplicationContext(ServletActionContext.getServletContext()); String name = StringUtils.uncapitalize(StringUtils.substringAfterLast(cls.getName(), ".")); @SuppressWarnings("unchecked") T t = (T) ctx.getBean(name); return t; } catch (Exception e) { e.printStackTrace(); return null; } }
From source file:org.beangle.web.io.DefaultStreamDownloader.java
protected void addContent(HttpServletRequest request, HttpServletResponse response, String attach) { String contentType = response.getContentType(); if (null == contentType) { contentType = mimeTypeProvider.getMimeType(StringUtils.substringAfterLast(attach, "."), "application/x-msdownload"); response.setContentType(contentType); logger.debug("set content type {} for {}", contentType, attach); }//from www. ja v a 2s . c o m String encodeName = encodeAttachName(request, attach); response.setHeader("Content-Disposition", "attachment; filename=" + encodeName); response.setHeader("Location", encodeName); }
From source file:org.beangle.web.io.DefaultStreamDownloader.java
public static String getAttachName(String name, String display) { String attch_name = ""; String ext = StringUtils.substringAfterLast(name, "."); if (StringUtils.isBlank(display)) { attch_name = getFileName(name);/*w ww. j av a2 s. c om*/ } else { attch_name = display; if (!attch_name.endsWith("." + ext)) { attch_name += "." + ext; } } return attch_name; }
From source file:org.betaconceptframework.astroboa.client.service.AbstractClientServiceWrapper.java
private void initialize(String serverHostNameAndorPortToConnect) { if (StringUtils.isBlank(serverHostNameAndorPortToConnect)) { //Set default URL if none provided serverHostNameAndorPortToConnect = AstroboaClient.INTERNAL_CONNECTION + ":" + DEFAULT_PORT; } else {// w w w . j a v a 2 s . c o m //Set port if not provided if (!serverHostNameAndorPortToConnect.contains(":")) { serverHostNameAndorPortToConnect = serverHostNameAndorPortToConnect.concat(":" + DEFAULT_PORT); } else { if (StringUtils.isBlank(StringUtils.substringAfterLast(serverHostNameAndorPortToConnect, ":"))) { serverHostNameAndorPortToConnect = serverHostNameAndorPortToConnect.concat(DEFAULT_PORT); } } } resetService(); this.serverHostNameOrIpAndPortDelimitedWithSemiColon = serverHostNameAndorPortToConnect; this.serverHostNameOrIp = StringUtils.substringBefore(serverHostNameAndorPortToConnect, ":"); this.port = StringUtils.substringAfter(serverHostNameAndorPortToConnect, ":"); loadService(); }
From source file:org.betaconceptframework.astroboa.configuration.W3CRelatedSchemaEntityResolver.java
private InputSource locateEntity(String systemId, String publicId) throws IOException { URL xsdOrDtdLocation = null;/* ww w . j a va 2s . co m*/ if (publicId != null && schemaURLsPerPublicId.containsKey(publicId)) { xsdOrDtdLocation = schemaURLsPerPublicId.get(publicId); } if (systemId == null) { return null; } String xsdOrDtdFilename = (systemId.contains(CmsConstants.FORWARD_SLASH) ? StringUtils.substringAfterLast(systemId, CmsConstants.FORWARD_SLASH) : systemId); //Check if schema is available locally if (xsdOrDtdLocation == null) { xsdOrDtdLocation = this.getClass() .getResource(xmlSchemaHomeDir + CmsConstants.FORWARD_SLASH + xsdOrDtdFilename); } //Try on the WEB if (xsdOrDtdLocation == null) { xsdOrDtdLocation = new URL(systemId); } try { InputSource is = new InputSource(xsdOrDtdLocation.openStream()); //System Id is the path of this URL is.setSystemId(xsdOrDtdLocation.toString()); is.setPublicId(publicId); schemaURLsPerPublicId.put(publicId, xsdOrDtdLocation); return is; } catch (Throwable isEx) { //Log a warning and let the Xerces parser to locate the schema LoggerFactory.getLogger(getClass()).warn("Unable to resolve schema for " + publicId + " " + systemId + " in URL " + xsdOrDtdLocation.toString(), isEx); //continue with parser provided by Java. If schema cannot be located, an exception will be thrown return null; } }
From source file:org.betaconceptframework.astroboa.console.jsf.richfaces.LazyLoadingCmsPropertyForContentObjectEditTreeNodeRichFaces.java
private String extractIndexFromFullPath(String fullPath) { if (StringUtils.isBlank(fullPath)) return ""; String index = StringUtils.substringAfterLast(fullPath, CmsConstants.LEFT_BRACKET); if (StringUtils.isBlank(index) || index.startsWith("0")) return ""; return CmsConstants.LEFT_BRACKET + index; }