Dolda2000 GitWeb
/
jsvc.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Merge branch 'master' of git.dolda2000.com:/srv/git/r/jsvc
[jsvc.git]
/
src
/
dolda
/
jsvc
/
util
/
StaticContent.java
diff --git
a/src/dolda/jsvc/util/StaticContent.java
b/src/dolda/jsvc/util/StaticContent.java
index
685669c
..
6d74e37
100644
(file)
--- a/
src/dolda/jsvc/util/StaticContent.java
+++ b/
src/dolda/jsvc/util/StaticContent.java
@@
-10,24
+10,22
@@
public class StaticContent implements Responder {
private final boolean dir;
private final String mimetype;
private final boolean dir;
private final String mimetype;
- public StaticContent(Class<?> base, String resname,
boolean dir,
String mimetype) {
+ public StaticContent(Class<?> base, String resname, String mimetype) {
this.base = base;
this.base = base;
- this.resname = resname;
- this.dir = dir;
+ this.dir = ((this.resname = resname).charAt(resname.length() - 1) == '/');
this.mimetype = mimetype;
}
this.mimetype = mimetype;
}
- public StaticContent(String resname,
boolean dir,
String mimetype) {
- this(null, resname,
dir,
mimetype);
+ public StaticContent(String resname, String mimetype) {
+ this(null, resname, mimetype);
}
public void respond(Request req) {
String nm;
}
public void respond(Request req) {
String nm;
- if(dir)
{
- nm = resname +
"/" +
req.path();
- } else {
+ if(dir)
+ nm = resname + req.path();
+ else
nm = resname;
nm = resname;
- }
InputStream in;
if(base == null) {
in = StaticContent.class.getClassLoader().getResourceAsStream(nm);
InputStream in;
if(base == null) {
in = StaticContent.class.getClassLoader().getResourceAsStream(nm);