当前位置: 首页>>代码示例>>Java>>正文


Java WCMMode.fromRequest方法代码示例

本文整理汇总了Java中com.day.cq.wcm.api.WCMMode.fromRequest方法的典型用法代码示例。如果您正苦于以下问题:Java WCMMode.fromRequest方法的具体用法?Java WCMMode.fromRequest怎么用?Java WCMMode.fromRequest使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在com.day.cq.wcm.api.WCMMode的用法示例。


在下文中一共展示了WCMMode.fromRequest方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: doFilter

import com.day.cq.wcm.api.WCMMode; //导入方法依赖的package包/类
@Override
public final void doFilter(ServletRequest request, ServletResponse response, FilterChain chain) throws IOException,
        ServletException {

    final WCMMode mode = WCMMode.fromRequest(request);
    final IncludeOptions includeOptions = IncludeOptions.getOptions(request, true);

    // Only execute in Publish mode
    if (false && includeOptions != null &&  ((mode == null || WCMMode.DISABLED.equals(mode)))) {
        // Disable CQ Decoration on cq:includes or sling:includes, only in Publish mode
        includeOptions.setDecorationTagName("");
    }

    // Finally, proceed with the the Filter chain
    chain.doFilter(request, response);
}
 
开发者ID:Adobe-Consulting-Services,项目名称:acs-aem-samples,代码行数:17,代码来源:SampleSlingIncludeFilter.java

示例2: doStartTag

import com.day.cq.wcm.api.WCMMode; //导入方法依赖的package包/类
@Override
public int doStartTag() throws JspException {
    try {
        if (StringUtils.isBlank(getMode())) {
            return EVAL_BODY_BUFFERED;
        }
        this.wcmmode = WCMMode.fromRequest(WCMUtil.getSlingRequest(pageContext));
        for (WCMMode candidate : WCMMode.values()) {
            if (StringUtils.equalsIgnoreCase(getMode(), candidate.toString())) {
                candidate.toRequest(WCMUtil.getSlingRequest(pageContext));
                break;
            }
        }
    } catch(RuntimeException re) {
        LOG.debug(re.getMessage());
        throw new JspException(re);
    }
    return EVAL_BODY_BUFFERED;
}
 
开发者ID:steeleforge,项目名称:ironsites,代码行数:20,代码来源:SetModeTag.java

示例3: execute

import com.day.cq.wcm.api.WCMMode; //导入方法依赖的package包/类
@Override
public CharSequence execute(final Object valueObj)
        throws Exception {

    StringBuffer buffer = new StringBuffer();
    TemplateContentModelImpl contentModel = contentModel();
    SlingHttpServletRequest slingRequest = contentModel.request();

    WCMMode wcmMode = WCMMode.fromRequest(slingRequest);
    ClientLibraryUtil clientLibUtil = new ClientLibraryUtil(htmlLibraryManager, slingRequest);
    clientLibUtil.setOptions(true, true, false, false, false, BLANK);

    if (wcmMode != WCMMode.DISABLED) {
        ComponentContext componentContext = WCMUtils.getComponentContext(slingRequest);
        EditContext editContext = componentContext.getEditContext();
        String dlgPath = null;
        if (editContext != null && editContext.getComponent() != null) {
            dlgPath = editContext.getComponent().getDialogPath();
        }

        if (AuthoringUIMode.fromRequest(slingRequest) == AuthoringUIMode.TOUCH) {
            buffer.append(clientLibUtil.generateClientLibrariesPristine("cq.authoring.page"));
        } else
        if (AuthoringUIMode.fromRequest(slingRequest) == AuthoringUIMode.CLASSIC) {
            buffer.append(clientLibUtil.generateClientLibrariesPristine("cq.wcm.edit"));
            boolean isEditMode = (wcmMode == WCMMode.EDIT) ? true : false;
            String dialogPath = dlgPath == null ? "" : dlgPath;
            buffer.append(this.getJavaScript(slingRequest, isEditMode, dialogPath));
        }
    }

    return new Handlebars.SafeString(buffer);
}
 
