Posts

Showing posts from October, 2011

Apache Tapestry PageActivationContext tutorial

The idea behind this annotation is nice and very simple. It's all about telling tapestry how to hypothetically convert a string to an object of your choice. This string is actually a key used to look up a desired object.


Now to do that you need to provide tapestry with your value encoder implementation then go ahead and use the @PageActivationContext annotation.


First create a value encoder service :

package com.skycomm.cth.services.encoders;
import org.apache.tapestry5.ValueEncoder;
import org.apache.tapestry5.services.ValueEncoderFactory;
import com.jarmy.beans.UserInfo;
import com.jarmy.services.dao.UserDAO;
public class UserInfoEncoder implements ValueEncoder, ValueEncoderFactory {
    private final UserDAO userDao;
    public UserInfoEncoder(UserDAO userDao) {
        this.userDao = userDao;
    }
    @Override
    public ValueEncoder create(Class paramClass) {
        return this;
    }
    @Override
    public String toClient(UserInfo paramV) {
        return paramV.getId();
    }
    @Override

Apache Tomcat 7 JAVA options

I needed to increase tomcat 7's heap size and provide an environment variable at the command line and here is how I did it:

In Tomcat's bin folder, open catalina.bat file in a text editor.Replace the following statement:set JAVA_OPTS=%JAVA_OPTS% %LOGGING_CONFIG%
By this one:
set JAVA_OPTS=-DIPK_CFG=C:/Skycomm-CTH/appconfig.properties -Xms64m -Xmx1024m %JAVA_OPTS% %LOGGING_CONFIG% If you have a better suggestion, please add it as a comment.