gate.cow.jetty
Class SecureProxyConnector

java.lang.Object
  extended by org.mortbay.component.AbstractLifeCycle
      extended by org.mortbay.jetty.AbstractBuffers
          extended by org.mortbay.jetty.AbstractConnector
              extended by org.mortbay.jetty.nio.AbstractNIOConnector
                  extended by org.mortbay.jetty.nio.SelectChannelConnector
                      extended by gate.cow.jetty.SecureProxyConnector
All Implemented Interfaces:
org.mortbay.component.LifeCycle, org.mortbay.io.Buffers, org.mortbay.jetty.Connector, org.mortbay.jetty.nio.NIOConnector

public class SecureProxyConnector
extends org.mortbay.jetty.nio.SelectChannelConnector

Simple custom Jetty connector that speaks the normal HTTP protocol but pretends to be secure. It returns true from isConfidential(org.mortbay.jetty.Request) and isIntegral(org.mortbay.jetty.Request) and customizes the request to believe it is an HTTPS request. This connector is useful when you are running CoW behind an Apache proxy that handles HTTPS requests and thus don't want to have to handle encryption within CoW, but you still want to be able to use the web.xml security-constraint mechanism to redirect requests to the secure port where necessary. For such a scenario your Apache server would need to be set up to ProxyPass HTTP requests to the normal Grails port and HTTPS requests to the port on which this SecureProxyConnector is listening. The server.port.https system property should be set to the port on which the Apache HTTPS server is listening (typically 443), not the port on which this SecureProxyConnector is listening.


Nested Class Summary
 
Nested classes/interfaces inherited from class org.mortbay.jetty.nio.SelectChannelConnector
org.mortbay.jetty.nio.SelectChannelConnector.ConnectorEndPoint, org.mortbay.jetty.nio.SelectChannelConnector.RetryContinuation
 
Nested classes/interfaces inherited from interface org.mortbay.component.LifeCycle
org.mortbay.component.LifeCycle.Listener
 
Field Summary
 
Fields inherited from class org.mortbay.jetty.AbstractConnector
_lowResourceMaxIdleTime, _maxIdleTime, _soLingerTime
 
Fields inherited from class org.mortbay.jetty.AbstractBuffers
_loss
 
Fields inherited from class org.mortbay.component.AbstractLifeCycle
_listeners
 
Constructor Summary
SecureProxyConnector(int port)
          Create a SecureProxyConnector listening on the given port.
 
Method Summary
 void customize(org.mortbay.io.EndPoint ep, org.mortbay.jetty.Request r)
          Tell the request that it is being served over https.
 boolean isConfidential(org.mortbay.jetty.Request r)
          We are confidential.
 boolean isIntegral(org.mortbay.jetty.Request r)
          We are integral.
 
Methods inherited from class org.mortbay.jetty.nio.SelectChannelConnector
accept, close, doStart, doStop, getConnection, getDelaySelectKeyUpdate, getLocalPort, getLowResourcesConnections, getLowResourcesMaxIdleTime, newConnection, newContinuation, newEndPoint, open, persist, setDelaySelectKeyUpdate, setLowResourceMaxIdleTime, setLowResourcesConnections, setLowResourcesMaxIdleTime, setMaxIdleTime
 
Methods inherited from class org.mortbay.jetty.nio.AbstractNIOConnector
getUseDirectBuffers, newBuffer, setUseDirectBuffers
 
Methods inherited from class org.mortbay.jetty.AbstractConnector
checkForwardedHeaders, configure, connectionClosed, connectionOpened, getAcceptorPriorityOffset, getAcceptors, getAcceptQueueSize, getConfidentialPort, getConfidentialScheme, getConnections, getConnectionsDurationAve, getConnectionsDurationMax, getConnectionsDurationMin, getConnectionsDurationTotal, getConnectionsOpen, getConnectionsOpenMax, getConnectionsOpenMin, getConnectionsRequestsAve, getConnectionsRequestsMax, getConnectionsRequestsMin, getForwardedForHeader, getForwardedHostHeader, getForwardedServerHeader, getHost, getHostHeader, getIntegralPort, getIntegralScheme, getLeftMostValue, getLowResourceMaxIdleTime, getMaxIdleTime, getName, getPort, getRequests, getResolveNames, getReuseAddress, getServer, getSoLingerTime, getStatsOn, getStatsOnMs, getThreadPool, isForwarded, join, setAcceptorPriorityOffset, setAcceptors, setAcceptQueueSize, setConfidentialPort, setConfidentialScheme, setForwarded, setForwardedForHeader, setForwardedHostHeader, setForwardedServerHeader, setHost, setHostHeader, setIntegralPort, setIntegralScheme, setName, setPort, setResolveNames, setReuseAddress, setServer, setSoLingerTime, setStatsOn, setThreadPool, statsReset, stopAccept, toString
 
Methods inherited from class org.mortbay.jetty.AbstractBuffers
getBuffer, getHeaderBufferSize, getRequestBufferSize, getResponseBufferSize, returnBuffer, setHeaderBufferSize, setRequestBufferSize, setResponseBufferSize
 
Methods inherited from class org.mortbay.component.AbstractLifeCycle
addLifeCycleListener, isFailed, isRunning, isStarted, isStarting, isStopped, isStopping, removeLifeCycleListener, start, stop
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface org.mortbay.jetty.Connector
getHeaderBufferSize, getRequestBufferSize, getResponseBufferSize, setHeaderBufferSize, setRequestBufferSize, setResponseBufferSize
 
Methods inherited from interface org.mortbay.component.LifeCycle
addLifeCycleListener, isFailed, isRunning, isStarted, isStarting, isStopped, isStopping, removeLifeCycleListener, start, stop
 
Methods inherited from interface org.mortbay.io.Buffers
getBuffer, returnBuffer
 

Constructor Detail

SecureProxyConnector

public SecureProxyConnector(int port)
Create a SecureProxyConnector listening on the given port.

Method Detail

customize

public void customize(org.mortbay.io.EndPoint ep,
                      org.mortbay.jetty.Request r)
               throws IOException
Tell the request that it is being served over https.

Specified by:
customize in interface org.mortbay.jetty.Connector
Overrides:
customize in class org.mortbay.jetty.nio.SelectChannelConnector
Throws:
IOException

isConfidential

public boolean isConfidential(org.mortbay.jetty.Request r)
We are confidential.

Specified by:
isConfidential in interface org.mortbay.jetty.Connector
Overrides:
isConfidential in class org.mortbay.jetty.AbstractConnector

isIntegral

public boolean isIntegral(org.mortbay.jetty.Request r)
We are integral.

Specified by:
isIntegral in interface org.mortbay.jetty.Connector
Overrides:
isIntegral in class org.mortbay.jetty.AbstractConnector