renamed scriptables to classMapping, slightly cleaned up
getNodeHref() and created getRootHref() method.
This commit is contained in:
parent
3adf646e35
commit
453e319496
1 changed files with 14 additions and 6 deletions
|
@ -99,7 +99,7 @@ public class Application extends UnicastRemoteObject implements IRemoteApp, IRep
|
||||||
private CryptFile pwfile;
|
private CryptFile pwfile;
|
||||||
|
|
||||||
// Map of java class names to object prototypes
|
// Map of java class names to object prototypes
|
||||||
Properties scriptables;
|
Properties classMapping;
|
||||||
|
|
||||||
// a cache for parsed skin objects
|
// a cache for parsed skin objects
|
||||||
CacheMap skincache = new CacheMap (100, 0.75f);
|
CacheMap skincache = new CacheMap (100, 0.75f);
|
||||||
|
@ -178,7 +178,7 @@ public class Application extends UnicastRemoteObject implements IRemoteApp, IRep
|
||||||
pwfile = new CryptFile (pwf, parentpwfile);
|
pwfile = new CryptFile (pwf, parentpwfile);
|
||||||
|
|
||||||
// the properties that map java class names to prototype names
|
// the properties that map java class names to prototype names
|
||||||
scriptables = new SystemProperties (new File (appDir, "scriptable.properties").getAbsolutePath ());
|
classMapping = new SystemProperties (new File (appDir, "class.properties").getAbsolutePath ());
|
||||||
|
|
||||||
// character encoding to be used for responses
|
// character encoding to be used for responses
|
||||||
charset = props.getProperty ("charset", "ISO-8859-1");
|
charset = props.getProperty ("charset", "ISO-8859-1");
|
||||||
|
@ -648,6 +648,12 @@ public class Application extends UnicastRemoteObject implements IRemoteApp, IRep
|
||||||
return pwfile.authenticate (uname, password);
|
return pwfile.authenticate (uname, password);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Return the href to the root of this application.
|
||||||
|
*/
|
||||||
|
public String getRootHref () {
|
||||||
|
return getNodeHref (getDataRoot(), null);
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Return a path to be used in a URL pointing to the given element and action
|
* Return a path to be used in a URL pointing to the given element and action
|
||||||
|
@ -667,7 +673,7 @@ public class Application extends UnicastRemoteObject implements IRemoteApp, IRep
|
||||||
// String href = n.getUrl (root, users, tmpname, siteroot);
|
// String href = n.getUrl (root, users, tmpname, siteroot);
|
||||||
|
|
||||||
String divider = "/";
|
String divider = "/";
|
||||||
StringBuffer b = new StringBuffer ();
|
StringBuffer b = new StringBuffer (baseURI);
|
||||||
Object p = elem;
|
Object p = elem;
|
||||||
int loopWatch = 0;
|
int loopWatch = 0;
|
||||||
|
|
||||||
|
@ -697,9 +703,11 @@ public class Application extends UnicastRemoteObject implements IRemoteApp, IRep
|
||||||
b.insert (0, divider);
|
b.insert (0, divider);
|
||||||
b.insert (0, "users");
|
b.insert (0, "users");
|
||||||
}
|
}
|
||||||
String href = b.toString()+UrlEncoder.encode (actionName);
|
|
||||||
|
|
||||||
return baseURI + href;
|
if (actionName != null)
|
||||||
|
b.append (UrlEncoder.encode (actionName));
|
||||||
|
|
||||||
|
return b.toString ();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -791,7 +799,7 @@ public class Application extends UnicastRemoteObject implements IRemoteApp, IRep
|
||||||
return ((IPathElement) obj).getPrototype ();
|
return ((IPathElement) obj).getPrototype ();
|
||||||
else
|
else
|
||||||
// use java class name as prototype name
|
// use java class name as prototype name
|
||||||
return scriptables.getProperty (obj.getClass ().getName ());
|
return classMapping.getProperty (obj.getClass ().getName ());
|
||||||
}
|
}
|
||||||
|
|
||||||
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
Loading…
Add table
Reference in a new issue