Java Code Examples for org.eclipse.jetty.webapp.WebAppContext#setDescriptor()
The following examples show how to use
org.eclipse.jetty.webapp.WebAppContext#setDescriptor() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: CommandServletUnitTest.java From Scribengin with GNU Affero General Public License v3.0 | 6 votes |
@BeforeClass public static void setup() throws Exception { CommandServerTestBase.setup(); Registry registry = CommandServerTestBase.getNewRegistry(); try { registry.connect(); } catch (RegistryException e) { e.printStackTrace(); } //Point our context to our web.xml we want to use for testing WebAppContext webapp = new WebAppContext(); webapp.setResourceBase(CommandServerTestBase.getCommandServerFolder()); webapp.setDescriptor(CommandServerTestBase.getCommandServerXml()); //Bring up commandServer using that context commandServer = new JettyServer(port, CommandServlet.class); commandServer.setHandler(webapp); commandServer.start(); }
Example 2
Source File: ExampleServerDstu3IT.java From hapi-fhir-jpaserver-starter with Apache License 2.0 | 6 votes |
@BeforeClass public static void beforeClass() throws Exception { String path = Paths.get("").toAbsolutePath().toString(); ourLog.info("Project base path is: {}", path); ourServer = new Server(0); WebAppContext webAppContext = new WebAppContext(); webAppContext.setContextPath("/hapi-fhir-jpaserver"); webAppContext.setDescriptor(path + "/src/main/webapp/WEB-INF/web.xml"); webAppContext.setResourceBase(path + "/target/hapi-fhir-jpaserver-starter"); webAppContext.setParentLoaderPriority(true); ourServer.setHandler(webAppContext); ourServer.start(); ourPort = JettyUtil.getPortForStartedServer(ourServer); ourCtx.getRestfulClientFactory().setServerValidationMode(ServerValidationModeEnum.NEVER); ourCtx.getRestfulClientFactory().setSocketTimeout(1200 * 1000); String ourServerBase = "http://localhost:" + ourPort + "/hapi-fhir-jpaserver/fhir/"; ourClient = ourCtx.newRestfulGenericClient(ourServerBase); ourClient.registerInterceptor(new LoggingInterceptor(true)); }
Example 3
Source File: JMMain.java From jmonitor with GNU General Public License v2.0 | 6 votes |
public static void main(String[] args) throws Exception { int port = 8088; if (args.length > 0) { port = Integer.valueOf(args[0]); } WebAppContext context = new WebAppContext(); context.setDescriptor("./webapp/WEB-INF/web.xml"); context.setParentLoaderPriority(true); context.setResourceBase("./webapp"); context.setContextPath("/"); Server server = new Server(port); server.setHandler(context); server.start(); System.out.println("jmontior running at:"+port); }
Example 4
Source File: CommandProxyServletRetryUnitTest.java From Scribengin with GNU Affero General Public License v3.0 | 6 votes |
@Before public void setup() throws Exception{ //Bring up ZK and all that jazz CommandServerTestBase.setup(); registry = CommandServerTestBase.getNewRegistry(); try { registry.connect(); } catch (RegistryException e) { e.printStackTrace(); } //Add the entry to tell the proxy server where to go to find the commandServer registry.create(registryPath, ("http://localhost:"+Integer.toString(commandPort)).getBytes(), NodeCreateMode.PERSISTENT); //Start proxy WebAppContext proxyApp = new WebAppContext(); proxyApp.setResourceBase(CommandServerTestBase.getProxyServerFolder()); proxyApp.setDescriptor( CommandServerTestBase.getProxyServerXml()); proxyServer = new JettyServer(proxyPort, CommandProxyServlet.class); proxyServer.setHandler(proxyApp); proxyServer.start(); }
Example 5
Source File: ExampleServerDstu2IT.java From hapi-fhir-jpaserver-starter with Apache License 2.0 | 6 votes |
@BeforeClass public static void beforeClass() throws Exception { String path = Paths.get("").toAbsolutePath().toString(); ourLog.info("Project base path is: {}", path); ourServer = new Server(0); WebAppContext webAppContext = new WebAppContext(); webAppContext.setContextPath("/hapi-fhir-jpaserver"); webAppContext.setDescriptor(path + "/src/main/webapp/WEB-INF/web.xml"); webAppContext.setResourceBase(path + "/target/hapi-fhir-jpaserver-starter"); webAppContext.setParentLoaderPriority(true); ourServer.setHandler(webAppContext); ourServer.start(); ourPort = JettyUtil.getPortForStartedServer(ourServer); ourCtx.getRestfulClientFactory().setServerValidationMode(ServerValidationModeEnum.NEVER); ourCtx.getRestfulClientFactory().setSocketTimeout(1200 * 1000); String ourServerBase = "http://localhost:" + ourPort + "/hapi-fhir-jpaserver/fhir/"; ourClient = ourCtx.newRestfulGenericClient(ourServerBase); ourClient.registerInterceptor(new LoggingInterceptor(true)); }
Example 6
Source File: JettyFactory.java From java-tutorial with Creative Commons Attribution Share Alike 4.0 International | 6 votes |
public static void initWebAppContext(Server server, int type) throws Exception { System.out.println("[INFO] Application loading"); WebAppContext webAppContext = (WebAppContext) server.getHandler(); webAppContext.setContextPath(CONTEXT); webAppContext.setResourceBase(getAbsolutePath() + RESOURCE_BASE_PATH); webAppContext.setDescriptor(getAbsolutePath() + RESOURCE_BASE_PATH + WEB_XML_PATH); if (IDE_INTELLIJ == type) { webAppContext.setDefaultsDescriptor(WINDOWS_WEBDEFAULT_PATH); supportJspAndSetTldJarNames(server, TLD_JAR_NAMES); } else { webAppContext.setParentLoaderPriority(true); } System.out.println("[INFO] Application loaded"); }
Example 7
Source File: JettyFactory.java From java-tutorial with Creative Commons Attribution Share Alike 4.0 International | 6 votes |
public static void initWebAppContext(Server server, int type) throws Exception { System.out.println("[INFO] Application loading"); WebAppContext webAppContext = (WebAppContext) server.getHandler(); webAppContext.setContextPath(CONTEXT); webAppContext.setResourceBase(getAbsolutePath() + RESOURCE_BASE_PATH); webAppContext.setDescriptor(getAbsolutePath() + RESOURCE_BASE_PATH + WEB_XML_PATH); if (IDE_INTELLIJ == type) { webAppContext.setDefaultsDescriptor(WINDOWS_WEBDEFAULT_PATH); supportJspAndSetTldJarNames(server, TLD_JAR_NAMES); } else { webAppContext.setParentLoaderPriority(true); } System.out.println("[INFO] Application loaded"); }
Example 8
Source File: JettyFactory.java From java-tutorial with Creative Commons Attribution Share Alike 4.0 International | 6 votes |
public static void initWebAppContext(Server server, int type) throws Exception { System.out.println("[INFO] Application loading"); WebAppContext webAppContext = (WebAppContext) server.getHandler(); webAppContext.setContextPath(CONTEXT); webAppContext.setResourceBase(getAbsolutePath() + RESOURCE_BASE_PATH); webAppContext.setDescriptor(getAbsolutePath() + RESOURCE_BASE_PATH + WEB_XML_PATH); if (IDE_INTELLIJ == type) { webAppContext.setDefaultsDescriptor(WINDOWS_WEBDEFAULT_PATH); supportJspAndSetTldJarNames(server, TLD_JAR_NAMES); } else { webAppContext.setParentLoaderPriority(true); } System.out.println("[INFO] Application loaded"); }
Example 9
Source File: CommandServerUnitTest.java From Scribengin with GNU Affero General Public License v3.0 | 6 votes |
@BeforeClass public static void setup() throws Exception{ //Bring up ZK and all that jazz CommandServerTestBase.setup(); Registry registry = CommandServerTestBase.getNewRegistry(); try { registry.connect(); } catch (RegistryException e) { e.printStackTrace(); } cs = new CommandServer(port); //Point our context to our web.xml we want to use for testing WebAppContext webapp = new WebAppContext(); webapp.setResourceBase(CommandServerTestBase.getCommandServerFolder()); webapp.setDescriptor(CommandServerTestBase.getCommandServerXml()); cs.setHandler(webapp); cs.startServer(); }
Example 10
Source File: JettyFactory.java From java-tutorial with Creative Commons Attribution Share Alike 4.0 International | 6 votes |
public static void initWebAppContext(Server server, int type) throws Exception { System.out.println("[INFO] Application loading"); WebAppContext webAppContext = (WebAppContext) server.getHandler(); webAppContext.setContextPath(CONTEXT); webAppContext.setResourceBase(getAbsolutePath() + RESOURCE_BASE_PATH); webAppContext.setDescriptor(getAbsolutePath() + RESOURCE_BASE_PATH + WEB_XML_PATH); if (IDE_INTELLIJ == type) { webAppContext.setDefaultsDescriptor(WINDOWS_WEBDEFAULT_PATH); supportJspAndSetTldJarNames(server, TLD_JAR_NAMES); } else { webAppContext.setParentLoaderPriority(true); } System.out.println("[INFO] Application loaded"); }
Example 11
Source File: AtlasAuthenticationKerberosFilterTest.java From atlas with Apache License 2.0 | 5 votes |
@Override protected WebAppContext getWebAppContext(String path) { WebAppContext application = new WebAppContext(path, "/"); application.setDescriptor(System.getProperty("projectBaseDir") + "/webapp/src/test/webapp/WEB-INF/web.xml"); application.setClassLoader(Thread.currentThread().getContextClassLoader()); return application; }
Example 12
Source File: StartHelper.java From projectforge-webapp with GNU General Public License v3.0 | 5 votes |
/** * @see org.projectforge.webserver.AbstractStartHelper#getWebAppContext() */ @Override protected WebAppContext getWebAppContext() { final WebAppContext webAppContext = new WebAppContext(); webAppContext.setClassLoader(this.getClass().getClassLoader()); webAppContext.setConfigurationClasses(CONFIGURATION_CLASSES); webAppContext.setContextPath("/ProjectForge"); webAppContext.setWar("src/main/webapp"); webAppContext.setDescriptor("src/main/webapp/WEB-INF/web.xml"); webAppContext.setExtraClasspath("target/classes"); webAppContext.setInitParameter("development", String.valueOf(startSettings.isDevelopment())); webAppContext.setInitParameter("stripWicketTags", String.valueOf(startSettings.isStripWicketTags())); return webAppContext; }
Example 13
Source File: CommandProxyServerUnitTest.java From Scribengin with GNU Affero General Public License v3.0 | 5 votes |
@BeforeClass public static void setup() throws Exception{ CommandServerTestBase.setup(); Registry registry = CommandServerTestBase.getNewRegistry(); try { registry.connect(); } catch (RegistryException e) { e.printStackTrace(); } registry.create("/vm/commandServer", ("http://localhost:"+Integer.toString(commandPort)).getBytes(), NodeCreateMode.PERSISTENT); //Point our context to our web.xml we want to use for testing WebAppContext commandApp = new WebAppContext(); commandApp.setResourceBase(CommandServerTestBase.getCommandServerFolder()); commandApp.setDescriptor( CommandServerTestBase.getCommandServerXml()); //Point our context to our web.xml we want to use for testing WebAppContext proxyApp = new WebAppContext(); proxyApp.setResourceBase(CommandServerTestBase.getProxyServerFolder()); proxyApp.setDescriptor(CommandServerTestBase.getProxyServerXml()); //Bring up proxy cps = new CommandProxyServer(proxyPort); cps.setHandler(proxyApp); cps.startServer(); //Bring up commandServer using that context commandServer = new JettyServer(commandPort, CommandServlet.class); commandServer.setHandler(commandApp); commandServer.start(); }
Example 14
Source File: Main.java From phoenix with Apache License 2.0 | 5 votes |
@Override public int run(String[] arg0) throws Exception { // logProcessInfo(getConf()); final int port = getConf().getInt(TRACE_SERVER_HTTP_PORT_KEY, DEFAULT_HTTP_PORT); BasicConfigurator.configure(); final String home = getConf().get(TRACE_SERVER_HTTP_JETTY_HOME_KEY, DEFAULT_HTTP_HOME); //setting up the embedded server Server server = new Server(port); WebAppContext root = new WebAppContext(); URL webAppDir = Thread.currentThread().getContextClassLoader().getResource(DEFAULT_WEBAPP_DIR_LOCATION); if (webAppDir == null) { throw new RuntimeException(String.format("No %s directory was found into the JAR file", DEFAULT_WEBAPP_DIR_LOCATION)); } root.setContextPath(home); root.setDescriptor(DEFAULT_WEBAPP_DIR_LOCATION + "/WEB-INF/web.xml"); root.setResourceBase(webAppDir.toURI().toString()); root.setParentLoaderPriority(true); server.setHandler(root); server.start(); server.join(); return 0; }
Example 15
Source File: VRaptorServer.java From mamute with Apache License 2.0 | 5 votes |
private static WebAppContext loadContext(String webappDirLocation, String webXmlLocation) { WebAppContext context = new WebAppContext(); context.setContextPath(getContext()); context.setDescriptor(webXmlLocation); context.setResourceBase(webappDirLocation); context.setParentLoaderPriority(true); return context; }
Example 16
Source File: MultitenantServerR4IT.java From hapi-fhir-jpaserver-starter with Apache License 2.0 | 5 votes |
@BeforeClass public static void beforeClass() throws Exception { String path = Paths.get("").toAbsolutePath().toString(); ourLog.info("Project base path is: {}", path); ourServer = new Server(0); WebAppContext webAppContext = new WebAppContext(); webAppContext.setContextPath("/hapi-fhir-jpaserver"); webAppContext.setDisplayName("HAPI FHIR"); webAppContext.setDescriptor(path + "/src/main/webapp/WEB-INF/web.xml"); webAppContext.setResourceBase(path + "/target/hapi-fhir-jpaserver-starter"); webAppContext.setParentLoaderPriority(true); ourServer.setHandler(webAppContext); ourServer.start(); ourPort = JettyUtil.getPortForStartedServer(ourServer); ourCtx.getRestfulClientFactory().setServerValidationMode(ServerValidationModeEnum.NEVER); ourCtx.getRestfulClientFactory().setSocketTimeout(1200 * 1000); String ourServerBase = HapiProperties.getServerAddress(); ourServerBase = "http://localhost:" + ourPort + "/hapi-fhir-jpaserver/fhir/"; ourClient = ourCtx.newRestfulGenericClient(ourServerBase); ourClient.registerInterceptor(new LoggingInterceptor(true)); ourClientTenantInterceptor = new UrlTenantSelectionInterceptor(); ourClient.registerInterceptor(ourClientTenantInterceptor); }
Example 17
Source File: ExampleServerR4IT.java From hapi-fhir-jpaserver-starter with Apache License 2.0 | 5 votes |
@BeforeClass public static void beforeClass() throws Exception { String path = Paths.get("").toAbsolutePath().toString(); ourLog.info("Project base path is: {}", path); ourServer = new Server(0); WebAppContext webAppContext = new WebAppContext(); webAppContext.setContextPath("/hapi-fhir-jpaserver"); webAppContext.setDisplayName("HAPI FHIR"); webAppContext.setDescriptor(path + "/src/main/webapp/WEB-INF/web.xml"); webAppContext.setResourceBase(path + "/target/hapi-fhir-jpaserver-starter"); webAppContext.setParentLoaderPriority(true); ourServer.setHandler(webAppContext); ourServer.start(); ourPort = JettyUtil.getPortForStartedServer(ourServer); ourCtx.getRestfulClientFactory().setServerValidationMode(ServerValidationModeEnum.NEVER); ourCtx.getRestfulClientFactory().setSocketTimeout(1200 * 1000); String ourServerBase = HapiProperties.getServerAddress(); ourServerBase = "http://localhost:" + ourPort + "/hapi-fhir-jpaserver/fhir/"; ourClient = ourCtx.newRestfulGenericClient(ourServerBase); ourClient.registerInterceptor(new LoggingInterceptor(true)); }
Example 18
Source File: QAServer.java From Shour with MIT License | 5 votes |
private WebAppContext buildContext() { WebAppContext context = new WebAppContext(); context.setDefaultsDescriptor("webapp/WEB-INF/webdefault.xml"); context.setDescriptor("webapp/WEB-INF/web.xml"); context.setResourceBase("webapp/"); context.setContextPath("/"); return context; }
Example 19
Source File: JettyNoApplicationTest.java From cxf with Apache License 2.0 | 4 votes |
@Override protected void configureContext(final WebAppContext context) throws Exception { context.setDescriptor(Resource.newClassPathResource("/WEB-INF/web.xml").getFile().toURI().getPath()); }
Example 20
Source File: ITRestClientTest.java From kylin with Apache License 2.0 | 3 votes |
protected static void startJetty() throws Exception { server = new Server(PORT); WebAppContext context = new WebAppContext(); context.setDescriptor("../server/src/main/webapp/WEB-INF/web.xml"); context.setResourceBase("../server/src/main/webapp"); context.setContextPath("/kylin"); context.setParentLoaderPriority(true); server.setHandler(context); server.start(); }