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

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

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

WebappContext.setInitParameter介绍

暂无

代码示例

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

context.setInitParameter(e.getKey(), e.getValue());

代码示例来源:origin: com.helger/peppol-smp-server-webapp

@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 aRegistration;
 if (aServletClass != null)
  aRegistration = aContext.addServlet (aServletClass.getName (), aServletClass);
 else
  aRegistration = aContext.addServlet (aServlet.getClass ().getName (), aServlet);
 aRegistration.addMapping ("/*");
 if (aContextInitParams != null)
  for (final Map.Entry <String, String> e : aContextInitParams.entrySet ())
   aContext.setInitParameter (e.getKey (), e.getValue ());
 if (aInitParams != null)
  aRegistration.setInitParameters (aInitParams);
 return aContext;
}

代码示例来源:origin: phax/peppol-smp-server

@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 aRegistration;
 if (aServletClass != null)
  aRegistration = aContext.addServlet (aServletClass.getName (), aServletClass);
 else
  aRegistration = aContext.addServlet (aServlet.getClass ().getName (), aServlet);
 aRegistration.addMapping ("/*");
 if (aContextInitParams != null)
  for (final Map.Entry <String, String> e : aContextInitParams.entrySet ())
   aContext.setInitParameter (e.getKey (), e.getValue ());
 if (aInitParams != null)
  aRegistration.setInitParameters (aInitParams);
 return aContext;
}

相关文章

WebappContext类方法