CQ 5.4 / 5.5 Resource Mapping
Introduction ¶
Several times I ran into Resource Mapping inside CQ / WBEM and had issues with it over and over again. Now I had to go into it and make it work and this is the result of it.
There were a few issues that need to be handled in order to avoid a lot of grief and there are a few things that can be done in order to make life easier.
Resource Mapping ¶
CQ is able to map resources on an incoming request as well as on the outgoing result. For example if your resource is /content/geometrixx/en/products.html and you map it to /en/products.html then CQ will show it with /en/products.html (obviously) but it also maps a link inside another page when the page is sent to the browser.
This means that one has to be careful when mapping resources because CQ will map them no matter what and you must be especially careful when dealing with the Author instance.
Map the Root ¶
Here I assume we are working inside CRXDE|Lite on the Publish instance. Now we want to map http://testme.com:4502/ to /content/geometrixx/de.html. This is what you need to do:
- Open the hosts file (Mac/Unix: /etc/hosts) and add row with 127.0.0.1 testme.com and make sure with ping testme.com that is resolves to 127.0.0.1
- Go to the Node /etc/map/http
- Right-click and select Create Node
- Enter name testme_com with the type sling:Mapping
- Go to the Properties of the newly created node
- Add a new Property with name sling:match and value testme\.com.4502
- Add a new Property with name sling:internalRedirect and value /content/geometrixx/de.html
-
Save it with Save All
Now you can open a browser and enter the Url http://testme.com:4504/ and you should see the German Geometrixx site. Now if you click on the Products on the toolbar we are back with the /content/geometrixx/de path.
Dealing with Mapping Issues ¶
Working with Resource Mapping in CQ can be very frustrating depending on the project your are working on. For example the Geometrixx site is a good example what can go wrong but also how to avoid issues like this.
First problem I ran into when mapping resources was that I ended up in an endless loop when trying to map both the English and German pages to different domain names. Because of the browser jumping between various pages I wasn’t able to see what is going on. Eventually I went to the command line (Mac) and used curl to access the web site:
curl http://testgerman:4502
and checked the output. Sure enough the Geometrixx site used the login page fromm the English site and so it would jump to http://testenglish.com:4502, login (on publish it does that automatically as anonymous) and then jump back to http://testegerman.com:4502 where it wasn’t logged in and repeated the loop. Because using curl I could see the source of the desired page and had no endless loop.
Next issue was that even when the page was coming up right it would come up without any images, style sheets etc and using curl again I saw that mapping of elements from /etc won’t work anymore. This means that I had to make sure that certain entries are mapped differently and because the browser accessed the page on the root we had to make sure that we exclude certain entries from the loop.
Map Content ¶
Mapping content is similar to mapping the root but here we can use a trick. If we don’t provide a sling:match property CQ will use the name of the node as a match. So we create it this way:
- Create a Node with Name testme.com.4502 and type sling:Mapping
- Add a property with name sling:internalRedirect and value /content/goemetrixx/de
-
Save it with Save All
Now you can open in a browser http://testme.com:4502/products.html and it will bring up the page but without images and style sheets as mentioned above. So we need to make sure that CQ isn’t mapping /etc. This is done this way:
- Under the node testme.com.4502 we create a child node with name etc and type sling:Mapping
- Enter a property with name sling:internalRedirect and value /etc
-
Save it with Save All
Because CQ is looking for the longest matching string testme.com:4502/etc is longer than testme.com:4502 and so it will take this one which maps /etc to /etc which is just what we wanted. Now opening http://testme.com:4502/products.html in a browser should come up just fine (you might need to clear the cache).
You can repeat this for other parts of your system like /apps etc if needed.
Still not 100% ¶
Having a closer look at the Products page you will notice that there is no toolbar because it is an URL that maps to /content/geometrixx and not /content/geometrixx/de even though the page starts with de.. This is unfortunate and you might be able to add additional mapping using Regex but then again you are probably not running Geometrixx as your site and so you can make sure that the toolbar etc is inside your CQ context. Unfortunately these shortcomings are not fixed in CQ 5.5. Even worse looking at your page you will find links that start with localhost:4502 even if you CQ instance is running on another port or host.
So it is not 100% but it is close enough for good sites in CQ.
Tips when dealing with Resource Mapping ¶
- Resource Mapping is only mapping CQ resources. Don’t try to map anything else.
- If a browser gives you grief use curl to see what the server returns
- Create a CQ package with the /etc/map as content, delete everything and start step by step. Each step must work as expected before going to the next.
- Check the HTML code from the server to verify the results. Browser’s output is often misleading
- Make sure that first level folders like /etc, /apps etc are not mapped
- To avoid mapping on Author but define the mapping on Author you can create /etc/map.publish instead of /etc/map and then replicate it to the Publish instane(s). Often mapping is not desired inside Author.
- If you have problems accessing the CQ Webpage because of the mapping you can use WebDav to remove the mapping nodes.
-
If you map different domains to different CQ sub folders make sure they are distinct otherwise the mapping of resources inside a returned page is undefined.
Final Result of my Mapping as JSon ¶
curl http://localhost:4502/etc/map.tidy.-1.json
{
"jcr:createdBy": "system",
"jcr:created": "Mon Mar 26 2012 19:47:11 GMT-0700",
"jcr:primaryType": "sling:Folder",
"testmegerman_com": {
"jcr:createdBy": "admin",
"sling:internalRedirect": "/content/geometrixx/de.html",
"jcr:created": "Wed Mar 28 2012 07:43:42 GMT-0700",
"jcr:primaryType": "sling:Mapping",
"sling:match": "testmegerman\.com.4502/$"
},
"testmefrench_com": {
"jcr:createdBy": "admin",
"sling:internalRedirect": "/content/geometrixx/fr.html",
"jcr:created": "Wed Mar 28 2012 07:43:42 GMT-0700",
"jcr:primaryType": "sling:Mapping",
"sling:match": "testmefrench\.com.4502/$"
},
"testmefrench.com.4502": {
"jcr:createdBy": "admin",
"jcr:created": "Wed Mar 28 2012 07:43:42 GMT-0700",
"sling:internalRedirect": "/content/geometrixx/fr",
"jcr:primaryType": "sling:Mapping",
"etc": {
"jcr:createdBy": "admin",
"sling:internalRedirect": "/etc",
"jcr:created": "Wed Mar 28 2012 11:10:16 GMT-0700",
"jcr:primaryType": "sling:Mapping"
}
},
"testmegerman.com.4502": {
"jcr:createdBy": "admin",
"jcr:created": "Wed Mar 28 2012 07:43:42 GMT-0700",
"sling:internalRedirect": "/content/geometrixx/de",
"jcr:primaryType": "sling:Mapping",
"etc": {
"jcr:createdBy": "admin",
"sling:internalRedirect": "/etc",
"jcr:created": "Wed Mar 28 2012 11:10:16 GMT-0700",
"jcr:primaryType": "sling:Mapping"
}
}
}
Alfred Powerpack: Bad Business Model?
Today I got an email from Alfred (Mac OS X app launcher) that Alfred is now two years old and to celebrate they offer the Powerpack with a 10% discount. I was thinking about buying it and it sounds reasonably priced but not with the limitations.
If I buy the current version it will run with 1.x release of Alfred which just turned two. That said I have no idea when they will release version 2.x. This prevents me from actually buying it or let’s say it this way it makes they price rather unreasonable. I paid more for software but all of them do more like Omnifocus, Omnigraffle, Pixelmator etc.
To make it work for me the Alfred team either needs to give us an idea how long 1.x is the current version or limit the time the license is valid like 2 years.
Finally the mega-support license is great but then how long will be Alfred around so that my investment is worthwhile.
For now I use the free but limited Alfred without the Powerpack.
– Andy
Post with Blogsy
This is my first post using Blogsy to write a post on my iPad. Even though I prefer writing on my MacBook Air it is nice to write it on a small device like the iPad.
- Andy
Mac OS X Tip: Manage Screenshots with DEVONthing
Since a while I am thinking on how to manage screenshots the best. I take them but then are lurking around inside a directory and if I don’t head over, review and rename them I will loose the context and often they become worthless. What I want is to take a series of screenshots (for example to demonstrate how to do something), then review and rename them quickly.
Because I am using DEVONthink as my second brain where I just dump everything I need to keep an eye on or need to work on later and then use its search / quick preview feature to go over the entries and organize them correctly. The nice think about DEVONthink is that it has a directory for its Inbox in the file system that I can use to drop items there using Finder or any other file selection tool.
Now I started to think if it would be possible to use the Mac Screen Capture system to add these screenshots to DEVONthink so that I can review them, add tags and organize them correctly after I am done with taking the shots. So I followed the instruction from Mac World OS X Hints how to change the default location for screenshots and opened a terminal:
defaults write com.apple.screencapture location \ "/Users/<User Name>/Library/Application Support/DEVONthink Pro 2/Inbox"
Then I had to log out and log back in so that the change could take into effect.
Now when I take a screenshot it won’t appear on the Desktop but rather in the Inbox of DEVONthink where I can easily view them, add tags and copy them into the final destination.
- Andy
Warning: Don’t shop at Hobbytown USA, Temecula
Since we moved into the region I was a regular customer at Hobbytown USA in Temecula but this came to a screeching halt because of their bad customer service which also includes the entire franchise Hobbytown USA because they weren’t willing to help me settle my argument with the shop. So the shop and the franchise are loosing me as a valuable customer (I bought several remote controlled cars, helicopters, remote controls and much more) over an argument over $400.
My wife wanted to buy all our kids a toys they could use together and she settled on a Slot Car racing track system. So she went to Hobbytown USA in Temecula because we had good experiences so far and bought the digital SCX 3 cars racing system for $400. So on Christmas day we built the racing track and my wife and the two oldest kids were racing with it on the junior settings so that they don’t shoot out of the tracks on every turn. An hour or so later my wife’s car lane change system stop working which is crucial to play it because that is the way how to refuel the car and at the end of 2 hours playing the spoiler on the trunk of another car was ripped out on one side.
Because we paid so much I packed up the system and went back to the store to return it because the quality of the system doesn’t match its price tag. But there I got a real eye-opener because the store owner was not willing to return it at all. He more or less accused me that we played too rough whatever that means on a racing system and therefore it is our problem now. After I told him that I am disappointed and that I could return a toy even at Toys’R'Us he kicked me out of the store.
After I came home I started to searched the system SCX D10009X510 1/32 Digital System GT Pit Box Slot Car Set 20.4′ I figured out that I could have bought the system cheaper on-line. Close to a month later Hobbytown USA isn’t selling the system anymore and I am wondering why. In an effort to resolve that issue I contacted Hobbytown USA because it was their flyer that gave my wife the idea and it was them defining the catalog of the toys sold. Again now luck with them because they just told me that all shops are owned independently and they set the rules. When I responded that it was their catalog which choose the system from and that it is their name / brand on the store and so I expect that they should help resolve the issue they just didn’t respond anymore.
If a store sells toys at a premium and doesn’t want to be compared to Toys’r'us then they should make sure that what they sell is worth the money and if it fails they should correct it and I don’t care about the relationship between the store and the brand, period. I would have gladly accepted an in-store credit but they choose to let me down and ruin a good customer relationship.
So from now on I will not buy anything from Hobbytown USA store in Temecula and from a Hobbytown USA store anywhere including their online store. Hobbytown USA should have a look at Apple and how their customer relationship is making me preferring their store instead of buying at Fryr’s, BestBuy or any other computer store. I had an iPad 2 where the homebutton would sometimes not work even though I felt the click. They replaced the iPad 2 without any questions and this one costed $600. Even if the Apple store is more expensive I know that I get great customer service and that if anything isn’t up to par I can return it. Or they should look at the 2 person company of Studioneat which make the Cosmonaut, an iPad stylus, and when some of their tips did not work effortlessly they send out an email to tell their customers and replaced mine without questioning and now and I am an even bigger fan of them as before I got the Cosmonaut.
In today’s economy I don’t understand how a company can blow their customer relationships like this and they don’t care if I was a one-time customer or a regular, long-time customer. But they did and I won’t forget it.
MacBook Air Arrived and Ready
Yesterday my new MacBook Air arrived and I started to set it up. Going to a smaller device I did not copy the content of my original 17-inch laptop over but started from scratch again.
Funny thing today is that I got an email from Apple that the Air was shipped even though I received it yesterday and the first delivery was made two days ago. So it seems that Apple had a problem with my shipment but at least I got it and it is working perfectly.
The first thing that amazed me was how light it is. Carrying it around compared to the 17-inch is a breeze. The overall speed is quite slower but not enough to be a drag. Of course creating or extracting large ZIP files is progressing a lot slower but that isn’t my daily business. Developing on CQ5.4 from Adobe (Day) is comparable and still beats my current Dell desktop at my workplace.
Having the Air connected to my 27-inch monitor it nearly feels like the 17-inch and so working at home with the Air is more or less the same. On the road the screen is small but because of that easy to use in a car or plane. If I am on-site it might be a little bit small for regular development but for now I rarely do that.
The only thing that baffles me a little bit is that the Activity Monitor is showing for CPUs for a Dual Core i5:

