Switched to zutil UserMessageManager
This commit is contained in:
parent
0c8f71d80d
commit
5065c24f39
5 changed files with 106 additions and 101 deletions
|
|
@ -81,8 +81,8 @@ public class Zallery extends HttpServlet{
|
|||
}
|
||||
|
||||
public static UserMessageManager getUserMessage(HttpSession session) {
|
||||
if (session.getAttribute(ZalleryConstants.SESSION_KEY_USER_MSG) == null)
|
||||
session.setAttribute(ZalleryConstants.SESSION_KEY_USER_MSG, new UserMessageManager());
|
||||
return (UserMessageManager) session.getAttribute(ZalleryConstants.SESSION_KEY_USER_MSG);
|
||||
if (session.getAttribute(ZalleryConstants.KEY_USER_MSG) == null)
|
||||
session.setAttribute(ZalleryConstants.KEY_USER_MSG, new UserMessageManager());
|
||||
return (UserMessageManager) session.getAttribute(ZalleryConstants.KEY_USER_MSG);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -9,7 +9,7 @@ public interface ZalleryConstants {
|
|||
|
||||
/** Session Constants **/
|
||||
|
||||
public static final String SESSION_KEY_USER_MSG = "zall_user_message";
|
||||
public static final String KEY_USER_MSG = "zall_user_message";
|
||||
|
||||
/** Language Key Constants **/
|
||||
|
||||
|
|
|
|||
|
|
@ -2,6 +2,7 @@ package zall;
|
|||
|
||||
import zutil.db.DBConnection;
|
||||
import zutil.log.LogUtil;
|
||||
import zutil.ui.UserMessageManager;
|
||||
|
||||
import javax.servlet.RequestDispatcher;
|
||||
import javax.servlet.ServletException;
|
||||
|
|
@ -22,7 +23,10 @@ public abstract class ZalleryServlet extends HttpServlet {
|
|||
public final void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException {
|
||||
DBConnection db = null;
|
||||
try {
|
||||
UserMessageManager msgs = Zallery.getUserMessage(request.getSession());
|
||||
request.setAttribute(ZalleryConstants.KEY_USER_MSG, msgs);
|
||||
doGet(request, response, db = Zallery.getDB());
|
||||
msgs.decrementViewCount();
|
||||
} catch (ServletException e) {
|
||||
throw e;
|
||||
} catch (Exception e) {
|
||||
|
|
|
|||
|
|
@ -5,7 +5,6 @@ import java.sql.PreparedStatement;
|
|||
import java.sql.SQLException;
|
||||
import java.sql.Timestamp;
|
||||
import java.util.Collections;
|
||||
import java.util.LinkedList;
|
||||
import java.util.List;
|
||||
import java.util.logging.Level;
|
||||
import java.util.logging.Logger;
|
||||
|
|
@ -141,10 +140,10 @@ public class Folder extends DBBean {
|
|||
|
||||
|
||||
/**
|
||||
* @return a File object that points to the physical file on the disk,
|
||||
* or null if the user or the filename is null
|
||||
* @param filename is the name of the file
|
||||
* @param size specifies the size of the image
|
||||
* @return a File object that points to the physical file on the disk,
|
||||
* or null if the user or the filename is null
|
||||
*/
|
||||
public File getFile(String filename, Image.Size size) {
|
||||
// Zallery not initialized.
|
||||
|
|
|
|||
|
|
@ -40,6 +40,7 @@ public class Image extends Media{
|
|||
sql.setLong(1, folder.getId());
|
||||
return DBConnection.exec(sql, DBBeanSQLResultHandler.createList(Image.class, db));
|
||||
}
|
||||
|
||||
public static Image load(DBConnection db, long id) throws SQLException {
|
||||
return DBBean.load(db, Image.class, id);
|
||||
}
|
||||
|
|
@ -53,6 +54,7 @@ public class Image extends Media{
|
|||
public LinkedList<Comment> getComments() {
|
||||
return comments;
|
||||
}
|
||||
|
||||
public void addComment(Comment cm) {
|
||||
comments.add(cm);
|
||||
}
|
||||
|
|
@ -101,8 +103,7 @@ public class Image extends Media{
|
|||
break;
|
||||
}
|
||||
ImageIO.write(image, IMAGE_FORMAT, file);
|
||||
}
|
||||
else if( !orgFile.exists() )
|
||||
} else if (!orgFile.exists())
|
||||
logger.severe("Original image file missing: \"" + file.getAbsolutePath() + "\"");
|
||||
else if (orgFile.canRead())
|
||||
logger.severe("Can not read original image file: \"" + file.getAbsolutePath() + "\"");
|
||||
|
|
@ -112,6 +113,7 @@ public class Image extends Media{
|
|||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getType() {
|
||||
return type;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue