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

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

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

WebAppContext.getContextPath介绍

暂无

代码示例

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

private void dumpUrl()
{
  Connector[] connectors = getServer().getConnectors();
  for (int i=0;i<connectors.length;i++)
  {
    String displayName = getDisplayName();
    if (displayName == null)
      displayName = "WebApp@"+Arrays.hashCode(connectors);
    LOG.info(displayName + " at http://" + connectors[i].toString() + getContextPath());
  }
}

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

@Override
public void setClassLoader(ClassLoader classLoader)
{
  super.setClassLoader(classLoader);
  String name = getDisplayName();
  if (name==null) 
    name=getContextPath();
  
  if (classLoader!=null && classLoader instanceof WebAppClassLoader && getDisplayName()!=null)
    ((WebAppClassLoader)classLoader).setName(name);
}

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

String contextPath = context.getContextPath();
contextPath=contextPath.replace('/','_');
contextPath=contextPath.replace('\\','_');

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

private void addDocsServlets(WebAppContext docsContext) {
  try {
    // Load the nifi/docs directory
    final File docsDir = getDocsDir("docs");
    // load the component documentation working directory
    final File componentDocsDirPath = props.getComponentDocumentationWorkingDirectory();
    final File workingDocsDirectory = getWorkingDocsDirectory(componentDocsDirPath);
    // Load the API docs
    final File webApiDocsDir = getWebApiDocsDir();
    // Create the servlet which will serve the static resources
    ServletHolder defaultHolder = new ServletHolder("default", DefaultServlet.class);
    defaultHolder.setInitParameter("dirAllowed", "false");
    ServletHolder docs = new ServletHolder("docs", DefaultServlet.class);
    docs.setInitParameter("resourceBase", docsDir.getPath());
    ServletHolder components = new ServletHolder("components", DefaultServlet.class);
    components.setInitParameter("resourceBase", workingDocsDirectory.getPath());
    ServletHolder restApi = new ServletHolder("rest-api", DefaultServlet.class);
    restApi.setInitParameter("resourceBase", webApiDocsDir.getPath());
    docsContext.addServlet(docs, "/html/*");
    docsContext.addServlet(components, "/components/*");
    docsContext.addServlet(restApi, "/rest-api/*");
    docsContext.addServlet(defaultHolder, "/");
    logger.info("Loading documents web app with context path set to " + docsContext.getContextPath());
  } catch (Exception ex) {
    logger.error("Unhandled Exception in createDocsWebApp: " + ex.getMessage());
    startUpFailure(ex);
  }
}

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

@Test
public void shouldAddWebAppContextHandler() throws Exception {
  jetty9Server.configure();
  jetty9Server.startHandlers();
  WebAppContext webAppContext = (WebAppContext) getLoadedHandlers().get(WebAppContext.class);
  assertThat(webAppContext, instanceOf(WebAppContext.class));
  List<String> configClasses = new ArrayList<>(Arrays.asList(webAppContext.getConfigurationClasses()));
  assertThat(configClasses.contains(WebInfConfiguration.class.getCanonicalName()), is(true));
  assertThat(configClasses.contains(WebXmlConfiguration.class.getCanonicalName()), is(true));
  assertThat(configClasses.contains(JettyWebXmlConfiguration.class.getCanonicalName()), is(true));
  assertThat(webAppContext.getContextPath(), is("context"));
  assertThat(webAppContext.getWar(), is("cruise.war"));
  assertThat(webAppContext.isParentLoaderPriority(), is(true));
  assertThat(webAppContext.getDefaultsDescriptor(), is("jar:file:cruise.war!/WEB-INF/webdefault.xml"));
}

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

LOG.info("NO JSP Support for {}, did not find {}", context.getContextPath(), servlet_class);
servlet_class = "org.eclipse.jetty.servlet.NoJspServlet";

代码示例来源:origin: org.apache.edgent/edgent-console-server

/**
 * 
 * @return a String containing the context path to the console web application
 * @throws Exception on failure
 */
public String getConsoleContextPath() throws Exception {
  return HttpServerHolder.WEBAPP.getContextPath();
}

代码示例来源:origin: apache/incubator-edgent

/**
 * 
 * @return a String containing the context path to the console web application
 * @throws Exception on failure
 */
public String getConsoleContextPath() throws Exception {
  return HttpServerHolder.WEBAPP.getContextPath();
}

代码示例来源:origin: io.brooklyn/brooklyn-launcher

public static Handler removeContextFromList(List<Handler> hl, String contextPath) {
  Iterator<Handler> hi = hl.iterator();
  while (hi.hasNext()) {
    Handler h = hi.next();
    if ((h instanceof WebAppContext) && ((WebAppContext)h).getContextPath().equals(contextPath)) {
      hi.remove();
      return h;
    }
  }
  return null;
}

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

