From: joinsang Date: Sat, 23 Feb 2019 14:00:45 +0000 (+0900) Subject: 서버단 zip 파일 만들어서 return X-Git-Url: https://git.insang.kr/gitweb/?a=commitdiff_plain;h=728fd76bc180e544f024cfe2090e3bc0c93a67c2;p=ZipProject.git 서버단 zip 파일 만들어서 return 잘 작동하며 remove files 작성해야함 --- diff --git a/ZipProject/Controllers/WebZipController.cs b/ZipProject/Controllers/WebZipController.cs index 8228ce1..8f066f8 100644 --- a/ZipProject/Controllers/WebZipController.cs +++ b/ZipProject/Controllers/WebZipController.cs @@ -47,13 +47,14 @@ namespace ZipProject.Controllers { return Redirect ("/"); } - public JsonResult FileUpload(List dirList, List files, string fileKeyPair){ + public ActionResult FileUpload(string dirList, List files, string fileKeyPair, string format){ JObject keyPair_FileDir= JObject.Parse(fileKeyPair); - ZipModel zipModel= new ZipModel(); - zipModel.SaveFiles(files); + string[] listDir= dirList.Split(','); + var zip= zipModel.MakeZip(keyPair_FileDir, listDir, files); + string filename= listDir[0]+"."+format; - return Json(keyPair_FileDir["building.html"]); + return File(zip.ToArray(), "application/zip"); } } diff --git a/ZipProject/Models/ZipModel.cs b/ZipProject/Models/ZipModel.cs index a4faecc..25cc13a 100644 --- a/ZipProject/Models/ZipModel.cs +++ b/ZipProject/Models/ZipModel.cs @@ -1,9 +1,9 @@ -using System.IO; -using Ionic.Zip; -using Newtonsoft.Json.Linq; +using System; using System.Collections.Generic; -using System; +using System.IO; +using Ionic.Zip; using Microsoft.AspNetCore.Http; +using Newtonsoft.Json.Linq; namespace ZipProject { public class ZipModel { @@ -11,26 +11,66 @@ namespace ZipProject { public ZipModel () { } - public string SaveFiles(List files){ - var path= Environment.CurrentDirectory + "/wwwroot/zip/"; - Int32 unixTimestamp = (Int32)(DateTime.UtcNow.Subtract(new DateTime(1970, 1, 1))).TotalSeconds; - path += unixTimestamp+"/"; + private string MakeDirname () { + var path = Environment.CurrentDirectory + "/wwwroot/zip/"; + Int32 unixTimestamp = (Int32) (DateTime.UtcNow.Subtract (new DateTime (1970, 1, 1))).TotalSeconds; + path += unixTimestamp; + + return path; + } + + private string SaveFiles (JObject keypair, string[] dirList, List files) { + string path; + bool exist; + int aCount = 0; + + do { + path = this.MakeDirname () + (aCount++); + exist = Directory.Exists (path); + } while (exist); + + path += "/"; + Directory.CreateDirectory (path); - foreach(var file in files){ - if (file.Length > 0){ - var filepath= path+ file.FileName; - using(var fileStream= new FileStream(filepath, FileMode.Create)){ - file.CopyTo(fileStream); + for (int i = 0; i < files.Count; i++) { + if (files[i].Length > 0) { + int keypairnum = Int32.Parse ((string) keypair[files[i].FileName]); + string dirInDir = dirList[keypairnum] + "/"; + string filepath = path + ((keypairnum == 0) ? "" : dirInDir); + string fullpath = filepath + files[i].FileName; + exist = Directory.Exists (filepath); + + if (!exist) { + Directory.CreateDirectory (filepath); + } + + using (var fileStream = new FileStream (fullpath, FileMode.Create)) { + files[i].CopyTo (fileStream); } } } - return unixTimestamp+""; + return path; + } + + private string RemoveFiles (string dirName) { + return null; } - public void MakeZip (JObject keypair, List dirList, List files) { + public MemoryStream MakeZip (JObject keypair, string[] dirList, List files) { + + string path = this.SaveFiles (keypair, dirList, files); + + MemoryStream memoryStream= new MemoryStream(); using (ZipFile zip = new ZipFile ()) { + zip.AddDirectory (path); + zip.Name = dirList[0]; + zip.Save(memoryStream); } + + this.RemoveFiles (path); + + return memoryStream; } } } \ No newline at end of file diff --git a/ZipProject/wwwroot/js/Zip/partial_zip.js b/ZipProject/wwwroot/js/Zip/partial_zip.js index 4c20fcf..2d6e3f5 100644 --- a/ZipProject/wwwroot/js/Zip/partial_zip.js +++ b/ZipProject/wwwroot/js/Zip/partial_zip.js @@ -272,6 +272,7 @@ function isTooLongFileName(val) { //압축 시작(백단에 파일들과 파일정보 map 전송) function RequestCompress() { + var format = "zip"; //디렉토리 리스트 var dirList = new Array(); for (var i = 0; i < directories.keys().length; i++) { @@ -287,9 +288,9 @@ function RequestCompress() { '" : "' + files.get(i).get("directory") + '"'; - if (files.keys().length -1 != i){ - fileKeyPair+=", "; - } + if (files.keys().length - 1 != i) { + fileKeyPair += ", "; + } } fileKeyPair += "}"; @@ -299,17 +300,26 @@ function RequestCompress() { } formdata.append("fileKeyPair", fileKeyPair); formdata.append("dirList", dirList); + formdata.append("format", format); $.ajax({ type: "post", url: "/webzip/fileupload", data: formdata, processData: false, - contentType: false - }).done(function(data){ - alert(data); - }) - + contentType: false, + xhrFields: { + responseType: "blob" + }, + success: function(data) { + var a = document.createElement("a"); + var url = window.URL.createObjectURL(data); + a.href = url; + a.download = directories.get(0) + "." + format; + a.click(); + window.URL.revokeObjectURL(url); + } + }); } //초기세팅(bullet, sort, 기본 zip label 세팅) diff --git a/ZipProject/wwwroot/zip/15509299050/building.html b/ZipProject/wwwroot/zip/15509299050/building.html new file mode 100644 index 0000000..2235920 --- /dev/null +++ b/ZipProject/wwwroot/zip/15509299050/building.html @@ -0,0 +1,278 @@ + +Apache Tomcat 9 (9.0.11) - Building Tomcat

