public class Root extends Service
Modifier and Type | Class and Description |
---|---|
static class |
Root.Find |
static class |
Root.Hash |
static class |
Root.KeyFail |
static class |
Root.Link |
static class |
Root.LinkFail |
static class |
Root.Meta |
static class |
Root.MetaFail |
static class |
Root.Node |
static class |
Root.Salt |
static class |
Root.SortFail |
static class |
Root.Tree |
CREATE, DISCONNECT, TIMEOUT
Constructor and Description |
---|
Root(java.lang.String domain,
java.util.Properties prop) |
Modifier and Type | Method and Description |
---|---|
void |
create(Daemon daemon)
Initiate service dependencies.
|
static java.lang.String |
file(java.io.File file) |
static java.lang.String |
file(java.lang.String path) |
void |
filter(Event event)
The service method, equivalent of HttpServlet.service().
|
static java.lang.String[] |
getHost() |
static java.lang.String[] |
getIp() |
static long |
hash(java.lang.String key) |
static java.lang.String |
home()
A cross functional Root home folder detection for your deploy.
|
static java.lang.String |
host() |
static long |
id(java.lang.String key,
java.lang.String type)
Fetch the id for a key.
|
static java.lang.String |
local() |
java.lang.String |
path()
The identifier that should trigger this service.
|
static java.lang.String |
path(long id) |
static java.lang.String |
path(java.lang.String name) |
static JSONObject |
sync(Event event,
java.lang.String type,
java.lang.String sort,
boolean create)
Create and synchronize a unique node key across the cluster.
|
public static java.lang.String[] getIp()
public static java.lang.String[] getHost()
public void create(Daemon daemon) throws java.lang.Exception
Service
public static java.lang.String host() throws java.lang.Exception
java.lang.Exception
public static java.lang.String home() throws java.lang.Exception
public static class Login extends Service { public String path() { return "/login"; } public void filter(Event event) throws Event, Exception { event.query().parse(); String mail = event.string("mail"); String pass = event.string("pass"); if(mail.length() > 0 && pass.length() > 0) { File file = new File(Root.home() + "/node/user/mail" + Root.path(mail)); if(!file.exists()) { System.out.println(file); error(event, "Användare ej funnen."); } JSONObject user = new JSONObject(Root.file(file)); if(Deploy.hash(pass, "SHA").equals(user.getString("pass"))) { event.session().put("user", user); } else { error(event, "Fel lösenord."); } } event.reply().header("Location", "user"); event.reply().code("302 Found"); } }
java.lang.Exception
public static java.lang.String local()
public java.lang.String path()
Service
event.daemon().chain(event, "/login").filter(event); throw event; // stop the chainor
event.reply().header("Location", "/login"); event.reply().code("302 Found"); throw event; // stop the chain
public void filter(Event event) throws Event, java.lang.Exception
Service
public static JSONObject sync(Event event, java.lang.String type, java.lang.String sort, boolean create) throws java.lang.Exception
hash(String)
.java.lang.Exception
public static long id(java.lang.String key, java.lang.String type) throws java.lang.Exception
java.lang.Exception
public static long hash(java.lang.String key) throws java.lang.Exception
java.lang.Exception
public static java.lang.String path(long id)
public static java.lang.String path(java.lang.String name)
public static java.lang.String file(java.lang.String path) throws java.lang.Exception
java.lang.Exception
public static java.lang.String file(java.io.File file) throws java.lang.Exception
java.lang.Exception