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


Java DispatcherType.REQUEST属性代码示例

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


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

示例1: handleRequest

@Override
public void handleRequest(final HttpServerExchange exchange) throws Exception {
    final ServletRequestContext servletRequestContext = exchange.getAttachment(ServletRequestContext.ATTACHMENT_KEY);
    ServletRequest request = servletRequestContext.getServletRequest();
    if (request.getDispatcherType() == DispatcherType.REQUEST) {
        List<SingleConstraintMatch> constraints = servletRequestContext.getRequiredConstrains();
        SecurityContext sc = exchange.getSecurityContext();
        if (!authorizationManager.canAccessResource(constraints, sc.getAuthenticatedAccount(), servletRequestContext.getCurrentServlet().getManagedServlet().getServletInfo(), servletRequestContext.getOriginalRequest(), servletRequestContext.getDeployment())) {

            HttpServletResponse response = (HttpServletResponse) servletRequestContext.getServletResponse();
            response.sendError(StatusCodes.FORBIDDEN);
            return;
        }
    }
    next.handleRequest(exchange);
}
 
开发者ID:lamsfoundation,项目名称:lams,代码行数:16,代码来源:ServletSecurityRoleHandler.java

示例2: isAllowed

private boolean isAllowed(String path, DispatcherType dispatcherType) {
    if (!path.isEmpty()) {
        if (dispatcherType == DispatcherType.REQUEST) {
            //WFLY-3543 allow the dispatcher to access stuff in web-inf and meta inf
            if (path.startsWith("/META-INF") ||
                    path.startsWith("META-INF") ||
                    path.startsWith("/WEB-INF") ||
                    path.startsWith("WEB-INF")) {
                return false;
            }
        }
    }
    if (defaultAllowed && disallowed.isEmpty()) {
        return true;
    }
    int pos = path.lastIndexOf('/');
    final String lastSegment;
    if (pos == -1) {
        lastSegment = path;
    } else {
        lastSegment = path.substring(pos + 1);
    }
    if (lastSegment.isEmpty()) {
        return true;
    }
    int ext = lastSegment.lastIndexOf('.');
    if (ext == -1) {
        //no extension
        return true;
    }
    final String extension = lastSegment.substring(ext + 1, lastSegment.length()).toLowerCase();
    if (defaultAllowed) {
        return !disallowed.contains(extension);
    } else {
        return allowed.contains(extension);
    }
}
 
开发者ID:yangfuhai,项目名称:jboot,代码行数:37,代码来源:JbootResourceServlet.java

示例3: getDispatcherType

@Override
public DispatcherType getDispatcherType() {
    if (internalDispatcherType == null) {
        return DispatcherType.REQUEST;
    }

    return this.internalDispatcherType;
}
 
开发者ID:liaokailin,项目名称:tomcat7,代码行数:8,代码来源:Request.java

示例4: isAllowed

private boolean isAllowed(String path, DispatcherType dispatcherType) {
    if (!path.isEmpty()) {
        if(dispatcherType == DispatcherType.REQUEST) {
            //WFLY-3543 allow the dispatcher to access stuff in web-inf and meta inf
            if (path.startsWith("/META-INF") ||
                    path.startsWith("META-INF") ||
                    path.startsWith("/WEB-INF") ||
                    path.startsWith("WEB-INF")) {
                return false;
            }
        }
    }
    int pos = path.lastIndexOf('/');
    final String lastSegment;
    if (pos == -1) {
        lastSegment = path;
    } else {
        lastSegment = path.substring(pos + 1);
    }
    if (lastSegment.isEmpty()) {
        return true;
    }
    int ext = lastSegment.lastIndexOf('.');
    if (ext == -1) {
        //no extension
        return true;
    }
    final String extension = lastSegment.substring(ext + 1, lastSegment.length());
    if (defaultAllowed) {
        return !disallowed.contains(extension);
    } else {
        return allowed.contains(extension);
    }
}
 
开发者ID:lamsfoundation,项目名称:lams,代码行数:34,代码来源:DefaultServlet.java

示例5: getDispatcherType

@Override
public DispatcherType getDispatcherType() {
	if (internalDispatcherType == null) {
		return DispatcherType.REQUEST;
	}

	return this.internalDispatcherType;
}
 
开发者ID:how2j,项目名称:lazycat,代码行数:8,代码来源:Request.java

示例6: get

@Override
public Object get(Request request, String name) {
    return (request.internalDispatcherType == null) ? DispatcherType.REQUEST
            : request.internalDispatcherType;
}
 
开发者ID:liaokailin,项目名称:tomcat7,代码行数:5,代码来源:Request.java

示例7: dispatchRequest

private void dispatchRequest(final HttpServerExchange exchange, final ServletRequestContext servletRequestContext, final ServletChain servletChain, final DispatcherType dispatcherType) throws Exception {
    servletRequestContext.setDispatcherType(dispatcherType);
    servletRequestContext.setCurrentServlet(servletChain);
    if (dispatcherType == DispatcherType.REQUEST || dispatcherType == DispatcherType.ASYNC) {
        handleFirstRequest(exchange, servletChain, servletRequestContext, servletRequestContext.getServletRequest(), servletRequestContext.getServletResponse());
    } else {
        next.handleRequest(exchange);
    }
}
 
开发者ID:lamsfoundation,项目名称:lams,代码行数:9,代码来源:ServletInitialHandler.java

示例8: get

@Override
public Object get(Request request, String name) {
	return (request.internalDispatcherType == null) ? DispatcherType.REQUEST
			: request.internalDispatcherType;
}
 
开发者ID:how2j,项目名称:lazycat,代码行数:5,代码来源:Request.java


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