com.greenline.guahao.web.module.home.controllers.mobile.PageUtils.java Source code

Java tutorial

Introduction

Here is the source code for com.greenline.guahao.web.module.home.controllers.mobile.PageUtils.java

Source

/**
 * Project: guahao-portal-web-home
 * 
 * File Created at 2012-11-30
 * 
 * Copyright 2012 Greenline.com Corporation Limited.
 * All rights reserved.
 *
 * This software is the confidential and proprietary information of
 * Greenline Company. ("Confidential Information").  You shall not
 * disclose such Confidential Information and shall use it only in
 * accordance with the terms of the license agreement you entered into
 * with Greenline.com.
 */
package com.greenline.guahao.web.module.home.controllers.mobile;

import javax.servlet.http.HttpServletRequest;

import org.apache.commons.lang.StringUtils;

import com.greenline.guahao.web.module.common.utils.CommonUtils;

/**
 * @Type PageUtils
 * @Desc
 * @author jianyun.zheng
 * @date 2012-11-30
 * @Version V1.0
 */
public class PageUtils {

    /**
     * ???url
     * 
     * @param request
     * @return String
     */
    public static String getCurrUrl(HttpServletRequest request) {
        String url = CommonUtils.getRequestUrl(request);
        if (StringUtils.isNotBlank(url)) {
            url = url.replaceAll("&pageNo=\\d+$", "").replaceAll("pageNo=\\d+$", "");
        }
        if (!url.contains("?")) {
            url += "?";
        } else {
            if (!url.endsWith("?")) {
                url += "&";
            }
        }
        url += "pageNo=";
        return url;
    }
}