Package org.jresearch.gossip.forms

Examples of org.jresearch.gossip.forms.ProcessAttachForm


            HttpServletRequest request, HttpServletResponse response)
            throws Exception {
        HttpSession session = request.getSession();
        User user = (User) session.getAttribute(IConst.SESSION.USER_KEY);
        ForumDAO dao = ForumDAO.getInstance();
        ProcessAttachForm paForm = (ProcessAttachForm) form;
        if (Configurator.getInstance().getBoolean(
                IConst.CONFIG.ENABLE_FILE_UPLOAD)) {
            FileData fData = dao
                    .getAttachment(Integer.parseInt(paForm.getId()));
            response.setContentType(IConst.JSP.JPG_CONTENT_TYPE);
            ServletOutputStream out = response.getOutputStream();
            ByteArrayInputStream b = new ByteArrayInputStream(fData.getData());
            BufferedImage img = ImageIO.read(b);
            if (img == null) { throw new SystemException(
View Full Code Here


            HttpServletRequest request, HttpServletResponse response)
            throws Exception {
        HttpSession session = request.getSession();
        User user = (User) session.getAttribute(IConst.SESSION.USER_KEY);
        ForumDAO dao = ForumDAO.getInstance();
        ProcessAttachForm paForm = (ProcessAttachForm) form;
        if (Configurator.getInstance().getBoolean(
                IConst.CONFIG.ENABLE_FILE_UPLOAD)) {
            FileData fData = dao
                    .getAttachment(Integer.parseInt(paForm.getId()));
            String mime = fData.getInfo().getContentType();
            response.setContentType(mime);
            if (!(IConst.JSP.JPG_CONTENT_TYPE.equals(mime)
                    || IConst.JSP.GIF_CONTENT_TYPE.equals(mime) || IConst.JSP.PNG_CONTENT_TYPE
                    .equals(mime))) {
View Full Code Here

            HttpServletRequest request, HttpServletResponse response)
            throws Exception {
        HttpSession session = request.getSession();
        User user = (User) session.getAttribute(IConst.SESSION.USER_KEY);
        ForumDAO dao = ForumDAO.getInstance();
        ProcessAttachForm paForm = (ProcessAttachForm) form;
       
        try {
            boolean isUserMod = dao.checkMod(Integer.parseInt(paForm.getFid()),
                    user);
            //          check user access rights
            getServlet().log("check user access rights ");
            if (isUserMod) {
                dao.removeAttachment(Integer.parseInt(paForm.getId()));
            } else {
                return (mapping.findForward(IConst.TOKEN.DENIED));
            }

        } catch (NumberFormatException e) {
            throw new SystemException(e);
        } catch (SQLException e) {
            throw new SystemException(e);
        }
        StringBuffer forward = new StringBuffer();
        forward.append("/ShowMessage.do?fid=");
        forward.append(paForm.getFid());
        forward.append("&tid=");
        forward.append(paForm.getTid());
        forward.append("&mid=");
        forward.append(paForm.getMid());
        return (new ActionForward(forward.toString(), true));
    }
View Full Code Here

            HttpServletRequest request, HttpServletResponse response)
            throws JGossipException {
        HttpSession session = request.getSession();
        User user = (User) session.getAttribute(IConst.SESSION.USER_KEY);
        ForumDAO dao = ForumDAO.getInstance();
        ProcessAttachForm paForm = (ProcessAttachForm) form;
       
        try {
            boolean isUserMod = dao.checkMod(Integer.parseInt(paForm.getFid()),
                    user);
            //          check user access rights
            getServlet().log("check user access rights ");
            if (isUserMod) {
                if(request.getAttribute("attachmentInfoForm")!=null){
                    return mapping.findForward(IConst.TOKEN.PAGE);
                }
                FileDataInfo fInfo = dao.getAttachmentInfo(Integer
                        .parseInt(paForm.getId()));
                if (fInfo == null) {
                    StringBuffer forward = new StringBuffer();
                    forward.append("/ShowMessage.do?fid=");
                    forward.append(paForm.getFid());
                    forward.append("&tid=");
                    forward.append(paForm.getTid());
                    forward.append("&mid=");
                    forward.append(paForm.getMid());
                    return (new ActionForward(forward.toString(), true));
                }
               
                AttachmentInfoForm aiForm=new AttachmentInfoForm();
                BeanUtils.copyProperties(aiForm,paForm);
View Full Code Here

TOP

Related Classes of org.jresearch.gossip.forms.ProcessAttachForm

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.