< prev index next >

src/jdk.httpserver/share/classes/com/sun/net/httpserver/HttpExchange.java

Print this page




 156      * @return the stream to which the response body is written
 157      */
 158     public abstract OutputStream getResponseBody () ;
 159 
 160 
 161     /**
 162      * Starts sending the response back to the client using the current set of response headers
 163      * and the numeric response code as specified in this method. The response body length is also specified
 164      * as follows. If the response length parameter is greater than zero, this specifies an exact
 165      * number of bytes to send and the application must send that exact amount of data.
 166      * If the response length parameter is {@code zero}, then chunked transfer encoding is
 167      * used and an arbitrary amount of data may be sent. The application terminates the
 168      * response body by closing the OutputStream. If response length has the value {@code -1}
 169      * then no response body is being sent.
 170      * <p>
 171      * If the content-length response header has not already been set then
 172      * this is set to the appropriate value depending on the response length parameter.
 173      * <p>
 174      * This method must be called prior to calling {@link #getResponseBody()}.
 175      * @param rCode the response code to send
 176      * @param responseLength if > 0, specifies a fixed response body length
 177      *        and that exact number of bytes must be written
 178      *        to the stream acquired from getResponseBody(), or else
 179      *        if equal to 0, then chunked encoding is used,
 180      *        and an arbitrary number of bytes may be written.
 181      *        if <= -1, then no response body length is specified and
 182      *        no response body may be written.
 183      * @see HttpExchange#getResponseBody()
 184      */
 185     public abstract void sendResponseHeaders (int rCode, long responseLength) throws IOException ;
 186 
 187     /**
 188      * Returns the address of the remote entity invoking this request
 189      * @return the InetSocketAddress of the caller
 190      */
 191     public abstract InetSocketAddress getRemoteAddress ();
 192 
 193     /**
 194      * Returns the response code, if it has already been set
 195      * @return the response code, if available. {@code -1} if not available yet.
 196      */
 197     public abstract int getResponseCode ();
 198 
 199     /**
 200      * Returns the local address on which the request was received
 201      * @return the InetSocketAddress of the local interface




 156      * @return the stream to which the response body is written
 157      */
 158     public abstract OutputStream getResponseBody () ;
 159 
 160 
 161     /**
 162      * Starts sending the response back to the client using the current set of response headers
 163      * and the numeric response code as specified in this method. The response body length is also specified
 164      * as follows. If the response length parameter is greater than zero, this specifies an exact
 165      * number of bytes to send and the application must send that exact amount of data.
 166      * If the response length parameter is {@code zero}, then chunked transfer encoding is
 167      * used and an arbitrary amount of data may be sent. The application terminates the
 168      * response body by closing the OutputStream. If response length has the value {@code -1}
 169      * then no response body is being sent.
 170      * <p>
 171      * If the content-length response header has not already been set then
 172      * this is set to the appropriate value depending on the response length parameter.
 173      * <p>
 174      * This method must be called prior to calling {@link #getResponseBody()}.
 175      * @param rCode the response code to send
 176      * @param responseLength if {@literal > 0}, specifies a fixed response
 177      *        body length and that exact number of bytes must be written
 178      *        to the stream acquired from getResponseBody(), or else
 179      *        if equal to 0, then chunked encoding is used,
 180      *        and an arbitrary number of bytes may be written.
 181      *        if {@literal <= -1}, then no response body length is specified and
 182      *        no response body may be written.
 183      * @see HttpExchange#getResponseBody()
 184      */
 185     public abstract void sendResponseHeaders (int rCode, long responseLength) throws IOException ;
 186 
 187     /**
 188      * Returns the address of the remote entity invoking this request
 189      * @return the InetSocketAddress of the caller
 190      */
 191     public abstract InetSocketAddress getRemoteAddress ();
 192 
 193     /**
 194      * Returns the response code, if it has already been set
 195      * @return the response code, if available. {@code -1} if not available yet.
 196      */
 197     public abstract int getResponseCode ();
 198 
 199     /**
 200      * Returns the local address on which the request was received
 201      * @return the InetSocketAddress of the local interface


< prev index next >