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


Java Checks.notNull方法代码示例

本文整理汇总了Java中org.apache.wicket.util.lang.Checks.notNull方法的典型用法代码示例。如果您正苦于以下问题:Java Checks.notNull方法的具体用法?Java Checks.notNull怎么用?Java Checks.notNull使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在org.apache.wicket.util.lang.Checks的用法示例。


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

示例1: AbstractWebSocketProcessor

import org.apache.wicket.util.lang.Checks; //导入方法依赖的package包/类
/**
 * Constructor.
 *
 * @param request
 *      the http request that was used to create the TomcatWebSocketProcessor
 * @param application
 *      the current Wicket Application
 */
public AbstractWebSocketProcessor(final HttpServletRequest request, final WebApplication application)
{
	this.sessionId = request.getSession(true).getId();

	String pageId = request.getParameter("pageId");
	resourceName = request.getParameter("resourceName");
	if (Strings.isEmpty(pageId) && Strings.isEmpty(resourceName))
	{
		throw new IllegalArgumentException("The request should have either 'pageId' or 'resourceName' parameter!");
	}
	if (Strings.isEmpty(pageId) == false)
	{
		this.pageId = Integer.parseInt(pageId, 10);
	}
	else
	{
		this.pageId = NO_PAGE_ID;
	}

	String baseUrl = request.getParameter(WebRequest.PARAM_AJAX_BASE_URL);
	Checks.notNull(baseUrl, String.format("Request parameter '%s' is required!", WebRequest.PARAM_AJAX_BASE_URL));
	this.baseUrl = Url.parse(baseUrl);

	WicketFilter wicketFilter = application.getWicketFilter();
	this.servletRequest = new ServletRequestCopy(request);

	this.application = Args.notNull(application, "application");

	this.webSocketSettings = WebSocketSettings.Holder.get(application);

	this.webRequest = webSocketSettings.newWebSocketRequest(request, wicketFilter.getFilterPath());

	this.connectionRegistry = webSocketSettings.getConnectionRegistry();

	this.connectionFilter = webSocketSettings.getConnectionFilter();
}
 
开发者ID:jmfgdev,项目名称:gitplex-mit,代码行数:45,代码来源:AbstractWebSocketProcessor.java

示例2: getClientUrl

import org.apache.wicket.util.lang.Checks; //导入方法依赖的package包/类
/**
 * Returns base url without context or filter mapping. <p> Example: if current url is <p/>
 * <pre>
 * http://localhost:8080/context/filter/mapping/wicket/bookmarkable/com.foo.Page?1&id=2
 * </pre>
 * <p/> the base url is <em>wicket/bookmarkable/com.foo.Page</em> </p>
 *
 * @see org.apache.wicket.request.Request#getClientUrl()
 */
@Override
public Url getClientUrl() {
    if (errorAttributes != null && !Strings.isEmpty(errorAttributes.getRequestUri())) {
        String problematicURI = Url.parse(errorAttributes.getRequestUri(), getCharset())
                .toString();
        return getContextRelativeUrl(problematicURI, filterPrefix);
    } else if (forwardAttributes != null && !Strings.isEmpty(forwardAttributes.getRequestUri())) {
        String forwardURI = Url.parse(forwardAttributes.getRequestUri(), getCharset()).toString();
        // -- START BUG FIX
        // [YS] because it's a forward URL, the wicket filterPrefix might not be part or the URL
        // detect it by taking the second path element (e.g., /contextPath/forwardFilterPrefix/restOfPath)
        int contextPathLength = httpServletRequest.getContextPath().length();
        int forwardFilterPrefixStart = contextPathLength + 1;  // the trailing '/'
        String servletPath = forwardURI.substring(forwardFilterPrefixStart);    // servlet path without leading '/'
        int forwardFilterPrefixEnd = servletPath.indexOf('/');
        if (forwardFilterPrefixEnd == -1) {
            forwardFilterPrefixEnd = servletPath.length();
        }
        String forwardFilterPrefix = forwardURI.substring(
                forwardFilterPrefixStart, forwardFilterPrefixStart + forwardFilterPrefixEnd);
        return getContextRelativeUrl(forwardURI, forwardFilterPrefix);
        // -- END BUG FIX
    } else if (!isAjax()) {
        return getContextRelativeUrl(httpServletRequest.getRequestURI(), filterPrefix);
    } else {
        String base = null;

        base = getHeader(HEADER_AJAX_BASE_URL);

        if (base == null) {
            base = getRequestParameters().getParameterValue(PARAM_AJAX_BASE_URL).toString(null);
        }

        Checks.notNull(base, "Current ajax request is missing the base url header or parameter");

        return setParameters(Url.parse(base, getCharset()));
    }
}
 
开发者ID:alancnet,项目名称:artifactory,代码行数:48,代码来源:ArtifactoryWebRequest.java


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