# web::WebRes

    sys::Obj
      sys::Virtual
        sys::OutStream
          web::WebRes

`public class WebRes`

WebRes models the response side of an HTTP transaction. All responses should be ordered as:

      1. res.writeStatus
      2. zero or more calls to res.writeHeader
      3. res.finishHeaders
      4. write body

bufLen

  `public static const define int bufLen`

service

  `public WebService service`

  Parent web service component

close

  `public override void close()`

encode64

  `public WebRes encode64(Buf b)`

  Print the buf contents using base64 encoding and return this.

esc

  `public WebRes esc(Str s)`

  Print the specified string escaping <, >, and & into the &lt;, &gt;, and &amp;

finishHeaders

  `public WebRes finishHeaders()`

  This call closes the header section and readys the output stream for the response content.

flush

  `public override void flush()`

html

  `public WebRes html()`

  Write out 200 OK status, text/html content type, and opening HTML markup.

htmlEnd

  `public WebRes htmlEnd()`

  Write closing HTML markup.

printDuration

  `public WebRes printDuration(long ticks)`

  Print duration in human readable form.

printElapsed

  `public WebRes printElapsed(long ticks)`

  Print elapsed duration from specified ticks to now.

printProp

  `public WebRes printProp(Component c, Slot prop)`

  Print the component's current value of the specified property.

spaces

  `public WebRes spaces(int num)`

  Print the specified number of spaces.

td

  `public WebRes td()`

  Write td start tag with no-wrap and left align.

th

  `public WebRes th(Str title)`

  Write th element with no-wrap and left align.

trTitle

  `public WebRes trTitle(Str title, int colspan)`

  Write a tr element with the specified colspan that can be used as a title header to separate rows.

w

  `public WebRes w(Str s)`

  Print the specified string and return this.

wi

  `public WebRes wi(int i)`

  Print the specified integer and return this.

write

  `public override bool write(int b)`

writeBytes

  `public override bool writeBytes(byte[] b, int off, int len)`

writeContentType

  `public WebRes writeContentType(Str val)`

  Convenience for writeHeader("Content-Type", val)

writeHeader

  `public WebRes writeHeader(Str name, Str val)`

  Write a header name/value pair. This call must be made between writeStatus() and finishHeaders().

writeStatus

  `public WebRes writeStatus(int status)`

  Write response status line with specified HTTP status code. This call must be the very first thing written.

writeStatusOk

  `public WebRes writeStatusOk()`

  Convenience for writeStatus(200)