Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGreg Wilkins2013-09-06 03:06:15 +0000
committerGreg Wilkins2013-09-06 03:06:15 +0000
commit5c3f498624b369bd2f504488377790cb85edf71a (patch)
treeedbcd5d40e91bb2aa0e65e5af625de1b459872fa
parentc3bd5752ee40dfd4c083f2bbff4e5b97fddb31e2 (diff)
downloadorg.eclipse.jetty.project-5c3f498624b369bd2f504488377790cb85edf71a.tar.gz
org.eclipse.jetty.project-5c3f498624b369bd2f504488377790cb85edf71a.tar.xz
org.eclipse.jetty.project-5c3f498624b369bd2f504488377790cb85edf71a.zip
create directories on module ini
-rw-r--r--jetty-deploy/src/main/config/modules/deploy.mod3
-rw-r--r--jetty-server/src/main/config/etc/jetty-requestlog.xml2
-rw-r--r--jetty-server/src/main/config/modules/requestlog.mod3
-rw-r--r--jetty-server/src/main/config/modules/ssl.mod2
-rw-r--r--jetty-server/src/main/java/org/eclipse/jetty/server/HttpInput.java2
-rw-r--r--jetty-spdy/spdy-http-server/src/main/config/modules/npn.mod4
-rw-r--r--jetty-start/src/main/java/org/eclipse/jetty/start/FileArg.java (renamed from jetty-start/src/main/java/org/eclipse/jetty/start/DownloadArg.java)30
-rw-r--r--jetty-start/src/main/java/org/eclipse/jetty/start/Main.java47
-rw-r--r--jetty-start/src/main/java/org/eclipse/jetty/start/Module.java14
-rw-r--r--jetty-start/src/main/java/org/eclipse/jetty/start/StartArgs.java23
-rw-r--r--jetty-start/src/test/java/org/eclipse/jetty/start/ConfigurationAssert.java2
-rw-r--r--jetty-start/src/test/resources/usecases/home/modules/npn.mod4
12 files changed, 78 insertions, 58 deletions
diff --git a/jetty-deploy/src/main/config/modules/deploy.mod b/jetty-deploy/src/main/config/modules/deploy.mod
index 94c0e40316..84c90ab5d2 100644
--- a/jetty-deploy/src/main/config/modules/deploy.mod
+++ b/jetty-deploy/src/main/config/modules/deploy.mod
@@ -9,6 +9,9 @@ webapp
# Deploy jars
lib/jetty-deploy-${jetty.version}.jar
+[files]
+webapps/
+
[xml]
# Deploy configuration
etc/jetty-deploy.xml
diff --git a/jetty-server/src/main/config/etc/jetty-requestlog.xml b/jetty-server/src/main/config/etc/jetty-requestlog.xml
index 213177731a..7b1b241b73 100644
--- a/jetty-server/src/main/config/etc/jetty-requestlog.xml
+++ b/jetty-server/src/main/config/etc/jetty-requestlog.xml
@@ -15,7 +15,7 @@
<New id="RequestLog" class="org.eclipse.jetty.server.handler.RequestLogHandler">
<Set name="requestLog">
<New id="RequestLogImpl" class="org.eclipse.jetty.server.AsyncNCSARequestLog">
- <Set name="filename"><Property name="jetty.logs" default="./logs" />/yyyy_mm_dd.request.log</Set>
+ <Set name="filename"><Property name="jetty.base" default="." />/logs/yyyy_mm_dd.request.log</Set>
<Set name="filenameDateFormat">yyyy_MM_dd</Set>
<Set name="retainDays"><Property name="requestlog.retain" default="90"/></Set>
<Set name="append"><Property name="requestlog.append" default="false"/></Set>
diff --git a/jetty-server/src/main/config/modules/requestlog.mod b/jetty-server/src/main/config/modules/requestlog.mod
index 9d17958a46..b726373f00 100644
--- a/jetty-server/src/main/config/modules/requestlog.mod
+++ b/jetty-server/src/main/config/modules/requestlog.mod
@@ -8,6 +8,9 @@ server
[xml]
etc/jetty-requestlog.xml
+[files]
+logs/
+
[ini]
# requestlog.retain=90
# requestlog.append=true
diff --git a/jetty-server/src/main/config/modules/ssl.mod b/jetty-server/src/main/config/modules/ssl.mod
index be4a4aebe3..90feccc31e 100644
--- a/jetty-server/src/main/config/modules/ssl.mod
+++ b/jetty-server/src/main/config/modules/ssl.mod
@@ -7,7 +7,7 @@ server
[xml]
etc/jetty-ssl.xml
-[download]
+[files]
http://git.eclipse.org/c/jetty/org.eclipse.jetty.project.git/plain/jetty-server/src/main/config/etc/keystore:etc/keystore
[ini]
diff --git a/jetty-server/src/main/java/org/eclipse/jetty/server/HttpInput.java b/jetty-server/src/main/java/org/eclipse/jetty/server/HttpInput.java
index a9dba922ad..b06612fddf 100644
--- a/jetty-server/src/main/java/org/eclipse/jetty/server/HttpInput.java
+++ b/jetty-server/src/main/java/org/eclipse/jetty/server/HttpInput.java
@@ -239,7 +239,7 @@ public abstract class HttpInput<T> extends ServletInputStream implements Runnabl
}
catch (IOException e)
{
- throw new RuntimeIOException(e);
+ LOG.debug(e);
}
}
}
diff --git a/jetty-spdy/spdy-http-server/src/main/config/modules/npn.mod b/jetty-spdy/spdy-http-server/src/main/config/modules/npn.mod
index 7dfa4b8511..7c41e01500 100644
--- a/jetty-spdy/spdy-http-server/src/main/config/modules/npn.mod
+++ b/jetty-spdy/spdy-http-server/src/main/config/modules/npn.mod
@@ -1,7 +1,7 @@
-[download]
+[files]
http://repo1.maven.org/maven2/org/mortbay/jetty/npn/npn-boot/1.1.5.v20130313/npn-boot-1.1.5.v20130313.jar:lib/npn/npn-boot-1.1.5.v20130313.jar
[ini]
-Xbootclasspath/p:lib/npn/npn-boot-1.1.5.v20130313.jar
---exec \ No newline at end of file
+--exec
diff --git a/jetty-start/src/main/java/org/eclipse/jetty/start/DownloadArg.java b/jetty-start/src/main/java/org/eclipse/jetty/start/FileArg.java
index 837b33cc72..c3b6b418a5 100644
--- a/jetty-start/src/main/java/org/eclipse/jetty/start/DownloadArg.java
+++ b/jetty-start/src/main/java/org/eclipse/jetty/start/FileArg.java
@@ -18,28 +18,32 @@
package org.eclipse.jetty.start;
-public class DownloadArg
+public class FileArg
{
public String uri;
public String location;
- public DownloadArg(String uriLocation)
+ public FileArg(String uriLocation)
{
String parts[] = uriLocation.split(":",3);
- if (parts.length != 3)
+ if (parts.length == 3)
{
- throw new IllegalArgumentException("Not <http uri>:<location>");
- }
- if (!"http".equalsIgnoreCase(parts[0]))
- {
- throw new IllegalArgumentException("Download only supports http protocol");
+ if (!"http".equalsIgnoreCase(parts[0]))
+ {
+ throw new IllegalArgumentException("Download only supports http protocol");
+ }
+ if (!parts[1].startsWith("//"))
+ {
+ throw new IllegalArgumentException("Download URI invalid: " + uriLocation);
+ }
+ this.uri = String.format("%s:%s",parts[0],parts[1]);
+ this.location = parts[2];
}
- if (!parts[1].startsWith("//"))
+ else
{
- throw new IllegalArgumentException("Download URI invalid: " + uriLocation);
+ this.uri = null;
+ this.location = uriLocation;
}
- this.uri = String.format("%s:%s",parts[0],parts[1]);
- this.location = parts[2];
}
@Override
@@ -57,7 +61,7 @@ public class DownloadArg
{
return false;
}
- DownloadArg other = (DownloadArg)obj;
+ FileArg other = (FileArg)obj;
if (uri == null)
{
if (other.uri != null)
diff --git a/jetty-start/src/main/java/org/eclipse/jetty/start/Main.java b/jetty-start/src/main/java/org/eclipse/jetty/start/Main.java
index be928d6cdf..c582e0b812 100644
--- a/jetty-start/src/main/java/org/eclipse/jetty/start/Main.java
+++ b/jetty-start/src/main/java/org/eclipse/jetty/start/Main.java
@@ -171,7 +171,7 @@ public class Main
}).start();
}
- private void download(DownloadArg arg)
+ private void initFile(FileArg arg)
{
try
{
@@ -183,29 +183,40 @@ public class Main
return;
}
- URL url = new URL(arg.uri);
+ if (arg.uri!=null)
+ {
+ URL url = new URL(arg.uri);
- System.err.println("DOWNLOAD: " + url + " to " + arg.location);
+ System.err.println("DOWNLOAD: " + url + " to " + arg.location);
- FS.ensureDirectoryExists(file.getParentFile());
+ FS.ensureDirectoryExists(file.getParentFile());
- byte[] buf = new byte[8192];
- try (InputStream in = url.openStream(); OutputStream out = new FileOutputStream(file);)
- {
- while (true)
+ byte[] buf = new byte[8192];
+ try (InputStream in = url.openStream(); OutputStream out = new FileOutputStream(file);)
{
- int len = in.read(buf);
-
- if (len > 0)
+ while (true)
{
- out.write(buf,0,len);
- }
- if (len < 0)
- {
- break;
+ int len = in.read(buf);
+
+ if (len > 0)
+ {
+ out.write(buf,0,len);
+ }
+ if (len < 0)
+ {
+ break;
+ }
}
}
}
+ else if (arg.location.endsWith("/"))
+ {
+ System.err.println("MKDIR: " + baseHome.toShortForm(file));
+ file.mkdirs();
+ }
+ else
+ StartLog.warn("MISSING: required file "+ baseHome.toShortForm(file));
+
}
catch (Exception e)
{
@@ -464,9 +475,9 @@ public class Main
}
// Do downloads now
- for (String download : module.getDownloads())
+ for (String file : module.getFiles())
{
- download(new DownloadArg(download));
+ initFile(new FileArg(file));
}
// Process dependencies from top level only
diff --git a/jetty-start/src/main/java/org/eclipse/jetty/start/Module.java b/jetty-start/src/main/java/org/eclipse/jetty/start/Module.java
index 4c57c3672a..8dbf5f274a 100644
--- a/jetty-start/src/main/java/org/eclipse/jetty/start/Module.java
+++ b/jetty-start/src/main/java/org/eclipse/jetty/start/Module.java
@@ -93,8 +93,8 @@ public class Module
private List<String> initialise;
/** List of library options for this Module */
private List<String> libs;
- /** List of downloads for this Module */
- private List<String> downloads;
+ /** List of files for this Module */
+ private List<String> files;
/** Is this Module enabled via start.jar command line, start.ini, or start.d/*.ini ? */
private boolean enabled = false;
@@ -208,9 +208,9 @@ public class Module
return initialise;
}
- public List<String> getDownloads()
+ public List<String> getFiles()
{
- return downloads;
+ return files;
}
@Override
@@ -236,7 +236,7 @@ public class Module
xmls = new ArrayList<>();
initialise = new ArrayList<>();
libs = new ArrayList<>();
- downloads = new ArrayList<>();
+ files = new ArrayList<>();
}
public boolean isEnabled()
@@ -295,8 +295,8 @@ public class Module
case "OPTIONAL":
optionalParentNames.add(line);
break;
- case "DOWNLOAD":
- downloads.add(line);
+ case "FILES":
+ files.add(line);
break;
case "INI":
initialise.add(line);
diff --git a/jetty-start/src/main/java/org/eclipse/jetty/start/StartArgs.java b/jetty-start/src/main/java/org/eclipse/jetty/start/StartArgs.java
index ae49cf7449..aa6378c0e4 100644
--- a/jetty-start/src/main/java/org/eclipse/jetty/start/StartArgs.java
+++ b/jetty-start/src/main/java/org/eclipse/jetty/start/StartArgs.java
@@ -69,7 +69,7 @@ public class StartArgs
private List<String> commandLine = new ArrayList<>();
private Set<String> modules = new HashSet<>();
private Map<String, List<String>> sources = new HashMap<>();
- private List<DownloadArg> downloads = new ArrayList<>();
+ private List<FileArg> files = new ArrayList<>();
private Classpath classpath;
private List<String> xmlRefs = new ArrayList<>();
private List<File> xmls = new ArrayList<>();
@@ -99,12 +99,12 @@ public class StartArgs
classpath = new Classpath();
}
- private void addDownload(String uriLocation)
+ private void addFile(String uriLocation)
{
- DownloadArg arg = new DownloadArg(uriLocation);
- if (!downloads.contains(arg))
+ FileArg arg = new FileArg(uriLocation);
+ if (!files.contains(arg))
{
- downloads.add(arg);
+ files.add(arg);
}
}
@@ -338,10 +338,10 @@ public class StartArgs
}
// Register Download operations
- for (String download : module.getDownloads())
+ for (String file : module.getFiles())
{
- StartLog.debug("Adding module specified download: %s",download);
- addDownload(download);
+ StartLog.debug("Adding module specified file: %s",file);
+ addFile(file);
}
}
}
@@ -361,10 +361,9 @@ public class StartArgs
return this.commandLine;
}
- public List<DownloadArg> getDownloads()
-
+ public List<FileArg> getFiles()
{
- return downloads;
+ return files;
}
public Set<String> getEnabledModules()
@@ -634,7 +633,7 @@ public class StartArgs
if (arg.startsWith("--download="))
{
- addDownload(getValue(arg));
+ addFile(getValue(arg));
return;
}
diff --git a/jetty-start/src/test/java/org/eclipse/jetty/start/ConfigurationAssert.java b/jetty-start/src/test/java/org/eclipse/jetty/start/ConfigurationAssert.java
index 04586a0e26..6b608fc0ed 100644
--- a/jetty-start/src/test/java/org/eclipse/jetty/start/ConfigurationAssert.java
+++ b/jetty-start/src/test/java/org/eclipse/jetty/start/ConfigurationAssert.java
@@ -121,7 +121,7 @@ public class ConfigurationAssert
}
}
List<String> actualDownloads = new ArrayList<>();
- for (DownloadArg darg : args.getDownloads())
+ for (FileArg darg : args.getFiles())
{
actualDownloads.add(String.format("%s:%s",darg.uri,darg.location));
}
diff --git a/jetty-start/src/test/resources/usecases/home/modules/npn.mod b/jetty-start/src/test/resources/usecases/home/modules/npn.mod
index 1f2856c73e..a819d259ce 100644
--- a/jetty-start/src/test/resources/usecases/home/modules/npn.mod
+++ b/jetty-start/src/test/resources/usecases/home/modules/npn.mod
@@ -1,6 +1,6 @@
-[download]
+[files]
http://repo1.maven.org/maven2/org/mortbay/jetty/npn/npn-boot/1.1.5.v20130313/npn-boot-1.1.5.v20130313.jar:lib/npn/npn-boot-1.1.5.v20130313.jar
[ini]
--Xbootclasspath/p:lib/npn/npn-boot-1.1.5.v20130313.jar \ No newline at end of file
+-Xbootclasspath/p:lib/npn/npn-boot-1.1.5.v20130313.jar

Back to the top