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


Java ServletInfo类代码示例

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


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

示例1: addServlet

import io.undertow.servlet.api.ServletInfo; //导入依赖的package包/类
@Override
public ServletRegistration.Dynamic addServlet(final String servletName, final String className) {
    ensureNotProgramaticListener();
    ensureNotInitialized();
    try {
        if (deploymentInfo.getServlets().containsKey(servletName)) {
            return null;
        }
        ServletInfo servlet = new ServletInfo(servletName, (Class<? extends Servlet>) deploymentInfo.getClassLoader().loadClass(className));
        readServletAnnotations(servlet);
        deploymentInfo.addServlet(servlet);
        ServletHandler handler = deployment.getServlets().addServlet(servlet);
        return new ServletRegistrationImpl(servlet, handler.getManagedServlet(), deployment);
    } catch (ClassNotFoundException e) {
        throw UndertowServletMessages.MESSAGES.cannotLoadClass(className, e);
    }
}
 
开发者ID:lamsfoundation,项目名称:lams,代码行数:18,代码来源:ServletContextImpl.java

示例2: isUserInRole

import io.undertow.servlet.api.ServletInfo; //导入依赖的package包/类
@Override
public boolean isUserInRole(String role, Account account, ServletInfo servletInfo, HttpServletRequest request, Deployment deployment) {

    final Map<String, Set<String>> principalVersusRolesMap = deployment.getDeploymentInfo().getPrincipalVersusRolesMap();
    final Set<String> roles = principalVersusRolesMap.get(account.getPrincipal().getName());
    //TODO: a more efficient imple
    for (SecurityRoleRef ref : servletInfo.getSecurityRoleRefs()) {
        if (ref.getRole().equals(role)) {
            if (roles != null && roles.contains(ref.getLinkedRole())) {
                return true;
            }
            return account.getRoles().contains(ref.getLinkedRole());
        }
    }
    if (roles != null && roles.contains(role)) {
        return true;
    }
    return account.getRoles().contains(role);
}
 
开发者ID:lamsfoundation,项目名称:lams,代码行数:20,代码来源:DefaultAuthorizationManager.java

示例3: undertowDeployment

import io.undertow.servlet.api.ServletInfo; //导入依赖的package包/类
static DeploymentInfo undertowDeployment(ResteasyDeployment deployment, String mapping) {
    if (mapping == null) {
        mapping = "/";
    }

    if (!mapping.startsWith("/")) {
        mapping = '/' + mapping;
    }

    if (!mapping.endsWith("/")) {
        mapping = mapping + '/';
    }

    mapping = mapping + '*';
    String prefix = null;
    if (!mapping.equals("/*")) {
        prefix = mapping.substring(0, mapping.length() - 2);
    }

    ServletInfo resteasyServlet = Servlets.servlet("ResteasyServlet", HttpServlet30Dispatcher.class).setAsyncSupported(true).setLoadOnStartup(1).addMapping(mapping);
    if (prefix != null) {
        resteasyServlet.addInitParam("resteasy.servlet.mapping.prefix", prefix);
    }

    return (new DeploymentInfo()).addServletContextAttribute(ResteasyDeployment.class.getName(), deployment).addServlet(resteasyServlet);
}
 
开发者ID:automenta,项目名称:spimedb,代码行数:27,代码来源:WebServer.java

示例4: testConversion

import io.undertow.servlet.api.ServletInfo; //导入依赖的package包/类
@Test
public void testConversion() {
    Class<? extends HttpServlet> servletClass = DefaultServlet.class;
    String name = "name";
    String[] value = new String[]{"a"};
    String[] urlPatterns = new String[]{"/b"};
    int loadOnStartup = 2;
    WebInitParam[] initParams = new WebInitParam[]{new WebParam("name","value")};
    boolean asyncSupported = true;
    ServletDescriptor servletDescriptor = new ServletDescriptor(name, value, urlPatterns, loadOnStartup,
            initParams, asyncSupported, servletClass);
    ServletInfo servletInfo = mapper.apply(servletDescriptor);

    assertThat(servletInfo.getName()).isEqualTo(name);
    assertThat(servletInfo.getServletClass()).isEqualTo(servletClass);
    assertThat(servletInfo.getMappings()).isEqualTo(asList(urlPatterns));
    assertThat(servletInfo.getLoadOnStartup()).isEqualTo(loadOnStartup);
    assertThat(servletInfo.isAsyncSupported()).isEqualTo(asyncSupported);
    assertThat(servletInfo.getInitParams()).isEqualTo(singletonMap("name","value"));
}
 
开发者ID:hammock-project,项目名称:hammock,代码行数:21,代码来源:UndertowServletMapperTest.java

示例5: readServletAnnotations

import io.undertow.servlet.api.ServletInfo; //导入依赖的package包/类
private void readServletAnnotations(ServletInfo servlet) {
    if (System.getSecurityManager() == null) {
        new ReadServletAnnotationsTask(servlet, deploymentInfo).run();
    } else {
        AccessController.doPrivileged(new ReadServletAnnotationsTask(servlet, deploymentInfo));
    }
}
 
