提取分页信息。

@param request
请求
@param defaultPageSize
默认每页记录数
@return 分页信息
765769
public static PagingInfo getPageInfos(final HttpServletRequest request, final int defaultPageSize) {
		PagingInfo info = new PagingInfo();
		info.setKey(getPageKey(request));
		info.setUrl(getUrl(request));
		info.setTotal(getTotal(request));
		info.setPageIndex(getPageIndex(request));
		info.setPageSize(getPageSize(request, defaultPageSize));
		return info;
	}
374438
@ResourceMapping(value = "retrieveSearchJSONResults")
    public ModelAndView showJSONSearchResults(PortletRequest request) {

        PortletPreferences prefs = request.getPreferences();
        int maxTextLength =
                Integer.parseInt(prefs.getValue(AUTOCOMPLETE_MAX_TEXT_LENGTH_PREF_NAME, "180"));

        final Map<String, Object> model = new HashMap<>();
        List<AutocompleteResultsModel> results = new ArrayList<>();

        final PortletSession session = request.getPortletSession();
        String queryId = (String) session.getAttribute(SEARCH_LAST_QUERY_ID);
        if (queryId != null) {
            final PortalSearchResults portalSearchResults =
                    this.getPortalSearchResults(request, queryId);
            if (portalSearchResults != null) {
                final ConcurrentMap<String, List<Tuple<SearchResult, String>>> resultsMap =
                        portalSearchResults.getResults();
                results = collateResultsForAutoCompleteResponse(resultsMap, maxTextLength);
            }
        }
        model.put("results", results);
        model.put("count", results.size());
        return new ModelAndView("json", model);
    }
895272
private void addPostParams(final Request request) {
        if (defaults != null) {
            request.addPostParam("Defaults", Converter.mapToJson(defaults));
        }
    }
606556
private void addQueryParams(final Request request) {
        if (getPageSize() != null) {
            request.addQueryParam("PageSize", Integer.toString(getPageSize()));
        }
    }
1160884
public static int getDefaultPageSize() {
        synchronized (sLock) {
            if (sDefaultPageSize == 0) {
                try {
                    Class clazz = Class.forName("android.os.StatFs");
                    Method m = clazz.getMethod("getBlockSize");
                    Object statFsObj = clazz.getConstructor(String.class).newInstance("/data");
                    Integer value = (Integer) m.invoke(statFsObj, (Object[])null);
                    if (value != null)
                        return value.intValue();
                } catch (Exception e) { }
            }
            if (sDefaultPageSize == 0)
                sDefaultPageSize = 1024;
            return sDefaultPageSize;
        }
    }
1196433
private void addQueryParams(final Request request) {
        if (status != null) {
            request.addQueryParam("Status", status.toString());
        }

        if (phoneNumber != null) {
            request.addQueryParam("PhoneNumber", phoneNumber.toString());
        }

        if (incomingPhoneNumberSid != null) {
            request.addQueryParam("IncomingPhoneNumberSid", incomingPhoneNumberSid);
        }

        if (friendlyName != null) {
            request.addQueryParam("FriendlyName", friendlyName);
        }

        if (uniqueName != null) {
            request.addQueryParam("UniqueName", uniqueName);
        }

        if (getPageSize() != null) {
            request.addQueryParam("PageSize", Integer.toString(getPageSize()));
        }
    }
1212741
private void addQueryParams(final Request request) {
        if (dateCreatedFrom != null) {
            request.addQueryParam("DateCreatedFrom", dateCreatedFrom.toString());
        }

        if (dateCreatedTo != null) {
            request.addQueryParam("DateCreatedTo", dateCreatedTo.toString());
        }

        if (getPageSize() != null) {
            request.addQueryParam("PageSize", Integer.toString(getPageSize()));
        }
    }
1113213
private List<Integer> getPageSizes() {

        final String pageSizes = parseOptionalStringValue(XML_ELEMENT_PAGESIZE);
        if (pageSizes != null) {
            String[] pageSizesArray = pageSizes.split("-");
            if (pageSizesArray.length > 0) {
                try {
                    List<Integer> result = new ArrayList<>(pageSizesArray.length);
                    for (int i = 0; i < pageSizesArray.length; i++) {
                        result.add(Integer.valueOf(pageSizesArray[i]));
                    }
                    return result;
                } catch (NumberFormatException e) {
                    LOG.warn(Messages.get().getBundle().key(Messages.LOG_PARSING_PAGE_SIZES_FAILED_1, pageSizes), e);
                }
            }
        }
        return null;
    }
636164
public ListDomainStatisticsResponse listDomainStatistics(ListDomainStatisticsRequest request) {
        checkNotNull(request, "The parameter request should NOT be null.");

        checkStringNotEmpty(request.getStartTime(), "startTime should NOT be empty");

        InternalRequest internalRequest = createRequest(HttpMethodName.GET, request,
                STATISTICS, LIVE_DOMAIN, "list");
        internalRequest.addParameter("startTime", request.getStartTime());
        if (request.getEndTime() != null) {
            internalRequest.addParameter("endTime", request.getEndTime());
        }
        if (request.getKeyword() != null) {
            internalRequest.addParameter("keyword", request.getKeyword());
        }
        if (request.getKeywordType() != null) {
            internalRequest.addParameter("keywordType", request.getKeywordType());
        }
        if (request.getOrderBy() != null) {
            internalRequest.addParameter("orderBy", request.getOrderBy());
        }
        return invokeHttpClient(internalRequest, ListDomainStatisticsResponse.class);
    }
