Package com.liferay.portlet

Examples of com.liferay.portlet.ActionRequestImpl


  private void _publishFiles(ActionRequest req, User user) throws WebAssetException {
   
    String[] publishInode = req.getParameterValues("publishInode");
    if (publishInode == null) return;
   
    ActionRequestImpl reqImpl = (ActionRequestImpl)req;
   
    for (int i=0;i<publishInode.length;i++) {
      File file = (File) InodeFactory.getInode(publishInode[i],File.class);
 
      if (InodeUtils.isSet(file.getInode())) {
        //calls the asset factory edit
       
        try{
          PublishFactory.publishAsset(file,reqImpl.getHttpServletRequest());
          SessionMessages.add(req, "message", "message.file_list.published");
        } catch(Exception wax){
          Logger.error(this, wax.getMessage(),wax);
          SessionMessages.add(req, "error", "message.webasset.published.failed");
        }
View Full Code Here


        String cmd = req.getParameter(Constants.CMD);
    String referer = req.getParameter("referer");

    //wraps request to get session object
    ActionRequestImpl reqImpl = (ActionRequestImpl)req;
    HttpServletRequest httpReq = reqImpl.getHttpServletRequest();

    if ((referer!=null) && (referer.length()!=0)) {
      referer = URLDecoder.decode(referer,"UTF-8");
    }
    Logger.debug(this, "UploadMultipleFilesAction cmd=" + cmd);
View Full Code Here

    String inode = req.getParameter("inode");

    FolderAPI folderAPI = new FolderAPIImpl();
    Folder folder = folderAPI.find(inode, _getUser(req), false);

    ActionRequestImpl areq = (ActionRequestImpl) req;
    HttpServletRequest hreq = areq.getHttpServletRequest();

    if (InodeUtils.isSet(folder.getInode())) {
      try{
        PublishFactory.publishAsset(folder,hreq);
        SessionMessages.add(req, "message", "message.folder.published");
View Full Code Here

    String cmd = req.getParameter(Constants.CMD);
    String referer = req.getParameter("referer");
    FileForm fileForm = (FileForm) form;
   
    // wraps request to get session object
    ActionRequestImpl reqImpl = (ActionRequestImpl) req;
    HttpServletRequest httpReq = reqImpl.getHttpServletRequest();
   
    if ((referer != null) && (referer.length() != 0)) {
      referer = URLDecoder.decode(referer, "UTF-8");
    }
   
View Full Code Here

  throws Exception {
   
    try {
     
      // wraps request to get session object
      ActionRequestImpl reqImpl = (ActionRequestImpl) req;
      HttpServletRequest httpReq = reqImpl.getHttpServletRequest();
      FileForm fileForm = (FileForm) form;
      UploadPortletRequest uploadReq = PortalUtil.getUploadPortletRequest(req);
     
     
      // gets the new information for the container from the request
      // object
      File file = new File();
      file.setTitle(fileForm.getTitle());
      BeanUtils.copyProperties(file,fileForm);
      req.setAttribute(WebKeys.FILE_FORM_EDIT,file);
           
      // gets the current container being edited from the request object
      File currentFile = (File) req.getAttribute(WebKeys.FILE_EDIT);
     
      // parent folder
      String parent = ParamUtil.getString(req, "parent");
      Folder folder = APILocator.getFolderAPI().find(parent, user, false);
      //http://jira.dotmarketing.net/browse/DOTCMS-5899
      if(InodeUtils.isSet(currentFile.getIdentifier())){
        Identifier id = APILocator.getIdentifierAPI().find(currentFile);
        if(id!=null && InodeUtils.isSet(id.getInode())){
          String URI = id.getURI();
          String uriPath = URI.substring(0,URI.lastIndexOf("/")+1);
          String folderPath = APILocator.getIdentifierAPI().find(folder).getPath();
          if(!uriPath.equals(folderPath)){
            id.setURI(folderPath+currentFile.getFileName());
            APILocator.getIdentifierAPI().save(id);
          }
        }
      }

      req.setAttribute(WebKeys.PARENT_FOLDER, folder)// Since the above query is expensive, save it into request object
     
      if(currentFile!=null)
        file.setIdentifier(currentFile.getIdentifier());
     
      _checkPermissions(file, folder, user, httpReq);
     
      // gets user id from request for modified user
      String userId = user.getUserId();
     
      boolean previousShowMenu = file.isShowOnMenu();
     
      long uploadFileMaxSize = Long.parseLong(Config.getStringProperty("UPLOAD_FILE_MAX_SIZE"));

      //Checking the max file size
      java.io.File uploadedFile = uploadReq.getFile("uploadedFile");
     
      if(currentFile!=null && UtilMethods.isSet(currentFile.getInode())){
        java.io.File editedFile = new java.io.File(APILocator.getFileAPI().getAssetIOFile(currentFile).getPath()+"_text");
        if(editedFile.exists()){
          FileChannel ic = new FileInputStream(editedFile).getChannel();
          FileChannel oc = new FileOutputStream(APILocator.getFileAPI().getAssetIOFile(currentFile)).getChannel();
          ic.transferTo(0, ic.size(), oc);
          ic.close();
          oc.close();
        }
      }

     
      //Do we have an uploaded file or not?
      boolean haveUpload = (uploadedFile.exists() && uploadedFile.length()>0);
      boolean tmpFile = true;
     
      if(!haveUpload){

        // look for a edited file in the users session, if it is there, use that
        if(UtilMethods.isSet(fileForm.get_imageToolSaveFile())){
          String x =fileForm.get_imageToolSaveFile().trim();
          if( x != null){
            x = PublicEncryptionFactory.decryptString(x);
            uploadedFile = new java.io.File( x.trim());
            haveUpload = (uploadedFile.exists() && uploadedFile.length()>0);
          }
          else{
            x=null;
          }
          reqImpl.getHttpServletRequest().getSession().removeAttribute(WebKeys.IMAGE_TOOL_SAVE_FILES);
        }
      }
     
     
     
View Full Code Here

 
  public void _copyWebAsset(ActionRequest req, ActionResponse res, PortletConfig config, ActionForm form, User user)
  throws Exception {
   
    // wraps request to get session object
    ActionRequestImpl reqImpl = (ActionRequestImpl) req;
    HttpServletRequest httpReq = reqImpl.getHttpServletRequest();
   
    Logger.debug(this, "I'm copying the File");
   
    try {
      // gets the current template being edited from the request object
View Full Code Here

  public void processAction(ActionMapping mapping, ActionForm form,
      PortletConfig config, ActionRequest req, ActionResponse res)
      throws Exception {

    // wraps request to get session object
    ActionRequestImpl reqImpl = (ActionRequestImpl) req;
    HttpServletRequest httpReq = reqImpl.getHttpServletRequest();

    String cmd = req.getParameter(Constants.CMD);

    User user = _getUser(req);
View Full Code Here

      PortletConfig config, ActionForm form) throws Exception {

    Folder f = (Folder) req.getAttribute(WebKeys.FOLDER_EDIT);

    // wraps request to get session object
    ActionRequestImpl reqImpl = (ActionRequestImpl) req;
    HttpServletRequest httpReq = reqImpl.getHttpServletRequest();
    // gets the session object for the messages
    HttpSession session = httpReq.getSession();

    String selectedFolder = ((String) session
        .getAttribute(com.dotmarketing.util.WebKeys.FOLDER_SELECTED) != null) ? (String) session
View Full Code Here

        UploadPortletRequest uploadReq = PortalUtil.getUploadPortletRequest(req);
        ActionResponseImpl responseImpl = (ActionResponseImpl) res;
        HttpServletResponse httpResponse = responseImpl.getHttpServletResponse();

        ActionRequestImpl requestImpl = (ActionRequestImpl) req;
        HttpServletRequest httpRequest = requestImpl.getHttpServletRequest();

        //message ="file upload Done.";

        doUpload(httpRequest, httpResponse, uploadReq);
      }
View Full Code Here

    PortletMode portletMode = new PortletMode(
      ParamUtil.getString(req, "p_p_mode"));

    if (action) {
      ActionRequestImpl actionRequest = new ActionRequestImpl(
        req, portlet, cachePortlet, portletCtx, windowState,
        portletMode, portletPrefs, layout.getId());

      ActionResponseImpl actionResponse = new ActionResponseImpl(
        actionRequest, res, portletId, user, layout, windowState,
        portletMode);

      actionRequest.defineObjects(portletConfig, actionResponse);

      cachePortlet.processAction(actionRequest, actionResponse);

      RenderParametersPool.put(
        req, layout.getId(), portletId,
View Full Code Here

TOP

Related Classes of com.liferay.portlet.ActionRequestImpl

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.