开发者ID:lamsfoundation,项目名称:lams,代码行数:8,代码来源:ServletContextImpl.java

示例6: LifecyleInterceptorInvocation

import io.undertow.servlet.api.ServletInfo; //导入依赖的package包/类
LifecyleInterceptorInvocation(List<LifecycleInterceptor> list, ServletInfo servletInfo, Servlet servlet,  ServletConfig servletConfig) {
    this.list = list;
    this.servletInfo = servletInfo;
    this.servlet = servlet;
    this.servletConfig = servletConfig;
    this.filter = null;
    this.filterConfig = null;
    this.filterInfo = null;
    i = list.size();
}
 
开发者ID:lamsfoundation,项目名称:lams,代码行数:11,代码来源:LifecyleInterceptorInvocation.java

示例7: handleRequest

import io.undertow.servlet.api.ServletInfo; //导入依赖的package包/类
@Override
public void handleRequest(final HttpServerExchange exchange) throws Exception {
    ServletRequestContext context = exchange.getAttachment(ServletRequestContext.ATTACHMENT_KEY);
    ServletInfo servletInfo = context.getCurrentServlet().getManagedServlet().getServletInfo();
    MetricsHandler handler = servletHandlers.get(servletInfo.getName());
    if(handler != null) {
        handler.handleRequest(exchange);
    } else {
        next.handleRequest(exchange);
    }
}
 
开发者ID:lamsfoundation,项目名称:lams,代码行数:12,代码来源:MetricsChainHandler.java

示例8: canAccessResource

import io.undertow.servlet.api.ServletInfo; //导入依赖的package包/类
@Override
public boolean canAccessResource(List<SingleConstraintMatch> constraints, Account account, ServletInfo servletInfo, HttpServletRequest request, Deployment deployment) {
    if (constraints == null || constraints.isEmpty()) {
        return true;
    }
    for (final SingleConstraintMatch constraint : constraints) {

        boolean found = false;

        Set<String> roleSet = constraint.getRequiredRoles();
        if (roleSet.isEmpty() && constraint.getEmptyRoleSemantic() != SecurityInfo.EmptyRoleSemantic.DENY) {
                /*
                 * The EmptyRoleSemantic was either PERMIT or AUTHENTICATE, either way a roles check is not needed.
                 */
            found = true;
        } else if (account != null) {
            final Set<String> roles = deployment.getDeploymentInfo().getPrincipalVersusRolesMap().get(account.getPrincipal().getName());

            for (String role : roleSet) {
                if (roles != null) {
                    if (roles.contains(role)) {
                        found = true;
                        break;
                    }
                }
                if (account.getRoles().contains(role)) {
                    found = true;
                    break;
                }
            }
        }
        if (!found) {
            return false;
        }
    }
    return true;

}
 
开发者ID:lamsfoundation,项目名称:lams,代码行数:39,代码来源:DefaultAuthorizationManager.java

示例9: ManagedServlet

import io.undertow.servlet.api.ServletInfo; //导入依赖的package包/类
public ManagedServlet(final ServletInfo servletInfo, final ServletContextImpl servletContext) {
    this.servletInfo = servletInfo;
    this.servletContext = servletContext;
    if (SingleThreadModel.class.isAssignableFrom(servletInfo.getServletClass())) {
        instanceStrategy = new SingleThreadModelPoolStrategy(servletInfo.getInstanceFactory(), servletInfo, servletContext);
    } else {
        instanceStrategy = new DefaultInstanceStrategy(servletInfo.getInstanceFactory(), servletInfo, servletContext);
    }
    setupMultipart(servletContext);
}
 
开发者ID:lamsfoundation,项目名称:lams,代码行数:11,代码来源:ManagedServlet.java

示例10: createServletsAndFilters

import io.undertow.servlet.api.ServletInfo; //导入依赖的package包/类
private void createServletsAndFilters(final DeploymentImpl deployment, final DeploymentInfo deploymentInfo) {
    for (Map.Entry<String, ServletInfo> servlet : deploymentInfo.getServlets().entrySet()) {
        deployment.getServlets().addServlet(servlet.getValue());
    }
    for (Map.Entry<String, FilterInfo> filter : deploymentInfo.getFilters().entrySet()) {
        deployment.getFilters().addFilter(filter.getValue());
    }
}
 
开发者ID:lamsfoundation,项目名称:lams,代码行数:9,代码来源:DeploymentManagerImpl.java

示例11: addServlet

import io.undertow.servlet.api.ServletInfo; //导入依赖的package包/类
public ServletHandler addServlet(final ServletInfo servletInfo) {
    ManagedServlet managedServlet = new ManagedServlet(servletInfo, deployment.getServletContext());
    ServletHandler servletHandler = new ServletHandler(managedServlet);
    managedServletMap.put(servletInfo.getName(), servletHandler);
    deployment.addLifecycleObjects(managedServlet);
    this.servletPaths.invalidate();

    return servletHandler;
}
 
