org.plovr.io
Class Responses

java.lang.Object
  extended by org.plovr.io.Responses

public final class Responses
extends Object


Method Summary
static void redirect(com.sun.net.httpserver.HttpExchange exchange, String uri)
           
static void writeHtml(String html, com.sun.net.httpserver.HttpExchange exchange)
           
static void writeJs(String js, Config config, com.sun.net.httpserver.HttpExchange exchange)
          Writes a 200 response with the specified JavaScript content using the appropriate headers and character encoding.
static void writePlainText(String text, com.sun.net.httpserver.HttpExchange exchange)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

writeJs

public static void writeJs(String js,
                           Config config,
                           com.sun.net.httpserver.HttpExchange exchange)
                    throws IOException
Writes a 200 response with the specified JavaScript content using the appropriate headers and character encoding. Once this method is called, nothing else may be written as it closes the response.

Parameters:
js - The JavaScript code to write to the response.
exchange - to which the response will be written -- no content may have been written to its response yet as this method sets headers
Throws:
IOException

writePlainText

public static void writePlainText(String text,
                                  com.sun.net.httpserver.HttpExchange exchange)
                           throws IOException
Throws:
IOException

writeHtml

public static void writeHtml(String html,
                             com.sun.net.httpserver.HttpExchange exchange)
                      throws IOException
Throws:
IOException

redirect

public static void redirect(com.sun.net.httpserver.HttpExchange exchange,
                            String uri)
                     throws IOException
Throws:
IOException