Atitit 部署了个webdav服务 as root 目录 1.1. WEB-INF copy to root dir only a web.xml use... 1 1.2. Java.ba

Atitit 部署了个webdav服务 as root

目录

1.1. WEB-INF copy to root dir   only a web.xml  use... 1

1.2. Java.bat 1

1.3. Chmod 777 ./java.sh 1

1.4. Java.sh 1

1.5. http://192.168.1.18:1314/webdavapp/webdavurl 2

1.6. code 2

 

1.1. WEB-INF copy to root dir   only a web.xml  use...

Classes  lib all clr...

 

1.2. Java.bat

java  -classpath "%~dp0bin"   -Djava.ext.dirs="%~dp0libtomcart"  EmbeddedTomcat c:\www

 

rem  setx path  "%path%;C:\Program Files\Java\jdk1.8.0_131\jre\bin"

 

1.3. Chmod 777 ./java.sh 

1.4. Java.sh

#将classes和包jar加入classpath,注意用的是冒号":"分割的  

java  -classpath "./bin"     -Djava.ext.dirs="./libtomcart"  EmbeddedTomcat /

 

rem  setx path  "%path%;C:\Program Files\Java\jdk1.8.0_131\jre\bin"

 

 

 

1.5. http://192.168.1.18:1314/webdavapp/webdavurl

    static int port = 1314;

    static String contextPath = "/webdavapp";

    static  String baseDir ="/";

 

 

1.6. code

 

import java.io.File;

import java.util.concurrent.atomic.AtomicBoolean;

 

import org.apache.catalina.LifecycleException;

import org.apache.catalina.core.AprLifecycleListener;

import org.apache.catalina.core.StandardServer;

import org.apache.catalina.startup.ClassLoaderFactory;

import org.apache.catalina.startup.Tomcat;

 

 

 

import com.attilax.util.Global;

 

import javax.servlet.ServletException;

 

/**

 *

 * http://localhost/cloud/clinewadvice/clinicvaf1insert?lver=22

 *

 * Created by nil on 2014/8/1.

 */

public class EmbeddedTomcat {

    private Tomcat tomcat;    

    static int port = 1314;

    static String contextPath = "/webdavapp";

    static  String baseDir ="/";

 

 

 

    public static void main(String[] args) {

     

     

    baseDir=args[0].trim();

    System.out.println("");

        try {

           

         

            System.out.println("basedir:"+baseDir);

            //new File("webroot").getAbsolutePath();  // 椤圭洰涓瓀eb鐩綍鍚嶇О锛屼互鍓嶇増鏈负WebRoot銆亀ebapp銆亀ebapps锛岀幇鍦ㄤ负WebContent

            EmbeddedTomcat EmbeddedTomcat1 = new EmbeddedTomcat();

            EmbeddedTomcat1.startTomcat(port, contextPath, baseDir);

            // 鐢变簬Tomcat鐨剆tart鏂规硶涓洪潪闃诲鏂规硶,鍔犱竴涓嚎绋嬬潯鐪犳ā鎷熺嚎绋嬮樆锟?

            

            

            String heartbeat_str = "--tomcat run. heartbeat_str";

           Global.heartbeatRecycle(heartbeat_str);

           

        } catch (Exception e) {

            e.printStackTrace();

            throw new RuntimeException(e);

        }

    }

    

    

    private void startTomcat(int port, String contextPath, String baseDir)

            throws ServletException, LifecycleException {

        tomcat = new Tomcat();

        tomcat.setPort(port);

        tomcat.setBaseDir(".");

        StandardServer server = (StandardServer) tomcat.getServer();

        AprLifecycleListener listener = new AprLifecycleListener();

        server.addLifecycleListener(listener);

        tomcat.addWebapp(contextPath, baseDir);

        tomcat.start();

    }

 

    private void stopTomcat() throws LifecycleException {

        tomcat.stop();

    }

}

posted @ 2018-05-26 20:35  attilaxAti  阅读(32)  评论(0编辑  收藏  举报