Some content

Java Snow Application Setup

Fastest way to start and understand Snow is to look at the sampleBookmarks application.

For advanced Snow developers, here are two ways to start your Snow project quickly.

From snowStarter

From https://github.com/BriteSnow/snowStarter which is a

Clone it

$ git clone git://github.com/BriteSnow/snowStarter.git

Build it

$ cd snowStarter  
snowStarter/$ mvn clean package  

Run it

snowStarter/$ mvn jetty:run  

And open http://localhost:8080/

Setup eclipse (optional)

Assuming you have setup Eclipse to work with Maven, you can do the following to set the eclipse dependencies.

snowStarter/$ mvn eclipse:eclipse  

From scratch (using Maven)

/pom.xml

<dependency>
  <groupId>com.britesnow</groupId>
  <artifactId>snow</artifactId>
  <version>2.0.6</version>
</dependency>  

/WEB-INF/snow.properties

# The Application Guice Modules (1 or more, comma seperated)
snow.webApplicationModules=com.example.myapp.MyAppModule

# TODO: need to change the "com.example.starter.MyAppModule" to the application package 
#       and application module class name. 


# NOTE: Any property in this file can be injected via Google using 
#        @Named(propertyName)String propertyValue
# So, if we have here: 
# myApp.prop1=value1
# Then, in any Guice managed class, we can have
# @Inject
# private @Named(myApp.prop1) String value

Tap For More Info

/WEB-INF/web.xml

<web-app id="WebApp_ID" version="2.4" 
    xmlns="http://java.sun.com/xml/ns/j2ee" 
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" 
    xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd">

  <!-- Note: Snow takes all request to provide full customizability,
  performance impact is negligeable, and flexibility (including performance
  optimization) is maximized. So, at the end, this approach will boost
  your application performance significantly without having to learn tomcat 
  or other container proprietary optimization tricks -->
  
  <!-- Note: Same web.xml for all applications... the simpler the better -->
  
  <display-name>
    SnowApplication
  </display-name>
  <servlet>
    <servlet-name>
      snowServlet
    </servlet-name>
    <servlet-class>
      com.britesnow.snow.web.SnowServlet
    </servlet-class>
  </servlet>
  <servlet-mapping>
    <servlet-name>
      snowServlet
    </servlet-name>
    <url-pattern>/</url-pattern>
  </servlet-mapping>
</web-app>

Tap For More Info