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


Java ServletSecurityElement类代码示例

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


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

示例1: setServletSecurity

import javax.servlet.ServletSecurityElement; //导入依赖的package包/类
@Override
public Set<String> setServletSecurity(ServletSecurityElement constraint) {
    if (constraint == null) {
        throw new IllegalArgumentException(sm.getString(
                "applicationServletRegistration.setServletSecurity.iae",
                getName(), context.getName()));
    }
    
    if (!context.getState().equals(LifecycleState.STARTING_PREP)) {
        throw new IllegalStateException(sm.getString(
                "applicationServletRegistration.setServletSecurity.ise",
                getName(), context.getName()));
    }

    return context.addServletSecurity(this, constraint);
}
 
开发者ID:liaokailin,项目名称:tomcat7,代码行数:17,代码来源:ApplicationServletRegistration.java

示例2: processServletSecurityAnnotation

import javax.servlet.ServletSecurityElement; //导入依赖的package包/类
private void processServletSecurityAnnotation(Class<?> clazz) {
    // Calling this twice isn't harmful so no syncs
    servletSecurityAnnotationScanRequired = false;

    Context ctxt = (Context) getParent();
    
    if (ctxt.getIgnoreAnnotations()) {
        return;
    }

    ServletSecurity secAnnotation =
        clazz.getAnnotation(ServletSecurity.class);
    if (secAnnotation != null) {
        ctxt.addServletSecurity(
                new ApplicationServletRegistration(this, ctxt),
                new ServletSecurityElement(secAnnotation));
    }
}
 
开发者ID:liaokailin,项目名称:tomcat7,代码行数:19,代码来源:StandardWrapper.java

示例3: setServletSecurity

import javax.servlet.ServletSecurityElement; //导入依赖的package包/类
/**
 * Delegate for ServletRegistration.Dynamic.setServletSecurity method
 * @param registration ServletRegistration.Dynamic instance that setServletSecurity was called on
 * @param servletSecurityElement new security info
 * @return the set of exact URL mappings currently associated with the registration that are also present in the web.xml
 * security constraints and thus will be unaffected by this call.
 */
public Set<String> setServletSecurity(ServletRegistration.Dynamic registration, ServletSecurityElement servletSecurityElement)
{
    //Default implementation is to just accept them all. If using a webapp, then this behaviour is overridden in WebAppContext.setServletSecurity       
    Collection<String> pathSpecs = registration.getMappings();
    if (pathSpecs != null)
    {
        for (String pathSpec:pathSpecs)
        {
            List<ConstraintMapping> mappings = ConstraintSecurityHandler.createConstraintsWithMappingsForPath(registration.getName(), pathSpec, servletSecurityElement);
            for (ConstraintMapping m:mappings)
                ((ConstraintAware)getSecurityHandler()).addConstraintMapping(m);
        }
    }
    return Collections.emptySet();
}
 
开发者ID:xiaomin0322,项目名称:marathon-auth-plugin,代码行数:23,代码来源:ServletContextHandler.java

示例4: processServletSecurityAnnotation

import javax.servlet.ServletSecurityElement; //导入依赖的package包/类
private void processServletSecurityAnnotation(Class<?> clazz) {
	// Calling this twice isn't harmful so no syncs
	servletSecurityAnnotationScanRequired = false;

	Context ctxt = (Context) getParent();

	if (ctxt.getIgnoreAnnotations()) {
		return;
	}

	ServletSecurity secAnnotation = clazz.getAnnotation(ServletSecurity.class);
	if (secAnnotation != null) {
		ctxt.addServletSecurity(new ApplicationServletRegistration(this, ctxt),
				new ServletSecurityElement(secAnnotation));
	}
}
 
开发者ID:how2j,项目名称:lazycat,代码行数:17,代码来源:StandardWrapper.java

示例5: onStartup