For now the only reason why I would go back to my 17-inch is if I need to have a powerful development machine away from my home and there is no way I could have an external monitor with a better resolution that the Air which is pretty good with 1440×900.
- Andy
iPad-ification of Development
Since I started my career as professional software developer my motto towards new laptops was bigger, faster, larger until now. Since I started working with iPads I started to think maybe lighter, quicker, longer maybe better afterall and so I went ahead and bought an 13-inch Mac Air on Black Friday.
Initially a new laptop had to be:
- bigger meaning the screen real estate had to be bigger so that I could view more code without scrolling
- faster meaning faster CPUs to just get work done faster
- larger meaning more harddisk space to store all my projects and other documents data.
Now having a Mac Pro at the office with a 30-inch monitor I have no need for a big laptop and when I am on the road I rarely do hardcore development that requires a big screen and being on an airplane or inside a car the size of the laptop makes it cumbersome to code anyhow. So my priorities shifted to:
- lighter meaning having a lightweight laptop is easier to transport and I can work with it everywhere
- quicker meaning the laptop is always on like an iPad. My 17-inch laptop with its SSD boot drive is close to it but I have some hickups with the setup from time to time.
- longer meaning battery life. Again the 17-inch laptop is close but not quite there.
So I already started my transition to the Air a while ago with my MacBook Pro but now I want to have it in a nice little package that I can take everywhere without breaking my back or being afraid it might slip.
The need for more CPU power went away some time ago because I rarely max out CPUs and if I really need to deal with movies then I’ll use my Mac Pro instead.
Finally the need for large harddisks also became somewhat mute with external drives that are quick and big. Lately I never had to manage many huge projects and so the only reason I need a lot of disk space is because I have many projects around for reference which I rarely use so an external drive would do just fine.
So now I think I am ready to develop on an iPad like device rather than carry around a “Schlepptop”.
- Andy
New Theme: Traction from The Theme Foundry
As you have probably noticed we have a new theme. Even though I am creatively challenged I know when a design bugs me because it is either too busy, too blend or distracts from the actual content.
Even though I liked our previous theme initially I found it too busy after some time. Listening to the Founder’s Talk podcast on 5 by 5 episode 22 with Drew Strojny I checked out his Theme Foundry and found traction quite appealing. It has mostly what I was looking for like it was dark but not black, good coloring but not too busy, clean but not blend and text area where light but not white. So I decided to buy it because I can’t create a theme like that for that little money because I just don’t have the time and knowledge for it.
Have fun – Andy
MarsEdit, WordPress and BlogText All In One
Today I wanted to see if I could use MarsEdit and BBEdit to post a Post or Page to this WordPress site using BlogText plugin for WordPress.
BlogText is a simple markup language so that I don’t have to write HTML in order to post a Blog. Now with the HTML editor of MarsEdit that maybe isn’t necessary but I am going to edit the posts / pages through the Web Interface or iOS App and then I want to make it as quickly as possible.
Initially I ran into a lot of issues because MarsEdit did create HTML around the BlogText effectively rendering BlogText mute. Then I tried to use the HTML view and voila it would send the content as is. So I changed the default editor back to the HTML editor and now I can edit my posts like this one with BBEdit using BlogText through MarsEdit.
BTW I like MarsEdit because it is faster to navigate and has a better overview than the Web interface of WordPress.
- Andy
Apptico: Be Aware of Not Getting Paid
Apptico, a small company headed by Paul Grossi is behind the iPhone App **Stadiyum**. The App is nice but the business practice of Apptico / Paul Grossi is to use developers / creative artists work and when they finally have to pay the just look for new people without paying for work already delivered.
If we would be the only one I wouldn’t mention this here but I knew a few people with even bigger outstanding invoices than me and so I want to help others to avoid this trap. Every start-up will deal with financial hardship one way or the other but Apptico / Paul Grossi did not even try to find a compromise and just did not respond at all. Looking at all these cases I left wondering if this isn’t just Apptico’s business model to get cheap labour.
For me I am done with them but I want to spread the word what anyone can expect with them. They might pay an few invoices just to give you a sense of security but so far I don’t know anyone getting paid in full.
Cheers – Andy

