Thursday, 21 May 2015

AEM Developers Google Chrome Extension

In this post I will explain features of "Google Chrome AEM Extension Plugin". For using AEM extension first add this plugin to your chrome browser from Chrome web store. After adding this plugin into your Chrome, you are able to see an icon at top right corner as shown below.

Now open any AEM content page as -

then click on this menu you will get options like - 
Here you will get lot of developers friendly options these are listed below - 

1). Directly change WCM Mode.
Before this plugin we have to append wcmmode=disabled or wcmmode=preview in our AEM content page URL but with the help of this plugin we can do this directly by clicking on different buttons.

2). User Impersonate feature
We can easily impersonate users using Authentication tab. Here you will get a option of impersonate user directly.

3). Test Environment
Here you can test your page on author & publish using single click. This facility is present in Environment tab.

4). Cache Flush feature
Another important feature of this plugin is that you can directly clear cache using Clear Cache tab.
5). Layout Debugging feature
You can also add options to your current page for debugging layout & also debugging client libraries.

6). Adobe Marketing Cloud Option
You can directly open adobe marketing cloud option from here.

I think this plugin reduces some AEM site development & debugging time for developers.

Happy Coding
Namah Shivay

Friday, 15 May 2015

Dispatcher Configuration on Apache2 Server

Some of my colleagues wants to know the easiest way of dispatcher configuration on Apache2 server so this post is for you guys. In this tutorial, 
I will explain the easiest way to configure dispatcher on Apache2 server.  
For this post, I used the latest version of Apache2, dispatcher & Ubuntu these are -

Apache2 version 2.4.10 (Current 2.4.12)
dispatcher version 4.1.9
OS version is Ubuntu 15.04

Note - This configuration will also work on Ubuntu 14.04.
So Let's start - 
Install Apache2 server on your Ubuntu machine using command -
sudo apt-get install apache2

Now type the command
sudo service apache2 start

Then hit a url in your web browser  
http://localhost:80 or http://localhost

You will get Apache2 welcome screen.

Download the dispatcher package from Package Share. Location is -

Extract this *.tar.gz file, You will get a folder named as dispatcher-apache2.4-linux-x86-64-4.1.9. 

In this folder you have a file file, just rename it to Now this directory have one directory & three files as shown below -
Copy and paste  file to /usr/lib/apache2/modules location. as shown below - 
If copy & paste not working then you have two ways.
Change the permission of /usr/lib/apache2/modules directory using command -
sudo chmod 777 -R /usr/lib/apache2/modules
Or you use command prompt - 
sudo cp < file location> <place where to paste this file>

sudo cp /media/ankur/myDisk/software/dispatcher-apache2.4-linux-x86-64-4.1.9/ /usr/lib/apache2/modules/ 

In dispatcher-apache2.4-4.1.9 directory there is another directory named as conf. In conf directory there is a file named as dispatcher.any

Just copy this file and paste in /etc/apache2/conf-available directory. as shown below - 
Again if you are not able to paste this file directly then, you can either change the permission of Apache2 directory or use command line to copy and paste this file. 
I am changing the permission of Apache2 directory using command 
sudo chmod 777 -R /etc/apache2 

Now you can easily paste your file in conf-available directory as well as in other directories of apache2 folder.

Now create a soft link in conf-enabled directory using command 
ln -s /etc/apache2/conf-available/dispatcher.any /etc/apache2/conf-enabled/dispatcher.any
It will look like - 
At this point if you want to start your Apache2 server you will get a error & server will not be started because you have created a soft link but it is not defined for Apache2. So not to worry about that error we will resolve that shortly.

Now create a file named as dispatcher.load in mods-available folder & write this line-
LoadModule dispatcher_module /usr/lib/apache2/modules/
It will look like this - 

Note : - This file will be used to load dispatcher module in Apache2 server.

Create a soft link in mods-enabled directory using this command - 
ln -s /etc/apache2/mods-available/dispatcher.load /etc/apache2/mods-enabled/dispatcher.load
It will look like this - 

NOTE: - "Sorry for this, but last two images in my blogs are wrong file names are as displayed in the last two images,  these names are incorrect, filenames must be dispatcher.load in both of these images."

Next step is just open apache2.conf file, search for <Directory> tag here you have to 
add one more <directory> tag as displayed below - 

<Directory />
  <IfModule disp_apache2.c>
          SetHandler dispatcher-handler
  Options FollowSymLinks
  AllowOverride None

Now open ports.conf file & at the end of the file add the line - 

<IfModule disp_apache2.c>
     DispatcherConfig conf-enabled/dispatcher.any
     DispatcherLog    logs/dispatcher.log
     DispatcherLogLevel 3
     DispatcherNoServerHeader 0
     DispatcherDeclineRoot 0
     DispatcherUseProcessedURL 0
     DispatcherPassError 0

Now all set for dispatcher configuration to test your settings first restart the Apache server using command - 
sudo service apache2 start

Now dispatcher configuration with Apache2 is done here is final step -

Go to /etc directory & open hosts file. using command-
sudo gedit /etc/hosts

then add one more line as

All set restart your Apache server using
sudo service apache2 restart

Go to your web browser & hit a url you will get a Apache2 welcome screen.
"One more thing is that in dispatcher.any file change the port number to 4503 as default port is 8080."
It starts successfully.

If you need my help then feel free. I have added multiple images in this post. These images are was not required, but it's human behaviour that we can learn early with pictures & movies rather then hard line. So to make this post easy to understand, I tried my level best.

Happy Coding
Namah Shivay