Hi Sebastien,
>
> TCPSelectorHandler tcpSelectorHandler = new TCPSelectorHandler(){
>
> public boolean onAcceptInterest(SelectionKey key,
> Context ctx) throws IOException {
>
> super.onAcceptInterest(key,ctx);
>
> // Add you code here :-)
>
> // try that..but wasn't able to get the socket client from the
> selectionKey
> ServerSocketChannel ssc =
> (ServerSocketChannel)key.channel();
>
> ssc.socket().getInetAddress();
>
> return false;
> }
> };
>
>
> but I don't know if I'm at the right place.
Please do this:
TCPSelectorHandler tcpSelectorHandler = new TCPSelectorHandler(){
public SelectableChannel acceptWithoutRegistration(SelectionKey
key)
throws IOException {
ServerSocketChannel server = (ServerSocketChannel)
key.channel();
SocketChannel channel = server.accept();
if (!checkAddress(channel.socket().getInetAddress())) {
closeChannel(channel);
return null;
}
return channel;;
}
>
>
> 2009/1/20 Jeanfrancois Arcand <Jeanfrancois.Arcand_at_sun.com>
> Salut,
>
>
> Oleksiy Stashok wrote:
> Hi,
>
> in Grizzly 2.0, Filters have possibility to handle ACCEPT, CONNECT,
> CLOSE events additionally to READ and WRITE. You can use it right
> now, but since Grizzly 2.0 is still in development - its API still
> is not stable.
> Please take a look at the following example [1], to see how it could
> be implemented.
>
> The problem is http is not implemented yet in 2.0, and based on this
> thread, http is required. I would think the SuspendableFilter is
> probably a good start as it can be shared with the http module
> easily using the
> SelectorThread
> .getSelectorHandler().getProtocolChainInstanceHandler(), and inject
> the Suspendable filter inside the ProtocolChain.
>
> A+
>
> -- Jeanfrancois
>
>
>
> Thanks.
>
> WBR,
> Alexey.
>
> [1] https://grizzly.dev.java.net/source/browse/grizzly/branches/2dot0/samples/framework-samples/src/main/java/org/glassfish/grizzly/samples/lifecycle/
>
> On Jan 19, 2009, at 19:09 , Jeanfrancois Arcand wrote:
>
> Salut,
>
> vijay phaneendra wrote:
> Hi
> I am able to get the client connection reference in the filter. The
> filter will be called after the message is formed by the protocol
> parser. I need to get a handle when the server does an ACCEPT from
> the client and before any bytes are read from the client.
>
> Just do something like that:
>
> TCPSelectorHandler sh = new TCPSelectorHandler(){
>
> @Override
> public boolean onAcceptInterest(SelectionKey key,
> Context ctx) throws IOException {
>
> super.onAcceptInterest(key,ctx);
>
> // Add you code here :-)
> }
>
> Let us know.
>
> -- Jeanfrancos
>
>
> Appreciate your help.
> Regards
> VP
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe_at_grizzly.dev.java.net
> For additional commands, e-mail: users-help_at_grizzly.dev.java.net
>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe_at_grizzly.dev.java.net
> For additional commands, e-mail: users-help_at_grizzly.dev.java.net
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe_at_grizzly.dev.java.net
> For additional commands, e-mail: users-help_at_grizzly.dev.java.net
>
>