1241703
private void addQueryParams(final Request request) {
        if (recurring != null) {
            request.addQueryParam("Recurring", recurring.toString());
        }

        if (triggerBy != null) {
            request.addQueryParam("TriggerBy", triggerBy.toString());
        }

        if (usageCategory != null) {
            request.addQueryParam("UsageCategory", usageCategory.toString());
        }

        if (getPageSize() != null) {
            request.addQueryParam("PageSize", Integer.toString(getPageSize()));
        }
    }
812296
private void handlePaginationRequest(final Request request) {
		String rowsStr = request.getParameter(getId() + ".rows");

		int prevPage = getCurrentPage();
		int prevRows = getRowsPerPage();

		boolean rowsChanged = false;

		// Check for rows per page option and is valid
		if (rowsStr != null && getRowsPerPageOptions() != null) {
			try {
				int newRows = Integer.parseInt(rowsStr);
				// If rows option changed
				if (prevRows != newRows) {
					// Set rows
					setRowsPerPage(newRows);
					if (newRows == 0) {
						setCurrentPage(0);
					} else {
						// Try to calc the page the previous top row was on
						int startIdx = prevPage * prevRows;
						int page = startIdx / newRows;
						setCurrentPage(page);
					}
					rowsChanged = true;
				}
			} catch (NumberFormatException e) {
				LOG.warn("Invalid rows option: " + rowsStr);
			}
		}

		// Check for the current page
		if (!rowsChanged && isPaginated()) {
			String pageStr = request.getParameter(getId() + ".page");
			if (pageStr == null) {
				setCurrentPage(0);
			} else {
				try {
					int pageNum = Integer.parseInt(pageStr);
					setCurrentPage(pageNum);
				} catch (NumberFormatException e) {
					LOG.warn("Invalid page number: " + pageStr);
				}
			}
		}

	}
295361
public CmsDetailPageInfo getDefaultDetailPage() {

        for (CmsDetailPageInfo detailpage : getAllDetailPages(true)) {
            if (CmsADEManager.DEFAULT_DETAILPAGE_TYPE.equals(detailpage.getType())) {
                return detailpage;
            }
        }
        return null;
    }
118159
public int getConnectionPoolSize(URL url) {
        RequestBuilder req = new RequestBuilder();
        req.host = url.getHost();
        req.port = url.getPort() < 0 ? url.getDefaultPort() : url.getPort();
        return _getPoolSize(req);
    }
511179
public static long getLong(@NotNull ServletRequest request, @NotNull String param, long defaultValue) {
    String value = request.getParameter(param);
    return NumberUtils.toLong(value, defaultValue);
  }
158921
private void handleExpansionRequest(final Request request) {
		String[] paramValue = request.getParameterValues(getId() + ".expanded");

		if (paramValue == null) {
			paramValue = new String[0];
		}

		Map<List<Integer>, Object> pageRowKeys = getCurrentRowIndexAndKeys();

		String[] expandedRows = removeEmptyStrings(paramValue);
		Set<?> oldExpansions = getExpandedRows();
		Set<Object> newExpansions;

		TableModel model = getTableModel();

		if (model.getRowCount() == 0) {
			newExpansions = new HashSet<>();
			expandedRows = new String[0];
		} else if (getPaginationMode() == PaginationMode.NONE || getPaginationMode() == PaginationMode.CLIENT
				|| oldExpansions == null || !isPaginated()) {
			newExpansions = new HashSet<>(expandedRows.length);
		} else {
			// row expansions only apply to the current page
			newExpansions = (Set<Object>) new HashSet<>(oldExpansions);
			newExpansions.removeAll(pageRowKeys.values());
		}

		for (String expandedRow : expandedRows) {
			List<Integer> rowIndex = TableUtil.rowIndexStringToList(expandedRow);
			Object key = pageRowKeys.get(rowIndex);
			if (key != null) {
				newExpansions.add(key);
			}
		}

		setExpandedRows(newExpansions);
	}
219753
private void addQueryParams(final Request request) {
        if (to != null) {
            request.addQueryParam("To", to.toString());
        }

        if (from != null) {
            request.addQueryParam("From", from.toString());
        }

        if (absoluteDateSent != null) {
            request.addQueryParam("DateSent", absoluteDateSent.toString(Request.QUERY_STRING_DATE_TIME_FORMAT));
        } else if (rangeDateSent != null) {
            request.addQueryDateTimeRange("DateSent", rangeDateSent);
        }

        if (getPageSize() != null) {
            request.addQueryParam("PageSize", Integer.toString(getPageSize()));
        }
    }
1075907
public static int getPageCount(int size, int pageSize, int page) {
        int totalPage = size / pageSize;
        if (size > pageSize * totalPage) {
            totalPage += 1;
        }
        return totalPage;
    }