org.cruxframework.crux.core.server.rest.spi
Class HttpResponse

java.lang.Object
  extended by org.cruxframework.crux.core.server.rest.spi.HttpResponse

public class HttpResponse
extends Object

Author:
Thiago da Rosa de Bustamante

Constructor Summary
HttpResponse(javax.servlet.http.HttpServletResponse response)
           
 
Method Summary
 void flushBuffer()
           
 void flushFileContent(String mimeType, String fileName, String fileContent)
          Flushes the response as a file.
 void flushFileContent(String mimeType, String charset, String fileName, String fileContent)
          Flushes the response as a file.
 HttpServletResponseHeaders getOutputHeaders()
           
 OutputStream getOutputStream()
           
 int getStatus()
           
 boolean isCommitted()
           
 void reset()
           
 void sendEmptyResponse()
           
 void sendError(int status, String message)
           
 void sendException(int status, String message)
           
 void sendRedirect(String location)
           
static String serializeException(String message)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

HttpResponse

public HttpResponse(javax.servlet.http.HttpServletResponse response)
Method Detail

getStatus

public int getStatus()

sendEmptyResponse

public void sendEmptyResponse()

flushFileContent

public void flushFileContent(String mimeType,
                             String fileName,
                             String fileContent)
                      throws IOException
Flushes the response as a file.

Parameters:
mimeType - the file mimeType.
fileName - the file name.
fileContent - the file content.
Throws:
IOException

flushFileContent

public void flushFileContent(String mimeType,
                             String charset,
                             String fileName,
                             String fileContent)
                      throws IOException
Flushes the response as a file.

Parameters:
mimeType - the file mimeType.
charset - the file charset.
fileName - the file name.
fileContent - the file content.
Throws:
IOException

getOutputHeaders

public HttpServletResponseHeaders getOutputHeaders()

getOutputStream

public OutputStream getOutputStream()
                             throws IOException
Throws:
IOException

sendError

public void sendError(int status,
                      String message)
               throws IOException
Throws:
IOException

sendException

public void sendException(int status,
                          String message)
                   throws IOException
Throws:
IOException

serializeException

public static String serializeException(String message)
                                 throws IOException
Throws:
IOException

sendRedirect

public void sendRedirect(String location)
                  throws IOException
Throws:
IOException
See Also:
response.sendRedirect(location);

isCommitted

public boolean isCommitted()

reset

public void reset()

flushBuffer

public void flushBuffer()
                 throws IOException
Throws:
IOException


Copyright © 2015. All rights reserved.