Site Network: Personal | Professional | Photography

Technical Blog

This blog will contain content related to Java, Seam, Security, my sites and projects, as well as other technical subjects I am interested in.

Comments and questions are welcome!

Updates to the ATG RSS Feed Module

Sunday, May 4th, 2008

Thanks to Doug Henderson sending me some code updates I have released a new version of the RSS Feed Droplet (first mentioned in this post) which supports configurable character encodings. This can be very useful if you have "interesting" characters in the content you are publishing.

I have also rolled the code into my ATG Open Source Module Pack, so that I can maintain everything in one location.

Also: please note that you cannot reformat the JSP code, or introduce any spaces as it will break the feed. I've made note of that in the module's Readme as well.

Enjoy!

Adding the “Upload Image” Button in the ACC

Monday, April 14th, 2008

If you have your own content repository items defined, and you'd like the ACC to provide the Upload Image functionality for your internal binary properties, Russell Moore has figured it out:

In /atg/devtools/ create a local version of admins.xml:

 
<repository-admins>
  <default-admin id="YourRepository">
    <display-name>Your Content</display-name>
    <repository-name>YourRepository</repository-name>
    <create-bean-displays>
      <bean-display type="media" class="atg.ui.repository.MediaInternalBinaryEditor">
<property name="internalBinaryExcludedTableProperties" value="path, version, mimeType,data, length,url"/>
      </bean-display>
    </create-bean-displays>
    <standard-bean-displays>
      <bean-display type="media" class="atg.ui.repository.MediaInternalBinaryEditor">
<property name="internalBinaryExcludedTableProperties" value="version, mimeType, data, length, url"/>
<property name="internalBinaryTableReadOnlyProperties" value="path"/>
      </bean-display>
    </standard-bean-displays>
  </default-admin>
</repository-admins>
 

Thanks Russell!

Getting the Real IP Address from a Proxied Request in ATG

Tuesday, April 8th, 2008

Many things can obscure the real IP address of the end user when they visit your site: a load balancer in front of your ATG cluster, Akamai, the user's ISP or office network, and more. This makes correlating logging events, or using the ATG session IP validation security option, and more, very difficult. In light of that challange I've added a new mini-module to my Open Source ATG Modules called the ProxyIPFixer. It uses a simple ATG pipeline Servlet to examine the X-FORWARDED-FOR request header, and if it finds one, parse through the IP addresses to find the originating IP address of the user, and puts that value into the ATG Request object's remoteAddr property.

This allows downstream pipeline servlets, code, and pages to see the real user's IP address.

The caveat is that the header can be faked, and that some ISPs/companies, such as AOL, do not set the true end point of the user, and you can only see back to their outgoing proxy server. In AOL's case in particular, they can also route subsequent requests by the same AOL user through different AOL proxy points, which will make it appear that someone is hijacking a session (if you're using the ATG session security mechanism). So be aware of the limitations. However it can be very useful.

For those who don't want to download the whole module package, I have attached the Java source and the ATG properties file to this post.

Enjoy! (and as always feel free to contact me with questions, issues, improvements, etc...)

ProxyIPFixerServlet Java Source

ProxyIPFixer ATG Properties File

ATG Project Templates and Open Source Modules

Tuesday, February 26th, 2008

I have just added a new page to my site:

ATG Technologies

This page currently has ATG Project templates, with ant build files, for ATG 7.1 and ATG 2006.3 and 2007.1 available for download. It also has a collection of small handy ATG Modules which I have created and released as open source, using the Apache License.

These modules provide everything from Cache Header control, to Captcha, to Encryption, etc... I will be enhancing them and adding new modules as time goes on.

Check them out, and e-mail me with any comments, questions, bugs, requests, code updates, or contributions.

ATG Cache Header Control Module

Saturday, February 2nd, 2008

Many ATG application server static content, or semi-static content, from within the ATG application's .war file. It is often much simpler to package CSS, JavaScript, Flash, Images, and other files in your web application than to try to manage them separately and deploy correctly in development and production instances.

It is often desirable to set long cache times for static content and you may also want to ensure that certain other files or URIs are never cached. Unfortunately ATG does not provide a mechanism for tuning the cache headers.

I have created a new ATG Module which allows you to easily adjust cache header times based on mime-types and URIs, including parent directories. You can download it here: DSCacheControl ATG Cache Header Control Module.

I have built and tested it using ATG 7.1 I will be releasing one for ATG 2007.1 in a bit, which may be based on a Servlet Filter instead, but I haven't decided yet. This one may work on ATG 2007.1, I haven't been able to test it yet.

It is very simple, with two classes: a pipeline servlet and a custom comparator, and two config files: the pipeline servlet's configuration and an Initial.properties to start the servlet. The source code is included in the module.

It allows you to control the cache time used to build the cache related response headers based on the requested asset's mime-type and URI location. It has an order of precedence of a default setting of 0 seconds (do not cache at all), then the mime-type settings are used, and then the URICacheMap is examined to find the most specific entry which is the specific URI or a parent directory. This should allow you to setup basic settings, and override them for specific directories or files as needed.

Here are some example config settings to give you an idea:

mimeTypeCacheMap=image/png=604800, \
image/jpeg=604800, \
image/gif=604800, \
application/x-javascript=604800, \
application/x-Shockwave-Flash=604800, \
flv-application/octet-stream=604800, \
text/html=0, \
text/css=604800

URICacheMap=/myapp/images=2592000, \
/myapp/index.jsp=2342343, \
/myapp/other.jsp=1342342, \
/myapp/images/changing-image.jpg=3600, \
/myapp/huge-static-jsp.jsp=2592000

To install it, simply download the zip file, unzip it, copy the module into your ATG 7.1 root directory and add the module to the list of DYNAMO_MODULES in your environment.sh (or add it using the -m option on the command line when you start ATG). You will likely want to override the default configuration. The .properties file is heavily commented and should be simple to understand. You can edit it within the module if you like, although of course the better approach is to set your cache settings in your application module or in localconfig, depending.

If you try it, please give me your feedback. If you enhance it, please share the code back with me.