@Override public void setInitParameter(String name, String value) { webAppContext.setInitParameter(name, value); }
context.setInitParameter(e.getKey(), e.getValue());
webAppContext.setInitParameter("org.eclipse.jetty.servlet.Default.dirAllowed", "false"); webAppContext.setInitParameter("org.eclipse.jetty.servlet.Default.useFileMappedBuffer", "false");
webapp.setWar(warFilePath); webapp.setParentLoaderPriority(false); webapp.setInitParameter("org.eclipse.jetty.servlet.Default.dirAllowed", "false"); webapp.addAliasCheck(new AllowSymLinkAliasChecker());
servletContextHandler.setAttribute("org.eclipse.jetty.server.webapp.ContainerIncludeJarPattern", ".*(/target/classes/|.*.jar)"); servletContextHandler.setParentLoaderPriority(true); servletContextHandler.setInitParameter("useFileMappedBuffer", "false"); servletContextHandler.setAttribute("globalProps", globalProps);
staticContext.setContextPath( mountPoint ); staticContext.setSessionHandler( sessionHandler ); staticContext.setInitParameter( "org.eclipse.jetty.servlet.Default.dirAllowed", "false" ); URL resourceLoc = getClass().getClassLoader().getResource( contentLocation ); if ( resourceLoc != null )
@Override public void addProperty(String key, String value) { context.setInitParameter(key, value); }
WebAppContext webApp = new WebAppContext(); webApp.setInitParameter("org.eclipse.jetty.servlet.Default.dirAllowed", "false");
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); }
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; }
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); } }
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"; }
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); } }
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); }
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; }
webAppContext.setInitParameter("jqmnode", node.getName()); webAppContext.setInitParameter("jqmnodeid", node.getId().toString());
/** * 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(); }
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; }
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; }
webapp.setInitParameter("org.jboss.weld.environment.container.class", "org.jboss.weld.environment.jetty.JettyContainer");