import javax.servlet.ServletSecurityElement; //导入依赖的package包/类
@Override
public void onStartup(Set<Class<?>> c, ServletContext ctx)
        throws ServletException {
    // Register and map servlet
    Servlet s = new Bug50015Servlet();
    ServletRegistration.Dynamic sr = ctx.addServlet("bug50015", s);
    sr.addMapping("/bug50015");

    // Limit access to users in the Tomcat role
    HttpConstraintElement hce = new HttpConstraintElement(
            TransportGuarantee.NONE, "tomcat");
    ServletSecurityElement sse = new ServletSecurityElement(hce);
    sr.setServletSecurity(sse);
}
 
开发者ID:liaokailin,项目名称:tomcat7,代码行数:15,代码来源:TestStandardContext.java

示例6: setServletSecurity

import javax.servlet.ServletSecurityElement; //导入依赖的package包/类
@Override
public Set<String> setServletSecurity(final ServletSecurityElement constraint) {
    if (constraint == null) {
        throw UndertowMessages.MESSAGES.argumentCannotBeNull("constraint");
    }
    DeploymentInfo deploymentInfo = deployment.getDeploymentInfo();

    //this is not super efficient, but it does not really matter
    final Set<String> urlPatterns = new HashSet<>();
    for (SecurityConstraint sc : deploymentInfo.getSecurityConstraints()) {
        for (WebResourceCollection webResources : sc.getWebResourceCollections()) {
            urlPatterns.addAll(webResources.getUrlPatterns());
        }
    }
    final Set<String> ret = new HashSet<>();
    for (String url : servletInfo.getMappings()) {
        if (urlPatterns.contains(url)) {
            ret.add(url);
        }
    }
    ServletSecurityInfo info = new ServletSecurityInfo();
    servletInfo.setServletSecurityInfo(info);
    info.setTransportGuaranteeType(constraint.getTransportGuarantee() == CONFIDENTIAL ? TransportGuaranteeType.CONFIDENTIAL : TransportGuaranteeType.NONE)
            .setEmptyRoleSemantic(emptyRoleSemantic(constraint.getEmptyRoleSemantic()))
            .addRolesAllowed(constraint.getRolesAllowed());

    for (final HttpMethodConstraintElement methodConstraint : constraint.getHttpMethodConstraints()) {
        info.addHttpMethodSecurityInfo(new HttpMethodSecurityInfo()
                .setTransportGuaranteeType(methodConstraint.getTransportGuarantee() == CONFIDENTIAL ? TransportGuaranteeType.CONFIDENTIAL : TransportGuaranteeType.NONE)
                .setMethod(methodConstraint.getMethodName())
                .setEmptyRoleSemantic(emptyRoleSemantic(methodConstraint.getEmptyRoleSemantic()))
                .addRolesAllowed(methodConstraint.getRolesAllowed()));
    }
    return ret;
}
 
开发者ID:lamsfoundation,项目名称:lams,代码行数:36,代码来源:ServletRegistrationImpl.java

示例7: setServletSecurity

import javax.servlet.ServletSecurityElement; //导入依赖的package包/类
@Override
public Set<String> setServletSecurity(ServletSecurityElement constraint) {
	if (constraint == null) {
		throw new IllegalArgumentException(sm.getString("applicationServletRegistration.setServletSecurity.iae",
				getName(), context.getName()));
	}

	if (!context.getState().equals(LifecycleState.STARTING_PREP)) {
		throw new IllegalStateException(sm.getString("applicationServletRegistration.setServletSecurity.ise",
				getName(), context.getName()));
	}

	return context.addServletSecurity(this, constraint);
}
 
开发者ID:how2j,项目名称:lazycat,代码行数:15,代码来源:ApplicationServletRegistration.java

示例8: registerRpcServlet

import javax.servlet.ServletSecurityElement; //导入依赖的package包/类
private RpcServlet registerRpcServlet(ServletContext ctx) {
    LOGGER.info("Starting HTTP RPC runtime");
    RpcServlet servlet = new RpcServlet();
    ServletRegistration.Dynamic regInfo = ctx.addServlet(RpcServlet.class.getName(), servlet);
    ServletSecurityElement sec = new ServletSecurityElement(new HttpConstraintElement());
    regInfo.setServletSecurity(sec);
    regInfo.setLoadOnStartup(1);
    regInfo.addMapping(RpcConfig.getInstance().getPath() + "/http");
    return servlet;
}
 
