org.eclipse.jetty.webapp.WebAppContext.setInitParameter()方法的使用及代码示例

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

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

WebAppContext.setInitParameter介绍

暂无

代码示例

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

@Override
public void setInitParameter(String name, String value) {
  webAppContext.setInitParameter(name, value);
}

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

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

代码示例来源:origin: Dreampie/Resty

webAppContext.setInitParameter("org.eclipse.jetty.servlet.Default.dirAllowed", "false");
webAppContext.setInitParameter("org.eclipse.jetty.servlet.Default.useFileMappedBuffer", "false");

代码示例来源:origin: apache/geode

webapp.setWar(warFilePath);
webapp.setParentLoaderPriority(false);
webapp.setInitParameter("org.eclipse.jetty.servlet.Default.dirAllowed", "false");
webapp.addAliasCheck(new AllowSymLinkAliasChecker());

代码示例来源:origin: DeemOpen/zkui

servletContextHandler.setAttribute("org.eclipse.jetty.server.webapp.ContainerIncludeJarPattern", ".*(/target/classes/|.*.jar)");
servletContextHandler.setParentLoaderPriority(true);
servletContextHandler.setInitParameter("useFileMappedBuffer", "false");
servletContextHandler.setAttribute("globalProps", globalProps);

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

staticContext.setContextPath( mountPoint );
staticContext.setSessionHandler( sessionHandler );
staticContext.setInitParameter( "org.eclipse.jetty.servlet.Default.dirAllowed", "false" );
URL resourceLoc = getClass().getClassLoader().getResource( contentLocation );
if ( resourceLoc != null )

代码示例来源:origin: pl.edu.icm.synat/synat-platform-integration-tests

@Override
public void addProperty(String key, String value) {
  context.setInitParameter(key, value);
}

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

WebAppContext webApp = new WebAppContext();
webApp.setInitParameter("org.eclipse.jetty.servlet.Default.dirAllowed", "false");

代码示例来源:origin: apache/cloudstack

private HandlerCollection createHandlers() {
  final WebAppContext webApp = new WebAppContext();
  webApp.setContextPath(contextPath);
  webApp.setInitParameter("org.eclipse.jetty.servlet.Default.dirAllowed", "false");
  webApp.getSessionHandler().setMaxInactiveInterval(sessionTimeout * 60);
  // GZIP handler
  final GzipHandler gzipHandler = new GzipHandler();
  gzipHandler.addIncludedMimeTypes("text/html", "text/xml", "text/css", "text/plain", "text/javascript", "application/javascript", "application/json", "application/xml");
  gzipHandler.setIncludedMethods("GET", "POST");
  gzipHandler.setCompressionLevel(9);
  gzipHandler.setHandler(webApp);
  if (Strings.isNullOrEmpty(webAppLocation)) {
    webApp.setWar(getShadedWarUrl());
  } else {
    webApp.setWar(webAppLocation);
  }
  // Request log handler
  final RequestLogHandler log = new RequestLogHandler();
  log.setRequestLog(createRequestLog());
  // Redirect root context handler
  MovedContextHandler rootRedirect = new MovedContextHandler();
  rootRedirect.setContextPath("/");
  rootRedirect.setNewContextURL(contextPath);
  rootRedirect.setPermanent(true);
  // Put rootRedirect at the end!
  return new HandlerCollection(log, gzipHandler, rootRedirect);
}

代码示例来源:origin: apache/atlas

protected WebAppContext getWebAppContext(String path) {
  WebAppContext application = new WebAppContext(path, "/");
  application.setClassLoader(Thread.currentThread().getContextClassLoader());
  // Disable directory listing
  application.setInitParameter("org.eclipse.jetty.servlet.Default.dirAllowed", "false");
  return application;
}

代码示例来源:origin: coderczp/dlog

