List of usage examples for com.liferay.portal.kernel.util StringPool SLASH
String SLASH
To view the source code for com.liferay.portal.kernel.util StringPool SLASH.
Click Source Link
From source file:com.liferay.util.bridges.alloy.AlloyFriendlyURLMapper.java
License:Open Source License
@Override public void populateParams(String friendlyURLPath, Map<String, String[]> parameterMap, Map<String, Object> requestContext) { // Determine lifecycle from request method HttpServletRequest request = (HttpServletRequest) requestContext.get("request"); friendlyURLPath = request.getMethod() + friendlyURLPath.substring(getMapping().length() + 1); if (friendlyURLPath.endsWith(StringPool.SLASH)) { friendlyURLPath = friendlyURLPath.substring(0, friendlyURLPath.length() - 1); }//from w w w.ja v a2 s . co m Map<String, String> routeParameters = new HashMap<String, String>(); if (!router.urlToParameters(friendlyURLPath, routeParameters)) { if (_log.isWarnEnabled()) { _log.warn("No route could be found to match URL " + friendlyURLPath); } return; } String portletId = getPortletId(routeParameters); if (portletId == null) { return; } String namespace = PortalUtil.getPortletNamespace(portletId); addParameter(namespace, parameterMap, "p_p_id", portletId); addParameter(parameterMap, "p_p_lifecycle", getLifecycle(request)); populateParams(parameterMap, namespace, routeParameters); }
From source file:com.liferay.util.bridges.alloy.BaseAlloyControllerImpl.java
License:Open Source License
protected String buildIncludePath(String viewPath) { if (viewPath.equals(_VIEW_PATH_ERROR)) { return "/WEB-INF/jsp/".concat(portlet.getFriendlyURLMapping()).concat("/views/error.jsp"); }/* w w w.ja va2 s. c o m*/ StringBundler sb = new StringBundler(7); sb.append("/WEB-INF/jsp/"); sb.append(portlet.getFriendlyURLMapping()); sb.append("/views/"); sb.append(controllerPath); sb.append(StringPool.SLASH); sb.append(viewPath); sb.append(".jsp"); return sb.toString(); }
From source file:com.liferay.util.bridges.mvc.MVCPortlet.java
License:Open Source License
@Override public void init() throws PortletException { super.init(); templatePath = _getInitParameter("template-path"); if (Validator.isNull(templatePath)) { templatePath = StringPool.SLASH; } else if (templatePath.contains(StringPool.BACK_SLASH) || templatePath.contains(StringPool.DOUBLE_SLASH) || templatePath.contains(StringPool.PERIOD) || templatePath.contains(StringPool.SPACE)) { throw new PortletException("template-path " + templatePath + " has invalid characters"); } else if (!templatePath.startsWith(StringPool.SLASH) || !templatePath.endsWith(StringPool.SLASH)) { throw new PortletException("template-path " + templatePath + " must start and end with a /"); }/*from w w w .j a va 2 s . com*/ aboutTemplate = _getInitParameter("about-template"); configTemplate = _getInitParameter("config-template"); editTemplate = _getInitParameter("edit-template"); editDefaultsTemplate = _getInitParameter("edit-defaults-template"); editGuestTemplate = _getInitParameter("edit-guest-template"); helpTemplate = _getInitParameter("help-template"); previewTemplate = _getInitParameter("preview-template"); printTemplate = _getInitParameter("print-template"); viewTemplate = _getInitParameter("view-template"); clearRequestParameters = GetterUtil.getBoolean(getInitParameter("clear-request-parameters")); copyRequestParameters = GetterUtil.getBoolean(getInitParameter("copy-request-parameters")); String packagePrefix = getInitParameter(ActionCommandCache.ACTION_PACKAGE_NAME); if (Validator.isNotNull(packagePrefix)) { _actionCommandCache = new ActionCommandCache(packagePrefix); } }
From source file:com.liferay.util.bridges.php.PHPServletRequest.java
License:Open Source License
@Override public String getContextPath() { return StringPool.SLASH; }
From source file:com.liferay.util.bridges.php.PHPServletRequest.java
License:Open Source License
@Override public StringBuffer getRequestURL() { StringBuffer sb = new StringBuffer(); sb.append(getRequest().getProtocol()); sb.append("://"); sb.append(getRequest().getRemoteHost()); sb.append(StringPool.COLON);/* w w w . jav a2 s. c om*/ sb.append(getRequest().getServerPort()); sb.append(StringPool.SLASH); sb.append(getRequestURI()); return sb; }
From source file:com.liferay.util.bridges.wai.WAIFriendlyURLMapper.java
License:Open Source License
public String buildPath(LiferayPortletURL liferayPortletURL) { String portletId = liferayPortletURL.getPortletId(); String prefix = portletId;//from www . j a va 2 s .c om int pos = portletId.indexOf(PortletConstants.WAR_SEPARATOR); if (pos != -1) { prefix = portletId.substring(0, pos); } String appUrl = GetterUtil.getString(liferayPortletURL.getParameter("appURL")); liferayPortletURL.addParameterIncludedInPath("p_p_id"); return StringPool.SLASH + _MAPPING + StringPool.SLASH + prefix + StringPool.SLASH + appUrl; }
From source file:com.liferay.util.ldap.LDAPUtil.java
License:Open Source License
public static String getFullProviderURL(String baseURL, String baseDN) { return baseURL + StringPool.SLASH + baseDN; }
From source file:com.liferay.web.extender.internal.webbundle.WebBundleProcessor.java
License:Open Source License
public void process() throws IOException { String webContextpath = MapUtil.getString(_parameterMap, OSGiConstants.WEB_CONTEXTPATH); if (!webContextpath.startsWith(StringPool.SLASH)) { webContextpath = StringPool.SLASH.concat(webContextpath); }//www .j a v a2 s. c o m List<AutoDeployListener> autoDeployListeners = GlobalStartupAction.getAutoDeployListeners(); for (AutoDeployListener autoDeployListener : autoDeployListeners) { if (autoDeployListener instanceof OSGiAutoDeployListener) { continue; } try { autoDeployListener.deploy(_file, webContextpath); } catch (AutoDeployException e) { e.printStackTrace(); } } String deployDir = null; try { deployDir = DeployUtil.getAutoDeployDestDir(); } catch (Exception e) { throw new IOException(e); } _deployedAppFolder = new File(deployDir, webContextpath); if (!_deployedAppFolder.exists() || !_deployedAppFolder.isDirectory()) { return; } File manifestFile = new File(_deployedAppFolder, "META-INF/MANIFEST.MF"); if (!manifestFile.exists()) { FileUtil.mkdirs(manifestFile.getParent()); manifestFile.createNewFile(); } Manifest manifest = new Manifest(); FileInputStream fis = new FileInputStream(manifestFile); try { manifest.read(fis); } finally { fis.close(); } _resourcePaths = new ArrayList<String>(); processPaths(_deployedAppFolder, _deployedAppFolder.toURI()); Attributes attributes = manifest.getMainAttributes(); attributes.putValue(OSGiConstants.WEB_CONTEXTPATH, webContextpath); // If it's not a bundle, then we need to manipulate it into one. The // spec states that this is only true when the Manifest does not contain // a Bundle_SymbolicName header. if (!attributes.containsKey(Constants.BUNDLE_SYMBOLICNAME)) { processBundleSymbolicName(attributes, webContextpath); processBundleVersion(attributes); processBundleManifestVersion(attributes); processPortletXML(webContextpath); processLiferayPortletXML(webContextpath); // The order of these operations is important processBundleClassPath(attributes); processDeclarativeReferences(attributes); processExportImportPackage(attributes); } if (!attributes.containsKey(Attributes.Name.MANIFEST_VERSION.toString())) { attributes.putValue(Attributes.Name.MANIFEST_VERSION.toString(), "1.0"); } FileOutputStream fos = new FileOutputStream(manifestFile); try { manifest.write(fos); } finally { fos.close(); } }
From source file:com.liferay.web.extender.internal.webbundle.WebBundleProcessor.java
License:Open Source License
protected void processClass(DependencyVisitor dependencyVisitor, String className, InputStream inputStream, List<String> packageList) throws IOException { try {//from w w w . ja va 2 s. c o m ClassReader classReader = new ClassReader(inputStream); classReader.accept(dependencyVisitor, 0); Set<String> packages = dependencyVisitor.getPackages(); for (String packageName : packages) { packageList.add(packageName.replaceAll(StringPool.SLASH, StringPool.PERIOD)); } } catch (NullPointerException npe) { //npe.printStackTrace(); } }
From source file:com.liferay.web.extender.internal.webbundle.WebBundleProcessor.java
License:Open Source License
protected void processClassDependencies(File classFile) throws IOException { DependencyVisitor dependencyVisitor = new DependencyVisitor(); FileInputStream fis = new FileInputStream(classFile); processClass(dependencyVisitor, classFile.getName(), fis, _referencedPackages); Set<String> jarPackages = dependencyVisitor.getGlobals().keySet(); for (String jarPackage : jarPackages) { _classProvidedPackages.add(jarPackage.replaceAll(StringPool.SLASH, StringPool.PERIOD)); }/*from w w w. j a v a 2 s. c om*/ }