18 package org.turro.elephant.zkoss;
20 import java.io.IOException;
21 import java.util.logging.Level;
22 import java.util.logging.Logger;
23 import javax.servlet.http.HttpServletRequest;
24 import javax.servlet.http.HttpServletResponse;
25 import javax.servlet.http.HttpSession;
26 import org.turro.string.Strings;
27 import org.turro.action.Contacts;
28 import org.turro.auth.Authentication;
29 import org.turro.elephant.ApplicationFramework;
30 import org.turro.elephant.context.Application;
31 import org.turro.elephant.context.ElephantContext;
32 import org.turro.elephant.context.History;
33 import org.turro.elephant.context.IConstructor;
34 import org.turro.elephant.security.IUser;
35 import org.turro.log.SystemLogType;
36 import org.turro.log.SystemLogger;
37 import org.turro.plugin.contacts.IContact;
38 import org.zkoss.web.fn.ServletFns;
39 import org.zkoss.zk.ui.Execution;
40 import org.zkoss.zk.ui.Executions;
41 import org.zkoss.zk.ui.Sessions;
55 request.setAttribute(
"el_app",
this);
61 if(application ==
null) {
63 application = (
Application) ServletFns.getCurrentRequest().getAttribute(
"el_app");
64 if(application ==
null) {
65 application =
new ZkossElephant((HttpServletRequest) ServletFns.getCurrentRequest(), (HttpServletResponse) ServletFns.getCurrentResponse());
66 ServletFns.getCurrentRequest().setAttribute(
"el_app", application);
69 }
catch(Exception ex) {
87 Execution execution = Executions.getCurrent();
88 if(execution !=
null) {
89 return (HttpServletRequest) execution.getNativeRequest();
97 Execution execution = Executions.getCurrent();
98 if(execution !=
null) {
99 return (HttpServletResponse) execution.getNativeResponse();
107 HttpSession ses = super.getHttpSession(create);
109 ses = (HttpSession) Sessions.getCurrent(create).getNativeSession();
114 public static void doWebAdmin(
boolean value, String redir)
throws IOException {
120 Executions.sendRedirect(redir ==
null ?
"" : redir);
136 if(Executions.getCurrent() !=
null) {
137 Executions.sendRedirect(uri);
141 }
catch (IOException ex) {
150 if(constructor !=
null) {
151 if(Executions.getCurrent() !=
null) {
152 Executions.sendRedirect(Strings.isBlank(
History.
back(constructor),
"/"));
156 }
catch (IOException ex) {
static boolean sendReminder(IConstructor constructor, String name, String email)
static void setLocale(HttpServletRequest request)
IConstructor getConstructor()
HttpServletResponse response
HttpSession getHttpSession(boolean create)
HttpServletRequest request
static ThreadLocal< Application > app
static IConstructor getConstructor(HttpServletRequest request, HttpServletResponse response)
static String logMsg(String msg)
static String back(IConstructor constructor)
static boolean doSendReminder(String login)
HttpSession getHttpSession(boolean create)
ZkossElephant(HttpServletRequest request, HttpServletResponse response)
static Application getCurrent()
static void doWebAdmin(boolean value, String redir)
HttpServletResponse getHttpServletResponse()
IConstructor doConstructor()
HttpServletRequest getHttpServletRequest()
static ZkossElephant instance(HttpServletRequest request, HttpServletResponse response)
void sendRedirect(String uri)
static ISystemLogger getInstance()
void setWebAdministering(boolean value)
void redirect(String path)
void setRequestAttribute(String key, Object value)
static final String CONNECTOR_EMAIL
boolean impersonate(String login)
String getProperty(String key)
boolean impersonateByEmail(String email)
void doLog(SystemLogType type, Object entity, String comment, Serializable data)