torstai 17. marraskuuta 2011

Spring, Jetty 7 and jndi

jetty-env.xml needs to be in WEB-INF


<?xml version="1.0"?>
<!DOCTYPE Configure PUBLIC "-//Mort Bay Consulting//DTD Configure//EN"
"http://www.eclipse.org/jetty/configure.dtd">
<Configure id="wac" class="org.eclipse.jetty.webapp.WebAppContext">
<New class="org.eclipse.jetty.plus.jndi.EnvEntry">
<Arg>jdbc/jndiname</Arg>
<Arg>
<New class="oracle.jdbc.pool.OracleDataSource">
<Set name="user">DBUSER</Set>
<Set name="password">DBPASSWORD</Set>
<Set name="URL">jdbc:oracle:thin:@URL</Set>
</New>
</Arg>
</New>
</Configure>


pom.xml:


<groupId>org.mortbay.jetty</groupId>
<artifactId>jetty-maven-plugin</artifactId>
....


applicationContext:


<bean id="dataSource" class="org.springframework.jndi.JndiObjectFactoryBean">
<property name="jndiName" value="java:comp/env/jdbc/jndiname" />
</bean>

lauantai 14. toukokuuta 2011

How to find largest files on linux?

find . -type f | xargs ls -s | sort -rn | awk '{size=$1/1024; printf("%dMb %s\n", size,$2);}' | head -30

keskiviikko 2. maaliskuuta 2011

Googlebot, CookieLocaleResolver and default locale

Googlebot doesn't set a locale on request.

What does this mean? Well, in my case when I localized www.uutispuro.fi, googlebot only minded about english content. Even if I made different urls and sitemaps for webmaster tools.

Why such a behaviour? I'm using Spring's CookieLocalResolver, and ofcourse it had a default to en_US. This took a while for me to notice. Setting the default to "fi" does what I was expecting in the first place.


<bean id="localeResolver" class="org.springframework.web.servlet.i18n.CookieLocaleResolver">
<property name="defaultLocale" value="fi"/>
</bean>