Change-Id: I01c09aa503158d8cdbcfb3e15b03b61e9ac29d21
import java.util.HashMap;
import java.util.LinkedList;
import java.util.Locale;
import java.util.HashMap;
import java.util.LinkedList;
import java.util.Locale;
import club.wpia.gigi.localisation.Language;
import club.wpia.gigi.output.template.Outputable;
import club.wpia.gigi.localisation.Language;
import club.wpia.gigi.output.template.Outputable;
- public void format(PrintWriter out, Language language) {
+ public void format(PrintWriter out, Language language, Map<String, Object> vars) {
out.println("<div class='alert alert-danger error-msgs'>");
if (isInternalError()) {
e.printStackTrace();
out.println("<div class='alert alert-danger error-msgs'>");
if (isInternalError()) {
e.printStackTrace();
out.println(language.getTranslation("An internal error occurred."));
out.println("</p>");
}
out.println(language.getTranslation("An internal error occurred."));
out.println("</p>");
}
- HashMap<String, Object> map = new HashMap<>();
for (Outputable message : messages) {
for (Outputable message : messages) {
+ HashMap<String, Object> map = new HashMap<>(vars);
out.print("<p>");
message.output(out, language, map);
out.print("<p>");
message.output(out, language, map);
public static boolean printFormErrors(HttpServletRequest req, PrintWriter out) {
Object o = req.getAttribute(SUBMIT_RESULT);
if (o != null && (o instanceof PermamentFormException)) {
public static boolean printFormErrors(HttpServletRequest req, PrintWriter out) {
Object o = req.getAttribute(SUBMIT_RESULT);
if (o != null && (o instanceof PermamentFormException)) {
- ((PermamentFormException) o).getCause().format(out, Page.getLanguage(req));
+ ((PermamentFormException) o).getCause().format(out, Page.getLanguage(req), Page.getDefaultVars(req));
return false;
}
if (o != null && (o instanceof GigiApiException)) {
return false;
}
if (o != null && (o instanceof GigiApiException)) {
- ((GigiApiException) o).format(out, Page.getLanguage(req));
+ ((GigiApiException) o).format(out, Page.getLanguage(req), Page.getDefaultVars(req));
return true;
}
if (o != null && (o instanceof FormContinue)) {
return true;
}
if (o != null && (o instanceof FormContinue)) {
try {
c.getConstructor(HttpServletRequest.class).newInstance(req).output(resp.getWriter(), getLanguage(req), getDefaultVars(req));
} catch (ReflectiveOperationException e) {
try {
c.getConstructor(HttpServletRequest.class).newInstance(req).output(resp.getWriter(), getLanguage(req), getDefaultVars(req));
} catch (ReflectiveOperationException e) {
- new GigiApiException().format(resp.getWriter(), getLanguage(req));
+ new GigiApiException().format(resp.getWriter(), getLanguage(req), getDefaultVars(req));
* the HTTP-request to derive the map from
* @return the map
*/
* the HTTP-request to derive the map from
* @return the map
*/
- protected Map<String, Object> getDefaultVars(HttpServletRequest req) {
+ public static Map<String, Object> getDefaultVars(HttpServletRequest req) {
HashMap<String, Object> vars = new HashMap<String, Object>();
vars.put(Gigi.LINK_HOST, req.getAttribute(Gigi.LINK_HOST));
vars.put("appName", ServerConstants.getAppName());
HashMap<String, Object> vars = new HashMap<String, Object>();
vars.put(Gigi.LINK_HOST, req.getAttribute(Gigi.LINK_HOST));
vars.put("appName", ServerConstants.getAppName());
try {
new PasswordResetForm(req).output(resp.getWriter(), getLanguage(req), getDefaultVars(req));
} catch (GigiApiException e) {
try {
new PasswordResetForm(req).output(resp.getWriter(), getLanguage(req), getDefaultVars(req));
} catch (GigiApiException e) {
- e.format(resp.getWriter(), getLanguage(req));
+ e.format(resp.getWriter(), getLanguage(req), getDefaultVars(req));
} catch (GeneralSecurityException e) {
e.printStackTrace();
} catch (GigiApiException e) {
} catch (GeneralSecurityException e) {
e.printStackTrace();
} catch (GigiApiException e) {
+ e.format(out, l, getDefaultVars(req));
}
certDisplay.output(out, getLanguage(req), vars);
}
certDisplay.output(out, getLanguage(req), vars);
}
getDefaultTemplate().output(resp.getWriter(), getLanguage(req), vars);
} catch (GigiApiException e) {
}
getDefaultTemplate().output(resp.getWriter(), getLanguage(req), vars);
} catch (GigiApiException e) {
- e.format(resp.getWriter(), getLanguage(req));
+ e.format(resp.getWriter(), getLanguage(req), getDefaultVars(req));
try {
pings = target.getPings();
} catch (GigiApiException e) {
try {
pings = target.getPings();
} catch (GigiApiException e) {
+ e.format(out, l, vars);
return;
}
vars.put("domainname", target.getSuffix());
return;
}
vars.put("domainname", target.getSuffix());
try {
new PingConfigForm(req, d).output(resp.getWriter(), getLanguage(req), getDefaultVars(req));
} catch (GigiApiException e) {
try {
new PingConfigForm(req, d).output(resp.getWriter(), getLanguage(req), getDefaultVars(req));
} catch (GigiApiException e) {
- e.format(resp.getWriter(), getLanguage(req));
+ e.format(resp.getWriter(), getLanguage(req), getDefaultVars(req));
try {
new VerificationForm(req, applicant).output(out, getLanguage(req), getDefaultVars(req));
} catch (GigiApiException e) {
try {
new VerificationForm(req, applicant).output(out, getLanguage(req), getDefaultVars(req));
} catch (GigiApiException e) {
- e.format(out, Page.getLanguage(req));
+ e.format(out, Page.getLanguage(req), getDefaultVars(req));
}
} catch (GigiApiException e) {
}
} catch (GigiApiException e) {
- e.format(out, getLanguage(req));
+ e.format(out, getLanguage(req), getDefaultVars(req));
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
-import sun.security.x509.X509Key;
import club.wpia.gigi.Gigi;
import club.wpia.gigi.GigiApiException;
import club.wpia.gigi.crypto.SPKAC;
import club.wpia.gigi.Gigi;
import club.wpia.gigi.GigiApiException;
import club.wpia.gigi.crypto.SPKAC;
import club.wpia.gigi.util.HTMLEncoder;
import club.wpia.gigi.util.Notary;
import club.wpia.gigi.util.TimeConditions;
import club.wpia.gigi.util.HTMLEncoder;
import club.wpia.gigi.util.Notary;
import club.wpia.gigi.util.TimeConditions;
+import sun.security.x509.X509Key;
public class Manager extends Page {
public class Manager extends Page {
e.printStackTrace();
resp.getWriter().println("An internal error occured.");
} catch (GigiApiException e) {
e.printStackTrace();
resp.getWriter().println("An internal error occured.");
} catch (GigiApiException e) {
- e.format(resp.getWriter(), Language.getInstance(Locale.ENGLISH));
+ e.format(resp.getWriter(), Language.getInstance(Locale.ENGLISH), getDefaultVars(req));
}
} else if (req.getParameter("addCert") != null) {
User u = User.getByEmail(req.getParameter("addCertEmail"));
}
} else if (req.getParameter("addCert") != null) {
User u = User.getByEmail(req.getParameter("addCertEmail"));
e1.printStackTrace();
resp.getWriter().println("error");
} catch (GigiApiException e) {
e1.printStackTrace();
resp.getWriter().println("error");
} catch (GigiApiException e) {
- e.format(resp.getWriter(), Language.getInstance(Locale.ENGLISH));
+ e.format(resp.getWriter(), Language.getInstance(Locale.ENGLISH), getDefaultVars(req));
}
} else if (req.getParameter("addExDom") != null) {
}
} else if (req.getParameter("addExDom") != null) {