protected void deployArchive(HttpServletRequest request,HttpServletResponse response,String contextPath) throws IOException {
  Log.debug("Remotely deploying a remote web archive with context " + contextPath);
  if (contextPath == null) {
    sendError(response,"The path variable is not set");
  }
 else   if (!contextPath.startsWith("/")) {
    sendError(response,"The path variable must start with /");
  }
 else   if (getContextHandler(contextPath) != null) {
    sendError(response,"The webapp context path is already in use");
  }
 else {
    Log.debug("trying to get the remote web archive");
    File webappFile=new File(this.webAppDirectory,(contextPath.equals("/") ? "ROOT" : contextPath.substring(1)) + ".war");
    InputStream inputStream=new BufferedInputStream(request.getInputStream());
    OutputStream outputStream=new BufferedOutputStream(new FileOutputStream(webappFile),8096);
    int i=inputStream.read();
    while (i != -1) {
      outputStream.write(i);
      i=inputStream.read();
    }
    inputStream.close();
    outputStream.flush();
    outputStream.close();
    WebAppContext webappcontext=new WebAppContext();
    webappcontext.setContextPath(contextPath);
    webappcontext.setWar(webappFile.getAbsolutePath());
    webappcontext.setDefaultsDescriptor(configHome + "/etc/webdefault.xml");
    chc.addHandler(webappcontext);
    try {
      webappcontext.start();
    }
 catch (    Exception e) {
      sendError(response,"Unexpected error when trying to start the webapp");
      Log.warn(e);
      return;
    }
  }
  sendMessage(response,"Webapp deployed at context " + contextPath);
}

protected void deployArchive ( HttpServletRequest request , HttpServletResponse response , String contextPath ) throws IOException { Log . debug ( "Remotely deploying a remote web archive with context " + contextPath ) ; if ( contextPath == null ) { sendError ( response , "The path variable is not set" ) ; } else if ( ! contextPath . startsWith ( "/" ) ) { sendError ( response , "The path variable must start with /" ) ; } else if ( getContextHandler ( contextPath ) != null ) { sendError ( response , "The webapp context path is already in use" ) ; } else { Log . debug ( "trying to get the remote web archive" ) ; File webappFile = new File ( this . webAppDirectory , ( contextPath . equals ( "/" ) ? "ROOT" : contextPath . substring ( 1 ) ) + ".war" ) ; InputStream inputStream = new BufferedInputStream ( request . getInputStream ( ) ) ; OutputStream outputStream = new BufferedOutputStream ( new FileOutputStream ( webappFile ) , 8096 ) ; int i = inputStream . read ( ) ; while ( i != - 1 ) { outputStream . write ( i ) ; i = inputStream . read ( ) ; } inputStream . close ( ) ; outputStream . flush ( ) ; outputStream . close ( ) ; WebAppContext webappcontext = new WebAppContext ( ) ; webappcontext . setContextPath ( contextPath ) ; webappcontext . setWar ( webappFile . getAbsolutePath ( ) ) ; webappcontext . setDefaultsDescriptor ( configHome + "/etc/webdefault.xml" ) ; chc . addHandler ( webappcontext ) ; try { webappcontext . start ( ) ; } catch ( Exception e ) { sendError ( response , "Unexpected error when trying to start the webapp" ) ; Log . warn ( e ) ; return ; } } sendMessage ( response , "Webapp deployed at context " + contextPath ) ; }
deploys the archive to the server .
