org.codehaus.cargo.container.deployable.WAR.getContext()方法的使用及代码示例

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

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

WAR.getContext介绍

暂无

代码示例

代码示例来源:origin: org.codehaus.cargo/cargo-core-container-jetty

  1. /**
  2. * Get the context path for the webapp.
  3. *
  4. * @param deployable the deployable
  5. * @return the context path
  6. */
  7. public static String getContext(Deployable deployable)
  8. {
  9. return "/" + ((WAR) deployable).getContext();
  10. }
  11. }

代码示例来源:origin: codehaus-cargo/cargo

  1. /**
  2. * Returns the name of this deployable. For WAR file it is its context.
  3. * @return the name of this deployable
  4. */
  5. @Override
  6. public String getName()
  7. {
  8. return getContext();
  9. }
  10. }

代码示例来源:origin: codehaus-cargo/cargo

  1. /**
  2. * Get the context path for the webapp.
  3. *
  4. * @param deployable the deployable
  5. * @return the context path
  6. */
  7. public static String getContext(Deployable deployable)
  8. {
  9. return "/" + ((WAR) deployable).getContext();
  10. }
  11. }

代码示例来源:origin: org.codehaus.cargo/cargo-core-container-tomcat

  1. /**
  2. * Used by {@link TomcatEmbeddedLocalDeployer} to register {@link Deployable}s that are to be
  3. * deployed once the container is started.
  4. *
  5. * @param deployable {@link Deployable} to be deployed later.
  6. */
  7. public void scheduleDeployment(Deployable deployable)
  8. {
  9. WAR war = (WAR) deployable;
  10. scheduledDeployables.put(war.getContext(), war);
  11. }

代码示例来源:origin: codehaus-cargo/cargo

  1. /**
  2. * Used by {@link TomcatEmbeddedLocalDeployer} to register {@link Deployable}s that are to be
  3. * deployed once the container is started.
  4. *
  5. * @param deployable {@link Deployable} to be deployed later.
  6. */
  7. public void scheduleDeployment(Deployable deployable)
  8. {
  9. WAR war = (WAR) deployable;
  10. scheduledDeployables.put(war.getContext(), war);
  11. }

代码示例来源:origin: codehaus-cargo/cargo

  1. /**
  2. * Adds context parameter if deployable is WAR file.
  3. * @param arguments Arguments passed to configuration script.
  4. */
  5. private void addContext(StringBuffer arguments)
  6. {
  7. if (deployable instanceof WAR)
  8. {
  9. arguments.append(",'-contextroot','");
  10. arguments.append(((WAR) deployable).getContext());
  11. arguments.append("'");
  12. }
  13. }

代码示例来源:origin: codehaus-cargo/cargo

  1. /**
  2. * @return the context defined in <code>context.xml</code> if any. If there is no
  3. * <code>context.xml</code> or if it doesn't define any root context, then return
  4. * {@link WAR#getContext()}.
  5. */
  6. @Override
  7. public synchronized String getContext()
  8. {
  9. String result = parseTomcatContextXml();
  10. if (result == null)
  11. {
  12. result = super.getContext();
  13. }
  14. return result;
  15. }

代码示例来源:origin: org.codehaus.cargo/cargo-core-container-tomcat

  1. /**
  2. * {@inheritDoc}
  3. */
  4. @Override
  5. public void stop(Deployable deployable)
  6. {
  7. WAR war = (WAR) deployable;
  8. container.getHost().findChild(war.getContext()).setAvailable(false);
  9. }

代码示例来源:origin: org.codehaus.cargo/cargo-core-container-tomcat

  1. /**
  2. * {@inheritDoc}
  3. */
  4. @Override
  5. public void start(Deployable deployable)
  6. {
  7. WAR war = (WAR) deployable;
  8. container.getHost().findChild(war.getContext()).setAvailable(true);
  9. }

代码示例来源:origin: codehaus-cargo/cargo

  1. /**
  2. * {@inheritDoc}
  3. */
  4. @Override
  5. public void stop(Deployable deployable)
  6. {
  7. WAR war = (WAR) deployable;
  8. container.getHost().findChild(war.getContext()).setAvailable(false);
  9. }

