Issue: Created AEM servlet and testing post request from Postman returns 403 - Forbidden Error.
Steps:
Now you can call your POST method anywhere.
1. Folder/Asset Naming convention
a. Is it good a have a folder/Asset name contains underscore ( _ ).
Eg: /content/dam/Test/Advanced_buttons
Is CQ providing any best naming conventions.
2. Assets (Images/pdf/docs whatever)
a. What is the max size limit of an Asset?
3. What is the max number of Assets that we can upload in a dam folder.
Comments:
1. Yes folders can have underscores. I didn't see any issue till now.
2. Max size limit I am not sure but I injected around 10 to 30 MB size with out any issues.
3. There should not be much issue even if you inject 100 to 150 gigs of assets. we migrated around 130 gigs with out much issues. In terms of number of assets inside a particular folder (Number of nodes at one level) Adobe recommends dont use more than 200 to 250 at one level. If it is more than that front end DAM UI will slows down (still repository doesn't show any issue)
mkdir static
mkdir static/install
Copy myapp.zip static/install
jar uf quickstart.jar static/install/myapp.zipReference:
http://helpx.adobe.com/crx/kb/HowToInstallPackagesUsingRepositoryInstall.html
http://www.wemblog.com/2012/04/how-to-install-multiple-package-in-cq.html
Note:
Steps:
To prevent the process from forking into more than one process, increase the maximum heap size and the PermGen JVM parameters. Locate the set jvm_options command and set the value as follows:
set jvm_options=-XX:MaxPermSize=256M;-Xmx1792m
instsrv.bat cq5
To verify that the service is created, open Services in the Administrative Tools control panel or type start services.msc in Command Prompt. The cq5 service appears in the list.
Note: The property values in the instsrv.bat file are used when creating the Windows service. If you edit the property values in instsrv.bat, you must uninstall and then re-install the service.
To uninstall the service, either click Stop in the Services control panel or in the command line, navigate to the folder and type instsrv.bat -uninstall cq5. The service gets removed from the list in the Services control panel or from the list in the command line when you type net start.
Deprecated API information is logged here: http://dev.day.com/docs/en/cq/current/javadoc/deprecated-list.html
Below are the two easiest ways to get Service:
1. Using the slingScriptHelper
<sling:defineObjects />
<%
ServiceType service = sling.getService(ServiceType.class);
%>
2. Using adaptTo()
adaptTo() method that will translate the object to the class type being passed as the argument.
Example:
Node node = resource.adaptTo(Node.class);
More Info on Adaptors: http://dev.day.com/docs/en/cq/current/developing/sling-adapters.html
/crx/explorer/index.jsp - CRX explorer
/crx/de/index.jsp – CRXDE Lite url
/damadmin - DAM
/libs/cq/search/content/querydebug.html – Query debug tool
/libs/granite/security/content/admin.html – New user manager standalone ui [5.6 only?]
/libs/cq/contentsync/content/console.html – Content sync console
/system/console/bundles – Felix web admin console
/system/console/jmx/com.adobe.granite.workflow%3Atype%3DMaintenance - Felix web admin console JMX / Workflow maintenance tasks
/system/console/jmx/com.adobe.granite%3Atype%3DRepository - Felix web admin console JMX / Repository maintenance tasks
/system/console/depfinder – This new 5.6 tool will help you figure out what package exports a class and also prints a Maven Dependency for the class.
/libs/granite/ui/content/dumplibs.rebuild.html?rebuild=true – Helpful link for debugging caching problems. Wipes the clientlibs and designs and forces it to rebuild it. Thanks to Mark Ellis for this link.
/system/console/adapters – This link shows you the Adapters are registered in the system. This helps you figure out what you can adaptTo() from resource to resource.
wcmmode=DISABLED - This handy publisher parameter turns off CQ authoring features so you can preview a page cleanly
Generic Code to get service from the OSGI service registry:
================================================================
If you are in a JSP Script you can do
<cq:defineObjects />
<%
ServiceType service = sling.getService(ServiceType.class);
%>
==================================================================
Get Administrative Resource Resolver :
<%!
/**
@Parms: ResourceResolverFactory
returns ResourceResolver , Admin resource resolver will be return
*/
public ResourceResolver getRR(ResourceResolverFactory resolverFactory)
{
ResourceResolver rr=null;
try{
rr= resolverFactory.getAdministrativeResourceResolver(null);
}catch(Exception e)
{
System.out.println("RRF Exception:"+e.getMessage());
}
return rr;
}
%>
<%
//Get ResourceResolverFactory service from OSGI service Registry
org.apache.sling.api.resource.ResourceResolverFactory rrFactory = sling.getService(org.apache.sling.api.resource.ResourceResolverFactory.class);
Resource r = getRR(rrFactory);
%>
In OSGI Service/Compoment
You can access a resource through the JcrResourceResolverFactory service:
@Referenceprivate SlingRepository repository;
@Referenceprivate JcrResourceResolverFactory resolverFactory;
public void myMethod() {Session adminSession = null;try {String resourcePath = "path/to/resource";adminSession = repository.loginAdministrative(null);ResourceResolver resourceResolver = resolverFactory.getResourceResolver(adminSession);Resource res = resourceResolver.getResource(resourcePath);} catch (RepositoryException e) {log.error("RepositoryException: " + e);} finally {if (adminSession != null && adminSession.isLive()) {adminSession.logout();adminSession = null;}}
}
In JSP
<sling:defineObjects>
<%
String resourcePath = "path/to/resource";
Resource res = resourceResolver.getResource(resourcePath);
%>
1. In the Websites tab, in the left pane, select the site.
2. Add a new language branch to the site:
a. Click New..
b. In the dialog, specify the Title and the Name.
The Name needs to have the following format:
<language-code> or <language-code>_<country-code>
- the supported language code is lower-case, two-letter code as defined by ISO-639-1
- the supported country code is lower-case or upper-case, two-letter code as defined by ISO 3166
Examples: en, en_US, en_us, en_GB, en_gb.
Select the Template and click Create.
3. In the Websites tab, in the left pane, select the site.
4. In the Tools menu, select Language Copy.
5. The Language Copy dialog opens. It displays a matrix of the language versions available for individual pages. An x in a language column means that the page is available within the language tree.
6. To copy an existing page or page tree to a specific language first select the appropriate empty cell. Then click the arrow and select the type of copy in the drop-down menu.
Type of language copy
Description
auto
Uses the behavior from parent pages
ignore
Cancels the copy for this page and its children
<language>+ (e.g. French+)
Copies the page and all its children from that language
<language> (e.g. French)
Copies only the page from that language
7. Click OK to close the dialog.
8. In the next dialog, click Yes to confirm the copy.
How can we hide some of the CMS consoles / tabs (like the Site Admin, DAM Admin, Tools, Security, Workflow and Tagging) via permissions?
Answer: Uncheck the READ permission for groups/users on the corresponding console node.
Ref: http://helpx.adobe.com/cq/kb/CQ53HowToHideCQNavigationButtons.html
Error Type:
./script.sh: line 1: syntax error near unexpected token '$'do\r''
Or ...
./script.sh: line 1: $'\r': command not found
Step 1: Get the PID of your java process
The java JDK ships with the jps command which lists all java process ids.
You can run this command like this: jps –l
8112
1396 sun.tools.jps.Jps
3576 crx-quickstart\app\cq-quickstart-5.6.0-standalone.jar
Step 2 : Request a Thread Dump from the JVM
In windows:
1. Install cygwin to run shell script
2. set path to the environment variable list.
3. Add following script in the <name>.sh
#!/bin/bash
if [ $# -eq 0 ]; then
echo >&2 "Usage: jstackSeries <pid> <run_user> [ <count> [ <delay> ] ]"
echo >&2 " Defaults: count = 10, delay = 0.5 (seconds)"
exit 1
fi
pid=$1 # required
user=$2 # required
count=${3:-10} # defaults to 10 times
delay=${4:-0.5} # defaults to 0.5 seconds
while [ $count -gt 0 ]
do
jstack -F $pid >jstack.$pid.$(date +%H%M%S.%N)
sleep $delay
count=`expr $count - 1`
echo -n "."
done
4. You can run this shell script like:
sh <name>.sh <Process Id of AEM> <Intervals> <No.of Threads>
Eg: sh TrheadDump.sh 4321 10 5
Result: It takes 5 thread dumps at an intervals of 10 sec.
Note: Running CQ on UNIX ?
Reference: http://helpx.adobe.com/cq/kb/TakeThreadDump.html
You can use “com.adobe.granite.workflow.status.WorkflowStatus” API to check the WF status of the payload.
Eg:
WorkflowStatus wfState = <payload object>.adaptTo(WorkflowStatus.class);
boolean status=false;
status = wfState.isInRunningWorkflow(true);