开发者ID:DantaFramework,项目名称:AEM,代码行数:34,代码来源:InitScriptHelperFunction.java

示例4: doTag

import com.day.cq.wcm.api.WCMMode; //导入方法依赖的package包/类
@Override
public void doTag() throws JspException, IOException {

    wcmEdit = WCMMode.fromRequest(getRequest()) == WCMMode.EDIT;
    wcmDesign = WCMMode.fromRequest(getRequest()) == WCMMode.DESIGN;
    wcmAuthor = !(WCMMode.fromRequest(getRequest()) == WCMMode.DISABLED);

    getPageContext().setAttribute(JSP_ATTR_WCM_EDIT, wcmEdit);
    getPageContext().setAttribute(JSP_ATTR_WCM_DESIGN, wcmDesign);
    getPageContext().setAttribute(JSP_ATTR_WCM_AUTHOR, wcmAuthor);
}
 
开发者ID:headwirecom,项目名称:aem-solr-search,代码行数:12,代码来源:WcmModeTag.java

示例5: getOrSetFirstWCMMode

import com.day.cq.wcm.api.WCMMode; //导入方法依赖的package包/类
/**
 * Gets or sets and gets the original WCMMode for the Request.
 *
 * @param request the Request
 * @return the original WCMMode for the Request
 */
private WCMMode getOrSetFirstWCMMode(final SlingHttpServletRequest request) {
    WCMMode wcmMode = (WCMMode) request.getAttribute(ATTR_FILTER);

    if (wcmMode == null) {
        wcmMode = WCMMode.fromRequest(request);
        request.setAttribute(ATTR_FILTER, wcmMode);
    }

    return wcmMode;
}
 
开发者ID:Adobe-Consulting-Services,项目名称:acs-aem-commons,代码行数:17,代码来源:WCMViewsFilter.java

示例6: isRequestInMode

import com.day.cq.wcm.api.WCMMode; //导入方法依赖的package包/类
private boolean isRequestInMode() {
    final ServletRequest request = pageContext.getRequest();

    if (not) {
        return WCMMode.fromRequest(request) != getMode();
    } else {
        return WCMMode.fromRequest(request) == getMode();
    }
}
 
开发者ID:Adobe-Consulting-Services,项目名称:acs-aem-commons,代码行数:10,代码来源:AbstractMode.java

示例7: doStartTag

import com.day.cq.wcm.api.WCMMode; //导入方法依赖的package包/类
/**
 * {@inheritDoc}
 */
@Override
public int doStartTag() throws JspException {
    final WCMMode toSet = WCMMode.valueOf(mode);
    final ServletRequest request = pageContext.getRequest();
    this.oldMode = WCMMode.fromRequest(request);
    toSet.toRequest(request);
    return EVAL_BODY_INCLUDE;
}
 
开发者ID:Adobe-Consulting-Services,项目名称:acs-aem-commons,代码行数:12,代码来源:SetWCMMode.java

示例8: isDesign

import com.day.cq.wcm.api.WCMMode; //导入方法依赖的package包/类
/**
 * Determine if the current WCMMode is design mode.
 * 
 * @param pageContext the current page context
 * @return true if the WCMMode is design
 */
@Function
public static boolean isDesign(PageContext pageContext) {
    if (pageContext == null) {
        return false;
    }
    final ServletRequest request = pageContext.getRequest();
    if (request == null) {
        return false;
    }
    return WCMMode.fromRequest(request) == WCMMode.DESIGN;
}
 
开发者ID:Adobe-Consulting-Services,项目名称:acs-aem-commons,代码行数:18,代码来源:WCMModeFunctions.java

示例9: isDisabled

import com.day.cq.wcm.api.WCMMode; //导入方法依赖的package包/类
/**
 * Determine if the current WCMMode is disabled mode.
 * 
 * @param pageContext the current page context
 * @return true if the WCMMode is disabled
 */
