users@grizzly.java.net

Re: How to use EventResolver

From: Oleksiy Stashok <oleksiy.stashok_at_oracle.com>
Date: Tue, 21 Jun 2011 17:27:43 +0200

Hi,

currently this is used in http-server module.

class org.glassfish.grizzly.http.server.util.RequestUtils

     public static Object populateCertificateAttribute(final Request
request) {
         Object certificates = null;

         if (request.getRequest().isSecure()) {
             SSLFilter.CertificateEvent event = new
SSLFilter.CertificateEvent(true);
             try {
                 request.getContext().notifyDownstream(event);
             } catch (IOException ioe) {
                 if (LOGGER.isLoggable(Level.FINE)) {
                     LOGGER.log(Level.FINE, ioe.toString(), ioe);
                 }
             }
             certificates = event.getCertificates();
             request.setAttribute(SSLSupport.CERTIFICATE_KEY, certificates);
         }

         return certificates;
     }


You can try to make a similar notifyDownstream(...) call from the filter
next to SSLFilter to check how it works.

WBR,
Alexey.

On 06/21/2011 04:29 PM, yangjun2 wrote:
> Hi,
> When I debug SSLFilter handleEvent() method,but no hit it.
>
> @Override
> public NextAction handleEvent(FilterChainContext ctx, FilterChainEvent
> event) throws IOException {
> if (event.type() == CertificateEvent.TYPE) {
> final CertificateEvent ce = (CertificateEvent) event;
> ce.certs =
> getPeerCertificateChain(getSSLEngine(ctx.getConnection()),
> ctx,
> ce.needClientAuth);
> return ctx.getStopAction();
> }
> return ctx.getInvokeAction();
> }
>
> -----
> Best Regards.
> yangjun
> --
> View this message in context: http://grizzly.1045725.n5.nabble.com/How-to-use-EventResolver-tp4510665p4510797.html
> Sent from the Grizzly - Users mailing list archive at Nabble.com.