开发者ID:brutusin,项目名称:Brutusin-RPC,代码行数:11,代码来源:RpcWebInitializer.java

示例9: onStartup

import javax.servlet.ServletSecurityElement; //导入依赖的package包/类
@Override
public void onStartup(Set<Class<?>> c, ServletContext ctx)
        throws ServletException {
    // Register and map servlet
    Servlet s = new Bug50015Servlet();
    ServletRegistration.Dynamic sr = ctx.addServlet("bug50015", s);
    sr.addMapping("/bug50015");
    
    // Limit access to users in the Tomcat role
    HttpConstraintElement hce = new HttpConstraintElement(
            TransportGuarantee.NONE, "tomcat");
    ServletSecurityElement sse = new ServletSecurityElement(hce);
    sr.setServletSecurity(sse);
}
 
开发者ID:WhiteBearSolutions,项目名称:WBSAirback,代码行数:15,代码来源:TestStandardContext.java

示例10: findSecurityConstraints

import javax.servlet.ServletSecurityElement; //导入依赖的package包/类
@Override
public SecurityConstraint[] findSecurityConstraints(final Request request, final Context context) {
    final Map<String, ServletSecurityElement> map = (Map<String, ServletSecurityElement>) invoke(findSecurityConstraintsMethod, request.getRequest(), context.getPath());
    final List<SecurityConstraint> constraints = new ArrayList<SecurityConstraint>();
    for (final Map.Entry<String, ServletSecurityElement> entry : map.entrySet()) {
        constraints.addAll(Arrays.asList(SecurityConstraint.createConstraints(entry.getValue(), entry.getKey())));
    }
    return constraints.toArray(new SecurityConstraint[constraints.size()]);
}
 
开发者ID:apache,项目名称:tomee,代码行数:10,代码来源:LowTypedRealm.java

示例11: ServletHolder

import javax.servlet.ServletSecurityElement; //导入依赖的package包/类
public ServletHolder(Servlet servlet, String name, Map<String, String> initParameters, boolean asyncSupported, boolean isMatchAfter, int loadOnStartup, ServletSecurityElement securityElement, String... urlPatterns) {
    super();
    this.servlet = servlet;
    this.name = name;
    this.initParameters = initParameters;
    this.asyncSupported = asyncSupported;
    this.isMatchAfter = isMatchAfter;
    this.loadOnStartup = loadOnStartup;
    this.securityElement = securityElement;
    this.urlPatterns = Arrays.copyOf(urlPatterns, urlPatterns.length);
}
 
开发者ID:pidster-dot-org,项目名称:embed-apache-tomcat,代码行数:12,代码来源:ServletHolder.java

示例12: addServletSecurity

import javax.servlet.ServletSecurityElement; //导入依赖的package包/类
@Override
public Set<String> addServletSecurity(
        ApplicationServletRegistration registration,
        ServletSecurityElement servletSecurityElement) { return null; }
 
开发者ID:liaokailin,项目名称:tomcat7,代码行数:5,代码来源:FailedContext.java

示例13: addServletSecurity

import javax.servlet.ServletSecurityElement; //导入依赖的package包/类
@Override
public Set<String> addServletSecurity(
        ApplicationServletRegistration registration,
        ServletSecurityElement servletSecurityElement) {
    return null;
}
 
开发者ID:liaokailin,项目名称:tomcat7,代码行数:7,代码来源:TesterContext.java

示例14: setServletSecurity

import javax.servlet.ServletSecurityElement; //导入依赖的package包/类
@Override
public Set<String> setServletSecurity(ServletSecurityElement constraint) {
    return null;
}
 
开发者ID:xm-online,项目名称:xm-ms-entity,代码行数:5,代码来源:WebConfigurerIntTest.java

示例15: addServletSecurity

import javax.servlet.ServletSecurityElement; //导入依赖的package包/类
@Override
public Set<String> addServletSecurity(ApplicationServletRegistration registration,
		ServletSecurityElement servletSecurityElement) {
	return null;
}
 
开发者ID:how2j,项目名称:lazycat,代码行数:6,代码来源:FailedContext.java


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