Building Tomcat

Table of Contents

Introduction

+ +

+Building Apache Tomcat from source is very easy, and is the first step to +contributing to Tomcat. The complete and comprehensive instructions are +provided in the file BUILDING.txt. +The following is a quick step by step guide. +

+ +

Download a Java Development Kit (JDK) version 8

+ +

+Building Apache Tomcat requires a JDK (version 8) to be installed. You can download one from
+http://www.oracle.com/technetwork/java/javase/downloads/index.html
+http://openjdk.java.net/install/index.html
+or another JDK vendor. +

+ +

+IMPORTANT: Set an environment variable JAVA_HOME to the pathname of the +directory into which you installed the JDK release. +

+ +

Install Apache Ant 1.9.8 or later

+ +

+Download a binary distribution of Ant 1.9.8 or later from +here. +

+ +

+Unpack the binary distribution into a convenient location so that the +Ant release resides in its own directory (conventionally named +apache-ant-1.9.x). For the remainder of this guide, +the symbolic name ${ant.home} is used to refer to the full pathname of + the Ant installation directory. +

+ +

+IMPORTANT: Create an ANT_HOME environment variable to point the directory ${ant.home}, +and modify the PATH environment variable to include directory +${ant.home}/bin in its list. This makes the ant command line script +available, which will be used to actually perform the build. +

+ +

Checkout or obtain the Tomcat source code

+ +

+ Tomcat SVN repository URL: + https://svn.apache.org/repos/asf/tomcat/trunk/ +

+

+ Tomcat source packages: + https://tomcat.apache.org/download-90.cgi. +

+ +

+ Checkout the source using SVN, selecting a tag for released version or + trunk for the current development code, or download and unpack a + source package. For the remainder of this guide, the symbolic name + ${tomcat.source} is used to refer to the + location where the source has been placed. +

+ +

Configure download area

+ +

+ Building Tomcat involves downloading a number of libraries that it depends on. + It is strongly recommended to configure download area for those libraries. +

+ +

+ By default the build is configured to download the dependencies into the + ${user.home}/tomcat-build-libs directory. You can change this + (see below) but it must be an absolute path. +

+ +

+ The build is controlled by creating a + ${tomcat.source}/build.properties file. It can be used to + redefine any property that is present in build.properties.default + and build.xml files. The build.properties file + does not exist by default. You have to create it. +

+ +

+ The download area is defined by property base.path. For example: +

+ +
# ----- Default Base Path for Dependent Packages -----
+# Replace this path with the directory path where
+# dependencies binaries should be downloaded.
+base.path=/home/me/some-place-to-download-to
+ +

+ Different versions of Tomcat are allowed to share the same download area. +

+ +

+ Another example: +

+ +
base.path=${user.dir}/../libraries-tomcat9.0
+ +

+ Users who access the Internet through a proxy must use the properties + file to indicate to Ant the proxy configuration: +

+ +
# ----- Proxy setup -----
+proxy.host=proxy.domain
+proxy.port=8080
+proxy.use=on
+ +

Building Tomcat

+ +

+Use the following commands to build Tomcat: +

+ +

+cd ${tomcat.source}
+ant +

+ +

+Once the build has completed successfully, a usable Tomcat installation will have been +produced in the ${tomcat.source}/output/build directory, and can be started +and stopped with the usual scripts. +

+

Building with Eclipse

+ +

+IMPORTANT: This is not a supported means of building Tomcat; this information is +provided without warranty :-). +The only supported means of building Tomcat is with the Ant build described above. +However, some developers like to work on Java code with a Java IDE, +and the following steps have been used by some developers. +

+ +

+NOTE: This will not let you build everything under Eclipse; +the build process requires use of Ant for the many stages that aren't +simple Java compilations. +However, it will allow you to view and edit the Java code, +get warnings, reformat code, perform refactorings, run Tomcat +under the IDE, and so on. +

