Jump to content

Erlang Programming/Creating Web Applications with yaws/Out function

From Wikibooks, open books for an open world

The out/1 function is called by Yaws as an entering point in any module that the author of a web application has written.

The applied argument supplied to out/1 is the arg data structure, this record contains the data of the request made to Yaws that resulted in the out/1 function call.

Yaws parses the returning value of the out/1 function and takes the appropriate action depending on the returning value, hence there is only a certain number of valid return values that can be sent from out/1

      {html, DeepList}
      {ehtml, Term}
      {content, MimeType, Content}
      {streamcontent, MimeType, FirstChunk}
      {streamcontent_with_timeout, MimeType, FirstChunk, Timeout}
      {header, H}
             {connection, What}
             {location, Url}
             {cache_control, What}
             {set_cookie, Cookie}
             {content_type, MimeType}
             {content_length, Len}
             {header, "My-X-Header: gadong"}
      {allheaders, HeaderList}
      {status, Code}
      break
      ok
      {redirect, Url}
      {redirect_local, Path}
      {get_more, Cont, State}
      {page, Page}
      {page, {Options, Page}}
      {ssi, File, Delimiter, Bindings}
      {bindings, [{Key1, Value2}, {Key2, Value2} .....]}
      {yssi, YawsFile}
      [ListOfValues]