Start line:  
End line:  

Snippet Preview

Snippet HTML Code

Stack Overflow Questions
Copyright (c) 2014 Red Hat, Inc.. All rights reserved. This program and the accompanying materials are made available under the terms of the GNU Public License v3.0 which accompanies this distribution, and is available at http://www.gnu.org/licenses/gpl.html Contributors: Red Hat, Inc. - initial API and implementation /
 
 package org.commonjava.aprox.core.bind.vertx;
 
 import java.util.List;
 import java.util.Map;
 import java.util.Set;
 
 
 
 @Named"rest" )
 public class RestRouter
     extends AproxRouter
 {
 
     private static final Map<StringStringROUTE_ALIASES = Collections.unmodifiableMapnew HashMap<StringString>()
     {
         {
             put"/1.0/""/" );
         }
 
         private static final long serialVersionUID = 1L;
     } );
 
     public static final String PREFIX = "/api";
 
     public static final String APROX_ID = "aprox";
 
     private final Logger logger = LoggerFactory.getLoggergetClass() );
 
     @Inject
 
     @Inject
 
     @Inject
 
     public RestRouter()
     {
         supernew ApplicationRouterConfig().withAppAcceptId )
                                             .withPrefix )
                                             .withRouteAliases ) );
     }
 
     public RestRouterfinal Set<RequestHandlerhandlersfinal List<RouteCollectionrouteCollections,
                        final List<FilterCollectionfilterCollections )
     {
         supernew ApplicationRouterConfig().withAppAcceptId )
                                             .withPrefix )
                                             .withHandlershandlers )
                                             .withRouteCollectionsrouteCollections )
                                             .withFilterCollectionsfilterCollections )
                                             .withRouteAliases ) );
     }
 
     public void containerInit( @Observes final Event<ContainerInitializedevt )
     {
         initializeComponents();
     }
 
     @Override
     @PostConstruct
     public void initializeComponents()
     {
         .info"\n\nCONSTRUCTING WEB ROUTES FOR APROX...\n\n" );
 
         final Set<RouteCollectionroutes = new HashSet<>();
        nextRoute: for ( final RouteCollection collection :  )
        {
            final Annotation[] annotations = collection.getClass()
                                                       .getAnnotations();
            boolean foundQualifier = false;
            for ( final Annotation annotation : annotations )
            {
                if ( annotation.getClass()
                               .getAnnotationQualifier.class ) != null )
                {
                    foundQualifier = true;
                    if ( RestApp.class.equalsannotation.getClass() ) )
                    {
                        routes.addcollection );
                        continue nextRoute;
                    }
                }
            }
            if ( !foundQualifier )
            {
                routes.addcollection );
            }
        }
        final Set<FilterCollectionfilters = new HashSet<>();
        nextFilter: for ( final FilterCollection collection :  )
        {
            final Annotation[] annotations = collection.getClass()
                                                       .getAnnotations();
            boolean foundQualifier = false;
            for ( final Annotation annotation : annotations )
            {
                if ( annotation.getClass()
                               .getAnnotationQualifier.class ) != null )
                {
                    foundQualifier = true;
                    if ( RestApp.class.equalsannotation.getClass() ) )
                    {
                        filters.addcollection );
                        continue nextFilter;
                    }
                }
            }
            if ( !foundQualifier )
            {
                filters.addcollection );
            }
        }
        bindHandlers );
        bindRouteCollectionsroutes );
        bindFilterCollectionsfilters );
        .info"\n\n...done.\n\n" );
    }
New to GrepCode? Check out our FAQ X