+ +

+WARNING: Do not forget to create and configure + ${tomcat.source}/build.properties file as described above + before running any Ant targets. +

+ +

+Sample Eclipse project files and launch targets are provided in the +res/ide-support/eclipse directory of the source tree. +The instructions below will automatically copy these into the required locations. +

+

+An Ant target is provided as a convenience to download all binary dependencies, and to create +the Eclipse project and classpath files in the root of the source tree. +

+ +

+cd ${tomcat.source}
+ant ide-eclipse +

+ +

+Start Eclipse and create a new Workspace. +

+ +

+Open the Preferences dialog and then select Java->Build Path->Classpath +Variables to add two new Classpath Variables: +

+ + + + + +
TOMCAT_LIBS_BASEThe same location as the base.path + setting in build.properties, where the binary dependencies have been downloaded
ANT_HOMEthe base path of Ant 1.9.8 or later
+ + +

+Use File->Import and choose Existing Projects into Workspace. +From there choose the root directory of the Tomcat source tree (${tomcat.source}) +and import the Tomcat project located there. +

+ +

+start-tomcat and stop-tomcat launch configurations are provided in +res/ide-support/eclipse and will be available in the Run->Run Configurations +dialog. Use these to start and stop Tomcat from Eclipse. +If you want to configure these yourself (or are using a different IDE) +then use org.apache.catalina.startup.Bootstrap as the main class, +start/stop etc. as program arguments, and specify -Dcatalina.home=... +(with the name of your build directory) as VM arguments. +

+ +

+Tweaking a few formatting preferences will make it much easier to keep consistent with Tomcat +coding conventions (and have your contributions accepted): +

+ + + + + + + + +
Java -> Code Style -> Formatter -> Edit...Tab policy: Spaces only
Tab and Indentation size: 4
General -> Editors -> Text EditorsDisplayed tab width: 2
Insert spaces for tabs
Show whitespace characters (optional)
XML -> XML Files -> EditorIndent using spaces
Indentation size: 2
Ant -> Editor -> FormatterTab size: 2
Use tab character instead of spaces: unchecked
+ +

+The recommended configuration of Compiler Warnings is documented in +res/ide-support/eclipse/java-compiler-errors-warnings.txt file. +

+ +

Building with other IDEs

+

+The same general approach should work for most IDEs; it has been reported +to work in IntelliJ IDEA, for example. +

+ +

+ Comments +

Notice: This comments section collects your suggestions + on improving documentation for Apache Tomcat.

+ If you have trouble and need help, read + Find Help page + and ask your question on the tomcat-users + mailing list. + Do not ask such questions here. This is not a Q&A section.

+ The Apache Comments System is explained here. + Comments may be removed by our moderators if they are either + implemented or considered invalid/off-topic. +

\ No newline at end of file diff --git a/ZipProject/wwwroot/zip/15509299050/new/balancer-howto.html b/ZipProject/wwwroot/zip/15509299050/new/balancer-howto.html new file mode 100644 index 0000000..ebef81c --- /dev/null +++ b/ZipProject/wwwroot/zip/15509299050/new/balancer-howto.html @@ -0,0 +1,61 @@ + +Apache Tomcat 9 (9.0.11) - Load Balancer HOW-TO

Load Balancer HOW-TO

Table of Contents

Using the JK 1.2.x native connector

+ +Please refer to the JK 1.2.x documentation. + +

Using Apache HTTP Server 2.x with mod_proxy

+ +Please refer to the mod_proxy documentation for Apache HTTP Server 2.2. This supports either +HTTP or AJP load balancing. This new version of mod_proxy is also usable with +Apache HTTP Server 2.0, but mod_proxy will have to be compiled separately using the code +from Apache HTTP Server 2.2. + +

+ Comments +

Notice: This comments section collects your suggestions + on improving documentation for Apache Tomcat.

+ If you have trouble and need help, read + Find Help page + and ask your question on the tomcat-users + mailing list. + Do not ask such questions here. This is not a Q&A section.

+ The Apache Comments System is explained here. + Comments may be removed by our moderators if they are either + implemented or considered invalid/off-topic. +

\ No newline at end of file diff --git a/ZipProject/wwwroot/zip/15509300240/balancer-howto.html b/ZipProject/wwwroot/zip/15509300240/balancer-howto.html new file mode 100644 index 0000000..ebef81c --- /dev/null +++ b/ZipProject/wwwroot/zip/15509300240/balancer-howto.html @@ -0,0 +1,61 @@ + +Apache Tomcat 9 (9.0.11) - Load Balancer HOW-TO

Load Balancer HOW-TO

Table of Contents

Using the JK 1.2.x native connector

+ +Please refer to the JK 1.2.x documentation. + +

Using Apache HTTP Server 2.x with mod_proxy

+ +Please refer to the mod_proxy documentation for Apache HTTP Server 2.2. This supports either +HTTP or AJP load balancing. This new version of mod_proxy is also usable with +Apache HTTP Server 2.0, but mod_proxy will have to be compiled separately using the code +from Apache HTTP Server 2.2. + +