@Function
public static boolean isDisabled(PageContext pageContext) {
    if (pageContext == null) {
        return true;
    }
    final ServletRequest request = pageContext.getRequest();
    if (request == null) {
        return true;
    }
    return WCMMode.fromRequest(request) == WCMMode.DISABLED;
}
 
开发者ID:Adobe-Consulting-Services,项目名称:acs-aem-commons,代码行数:18,代码来源:WCMModeFunctions.java

示例10: isEdit

import com.day.cq.wcm.api.WCMMode; //导入方法依赖的package包/类
/**
 * Determine if the current WCMMode is edit mode.
 * 
 * @param pageContext the current page context
 * @return true if the WCMMode is edit
 */
@Function
public static boolean isEdit(PageContext pageContext) {
    if (pageContext == null) {
        return false;
    }
    final ServletRequest request = pageContext.getRequest();
    if (request == null) {
        return false;
    }
    return WCMMode.fromRequest(request) == WCMMode.EDIT;
}
 
开发者ID:Adobe-Consulting-Services,项目名称:acs-aem-commons,代码行数:18,代码来源:WCMModeFunctions.java

示例11: isPreview

import com.day.cq.wcm.api.WCMMode; //导入方法依赖的package包/类
/**
 * Determine if the current WCMMode is preview mode.
 * 
 * @param pageContext the current page context
 * @return true if the WCMMode is preview
 */
@Function
public static boolean isPreview(PageContext pageContext) {
    if (pageContext == null) {
        return false;
    }
    final ServletRequest request = pageContext.getRequest();
    if (request == null) {
        return false;
    }
    return WCMMode.fromRequest(request) == WCMMode.PREVIEW;
}
 
开发者ID:Adobe-Consulting-Services,项目名称:acs-aem-commons,代码行数:18,代码来源:WCMModeFunctions.java

示例12: init

import com.day.cq.wcm.api.WCMMode; //导入方法依赖的package包/类
protected void init() {
    request = WCMUtil.getSlingRequest(pageContext);
    mode = WCMMode.fromRequest(request);
    
    if (StringUtils.isBlank(getMapName())) {
        setMapName(DEFAULT_MODEMAP_NAME);
    }
    if (StringUtils.isBlank(getWcmmodeName())) {
        setWcmmodeName(DEFAULT_MODEOBJECT_NAME);
    }
}
 
开发者ID:steeleforge,项目名称:ironsites,代码行数:12,代码来源:ModeHelperTag.java

示例13: getWcmMode

import com.day.cq.wcm.api.WCMMode; //导入方法依赖的package包/类
private WCMMode getWcmMode(final SlingHttpServletRequest request) {
  return WCMMode.fromRequest(request);
}
 
开发者ID:wcm-io,项目名称:wcm-io-cq5,代码行数:4,代码来源:AemObjectInjector.java

示例14: isAnalytics

import com.day.cq.wcm.api.WCMMode; //导入方法依赖的package包/类
/**
 * Checks if the request is in mode {@link WCMMode#ANALYTICS}
 * 
 * @param request
 *            request to check
 * @return true if the request is in analytics mode
 */
public static boolean isAnalytics(SlingHttpServletRequest request) {
    return WCMMode.ANALYTICS == WCMMode.fromRequest(request);
}
 
开发者ID:Adobe-Consulting-Services,项目名称:acs-aem-commons,代码行数:11,代码来源:ModeUtil.java

示例15: isDesign

import com.day.cq.wcm.api.WCMMode; //导入方法依赖的package包/类
/**
 * Checks if the request is in mode {@link WCMMode#DESIGN}
 * 
 * @param request
 *            request to check
 * @return true if the request is in design mode
 */
public static boolean isDesign(SlingHttpServletRequest request) {
    return WCMMode.DESIGN == WCMMode.fromRequest(request);
}
 
开发者ID:Adobe-Consulting-Services,项目名称:acs-aem-commons,代码行数:11,代码来源:ModeUtil.java


注:本文中的com.day.cq.wcm.api.WCMMode.fromRequest方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。