"; */ ?>

software


9
Jul 08

Spring Web Application Context Visibility

spring framework logoWhile developing a Web App using Spring little things can take a lot of time to resolve. At the end they may appear to be very simple, and you may ask your self “how could I not think of it before – it is so obvious!”. Well, yea, it is obvious, but you just have to know it! One of the places that helps you to solve the “obvious” (and not so obvious), so you do not have to spin your wheels is, with no doubts, the spring forum. However you need to know the right search criteria to find what you need.

Here I just want to share something small but important about the visibility of Spring Contexts in a Web App.

Looking at org.springframework.web.servlet.DispatcherServlet API notice this:

“A web application can define any number of DispatcherServlets. Each servlet will operate in its own namespace, loading its own application context with mappings, handlers, etc. Only the root application context as loaded by ContextLoaderListener, if any, will be shared.”

This brings an interesting point – in a Spring Web App you have one root application context which is private, and many dispatcher servlet application contexts which are children of the root application context:

<context-param>
<param-name>contextConfigLocation</param-name>
   <param-value>
      /WEB-INF/classes/applicationContext.xml
      /WEB-INF/classes/otherContext.xml
   </param-value>
 </context-param>
 
...
 
 <servlet>
  <servlet-name>context</servlet-name>
  <servlet-class>org.springframework.web.context.ContextLoaderServlet</servlet-class>
  <load-on-startup>1</load-on-startup>
 </servlet>
 
...
 
 <servlet>
  <servlet-name>dispatcher-servlet-number-x</servlet-name>
  <servlet-class>org.springframework.web.servlet.DispatcherServlet</servlet-class>
  <load-on-startup>2</load-on-startup>
 </servlet>

In the above, everything that is defined in “contextConfigLocation” is your root application context. Every “dispatcher-servlet-number-x” (“dispatcher-servlet-number-1”, “dispatcher-servlet-number-2”, etc..) would represent a child application context which will see (have the visibility to) all the beans from the parent (root) context, but will not see any of the beans defined by its siblings – another dispatcher servlet contexts.

The only gotcha in the above visibility is BeanFactoryPostProcessor / BeanPostProcessor (s) – like “PropertyPlaceholderConfigurer” for example. These guys apply ONLY to beans in its own context. For example, if you have PropertyPlaceholderConfigurer defined in the root application context, none of root’s children will be able to use it (see) the ${properties}.

Here is the semi-official version “why” from Juergen (Spring Lead Developer):

“PropertyPlaceholderConfigurer is an implementation of the BeanFactoryPostProcessor interface: This interface and its sibling BeanPostProcessor just apply to the BeanFactory that defines them, that is, to the application context that defines them.

If you combine multiple config files into a single contextConfigLocation, a PropertyPlaceholderConfigurer defined in any of the files will apply to all of the files, because they are loaded into a single application context.

However, a DispatcherServlet has its own application context, just using the root web application context as parent. Therefore, it needs to define its own BeanFactoryPostProcessors and/or BeanPostProcessors, in this case its own PropertyPlaceholderConfigurer.”

Happy Springing!


16
Jun 08

SplashTop Linux On HP and Dell Notebooks

linux inside dell and hpSometime ago ASUS rebranded some of their motherboards as “Express Gate”.

What is unique about these “new wave” motherboards is that they come with SplashTop Linux installed in 512MB flash memory that is embedded on these motherboards.

What does it mean? It means that essential applications (e.g. web browser, instant message client, e-mail client, etc.) that come with SplashTop Linux can be started within 5 seconds after PC/Notebook is powered on – cool huh? Well Hewlett-Packard and Dell also thought it is “cool huh?” and decided to act upon it.

This week Hewlett-Packard announced the HP Envy 133 as its competition to Apple’s ultra-thin MacBook Air notebook. Like the MacBook Air, the Envy 133 runs off an Intel CPU. With the HP Envy 133 they are also shipping an “instant-on Linux” they’ve called Voodoo IOS (Instant-on Operating System).

In addition to the instant-on Linux excitement this week for the HP Envy 133, Dell is apparently working on a similar Linux solution. Engadget has shared details surrounding the Dell E and E Slim. These notebooks are direct competition to the very popular ASUS Eee PCs. These Dell E and E Slim notebooks will use Intel’s Diamondville processors and come with a similar set of features to the Eee PC and potentially at a better price. The E and E Slim also ship with what Dell is calling “BlackTop” for providing an instant-on Linux solution.

For a few months now DeviceVM (SplashTop creators) has had a version of SplashTop that comes equipped with the Pidgin (formerly GAIM) instant messenger and other cool apps.

from wikipedia:

Distinct from most Linux distributions, Splashtop is intended to be integrated on a read-only device and shipped with the hardware, rather than installed by the user. The user can install another operating system but always has this one ready to boot, in case the other one is broken, or in case web browsing and chatting is enough. It boots in about 5 seconds.[5] It is thus marketed as “instant-on.”

An “instant-on” operating system offers many advantages over a traditional operating system:

  • It boots much faster.
  • It is less vulnerable to malware as the system is mostly read-only.
  • It allows for diskless computers.
  • It is lighter but sufficient for running a web desktop and web applications.

sources: phoronix


3
Jun 08

Install Floola on Ubuntu

iPod on UbuntuFloola is a freeware application to efficiently manage your iPod or your Motorola mobile phone (any model supporting iTunes). It’s a standalone application that can be run directly from your iPod and needs no installation under Linux, Mac OS X and Windows (Windows Vista is supported).

Step 1. Get it from:

http://www.floola.com/modules/wiwimod/index.php?page=download_linux

Step 2. Before running make sure to install c++ standard library:

sudo apt-get install libstdc++5

Step 3. DONE!


3
Jun 08

Install Avant Window Navigator on Ubuntu Hardy Heron

add these two in /etc/apt/sources.list

deb http://ppa.launchpad.net/awn-core/ubuntu/ hardy main
deb-src http://ppa.launchpad.net/awn-core/ubuntu/ hardy main

sudo apt-get update

sudo apt-get install awn-manager-trunk awn-extras-applets-trunk


3
Jun 08

Install Opera in Ubuntu Hardy Heron

1. Add “deb http://archive.canonical.com/ubuntu feisty-commercial main” to /etc/apt/source.list

2. sudo apt-get update

3. sudo apt-get install opera