开发者ID:lamsfoundation,项目名称:lams,代码行数:10,代码来源:ManagedServlets.java

示例12: createServletInfo

import io.undertow.servlet.api.ServletInfo; //导入依赖的package包/类
private static ServletInfo createServletInfo(String mapping, String servletName, Class<? extends Servlet> servlet)
        throws NoSuchMethodException {
    ServletInfo servletInfo = Servlets
            .servlet(servletName, servlet)
            .setAsyncSupported(true)
            .setLoadOnStartup(1)
            .addMapping(mapping);
    servletInfo.setInstanceFactory(CdiClassIntrospecter.INSTANCE.createInstanceFactory(servlet));

    return servletInfo;
}
 
开发者ID:shamoh,项目名称:standalone-javax-mvc,代码行数:12,代码来源:Main.java

示例13: startUndertow

import io.undertow.servlet.api.ServletInfo; //导入依赖的package包/类
private static void startUndertow() throws ServletException {
    ServletInfo servletInfo = new ServletInfo(VaadinServlet.class.getName(), VaadinServlet.class)
            .setAsyncSupported(true)
            .setLoadOnStartup(1)
            .addInitParam("ui", "com.hybridbpm.ui.HybridbpmUI").addInitParam("widgetset", "com.hybridbpm.ui.HybridbpmWidgetSet")
            .addMapping("/*").addMapping("/VAADIN");

    DeploymentInfo deploymentInfo = deployment()
            .setClassLoader(HybridbpmServer.class.getClassLoader())
            .setContextPath(PATH)
            .setDeploymentName("hybridbpm.war")
            .setDisplayName("HYBRIDBPM")
            .setResourceManager(new ClassPathResourceManager(HybridbpmServer.class.getClassLoader()))
            .addServlets(servletInfo)
            .addServletContextAttribute(WebSocketDeploymentInfo.ATTRIBUTE_NAME, new WebSocketDeploymentInfo());

    DeploymentManager manager = defaultContainer().addDeployment(deploymentInfo);
    manager.deploy();

    PathHandler path = Handlers.path(Handlers.redirect(PATH)).addPrefixPath(PATH, manager.start());

    Undertow.Builder builder = Undertow.builder().addHttpListener(8080, "0.0.0.0").setHandler(path);

    undertow = builder.build();
    undertow.start();
    logger.info("HybridbpmServer UI started");
}
 
开发者ID:hybridbpm,项目名称:hybridbpm,代码行数:28,代码来源:HybridbpmServer.java

示例14: createFathomDeploymentManager

import io.undertow.servlet.api.ServletInfo; //导入依赖的package包/类
protected DeploymentManager createFathomDeploymentManager() throws ServletException {

        DeploymentInfo info = Servlets.deployment();
        info.setDeploymentName("Fathom");
        info.setClassLoader(this.getClass().getClassLoader());
        info.setContextPath(settings.getContextPath());
        info.setIgnoreFlush(true);
        info.setDefaultEncoding("UTF-8");

        FilterInfo guiceFilter = new FilterInfo("GuiceFilter", GuiceFilter.class);
        guiceFilter.setAsyncSupported(true);

        info.addFilterUrlMapping("GuiceFilter", "/*", DispatcherType.REQUEST);
        info.addFilters(guiceFilter);

        ServletInfo defaultServlet = new ServletInfo("DefaultServlet", DefaultServlet.class);
        defaultServlet.setAsyncSupported(true);
        defaultServlet.addMapping("/");

        ServletContextListener fathomListener = new ServletContextListener(settings);

        info.addListeners(new ListenerInfo(ServletContextListener.class, new ImmediateInstanceFactory<>(fathomListener)));

        MultipartConfigElement multipartConfig = new MultipartConfigElement(settings.getUploadFilesLocation(), settings.getUploadFilesMaxSize(), -1L, 0);
        defaultServlet.setMultipartConfig(multipartConfig);
        info.addServlets(defaultServlet);

        DeploymentManager deploymentManager = Servlets.defaultContainer().addDeployment(info);
        deploymentManager.deploy();

        return deploymentManager;
    }
 
开发者ID:gitblit,项目名称:fathom,代码行数:33,代码来源:Server.java

示例15: deployJaxrs

import io.undertow.servlet.api.ServletInfo; //导入依赖的package包/类
protected void deployJaxrs(BootContext context) {
  String adminJaxrs = context.properties().getProperty("vas.admin.jaxrs", "false");
  if(Boolean.valueOf(adminJaxrs)) {
    DeploymentInfo deploymentInfo = context.deploymentInfo();

    ServletInfo servletInfo = Servlets.servlet("admin-jaxrs", AdminServlet.class).setEnabled(true)
      .setAsyncSupported(true).setLoadOnStartup(1).addMappings("/admin/jaxrs");

    deploymentInfo.addServlet(servletInfo);
  }
}
 
开发者ID:vvergnolle,项目名称:vas,代码行数:12,代码来源:AdminHttpHandlerPostProcessor.java


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