com.day.cq.widget.impl
Class HtmlLibrary

java.lang.Object
  extended by com.day.cq.widget.impl.HtmlLibrary

public class HtmlLibrary
extends Object

The HtmlLibrary manages the client lib (js/css) in order to deliver always the up to date library. The generated library is saved in the /tmp folder (where everyone has rw access)


Field Summary
static String TMP_LOCATION
          client lib tmp space
 
Constructor Summary
HtmlLibrary(org.apache.sling.api.resource.Resource resource, org.apache.sling.jcr.api.SlingRepository repository)
           
 
Method Summary
 void build()
          This method manages the library build process
 void copy(org.apache.sling.api.SlingHttpServletResponse response)
          Is copying the input stream of the generated lib to the output stream of it's response object and sets the Last-Modified header
 HtmlLibraryBuilder getBuilder()
          Returns the approprate builder
 List<org.apache.sling.api.resource.Resource> getFiles()
          Get all files
 List<org.apache.sling.api.resource.Resource> getFiles(org.apache.sling.api.resource.Resource resource, List<org.apache.sling.api.resource.Resource> scriptList)
          All files are retourned for concatenation or debugging that belong to the respective client library.
 InputStream getInputStream()
          Returns the input stream of the generated lib file
 long getLastModified()
          Returns the lastModified date of the generated lib
 String getScripts(String delimiter)
           
 long getScriptsLastModified()
          Searches the "youngest" script and returns its last modified date
 boolean isDoGzip()
           
 boolean isDoMinify()
           
 void setDoGzip(boolean doGzip)
           
 void setDoMinify(boolean doMinify)
           
 boolean upToDate()
          Checks if generated file is still up to date
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

TMP_LOCATION

public static String TMP_LOCATION
client lib tmp space

Constructor Detail

HtmlLibrary

public HtmlLibrary(org.apache.sling.api.resource.Resource resource,
                   org.apache.sling.jcr.api.SlingRepository repository)
Method Detail

upToDate

public boolean upToDate()
Checks if generated file is still up to date

Returns:
true if up to date

isDoGzip

public boolean isDoGzip()

setDoGzip

public void setDoGzip(boolean doGzip)

isDoMinify

public boolean isDoMinify()

setDoMinify

public void setDoMinify(boolean doMinify)

getScriptsLastModified

public long getScriptsLastModified()
Searches the "youngest" script and returns its last modified date

Returns:
last modified date as long

getLastModified

public long getLastModified()
Returns the lastModified date of the generated lib

Returns:
last modified date as long

copy

public void copy(org.apache.sling.api.SlingHttpServletResponse response)
          throws IOException
Is copying the input stream of the generated lib to the output stream of it's response object and sets the Last-Modified header

Parameters:
response - servlet response
Throws:
IOException - is thrown in case the copy operation failes

getInputStream

public InputStream getInputStream()
Returns the input stream of the generated lib file

Returns:
input stream

build

public void build()
           throws IOException,
                  RepositoryException
This method manages the library build process

Throws:
IOException
RepositoryException

getBuilder

public HtmlLibraryBuilder getBuilder()
Returns the approprate builder

Returns:
the approprate builder

getFiles

public List<org.apache.sling.api.resource.Resource> getFiles()
Get all files

Returns:
list of files

getFiles

public List<org.apache.sling.api.resource.Resource> getFiles(org.apache.sling.api.resource.Resource resource,
                                                             List<org.apache.sling.api.resource.Resource> scriptList)
All files are retourned for concatenation or debugging that belong to the respective client library. .

Parameters:
resource -
scriptList -
Returns:

getScripts

public String getScripts(String delimiter)


Copyright © 2008 Day Management AG. All Rights Reserved.