org.mortbay.http.ajp

Class AJP13Connection

Implemented Interfaces:
OutputObserver

public class AJP13Connection
extends HttpConnection

Version:
$Id: AJP13Connection.java,v 1.34 2005/12/16 02:47:12 gregwilkins Exp $
Author:
Greg Wilkins (gregw)

Field Summary

Fields inherited from class org.mortbay.http.HttpConnection

_dotVersion, _keepAlive, _persistent, _request, _response

Fields inherited from interface org.mortbay.util.OutputObserver

__CLOSED, __CLOSING, __COMMITING, __FIRST_WRITE, __RESET_BUFFER

Constructor Summary

AJP13Connection(AJP13Listener listener, InputStream in, OutputStream out, Socket socket, int bufferSize)

Method Summary

protected void
commit()
void
destroy()
Destroy the connection.
protected void
firstWrite()
Setup the reponse output stream.
String
getDefaultScheme()
Get the listeners Default scheme.
String
getRemoteAddr()
Get the Remote address.
String
getRemoteHost()
Get the Remote address.
InetAddress
getRemoteInetAddress()
Get the Remote address.
String
getServerName()
Get the listeners HttpServer .
int
getServerPort()
Get the listeners Port .
boolean
handleNext()
Handle next request off the connection.
boolean
isSSL()
protected void
setupOutputStream()

Methods inherited from class org.mortbay.http.HttpConnection

associateThread, close, commit, destroy, disassociateThread, firstWrite, forceClose, getConnection, getDefaultScheme, getHttpServer, getHttpTunnel, getInputStream, getListener, getObject, getOutputStream, getRemoteAddr, getRemoteHost, getRemoteInetAddress, getRemotePort, getRequest, getResponse, getServerAddr, getServerName, getServerPort, handle, handleNext, isThrottled, outputNotify, readRequest, recycle, service, setHttpTunnel, setObject, setThrottled, statsRequestEnd, statsRequestStart

Constructor Details

AJP13Connection

public AJP13Connection(AJP13Listener listener,
                       InputStream in,
                       OutputStream out,
                       Socket socket,
                       int bufferSize)
            throws IOException

Method Details

commit

protected void commit()
            throws IOException
Overrides:
commit in interface HttpConnection

destroy

public void destroy()
Destroy the connection. called by handle when handleNext returns false.
Overrides:
destroy in interface HttpConnection

firstWrite

protected void firstWrite()
            throws IOException
Setup the reponse output stream. Use the current state of the request and response, to set tranfer parameters such as chunking and content length.
Overrides:
firstWrite in interface HttpConnection

getDefaultScheme

public String getDefaultScheme()
Get the listeners Default scheme. Conveniance method equivalent to getListener().getDefaultProtocol().
Overrides:
getDefaultScheme in interface HttpConnection
Returns:
HttpServer.

getRemoteAddr

public String getRemoteAddr()
Get the Remote address.
Overrides:
getRemoteAddr in interface HttpConnection
Returns:
the remote host name

getRemoteHost

public String getRemoteHost()
Get the Remote address.
Overrides:
getRemoteHost in interface HttpConnection
Returns:
the remote host name

getRemoteInetAddress

public InetAddress getRemoteInetAddress()
Get the Remote address.
Overrides:
getRemoteInetAddress in interface HttpConnection
Returns:
the remote address

getServerName

public String getServerName()
Get the listeners HttpServer . Conveniance method equivalent to getListener().getHost().
Overrides:
getServerName in interface HttpConnection
Returns:
HttpServer.

getServerPort

public int getServerPort()
Get the listeners Port . Conveniance method equivalent to getListener().getPort().
Overrides:
getServerPort in interface HttpConnection
Returns:
HttpServer.

handleNext

public boolean handleNext()
Handle next request off the connection. The service(request,response) method is called by handle to service each request received on the connection. If the thread is a PoolThread, the thread is set as inactive when waiting for a request.

If a HttpTunnel has been set on this connection, it's handle method is called and when that completes, false is return from this method.

The Connection is set as a ThreadLocal of the calling thread and is available via the getHttpConnection() method.

Overrides:
handleNext in interface HttpConnection
Returns:
true if the connection is still open and may provide more requests.

isSSL

public boolean isSSL()

setupOutputStream

protected void setupOutputStream()
            throws IOException

Copyright © 2004 Mortbay Consulting Pty. Ltd. All Rights Reserved.