+ Comments +

Notice: This comments section collects your suggestions + on improving documentation for Apache Tomcat.

+ If you have trouble and need help, read + Find Help page + and ask your question on the tomcat-users + mailing list. + Do not ask such questions here. This is not a Q&A section.

+ The Apache Comments System is explained here. + Comments may be removed by our moderators if they are either + implemented or considered invalid/off-topic. +

\ No newline at end of file diff --git a/ZipProject/wwwroot/zip/15509300240/new/building.html b/ZipProject/wwwroot/zip/15509300240/new/building.html new file mode 100644 index 0000000..2235920 --- /dev/null +++ b/ZipProject/wwwroot/zip/15509300240/new/building.html @@ -0,0 +1,278 @@ + +Apache Tomcat 9 (9.0.11) - Building Tomcat

Building Tomcat

Table of Contents

Introduction

+ +

+Building Apache Tomcat from source is very easy, and is the first step to +contributing to Tomcat. The complete and comprehensive instructions are +provided in the file BUILDING.txt. +The following is a quick step by step guide. +

+ +

Download a Java Development Kit (JDK) version 8

+ +

+Building Apache Tomcat requires a JDK (version 8) to be installed. You can download one from
+http://www.oracle.com/technetwork/java/javase/downloads/index.html
+http://openjdk.java.net/install/index.html
+or another JDK vendor. +

+ +

+IMPORTANT: Set an environment variable JAVA_HOME to the pathname of the +directory into which you installed the JDK release. +

+ +

Install Apache Ant 1.9.8 or later

+ +

+Download a binary distribution of Ant 1.9.8 or later from +here. +

+ +

+Unpack the binary distribution into a convenient location so that the +Ant release resides in its own directory (conventionally named +apache-ant-1.9.x). For the remainder of this guide, +the symbolic name ${ant.home} is used to refer to the full pathname of + the Ant installation directory. +

+ +

+IMPORTANT: Create an ANT_HOME environment variable to point the directory ${ant.home}, +and modify the PATH environment variable to include directory +${ant.home}/bin in its list. This makes the ant command line script +available, which will be used to actually perform the build. +

+ +

Checkout or obtain the Tomcat source code

+ +

+ Tomcat SVN repository URL: + https://svn.apache.org/repos/asf/tomcat/trunk/ +

+

+ Tomcat source packages: + https://tomcat.apache.org/download-90.cgi. +

+ +

+ Checkout the source using SVN, selecting a tag for released version or + trunk for the current development code, or download and unpack a + source package. For the remainder of this guide, the symbolic name + ${tomcat.source} is used to refer to the + location where the source has been placed. +

+ +

Configure download area

+ +

+ Building Tomcat involves downloading a number of libraries that it depends on. + It is strongly recommended to configure download area for those libraries. +

+ +

+ By default the build is configured to download the dependencies into the + ${user.home}/tomcat-build-libs directory. You can change this + (see below) but it must be an absolute path. +

+ +

+ The build is controlled by creating a + ${tomcat.source}/build.properties file. It can be used to + redefine any property that is present in build.properties.default + and build.xml files. The build.properties file + does not exist by default. You have to create it. +

+ +

+ The download area is defined by property base.path. For example: +

+ +
# ----- Default Base Path for Dependent Packages -----
+# Replace this path with the directory path where
+# dependencies binaries should be downloaded.
+base.path=/home/me/some-place-to-download-to
+ +

+ Different versions of Tomcat are allowed to share the same download area. +

+ +

+ Another example: +

+ +
base.path=${user.dir}/../libraries-tomcat9.0
+ +

+ Users who access the Internet through a proxy must use the properties + file to indicate to Ant the proxy configuration: +

+ +
# ----- Proxy setup -----
+proxy.host=proxy.domain
+proxy.port=8080
+proxy.use=on
+ +

Building Tomcat

+ +

+Use the following commands to build Tomcat: +

+ +

+cd ${tomcat.source}
+ant +

+ +

+Once the build has completed successfully, a usable Tomcat installation will have been +produced in the ${tomcat.source}/output/build directory, and can be started +and stopped with the usual scripts. +

+

Building with Eclipse

+ +

+IMPORTANT: This is not a supported means of building Tomcat; this information is +provided without warranty :-). +The only supported means of building Tomcat is with the Ant build described above. +However, some developers like to work on Java code with a Java IDE, +and the following steps have been used by some developers. +

+ +

+NOTE: This will not let you build everything under Eclipse; +the build process requires use of Ant for the many stages that aren't +simple Java compilations. +However, it will allow you to view and edit the Java code, +get warnings, reformat code, perform refactorings, run Tomcat +under the IDE, and so on. +

+ +

+WARNING: Do not forget to create and configure + ${tomcat.source}/build.properties file as described above + before running any Ant targets. +

+ +

+Sample Eclipse project files and launch targets are provided in the +res/ide-support/eclipse directory of the source tree. +The instructions below will automatically copy these into the required locations. +

+

+An Ant target is provided as a convenience to download all binary dependencies, and to create +the Eclipse project and classpath files in the root of the source tree. +

