Examples of WebApplicationDeploymentContext


Examples of net.sourceforge.javautil.web.server.application.WebApplicationDeploymentContext

  public Object getAttribute(String name) { return attributes.get(name); }
 
  public Enumeration getAttributeNames() { return Collections.enumeration( attributes.keySet() ); }
 
  public ServletContext getContext(String path) {
    WebApplicationDeploymentContext deployment = host.getContext(path);
    return deployment == null ? null : deployment.getServletContext();
  }
View Full Code Here

Examples of net.sourceforge.javautil.web.server.application.WebApplicationDeploymentContext

   */
  public MockServerResponse process (MockBrowserRequest request) throws ServletException, IOException {
    ClassLoader original = Thread.currentThread().getContextClassLoader();
    try {
      String path = request.getUrl().getPath();
      WebApplicationDeploymentContext deployment = this.getContext(path);
      if (deployment == null)
        throw new MockBrowserException(request, "No context could be found to handle request", null);
     
      MockHttpServletContext ctx = (MockHttpServletContext) deployment.getServletContext();
      path = path.length() == ctx.getContextPath().length() ? "/" : path.substring(ctx.getContextPath().length());
      if (!path.startsWith("/")) path = "/" + path;
       
      Thread.currentThread().setContextClassLoader(ctx.getParentClassLoader());
     
View Full Code Here

Examples of net.sourceforge.javautil.web.server.application.WebApplicationDeploymentContext

    if (this.deployed.containsKey(name))
      throw new WebServerException(server, "An application is already deployed by this name: " + name);
   
    try {
      MockHttpServletContext context = new MockHttpServletContext(this, application);
      WebApplicationDeploymentContext deployment = new WebApplicationDeploymentContext(this, application, context);
      application.preDeploySetup(deployment, false);
      context.initialize();
      this.deployed.put(application.getName(), deployment);
      server.getHandler().applicationDeployed(new WebServerApplicationEvent(server, this, application));
      return true;
View Full Code Here

Examples of net.sourceforge.javautil.web.server.application.WebApplicationDeploymentContext

   * @param path The path to resolve for a context
   * @return The context that would handle a request at this path, or null if none could be found
   */
  public WebApplicationDeploymentContext getContext (String path) {
    int match = -1;
    WebApplicationDeploymentContext found = null;
    for (WebApplicationDeploymentContext ctx : this.deployed.values()) {
      if (path.startsWith( ctx.getServletContext().getContextPath() ) && ctx.getServletContext().getContextPath().length() > match) {
        match = ctx.getServletContext().getContextPath().length();
        found = ctx;
      }
View Full Code Here

Examples of net.sourceforge.javautil.web.server.application.WebApplicationDeploymentContext

  public void registerValve(WebServerHostValve valve) { this.valves.add(valve); }

  public void unregisterValve(WebServerHostValve valve) { this.valves.remove(valve); }
 
  public URL getExternalURLFor (String name) {
    WebApplicationDeploymentContext wadc = this.applications.get(name);
    if (wadc == null)
      throw new IllegalArgumentException("No such application found: " + name);
   
    if (this.server.getConnectors().size() == 0)
      throw new IllegalStateException("No connectors have been defined for the server");
   
    WebServerConnector connector = this.server.getConnectors().get(0);
    if (connector instanceof WebServerConnectorHTTP) {
      WebServerConnectorHTTP http = (WebServerConnectorHTTP) connector;
      try {
        return new URL("http", http.getHostname(), http.getPort(), wadc.getApplication().getContextPath());
      } catch (MalformedURLException e) {
        throw ThrowableManagerRegistry.caught(e);
      }
    }
   
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.