source: ether_megapoli/trunk/service/implementation/com/medias/megapoli/struts/actions/PrepareFileListAccessAction.java @ 151

Last change on this file since 151 was 151, checked in by vmipsl, 13 years ago

Import medias files and cleanup

  • Property svn:executable set to *
File size: 1.7 KB
Line 
1package com.medias.megapoli.struts.actions;
2
3import javax.servlet.ServletException;
4import javax.servlet.http.HttpServletRequest;
5import javax.servlet.http.HttpServletResponse;
6
7import org.apache.struts.action.Action;
8import org.apache.struts.action.ActionError;
9import org.apache.struts.action.ActionErrors;
10import org.apache.struts.action.ActionForm;
11import org.apache.struts.action.ActionForward;
12import org.apache.struts.action.ActionMapping;
13
14import com.medias.xml.hierarchie.Hierarchie;
15
16
17/**
18 * @author combaz
19 *
20 * Created on 22 févr. 2005
21 */
22public class PrepareFileListAccessAction extends Action {
23   
24        public ActionForward execute (ActionMapping mapping,
25                                      ActionForm form,
26                                      HttpServletRequest request, 
27                                      HttpServletResponse response)
28                throws ServletException {
29           
30                String target = "failure";
31                ActionErrors errors = new ActionErrors ();
32                               
33                Hierarchie tree = (Hierarchie) request.getSession ().getServletContext ().getAttribute ("APP_ACCESSTREE");
34//              String path = (String) request.getParameter("setPath");
35                String path = tree.getDataRoot () + '/' + ((String) request.getParameter ("setPath"));
36                System.out.println (" ************" + path);
37
38                try{
39                        tree.createFileView(path);
40                        request.getSession().setAttribute("jeu", path.substring(path.lastIndexOf ("/") + 1));
41                        target = "success";
42                }
43                catch(Exception e) {
44                        System.out.println ("exception_prepareFileListAction");
45                        errors.add (ActionErrors.GLOBAL_MESSAGE, new ActionError ("errors.upload.prepareFileList.failed"));
46                        e.printStackTrace ();
47                }       
48               
49                if(!errors.isEmpty ()){
50                        saveErrors (request, errors);
51                }
52               
53                return (mapping.findForward (target));
54               
55        }
56       
57}
Note: See TracBrowser for help on using the repository browser.