Monday, 29 July 2013

Adobe Marketing Cloud Communities now open for business

Today is the start of a new era for the Adobe Digital Marketing Cloud and its community. After months of hard work, the day has arrived. That is correct -- the Adobe Marketing Cloud Communities are now open for business.

The Adobe Experience Manager forum - part of the Adobe Marketing Cloud Community

The Marketing Cloud community is built using Adobe's latest Social Community platform, part of Experience Manager. The communities make up one key aspect of the Marketing Cloud help, support and learning social strategy, which includes Adobe.com help, Twitter support and advice and is tied to the existing documentation and help experiences.  The Marketing Cloud community is the place for you to dig into the solutions you're using, including Analytics, Experience Manager, Social, Target and even our new Marketing Cloud.

How to get involved with the Adobe Marketing Cloud community
1. Go to the following URL: http://help-forums.adobe.com/content/adobeforums/en.html.
2. Sign in with your Adobe ID.
3. Create your profile by clicking your profile name in the upper right hand corner.
4. Click on one of the Adobe Digital Marketing solutions that you are interested in.
5. Post a new question (or discussion) or help other community members by answering existing questions.

Join the Adobe Experience Cloud Community 

Join the Adobe Experience Cloud Community by clicking this banner




I (Scott Macdonald) am a Senior Digital Marketing Community Manager at Adobe Systems with 20 years in the high tech industry. I am also a programmer with knowledge in Java, JavaScript, C#,C++, HTML, XML and ActionScript. If  you would like to see more CQ or other Adobe Digital Marketing end to end articles like this, then leave a comment and let me know what content you would like to see.


TwitterFollow the Digital Marketing Customer Care team on Twitter @AdobeExpCare.

YouTube: Subscribe to the AEM Community Channel




Thursday, 25 July 2013

Uploading files to Adobe Experience Manager DAM using AssetManager API

You can create an Adobe Experience Manager (AEM) application that lets a user select a file from their local desktop and upload it to AEM Digital Asset Manager (DAM). The file is posted to a custom Sling Servlet that persists an image file in the AEM DAM.



An Adobe AEM client web page that lets a user select a file and upload it to AEM

In this example, notice that a file named lake.jpg is selected. Once the file is uploaded, the Sling Servlet persists the file in the AEM DAM, as shown in the following illustration.


A file is located in the Adobe CQ DAM that was uploaded using a Sling Servlet


When you use the AssetManager API to persist a file in the AEM DAM, AEM automatically creates different renditions for the asset, as shown in this illustration.



Java code that works in non-sling Java servlets to upload a file throws an exception within Adobe CQ. That is, using Apache Commons FileUpload application logic (that works in non-sling Java servlets used in other projects) throws this exception:

java.lang.IllegalStateException: Request Data has already been read

Here is an example of Apache Commons FileUpload Java code that works in other projects - but not in Adobe CQ:

 String fileName = "";
         org.apache.commons.fileupload.FileItem fileItem;
         fileName = "";
         fileItem = null;
         Iterator iterator;

         try {
                 
             List items = (new org.apache.commons.fileupload.servlet.ServletFileUpload(new org.apache.commons.fileupload.disk.DiskFileItemFactory())).parseRequest(request);
             iterator = items.iterator();
             while(iterator.hasNext())
             {
                 Object itemObj = iterator.next();
                 org.apache.commons.fileupload.FileItem item = (org.apache.commons.fileupload.FileItem)itemObj;
                 if(item.getFieldName().equals("our-file"))
                 {
                     fileItem = item;
                     fileName = item.getName();

...

At first, I did not realize why code that I have used in other projects would not work in Adobe CQ.  As I researched this issue further, I discovered that Sling reads the file content automatically, so the code attempts to read in the request data twice. 

This explains the exception. Now the question is how do you successfully get the file when using a Sling servlet? The answer is you can read the file using Sling APIs.  The following Java code example represents the doPost method of a sling servlet that reads the file that is uploaded. The fully qualified names of the Java objects are used so you understand the data types used in this code fragment.

 @Override
     protected void doPost(SlingHttpServletRequest request, SlingHttpServletResponse response) throws ServerException, IOException {
       
       
    try
    {
    final boolean isMultipart = org.apache.commons.fileupload.servlet.ServletFileUpload.isMultipartContent(request);
    PrintWriter out = null;
     
      out = response.getWriter();
      if (isMultipart) {
        final java.util.Map<String, org.apache.sling.api.request.RequestParameter[]> params = request.getRequestParameterMap();
        for (final java.util.Map.Entry<String, org.apache.sling.api.request.RequestParameter[]> pairs : params.entrySet()) {
          final String k = pairs.getKey();
          final org.apache.sling.api.request.RequestParameter[] pArr = pairs.getValue();
          final org.apache.sling.api.request.RequestParameter param = pArr[0];
          final InputStream stream = param.getInputStream();
          if (param.isFormField()) {
            out.println("Form field " + k + " with value " + org.apache.commons.fileupload.util.Streams.asString(stream) + " detected.");
          } else {
            out.println("File field " + k + " with file name " + param.getFileName() + " detected.");
          }
        }
      }
    }
     
         catch (Exception e) {
             e.printStackTrace();
         }
      
     }

To read this development article, click:

http://helpx.adobe.com/experience-manager/using/uploading-files-aem1.html



Join the Adobe Experience Cloud Community 

Join the Adobe Experience Cloud Community by clicking this banner




I (Scott Macdonald) am a Senior Digital Marketing Community Manager at Adobe Systems with 20 years in the high tech industry. I am also a programmer with knowledge in Java, JavaScript, C#,C++, HTML, XML and ActionScript. If  you would like to see more CQ or other Adobe Digital Marketing end to end articles like this, then leave a comment and let me know what content you would like to see.


TwitterFollow the Digital Marketing Customer Care team on Twitter @AdobeExpCare.

YouTube: Subscribe to the AEM Community Channel


Tuesday, 9 July 2013

Using AJAX requests to display Adobe CQ users in a grid control

You can use an AJAX request to retrieve Adobe CQ users and display the result set in a data grid control. To retrieve user data from Adobe CQ, you use a com.day.cq.security.UserManager instance that belongs to the Adobe CQ API. This API provides access to both Adobe CQ users and groups. The following illustration shows Adobe CQ users displayed within a grid control.
Adobe CQ users 
This development article guides you through creating this AEM application that retrieves CQ user data and displays the data in a client web page. To view this development article, click:

http://helpx.adobe.com/experience-manager/using/using-ajax-requests-display-cq.html

Join the Adobe Experience Cloud Community 

Join the Adobe Experience Cloud Community by clicking this banner




I (Scott Macdonald) am a Senior Digital Marketing Community Manager at Adobe Systems with 20 years in the high tech industry. I am also a programmer with knowledge in Java, JavaScript, C#,C++, HTML, XML and ActionScript. If  you would like to see more CQ or other Adobe Digital Marketing end to end articles like this, then leave a comment and let me know what content you would like to see.


TwitterFollow the Digital Marketing Customer Care team on Twitter @AdobeExpCare.

YouTube: Subscribe to the AEM Community Channel