+ +

+cd ${tomcat.source}
+ant ide-eclipse +

+ +

+Start Eclipse and create a new Workspace. +

+ +

+Open the Preferences dialog and then select Java->Build Path->Classpath +Variables to add two new Classpath Variables: +

+ + + + + +
TOMCAT_LIBS_BASEThe same location as the base.path + setting in build.properties, where the binary dependencies have been downloaded
ANT_HOMEthe base path of Ant 1.9.8 or later
+ + +

+Use File->Import and choose Existing Projects into Workspace. +From there choose the root directory of the Tomcat source tree (${tomcat.source}) +and import the Tomcat project located there. +

+ +

+start-tomcat and stop-tomcat launch configurations are provided in +res/ide-support/eclipse and will be available in the Run->Run Configurations +dialog. Use these to start and stop Tomcat from Eclipse. +If you want to configure these yourself (or are using a different IDE) +then use org.apache.catalina.startup.Bootstrap as the main class, +start/stop etc. as program arguments, and specify -Dcatalina.home=... +(with the name of your build directory) as VM arguments. +

+ +

+Tweaking a few formatting preferences will make it much easier to keep consistent with Tomcat +coding conventions (and have your contributions accepted): +

+ + + + + + + + +
Java -> Code Style -> Formatter -> Edit...Tab policy: Spaces only
Tab and Indentation size: 4
General -> Editors -> Text EditorsDisplayed tab width: 2
Insert spaces for tabs
Show whitespace characters (optional)
XML -> XML Files -> EditorIndent using spaces
Indentation size: 2
Ant -> Editor -> FormatterTab size: 2
Use tab character instead of spaces: unchecked
+ +

+The recommended configuration of Compiler Warnings is documented in +res/ide-support/eclipse/java-compiler-errors-warnings.txt file. +

+ +

Building with other IDEs

+

+The same general approach should work for most IDEs; it has been reported +to work in IntelliJ IDEA, for example. +

+ +

+ Comments +

Notice: This comments section collects your suggestions + on improving documentation for Apache Tomcat.

+ If you have trouble and need help, read + Find Help page + and ask your question on the tomcat-users + mailing list. + Do not ask such questions here. This is not a Q&A section.

+ The Apache Comments System is explained here. + Comments may be removed by our moderators if they are either + implemented or considered invalid/off-topic. +

\ No newline at end of file diff --git a/ZipProject/wwwroot/zip/15509300320/balancer-howto.html b/ZipProject/wwwroot/zip/15509300320/balancer-howto.html new file mode 100644 index 0000000..ebef81c --- /dev/null +++ b/ZipProject/wwwroot/zip/15509300320/balancer-howto.html @@ -0,0 +1,61 @@ + +Apache Tomcat 9 (9.0.11) - Load Balancer HOW-TO

Load Balancer HOW-TO

Table of Contents

Using the JK 1.2.x native connector

+ +Please refer to the JK 1.2.x documentation. + +

Using Apache HTTP Server 2.x with mod_proxy

+ +Please refer to the mod_proxy documentation for Apache HTTP Server 2.2. This supports either +HTTP or AJP load balancing. This new version of mod_proxy is also usable with +Apache HTTP Server 2.0, but mod_proxy will have to be compiled separately using the code +from Apache HTTP Server 2.2. + +

+ Comments +

Notice: This comments section collects your suggestions + on improving documentation for Apache Tomcat.

+ If you have trouble and need help, read + Find Help page + and ask your question on the tomcat-users + mailing list. + Do not ask such questions here. This is not a Q&A section.

+ The Apache Comments System is explained here. + Comments may be removed by our moderators if they are either + implemented or considered invalid/off-topic. +

\ No newline at end of file diff --git a/ZipProject/wwwroot/zip/15509300440/balancer-howto.html b/ZipProject/wwwroot/zip/15509300440/balancer-howto.html new file mode 100644 index 0000000..ebef81c --- /dev/null +++ b/ZipProject/wwwroot/zip/15509300440/balancer-howto.html @@ -0,0 +1,61 @@ + +Apache Tomcat 9 (9.0.11) - Load Balancer HOW-TO

Load Balancer HOW-TO

Table of Contents

Using the JK 1.2.x native connector

+ +Please refer to the JK 1.2.x documentation. + +

Using Apache HTTP Server 2.x with mod_proxy

+ +Please refer to the mod_proxy documentation for Apache HTTP Server 2.2. This supports either +HTTP or AJP load balancing. This new version of mod_proxy is also usable with +Apache HTTP Server 2.0, but mod_proxy will have to be compiled separately using the code +from Apache HTTP Server 2.2. + +

+ Comments +

Notice: This comments section collects your suggestions + on improving documentation for Apache Tomcat.

+ If you have trouble and need help, read + Find Help page + and ask your question on the tomcat-users + mailing list. + Do not ask such questions here. This is not a Q&A section.

+ The Apache Comments System is explained here. + Comments may be removed by our moderators if they are either + implemented or considered invalid/off-topic. +

