Example usage for javax.servlet ServletSecurityElement ServletSecurityElement

List of usage examples for javax.servlet ServletSecurityElement ServletSecurityElement

Introduction

In this page you can find the example usage for javax.servlet ServletSecurityElement ServletSecurityElement.

Prototype

public ServletSecurityElement(ServletSecurity annotation) 

Source Link

Document

Constructs an instance from a ServletSecurity annotation value.

Usage

From source file:org.brutusin.rpc.RpcWebInitializer.java

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);/*from w  w w  . j av  a  2 s  . c o  m*/
    regInfo.setLoadOnStartup(1);
    regInfo.addMapping(RpcConfig.getInstance().getPath() + "/http");
    return servlet;
}