org.loom.resolution
Class HtmlResolution

java.lang.Object
  extended by org.loom.resolution.AbstractHttpResolution
      extended by org.loom.resolution.HtmlResolution
All Implemented Interfaces:
CacheableResolution, HttpResolution, Resolution

public class HtmlResolution
extends AbstractHttpResolution

A Resolution class to compose HTML by hand.


Constructor Summary
HtmlResolution()
           
 
Method Summary
 HtmlResolution end(java.lang.String tag)
           
 HtmlResolution endJavascript()
          Write a javascript end tag
 java.lang.String getContents()
           
 StringWriterWrapper getWriterWrapper()
           
 HtmlResolution print(java.lang.CharSequence seq)
          Print text
 HtmlResolution printAttribute(java.lang.String name, java.lang.Object value)
          Print an attribute, if its value is not null.
 HtmlResolution printHiddenField(java.lang.String name, java.lang.String value)
          Print a input type="hidden" field
 void resolve(LoomServletRequest request, LoomServletResponse response)
          Write the response contents
 HtmlResolution start(java.lang.String tag, java.lang.Object... attributes)
           
 HtmlResolution startEnd(java.lang.String tag, java.lang.Object... attributes)
           
 HtmlResolution startJavascript()
          Write a javascript start tag
 
Methods inherited from class org.loom.resolution.AbstractHttpResolution
addCookie, addCookie, addCookie, addDateHeader, addHeader, addIntHeader, containsHeader, getCacheControl, getCharset, getContentType, setCacheControl, setCharset, setContentType, setDateHeader, setDateHeaderIfNotPresent, setHeader, setHeaderIfNotPresent, setIntHeader, setIntHeaderIfNotPresent, setJsonHeader, writeHeaders
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

HtmlResolution

public HtmlResolution()
Method Detail

resolve

public void resolve(LoomServletRequest request,
                    LoomServletResponse response)
             throws java.io.IOException,
                    javax.servlet.ServletException
Description copied from interface: Resolution
Write the response contents

Specified by:
resolve in interface Resolution
Specified by:
resolve in class AbstractHttpResolution
Parameters:
request - the current request object
response - the current response object
Throws:
java.io.IOException
javax.servlet.ServletException

print

public HtmlResolution print(java.lang.CharSequence seq)
                     throws java.io.IOException
Print text

Parameters:
seq - the text to print
Returns:
this same instance
Throws:
java.io.IOException

printAttribute

public HtmlResolution printAttribute(java.lang.String name,
                                     java.lang.Object value)
                              throws java.io.IOException
Print an attribute, if its value is not null. Else, does nothing

Parameters:
name - the name of the attribute
value - the value of the attribute that will be printed (invoking toString())
Returns:
this same instance
Throws:
java.io.IOException

printHiddenField

public HtmlResolution printHiddenField(java.lang.String name,
                                       java.lang.String value)
                                throws java.io.IOException
Print a input type="hidden" field

Parameters:
name - the name of the field
value - the value that will be printed (invoking toString())
Returns:
this same instance
Throws:
java.io.IOException

startJavascript

public HtmlResolution startJavascript()
                               throws java.io.IOException
Write a javascript start tag

Throws:
java.io.IOException

endJavascript

public HtmlResolution endJavascript()
                             throws java.io.IOException
Write a javascript end tag

Throws:
java.io.IOException

start

public HtmlResolution start(java.lang.String tag,
                            java.lang.Object... attributes)
                     throws java.io.IOException
Throws:
java.io.IOException
See Also:
WriterWrapper.start(String, Object...)

startEnd

public HtmlResolution startEnd(java.lang.String tag,
                               java.lang.Object... attributes)
                        throws java.io.IOException
Throws:
java.io.IOException
See Also:
WriterWrapper.startEnd(String, Object...)

end

public HtmlResolution end(java.lang.String tag)
                   throws java.io.IOException
Throws:
java.io.IOException
See Also:
WriterWrapper.end(String)

getContents

public java.lang.String getContents()
Returns:
the contents of this resolution object, as String

getWriterWrapper

public StringWriterWrapper getWriterWrapper()