\ No newline at end of file diff --git a/ZipProject/wwwroot/zip/15509301900/building.html b/ZipProject/wwwroot/zip/15509301900/building.html new file mode 100644 index 0000000..2235920 --- /dev/null +++ b/ZipProject/wwwroot/zip/15509301900/building.html @@ -0,0 +1,278 @@ + +Apache Tomcat 9 (9.0.11) - Building Tomcat

Building Tomcat

Table of Contents

Introduction

+ +

+Building Apache Tomcat from source is very easy, and is the first step to +contributing to Tomcat. The complete and comprehensive instructions are +provided in the file BUILDING.txt. +The following is a quick step by step guide. +

+ +

Download a Java Development Kit (JDK) version 8

+ +

+Building Apache Tomcat requires a JDK (version 8) to be installed. You can download one from
+http://www.oracle.com/technetwork/java/javase/downloads/index.html
+http://openjdk.java.net/install/index.html
+or another JDK vendor. +

+ +

+IMPORTANT: Set an environment variable JAVA_HOME to the pathname of the +directory into which you installed the JDK release. +

+ +

Install Apache Ant 1.9.8 or later

+ +

+Download a binary distribution of Ant 1.9.8 or later from +here. +

+ +

+Unpack the binary distribution into a convenient location so that the +Ant release resides in its own directory (conventionally named +apache-ant-1.9.x). For the remainder of this guide, +the symbolic name ${ant.home} is used to refer to the full pathname of + the Ant installation directory. +

+ +

+IMPORTANT: Create an ANT_HOME environment variable to point the directory ${ant.home}, +and modify the PATH environment variable to include directory +${ant.home}/bin in its list. This makes the ant command line script +available, which will be used to actually perform the build. +

+ +

Checkout or obtain the Tomcat source code

+ +

+ Tomcat SVN repository URL: + https://svn.apache.org/repos/asf/tomcat/trunk/ +

+

+ Tomcat source packages: + https://tomcat.apache.org/download-90.cgi. +

+ +

+ Checkout the source using SVN, selecting a tag for released version or + trunk for the current development code, or download and unpack a + source package. For the remainder of this guide, the symbolic name + ${tomcat.source} is used to refer to the + location where the source has been placed. +

+ +

Configure download area

+ +

+ Building Tomcat involves downloading a number of libraries that it depends on. + It is strongly recommended to configure download area for those libraries. +

+ +

+ By default the build is configured to download the dependencies into the + ${user.home}/tomcat-build-libs directory. You can change this + (see below) but it must be an absolute path. +

+ +

+ The build is controlled by creating a + ${tomcat.source}/build.properties file. It can be used to + redefine any property that is present in build.properties.default + and build.xml files. The build.properties file + does not exist by default. You have to create it. +

+ +

+ The download area is defined by property base.path. For example: +

+ +
# ----- Default Base Path for Dependent Packages -----
+# Replace this path with the directory path where
+# dependencies binaries should be downloaded.
+base.path=/home/me/some-place-to-download-to
+ +

+ Different versions of Tomcat are allowed to share the same download area. +

+ +

+ Another example: +

+ +
base.path=${user.dir}/../libraries-tomcat9.0
+ +

+ Users who access the Internet through a proxy must use the properties + file to indicate to Ant the proxy configuration: +

+ +
# ----- Proxy setup -----
+proxy.host=proxy.domain
+proxy.port=8080
+proxy.use=on
+ +

Building Tomcat

+ +

+Use the following commands to build Tomcat: +

+ +

+cd ${tomcat.source}
+ant +

+ +

+Once the build has completed successfully, a usable Tomcat installation will have been +produced in the ${tomcat.source}/output/build directory, and can be started +and stopped with the usual scripts. +

+

Building with Eclipse

+ +

+IMPORTANT: This is not a supported means of building Tomcat; this information is +provided without warranty :-). +The only supported means of building Tomcat is with the Ant build described above. +However, some developers like to work on Java code with a Java IDE, +and the following steps have been used by some developers. +

+ +

+NOTE: This will not let you build everything under Eclipse; +the build process requires use of Ant for the many stages that aren't +simple Java compilations. +However, it will allow you to view and edit the Java code, +get warnings, reformat code, perform refactorings, run Tomcat +under the IDE, and so on. +

+ +

+WARNING: Do not forget to create and configure + ${tomcat.source}/build.properties file as described above + before running any Ant targets. +

+ +

+Sample Eclipse project files and launch targets are provided in the +res/ide-support/eclipse directory of the source tree. +The instructions below will automatically copy these into the required locations. +

+

+An Ant target is provided as a convenience to download all binary dependencies, and to create +the Eclipse project and classpath files in the root of the source tree. +

+ +

+cd ${tomcat.source}
+ant ide-eclipse +

+ +

+Start Eclipse and create a new Workspace. +

+ +

+Open the Preferences dialog and then select Java->Build Path->Classpath +Variables to add two new Classpath Variables: +

+ + + + + +
TOMCAT_LIBS_BASEThe same location as the base.path + setting in build.properties, where the binary dependencies have been downloaded
ANT_HOMEthe base path of Ant 1.9.8 or later
+ + +