public void start() {
  try {
    WebAppContext web = new WebAppContext();
    web.setResourceBase("web");
    web.setParentLoaderPriority(true);
    web.addServlet(new ServletHolder(this), "/ws");
    web.setInitParameter(useMap, System.getProperty("debug", "false"));
    server = new Server(port);
    server.setHandler(web);
    server.start();
  } catch (Exception e) {
    throw new RuntimeException(e);
  }
}

代码示例来源:origin: com.github.jruby-gradle/jruby-gradle-plugin

public String addRepository(String url) {
  if (urls.contains(url)) {
    return null;
  }
  String path = "/" + url.replace("://", "_")
              .replace(":", "_")
              .replace("/", "_")
              .replace(".", "_");
  WebAppContext context = new WebAppContext();
  context.setServer(server);
  context.setContextPath(path);
  context.setExtractWAR(false);
  context.setCopyWebInf(true);
  context.setWar(rubygemsWarURI);
  context.setInitParameter("gem-caching-proxy-url", url);
  context.setInitParameter("gem-caching-proxy-storage",
               new File(cachedir, path).getAbsolutePath());
  // do not setup other repos
  context.setInitParameter("gem-proxy-storage", "");
  context.setInitParameter("gem-hosted-storage", "");
  context.setInitParameter("gem-merged", "false");
  this.handlerCollection.addHandler(context);
  return path + "/caching/maven/releases";
}

代码示例来源:origin: pl.edu.icm.synat/synat-platform-integration-tests

public void start() {
  server.setConnectors(new Connector[] { connector });
  connector.setPort(Integer.parseInt(httpPort));
  context.setContextPath(contextPath);
  context.setParentLoaderPriority(true);
  
  context.setWar(getWarPath());
  
  for (Map.Entry<String, String> property : casServerProperties.entrySet()) {
    context.setInitParameter(property.getKey(), property.getValue());
  }
  
  server.setHandler(context);
  try {
    server.start();
  
    for (CasServerListener casServerListener : casServerListeners) {
      casServerListener.casServerStarted();
    }
  } catch (final Exception e) {
    logger.error("Exception reported", e);
  }
  
}

代码示例来源:origin: org.unidal.framework/test-framework

protected void configure(WebAppContext context) throws Exception {
 File warRoot = getWarRoot();
 m_resource = new WebModuleResource(warRoot);
 context.setInitParameter("org.eclipse.jetty.servlet.Default.dirAllowed", "false");
 context.setContextPath(getContextPath());
 context.setDescriptor(new File(warRoot, "WEB-INF/web.xml").getPath());
 context.setBaseResource(m_resource);
}

代码示例来源:origin: org.apache.geode/gemfire-core

public static Server addWebApplication(final Server jetty,
  final String webAppContext, final String warFilePath) {
 WebAppContext webapp = new WebAppContext();
 webapp.setContextPath(webAppContext);
 webapp.setWar(warFilePath);
 webapp.setParentLoaderPriority(false);
 webapp.setInitParameter("org.eclipse.jetty.servlet.Default.dirAllowed", "false");
 File tmpPath = new File(getWebAppBaseDirectory(webAppContext));
 tmpPath.mkdirs();
 webapp.setTempDirectory(tmpPath);
 ((HandlerCollection) jetty.getHandler()).addHandler(webapp);
 return jetty;
}

代码示例来源:origin: com.enioka.jqm/jqm-service

webAppContext.setInitParameter("jqmnode", node.getName());
webAppContext.setInitParameter("jqmnodeid", node.getId().toString());

代码示例来源:origin: org.avaje.glue/jetty-runner

/**
 * Create the WebAppContext with basic configurations set like context path etc.
 */
void createWebAppContext() {
 webapp.setServerClasses(getServerClasses());
 webapp.setContextPath(contextPath);
 webapp.setTempDirectory(createTempDir("jetty-app-"));
 webapp.setInitParameter("org.eclipse.jetty.servlet.Default.dirAllowed", "false");
 setSecureCookies();
}

