org.glassfish.grizzly.servlet.WebappContext.addContextInitParameter()方法的使用及代码示例

x33g5p2x  于2022-02-03 转载在 其他  
字(2.8k)|赞(0)|评价(0)|浏览(84)

本文整理了Java中org.glassfish.grizzly.servlet.WebappContext.addContextInitParameter()方法的一些代码示例,展示了WebappContext.addContextInitParameter()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。WebappContext.addContextInitParameter()方法的具体详情如下:
包路径:org.glassfish.grizzly.servlet.WebappContext
类名称:WebappContext
方法名:addContextInitParameter

WebappContext.addContextInitParameter介绍

暂无

代码示例

代码示例来源:origin: jersey/jersey

context.addContextInitParameter(contextParamName, contextParams.get(contextParamName));

代码示例来源:origin: stackoverflow.com

@Before
public void setUp() throws Exception {
  if (server == null) {
    System.out.println("Initializing an instance of Grizzly Container");
    final ResourceConfig rc = new ResourceConfig(A.class, B.class);

    WebappContext ctx = new WebappContext() {};
    ctx.addContextInitParameter("contextConfigLocation", "classpath:applicationContext.xml");

    ctx.addListener("com.package.something.AServletContextListener");

    server = GrizzlyHttpServerFactory.createHttpServer(URI.create(BASE_URI), rc);
      ctx.deploy(server);
    }
  }

代码示例来源:origin: stackoverflow.com

@Before
 public void setup() throws Exception {
   if (server == null) {
     System.out.println("Initializing an instance of Grizzly Container ...");
     final ResourceConfig rc = new ResourceConfig(ResourceEndpointIntegrationTest.class, ..., ..., ...); //update
     WebappContext ctx = new WebappContext("IntegrationTestContext");
           //register your listeners from web.xml in here
     ctx.addListener("com.xxx.yyy.XEndpointServletContextListener");
           //register your applicationContext.xml here
     ctx.addContextInitParameter("contextConfigLocation", "classpath:applicationContext.xml");
           //ServletRegistration is needed to load the ResourceConfig rc inside ServletContainer or you will have no 
           //Servlet-based features available 
     ServletRegistration registration = ctx.addServlet("ServletContainer",
         new ServletContainer(rc));
           //Initialize the Grizzly server passing it base URL
     server = GrizzlyHttpServerFactory.createHttpServer(URI.create(BASE_URI));
           //Deploy the server using our custom context
     ctx.deploy(server);
   }
 }

代码示例来源:origin: stackoverflow.com

final ServletRegistration reg = ctx.addServlet("spring", new SpringServlet());
reg.addMapping("/*");
ctx.addContextInitParameter("contextConfigLocation", "classpath:spring-context.xml");
ctx.addListener("org.springframework.web.context.ContextLoaderListener");
ctx.addListener("org.springframework.web.context.request.RequestContextListener");

代码示例来源:origin: com.sun.jersey.jersey-test-framework/jersey-test-framework-grizzly2

context.addContextInitParameter(contextParamName, contextParams.get(contextParamName));

代码示例来源:origin: org.glassfish.jersey.test-framework.providers/jersey-test-framework-provider-grizzly2

context.addContextInitParameter(contextParamName, contextParams.get(contextParamName));

相关文章

WebappContext类方法