public void contextInitialized(ServletContextEvent sce) {
  WebAppContext ctx = (WebAppContext) sce.getServletContext();
  System.out.println("context Base Path" + ctx.getContextPath());
  System.out.println("Getting the port is a bit trickier");
  System.out.println("One valid Port = " + ctx.getServer().getConnectors()[0].getPort());
}

代码示例来源:origin: com.carecon.fabric3/fabric3-container-web-jetty

@Override
@ManagementOperation(description = "The web app context path")
public String getContextPath() {
  return super.getContextPath();
}

代码示例来源:origin: org.fabric3/fabric3-container-web-jetty

@Override
@ManagementOperation(description = "The web app context path")
public String getContextPath() {
  return super.getContextPath();
}

代码示例来源:origin: com.ovea.tajin.servers/tajin-server-jetty9

private void dumpUrl()
{
  Connector[] connectors = getServer().getConnectors();
  for (int i=0;i<connectors.length;i++)
  {
    String displayName = getDisplayName();
    if (displayName == null)
      displayName = "WebApp@"+connectors.hashCode();
    LOG.info(displayName + " at http://" + connectors[i].toString() + getContextPath());
  }
}

代码示例来源:origin: com.ovea.tajin.server/tajin-server-jetty9

private void dumpUrl()
{
  Connector[] connectors = getServer().getConnectors();
  for (int i=0;i<connectors.length;i++)
  {
    String displayName = getDisplayName();
    if (displayName == null)
      displayName = "WebApp@"+connectors.hashCode();
    LOG.info(displayName + " at http://" + connectors[i].toString() + getContextPath());
  }
}

代码示例来源:origin: jenkinsci/winstone

private void dumpUrl()
{
  Connector[] connectors = getServer().getConnectors();
  for (int i=0;i<connectors.length;i++)
  {
    String displayName = getDisplayName();
    if (displayName == null)
      displayName = "WebApp@"+Arrays.hashCode(connectors);
    LOG.info(displayName + " at http://" + connectors[i].toString() + getContextPath());
  }
}

代码示例来源:origin: org.eclipse.jetty.aggregate/jetty-all-server

private void dumpUrl()
{
  Connector[] connectors = getServer().getConnectors();
  for (int i=0;i<connectors.length;i++)
  {
    String connectorName = connectors[i].getName();
    String displayName = getDisplayName();
    if (displayName == null)
      displayName = "WebApp@"+connectors.hashCode();
    LOG.info(displayName + " at http://" + connectorName + getContextPath());
  }
}

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

private void dumpUrl()
{
  Connector[] connectors = getServer().getConnectors();
  for (int i=0;i<connectors.length;i++)
  {
    String connectorName = connectors[i].getName();
    String displayName = getDisplayName();
    if (displayName == null)
      displayName = "WebApp@"+connectors.hashCode();
    LOG.info(displayName + " at http://" + connectorName + getContextPath());
  }
}

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

private void dumpUrl()
{
  Connector[] connectors = getServer().getConnectors();
  for (int i=0;i<connectors.length;i++)
  {
    String connectorName = connectors[i].getName();
    String displayName = getDisplayName();
    if (displayName == null)
      displayName = "WebApp@"+connectors.hashCode();
    LOG.info(displayName + " at http://" + connectorName + getContextPath());
  }
}

代码示例来源:origin: jenkinsci/winstone

@Override
public void setClassLoader(ClassLoader classLoader)
{
  super.setClassLoader(classLoader);
  String name = getDisplayName();
  if (name==null) 
    name=getContextPath();
  
  if (classLoader!=null && classLoader instanceof WebAppClassLoader && getDisplayName()!=null)
    ((WebAppClassLoader)classLoader).setName(name);
}

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

// To be passed to all scanned webapps. Ensures SSO between contexts
SessionManager sessManager = new HashSessionManager();
SessionCookieConfig config = sessManager.getSessionCookieConfig();
config.setPath("/webapps/"); // Ensures all webapps share the same cookie

// Create the Handler (a.k.a the WebAppContext).
App app = new App(deployer, provider, module.getFile().getAbsolutePath());
WebAppContext handler = (WebAppContext)app.getContextHandler(); // getContextHandler does the extraction
// Consolidating all scanned webapps under a single context path allows SSO
handler.setContextPath("/webapps" + handler.getContextPath());
// Cookies need to be shared between webapps for SSO
SessionHandler sessHandler = handler.getSessionHandler();
sessHandler.setSessionManager(sessManager);

相关文章

WebAppContext类方法