代码示例来源:origin: codehaus-cargo/cargo

  1. /**
  2. * {@inheritDoc}
  3. */
  4. @Override
  5. public void start(Deployable deployable)
  6. {
  7. WAR war = (WAR) deployable;
  8. container.getHost().findChild(war.getContext()).setAvailable(true);
  9. }

代码示例来源:origin: codehaus-cargo/cargo

  1. /**
  2. * {@inheritDoc}
  3. */
  4. @Override
  5. public void undeploy(Deployable deployable)
  6. {
  7. WAR war = (WAR) deployable;
  8. TomcatEmbedded.Context context = container.getHost().findChild(war.getContext());
  9. container.getHost().removeChild(context);
  10. }

代码示例来源:origin: org.codehaus.cargo/cargo-core-container-tomcat

  1. /**
  2. * {@inheritDoc}
  3. */
  4. @Override
  5. public void undeploy(Deployable deployable)
  6. {
  7. WAR war = (WAR) deployable;
  8. TomcatEmbedded.Context context = container.getHost().findChild(war.getContext());
  9. container.getHost().removeChild(context);
  10. }

代码示例来源:origin: codehaus-cargo/cargo

  1. /**
  2. * Test context when WAR has an extension.
  3. */
  4. public void testGetContextWhenWarHasExtension()
  5. {
  6. WAR war = new WAR("c:/some/path/to/war/test.war");
  7. assertEquals("test", war.getContext());
  8. }

代码示例来源:origin: codehaus-cargo/cargo

  1. /**
  2. * Test context when WAR has no extension.
  3. */
  4. public void testGetContextWhenWarHasNoExtension()
  5. {
  6. WAR war = new WAR("/some/path/to/war/test");
  7. assertEquals("test", war.getContext());
  8. }

代码示例来源:origin: codehaus-cargo/cargo

  1. /**
  2. * Test WAR context overriden with a slash in the middhe.
  3. */
  4. public void testGetContextWhenOverrideAndMiddleSlash()
  5. {
  6. WAR war = new WAR("c:/some/path/to/war/test.war");
  7. war.setContext("/a/b");
  8. assertEquals("a/b", war.getContext());
  9. }

代码示例来源:origin: codehaus-cargo/cargo

  1. /**
  2. * Test overriden WAR context.
  3. */
  4. public void testGetContextWhenOverride()
  5. {
  6. WAR war = new WAR("c:/some/path/to/war/test.war");
  7. war.setContext("context");
  8. assertEquals("context", war.getContext());
  9. }

代码示例来源:origin: codehaus-cargo/cargo

  1. /**
  2. * Test WAR context overriden with a leading slash.
  3. */
  4. public void testGetContextWhenOverrideAndLeadingSlash()
  5. {
  6. WAR war = new WAR("c:/some/path/to/war/test.war");
  7. war.setContext("/");
  8. assertEquals("", war.getContext());
  9. }

代码示例来源:origin: codehaus-cargo/cargo

  1. /**
  2. * Test logger when getting WAR context.
  3. */
  4. public void testLoggerWhenCallingGetContext()
  5. {
  6. MockLogger logger = new MockLogger();
  7. WAR war = new WAR("c:/test.war");
  8. war.setLogger(logger);
  9. // Calling getContext just to trigger the log
  10. war.getContext();
  11. assertEquals(1, logger.severities.size());
  12. assertEquals("debug", logger.severities.get(0));
  13. assertEquals("Parsed web context = [test]", logger.messages.get(0));
  14. assertEquals("org.codehaus.cargo.container.deployable.WAR", logger.categories.get(0));
  15. }

代码示例来源:origin: codehaus-cargo/cargo

  1. /**
  2. * Verify that WAR context change works.
  3. * @throws Exception If anything goes wrong.
  4. */
  5. public void testChangeWarContextAndDeployUndeployRemotely() throws Exception
  6. {
  7. this.war.setContext("simple");
  8. URL warPingURL = new URL("http://localhost:" + getTestData().port + "/"
  9. + this.war.getContext() + "/index.jsp");
  10. deployer.deploy(this.war);
  11. PingUtils.assertPingTrue("simple war not correctly deployed", warPingURL, getLogger());
  12. deployer.undeploy(this.war);
  13. PingUtils.assertPingFalse("simple war not correctly undeployed", warPingURL, getLogger());
  14. }

相关文章