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


Java ServletRegistration.setInitParameters方法代码示例

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


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

示例1: _createContext

import org.glassfish.grizzly.servlet.ServletRegistration; //导入方法依赖的package包/类
@Nonnull
private static WebappContext _createContext (final URI u,
                                             final Class <? extends Servlet> aServletClass,
                                             final Servlet aServlet,
                                             final Map <String, String> aInitParams,
                                             final Map <String, String> aContextInitParams)
{
  String path = u.getPath ();
  if (path == null)
    throw new IllegalArgumentException ("The URI path, of the URI " + u + ", must be non-null");
  if (path.isEmpty ())
    throw new IllegalArgumentException ("The URI path, of the URI " + u + ", must be present");
  if (path.charAt (0) != '/')
    throw new IllegalArgumentException ("The URI path, of the URI " + u + ". must start with a '/'");
  path = String.format ("/%s", UriComponent.decodePath (u.getPath (), true).get (1).toString ());

  final WebappContext aContext = new WebappContext ("GrizzlyContext", path);
  ServletRegistration registration;
  if (aServletClass != null)
    registration = aContext.addServlet (aServletClass.getName (), aServletClass);
  else
    registration = aContext.addServlet (aServlet.getClass ().getName (), aServlet);
  registration.addMapping ("/*");

  if (aContextInitParams != null)
    for (final Map.Entry <String, String> e : aContextInitParams.entrySet ())
      aContext.setInitParameter (e.getKey (), e.getValue ());

  if (aInitParams != null)
    registration.setInitParameters (aInitParams);

  return aContext;
}
 
开发者ID:phax,项目名称:peppol-directory,代码行数:34,代码来源:MockServer.java

示例2: registerServlet

import org.glassfish.grizzly.servlet.ServletRegistration; //导入方法依赖的package包/类
private void registerServlet(final WebappContext webapp) {
    ServletRegistration registration = webapp.addServlet(servlet.getSimpleName(), servlet);
    registration.addMapping(mapping);
    registration.setInitParameters(initParameters);
    registration.setLoadOnStartup(1);
}
 
开发者ID:trautonen,项目名称:jersey-mustache,代码行数:7,代码来源:GrizzlyServerBuilder.java


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