Skip to main content

Posts

A Simple Output Cache Solution for DD4T Java

This blog post presents a very simple output cache solution presented in the form of a Java Servlet filter. The output cache works together with DD4T Java, although it is a pretty generic solution. The idea behind this output cache is to store the response output in a memory cache, such that a subsequent request to the same URL will load the cached response content from cache, instead of letting it be processed again through the normal request processing pipeline. This approach has, of course, a few constraints — namely, the biggest being there cannot be any personalization in the response based on users. The response is the same for several requests which might belong to several users, sessions, cookies, etc. Hence this ‘simple’ output cache. The output cache filter uses the incoming request URL as a key in the local memory cache. If a previously cached response is found in cache, it will be served; otherwise, the request is let go through the processing pipeline and the resu...

Extending Tuckey URL Rewrite Filter with Tridion-published rules

This post shows a way of extending Paul Tuckey’s URL rewrite filter ( https://code.google.com/p/urlrewritefilter/ ). Namely, it extends the Java version 4.0.3 of the filter and makes it use rewrite/redirect rules published from Tridion. The rules are published to the Content Delivery Database as a dynamic DD4T page, and use specific view model objects that make reading the rules very easy. The extension I wrote will also attempt to load the existing rules in file “ /WEB-INF/urlrewrite.xml ” - the default configuration file used by URL rewrite filter. Tridion Part We define an Embedded Schema called EmbeddedRedirect having the following fields: from - single value text; to - single value text; permanent - singe value drop down or radian button text field based on values of a list with possible values “Yes” or “No”; We define a Schema called Redirects having the following field: redirect - multi value embedded field based on Schema EmbeddedRedirect ; Next, we a...

Custom Cache Invalidation using JMS

Let's say you have your own application or a custom cache that stores some Tridion items for better performance. You are not relying solely on the Tridion object cache, and you built your own cache layer on top of it. You don't want to serve stale content or use a dummy time-to-live cache, and you chose an elegant dependency cache implementation. This implies you need to intercept the cache 'invalidate' messages from the Tridion Deployer and use them to remove the updated items from your custom cache. This is exactly the setup I happen to have -- DD4T Java web-application using RESTful services providers. The DD4T application makes no use of Tridion APIs whatsoever, everything being abstracted in the services layer. The DD4T factories call the service-based providers and cache the returned models in a local EHCache. Naturally, I need an elegant cache notification mechanism to flush the items in the EHCache that are updated by a publish action. The Cache Channel Servic...

Setup Apache ActiveMQ

This is a follow up of my previous post JMS Cache Channel Setup . The goal is to configure JMS cache invalidation for Tridion Content Delivery. In my previous post I was describing how to configure the Tridion Deployer to use JMS technology and to post cache notification messages to an Apache ActiveMQ server. This post describes the steps I took to install and configure ActiveMQ on my machine. I started my endeavor without having any prior experience with ActiveMQ. To my surprise, the installation was a breeze and took me about 20 minutes to get everything running. I started by visiting the home of ActiveMQ -- activemq.apache.org . The latest version as of the day was 5.10.0. I followed the no-nonsense guide on the home page and I first downloaded ActiveMQ. I use a Mac (like every freelancer who respects himself :-p) and I personally love FreeBSD, so I downloaded the Unix/Linux/Cygwin Distribution . Namely, a file named apache-activemq-5.10.0-bin.tar.gz . The Getting Starte...

JMS Cache Channel Setup

In my current project, we are implementing the Tridion Cache Channel Service using JMS technology. Without having installed it previously I used to regard this as a little bit of voodoo. I started doing my due diligence research on the topic, only to find out that actually there are quite a few resources out there on JMS in general (doh!), as well as in conjunction with Tridion specifically. There are some great blog posts on JMS consumption and setup from Bruce Snyder: bsnyderblog.blogspot.com/2010/02/using-spring-to-receive-jms-messages bsnyderblog.blogspot.com/2010/05/tuning-jms-message-consumption-in And a concise, but great post from Julian on enabling JMS for a Tridion Deployer: sdltridionworld.com/articles/usingsdltridionobjectcachingwithapacheactivemq A Bit of Architecture In a classic configuration (i.e. one using RMI), the Cache Channel Service (CCS) is running as a separate process, most likely a small stand-alone Java application. In a JMS configur...

Label Service in DD4T Java

Many times over we need to implement a Label service mechanism in our projects. This post shows one such approach for DD4T Java. The idea is to have a Labels Page published from Tridion containing the Labels Component on it. The labels are simply multi-valued Key - Value pairs represented by an Embedded Schema. The Labels page is read in DD4T and the labels on it are parsed and loaded into a java.util.Map. The front end code employs a custom JSP tag to read the label map and display the associated value for a given key. Content Manager Part We use Schema Label with a field ' label ' of type Embedded Schema, multi-valued. The Embedded Schema is ' Embedded label ' and contains two field, both single value text fields: ' key ' and ' value '. We create a Component ' Labels ' and populate it with our labels. This Component can be localized and translated in sub-Publications, as the Label Service can use context-aware Components to loa...

Experience Manager in DD4T with Service-Oriented Architecture Providers

This post describes the architecture for Tridion's Experience Manager (XPM) when used with an MVC framework such as DD4T in a Service-Oriented Architecture. This architecture implies that the website is completely independent of Tridion Content Delivery APIs. The only place where the CD APIs are used is on the Provider's Services Layer, as described in the following diagram. I am going to focus on this diagram to explain the basics of XPM and Session Preview mechanism in a DD4T with SOA providers setup. Publishing Flow This flow is a standard Content Delivery DB publishing flow: TRIDION CONTENT MANAGER publishes Pages, Components and Binaries to a DEPLOYER that writes everything in the CONTENT DELIVERY DATA STORE . It is very important to emphasize here that all  publishing types go to the CD DB and that nothing is written to a file-system. Content Delivery Flow This flow represents the normal delivery of pages and binaries from the web-application DD4...