Example usage for com.liferay.portal.kernel.util WebKeys SINGLE_PAGE_APPLICATION_CLEAR_CACHE

List of usage examples for com.liferay.portal.kernel.util WebKeys SINGLE_PAGE_APPLICATION_CLEAR_CACHE

Introduction

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

Prototype

String SINGLE_PAGE_APPLICATION_CLEAR_CACHE

To view the source code for com.liferay.portal.kernel.util WebKeys SINGLE_PAGE_APPLICATION_CLEAR_CACHE.

Click Source Link

Usage

From source file:com.liferay.asset.publisher.web.display.context.BaseItemSelectorViewDisplayContext.java

License:Open Source License

@Override
public String getDisplayStyle() {
    String displayStyle = ParamUtil.getString(request, "displayStyle");

    PortalPreferences portalPreferences = PortletPreferencesFactoryUtil.getPortalPreferences(request);

    if (Validator.isNull(displayStyle)) {
        displayStyle = portalPreferences.getValue(AssetPublisherWebKeys.ITEM_SELECTOR, "display-style", "icon");
    } else {/*from   www  .j a  va 2  s  .  c om*/
        portalPreferences.setValue(AssetPublisherWebKeys.ITEM_SELECTOR, "display-style", displayStyle);

        request.setAttribute(WebKeys.SINGLE_PAGE_APPLICATION_CLEAR_CACHE, Boolean.TRUE);
    }

    return displayStyle;
}

From source file:com.liferay.asset.publisher.web.portlet.AssetPublisherPortlet.java

License:Open Source License

@Override
protected void doDispatch(RenderRequest renderRequest, RenderResponse renderResponse)
        throws IOException, PortletException {

    try {//  w  w w.j  av a  2s .com
        renderRequest.setAttribute(AssetPublisherWebKeys.ASSET_ENTRY_ACTION_REGISTRY, assetEntryActionRegistry);

        renderRequest.setAttribute(AssetWebKeys.ASSET_HELPER, assetHelper);

        String rootPortletId = PortletIdCodec.decodePortletName(portal.getPortletId(renderRequest));

        AssetPublisherCustomizer assetPublisherCustomizer = assetPublisherCustomizerRegistry
                .getAssetPublisherCustomizer(rootPortletId);

        renderRequest.setAttribute(AssetPublisherWebKeys.ASSET_PUBLISHER_CUSTOMIZER, assetPublisherCustomizer);

        renderRequest.setAttribute(AssetPublisherWebKeys.ASSET_PUBLISHER_WEB_CONFIGURATION,
                assetPublisherWebConfiguration);

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

        PortletDisplay portletDisplay = themeDisplay.getPortletDisplay();

        AssetPublisherPortletInstanceConfiguration assetPublisherPortletInstanceConfiguration = portletDisplay
                .getPortletInstanceConfiguration(AssetPublisherPortletInstanceConfiguration.class);

        renderRequest.setAttribute(AssetPublisherWebKeys.ASSET_PUBLISHER_PORTLET_INSTANCE_CONFIGURATION,
                assetPublisherPortletInstanceConfiguration);

        renderRequest.setAttribute(WebKeys.SINGLE_PAGE_APPLICATION_CLEAR_CACHE, Boolean.TRUE);
    } catch (Exception e) {
        _log.error("Unable to get asset publisher customizer", e);
    }

    if (SessionErrors.contains(renderRequest, NoSuchGroupException.class.getName())
            || SessionErrors.contains(renderRequest, PrincipalException.getNestedClasses())) {

        include("/error.jsp", renderRequest, renderResponse);
    } else {
        super.doDispatch(renderRequest, renderResponse);
    }
}

From source file:com.liferay.frontend.js.spa.web.internal.servlet.taglib.util.SPAUtil.java

License:Open Source License

public boolean isClearScreensCache(HttpServletRequest request, HttpSession session) {

    boolean singlePageApplicationClearCache = GetterUtil
            .getBoolean(request.getAttribute(WebKeys.SINGLE_PAGE_APPLICATION_CLEAR_CACHE));

    if (singlePageApplicationClearCache) {
        return true;
    }/* w w  w .  jav  a2 s.co m*/

    String portletId = request.getParameter("p_p_id");

    if (Validator.isNull(portletId)) {
        return false;
    }

    String singlePageApplicationLastPortletId = (String) session
            .getAttribute(WebKeys.SINGLE_PAGE_APPLICATION_LAST_PORTLET_ID);

    if (Validator.isNotNull(singlePageApplicationLastPortletId)
            && !Objects.equals(portletId, singlePageApplicationLastPortletId)) {

        return true;
    }

    return false;
}

From source file:com.liferay.journal.web.internal.display.context.JournalDisplayContext.java

License:Open Source License

protected String getDisplayStyle(HttpServletRequest request, String[] displayViews) {

    PortalPreferences portalPreferences = PortletPreferencesFactoryUtil.getPortalPreferences(request);

    String displayStyle = ParamUtil.getString(request, "displayStyle");

    if (Validator.isNull(displayStyle)) {
        JournalWebConfiguration journalWebConfiguration = (JournalWebConfiguration) _request
                .getAttribute(JournalWebConfiguration.class.getName());

        displayStyle = portalPreferences.getValue(JournalPortletKeys.JOURNAL, "display-style",
                journalWebConfiguration.defaultDisplayView());
    } else {/*from w  w w  . j a  v a2s .co m*/
        if (ArrayUtil.contains(displayViews, displayStyle)) {
            portalPreferences.setValue(JournalPortletKeys.JOURNAL, "display-style", displayStyle);

            request.setAttribute(WebKeys.SINGLE_PAGE_APPLICATION_CLEAR_CACHE, Boolean.TRUE);
        }
    }

    if (!ArrayUtil.contains(displayViews, displayStyle)) {
        displayStyle = displayViews[0];
    }

    return displayStyle;
}

From source file:com.liferay.site.item.selector.web.internal.display.context.BaseSitesItemSelectorViewDisplayContext.java

License:Open Source License

@Override
public String getDisplayStyle() {
    String displayStyle = ParamUtil.getString(request, "displayStyle");

    PortalPreferences portalPreferences = PortletPreferencesFactoryUtil.getPortalPreferences(request);

    if (Validator.isNull(displayStyle)) {
        displayStyle = portalPreferences.getValue(SitesItemSelectorWebKeys.SITES_ITEM_SELECTOR, "display-style",
                "icon");
    } else {/*from w ww .ja  v  a  2  s .  c o  m*/
        portalPreferences.setValue(SitesItemSelectorWebKeys.SITES_ITEM_SELECTOR, "display-style", displayStyle);

        request.setAttribute(WebKeys.SINGLE_PAGE_APPLICATION_CLEAR_CACHE, Boolean.TRUE);
    }

    return displayStyle;
}