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


Java RequestHelper类代码示例

本文整理汇总了Java中org.displaytag.util.RequestHelper的典型用法代码示例。如果您正苦于以下问题:Java RequestHelper类的具体用法?Java RequestHelper怎么用?Java RequestHelper使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


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

示例1: getFromRequestOrSession

import org.displaytag.util.RequestHelper; //导入依赖的package包/类
/**
 * Get the given parameter from the request or, if not avaible, look for into into the session if keepstatus is set.
 * Also takes care of storing an existing paramter into session.
 * @param request servlet request
 * @param requestHelper request helper instance
 * @param parameter parameter, will be encoded
 * @return value value taken from a request parameter or from a session attribute
 */
private Integer getFromRequestOrSession(HttpServletRequest request, RequestHelper requestHelper, String parameter)
{
    String encodedParam = encodeParameter(parameter);
    Integer result = requestHelper.getIntParameter(encodedParam);

    if (keepStatus)
    {
        if (result == null)
        {
            // get from session
            HttpSession session = request.getSession(false);
            if (session != null)
            {
                if (clearStatus)
                {
                    session.removeAttribute(encodedParam);
                }
                else
                {
                    result = (Integer) session.getAttribute(encodedParam);
                }
            }
        }
        else
        {
            // set into session
            request.getSession(true).setAttribute(encodedParam, result);
        }
    }
    return result;
}
 
开发者ID:webbfontaine,项目名称:displaytag,代码行数:40,代码来源:TableTag.java

示例2: getRequestHelperInstance

import org.displaytag.util.RequestHelper; //导入依赖的package包/类
/**
 * @see org.displaytag.util.RequestHelperFactory#getRequestHelperInstance(javax.servlet.jsp.PageContext)
 */
@Override
public RequestHelper getRequestHelperInstance(PageContext context)
{
    return new PortletRequestHelper(context);
}
 
开发者ID:webbfontaine,项目名称:displaytag,代码行数:9,代码来源:PortletRequestHelperFactory.java

示例3: initHref

import org.displaytag.util.RequestHelper; //导入依赖的package包/类
/**
 * init the href object used to generate all the links for pagination, sorting, exporting.
 * @param requestHelper request helper used to extract the base Href
 */
protected void initHref(RequestHelper requestHelper)
{
    // get the href for this request
    this.baseHref = requestHelper.getHref();

    if (this.excludedParams != null)
    {
        String[] splittedExcludedParams = StringUtils.split(this.excludedParams);

        // handle * keyword
        if (splittedExcludedParams.length == 1 && "*".equals(splittedExcludedParams[0]))
        {
            // @todo cleanup: paramEncoder initialization should not be done here
            if (this.paramEncoder == null)
            {
                this.paramEncoder = new ParamEncoder(getUid());
            }

            Iterator<String> paramsIterator = baseHref.getParameterMap().keySet().iterator();
            while (paramsIterator.hasNext())
            {
                String key = paramsIterator.next();

                // don't remove parameters added by the table tag
                if (!this.paramEncoder.isParameterEncoded(key))
                {
                    baseHref.removeParameter(key);
                }
            }
        }
        else
        {
            for (int j = 0; j < splittedExcludedParams.length; j++)
            {
                baseHref.removeParameter(splittedExcludedParams[j]);
            }
        }
    }

    if (this.requestUri != null)
    {
        // if user has added a requestURI create a new href
        String fullURI = requestUri;
        if (!this.dontAppendContext)
        {
            String contextPath = ((HttpServletRequest) this.pageContext.getRequest()).getContextPath();

            // prepend the context path if any.
            // actually checks if context path is already there for people which manually add it
            if (!StringUtils.isEmpty(contextPath)
                && requestUri != null
                && requestUri.startsWith("/")
                && !requestUri.startsWith(contextPath))
            {
                fullURI = contextPath + this.requestUri;
            }
        }

        // call encodeURL to preserve session id when cookies are disabled
        fullURI = ((HttpServletResponse) this.pageContext.getResponse()).encodeURL(fullURI);

        baseHref.setFullUrl(fullURI);

        // // ... and copy parameters from the current request
        // Map parameterMap = normalHref.getParameterMap();
        // this.baseHref.addParameterMap(parameterMap);
    }

}
 
开发者ID:webbfontaine,项目名称:displaytag,代码行数:74,代码来源:TableTag.java

示例4: initHref

import org.displaytag.util.RequestHelper; //导入依赖的package包/类
protected void initHref(RequestHelper requestHelper) {} 
开发者ID:mtpettyp,项目名称:openreports,代码行数:2,代码来源:MockDisplayTableTag.java


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