Example usage for com.liferay.portal.kernel.util StringPool SLASH

List of usage examples for com.liferay.portal.kernel.util StringPool SLASH

Introduction

In this page you can find the example usage for com.liferay.portal.kernel.util StringPool SLASH.

Prototype

String SLASH

To view the source code for com.liferay.portal.kernel.util StringPool SLASH.

Click Source Link

Usage

From source file:com.liferay.alloy.mvc.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 ww w.j  av  a2s  .c  o  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));

    String format = routeParameters.get("format");

    if (Validator.isNotNull(format)) {
        addParameter(parameterMap, "p_p_state", "exclusive");
    }

    populateParams(parameterMap, namespace, routeParameters);
}

From source file:com.liferay.alloy.mvc.BaseAlloyControllerImpl.java

License:Open Source License

protected String buildIncludePath(String viewPath) {
    StringBundler sb = new StringBundler(4);

    sb.append("/WEB-INF/jsp/");
    sb.append(portlet.getFriendlyURLMapping());
    sb.append("/views/");

    if (viewPath.equals(_VIEW_PATH_ERROR)) {
        sb.append("error.jsp");

        return sb.toString();
    }//  www .j a  v  a  2s .  c  o  m

    sb = new StringBundler(new String[] { sb.toString() }, 4);

    sb.append(controllerPath);
    sb.append(StringPool.SLASH);
    sb.append(viewPath);
    sb.append(".jsp");

    return sb.toString();
}

From source file:com.liferay.alloy.mvc.BaseAlloyControllerImpl.java

License:Open Source License

protected String getMessageListenerGroupName() {
    String rootPortletId = portlet.getRootPortletId();

    return rootPortletId.concat(StringPool.SLASH).concat(controllerPath);
}

From source file:com.liferay.alloy.mvc.jsonwebservice.AlloyControllerInvokerManager.java

License:Open Source License

public AlloyControllerInvokerManager(LiferayPortletConfig liferayPortletConfig) {

    PortletContext portletContext = liferayPortletConfig.getPortletContext();

    _contextName = portletContext.getPortletContextName();
    _contextPath = StringPool.SLASH + portletContext.getPortletContextName();
}

From source file:com.liferay.alloy.mvc.jsonwebservice.AlloyControllerInvokerManager.java

License:Open Source License

protected String getAPIPath(String controller, Method method) {
    StringBundler sb = new StringBundler(4);

    sb.append(StringPool.SLASH);
    sb.append(controller);/*w  w w .  j  a v a  2 s  .c  om*/
    sb.append(StringPool.SLASH);
    sb.append(method.getName());

    return sb.toString();
}

From source file:com.liferay.analytics.test.util.TestUtil.java

License:Open Source License

public static Group addGroup(long companyId, long userId, long parentGroupId, String name, String description)
        throws PortalException, SystemException {

    Group group = GroupLocalServiceUtil.fetchGroup(companyId, name);

    if (group != null) {
        return group;
    }/*from   www.  j  a v  a 2  s .  c  om*/

    int type = GroupConstants.TYPE_SITE_OPEN;
    String friendlyURL = StringPool.SLASH + FriendlyURLNormalizerUtil.normalize(name);
    boolean site = true;
    boolean active = true;
    boolean manualMembership = true;
    int membershipRestriction = GroupConstants.DEFAULT_MEMBERSHIP_RESTRICTION;

    return GroupLocalServiceUtil.addGroup(userId, parentGroupId, null, 0, GroupConstants.DEFAULT_LIVE_GROUP_ID,
            name, description, type, manualMembership, membershipRestriction, friendlyURL, site, active,
            getServiceContext());
}

From source file:com.liferay.anonymoususers.util.DefaultAnonymousUsersCookieManagerImpl.java

License:Open Source License

@Override
public void addCookie(HttpServletRequest request, HttpServletResponse response, long anonymousUserId) {

    Cookie userIdCookie = new Cookie(ANONYMOUS_USER_ID, String.valueOf(anonymousUserId));

    userIdCookie.setPath(StringPool.SLASH);
    userIdCookie.setMaxAge(CookieKeys.MAX_AGE);

    CookieKeys.addCookie(request, response, userIdCookie);
}

From source file:com.liferay.bbb.service.impl.BBBServerLocalServiceImpl.java

License:Open Source License

protected String formatURL(String url) {
    if (!url.endsWith(StringPool.SLASH)) {
        url += StringPool.SLASH;
    }

    return url;
}

From source file:com.liferay.bbb.util.BBBUtil.java

License:Open Source License

public static String getInvitationURL(BBBParticipant bbbParticipant, HttpServletRequest request)
        throws Exception {

    StringBundler sb = new StringBundler(7);

    Group group = GroupLocalServiceUtil.getGroup(bbbParticipant.getCompanyId(), GroupConstants.GUEST);

    Layout layout = LayoutLocalServiceUtil.getLayout(group.getDefaultPublicPlid());

    ThemeDisplay themeDisplay = (ThemeDisplay) request.getAttribute(WebKeys.THEME_DISPLAY);

    sb.append(PortalUtil.getLayoutURL(layout, themeDisplay));

    sb.append(Portal.FRIENDLY_URL_SEPARATOR);
    sb.append("meetings");
    sb.append(StringPool.SLASH);
    sb.append(bbbParticipant.getBbbParticipantId());
    sb.append(StringPool.SLASH);// w ww.j  av  a 2s  .  c o  m
    sb.append(getHash(bbbParticipant));

    return sb.toString();
}

From source file:com.liferay.blogs.internal.util.PingbackMethodImpl.java

License:Open Source License

protected ServiceContext buildServiceContext(long companyId, long groupId, String urlTitle) throws Exception {

    ServiceContext serviceContext = new ServiceContext();

    String pingbackUserName = LanguageUtil.get(LocaleUtil.getSiteDefault(), "pingback");

    serviceContext.setAttribute("pingbackUserName", pingbackUserName);

    StringBundler sb = new StringBundler(5);

    String portletId = PortletProviderUtil.getPortletId(BlogsEntry.class.getName(),
            PortletProvider.Action.VIEW);

    if (Validator.isNull(portletId)) {
        return serviceContext;
    }/*from w  w  w.  ja  v a  2 s  .c  o m*/

    String layoutFullURL = PortalUtil.getLayoutFullURL(groupId, portletId);

    sb.append(layoutFullURL);

    sb.append(Portal.FRIENDLY_URL_SEPARATOR);

    Portlet portlet = _portletLocalService.getPortletById(companyId, portletId);

    sb.append(portlet.getFriendlyURLMapping());
    sb.append(StringPool.SLASH);
    sb.append(urlTitle);

    serviceContext.setAttribute("redirect", sb.toString());

    serviceContext.setLayoutFullURL(layoutFullURL);

    return serviceContext;
}