+Use File->Import and choose Existing Projects into Workspace. +From there choose the root directory of the Tomcat source tree (${tomcat.source}) +and import the Tomcat project located there. +

+ +

+start-tomcat and stop-tomcat launch configurations are provided in +res/ide-support/eclipse and will be available in the Run->Run Configurations +dialog. Use these to start and stop Tomcat from Eclipse. +If you want to configure these yourself (or are using a different IDE) +then use org.apache.catalina.startup.Bootstrap as the main class, +start/stop etc. as program arguments, and specify -Dcatalina.home=... +(with the name of your build directory) as VM arguments. +

+ +

+Tweaking a few formatting preferences will make it much easier to keep consistent with Tomcat +coding conventions (and have your contributions accepted): +

+ + + + + + + + +
Java -> Code Style -> Formatter -> Edit...Tab policy: Spaces only
Tab and Indentation size: 4
General -> Editors -> Text EditorsDisplayed tab width: 2
Insert spaces for tabs
Show whitespace characters (optional)
XML -> XML Files -> EditorIndent using spaces
Indentation size: 2
Ant -> Editor -> FormatterTab size: 2
Use tab character instead of spaces: unchecked
+ +

+The recommended configuration of Compiler Warnings is documented in +res/ide-support/eclipse/java-compiler-errors-warnings.txt file. +

+ +

Building with other IDEs

+

+The same general approach should work for most IDEs; it has been reported +to work in IntelliJ IDEA, for example. +

+ +

+ Comments +

Notice: This comments section collects your suggestions + on improving documentation for Apache Tomcat.

+ If you have trouble and need help, read + Find Help page + and ask your question on the tomcat-users + mailing list. + Do not ask such questions here. This is not a Q&A section.

+ The Apache Comments System is explained here. + Comments may be removed by our moderators if they are either + implemented or considered invalid/off-topic. +

\ No newline at end of file diff --git a/ZipProject/wwwroot/zip/15509303050/building.html b/ZipProject/wwwroot/zip/15509303050/building.html new file mode 100644 index 0000000..2235920 --- /dev/null +++ b/ZipProject/wwwroot/zip/15509303050/building.html @@ -0,0 +1,278 @@ + +Apache Tomcat 9 (9.0.11) - Building Tomcat

Building Tomcat

Table of Contents

Introduction

+ +

+Building Apache Tomcat from source is very easy, and is the first step to +contributing to Tomcat. The complete and comprehensive instructions are +provided in the file BUILDING.txt. +The following is a quick step by step guide. +

+ +

Download a Java Development Kit (JDK) version 8

+ +

+Building Apache Tomcat requires a JDK (version 8) to be installed. You can download one from
+http://www.oracle.com/technetwork/java/javase/downloads/index.html
+http://openjdk.java.net/install/index.html
+or another JDK vendor. +

+ +

+IMPORTANT: Set an environment variable JAVA_HOME to the pathname of the +directory into which you installed the JDK release. +

+ +

Install Apache Ant 1.9.8 or later

+ +

+Download a binary distribution of Ant 1.9.8 or later from +here. +

+ +

+Unpack the binary distribution into a convenient location so that the +Ant release resides in its own directory (conventionally named +apache-ant-1.9.x). For the remainder of this guide, +the symbolic name ${ant.home} is used to refer to the full pathname of + the Ant installation directory. +

+ +

+IMPORTANT: Create an ANT_HOME environment variable to point the directory ${ant.home}, +and modify the PATH environment variable to include directory +${ant.home}/bin in its list. This makes the ant command line script +available, which will be used to actually perform the build. +

+ +

Checkout or obtain the Tomcat source code

+ +

+ Tomcat SVN repository URL: + https://svn.apache.org/repos/asf/tomcat/trunk/ +

+

+ Tomcat source packages: + https://tomcat.apache.org/download-90.cgi. +

+ +

+ Checkout the source using SVN, selecting a tag for released version or + trunk for the current development code, or download and unpack a + source package. For the remainder of this guide, the symbolic name + ${tomcat.source} is used to refer to the + location where the source has been placed. +

+ +

Configure download area

+ +

+ Building Tomcat involves downloading a number of libraries that it depends on. + It is strongly recommended to configure download area for those libraries. +

+ +

+ By default the build is configured to download the dependencies into the + ${user.home}/tomcat-build-libs directory. You can change this + (see below) but it must be an absolute path. +

+ +

+ The build is controlled by creating a + ${tomcat.source}/build.properties file. It can be used to + redefine any property that is present in build.properties.default + and build.xml files. The build.properties file + does not exist by default. You have to create it. +

+ +

+ The download area is defined by property base.path. For example: +

+ +
# ----- Default Base Path for Dependent Packages -----
+# Replace this path with the directory path where
+# dependencies binaries should be downloaded.
+base.path=/home/me/some-place-to-download-to
+ +

+ Different versions of Tomcat are allowed to share the same download area. +

+ +

+ Another example: +

+ +
base.path=${user.dir}/../libraries-tomcat9.0
+ +

+ Users who access the Internet through a proxy must use the properties + file to indicate to Ant the proxy configuration: +

