org.loom.tags.core
Class AbstractWebResourceTag

java.lang.Object
  extended by javax.servlet.jsp.tagext.SimpleTagSupport
      extended by org.loom.tags.AbstractTag
          extended by org.loom.tags.core.AbstractWebResourceTag
All Implemented Interfaces:
javax.servlet.jsp.tagext.DynamicAttributes, javax.servlet.jsp.tagext.JspTag, javax.servlet.jsp.tagext.SimpleTag, LoomTag, ParameterContainer
Direct Known Subclasses:
CssTag, ScriptTag

public abstract class AbstractWebResourceTag
extends AbstractTag
implements ParameterContainer

Tag that creates a link to a script or css file. There are two common uses for this tag: <l:script src="/js/myfile.js"/> This tag will create a normal script tag, pointing to the specified resource with the webapp prefix prepended. <l:script resource="resource_path"/> When specifying the resource, it will use a resource bundle configured using spring.


Field Summary
static java.lang.Integer IE_ANY
          include the library with any version of IE
protected  WebResourceBundleRepository webResourceBundleRepository
           
 
Fields inherited from class org.loom.tags.AbstractTag
expressionLanguageProxy, loomServletRequestFactory, out, repository, request, response
 
Constructor Summary
AbstractWebResourceTag()
           
 
Method Summary
 AbstractWebResourceTag addParameter(java.lang.String name, java.lang.Object value)
          Adds a parameter to the resulting url
 void doTagImpl()
          The method that must be implemented by the child class
protected  void endTag()
          Does the tag cleanup, if any.
protected  java.lang.String getContents()
           
 java.lang.String getResource()
           
protected  java.lang.String getType()
           
 UrlBuilder getUrl()
           
protected  UrlBuilder getUrlBuilder()
           
protected  void initTag()
          Initializes the tag attributes
abstract  void printTag()
          print just the tag
 void setAction(java.lang.String action)
          The Action to invoke.
 void setEvent(java.lang.String event)
          The Event to invoke.
 void setHostname(java.lang.String serverName)
          The server name to use.
 void setIeLessThan(java.lang.String ie)
           
 void setMapping(java.lang.String mapping)
          The mapping as action.event.
 void setPort(java.lang.Integer port)
          The port to use.
protected  void setRawUrl(java.lang.String rawUrl)
           
 void setRelative(boolean relative)
          true if the url is relative (do not render schema, server or port), false to render a full URL.
 void setRequest(LoomServletRequest request)
           
 void setResource(java.lang.String resourceName)
           
 void setScheme(java.lang.String scheme)
          The scheme to use.
protected  void setType(java.lang.String type)
           
 void setUrl(UrlBuilder url)
           
 
Methods inherited from class org.loom.tags.AbstractTag
createWriterWrapper, doBody, doBufferedBody, doTag, evaluateExpression, getActionProperty, getAncestorWithClass, getBufferedBody, getExtendedAttributes, getMessagesRepository, getPageContext, getRequest, getResponse, getScopedAttribute, getWriter, printParentAttributes, removeScopedAttribute, setDynamicAttribute, setExtendedAttribute, setJspContext, setResponse, setScopedAttribute, setWriter
 
Methods inherited from class javax.servlet.jsp.tagext.SimpleTagSupport
findAncestorWithClass, getJspBody, getJspContext, getParent, setJspBody, setParent
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

webResourceBundleRepository

@Inject
protected WebResourceBundleRepository webResourceBundleRepository

IE_ANY

public static final java.lang.Integer IE_ANY
include the library with any version of IE

Constructor Detail

AbstractWebResourceTag

public AbstractWebResourceTag()
Method Detail

setRequest

public void setRequest(LoomServletRequest request)
Overrides:
setRequest in class AbstractTag

initTag

protected void initTag()
Description copied from class: AbstractTag
Initializes the tag attributes

Overrides:
initTag in class AbstractTag

doTagImpl

public void doTagImpl()
               throws javax.servlet.jsp.JspException,
                      java.io.IOException
Description copied from class: AbstractTag
The method that must be implemented by the child class

Specified by:
doTagImpl in class AbstractTag
Throws:
javax.servlet.jsp.JspException
java.io.IOException

printTag

public abstract void printTag()
                       throws javax.servlet.jsp.JspException,
                              java.io.IOException
print just the tag

Throws:
javax.servlet.jsp.JspException
java.io.IOException

endTag

protected void endTag()
Description copied from class: AbstractTag
Does the tag cleanup, if any.

Overrides:
endTag in class AbstractTag

getContents

protected java.lang.String getContents()

setAction

@Attribute
public void setAction(java.lang.String action)
The Action to invoke. If specified, the link will be calculated using the action/event pair.

Parameters:
action - The unqualified action name, with the "Action" suffix removed. The fully qualified class name can also be used.

setEvent

@Attribute
public void setEvent(java.lang.String event)
The Event to invoke. If specified, the link will be calculated using the action/event pair. Any not-null nested param tag or param- prefixed attribute will be appended.


setMapping

@Attribute
public void setMapping(java.lang.String mapping)
The mapping as action.event. This method is equivalent to setting action and event separately.


setRelative

@Attribute
public void setRelative(boolean relative)
true if the url is relative (do not render schema, server or port), false to render a full URL. Default is true


setScheme

@Attribute
public void setScheme(java.lang.String scheme)
The scheme to use. If not specified, the current request scheme will be used.

Parameters:
scheme - the scheme to use. Examples are: "http", "https"

setHostname

@Attribute
public void setHostname(java.lang.String serverName)
The server name to use. If not specified, the current request.getServerName() value will be used.


setPort

@Attribute
public void setPort(java.lang.Integer port)
The port to use. If not specified, the current request port will be used.

Parameters:
port - the port to use. Examples are: 80, 443

setResource

public void setResource(java.lang.String resourceName)

addParameter

public AbstractWebResourceTag addParameter(java.lang.String name,
                                           java.lang.Object value)
Description copied from interface: ParameterContainer
Adds a parameter to the resulting url

Specified by:
addParameter in interface ParameterContainer
Parameters:
name - the name of the parameter
value - the value of the parameter
Returns:
the same instance of ParameterContainer, to allow nested calls.

setIeLessThan

public void setIeLessThan(java.lang.String ie)

setRawUrl

protected void setRawUrl(java.lang.String rawUrl)

getUrl

public UrlBuilder getUrl()

setUrl

public void setUrl(UrlBuilder url)

getResource

public java.lang.String getResource()

getType

protected java.lang.String getType()

setType

protected void setType(java.lang.String type)

getUrlBuilder

protected UrlBuilder getUrlBuilder()