<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>Deployment Archives - Sourced Code</title>
	<atom:link href="https://sourcedcode.com/blog/category/aem/deployment/feed" rel="self" type="application/rss+xml" />
	<link>https://sourcedcode.com</link>
	<description>AEM Blog Made Just for You.</description>
	<lastBuildDate>Fri, 19 Jul 2024 08:41:33 +0000</lastBuildDate>
	<language>en-US</language>
	<sy:updatePeriod>
	hourly	</sy:updatePeriod>
	<sy:updateFrequency>
	1	</sy:updateFrequency>
	<generator>https://wordpress.org/?v=6.4.8</generator>

<image>
	<url>https://sourcedcode.com/wp-content/uploads/2019/09/cropped-favicon-32x32.png</url>
	<title>Deployment Archives - Sourced Code</title>
	<link>https://sourcedcode.com</link>
	<width>32</width>
	<height>32</height>
</image> 
	<item>
		<title>50 Visual Studio &#124; VS Code Hot Key / Shortcuts for Mac 2023</title>
		<link>https://sourcedcode.com/blog/aem/deployment/50-visual-studio-code-hot-key-shortcuts-for-mac-2023</link>
					<comments>https://sourcedcode.com/blog/aem/deployment/50-visual-studio-code-hot-key-shortcuts-for-mac-2023#respond</comments>
		
		<dc:creator><![CDATA[briankasingli]]></dc:creator>
		<pubDate>Mon, 31 Jul 2023 06:55:50 +0000</pubDate>
				<category><![CDATA[Deployment]]></category>
		<category><![CDATA[Visual Studio Code]]></category>
		<guid isPermaLink="false">https://sourcedcode.com/?p=5540</guid>

					<description><![CDATA[<p>Welcome to our guide on 50 Visual Studio Code shortcuts for Mac users. Whether you&#8217;re a seasoned developer or just starting, mastering these keyboard shortcuts will significantly enhance your coding productivity. Let&#8217;s dive in and discover the most efficient key combinations for a seamless coding experience! For Window users, visit this article, 50 Visual Studio [&#8230;]</p>
<p>The post <a rel="nofollow" href="https://sourcedcode.com/blog/aem/deployment/50-visual-studio-code-hot-key-shortcuts-for-mac-2023">50 Visual Studio | VS Code Hot Key / Shortcuts for Mac 2023</a> appeared first on <a rel="nofollow" href="https://sourcedcode.com">Sourced Code</a>.</p>
]]></description>
										<content:encoded><![CDATA[<p>Welcome to our guide on 50 Visual Studio Code shortcuts for Mac users. Whether you&#8217;re a seasoned developer or just starting, mastering these keyboard shortcuts will significantly enhance your coding productivity. Let&#8217;s dive in and discover the most efficient key combinations for a seamless coding experience!</p>
<div class="mention-block--gold">
For Window users, visit this article, <a href="https://sourcedcode.com/blog/aem/development/50-visual-studio-code-hot-key-shortcuts-for-windows-2023" rel="noopener" target="_blank">50 Visual Studio Code Hot Key / Shortcuts for Mac 2023</a>.
</div>
<hr class="spacer-larger"/>
<h2>Shortcuts List:</h2>
<ul>
<li><strong>(Command + P)</strong>: Quickly open files by typing their names in the Quick Open dialog.</li>
<li><strong>(Command + N)</strong>: Create a new file in the current workspace.</li>
<li><strong>(Command + Shift + P)</strong>: Open the Command Palette to access various commands and settings.</li>
<li><strong>(Command + B)</strong>: Toggle the visibility of the Side Bar.</li>
<li><strong>(Command + Shift + E)</strong>: Focus and show the File Explorer in the Side Bar.</li>
<li><strong>(Command + Shift + F)</strong>: Search across files in the entire workspace.</li>
<li><strong>(Command + J)</strong>: Toggle the Panel (Output, Terminal, or Debug Console).</li>
<li><strong>(Command + /)</strong>: Toggle line comments for the selected code.</li>
<li><strong>(Option + Shift + Up/Down Arrow)</strong>: Move lines of code up or down.</li>
<li><strong>(Option + Click)</strong>: Add multiple cursors at different positions to edit multiple lines at once.</li>
<li><strong>(Command + Shift + L)</strong>: Select all occurrences of the current selection.</li>
<li><strong>(Command + D)</strong>: Add the next occurrence of the current word to the selection.</li>
<li><strong>(Command + G)</strong>: Jump to a specific line number in the active file.</li>
<li><strong>(Option + Left/Right Arrow)</strong>: Move the cursor to the beginning/end of the current word.</li>
<li><strong>(Option + Up/Down Arrow)</strong>: Move the cursor up or down by paragraph.</li>
<li><strong>(Command + Shift + K)</strong>: Delete the current line.</li>
<li><strong>(Command + Shift + T)</strong>: Reopen the last closed tab.</li>
<li><strong>(Command + Tab / Command + Shift + Tab)</strong>: Cycle through open tabs.</li>
<li><strong>(Command + F2)</strong>: Set multiple cursors to the same word in the file.</li>
<li><strong>(Command + Shift + [ / Command + Shift + ])</strong>: Indent or unindent lines of code.</li>
<li><strong>(Option + Shift + O)</strong>: Sort lines in ascending order.</li>
<li><strong>(Option + Command + Down Arrow)</strong>: Copy lines down.</li>
<li><strong>(Option + Shift + Down Arrow)</strong>: Move lines down.</li>
<li><strong>(Option + Shift + Up Arrow)</strong>: Move lines up.</li>
<li><strong>(Option + Shift + F)</strong>: Format the selected code.</li>
<li><strong>(Option + Command + U)</strong>: Transform to uppercase.</li>
<li><strong>(Option + Command + L)</strong>: Transform to lowercase.</li>
<li><strong>(Command + Enter)</strong>: Insert a new line below the current line.</li>
<li><strong>(Command + Shift + Enter)</strong>: Insert a new line above the current line.</li>
<li><strong>(Command + Shift + \)</strong>: Jump to matching bracket.</li>
<li><strong>(Command + Shift + G)</strong>: Open the Source Control view.</li>
<li><strong>(Command + Shift + E)</strong>: Show Explorer/Files view.</li>
<li><strong>(Command + Shift + X)</strong>: Open the Extensions view.</li>
<li><strong>(Option + Shift + F)</strong>: Format document in the editor.</li>
<li><strong>(Command + F)</strong>: Find and replace text.</li>
<li><strong>(Command + Shift + H)</strong>: Replace in files (Find and replace across multiple files).</li>
<li><strong>(Command + Shift + M)</strong>: Show Problems panel.</li>
<li><strong>(Command + Shift + U)</strong>: Show output panel.</li>
<li><strong>(Command + K + W)</strong>: Close all editor tabs.</li>
<li><strong>(Command + Shift + [ / Command + Shift + ])</strong>: Fold or unfold region.</li>
<li><strong>(Option + F12)</strong>: Show all references of a symbol in the workspace.</li>
<li><strong>(Command + Shift + F10)</strong>: Run a specific test.</li>
<li><strong>(Command + Shift + D)</strong>: Open the Debugger panel.</li>
<li><strong>(Command + Shift + O)</strong>: Go to Symbol in File.</li>
<li><strong>(Command + Shift + U)</strong>: Go to a symbol&#8217;s implementation.</li>
<li><strong>(Command + K + R)</strong>: Show keyboard shortcuts reference.</li>
<li><strong>(Command + Shift + F)</strong>: Show keyboard shortcuts reference.</li>
</ul>
<hr class="spacer-larger"/>
<h2>Conclusion:</h2>
<p>Boost your coding productivity with these 50 essential Visual Studio Code shortcuts, tailored for Mac users. Incorporate these time-saving key combinations into your coding workflow, and watch as you breeze through tasks with remarkable speed and efficiency. Happy coding!</p>
<p>The post <a rel="nofollow" href="https://sourcedcode.com/blog/aem/deployment/50-visual-studio-code-hot-key-shortcuts-for-mac-2023">50 Visual Studio | VS Code Hot Key / Shortcuts for Mac 2023</a> appeared first on <a rel="nofollow" href="https://sourcedcode.com">Sourced Code</a>.</p>
]]></content:encoded>
					
					<wfw:commentRss>https://sourcedcode.com/blog/aem/deployment/50-visual-studio-code-hot-key-shortcuts-for-mac-2023/feed</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
			</item>
		<item>
		<title>Deploying Core Module of the AEM Project</title>
		<link>https://sourcedcode.com/blog/aem/deploying-core-module-of-the-aem-project</link>
					<comments>https://sourcedcode.com/blog/aem/deploying-core-module-of-the-aem-project#respond</comments>
		
		<dc:creator><![CDATA[briankasingli]]></dc:creator>
		<pubDate>Thu, 22 Dec 2022 04:33:04 +0000</pubDate>
				<category><![CDATA[AEM]]></category>
		<category><![CDATA[Deployment]]></category>
		<category><![CDATA[Development]]></category>
		<guid isPermaLink="false">https://sourcedcode.com/?p=4102</guid>

					<description><![CDATA[<p>For rapid AEM backend developer, we would like to build the AEM core module bundle to our running local AEM instance. In this article, we will configure the core bundle with an automated script. Simple build the project with mvn clean install -PautoInstallBundle. This is actually a standard that is shipped from the aem-project-archetype-39, but [&#8230;]</p>
<p>The post <a rel="nofollow" href="https://sourcedcode.com/blog/aem/deploying-core-module-of-the-aem-project">Deploying Core Module of the AEM Project</a> appeared first on <a rel="nofollow" href="https://sourcedcode.com">Sourced Code</a>.</p>
]]></description>
										<content:encoded><![CDATA[<p>For rapid AEM backend developer, we would like to build the AEM core module bundle to our running local AEM instance. In this article, we will configure the core bundle with an automated script. Simple build the project with mvn clean install -PautoInstallBundle. This is actually a standard that is shipped from the aem-project-archetype-39, but not configured to the AEM core module.</p>
<p>At the creation of this article, I have used <a href="https://github.com/adobe/aem-project-archetype/tree/aem-project-archetype-39" rel="noopener" target="_blank">https://github.com/adobe/aem-project-archetype/tree/aem-project-archetype-39</a>. </p>
<h3>1. Add a new profile in your core/pom.xml</h3>
<div class="codecolorer-container xml default" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;height:400px;"><table cellspacing="0" cellpadding="0"><tbody><tr><td style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap;text-align:center;color:#888888;background-color:#EEEEEE;border-right: 1px solid #9F9F9F;"><div>1<br />2<br />3<br />4<br />5<br />6<br />7<br />8<br />9<br />10<br />11<br />12<br />13<br />14<br />15<br />16<br />17<br />18<br />19<br />20<br />21<br />22<br />23<br />24<br />25<br />26<br />27<br />28<br />29<br />30<br /></div></td><td><div class="xml codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap;"><span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;profiles<span style="color: #000000; font-weight: bold;">&gt;</span></span></span><br />
&nbsp; &nbsp; <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;profile<span style="color: #000000; font-weight: bold;">&gt;</span></span></span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;id<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>autoInstallBundle<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/id<span style="color: #000000; font-weight: bold;">&gt;</span></span></span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;activation<span style="color: #000000; font-weight: bold;">&gt;</span></span></span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;activeByDefault<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>false<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/activeByDefault<span style="color: #000000; font-weight: bold;">&gt;</span></span></span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/activation<span style="color: #000000; font-weight: bold;">&gt;</span></span></span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;build<span style="color: #000000; font-weight: bold;">&gt;</span></span></span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;pluginManagement<span style="color: #000000; font-weight: bold;">&gt;</span></span></span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;plugins<span style="color: #000000; font-weight: bold;">&gt;</span></span></span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;plugin<span style="color: #000000; font-weight: bold;">&gt;</span></span></span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;groupId<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>org.apache.sling<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/groupId<span style="color: #000000; font-weight: bold;">&gt;</span></span></span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;artifactId<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>sling-maven-plugin<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/artifactId<span style="color: #000000; font-weight: bold;">&gt;</span></span></span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;version<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>2.4.0<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/version<span style="color: #000000; font-weight: bold;">&gt;</span></span></span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;executions<span style="color: #000000; font-weight: bold;">&gt;</span></span></span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;execution<span style="color: #000000; font-weight: bold;">&gt;</span></span></span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;id<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>install-bundle<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/id<span style="color: #000000; font-weight: bold;">&gt;</span></span></span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;goals<span style="color: #000000; font-weight: bold;">&gt;</span></span></span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;goal<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>install<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/goal<span style="color: #000000; font-weight: bold;">&gt;</span></span></span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/goals<span style="color: #000000; font-weight: bold;">&gt;</span></span></span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;configuration<span style="color: #000000; font-weight: bold;">&gt;</span></span></span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;slingUrl<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>${aem.host}:${aem.port}/system/console<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/slingUrl<span style="color: #000000; font-weight: bold;">&gt;</span></span></span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/configuration<span style="color: #000000; font-weight: bold;">&gt;</span></span></span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/execution<span style="color: #000000; font-weight: bold;">&gt;</span></span></span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/executions<span style="color: #000000; font-weight: bold;">&gt;</span></span></span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/plugin<span style="color: #000000; font-weight: bold;">&gt;</span></span></span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/plugins<span style="color: #000000; font-weight: bold;">&gt;</span></span></span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/pluginManagement<span style="color: #000000; font-weight: bold;">&gt;</span></span></span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/build<span style="color: #000000; font-weight: bold;">&gt;</span></span></span><br />
&nbsp; &nbsp; <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/profile<span style="color: #000000; font-weight: bold;">&gt;</span></span></span><br />
<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/profiles<span style="color: #000000; font-weight: bold;">&gt;</span></span></span></div></td></tr></tbody></table></div>
<hr class="spacer-large"/>
<h3>2. Change directory to the core bundle folder, and then run the command below:</h3>
<div class="codecolorer-container java default" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><table cellspacing="0" cellpadding="0"><tbody><tr><td style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap;text-align:center;color:#888888;background-color:#EEEEEE;border-right: 1px solid #9F9F9F;"><div>1<br />2<br />3<br /></div></td><td><div class="java codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap;">cd ~<span style="color: #339933;">/</span>git<span style="color: #339933;">/</span><span style="color: #cc66cc;">2023</span><span style="color: #339933;">/</span>sourcedcode<span style="color: #339933;">/</span>core<br />
<br />
mvn clean install <span style="color: #339933;">-</span>PautoInstallBundle</div></td></tr></tbody></table></div>
<hr class="spacer-large"/>
<h3>3. What&#8217;s the difference between Maven plugins vs dependencies?</h3>
<p><strong>Plugins</strong> are used during the code build phase, when code is being built by Maven; plugins are where much of the real action is performed, plugins are used to: create jar files, create war files, compile code, unit test code, create project documentation, and on and on. Almost any action that you can think of performing on a project is implemented as a Maven plugin.</p>
<p><strong>Dependencies</strong> are declared and used by Maven. During the build, Maven will download the dependencies to your local repository and then use this to compile your JAR. We use the &lt;scope&#038;;gt;test/&lt;scope&#038;;gt;t to indicate that dependency is not required at the runtime of the application but is used only for test purposes; this dependency will not be bundled with the .jar producted.</p>
<p>The post <a rel="nofollow" href="https://sourcedcode.com/blog/aem/deploying-core-module-of-the-aem-project">Deploying Core Module of the AEM Project</a> appeared first on <a rel="nofollow" href="https://sourcedcode.com">Sourced Code</a>.</p>
]]></content:encoded>
					
					<wfw:commentRss>https://sourcedcode.com/blog/aem/deploying-core-module-of-the-aem-project/feed</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
			</item>
		<item>
		<title>Send Out Emails with AEM Servlet</title>
		<link>https://sourcedcode.com/blog/aem/send-out-emails-with-aem-servlet</link>
					<comments>https://sourcedcode.com/blog/aem/send-out-emails-with-aem-servlet#respond</comments>
		
		<dc:creator><![CDATA[briankasingli]]></dc:creator>
		<pubDate>Fri, 21 Jan 2022 03:31:31 +0000</pubDate>
				<category><![CDATA[AEM]]></category>
		<category><![CDATA[Deployment]]></category>
		<category><![CDATA[OSGI]]></category>
		<category><![CDATA[Sling Servlet]]></category>
		<guid isPermaLink="false">https://sourcedcode.com/?p=3339</guid>

					<description><![CDATA[<p>In this article, we will be setting up the local AEM author developer&#8217;s environment to send out an email utilizing the Day CQ Mail Service. This article includes code snippets to a Sling Servlet that will be used to send out the email. We will be using a Google Gmail account as the SMTP Mail [&#8230;]</p>
<p>The post <a rel="nofollow" href="https://sourcedcode.com/blog/aem/send-out-emails-with-aem-servlet">Send Out Emails with AEM Servlet</a> appeared first on <a rel="nofollow" href="https://sourcedcode.com">Sourced Code</a>.</p>
]]></description>
										<content:encoded><![CDATA[<p>In this article, we will be setting up the local AEM author developer&#8217;s environment to send out an email utilizing the Day CQ Mail Service. This article includes code snippets to a Sling Servlet that will be used to send out the email.</p>
<div class="mention-block">
We will be using a Google Gmail account as the SMTP Mail Server in this article. To learn how to set up your Google Gmail account as the SMTP server, <a href="https://sourcedcode.com/blog/general-web/how-to-use-the-gmail-smtp-server-to-send-emails-for-free" rel="noopener" target="_blank">click here</a>.
</div>
<hr class="spacer-large" />
<h2>1. Configure the Day CQ Mail Service</h2>
<p>a. Visit <a href="http://localhost:4502/system/console/configMgr/com.day.cq.mailer.DefaultMailService" rel="noopener" target="_blank">http://localhost:4502/system/console/configMgr/com.day.cq.mailer.DefaultMailService</a></p>
<p><a class="foobox fbx-instance fbx-link" href="https://sourcedcode.com/wp-content/uploads/2022/01/step-1-send-email-aem.png"><img decoding="async" width="300" src="https://sourcedcode.com/wp-content/uploads/2022/01/step-1-send-email-aem.png" alt="This is a screenshot of the Apache Felix Console, Day CQ Mail Service Configuration"/></a></p>
<p>b. Include the configurations below:<br />
<strong>Google SMTP Configurations</strong><br />
SMTP server hostname: smtp.gmail.com<br />
SMTP server port: 465, 25 or 587 (test in that order)<br />
SMTP user: @@YOUR_EMAIL_ADDRESS@@<br />
SMTP from emai: @@YOUR_EMAIL_ADDRESS@@<br />
SMTP password: @@YOUR_PASSWORD@@<br />
SMTP TLS/SSL: true</p>
<p>To automate this configuration, you can run a Curl command like the example below. But please be aware, you must use your own Google Gmail account. </p>
<p>To update the Curl command below, use this tool here, <a class="code-highlight-primary" href="https://sourcedcode.com/blog/aem/tool-generate-curl-command-to-update-osgi-configurations?aemUrl=http://localhost:4502&#038;username=admin&#038;password=admin&#038;pid=com.day.cq.mailer.DefaultMailService&#038;osgiKeys=smtp.host,smtp.port,smtp.user,smtp.password,from.address,smtp.ssl&#038;osgiValues=smtp.gmail.com,587,contact@sourcedcode.com,p4ssw0rd,contact@sourcedcode.com,true#curltool" target="_blank" rel="noopener">Tool: Generate Curl Command to Update OSGI Configurations</a></p>
<pre style="white-space: pre-wrap; font-size: 12px; padding: 5px;">
curl -u admin:admin 'http://localhost:4502/system/console/configMgr/com.day.cq.mailer.DefaultMailService' --data-raw 'apply=true&action=ajaxConfigManager&%24location=&smtp.host=smtp.gmail.com&smtp.port=587&smtp.user=contact@sourcedcode.com&smtp.password=p4ssw0rd&from.address=contact@sourcedcode.com&smtp.ssl=true&propertylist=smtp.host%2Csmtp.port%2Csmtp.user%2Csmtp.password%2Cfrom.address%2Csmtp.ssl'
</pre >
<hr class="spacer-large" />
<h2>2. Create the SendEmailServletExample AEM Servlet</h2>
<p>Create a Java class named, SendEmailServletExample.java, copy and paste the code below, replace line:44 with your own email, and then use your Java Maven skills to build the servlet in AEM.</p>
<p>Once when the SendEmailServletExample.java is built into AEM, visit <a class="code-highlight-primary" href="http://localhost:4502/bin/sendemail" rel="noopener" target="_blank">http://localhost:4502/bin/sendemail</a>,</p>
<div class="code-1000">
<div class="codecolorer-container java default" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;height:400px;"><table cellspacing="0" cellpadding="0"><tbody><tr><td style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap;text-align:center;color:#888888;background-color:#EEEEEE;border-right: 1px solid #9F9F9F;"><div>1<br />2<br />3<br />4<br />5<br />6<br />7<br />8<br />9<br />10<br />11<br />12<br />13<br />14<br />15<br />16<br />17<br />18<br />19<br />20<br />21<br />22<br />23<br />24<br />25<br />26<br />27<br />28<br />29<br />30<br />31<br />32<br />33<br />34<br />35<br />36<br />37<br />38<br />39<br />40<br />41<br />42<br />43<br />44<br />45<br />46<br />47<br />48<br />49<br />50<br />51<br />52<br />53<br />54<br />55<br />56<br />57<br />58<br />59<br />60<br />61<br />62<br />63<br />64<br />65<br />66<br />67<br />68<br />69<br />70<br />71<br />72<br /></div></td><td><div class="java codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap;"><span style="color: #000000; font-weight: bold;">package</span> <span style="color: #006699;">com.sourcedcode.core.servlet</span><span style="color: #339933;">;</span><br />
<br />
<span style="color: #000000; font-weight: bold;">import</span> <span style="color: #006699;">com.day.cq.mailer.MessageGateway</span><span style="color: #339933;">;</span><br />
<span style="color: #000000; font-weight: bold;">import</span> <span style="color: #006699;">com.day.cq.mailer.MessageGatewayService</span><span style="color: #339933;">;</span><br />
<span style="color: #000000; font-weight: bold;">import</span> <span style="color: #006699;">org.apache.commons.mail.Email</span><span style="color: #339933;">;</span><br />
<span style="color: #000000; font-weight: bold;">import</span> <span style="color: #006699;">org.apache.commons.mail.EmailException</span><span style="color: #339933;">;</span><br />
<span style="color: #000000; font-weight: bold;">import</span> <span style="color: #006699;">org.apache.commons.mail.HtmlEmail</span><span style="color: #339933;">;</span><br />
<span style="color: #000000; font-weight: bold;">import</span> <span style="color: #006699;">org.apache.sling.api.SlingHttpServletRequest</span><span style="color: #339933;">;</span><br />
<span style="color: #000000; font-weight: bold;">import</span> <span style="color: #006699;">org.apache.sling.api.SlingHttpServletResponse</span><span style="color: #339933;">;</span><br />
<span style="color: #000000; font-weight: bold;">import</span> <span style="color: #006699;">org.apache.sling.api.servlets.SlingAllMethodsServlet</span><span style="color: #339933;">;</span><br />
<span style="color: #000000; font-weight: bold;">import</span> <span style="color: #006699;">org.json.JSONException</span><span style="color: #339933;">;</span><br />
<span style="color: #000000; font-weight: bold;">import</span> <span style="color: #006699;">org.json.JSONObject</span><span style="color: #339933;">;</span><br />
<span style="color: #000000; font-weight: bold;">import</span> <span style="color: #006699;">org.osgi.service.component.annotations.Component</span><span style="color: #339933;">;</span><br />
<span style="color: #000000; font-weight: bold;">import</span> <span style="color: #006699;">org.osgi.service.component.annotations.Reference</span><span style="color: #339933;">;</span><br />
<span style="color: #000000; font-weight: bold;">import</span> <span style="color: #006699;">org.slf4j.Logger</span><span style="color: #339933;">;</span><br />
<span style="color: #000000; font-weight: bold;">import</span> <span style="color: #006699;">org.slf4j.LoggerFactory</span><span style="color: #339933;">;</span><br />
<br />
<span style="color: #000000; font-weight: bold;">import</span> <span style="color: #006699;">javax.servlet.Servlet</span><span style="color: #339933;">;</span><br />
<span style="color: #000000; font-weight: bold;">import</span> <span style="color: #006699;">java.io.IOException</span><span style="color: #339933;">;</span><br />
<br />
<span style="color: #000000; font-weight: bold;">import</span> <span style="color: #006699;">static</span> org.<span style="color: #006633;">apache</span>.<span style="color: #006633;">sling</span>.<span style="color: #006633;">api</span>.<span style="color: #006633;">servlets</span>.<span style="color: #006633;">ServletResolverConstants</span>.<span style="color: #006633;">SLING_SERVLET_PATHS</span><span style="color: #339933;">;</span><br />
<br />
@<span style="color: #003399;">Component</span><span style="color: #009900;">&#40;</span><br />
&nbsp; service <span style="color: #339933;">=</span> <span style="color: #009900;">&#123;</span> Servlet.<span style="color: #000000; font-weight: bold;">class</span> <span style="color: #009900;">&#125;</span>,<br />
&nbsp; property <span style="color: #339933;">=</span> <span style="color: #009900;">&#123;</span><br />
&nbsp; &nbsp; SLING_SERVLET_PATHS <span style="color: #339933;">+</span> <span style="color: #0000ff;">&quot;=/bin/sendemail&quot;</span><br />
&nbsp; <span style="color: #009900;">&#125;</span><br />
<span style="color: #009900;">&#41;</span><br />
<span style="color: #000000; font-weight: bold;">public</span> <span style="color: #000000; font-weight: bold;">class</span> SendEmailServletExample <span style="color: #000000; font-weight: bold;">extends</span> SlingAllMethodsServlet <span style="color: #009900;">&#123;</span><br />
<br />
&nbsp; <span style="color: #000000; font-weight: bold;">private</span> <span style="color: #000000; font-weight: bold;">static</span> Logger log <span style="color: #339933;">=</span> LoggerFactory.<span style="color: #006633;">getLogger</span><span style="color: #009900;">&#40;</span>SendEmailServletExample.<span style="color: #000000; font-weight: bold;">class</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br />
<br />
&nbsp; @<span style="color: #003399;">Reference</span><br />
&nbsp; <span style="color: #000000; font-weight: bold;">private</span> MessageGatewayService messageGatewayService<span style="color: #339933;">;</span><br />
<br />
&nbsp; @Override<br />
&nbsp; <span style="color: #000000; font-weight: bold;">protected</span> <span style="color: #000066; font-weight: bold;">void</span> doGet<span style="color: #009900;">&#40;</span>SlingHttpServletRequest request, SlingHttpServletResponse response<span style="color: #009900;">&#41;</span> <span style="color: #000000; font-weight: bold;">throws</span> <span style="color: #003399;">IOException</span> <span style="color: #009900;">&#123;</span><br />
&nbsp; &nbsp; JSONObject jsonResponse <span style="color: #339933;">=</span> <span style="color: #000000; font-weight: bold;">new</span> JSONObject<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br />
&nbsp; &nbsp; <span style="color: #000066; font-weight: bold;">boolean</span> sent <span style="color: #339933;">=</span> <span style="color: #000066; font-weight: bold;">false</span><span style="color: #339933;">;</span><br />
&nbsp; &nbsp; <span style="color: #000000; font-weight: bold;">try</span> <span style="color: #009900;">&#123;</span><br />
&nbsp; &nbsp; &nbsp; <span style="color: #003399;">String</span><span style="color: #009900;">&#91;</span><span style="color: #009900;">&#93;</span> recipients <span style="color: #339933;">=</span> <span style="color: #009900;">&#123;</span> <span style="color: #0000ff;">&quot;contact@sourcedcode.com&quot;</span> <span style="color: #009900;">&#125;</span><span style="color: #339933;">;</span><br />
&nbsp; &nbsp; &nbsp; sendEmail<span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;This is an test email&quot;</span>,<br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #0000ff;">&quot;This is the email body&quot;</span>, recipients<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br />
&nbsp; &nbsp; &nbsp; response.<span style="color: #006633;">setStatus</span><span style="color: #009900;">&#40;</span><span style="color: #cc66cc;">200</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br />
&nbsp; &nbsp; &nbsp; sent <span style="color: #339933;">=</span> <span style="color: #000066; font-weight: bold;">true</span><span style="color: #339933;">;</span><br />
&nbsp; &nbsp; <span style="color: #009900;">&#125;</span> <span style="color: #000000; font-weight: bold;">catch</span> <span style="color: #009900;">&#40;</span>EmailException e<span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span><br />
&nbsp; &nbsp; &nbsp; response.<span style="color: #006633;">setStatus</span><span style="color: #009900;">&#40;</span><span style="color: #cc66cc;">500</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br />
&nbsp; &nbsp; <span style="color: #009900;">&#125;</span><br />
&nbsp; &nbsp; <span style="color: #000000; font-weight: bold;">try</span> <span style="color: #009900;">&#123;</span><br />
&nbsp; &nbsp; &nbsp; jsonResponse.<span style="color: #006633;">put</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;result&quot;</span>, sent <span style="color: #339933;">?</span> <span style="color: #0000ff;">&quot;done&quot;</span> <span style="color: #339933;">:</span> <span style="color: #0000ff;">&quot;something went wrong&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br />
&nbsp; &nbsp; <span style="color: #009900;">&#125;</span> <span style="color: #000000; font-weight: bold;">catch</span> <span style="color: #009900;">&#40;</span>JSONException e<span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span><br />
&nbsp; &nbsp; &nbsp; e.<span style="color: #006633;">printStackTrace</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br />
&nbsp; &nbsp; <span style="color: #009900;">&#125;</span><br />
&nbsp; &nbsp; response.<span style="color: #006633;">getWriter</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span>.<span style="color: #006633;">write</span><span style="color: #009900;">&#40;</span>jsonResponse.<span style="color: #006633;">toString</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br />
&nbsp; <span style="color: #009900;">&#125;</span><br />
<br />
&nbsp; <span style="color: #000000; font-weight: bold;">private</span> <span style="color: #000066; font-weight: bold;">void</span> sendEmail<span style="color: #009900;">&#40;</span><span style="color: #003399;">String</span> subjectLine, <span style="color: #003399;">String</span> msgBody, <span style="color: #003399;">String</span><span style="color: #009900;">&#91;</span><span style="color: #009900;">&#93;</span> recipients<span style="color: #009900;">&#41;</span> <span style="color: #000000; font-weight: bold;">throws</span> EmailException <span style="color: #009900;">&#123;</span><br />
&nbsp; &nbsp; Email email <span style="color: #339933;">=</span> <span style="color: #000000; font-weight: bold;">new</span> HtmlEmail<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br />
&nbsp; &nbsp; <span style="color: #000000; font-weight: bold;">for</span> <span style="color: #009900;">&#40;</span><span style="color: #003399;">String</span> recipient <span style="color: #339933;">:</span> recipients<span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span><br />
&nbsp; &nbsp; &nbsp; email.<span style="color: #006633;">addTo</span><span style="color: #009900;">&#40;</span>recipient, recipient<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br />
&nbsp; &nbsp; <span style="color: #009900;">&#125;</span><br />
&nbsp; &nbsp; email.<span style="color: #006633;">setSubject</span><span style="color: #009900;">&#40;</span>subjectLine<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br />
&nbsp; &nbsp; email.<span style="color: #006633;">setMsg</span><span style="color: #009900;">&#40;</span>msgBody<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br />
&nbsp; &nbsp; MessageGateway<span style="color: #339933;">&lt;</span>Email<span style="color: #339933;">&gt;</span> messageGateway <span style="color: #339933;">=</span> messageGatewayService.<span style="color: #006633;">getGateway</span><span style="color: #009900;">&#40;</span>HtmlEmail.<span style="color: #000000; font-weight: bold;">class</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br />
&nbsp; &nbsp; <span style="color: #000000; font-weight: bold;">if</span> <span style="color: #009900;">&#40;</span>messageGateway <span style="color: #339933;">!=</span> <span style="color: #000066; font-weight: bold;">null</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span><br />
&nbsp; &nbsp; &nbsp; log.<span style="color: #006633;">debug</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;sending out email&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br />
&nbsp; &nbsp; &nbsp; messageGateway.<span style="color: #006633;">send</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#40;</span>Email<span style="color: #009900;">&#41;</span> email<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br />
&nbsp; &nbsp; <span style="color: #009900;">&#125;</span> <span style="color: #000000; font-weight: bold;">else</span> <span style="color: #009900;">&#123;</span><br />
&nbsp; &nbsp; &nbsp; log.<span style="color: #006633;">error</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;The message gateway could not be retrieved.&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br />
&nbsp; &nbsp; <span style="color: #009900;">&#125;</span><br />
&nbsp; <span style="color: #009900;">&#125;</span><br />
<span style="color: #009900;">&#125;</span></div></td></tr></tbody></table></div>
</div>
<p>The post <a rel="nofollow" href="https://sourcedcode.com/blog/aem/send-out-emails-with-aem-servlet">Send Out Emails with AEM Servlet</a> appeared first on <a rel="nofollow" href="https://sourcedcode.com">Sourced Code</a>.</p>
]]></content:encoded>
					
					<wfw:commentRss>https://sourcedcode.com/blog/aem/send-out-emails-with-aem-servlet/feed</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
			</item>
		<item>
		<title>Get Cookie Example of AEM Servlet and Sling Model</title>
		<link>https://sourcedcode.com/blog/aem/get-cookie-example-of-aem-servlet-and-sling-model</link>
					<comments>https://sourcedcode.com/blog/aem/get-cookie-example-of-aem-servlet-and-sling-model#comments</comments>
		
		<dc:creator><![CDATA[briankasingli]]></dc:creator>
		<pubDate>Wed, 19 Jan 2022 04:58:31 +0000</pubDate>
				<category><![CDATA[AEM]]></category>
		<category><![CDATA[Deployment]]></category>
		<category><![CDATA[OSGI]]></category>
		<category><![CDATA[Short Post]]></category>
		<category><![CDATA[Sling Models]]></category>
		<guid isPermaLink="false">https://sourcedcode.com/?p=3277</guid>

					<description><![CDATA[<p>In this short article, we will show two code examples; for example, one will be showcasing how cookies values can be accessed for an AEM Servlet, and for example two, Sling Model. 1. AEM Servlet Get Cookie Example 1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465package com.sourcedcode.core.servlet; import com.cat.wcm.core.util.JSONObject; import org.apache.commons.lang.StringUtils; import org.apache.sling.api.SlingHttpServletRequest; import org.apache.sling.api.SlingHttpServletResponse; import org.apache.sling.api.servlets.SlingAllMethodsServlet; import org.osgi.service.component.annotations.Component; import javax.servlet.Servlet; import [&#8230;]</p>
<p>The post <a rel="nofollow" href="https://sourcedcode.com/blog/aem/get-cookie-example-of-aem-servlet-and-sling-model">Get Cookie Example of AEM Servlet and Sling Model</a> appeared first on <a rel="nofollow" href="https://sourcedcode.com">Sourced Code</a>.</p>
]]></description>
										<content:encoded><![CDATA[<p>In this short article, we will show two code examples; for example, one will be showcasing how cookies values can be accessed for an AEM Servlet, and for example two, Sling Model.</p>
<hr class="spacer-large" />
<h2>1. AEM Servlet Get Cookie Example</h2>
<div class="code-1000">
<div class="codecolorer-container java default" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;height:400px;"><table cellspacing="0" cellpadding="0"><tbody><tr><td style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap;text-align:center;color:#888888;background-color:#EEEEEE;border-right: 1px solid #9F9F9F;"><div>1<br />2<br />3<br />4<br />5<br />6<br />7<br />8<br />9<br />10<br />11<br />12<br />13<br />14<br />15<br />16<br />17<br />18<br />19<br />20<br />21<br />22<br />23<br />24<br />25<br />26<br />27<br />28<br />29<br />30<br />31<br />32<br />33<br />34<br />35<br />36<br />37<br />38<br />39<br />40<br />41<br />42<br />43<br />44<br />45<br />46<br />47<br />48<br />49<br />50<br />51<br />52<br />53<br />54<br />55<br />56<br />57<br />58<br />59<br />60<br />61<br />62<br />63<br />64<br />65<br /></div></td><td><div class="java codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap;"><span style="color: #000000; font-weight: bold;">package</span> <span style="color: #006699;">com.sourcedcode.core.servlet</span><span style="color: #339933;">;</span><br />
<br />
<span style="color: #000000; font-weight: bold;">import</span> <span style="color: #006699;">com.cat.wcm.core.util.JSONObject</span><span style="color: #339933;">;</span><br />
<span style="color: #000000; font-weight: bold;">import</span> <span style="color: #006699;">org.apache.commons.lang.StringUtils</span><span style="color: #339933;">;</span><br />
<span style="color: #000000; font-weight: bold;">import</span> <span style="color: #006699;">org.apache.sling.api.SlingHttpServletRequest</span><span style="color: #339933;">;</span><br />
<span style="color: #000000; font-weight: bold;">import</span> <span style="color: #006699;">org.apache.sling.api.SlingHttpServletResponse</span><span style="color: #339933;">;</span><br />
<span style="color: #000000; font-weight: bold;">import</span> <span style="color: #006699;">org.apache.sling.api.servlets.SlingAllMethodsServlet</span><span style="color: #339933;">;</span><br />
<span style="color: #000000; font-weight: bold;">import</span> <span style="color: #006699;">org.osgi.service.component.annotations.Component</span><span style="color: #339933;">;</span><br />
<br />
<span style="color: #000000; font-weight: bold;">import</span> <span style="color: #006699;">javax.servlet.Servlet</span><span style="color: #339933;">;</span><br />
<span style="color: #000000; font-weight: bold;">import</span> <span style="color: #006699;">javax.servlet.http.Cookie</span><span style="color: #339933;">;</span><br />
<span style="color: #000000; font-weight: bold;">import</span> <span style="color: #006699;">javax.servlet.http.HttpServletRequest</span><span style="color: #339933;">;</span><br />
<span style="color: #000000; font-weight: bold;">import</span> <span style="color: #006699;">java.io.IOException</span><span style="color: #339933;">;</span><br />
<br />
<span style="color: #000000; font-weight: bold;">import</span> <span style="color: #006699;">static</span> org.<span style="color: #006633;">apache</span>.<span style="color: #006633;">sling</span>.<span style="color: #006633;">api</span>.<span style="color: #006633;">servlets</span>.<span style="color: #006633;">ServletResolverConstants</span>.<span style="color: #006633;">SLING_SERVLET_PATHS</span><span style="color: #339933;">;</span><br />
<br />
@<span style="color: #003399;">Component</span><span style="color: #009900;">&#40;</span><br />
&nbsp; service <span style="color: #339933;">=</span> <span style="color: #009900;">&#123;</span> Servlet.<span style="color: #000000; font-weight: bold;">class</span> <span style="color: #009900;">&#125;</span>,<br />
&nbsp; property <span style="color: #339933;">=</span> <span style="color: #009900;">&#123;</span><br />
&nbsp; &nbsp; SLING_SERVLET_PATHS <span style="color: #339933;">+</span> <span style="color: #0000ff;">&quot;=/bin/getCookieExample&quot;</span><br />
&nbsp; <span style="color: #009900;">&#125;</span><br />
<span style="color: #009900;">&#41;</span><br />
<span style="color: #000000; font-weight: bold;">public</span> <span style="color: #000000; font-weight: bold;">class</span> GetCookieServletExample <span style="color: #000000; font-weight: bold;">extends</span> SlingAllMethodsServlet <span style="color: #009900;">&#123;</span><br />
<br />
&nbsp; @Override<br />
&nbsp; <span style="color: #000000; font-weight: bold;">protected</span> <span style="color: #000066; font-weight: bold;">void</span> doGet<span style="color: #009900;">&#40;</span>SlingHttpServletRequest request, SlingHttpServletResponse response<span style="color: #009900;">&#41;</span> <span style="color: #000000; font-weight: bold;">throws</span> <span style="color: #003399;">IOException</span> <span style="color: #009900;">&#123;</span><br />
&nbsp; &nbsp; Cookie myCookie <span style="color: #339933;">=</span> getCookie<span style="color: #009900;">&#40;</span>request, <span style="color: #0000ff;">&quot;myCookie&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br />
&nbsp; &nbsp; <span style="color: #003399;">String</span> myCookieValue <span style="color: #339933;">=</span> <span style="color: #0000ff;">&quot;&quot;</span><span style="color: #339933;">;</span><br />
&nbsp; &nbsp; <span style="color: #000000; font-weight: bold;">if</span> <span style="color: #009900;">&#40;</span>myCookie <span style="color: #339933;">!=</span> <span style="color: #000066; font-weight: bold;">null</span> <span style="color: #339933;">&amp;&amp;</span> <span style="color: #339933;">!</span>myCookie.<span style="color: #006633;">getValue</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span>.<span style="color: #006633;">isBlank</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span><br />
&nbsp; &nbsp; &nbsp; myCookieValue <span style="color: #339933;">=</span> myCookie.<span style="color: #006633;">getValue</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br />
&nbsp; &nbsp; <span style="color: #009900;">&#125;</span><br />
<br />
&nbsp; &nbsp; <span style="color: #666666; font-style: italic;">// server response</span><br />
&nbsp; &nbsp; response.<span style="color: #006633;">setStatus</span><span style="color: #009900;">&#40;</span><span style="color: #cc66cc;">200</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br />
&nbsp; &nbsp; response.<span style="color: #006633;">setContentType</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;application/json&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br />
<br />
&nbsp; &nbsp; JSONObject jsonResponse <span style="color: #339933;">=</span> <span style="color: #000000; font-weight: bold;">new</span> JSONObject<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br />
&nbsp; &nbsp; jsonResponse.<span style="color: #006633;">put</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;myCookie&quot;</span>, myCookieValue<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br />
&nbsp; &nbsp; response.<span style="color: #006633;">getWriter</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span>.<span style="color: #006633;">write</span><span style="color: #009900;">&#40;</span>jsonResponse.<span style="color: #006633;">toString</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br />
&nbsp; <span style="color: #009900;">&#125;</span><br />
&nbsp; &nbsp; &nbsp;<br />
&nbsp; <span style="color: #666666; font-style: italic;">// extracted helper method</span><br />
&nbsp; <span style="color: #000000; font-weight: bold;">private</span> Cookie getCookie<span style="color: #009900;">&#40;</span>HttpServletRequest request, <span style="color: #003399;">String</span> cookieName<span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span><br />
&nbsp; &nbsp; <span style="color: #000000; font-weight: bold;">if</span> <span style="color: #009900;">&#40;</span>StringUtils.<span style="color: #006633;">isBlank</span><span style="color: #009900;">&#40;</span>cookieName<span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span><br />
&nbsp; &nbsp; &nbsp; <span style="color: #000000; font-weight: bold;">return</span> <span style="color: #000066; font-weight: bold;">null</span><span style="color: #339933;">;</span><br />
&nbsp; &nbsp; <span style="color: #009900;">&#125;</span> <span style="color: #000000; font-weight: bold;">else</span> <span style="color: #009900;">&#123;</span><br />
&nbsp; &nbsp; &nbsp; Cookie<span style="color: #009900;">&#91;</span><span style="color: #009900;">&#93;</span> cookies <span style="color: #339933;">=</span> request.<span style="color: #006633;">getCookies</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br />
&nbsp; &nbsp; &nbsp; <span style="color: #000000; font-weight: bold;">if</span> <span style="color: #009900;">&#40;</span>cookies <span style="color: #339933;">==</span> <span style="color: #000066; font-weight: bold;">null</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000000; font-weight: bold;">return</span> <span style="color: #000066; font-weight: bold;">null</span><span style="color: #339933;">;</span><br />
&nbsp; &nbsp; &nbsp; <span style="color: #009900;">&#125;</span> <span style="color: #000000; font-weight: bold;">else</span> <span style="color: #009900;">&#123;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000000; font-weight: bold;">if</span> <span style="color: #009900;">&#40;</span>cookies.<span style="color: #006633;">length</span> <span style="color: #339933;">&gt;</span> <span style="color: #cc66cc;">0</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; Cookie<span style="color: #009900;">&#91;</span><span style="color: #009900;">&#93;</span> var3 <span style="color: #339933;">=</span> cookies<span style="color: #339933;">;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000066; font-weight: bold;">int</span> var4 <span style="color: #339933;">=</span> cookies.<span style="color: #006633;">length</span><span style="color: #339933;">;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000000; font-weight: bold;">for</span><span style="color: #009900;">&#40;</span><span style="color: #000066; font-weight: bold;">int</span> var5 <span style="color: #339933;">=</span> <span style="color: #cc66cc;">0</span><span style="color: #339933;">;</span> var5 <span style="color: #339933;">&lt;</span> var4<span style="color: #339933;">;</span> <span style="color: #339933;">++</span>var5<span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; Cookie cookie <span style="color: #339933;">=</span> var3<span style="color: #009900;">&#91;</span>var5<span style="color: #009900;">&#93;</span><span style="color: #339933;">;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000000; font-weight: bold;">if</span> <span style="color: #009900;">&#40;</span>StringUtils.<span style="color: #006633;">equals</span><span style="color: #009900;">&#40;</span>cookieName, cookie.<span style="color: #006633;">getName</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000000; font-weight: bold;">return</span> cookie<span style="color: #339933;">;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #009900;">&#125;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #009900;">&#125;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #009900;">&#125;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000000; font-weight: bold;">return</span> <span style="color: #000066; font-weight: bold;">null</span><span style="color: #339933;">;</span><br />
&nbsp; &nbsp; &nbsp; <span style="color: #009900;">&#125;</span><br />
&nbsp; &nbsp; <span style="color: #009900;">&#125;</span><br />
&nbsp; <span style="color: #009900;">&#125;</span><br />
<span style="color: #009900;">&#125;</span></div></td></tr></tbody></table></div>
</div>
<hr class="spacer-large" />
<h2>2. Sling Model Get Cookie Example</h2>
<div class="code-750">
<div class="codecolorer-container java default" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;height:400px;"><table cellspacing="0" cellpadding="0"><tbody><tr><td style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap;text-align:center;color:#888888;background-color:#EEEEEE;border-right: 1px solid #9F9F9F;"><div>1<br />2<br />3<br />4<br />5<br />6<br />7<br />8<br />9<br />10<br />11<br />12<br />13<br />14<br />15<br />16<br />17<br />18<br />19<br />20<br />21<br />22<br />23<br />24<br />25<br />26<br />27<br />28<br />29<br />30<br />31<br />32<br />33<br />34<br />35<br />36<br />37<br />38<br />39<br />40<br />41<br />42<br />43<br />44<br />45<br />46<br />47<br />48<br />49<br />50<br />51<br />52<br />53<br />54<br /></div></td><td><div class="java codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap;"><span style="color: #000000; font-weight: bold;">package</span> <span style="color: #006699;">com.sourcedcode.models.pages.page</span><span style="color: #339933;">;</span><br />
<br />
<span style="color: #000000; font-weight: bold;">import</span> <span style="color: #006699;">org.apache.commons.lang.StringUtils</span><span style="color: #339933;">;</span><br />
<span style="color: #000000; font-weight: bold;">import</span> <span style="color: #006699;">org.apache.sling.api.SlingHttpServletRequest</span><span style="color: #339933;">;</span><br />
<span style="color: #000000; font-weight: bold;">import</span> <span style="color: #006699;">org.apache.sling.api.resource.Resource</span><span style="color: #339933;">;</span><br />
<span style="color: #000000; font-weight: bold;">import</span> <span style="color: #006699;">org.apache.sling.models.annotations.DefaultInjectionStrategy</span><span style="color: #339933;">;</span><br />
<span style="color: #000000; font-weight: bold;">import</span> <span style="color: #006699;">org.apache.sling.models.annotations.Model</span><span style="color: #339933;">;</span><br />
<span style="color: #000000; font-weight: bold;">import</span> <span style="color: #006699;">org.apache.sling.models.annotations.injectorspecific.SlingObject</span><span style="color: #339933;">;</span><br />
<br />
<span style="color: #000000; font-weight: bold;">import</span> <span style="color: #006699;">javax.annotation.PostConstruct</span><span style="color: #339933;">;</span><br />
<span style="color: #000000; font-weight: bold;">import</span> <span style="color: #006699;">javax.servlet.http.Cookie</span><span style="color: #339933;">;</span><br />
<span style="color: #000000; font-weight: bold;">import</span> <span style="color: #006699;">javax.servlet.http.HttpServletRequest</span><span style="color: #339933;">;</span><br />
<br />
@Model<span style="color: #009900;">&#40;</span><br />
&nbsp; adaptables <span style="color: #339933;">=</span> <span style="color: #009900;">&#123;</span>SlingHttpServletRequest.<span style="color: #000000; font-weight: bold;">class</span>, Resource.<span style="color: #000000; font-weight: bold;">class</span><span style="color: #009900;">&#125;</span>,<br />
&nbsp; defaultInjectionStrategy <span style="color: #339933;">=</span> DefaultInjectionStrategy.<span style="color: #006633;">OPTIONAL</span><span style="color: #009900;">&#41;</span><br />
<span style="color: #000000; font-weight: bold;">public</span> <span style="color: #000000; font-weight: bold;">class</span> ExampleModel <span style="color: #009900;">&#123;</span><br />
<br />
&nbsp; @SlingObject<br />
&nbsp; <span style="color: #000000; font-weight: bold;">protected</span> SlingHttpServletRequest request<span style="color: #339933;">;</span><br />
<br />
&nbsp; @PostConstruct<br />
&nbsp; <span style="color: #000000; font-weight: bold;">private</span> <span style="color: #000066; font-weight: bold;">void</span> init<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span><br />
&nbsp; &nbsp; Cookie myCookie <span style="color: #339933;">=</span> getCookie<span style="color: #009900;">&#40;</span>request, <span style="color: #0000ff;">&quot;myCookie&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br />
&nbsp; &nbsp; <span style="color: #003399;">String</span> myCookieValue <span style="color: #339933;">=</span> <span style="color: #0000ff;">&quot;&quot;</span><span style="color: #339933;">;</span><br />
&nbsp; &nbsp; <span style="color: #000000; font-weight: bold;">if</span> <span style="color: #009900;">&#40;</span>myCookie <span style="color: #339933;">!=</span> <span style="color: #000066; font-weight: bold;">null</span> <span style="color: #339933;">&amp;&amp;</span> <span style="color: #339933;">!</span>myCookie.<span style="color: #006633;">getValue</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span>.<span style="color: #006633;">isBlank</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span><br />
&nbsp; &nbsp; &nbsp; myCookieValue <span style="color: #339933;">=</span> myCookie.<span style="color: #006633;">getValue</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br />
&nbsp; &nbsp; <span style="color: #009900;">&#125;</span><br />
&nbsp; <span style="color: #009900;">&#125;</span><br />
<br />
&nbsp; <span style="color: #666666; font-style: italic;">// extracted helper method</span><br />
&nbsp; <span style="color: #000000; font-weight: bold;">private</span> Cookie getCookie<span style="color: #009900;">&#40;</span>HttpServletRequest request, <span style="color: #003399;">String</span> cookieName<span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span><br />
&nbsp; &nbsp; <span style="color: #000000; font-weight: bold;">if</span> <span style="color: #009900;">&#40;</span>StringUtils.<span style="color: #006633;">isBlank</span><span style="color: #009900;">&#40;</span>cookieName<span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span><br />
&nbsp; &nbsp; &nbsp; <span style="color: #000000; font-weight: bold;">return</span> <span style="color: #000066; font-weight: bold;">null</span><span style="color: #339933;">;</span><br />
&nbsp; &nbsp; <span style="color: #009900;">&#125;</span> <span style="color: #000000; font-weight: bold;">else</span> <span style="color: #009900;">&#123;</span><br />
&nbsp; &nbsp; &nbsp; Cookie<span style="color: #009900;">&#91;</span><span style="color: #009900;">&#93;</span> cookies <span style="color: #339933;">=</span> request.<span style="color: #006633;">getCookies</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br />
&nbsp; &nbsp; &nbsp; <span style="color: #000000; font-weight: bold;">if</span> <span style="color: #009900;">&#40;</span>cookies <span style="color: #339933;">==</span> <span style="color: #000066; font-weight: bold;">null</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000000; font-weight: bold;">return</span> <span style="color: #000066; font-weight: bold;">null</span><span style="color: #339933;">;</span><br />
&nbsp; &nbsp; &nbsp; <span style="color: #009900;">&#125;</span> <span style="color: #000000; font-weight: bold;">else</span> <span style="color: #009900;">&#123;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000000; font-weight: bold;">if</span> <span style="color: #009900;">&#40;</span>cookies.<span style="color: #006633;">length</span> <span style="color: #339933;">&gt;</span> <span style="color: #cc66cc;">0</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; Cookie<span style="color: #009900;">&#91;</span><span style="color: #009900;">&#93;</span> var3 <span style="color: #339933;">=</span> cookies<span style="color: #339933;">;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000066; font-weight: bold;">int</span> var4 <span style="color: #339933;">=</span> cookies.<span style="color: #006633;">length</span><span style="color: #339933;">;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000000; font-weight: bold;">for</span><span style="color: #009900;">&#40;</span><span style="color: #000066; font-weight: bold;">int</span> var5 <span style="color: #339933;">=</span> <span style="color: #cc66cc;">0</span><span style="color: #339933;">;</span> var5 <span style="color: #339933;">&lt;</span> var4<span style="color: #339933;">;</span> <span style="color: #339933;">++</span>var5<span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; Cookie cookie <span style="color: #339933;">=</span> var3<span style="color: #009900;">&#91;</span>var5<span style="color: #009900;">&#93;</span><span style="color: #339933;">;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000000; font-weight: bold;">if</span> <span style="color: #009900;">&#40;</span>StringUtils.<span style="color: #006633;">equals</span><span style="color: #009900;">&#40;</span>cookieName, cookie.<span style="color: #006633;">getName</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000000; font-weight: bold;">return</span> cookie<span style="color: #339933;">;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #009900;">&#125;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #009900;">&#125;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #009900;">&#125;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000000; font-weight: bold;">return</span> <span style="color: #000066; font-weight: bold;">null</span><span style="color: #339933;">;</span><br />
&nbsp; &nbsp; &nbsp; <span style="color: #009900;">&#125;</span><br />
&nbsp; &nbsp; <span style="color: #009900;">&#125;</span><br />
&nbsp; <span style="color: #009900;">&#125;</span><br />
<span style="color: #009900;">&#125;</span></div></td></tr></tbody></table></div>
</div>
<p>The post <a rel="nofollow" href="https://sourcedcode.com/blog/aem/get-cookie-example-of-aem-servlet-and-sling-model">Get Cookie Example of AEM Servlet and Sling Model</a> appeared first on <a rel="nofollow" href="https://sourcedcode.com">Sourced Code</a>.</p>
]]></content:encoded>
					
					<wfw:commentRss>https://sourcedcode.com/blog/aem/get-cookie-example-of-aem-servlet-and-sling-model/feed</wfw:commentRss>
			<slash:comments>4</slash:comments>
		
		
			</item>
		<item>
		<title>5 Popular Ways to Replicate a Page in AEM</title>
		<link>https://sourcedcode.com/blog/aem/5-popular-ways-to-replicate-a-page-in-aem</link>
					<comments>https://sourcedcode.com/blog/aem/5-popular-ways-to-replicate-a-page-in-aem#comments</comments>
		
		<dc:creator><![CDATA[briankasingli]]></dc:creator>
		<pubDate>Sun, 21 Jun 2020 16:17:11 +0000</pubDate>
				<category><![CDATA[AEM]]></category>
		<category><![CDATA[Content]]></category>
		<category><![CDATA[Deployment]]></category>
		<guid isPermaLink="false">https://sourcedcode.com/?p=1948</guid>

					<description><![CDATA[<p>In AEM 6+ there are many ways to accomplish the goal to &#8220;replicate&#8221; a page. This article will display 5 Popular Ways to Replicate a Page in AEM. At the end of this article, you should be able to &#8220;replicate&#8221; a page using different methods within AEM. Quick Links: Touch UI &#8211; Site Console &#8211; [&#8230;]</p>
<p>The post <a rel="nofollow" href="https://sourcedcode.com/blog/aem/5-popular-ways-to-replicate-a-page-in-aem">5 Popular Ways to Replicate a Page in AEM</a> appeared first on <a rel="nofollow" href="https://sourcedcode.com">Sourced Code</a>.</p>
]]></description>
										<content:encoded><![CDATA[<p>In AEM 6+ there are many ways to accomplish the goal to &#8220;replicate&#8221; a page. This article will display 5 Popular Ways to Replicate a Page in AEM. At the end of this article, you should be able to &#8220;replicate&#8221; a page using different methods within AEM.</p>
<div class="mention-block">
<strong>Quick Links:</strong></p>
<ol>
<li><a href="#touch-ui-site-console-quick-publish">Touch UI &#8211; Site Console &#8211; Quick Publish</a></li>
<li><a href="#touch-ui-site-console-manage-publication">Touch UI &#8211; Site Console &#8211; Manage Publication</a></li>
<li><a href="#touch-ui-editable-page-sidebar-drop-options">Touch UI &#8211; Editable Page &#8211; Sidebar Drop Options</a></li>
<li><a href="#touch-ui-activate-a-page-with-an-aem-workflow">Touch UI &#8211; AEM Workflow</a></li>
<li><a href="#crxde-replication-tab">CRX/DE &#8211; Replication Tab</a></li>
</ol>
</div>
<p>Typically a scaled AEM structure, security is the highest priority. Typically Content Author’s privileges are restricted, so AEM page publishing is restricted; therefore AEM Workflows are utilised. Click here to skip the the <a href="#touch-ui-activate-a-page-with-an-aem-workflow">Touch UI &#8211; AEM Workflow</a> topic.</p>
<hr class="spacer-large"/>
<h2 id="touch-ui-site-console-quick-publish">1. Touch UI &#8211; Site Console &#8211; Quick Publish</h2>
<p>If you have the right <span style="color: red;">privilege</span> to replicate a page, and all it&#8217;s referenced resources, you can simply publish a page with the &#8220;Quick Publish&#8221; button from the Site Console&#8217;s navigation.</p>
<h6>How to publish a page using the &#8220;Quick Publish&#8221; AEM feature:</h6>
<ol>
<li>Step 1: Navigate to the Touch UI &#8211; Sites Console <a href="http://localhost:4502/sites.html/content">http://localhost:4502/sites.html/content</a>.</li>
<li>Step 2: Select on the &#8220;Targeted Page&#8221; by clicking on the thumbnail tile.</li>
<li>Step 3: Click on &#8220;Quick Publish&#8221; to replicate the Page.</li>
<li>Done.</li>
</ol>
<p><a href="https://sourcedcode.com/wp-content/uploads/2020/06/replicate-touch-ui-quick-publish.png"><img fetchpriority="high" decoding="async" src="https://sourcedcode.com/wp-content/uploads/2020/06/replicate-touch-ui-quick-publish-300x176.png" alt="Touch UI - Site Console - Quick Publish Instructions" width="300" height="176" class="alignnone size-medium wp-image-1957" srcset="https://sourcedcode.com/wp-content/uploads/2020/06/replicate-touch-ui-quick-publish-300x176.png 300w, https://sourcedcode.com/wp-content/uploads/2020/06/replicate-touch-ui-quick-publish-1024x601.png 1024w, https://sourcedcode.com/wp-content/uploads/2020/06/replicate-touch-ui-quick-publish-768x451.png 768w, https://sourcedcode.com/wp-content/uploads/2020/06/replicate-touch-ui-quick-publish-600x352.png 600w, https://sourcedcode.com/wp-content/uploads/2020/06/replicate-touch-ui-quick-publish.png 1200w" sizes="(max-width: 300px) 100vw, 300px" /></a></p>
<hr class="spacer-large"/>
<h2 id="touch-ui-site-console-manage-publication">2. Touch UI &#8211; Site Console &#8211; Manage Publication</h2>
<p>If you have the right <span style="color: red;">privilege</span> to replicate a page, and all it&#8217;s referenced resources, you can simply replicate a page with the &#8220;<a href="#site-console-quick-publish">Quick Publish</a>&#8221; button from the Site Console&#8217;s navigation.</p>
<p>But if you wish to manage the &#8220;referenced resources&#8221;, you can use the &#8220;Manage Publication&#8221; replication AEM feature.</p>
<h6>How to publish a page using the Manage Publication AEM feature:</h6>
<ol>
<li>Step 1: Navigate to the Touch UI &#8211; Sites Console <a href="http://localhost:4502/sites.html/content">http://localhost:4502/sites.html/content</a>.</li>
<li>Step 2: Select on the &#8220;Targeted Page&#8221; by clicking on the thumbnail tile.</li>
<li>Step 3: Click on the &#8220;Manage Publication&#8221; (if your screen is too small, click on the drop down &#8230; icon to expose this link).</li>
<li>Step 4: Select on the &#8220;Publish&#8221; option.</li>
<li>Step 5: Click on &#8220;Next&#8221;.</li>
<li>Step 6: Review References: By default, all resources in AEM that are referenced by the targeted page will be replicated. References items should be reviewed before replicating the page.</li>
<li>Step 7: Review References &#8211; Select on the &#8220;Targeted Page&#8221; by clicking on the thumbnail tile.</li>
<li>Step 8: Review References &#8211; Click on &#8220;Published References&#8221; to reveal a dialogue of all the referenced resources.</li>
<li>Step 9: Review References &#8211; Manage &#8220;Targeted References&#8221;; radio button clicked mean to &#8220;include resource as a part of the page replication. Click on &#8220;Done&#8221; to save settings.</li>
<li>Step 10: Click on &#8220;Publish&#8221; to replicate the Page.</li>
<li>Done.</li>
</ol>
<table>
<tr>
<td align="center" width="33%" style="border: none;"><strong>Steps 2 &#038; 3</strong><a href="https://sourcedcode.com/wp-content/uploads/2020/06/replicate-touch-ui-manage-replication-part-1-controls.png"><img decoding="async" src="https://sourcedcode.com/wp-content/uploads/2020/06/replicate-touch-ui-manage-replication-part-1-controls-300x176.png" alt="Site Console - Manage Publication - Steps 2 &#038; 3" width="300" height="176" class="alignnone size-medium wp-image-1955" srcset="https://sourcedcode.com/wp-content/uploads/2020/06/replicate-touch-ui-manage-replication-part-1-controls-300x176.png 300w, https://sourcedcode.com/wp-content/uploads/2020/06/replicate-touch-ui-manage-replication-part-1-controls-1024x601.png 1024w, https://sourcedcode.com/wp-content/uploads/2020/06/replicate-touch-ui-manage-replication-part-1-controls-768x451.png 768w, https://sourcedcode.com/wp-content/uploads/2020/06/replicate-touch-ui-manage-replication-part-1-controls-600x352.png 600w, https://sourcedcode.com/wp-content/uploads/2020/06/replicate-touch-ui-manage-replication-part-1-controls.png 1200w" sizes="(max-width: 300px) 100vw, 300px" /></a></td>
<td align="center" width="33%" style="border: none;"><strong>Steps 4 &#038; 5</strong><a href="https://sourcedcode.com/wp-content/uploads/2020/06/replicate-touch-ui-manage-replication-part-2-options.png"><img decoding="async" src="https://sourcedcode.com/wp-content/uploads/2020/06/replicate-touch-ui-manage-replication-part-2-options-300x176.png" alt="Site Console - Manage Publication - Steps 4 &#038; 5" width="300" height="176" class="alignnone size-medium wp-image-1954" srcset="https://sourcedcode.com/wp-content/uploads/2020/06/replicate-touch-ui-manage-replication-part-2-options-300x176.png 300w, https://sourcedcode.com/wp-content/uploads/2020/06/replicate-touch-ui-manage-replication-part-2-options-1024x601.png 1024w, https://sourcedcode.com/wp-content/uploads/2020/06/replicate-touch-ui-manage-replication-part-2-options-768x451.png 768w, https://sourcedcode.com/wp-content/uploads/2020/06/replicate-touch-ui-manage-replication-part-2-options-600x352.png 600w, https://sourcedcode.com/wp-content/uploads/2020/06/replicate-touch-ui-manage-replication-part-2-options.png 1200w" sizes="(max-width: 300px) 100vw, 300px" /></a></td>
<td align="center" width="33%" style="border: none;"><strong>Steps 6&#8230;10</strong><a href="https://sourcedcode.com/wp-content/uploads/2020/06/replicate-touch-ui-manage-replication-part-3-references.png"><img loading="lazy" decoding="async" src="https://sourcedcode.com/wp-content/uploads/2020/06/replicate-touch-ui-manage-replication-part-3-references-300x176.png" alt="Site Console - Manage Publication - Steps 6...10" width="300" height="176" class="alignnone size-medium wp-image-1952" srcset="https://sourcedcode.com/wp-content/uploads/2020/06/replicate-touch-ui-manage-replication-part-3-references-300x176.png 300w, https://sourcedcode.com/wp-content/uploads/2020/06/replicate-touch-ui-manage-replication-part-3-references-1024x601.png 1024w, https://sourcedcode.com/wp-content/uploads/2020/06/replicate-touch-ui-manage-replication-part-3-references-768x451.png 768w, https://sourcedcode.com/wp-content/uploads/2020/06/replicate-touch-ui-manage-replication-part-3-references-600x352.png 600w, https://sourcedcode.com/wp-content/uploads/2020/06/replicate-touch-ui-manage-replication-part-3-references.png 1200w" sizes="(max-width: 300px) 100vw, 300px" /></a></td>
</tr>
</table>
<hr class="spacer-large"/>
<h2 id="touch-ui-editable-page-sidebar-drop-options">3. Touch UI &#8211; Editable Page &#8211; Sidebar Drop Options</h2>
<p>If you have the right <span style="color: red;">privilege</span> to replicate a page, after a change within the AEM Page Editor, a replication from the sidebar drop options can be utilised to replicate the page. </p>
<h6>How to publish a page using from the &#8220;Editable Page&#8221; AEM feature:</h6>
<ol>
<li>Step 1: Navigate to the Touch UI &#8211; Sites Console <a href="http://localhost:4502/editor.html/content/we-retail/us/en/about-us.html">http://localhost:4502/editor.html/content/we-retail/us/en/about-us.html</a>.</li>
<li>Step 2: Click on &#8220;Publish Page&#8221; to replicate the Page.</li>
</ol>
<p><a href="https://sourcedcode.com/wp-content/uploads/2020/06/replicate-touch-ui-editing-page.png"><img loading="lazy" decoding="async" src="https://sourcedcode.com/wp-content/uploads/2020/06/replicate-touch-ui-editing-page-300x176.png" alt="Touch UI - Editable Page - Sidebar Drop Options" width="300" height="176" class="alignnone size-medium wp-image-1953" srcset="https://sourcedcode.com/wp-content/uploads/2020/06/replicate-touch-ui-editing-page-300x176.png 300w, https://sourcedcode.com/wp-content/uploads/2020/06/replicate-touch-ui-editing-page-1024x601.png 1024w, https://sourcedcode.com/wp-content/uploads/2020/06/replicate-touch-ui-editing-page-768x451.png 768w, https://sourcedcode.com/wp-content/uploads/2020/06/replicate-touch-ui-editing-page-600x352.png 600w, https://sourcedcode.com/wp-content/uploads/2020/06/replicate-touch-ui-editing-page.png 1200w" sizes="(max-width: 300px) 100vw, 300px" /></a></p>
<hr class="spacer-large"/>
<h2 id="touch-ui-activate-a-page-with-an-aem-workflow">4. Touch UI &#8211; Activate a Page with an AEM Workflow</h2>
<p>Typically a scaled AEM structure, security is the highest priority. Typically Content Author&#8217;s <span style="color: red;">privileges</span> are restricted, so AEM page publishing are restricted; therefore AEM Workflows are utilised. </p>
<p>One of the most popular page publishing type AEM Workflows utilised in AEM is Content Approval AEM Workflows. Content Approval AEM Workflows are implemented based on the business requirements and context of the AEM customer, but as an example of this blog article, we will take the &#8220;Request to Publish&#8221;, out of the box AEM Workflow model as an example.</p>
<p>The &#8220;Request to Publish&#8221; is an example of an out of the box AEM Workflow model that can be used by Content Authors with less <span style="color: red;">privileges</span>. When the &#8220;Request to Publish&#8221; AEM Workflow has been started, a AEM Workflow task is sent to a supporting user-group, for them to approve the request. Once the request have been approved, the page will be replicated; typically a system user is replicating the page with the correct privileges.</p>
<h6>How to publish a page using from the &#8220;Activate a Page&#8221; AEM Workflow:</h6>
<ol>
<li>Step 1: Navigate to the Touch UI &#8211; Sites Console <a href="http://localhost:4502/sites.html/content">http://localhost:4502/sites.html/content</a>.</li>
<li>Step 2: Select on the &#8220;Targeted Page&#8221; by clicking on the thumbnail tile.</li>
<li>Step 3: Click on &#8220;Create&#8221; to reveal a drop down menu &#038; Click on &#8220;Workflow&#8221;.</li>
<li>Step 4: Select on the targeted &#8220;Workflow Model&#8221;.</li>
<li>Step 5: Input a &#8220;Workflow Title&#8221;.</li>
<li>Step 6: Click on &#8220;Next&#8221;.</li>
<li>Step 7: Click on &#8220;Create&#8221;.</li>
<li>Done. When the page is approved the page will be published.</li>
</ol>
<table>
<tr>
<td align="center" width="33%" style="border: none;"><strong>Steps 2 &#038; 3</strong><a href="https://sourcedcode.com/wp-content/uploads/2020/06/replicate-touch-ui-workflow-part-1-drop-down-option.png"><img loading="lazy" decoding="async" src="https://sourcedcode.com/wp-content/uploads/2020/06/replicate-touch-ui-workflow-part-1-drop-down-option-300x176.png" alt="Touch UI - Activate a Page with a Workflow - Steps 2 &#038; 3" width="300" height="176" class="alignnone size-medium wp-image-1951" srcset="https://sourcedcode.com/wp-content/uploads/2020/06/replicate-touch-ui-workflow-part-1-drop-down-option-300x176.png 300w, https://sourcedcode.com/wp-content/uploads/2020/06/replicate-touch-ui-workflow-part-1-drop-down-option-1024x601.png 1024w, https://sourcedcode.com/wp-content/uploads/2020/06/replicate-touch-ui-workflow-part-1-drop-down-option-768x451.png 768w, https://sourcedcode.com/wp-content/uploads/2020/06/replicate-touch-ui-workflow-part-1-drop-down-option-600x352.png 600w, https://sourcedcode.com/wp-content/uploads/2020/06/replicate-touch-ui-workflow-part-1-drop-down-option.png 1200w" sizes="(max-width: 300px) 100vw, 300px" /></a></td>
<td align="center" width="33%" style="border: none;"><strong>Steps 4&#8230;6</strong><a href="https://sourcedcode.com/wp-content/uploads/2020/06/replicate-touch-ui-workflow-part-2-select-workflow.png"><img loading="lazy" decoding="async" src="https://sourcedcode.com/wp-content/uploads/2020/06/replicate-touch-ui-workflow-part-2-select-workflow-300x176.png" alt="Touch UI - Activate a Page with a Workflow - Steps 4..6" width="300" height="176" class="alignnone size-medium wp-image-1950" srcset="https://sourcedcode.com/wp-content/uploads/2020/06/replicate-touch-ui-workflow-part-2-select-workflow-300x176.png 300w, https://sourcedcode.com/wp-content/uploads/2020/06/replicate-touch-ui-workflow-part-2-select-workflow-1024x601.png 1024w, https://sourcedcode.com/wp-content/uploads/2020/06/replicate-touch-ui-workflow-part-2-select-workflow-768x451.png 768w, https://sourcedcode.com/wp-content/uploads/2020/06/replicate-touch-ui-workflow-part-2-select-workflow-600x352.png 600w, https://sourcedcode.com/wp-content/uploads/2020/06/replicate-touch-ui-workflow-part-2-select-workflow.png 1200w" sizes="(max-width: 300px) 100vw, 300px" /></a></td>
<td align="center" width="33%" style="border: none;"><strong>Step 7</strong><a href="https://sourcedcode.com/wp-content/uploads/2020/06/replicate-touch-ui-workflow-part-3-drop-create-workflow.png"><img loading="lazy" decoding="async" src="https://sourcedcode.com/wp-content/uploads/2020/06/replicate-touch-ui-workflow-part-3-drop-create-workflow-300x176.png" alt="Touch UI - Activate a Page with a Workflow - Steps 7" width="300" height="176" class="alignnone size-medium wp-image-1949" srcset="https://sourcedcode.com/wp-content/uploads/2020/06/replicate-touch-ui-workflow-part-3-drop-create-workflow-300x176.png 300w, https://sourcedcode.com/wp-content/uploads/2020/06/replicate-touch-ui-workflow-part-3-drop-create-workflow-1024x601.png 1024w, https://sourcedcode.com/wp-content/uploads/2020/06/replicate-touch-ui-workflow-part-3-drop-create-workflow-768x451.png 768w, https://sourcedcode.com/wp-content/uploads/2020/06/replicate-touch-ui-workflow-part-3-drop-create-workflow-600x352.png 600w, https://sourcedcode.com/wp-content/uploads/2020/06/replicate-touch-ui-workflow-part-3-drop-create-workflow.png 1200w" sizes="(max-width: 300px) 100vw, 300px" /></a>
</td>
</tr>
</table>
<hr class="spacer-large"/>
<h2 id="crxde-replication-tab">5. CRX/DE &#8211; Replication Tab</h2>
<p>In some cases where an administrator needs to quickly publish a page, they are utilise the &#8220;Replication Tab&#8221; within the CRX/DE web console. This feature is only used by users who knows that they are doing.</p>
<h6>How to publish a page using &#8220;CRX/DE Replication Tab&#8221;:</h6>
<ol>
<li>Step 1: Navigate to the CRX/DE Console <a href="http://localhost:4502/crx/de/index.jsp
">http://localhost:4502/crx/de/index.jsp<br />
</a>.</li>
<li>Step 2: Select on the &#8220;Targeted Page&#8221;.</li>
<li>Step 3: Select on the &#8220;Replication&#8221; tab.</li>
<li>Step 4: Click on &#8220;Replicate&#8221; to replicate the Page.</li>
<li>Done.</li>
</ol>
<p><a href="https://sourcedcode.com/wp-content/uploads/2020/06/replicate-crx-de.png"><img loading="lazy" decoding="async" src="https://sourcedcode.com/wp-content/uploads/2020/06/replicate-crx-de-300x176.png" alt="" width="300" height="176" class="alignnone size-medium wp-image-1956" srcset="https://sourcedcode.com/wp-content/uploads/2020/06/replicate-crx-de-300x176.png 300w, https://sourcedcode.com/wp-content/uploads/2020/06/replicate-crx-de-1024x601.png 1024w, https://sourcedcode.com/wp-content/uploads/2020/06/replicate-crx-de-768x451.png 768w, https://sourcedcode.com/wp-content/uploads/2020/06/replicate-crx-de-600x352.png 600w, https://sourcedcode.com/wp-content/uploads/2020/06/replicate-crx-de.png 1200w" sizes="(max-width: 300px) 100vw, 300px" /></a></p>
<p>The post <a rel="nofollow" href="https://sourcedcode.com/blog/aem/5-popular-ways-to-replicate-a-page-in-aem">5 Popular Ways to Replicate a Page in AEM</a> appeared first on <a rel="nofollow" href="https://sourcedcode.com">Sourced Code</a>.</p>
]]></content:encoded>
					
					<wfw:commentRss>https://sourcedcode.com/blog/aem/5-popular-ways-to-replicate-a-page-in-aem/feed</wfw:commentRss>
			<slash:comments>15</slash:comments>
		
		
			</item>
		<item>
		<title>How many times is an AEM Component used in the JCR?</title>
		<link>https://sourcedcode.com/blog/aem/how-many-times-is-an-aem-component-used-in-the-jcr</link>
					<comments>https://sourcedcode.com/blog/aem/how-many-times-is-an-aem-component-used-in-the-jcr#comments</comments>
		
		<dc:creator><![CDATA[briankasingli]]></dc:creator>
		<pubDate>Thu, 11 Jun 2020 23:09:16 +0000</pubDate>
				<category><![CDATA[AEM]]></category>
		<category><![CDATA[Author]]></category>
		<category><![CDATA[Deployment]]></category>
		<category><![CDATA[Quick Reference]]></category>
		<guid isPermaLink="false">https://sourcedcode.com/?p=1870</guid>

					<description><![CDATA[<p>Can we detect and remove unused components from our codebase? Is this AEM component being used at all? How many times is my component used within my running AEM instance? These are the common questions we have when we are trying to figure out the number of use and the node-paths of the targeted searched [&#8230;]</p>
<p>The post <a rel="nofollow" href="https://sourcedcode.com/blog/aem/how-many-times-is-an-aem-component-used-in-the-jcr">How many times is an AEM Component used in the JCR?</a> appeared first on <a rel="nofollow" href="https://sourcedcode.com">Sourced Code</a>.</p>
]]></description>
										<content:encoded><![CDATA[<p>Can we detect and remove unused components from our codebase? Is this AEM component being used at all? How many times is my component used within my running AEM instance? </p>
<p>These are the common questions we have when we are trying to figure out the number of use and the node-paths of the targeted searched component within the Java content repository, known as &#8220;JCR&#8221;. In this article, you will discover one of the quickest techniques used to retrieve the total number of uses and node-paths of a component within the JCR by using the Query Builder API, <a href="#query-debugger-tool">query debugger tool</a>. </p>
<p>If you don&#8217;t have certain user priveledges within your AEM instance, there&#8217;s another way to find out the usage of your component(s), <a href="#components-console">Components Console</a>; however, the Components Console is restricted in a sense where the component search results-list only display pages of a given component and does not provide a total number of how many pages are returned from the search.</p>
<div class="mention-block">
<strong>Quick Links</strong></p>
<ol>
<li><a href="#query-debugger-tool">Component Search by the Query Builder API, Query Builder Debugger Tool</a></li>
<li><a href="#components-console">Component Search by the Components Console</a></li>
<li><a href="#search-by-cq-template"><strong>Extra</strong>: How many pages are using an AEM template?</a></li>
<li><a href="#search-for-all-nodes-with-the-existing-property"><strong>Extra</strong>: How to search for all nodes in AEM, JCR, with an existing property?</a></li>
</ol>
</div>
<hr class="spacer-large"/>
<h2 id="query-debugger-tool">1. Component Search by the Query Builder API, Query Builder Debugger Tool</h3>
<p>The AEM Query Builder is an API which can be used to search for nodes in JCR. Well defined &#8220;Predicates&#8221; are typically created from using the Query Builder Debugging Tool, as this tool serves instant search results within the UI.</p>
<p><strong>Step 1</strong>: With your running AEM instance, visit <a href="http://localhost:4502/libs/cq/search/content/querydebug.html" rel="noopener noreferrer" target="_blank">http://localhost:4502/libs/cq/search/content/querydebug.html</a>.</p>
<p><strong>Step <a class="foobox" href="https://sourcedcode.com/wp-content/uploads/2020/06/blog-post-image-query-builder-find-component.jpg">2</a></strong>: Paste in the search query below &#038; hit search; <a class="foobox" href="https://sourcedcode.com/wp-content/uploads/2020/06/blog-post-image-query-builder-find-component.jpg">view screenshot</a>.<br />
<em style="color: red; font-size:12px;">Replace with your component&#8217;s path: weretail/components/content/heroimage</em><br />
<em style="color: blue; font-size:12px;">Note!: sometimes the descendant path must be more nested, so /content/we-retail/gb/en</em></p>
<div class="codecolorer-container java default" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><table cellspacing="0" cellpadding="0"><tbody><tr><td style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap;text-align:center;color:#888888;background-color:#EEEEEE;border-right: 1px solid #9F9F9F;"><div>1<br />2<br />3<br /></div></td><td><div class="java codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap;">path<span style="color: #339933;">=/</span>content<span style="color: #339933;">/</span>we<span style="color: #339933;">-</span>retail<br />
<span style="color: #cc66cc;">1</span>_property<span style="color: #339933;">=</span>sling<span style="color: #339933;">:</span>resourceType<br />
<span style="color: #cc66cc;">1</span>_property.<span style="color: #006633;">value</span><span style="color: #339933;">=</span>weretail<span style="color: #339933;">/</span>components<span style="color: #339933;">/</span>content<span style="color: #339933;">/</span>heroimage</div></td></tr></tbody></table></div>
<p><i>This query searches for all types of nodes with the sling:resourceType equals to the value, weretail/components/content/heroimage, and where the path is descendant from /content/we-retail; to learn more about the Query builder API and queries, <a href="https://docs.adobe.com/content/help/en/experience-manager-64/developing/platform/query-builder/querybuilder-api.html" rel="noopener noreferrer" target="_blank">click here (Adobe Documentation)</a></i></p>
<p><strong>Step 3</strong>: Review the results.<br />
<a class="foobox" href="https://sourcedcode.com/wp-content/uploads/2020/06/blog-post-image-query-builder-find-component.jpg"><img loading="lazy" decoding="async" src="https://sourcedcode.com/wp-content/uploads/2020/06/blog-post-image-query-builder-find-component-300x128.jpg" alt="Query Builder Debugger" width="300" height="128" class="alignnone size-medium wp-image-1889" srcset="https://sourcedcode.com/wp-content/uploads/2020/06/blog-post-image-query-builder-find-component-300x128.jpg 300w, https://sourcedcode.com/wp-content/uploads/2020/06/blog-post-image-query-builder-find-component-1024x436.jpg 1024w, https://sourcedcode.com/wp-content/uploads/2020/06/blog-post-image-query-builder-find-component-768x327.jpg 768w, https://sourcedcode.com/wp-content/uploads/2020/06/blog-post-image-query-builder-find-component-600x255.jpg 600w, https://sourcedcode.com/wp-content/uploads/2020/06/blog-post-image-query-builder-find-component.jpg 1300w" sizes="(max-width: 300px) 100vw, 300px" /></a></p>
<div id="search-by-cq-template" class="mention-block">
<strong>Extra:</strong></p>
<h2 style="font-size: 16px;">Find out How many pages are using an AEM template?</h2>
<p>The query below will find all cq:Page nodes in the JCR, which cq:template equals to /conf/we-retail/settings/wcm/templates/hero-page; under the content path /content/we-retail. The search results will show you the absolute node page path of whom has the matched property and value set.</p>
<div class="codecolorer-container java default" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><table cellspacing="0" cellpadding="0"><tbody><tr><td style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap;text-align:center;color:#888888;background-color:#EEEEEE;border-right: 1px solid #9F9F9F;"><div>1<br />2<br />3<br />4<br /></div></td><td><div class="java codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap;">type<span style="color: #339933;">=</span>cq<span style="color: #339933;">:</span>Page<br />
path<span style="color: #339933;">=/</span>content<span style="color: #339933;">/</span>we<span style="color: #339933;">-</span>retail<br />
<span style="color: #cc66cc;">1</span>_property<span style="color: #339933;">=</span>jcr<span style="color: #339933;">:</span>content<span style="color: #339933;">/</span>cq<span style="color: #339933;">:</span>template<br />
<span style="color: #cc66cc;">1</span>_property.<span style="color: #006633;">value</span><span style="color: #339933;">=/</span>conf<span style="color: #339933;">/</span>we<span style="color: #339933;">-</span>retail<span style="color: #339933;">/</span>settings<span style="color: #339933;">/</span>wcm<span style="color: #339933;">/</span>templates<span style="color: #339933;">/</span>hero<span style="color: #339933;">-</span>page</div></td></tr></tbody></table></div>
<p>Ensuring that the &#8220;path&#8221; property is set is important, because you would not want to excessively triverse through the entire JCR; which will exhaust the AEM environment performance.
</p></div>
<div id="search-for-all-nodes-with-the-existing-property" class="mention-block">
<strong>Extra:</strong></p>
<h2 style="font-size: 16px;">How to search for all nodes in AEM, JCR, with an existing property?</h2>
<p>The query below will search all nodes in the JCR, which &#8220;myCustomProperty&#8221; exists; under the content path /content/we-retail. The search results will show you the absolute node page path of whom has the matched property and value set.</p>
<div class="codecolorer-container java default" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><table cellspacing="0" cellpadding="0"><tbody><tr><td style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap;text-align:center;color:#888888;background-color:#EEEEEE;border-right: 1px solid #9F9F9F;"><div>1<br />2<br />3<br /></div></td><td><div class="java codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap;">path<span style="color: #339933;">=/</span>content<span style="color: #339933;">/</span>we<span style="color: #339933;">-</span>retail<br />
property<span style="color: #339933;">=</span>myCustomProperty<br />
property.<span style="color: #006633;">operation</span><span style="color: #339933;">=</span>exists</div></td></tr></tbody></table></div>
<p>Ensuring that the &#8220;path&#8221; property is set is important, because you would not want to excessively triverse through the entire JCR; which will exhaust the AEM environment performance.
</p></div>
<hr class="spacer-large"/>
<h2 id="components-console">2. Component Search by the Components Console</h3>
<p>This out of the box Components Console, CC, is available from AEM 6.2+ right under Tools -> General -> Components. The CC displays search results in a form of pages where the component is being used; rather than each node from the example above. This console is accessible to authors so that even they can check for which pages use the searched component.</p>
<p><strong>Step 1</strong>: Within your running AEM instance, visit <a href="http://localhost:4502/libs/wcm/core/content/sites/components.html">http://localhost:4502/libs/wcm/core/content/sites/components.html</a>.</p>
<p><strong>Step <a class="foobox" href="https://sourcedcode.com/wp-content/uploads/2020/06/blog-post-component-console-steps-a.jpg"><a class="foobox" href="https://sourcedcode.com/wp-content/uploads/2020/06/blog-post-component-console-steps-a.jpg">2</a></strong>: Search for a component. Insert your search criteria with either by &#8220;keyword&#8221;, &#8220;component path&#8221;, or &#8220;component group&#8221;. On every change of the search criteria, you should see results in a list format on the right hand side of the search left side bar.<br />
<strong>Step <a class="foobox" href="https://sourcedcode.com/wp-content/uploads/2020/06/blog-post-component-console-steps-a.jpg">3</a></strong>: Click on the targeted component, and you will be redirected to the details page.<br />
<strong>Step <a class="foobox" href="https://sourcedcode.com/wp-content/uploads/2020/06/blog-post-component-console-steps-b.jpg">4</a></strong>: From the details page, click on &#8220;live usage&#8221;, and a results-list of pages will be displayed, where the targeted component can be found.<br />
<strong>Step <a class="foobox" href="https://sourcedcode.com/wp-content/uploads/2020/06/blog-post-component-console-steps-b.jpg">5</a></strong>: From the results-list, clicking on a link will open the page&#8217;s editor.</p>
<table>
<tr>
<td align="center" width="50%" style="border: none;">Components Console &#8211; Steps 2 &#038; 3<a class="foobox" href="https://sourcedcode.com/wp-content/uploads/2020/06/blog-post-component-console-steps-a.jpg"><img loading="lazy" decoding="async" src="https://sourcedcode.com/wp-content/uploads/2020/06/blog-post-component-console-steps-a-300x164.jpg" alt="Components Console - Steps 2 &#038; 3" width="300" height="164" class="alignnone size-medium wp-image-1913" srcset="https://sourcedcode.com/wp-content/uploads/2020/06/blog-post-component-console-steps-a-300x164.jpg 300w, https://sourcedcode.com/wp-content/uploads/2020/06/blog-post-component-console-steps-a-1024x559.jpg 1024w, https://sourcedcode.com/wp-content/uploads/2020/06/blog-post-component-console-steps-a-768x419.jpg 768w, https://sourcedcode.com/wp-content/uploads/2020/06/blog-post-component-console-steps-a-600x328.jpg 600w, https://sourcedcode.com/wp-content/uploads/2020/06/blog-post-component-console-steps-a.jpg 1200w" sizes="(max-width: 300px) 100vw, 300px" /></a></td>
<td align="center" width="50%" style="border: none;">Components Console &#8211; Steps 4 &#038; 5 <a class="foobox" href="https://sourcedcode.com/wp-content/uploads/2020/06/blog-post-component-console-steps-b.jpg"><img loading="lazy" decoding="async" src="https://sourcedcode.com/wp-content/uploads/2020/06/blog-post-component-console-steps-b-300x164.jpg" alt="Components Console - Steps 4 &#038; 5" width="300" height="164" class="alignnone size-medium wp-image-1914" srcset="https://sourcedcode.com/wp-content/uploads/2020/06/blog-post-component-console-steps-b-300x164.jpg 300w, https://sourcedcode.com/wp-content/uploads/2020/06/blog-post-component-console-steps-b-1024x559.jpg 1024w, https://sourcedcode.com/wp-content/uploads/2020/06/blog-post-component-console-steps-b-768x419.jpg 768w, https://sourcedcode.com/wp-content/uploads/2020/06/blog-post-component-console-steps-b-600x328.jpg 600w, https://sourcedcode.com/wp-content/uploads/2020/06/blog-post-component-console-steps-b.jpg 1200w" sizes="(max-width: 300px) 100vw, 300px" /></a></td>
</tr>
</table>
<p>The post <a rel="nofollow" href="https://sourcedcode.com/blog/aem/how-many-times-is-an-aem-component-used-in-the-jcr">How many times is an AEM Component used in the JCR?</a> appeared first on <a rel="nofollow" href="https://sourcedcode.com">Sourced Code</a>.</p>
]]></content:encoded>
					
					<wfw:commentRss>https://sourcedcode.com/blog/aem/how-many-times-is-an-aem-component-used-in-the-jcr/feed</wfw:commentRss>
			<slash:comments>1</slash:comments>
		
		
			</item>
		<item>
		<title>How to Check all Active Run Modes in a Running AEM Instance.</title>
		<link>https://sourcedcode.com/blog/aem/how-to-check-all-active-run-modes-in-a-running-aem-instance</link>
					<comments>https://sourcedcode.com/blog/aem/how-to-check-all-active-run-modes-in-a-running-aem-instance#respond</comments>
		
		<dc:creator><![CDATA[briankasingli]]></dc:creator>
		<pubDate>Fri, 01 Nov 2019 21:38:02 +0000</pubDate>
				<category><![CDATA[AEM]]></category>
		<category><![CDATA[Deployment]]></category>
		<category><![CDATA[Development]]></category>
		<guid isPermaLink="false">https://sourcedcode.com/?p=899</guid>

					<description><![CDATA[<p>﻿The fastest way to retrieve all active run modes that are enabled within a running AEM instance would be from the OSGI console, Apache Sling Settings. Follow the two simple steps below: Log in to AEM as an admin or a user who has access to the OSGI console using this URL: http://localhost:4502/crx/de/index.jsp Navigate to [&#8230;]</p>
<p>The post <a rel="nofollow" href="https://sourcedcode.com/blog/aem/how-to-check-all-active-run-modes-in-a-running-aem-instance">How to Check all Active Run Modes in a Running AEM Instance.</a> appeared first on <a rel="nofollow" href="https://sourcedcode.com">Sourced Code</a>.</p>
]]></description>
										<content:encoded><![CDATA[<p><span data-mce-type="bookmark" style="display: inline-block; width: 0px; overflow: hidden; line-height: 0;" class="mce_SELRES_start">﻿</span>The fastest way to retrieve all active run modes that are enabled within a running AEM instance would be from the OSGI console, Apache Sling Settings.</p>
<h4>Follow the two simple steps below:</h4>
<ol>
<li>Log in to AEM as an admin or a user who has access to the OSGI console using this URL: <a href=
"http://localhost:4502/crx/de/index.jsp" target="_blank" title="localhost crx/de login" rel="noopener noreferrer">http://localhost:4502/crx/de/index.jsp</a>
 </li>
<li>
Navigate to the Apache Sling Settings OSGI console page <a href="http://localhost:4502/system/console/status-slingsettings" target="_blank" rel="noopener noreferrer">http://localhost:4502/system/console/status-slingsettings</a></p>
<p><b>Expected screen from visiting <a href="http://localhost:4502/system/console/status-slingsettings" target="_blank" rel="noopener noreferrer">http://localhost:4502/system/console/status-slingsettings</a></b><br />
<a href="https://sourcedcode.com/wp-content/uploads/2019/11/status-sling-settings.png" target="_blank" rel="noopener noreferrer"><img decoding="async" width="60%" src="https://sourcedcode.com/wp-content/uploads/2019/11/status-sling-settings.png" alt="status sling settings osgi console screenshot"></a>
</li>
</ol>
<p>The active AEM run modes here are: &#8220;local-local&#8221;, &#8220;s7connect&#8221;, &#8220;crx3&#8221;, &#8220;author&#8221;, &#8220;samplecontent&#8221;, &#8220;local&#8221;, &#8220;crx3tar:</p>
<h4>Propertie Breakdown</h4>
<ul>
<li><b>Sling ID</b>: A unique identifier of the running Sling instance. This value is created when Sling is first started and may be used to identify the instance, for example if multiple Sling instances are running on top of a Jackrabbit Repository Cluster.</li>
<li><b>Sling Home</b>: The absolute filesystem path to the directory where Sling stores all its content.</li>
<li><b>Sling Home URL</b>: The Sling Home path as an java.net.URL instance.</li>
<li><b>Run Modes</b>: The active Run Modes of the running Sling instance.</li>
</ul>
<p>The post <a rel="nofollow" href="https://sourcedcode.com/blog/aem/how-to-check-all-active-run-modes-in-a-running-aem-instance">How to Check all Active Run Modes in a Running AEM Instance.</a> appeared first on <a rel="nofollow" href="https://sourcedcode.com">Sourced Code</a>.</p>
]]></content:encoded>
					
					<wfw:commentRss>https://sourcedcode.com/blog/aem/how-to-check-all-active-run-modes-in-a-running-aem-instance/feed</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
			</item>
		<item>
		<title>How to install multiple packages in CRX/DE on a clean instance?</title>
		<link>https://sourcedcode.com/blog/aem/how-to-install-multiple-packages-in-crx-de-on-a-clean-instance</link>
					<comments>https://sourcedcode.com/blog/aem/how-to-install-multiple-packages-in-crx-de-on-a-clean-instance#comments</comments>
		
		<dc:creator><![CDATA[briankasingli]]></dc:creator>
		<pubDate>Mon, 09 Apr 2018 23:28:07 +0000</pubDate>
				<category><![CDATA[AEM]]></category>
		<category><![CDATA[Deployment]]></category>
		<guid isPermaLink="false">http://sourcedcode.com/?p=264</guid>

					<description><![CDATA[<p>You are ready to ship your project packages and package-dependencies over to your customers. You have 7+ packages that need to be individually installed; installing 7 packages is manually is not the best approach, and it will take too long (imagine when there are 5 AEM instances that need to be configured). What is the [&#8230;]</p>
<p>The post <a rel="nofollow" href="https://sourcedcode.com/blog/aem/how-to-install-multiple-packages-in-crx-de-on-a-clean-instance">How to install multiple packages in CRX/DE on a clean instance?</a> appeared first on <a rel="nofollow" href="https://sourcedcode.com">Sourced Code</a>.</p>
]]></description>
										<content:encoded><![CDATA[<p>You are ready to ship your project packages and package-dependencies over to your customers. You have 7+ packages that need to be individually installed; installing 7 packages is manually is not the best approach, and it will take too long (imagine when there are 5 AEM instances that need to be configured). What is the fastest way to install multiple packages into CRX/DE? The answer is automation.</p>
<div class="mention-block">
<p><strong>Pre-requisites:</strong></p>
<ul>
<li>Standalone AEM instance, quickstart jar</li>
<li>Java SE installed on your machine</li>
<li>CQ5.5 and above</li>
</ul>
</div>
<h3>To install multiple packages in CRX/DE during a clean application startup automatically</h3>
<ol>
<li>Open terminal or command line, and change directory to your standalone AEM instance, quickstart jar file.</li>
<li>In terminal or command line:
<div class="codecolorer-container java default" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><table cellspacing="0" cellpadding="0"><tbody><tr><td style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap;text-align:center;color:#888888;background-color:#EEEEEE;border-right: 1px solid #9F9F9F;"><div>1<br /></div></td><td><div class="java codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap;">java <span style="color: #339933;">-</span>jar cq<span style="color: #339933;">-</span>author<span style="color: #339933;">-</span><span style="color: #cc66cc;">4502</span>.<span style="color: #006633;">jar</span> <span style="color: #339933;">-</span>unpack</div></td></tr></tbody></table></div>
<p>This line of code unpacks the installation files for the jar file, and will not run AEM. You should see a /crx-quickstart folder being generated.</p>
</li>
<li>Create the folder &#8220;install&#8221; under &#8220;/crx-quickstart/install&#8221;.</li>
<li>Include all the packages in the &#8220;install&#8221; folder; this will upload and install all the packages within the folder on a application startup;<strong>packages will install in alphabetical order.</strong></li>
<li>Start AEM.</li>
<li>Visit CRX/DE Lite, package manager to ensure all packages are installed(<a href="http://localhost:4502/crx/packmgr/index.jsp" target="_blank" rel="noopener">http://localhost:4502/crx/packmgr/index.jsp</a>).</li>
<li>Done.</li>
</ol>
<div class="mention-block">
<h3>Final Notes</h3>
<p>When working with <strong>AEM 6.3 forms package addon</strong>, I suggest to not include the forms packages in the automation. This will break your AEM instance. I tried it multiple times.
</div>
<p>The post <a rel="nofollow" href="https://sourcedcode.com/blog/aem/how-to-install-multiple-packages-in-crx-de-on-a-clean-instance">How to install multiple packages in CRX/DE on a clean instance?</a> appeared first on <a rel="nofollow" href="https://sourcedcode.com">Sourced Code</a>.</p>
]]></content:encoded>
					
					<wfw:commentRss>https://sourcedcode.com/blog/aem/how-to-install-multiple-packages-in-crx-de-on-a-clean-instance/feed</wfw:commentRss>
			<slash:comments>1</slash:comments>
		
		
			</item>
		<item>
		<title>How to revert deployed packages in CRX/DE package manager?</title>
		<link>https://sourcedcode.com/blog/aem/deployment/how-to-revert-deployed-packages-in-crx-de-package-manager</link>
					<comments>https://sourcedcode.com/blog/aem/deployment/how-to-revert-deployed-packages-in-crx-de-package-manager#comments</comments>
		
		<dc:creator><![CDATA[briankasingli]]></dc:creator>
		<pubDate>Wed, 04 Apr 2018 16:46:50 +0000</pubDate>
				<category><![CDATA[AEM]]></category>
		<category><![CDATA[Deployment]]></category>
		<category><![CDATA[Video Tutorial]]></category>
		<guid isPermaLink="false">http://sourcedcode.com/?p=247</guid>

					<description><![CDATA[<p>In this tutorial, you will learn how to revert a deployed package in CRX/DE package manager. The package is uploaded into CRX/DE and not yet replicated. Visit CRX/DE Lite (http://localhost:4502/crx/packmgr/index.jsp) Locate the project package. Click on &#8220;more&#8221; (the drop-down on the right). Click on &#8220;uninstall&#8221; (this will ensure your AEM instance is back to what [&#8230;]</p>
<p>The post <a rel="nofollow" href="https://sourcedcode.com/blog/aem/deployment/how-to-revert-deployed-packages-in-crx-de-package-manager">How to revert deployed packages in CRX/DE package manager?</a> appeared first on <a rel="nofollow" href="https://sourcedcode.com">Sourced Code</a>.</p>
]]></description>
										<content:encoded><![CDATA[<p>In this tutorial, you will learn how to revert a deployed package in CRX/DE package manager.</p>
<h3>The package is uploaded into CRX/DE and <strong style="color:red;">not yet replicated.</strong></h3>
<ol>
<li>Visit CRX/DE Lite (<a href="http://localhost:4502/crx/packmgr/index.jsp" target="_blank" rel="noopener">http://localhost:4502/crx/packmgr/index.jsp</a>)</li>
<li>Locate the project package.</li>
<li>Click on &#8220;more&#8221; (the drop-down on the right).</li>
<li>Click on &#8220;uninstall&#8221; (this will ensure your AEM instance is back to what it was before the installation. Imagine all the &#8220;filter paths&#8221; have taken a backup snapshot. When uninstalling your package, this will bring your backup snapshot of back to life, and delete any thing in the folder that is not in the snapshot.)</li>
<li>Delete the current version (unwanted version) of the project package.</li>
<li>Done.</li>
</ol>
<h3>The package is uploaded into CRX/DE and <strong style="color:blue;">has already been replicated.</strong></h3>
<ol>
<li>Visit CRX/DE Lite  (<a href="http://localhost:4502/crx/packmgr/index.jsp" target="_blank" rel="noopener">http://localhost:4502/crx/packmgr/index.jsp</a>)</li>
<li>Locate the project package.</li>
<li>Click on &#8220;more&#8221; (the drop-down on the right).</li>
<li>Click on &#8220;uninstall&#8221; (this will ensure your AEM instance is back to what it was before the installation. Imagine all the &#8220;filter paths&#8221; have taken a backup snapshot. When uninstalling your package, this will bring your backup snapshot of back to life, and delete any thing in the folder that is not in the snapshot.)</li>
<li>Delete the current version (unwanted version) of the project package.</li>
<li>Repeat steps 1-5 for all your AEM instances (Author and Publish AEM servers)</li>
</ol>
<div class="mention-block">
<h3>Final Notes</h3>
<p>I insist not to replicate the /content folder that holds your site pages. This will replicate(copy) all your web pages to your publish instance. Even if your site manager indicates whether your page is not active, your page will be copied over to the publish instance and will available to your consumers.</p>
</div>
<p>The post <a rel="nofollow" href="https://sourcedcode.com/blog/aem/deployment/how-to-revert-deployed-packages-in-crx-de-package-manager">How to revert deployed packages in CRX/DE package manager?</a> appeared first on <a rel="nofollow" href="https://sourcedcode.com">Sourced Code</a>.</p>
]]></content:encoded>
					
					<wfw:commentRss>https://sourcedcode.com/blog/aem/deployment/how-to-revert-deployed-packages-in-crx-de-package-manager/feed</wfw:commentRss>
			<slash:comments>3</slash:comments>
		
		
			</item>
		<item>
		<title>How to deploy new releases manually on Staging and Production AEM environments?</title>
		<link>https://sourcedcode.com/blog/aem/how-to-deploy-new-releases-on-staging-and-production-aem-instance</link>
					<comments>https://sourcedcode.com/blog/aem/how-to-deploy-new-releases-on-staging-and-production-aem-instance#comments</comments>
		
		<dc:creator><![CDATA[briankasingli]]></dc:creator>
		<pubDate>Tue, 03 Apr 2018 19:30:11 +0000</pubDate>
				<category><![CDATA[AEM]]></category>
		<category><![CDATA[Deployment]]></category>
		<guid isPermaLink="false">http://sourcedcode.com/?p=185</guid>

					<description><![CDATA[<p>There are many ways for deploying new releases to AEM staging and Production environments. In this tutorial, I will share with you my process for deploying new releases manually. I personally found this the safer way to deploy new releases because you can easily roll back versions, and you let AEM&#8217;s out of the box [&#8230;]</p>
<p>The post <a rel="nofollow" href="https://sourcedcode.com/blog/aem/how-to-deploy-new-releases-on-staging-and-production-aem-instance">How to deploy new releases manually on Staging and Production AEM environments?</a> appeared first on <a rel="nofollow" href="https://sourcedcode.com">Sourced Code</a>.</p>
]]></description>
										<content:encoded><![CDATA[<p>There are many ways for deploying new releases to AEM staging and Production environments. In this tutorial, I will share with you my process for deploying new releases manually. I personally found this the safer way to deploy new releases because you can easily roll back versions, and you let AEM&#8217;s out of the box replicate agents transport new changes to your production publish environments.</p>
<div class="mention-block">This tutorial illustrates how you would manually deploy a new content package to AEM staging and AEM production environments, manually.</div>
<hr />
<h3>Scenarios</h3>
<ol>
<li><a href="#scenario1">Scenario 1: You are ready to make a release on Staging on AEM-onPrem</a></li>
<li><a href="#scenario2">Scenario 2: You are ready to make a new release on Productionon AEM-onPrem</a></li>
</ol>
<hr />
<h3 id="scenario1">Scenario 1: You are ready to make a new release on Staging</h3>
<p><img loading="lazy" decoding="async" class="aligncenter size-large wp-image-216" src="http://sourcedcode.com/wp-content/uploads/2018/04/staging-1024x418.png" alt="" width="1024" height="418" srcset="https://sourcedcode.com/wp-content/uploads/2018/04/staging-1024x418.png 1024w, https://sourcedcode.com/wp-content/uploads/2018/04/staging-300x122.png 300w, https://sourcedcode.com/wp-content/uploads/2018/04/staging-768x314.png 768w, https://sourcedcode.com/wp-content/uploads/2018/04/staging.png 1700w" sizes="(max-width: 1024px) 100vw, 1024px" /></p>
<ol>
<li>Change the project version in maven(remove SNAPSHOT, because SNAPSHOT packages are only for development).
<div class="codecolorer-container java default" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><table cellspacing="0" cellpadding="0"><tbody><tr><td style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap;text-align:center;color:#888888;background-color:#EEEEEE;border-right: 1px solid #9F9F9F;"><div>1<br />2<br />3<br />4<br /></div></td><td><div class="java codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap;"><span style="color: #666666; font-style: italic;">// documentation: http://www.mojohaus.org/versions-maven-plugin/examples/set.html</span><br />
<span style="color: #666666; font-style: italic;">// updates project version to 1.2.0 (remove &quot;SNAPSHOT&quot;, and don't commit version)</span><br />
mvn versions<span style="color: #339933;">:</span>set <span style="color: #339933;">-</span>DnewVersion<span style="color: #339933;">=</span>1.2.0<br />
mvn versions<span style="color: #339933;">:</span>commit</div></td></tr></tbody></table></div>
</li>
<li>Build your project to your local machine.
<div class="codecolorer-container java default" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><table cellspacing="0" cellpadding="0"><tbody><tr><td style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap;text-align:center;color:#888888;background-color:#EEEEEE;border-right: 1px solid #9F9F9F;"><div>1<br />2<br />3<br /></div></td><td><div class="java codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap;"><span style="color: #339933;">&lt;</span>code lang<span style="color: #339933;">=</span><span style="color: #0000ff;">&quot;java&quot;</span><span style="color: #339933;">&gt;</span><br />
<span style="color: #666666; font-style: italic;">// builds your maven project into target without installing packages on AEM</span><br />
mvn clean install <span style="color: #339933;">-</span>Padobe<span style="color: #339933;">-</span><span style="color: #000000; font-weight: bold;">public</span></div></td></tr></tbody></table></div>
<p></code>// output ui.apps in /ui.apps/target/{projectName}.ui.apps-x.x.x.zip<br />
// output ui.content in /ui.content/target/{projectName}.ui.content-x.x.x.zip</li>
<li>Upload the build (/ui.apps/target/{projectName}.ui.apps-x.x.x.zip) into &#8220;Staging Author&#8221;, package manager.</li>
<li>Upload the build (/ui.content/target/{projectName}.ui.content-x.x.x.zip) into &#8220;Staging Author&#8221;, package manager.</li>
<li>Replicate {projectName}.ui.apps-x.x.x.zip to Staging Publish. Replicating this package will ensure that all your publish instances will be up to date; all files are overwritten.</li>
<li>Do not replicate ui.content because unpublished pages will all be replicated to your publish instance. You can activate pages in the author instance at your desire.</li>
<li>Done.</li>
</ol>
<hr />
<h3 id="scenario2">Scenario 2: You are ready to make a new release on Production</h3>
<p><img loading="lazy" decoding="async" class="aligncenter size-large wp-image-215" src="http://sourcedcode.com/wp-content/uploads/2018/04/production-1024x404.png" alt="" width="1024" height="404" srcset="https://sourcedcode.com/wp-content/uploads/2018/04/production-1024x404.png 1024w, https://sourcedcode.com/wp-content/uploads/2018/04/production-300x118.png 300w, https://sourcedcode.com/wp-content/uploads/2018/04/production-768x303.png 768w, https://sourcedcode.com/wp-content/uploads/2018/04/production.png 1692w" sizes="(max-width: 1024px) 100vw, 1024px" /><br />
Your updates on the staging environment have been approved, and now we want to deploy a new release on to production; <strong class="red">the version of your packages should be the same version as your approved staging packages</strong>.</p>
<ol>
<li>Change the project version in maven(remove SNAPSHOT because SNAPSHOT packages are only for development).
<div class="codecolorer-container java default" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><table cellspacing="0" cellpadding="0"><tbody><tr><td style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap;text-align:center;color:#888888;background-color:#EEEEEE;border-right: 1px solid #9F9F9F;"><div>1<br />2<br />3<br />4<br /></div></td><td><div class="java codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap;"><span style="color: #666666; font-style: italic;">// documentation: http://www.mojohaus.org/versions-maven-plugin/examples/set.html</span><br />
<span style="color: #666666; font-style: italic;">// updates project version to 1.2.0 (remove &quot;SNAPSHOT&quot;, and don't commit version)</span><br />
mvn versions<span style="color: #339933;">:</span>set <span style="color: #339933;">-</span>DnewVersion<span style="color: #339933;">=</span>1.2.0<br />
mvn versions<span style="color: #339933;">:</span>commit</div></td></tr></tbody></table></div>
</li>
<li>Build your project to your local machine.
<div class="codecolorer-container java default" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><table cellspacing="0" cellpadding="0"><tbody><tr><td style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap;text-align:center;color:#888888;background-color:#EEEEEE;border-right: 1px solid #9F9F9F;"><div>1<br />2<br />3<br /></div></td><td><div class="java codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap;"><span style="color: #339933;">&lt;</span>code lang<span style="color: #339933;">=</span><span style="color: #0000ff;">&quot;java&quot;</span><span style="color: #339933;">&gt;</span><br />
<span style="color: #666666; font-style: italic;">// builds your maven project into target without installing packages on AEM</span><br />
mvn clean install <span style="color: #339933;">-</span>Padobe<span style="color: #339933;">-</span><span style="color: #000000; font-weight: bold;">public</span></div></td></tr></tbody></table></div>
<p></code>// output ui.apps in /ui.apps/target/{projectName}.ui.apps-x.x.x.zip<br />
// output ui.content in /ui.content/target/{projectName}.ui.content-x.x.x.zip</li>
<li>Upload the build (/ui.apps/target/{projectName}.ui.apps-x.x.x.zip) into &#8220;Production Author&#8221;, package manager.</li>
<li>Upload the build (/ui.content/target/{projectName}.ui.content-x.x.x.zip) into &#8220;Production Author&#8221;, package manager.</li>
<li>Replicate {projectName}.ui.apps-x.x.x.zip to Production Publish. Replicating this package will ensure that all your publish instances will be up to date; all files are overwritten.</li>
<li>Do not replicate ui.content because unpublished pages will all be replicated to your publish instance. You can activate pages in the author instance at your desire.</li>
<li>Check-in your code to master (and request for a pull request) with the &#8220;SNAPSHOT&#8221; label removed in your .pom file.</li>
<li>Tag your master with v1.2.0 (or whichever version you are working on)</li>
</ol>
<div class="mention-block">
<h3>Final Notes</h3>
<p>There are many ways of deploying new releases to your AEM Staging or Production environments, but this is my take on this for a manual release strategy. Please leave a comment if you have any questions or suggestions on how I can improve me &#8220;package manager oriented way of deploying my releases&#8221;.</p>
</div>
<p>The post <a rel="nofollow" href="https://sourcedcode.com/blog/aem/how-to-deploy-new-releases-on-staging-and-production-aem-instance">How to deploy new releases manually on Staging and Production AEM environments?</a> appeared first on <a rel="nofollow" href="https://sourcedcode.com">Sourced Code</a>.</p>
]]></content:encoded>
					
					<wfw:commentRss>https://sourcedcode.com/blog/aem/how-to-deploy-new-releases-on-staging-and-production-aem-instance/feed</wfw:commentRss>
			<slash:comments>5</slash:comments>
		
		
			</item>
	</channel>
</rss>