+ +
# ----- Proxy setup -----
+proxy.host=proxy.domain
+proxy.port=8080
+proxy.use=on
+ +

Building Tomcat

+ +

+Use the following commands to build Tomcat: +

+ +

+cd ${tomcat.source}
+ant +

+ +

+Once the build has completed successfully, a usable Tomcat installation will have been +produced in the ${tomcat.source}/output/build directory, and can be started +and stopped with the usual scripts. +

+

Building with Eclipse

+ +

+IMPORTANT: This is not a supported means of building Tomcat; this information is +provided without warranty :-). +The only supported means of building Tomcat is with the Ant build described above. +However, some developers like to work on Java code with a Java IDE, +and the following steps have been used by some developers. +

+ +

+NOTE: This will not let you build everything under Eclipse; +the build process requires use of Ant for the many stages that aren't +simple Java compilations. +However, it will allow you to view and edit the Java code, +get warnings, reformat code, perform refactorings, run Tomcat +under the IDE, and so on. +

+ +

+WARNING: Do not forget to create and configure + ${tomcat.source}/build.properties file as described above + before running any Ant targets. +

+ +

+Sample Eclipse project files and launch targets are provided in the +res/ide-support/eclipse directory of the source tree. +The instructions below will automatically copy these into the required locations. +

+

+An Ant target is provided as a convenience to download all binary dependencies, and to create +the Eclipse project and classpath files in the root of the source tree. +

+ +

+cd ${tomcat.source}
+ant ide-eclipse +

+ +

+Start Eclipse and create a new Workspace. +

+ +

+Open the Preferences dialog and then select Java->Build Path->Classpath +Variables to add two new Classpath Variables: +

+ + + + + +
TOMCAT_LIBS_BASEThe same location as the base.path + setting in build.properties, where the binary dependencies have been downloaded
ANT_HOMEthe base path of Ant 1.9.8 or later
+ + +

+Use File->Import and choose Existing Projects into Workspace. +From there choose the root directory of the Tomcat source tree (${tomcat.source}) +and import the Tomcat project located there. +

+ +

+start-tomcat and stop-tomcat launch configurations are provided in +res/ide-support/eclipse and will be available in the Run->Run Configurations +dialog. Use these to start and stop Tomcat from Eclipse. +If you want to configure these yourself (or are using a different IDE) +then use org.apache.catalina.startup.Bootstrap as the main class, +start/stop etc. as program arguments, and specify -Dcatalina.home=... +(with the name of your build directory) as VM arguments. +

+ +

+Tweaking a few formatting preferences will make it much easier to keep consistent with Tomcat +coding conventions (and have your contributions accepted): +

+ + + + + + + + +
Java -> Code Style -> Formatter -> Edit...Tab policy: Spaces only
Tab and Indentation size: 4
General -> Editors -> Text EditorsDisplayed tab width: 2
Insert spaces for tabs
Show whitespace characters (optional)
XML -> XML Files -> EditorIndent using spaces
Indentation size: 2
Ant -> Editor -> FormatterTab size: 2
Use tab character instead of spaces: unchecked
+ +

+The recommended configuration of Compiler Warnings is documented in +res/ide-support/eclipse/java-compiler-errors-warnings.txt file. +

+ +

Building with other IDEs

+

+The same general approach should work for most IDEs; it has been reported +to work in IntelliJ IDEA, for example. +

+ +

+ Comments +

Notice: This comments section collects your suggestions + on improving documentation for Apache Tomcat.

+ If you have trouble and need help, read + Find Help page + and ask your question on the tomcat-users + mailing list. + Do not ask such questions here. This is not a Q&A section.

+ The Apache Comments System is explained here. + Comments may be removed by our moderators if they are either + implemented or considered invalid/off-topic. +

\ No newline at end of file diff --git a/ZipProject/wwwroot/zip/15509303050/new/balancer-howto.html b/ZipProject/wwwroot/zip/15509303050/new/balancer-howto.html new file mode 100644 index 0000000..ebef81c --- /dev/null +++ b/ZipProject/wwwroot/zip/15509303050/new/balancer-howto.html @@ -0,0 +1,61 @@ + +Apache Tomcat 9 (9.0.11) - Load Balancer HOW-TO

Load Balancer HOW-TO

Table of Contents

Using the JK 1.2.x native connector

+ +Please refer to the JK 1.2.x documentation. + +

Using Apache HTTP Server 2.x with mod_proxy

+ +Please refer to the mod_proxy documentation for Apache HTTP Server 2.2. This supports either +HTTP or AJP load balancing. This new version of mod_proxy is also usable with +Apache HTTP Server 2.0, but mod_proxy will have to be compiled separately using the code +from Apache HTTP Server 2.2. + +

+ Comments +

Notice: This comments section collects your suggestions + on improving documentation for Apache Tomcat.

+ If you have trouble and need help, read + Find Help page + and ask your question on the tomcat-users + mailing list. + Do not ask such questions here. This is not a Q&A section.

+ The Apache Comments System is explained here. + Comments may be removed by our moderators if they are either + implemented or considered invalid/off-topic. +

\ No newline at end of file