19 package org.turro.mail.tracker;
21 import java.awt.image.BufferedImage;
23 import java.io.OutputStream;
24 import java.io.UnsupportedEncodingException;
25 import java.util.Date;
26 import java.util.HashMap;
27 import java.util.logging.Level;
28 import java.util.logging.Logger;
29 import javax.imageio.ImageIO;
30 import javax.servlet.ServletContext;
31 import javax.servlet.http.HttpServletRequest;
32 import javax.servlet.http.HttpServletResponse;
33 import org.turro.string.Strings;
34 import org.turro.collections.KeyValueMap;
35 import org.turro.elephant.context.ElephantContext;
36 import org.turro.elephant.context.IConstructor;
37 import org.turro.elephant.db.ElephantPU;
38 import org.turro.elephant.direct.DirectContent;
39 import org.turro.elephant.direct.DirectContents;
40 import org.turro.elephant.direct.IDirectContent;
41 import org.turro.elephant.entities.db.MailTracker;
42 import org.turro.plugin.contacts.IContact;
52 throws UnsupportedEncodingException, Exception {
53 if(contact !=
null && contact.isWebUser()) {
54 HashMap<String, String> values =
new HashMap<>();
55 values.put(
"idcontact", contact.getId());
56 values.put(
"entityPath", entityPath);
57 values.put(
"image", image);
69 public boolean itsMe(String
id) {
70 return getIdentifier().equals(
id);
74 public boolean myTurn(HttpServletRequest request) {
79 public void execute(ServletContext context, HttpServletRequest request, HttpServletResponse response) {
82 String imgtk = constructor.
getParameter(getIdentifier(),
false);
83 if(!Strings.isBlank(imgtk)) {
85 response.setContentType(
"image/png");
87 BufferedImage bi = ImageIO.read(f);
88 OutputStream out = response.getOutputStream();
89 ImageIO.write(bi,
"png", out);
97 }
catch (Exception ex) {
static String getRealPath(String path)
static IConstructor getConstructor(HttpServletRequest request, HttpServletResponse response)
static String logMsg(String msg)
static byte[] decrypt(byte[] value)
static boolean isYourTurn(HttpServletRequest request, String path)
static String doCreateParameter(String id, String parameter, Map< String, String > values)
void setEntityPath(String entityPath)
void setIdContact(String idContact)
void setReadDate(Date readDate)
boolean myTurn(HttpServletRequest request)
static String getIdentifier()
static String createURL(IConstructor constructor, String image, String entityPath, IContact contact)
void execute(ServletContext context, HttpServletRequest request, HttpServletResponse response)
String getParameter(String param)