Skip to content

Instantly share code, notes, and snippets.

@rei999
rei999 / gist:4231245
Created December 7, 2012 06:37
Redirect from naked domain to www subdomain
<IfModule mod_rewrite.c>
RewriteEngine On
### re-direct to www
RewriteCond %{HTTP_HOST} ^example.com
RewriteRule (.*) http://www.example.com/$1 [R=301,L]
</IfModule>
@rei999
rei999 / gist:4235129
Created December 7, 2012 18:03
SCP to download files through a terminal
scp -i {key} {user}@{domain}:{remote_path} {local_path}
@rei999
rei999 / gist:4574775
Created January 19, 2013 20:06
Spring App Engine web.xml
<servlet>
<servlet-name>spring-mvc</servlet-name>
<servlet-class>
org.springframework.web.servlet.DispatcherServlet
</servlet-class>
<load-on-startup>1</load-on-startup>
</servlet>
<servlet-mapping>
<servlet-name>spring-mvc</servlet-name>
@rei999
rei999 / gist:4574825
Created January 19, 2013 20:13
sample spring-mvc-servlet
<bean id="VideoController" class="com.yourcompanyname.controller.HelloController" />
<bean id="viewResolver"
class="org.springframework.web.servlet.view.InternalResourceViewResolver">
<property name="prefix">
<value>/views/</value>
</property>
<property name="suffix">
<value>.jsp</value>
</property>
@rei999
rei999 / gist:4574829
Created January 19, 2013 20:15
sample hello spring controller
package com.yournamespace.controller;
import org.springframework.stereotype.Controller;
import org.springframework.ui.ModelMap;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
@RequestMapping(value="/hello")
public class HelloContoller {
@rei999
rei999 / gist:4574840
Created January 19, 2013 20:18
spring velocity sitemesh
<servlet>
<servlet-name>sitemesh-velocity</servlet-name>
<servlet-class>com.opensymphony.module.sitemesh.velocity.VelocityDecoratorServlet</servlet-class>
</servlet>
<servlet-mapping>
<servlet-name>sitemesh-velocity</servlet-name>
<url-pattern>*.vm</url-pattern>
</servlet-mapping>
@rei999
rei999 / gist:4577439
Created January 20, 2013 09:20
spring sitemesh velocity
<filter>
<filter-name>sitemesh</filter-name>
<filter-class>com.opensymphony.sitemesh.webapp.SiteMeshFilter</filter-class>
</filter>
<filter-mapping>
<filter-name>sitemesh</filter-name>
<url-pattern>/*</url-pattern>
<dispatcher>FORWARD</dispatcher>
<dispatcher>REQUEST</dispatcher>
@rei999
rei999 / gist:4577444
Created January 20, 2013 09:22
velocity in servlet config
<bean id="velocityConfig"
class="org.springframework.web.servlet.view.velocity.VelocityConfigurer">
<property name="resourceLoaderPath" value="/velocity" />
</bean>
<bean id="viewResolver"
class="org.springframework.web.servlet.view.velocity.VelocityViewResolver">
<property name="cache" value="false" />
<property name="prefix" value="" />
<property name="suffix" value=".vm" />
@rei999
rei999 / gist:4577450
Created January 20, 2013 09:23
sitemesh.xml
<sitemesh>
<property name="decorators-file" value="/WEB-INF/decorators.xml"/>
<excludes file="${decorators-file}"/>
<page-parsers>
<parser default="true"
class="com.opensymphony.module.sitemesh.parser.FastPageParser"/>
<parser content-type="text/html"
class="com.opensymphony.module.sitemesh.parser.FastPageParser"/>
</page-parsers>
@rei999
rei999 / gist:4577457
Created January 20, 2013 09:25
sample SiteMesh decorator
<?xml version="1.0" encoding="UTF-8"?>
<decorators defaultdir="/decorators">
<decorator name="default" page="layout.vm">
<pattern>/*</pattern>
</decorator>
</decorators>