org.bbqjs.spring.debug
Class CSSCompilerServlet

java.lang.Object
  extended by org.bbqjs.spring.debug.CSSCompilerServlet

@Controller
public class CSSCompilerServlet
extends Object

Dynamically creates the CSS file with every request - meant for development and not recommended for production. Spring configuration example:


 <bean id="cssController" class="org.bbqjs.spring.debug.CSSCompilerServlet">
     <property name="pagePackage" value="${js.page.package}"/>
     <property name="path" value="/css"/>
     <property name="extension" value="less"/>
     <property name="includes">
         <list>
             <value>boilerplate.less</value>
             <value>common.less</value>
         </list>
     </property>
     <property name="sourceRoots">
         <list>
             <value>src/main/css</value>
         </list>
     </property>
 </bean>
 
The above example will respond to requests such as /css/generated/Home.less.


Constructor Summary
CSSCompilerServlet()
           
 
Method Summary
 void compileFile(javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response)
          The controller method.
 void setExtension(String extension)
          This is the requested file extension - defaults to css.
 void setIncludes(String[] includes)
          Specify any arbitrary files you want included at the top of the stylesheet.
 void setPagePackage(String pagePackage)
          The ${js.page.package} from your pom.
 void setPath(String path)
          This is the mount path of the controller.
 void setSourceRoots(String[] sourceRoots)
          Where to look for CSS files - a suggested value is "src/main/css".
 void setTheme(String theme)
          If a theme is used, pass in the name of the theme here.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

CSSCompilerServlet

public CSSCompilerServlet()
Method Detail

compileFile

@RequestMapping(method={POST,GET})
public void compileFile(javax.servlet.http.HttpServletRequest request,
                                       javax.servlet.http.HttpServletResponse response)
                 throws Exception
The controller method.

Parameters:
request -
response -
Throws:
Exception

setTheme

public void setTheme(String theme)
If a theme is used, pass in the name of the theme here.

Parameters:
theme -

setPath

public void setPath(String path)
This is the mount path of the controller. It is used to locate the relevant css document. If you send request to http://www.example.org/css/Home.css, this field should have the value "/css"

Parameters:
path -

setIncludes

public void setIncludes(String[] includes)
Specify any arbitrary files you want included at the top of the stylesheet.

Parameters:
includes -

setExtension

public void setExtension(String extension)
This is the requested file extension - defaults to css. If you request http://www.example.org/css/Home.less, this should be set to "less"

Parameters:
extension -

setPagePackage

public void setPagePackage(String pagePackage)
The ${js.page.package} from your pom. Maven should replace this at run/compile time.

Parameters:
pagePackage -

setSourceRoots

public void setSourceRoots(String[] sourceRoots)
Where to look for CSS files - a suggested value is "src/main/css".

Parameters:
sourceRoots -


Copyright © 2012. All Rights Reserved.