Examples of GenericWebAppContext


Examples of org.exoplatform.frameworks.jcr.command.web.GenericWebAppContext

public class CreateFolderCommand extends FCKConnectorXMLOutput implements Command
{

   public boolean execute(Context context) throws Exception
   {
      GenericWebAppContext webCtx = (GenericWebAppContext)context;
      HttpServletResponse response = webCtx.getResponse();
      HttpServletRequest request = webCtx.getRequest();

      String type = (String)context.get("Type");
      if (type == null)
         type = "";

      // // To limit browsing set Servlet init param "digitalAssetsPath"
      // // with desired JCR path
      // String rootFolderStr =
      // (String)context.get("org.exoplatform.frameworks.jcr.command.web.fckeditor.digitalAssetsPath"
      // );
      //   
      // if(rootFolderStr == null)
      // rootFolderStr = "/";
      //
      // // set current folder
      // String currentFolderStr = (String)context.get("CurrentFolder");
      // if(currentFolderStr == null)
      // currentFolderStr = "";
      // else if(currentFolderStr.length() < rootFolderStr.length())
      // currentFolderStr = rootFolderStr;
      //
      // String folderName = (String)context.get("NewFolderName");
      // if(folderName == null)
      // throw new Exception("NewFolderName not defined");
      //   
      // String jcrMapping = (String)context.get(GenericWebAppContext.JCR_CONTENT_MAPPING);
      // if(jcrMapping == null)
      // jcrMapping = DisplayResourceCommand.DEFAULT_MAPPING;
      //   
      // String digitalWS = (String)webCtx.get(AppConstants.DIGITAL_ASSETS_PROP);
      // if(digitalWS == null)
      // digitalWS = AppConstants.DEFAULT_DIGITAL_ASSETS_WS;
      //   
      // webCtx.setCurrentWorkspace(digitalWS);
      //   
      // Node currentFolder = (Node) webCtx.getSession().getItem(currentFolderStr);
      // Node newFolder = currentFolder.addNode(folderName, "nt:folder");
      // currentFolder.save();
      //   
      // String url = request.getContextPath()+jcrMapping+"?"+
      // "workspace="+digitalWS+
      // "&path="+currentFolderStr;

      String workspace = (String)webCtx.get(AppConstants.DIGITAL_ASSETS_PROP);
      if (workspace == null)
         workspace = AppConstants.DEFAULT_DIGITAL_ASSETS_WS;

      String currentFolderStr = getCurrentFolderPath(webCtx);

      String folderName = (String)context.get("NewFolderName");
      if (folderName == null)
         throw new Exception("NewFolderName not defined");

      webCtx.setCurrentWorkspace(workspace);

      Node currentFolder = (Node)webCtx.getSession().getItem(currentFolderStr);
      Node newFolder = currentFolder.addNode(folderName, "nt:folder");
      currentFolder.save();

      String repoName = ((ManageableRepository)webCtx.getSession().getRepository()).getConfiguration().getName();

      String url = request.getContextPath() + makeRESTPath(repoName, workspace, currentFolderStr);

      initRootElement("CreateFolder", type, newFolder.getPath() + "/", url);
View Full Code Here

Examples of org.exoplatform.frameworks.jcr.command.web.GenericWebAppContext

{

   public boolean execute(Context context) throws Exception
   {

      GenericWebAppContext webCtx = (GenericWebAppContext)context;
      HttpServletResponse response = webCtx.getResponse();
      HttpServletRequest request = webCtx.getRequest();
      PrintWriter out = response.getWriter();
      response.setContentType("text/html; charset=UTF-8");
      response.setHeader("Cache-Control", "no-cache");

      String type = (String)context.get("Type");
      if (type == null)
         type = "";

      // // To limit browsing set Servlet init param "digitalAssetsPath"
      // // with desired JCR path
      // String rootFolderStr =
      // (String)context.get("org.exoplatform.frameworks.jcr.command.web.fckeditor.digitalAssetsPath"
      // );
      //   
      // if(rootFolderStr == null)
      // rootFolderStr = "/";
      //
      // // set current folder
      // String currentFolderStr = (String)context.get("CurrentFolder");
      // if(currentFolderStr == null)
      // currentFolderStr = "";
      // else if(currentFolderStr.length() < rootFolderStr.length())
      // currentFolderStr = rootFolderStr;
      //   
      // String jcrMapping = (String)context.get(GenericWebAppContext.JCR_CONTENT_MAPPING);
      // if(jcrMapping == null)
      // jcrMapping = DisplayResourceCommand.DEFAULT_MAPPING;
      //   
      // String digitalWS = (String)webCtx.get(AppConstants.DIGITAL_ASSETS_PROP);
      // if(digitalWS == null)
      // digitalWS = AppConstants.DEFAULT_DIGITAL_ASSETS_WS;

      String workspace = (String)webCtx.get(AppConstants.DIGITAL_ASSETS_PROP);
      if (workspace == null)
         workspace = AppConstants.DEFAULT_DIGITAL_ASSETS_WS;

      String currentFolderStr = getCurrentFolderPath(webCtx);

      webCtx.setCurrentWorkspace(workspace);

      Node parentFolder = (Node)webCtx.getSession().getItem(currentFolderStr);

      DiskFileUpload upload = new DiskFileUpload();
      List items = upload.parseRequest(request);

      Map fields = new HashMap();
View Full Code Here

Examples of org.exoplatform.frameworks.jcr.command.web.GenericWebAppContext

{

   public boolean execute(Context context) throws Exception
   {

      GenericWebAppContext webCtx = (GenericWebAppContext)context;
      HttpServletResponse response = webCtx.getResponse();
      HttpServletRequest request = webCtx.getRequest();
      PrintWriter out = response.getWriter();
      response.setContentType("text/html; charset=UTF-8");
      response.setHeader("Cache-Control", "no-cache");

      String type = (String)context.get("Type");
      if (type == null)
         type = "";

      // // To limit browsing set Servlet init param "digitalAssetsPath"
      // // with desired JCR path
      // String rootFolderStr =
      // (String)context.get("org.exoplatform.frameworks.jcr.command.web.fckeditor.digitalAssetsPath"
      // );
      //   
      // if(rootFolderStr == null)
      // rootFolderStr = "/";
      //
      // // set current folder
      // String currentFolderStr = (String)context.get("CurrentFolder");
      // if(currentFolderStr == null)
      // currentFolderStr = "";
      // else if(currentFolderStr.length() < rootFolderStr.length())
      // currentFolderStr = rootFolderStr;
      //   
      // String jcrMapping = (String)context.get(GenericWebAppContext.JCR_CONTENT_MAPPING);
      // if(jcrMapping == null)
      // jcrMapping = DisplayResourceCommand.DEFAULT_MAPPING;
      //   
      // String digitalWS = (String)webCtx.get(AppConstants.DIGITAL_ASSETS_PROP);
      // if(digitalWS == null)
      // digitalWS = AppConstants.DEFAULT_DIGITAL_ASSETS_WS;

      String workspace = (String)webCtx.get(AppConstants.DIGITAL_ASSETS_PROP);
      if (workspace == null)
         workspace = AppConstants.DEFAULT_DIGITAL_ASSETS_WS;

      String currentFolderStr = getCurrentFolderPath(webCtx);

      webCtx.setCurrentWorkspace(workspace);

      Node parentFolder = (Node)webCtx.getSession().getItem(currentFolderStr);

      DiskFileUpload upload = new DiskFileUpload();
      List items = upload.parseRequest(request);

      Map fields = new HashMap();
View Full Code Here

Examples of org.exoplatform.frameworks.jcr.command.web.GenericWebAppContext

{

   public boolean execute(Context context) throws Exception
   {

      GenericWebAppContext webCtx = (GenericWebAppContext)context;
      HttpServletResponse response = webCtx.getResponse();
      HttpServletRequest request = webCtx.getRequest();
      PrintWriter out = response.getWriter();
      response.setContentType("text/html; charset=UTF-8");
      response.setHeader("Cache-Control", "no-cache");

      String type = (String)context.get("Type");
      if (type == null)
      {
         type = "";
      }

      // // To limit browsing set Servlet init param "digitalAssetsPath"
      // // with desired JCR path
      // String rootFolderStr =
      // (String)context.get("org.exoplatform.frameworks.jcr.command.web.fckeditor.digitalAssetsPath"
      // );
      //   
      // if(rootFolderStr == null)
      // rootFolderStr = "/";
      //
      // // set current folder
      // String currentFolderStr = (String)context.get("CurrentFolder");
      // if(currentFolderStr == null)
      // currentFolderStr = "";
      // else if(currentFolderStr.length() < rootFolderStr.length())
      // currentFolderStr = rootFolderStr;
      //   
      // String jcrMapping = (String)context.get(GenericWebAppContext.JCR_CONTENT_MAPPING);
      // if(jcrMapping == null)
      // jcrMapping = DisplayResourceCommand.DEFAULT_MAPPING;
      //   
      // String digitalWS = (String)webCtx.get(AppConstants.DIGITAL_ASSETS_PROP);
      // if(digitalWS == null)
      // digitalWS = AppConstants.DEFAULT_DIGITAL_ASSETS_WS;

      String workspace = (String)webCtx.get(AppConstants.DIGITAL_ASSETS_PROP);
      if (workspace == null)
      {
         workspace = AppConstants.DEFAULT_DIGITAL_ASSETS_WS;
      }

      String currentFolderStr = getCurrentFolderPath(webCtx);

      webCtx.setCurrentWorkspace(workspace);

      Node parentFolder = (Node)webCtx.getSession().getItem(currentFolderStr);

      DiskFileUpload upload = new DiskFileUpload();
      List items = upload.parseRequest(request);

      Map fields = new HashMap();
View Full Code Here

Examples of org.exoplatform.frameworks.jcr.command.web.GenericWebAppContext

      RepositoryService repositoryService =
         (RepositoryService)container.getComponentInstanceOfType(RepositoryService.class);
      CommandService commandService = (CommandService)container.getComponentInstanceOfType(CommandService.class);

      GenericWebAppContext ctx;
      try
      {
         ctx =
            new GenericWebAppContext(getServletContext(), request, response, sessionProviderService
               .getSessionProvider(null), // null for
               // ThreadLocalSessionProvider
               repositoryService.getDefaultRepository());
      }
      catch (final RepositoryException e)
      {
         throw new IOException()
         {
            @Override
            public Throwable getCause()
            {
               return e;
            }
         };
      }
      catch (final RepositoryConfigurationException e)
      {
         throw new IOException()
         {
            @Override
            public Throwable getCause()
            {
               return e;
            }
         };
      }

      String catalogName = (String)ctx.get(WebConstants.CATALOG_NAME);

      String wsName = (String)ctx.get("workspace");
      if (wsName != null)
         ctx.setCurrentWorkspace(wsName);

      String currentPath = (String)ctx.get("path");

      if (currentPath == null)
         throw new ServletException("Path undefined " + request.getParameter("path") + " Request: "
            + request.getRequestURI());

      try
      {
         Command cmd;
         if (catalogName == null)
            cmd = commandService.getCatalog().getCommand("displayResource");
         else
            cmd = commandService.getCatalog(catalogName).getCommand("displayResource");

         if (cmd == null)
            throw new Exception("No 'displayResource' command found");
         ctx.put("path", currentPath);
         ctx.put("cache-control-max-age", getServletConfig().getInitParameter("cache-control-max-age"));
         cmd.execute(ctx);
      }
      catch (Exception e)
      {
         e.printStackTrace();
View Full Code Here

Examples of org.exoplatform.frameworks.jcr.command.web.GenericWebAppContext

         (SessionProviderService)container.getComponentInstanceOfType(SessionProviderService.class);

      RepositoryService repositoryService =
         (RepositoryService)container.getComponentInstanceOfType(RepositoryService.class);

      GenericWebAppContext ctx;
      try
      {
         ctx =
            new GenericWebAppContext(getServletContext(), request, response, sessionProviderService
               .getSessionProvider(null), // null for
               // ThreadLocalSessionProvider
               repositoryService.getDefaultRepository());
      }
      catch (final RepositoryException e)
      {
         throw new IOException()
         {
            @Override
            public Throwable getCause()
            {
               return e;
            }
         };
      }
      catch (final RepositoryConfigurationException e)
      {
         throw new IOException()
         {
            @Override
            public Throwable getCause()
            {
               return e;
            }
         };
      }

      CommandService commandService = (CommandService)container.getComponentInstanceOfType(CommandService.class);
      String catalogName = (String)ctx.get(WebConstants.CATALOG_NAME);

      // command from context
      String commandName = (String)ctx.get("Command");
      if (commandName == null)
         throw new ServletException("No Command found at the Context");
      Command cmd;
      if (catalogName == null)
         cmd = commandService.getCatalog().getCommand(commandName);
View Full Code Here

Examples of org.exoplatform.frameworks.jcr.command.web.GenericWebAppContext

         (SessionProviderService)container.getComponentInstanceOfType(SessionProviderService.class);

      RepositoryService repositoryService =
         (RepositoryService)container.getComponentInstanceOfType(RepositoryService.class);

      GenericWebAppContext ctx;
      try
      {
         ctx =
            new GenericWebAppContext(servletCtx, request, response, sessionProviderService
               .getSessionProvider(null), // null for
               // ThreadLocalSessionProvider
               repositoryService.getDefaultRepository());
      }
      catch (final RepositoryException e)
      {
         throw new IOException()
         {
            @Override
            public Throwable getCause()
            {
               return e;
            }
         };
      }
      catch (final RepositoryConfigurationException e)
      {
         throw new IOException()
         {
            @Override
            public Throwable getCause()
            {
               return e;
            }
         };
      }

      CommandService commandService = (CommandService)container.getComponentInstanceOfType(CommandService.class);
      String catalogName = (String)ctx.get(WebConstants.CATALOG_NAME);

      // command from context
      String commandName = (String)ctx.get("Command");
      if (commandName == null)
         throw new ServletException("No Command found at the Context");
      Command cmd;
      if (catalogName == null)
         cmd = commandService.getCatalog().getCommand(commandName);
View Full Code Here

Examples of org.exoplatform.frameworks.jcr.command.web.GenericWebAppContext

      RepositoryService repositoryService =
         (RepositoryService)container.getComponentInstanceOfType(RepositoryService.class);
      CommandService commandService = (CommandService)container.getComponentInstanceOfType(CommandService.class);

      GenericWebAppContext ctx;
      try
      {
         ctx =
            new GenericWebAppContext(getServletContext(), request, response, sessionProviderService
               .getSessionProvider(null), // null for
               // ThreadLocalSessionProvider
               repositoryService.getDefaultRepository());
      }
      catch (final RepositoryException e)
      {
         throw new IOException()
         {
            @Override
            public Throwable getCause()
            {
               return e;
            }
         };
      }
      catch (final RepositoryConfigurationException e)
      {
         throw new IOException()
         {
            @Override
            public Throwable getCause()
            {
               return e;
            }
         };
      }

      String catalogName = (String)ctx.get(WebConstants.CATALOG_NAME);

      String wsName = (String)ctx.get("workspace");
      if (wsName != null)
         ctx.setCurrentWorkspace(wsName);

      String currentPath = (String)ctx.get("path");

      if (currentPath == null)
         throw new ServletException("Path undefined " + request.getParameter("path") + " Request: "
            + request.getRequestURI());

      try
      {
         Command cmd;
         if (catalogName == null)
            cmd = commandService.getCatalog().getCommand("displayResource");
         else
            cmd = commandService.getCatalog(catalogName).getCommand("displayResource");

         if (cmd == null)
            throw new Exception("No 'displayResource' command found");
         ctx.put("path", currentPath);
         ctx.put("cache-control-max-age", getServletConfig().getInitParameter("cache-control-max-age"));
         cmd.execute(ctx);
      }
      catch (Exception e)
      {
         e.printStackTrace(); //NOSONAR
View Full Code Here

Examples of org.exoplatform.frameworks.jcr.command.web.GenericWebAppContext

         (SessionProviderService)container.getComponentInstanceOfType(SessionProviderService.class);

      RepositoryService repositoryService =
         (RepositoryService)container.getComponentInstanceOfType(RepositoryService.class);

      GenericWebAppContext ctx;
      try
      {
         ctx =
            new GenericWebAppContext(servletCtx, request, response, sessionProviderService
               .getSessionProvider(null), // null for
               // ThreadLocalSessionProvider
               repositoryService.getDefaultRepository());
      }
      catch (final RepositoryException e)
      {
         throw new IOException()
         {
            @Override
            public Throwable getCause()
            {
               return e;
            }
         };
      }
      catch (final RepositoryConfigurationException e)
      {
         throw new IOException()
         {
            @Override
            public Throwable getCause()
            {
               return e;
            }
         };
      }

      CommandService commandService = (CommandService)container.getComponentInstanceOfType(CommandService.class);
      String catalogName = (String)ctx.get(WebConstants.CATALOG_NAME);

      // command from context
      String commandName = (String)ctx.get("Command");
      if (commandName == null)
         throw new ServletException("No Command found at the Context");
      Command cmd;
      if (catalogName == null)
         cmd = commandService.getCatalog().getCommand(commandName);
View Full Code Here

Examples of org.exoplatform.frameworks.jcr.command.web.GenericWebAppContext

{

   public boolean execute(Context context) throws Exception
   {

      GenericWebAppContext webCtx = (GenericWebAppContext)context;
      HttpServletResponse response = webCtx.getResponse();
      HttpServletRequest request = webCtx.getRequest();

      String filter = (String)context.get("Command");

      String type = (String)context.get("Type");
      if (type == null)
         type = "";

      // To limit browsing set Servlet init param "digitalAssetsPath" with desired JCR path
      // String rootFolderStr =
      // (String)context.get("org.exoplatform.frameworks.jcr.command.web.fckeditor.digitalAssetsPath"
      // );
      //   
      // if(rootFolderStr == null)
      // rootFolderStr = "/";
      //
      // // set current folder
      // String currentFolderStr = get;
      // if(currentFolderStr == null)
      // currentFolderStr = "";
      // else if(currentFolderStr.length() < rootFolderStr.length())
      // currentFolderStr = rootFolderStr;
      //
      // String jcrMapping = (String)context.get(GenericWebAppContext.JCR_CONTENT_MAPPING);
      // if(jcrMapping == null)
      // jcrMapping = DisplayResourceCommand.DEFAULT_MAPPING;
      //
      // String workspace = (String)webCtx.get(AppConstants.DIGITAL_ASSETS_PROP);
      // if(workspace == null)
      // workspace = AppConstants.DEFAULT_DIGITAL_ASSETS_WS;
      //
      // webCtx.setCurrentWorkspace(workspace);
      //
      // Node currentFolder = (Node) webCtx.getSession().getItem(currentFolderStr);
      //
      // initRootElement(filter, type, currentPath, request.getContextPath()+currentPath);
      // String url = request.getContextPath()+jcrMapping+"?"+
      // "workspace="+digitalWS+
      // "&path="+currentFolderStr;

      // /portal/jcr?workspace=collaboration&path=/Digital Assets/Pictures/my
      // images/39515971.u1D8dTVD.wilersee_5924.jpg

      String workspace = (String)webCtx.get(AppConstants.DIGITAL_ASSETS_PROP);
      if (workspace == null)
         workspace = AppConstants.DEFAULT_DIGITAL_ASSETS_WS;

      String currentFolderStr = getCurrentFolderPath(webCtx);

      webCtx.setCurrentWorkspace(workspace);
      Node currentFolder = (Node)webCtx.getSession().getItem(currentFolderStr);

      String repoName = ((ManageableRepository)webCtx.getSession().getRepository()).getConfiguration().getName();

      String url = request.getContextPath() + makeRESTPath(repoName, workspace, currentFolderStr);

      initRootElement(filter, type, currentFolderStr, url);
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.