代码示例来源:origin: org.apache.knox/gateway-server

private WebAppContext createWebAppContext( Topology topology, File warFile, String warPath ) throws IOException, ZipException, TransformerException, SAXException, ParserConfigurationException {
 String topoName = topology.getName();
 WebAppContext context = new WebAppContext();
 String contextPath;
 contextPath = "/" + Urls.trimLeadingAndTrailingSlashJoin( config.getGatewayPath(), topoName, warPath );
 context.setContextPath( contextPath );
 SessionCookieConfig sessionCookieConfig = context.getServletContext().getSessionCookieConfig();
 sessionCookieConfig.setName(KNOXSESSIONCOOKIENAME);
 context.setWar( warFile.getAbsolutePath() );
 context.setAttribute( GatewayServices.GATEWAY_CLUSTER_ATTRIBUTE, topoName );
 context.setAttribute( "org.apache.knox.gateway.frontend.uri", getFrontendUri( context, config ) );
 context.setAttribute( GatewayConfig.GATEWAY_CONFIG_ATTRIBUTE, config );
 // Add support for JSPs.
 context.setAttribute(
   "org.eclipse.jetty.server.webapp.ContainerIncludeJarPattern",
   ".*/[^/]*servlet-api-[^/]*\\.jar$|.*/javax.servlet.jsp.jstl-.*\\.jar$|.*/[^/]*taglibs.*\\.jar$" );
 context.setTempDirectory( FileUtils.getFile( warFile, "META-INF", "temp" ) );
 context.setErrorHandler( createErrorHandler() );
 context.setInitParameter("org.eclipse.jetty.servlet.Default.dirAllowed", "false");
 ClassLoader jspClassLoader = new URLClassLoader(new URL[0], this.getClass().getClassLoader());
 context.setClassLoader(jspClassLoader);
 return context;
}

代码示例来源:origin: apache/knox

private WebAppContext createWebAppContext( Topology topology, File warFile, String warPath ) throws IOException, ZipException, TransformerException, SAXException, ParserConfigurationException {
 String topoName = topology.getName();
 WebAppContext context = new WebAppContext();
 String contextPath;
 contextPath = "/" + Urls.trimLeadingAndTrailingSlashJoin( config.getGatewayPath(), topoName, warPath );
 context.setContextPath( contextPath );
 SessionCookieConfig sessionCookieConfig = context.getServletContext().getSessionCookieConfig();
 sessionCookieConfig.setName(KNOXSESSIONCOOKIENAME);
 context.setWar( warFile.getAbsolutePath() );
 context.setAttribute( GatewayServices.GATEWAY_CLUSTER_ATTRIBUTE, topoName );
 context.setAttribute( "org.apache.knox.gateway.frontend.uri", getFrontendUri( context, config ) );
 context.setAttribute( GatewayConfig.GATEWAY_CONFIG_ATTRIBUTE, config );
 // Add support for JSPs.
 context.setAttribute(
   "org.eclipse.jetty.server.webapp.ContainerIncludeJarPattern",
   ".*/[^/]*servlet-api-[^/]*\\.jar$|.*/javax.servlet.jsp.jstl-.*\\.jar$|.*/[^/]*taglibs.*\\.jar$" );
 context.setTempDirectory( FileUtils.getFile( warFile, "META-INF", "temp" ) );
 context.setErrorHandler( createErrorHandler() );
 context.setInitParameter("org.eclipse.jetty.servlet.Default.dirAllowed", "false");
 ClassLoader jspClassLoader = new URLClassLoader(new URL[0], this.getClass().getClassLoader());
 context.setClassLoader(jspClassLoader);
 return context;
}

代码示例来源:origin: org.eclipse.jetty/jetty-cdi

webapp.setInitParameter("org.jboss.weld.environment.container.class",
    "org.jboss.weld.environment.jetty.JettyContainer");

相关文章

微信公众号

最新文章

更多

WebAppContext类方法