Search in sources :

Example 1 with UITabSpec

use of com.netflix.exhibitor.core.entities.UITabSpec in project exhibitor by soabase.

the class UIResource method getAdditionalTabSpecs.

@Path("tabs")
@GET
@Produces(MediaType.APPLICATION_JSON)
public Response getAdditionalTabSpecs() {
    final AtomicInteger index = new AtomicInteger(0);
    List<UITabSpec> names = Lists.transform(tabs, new Function<UITab, UITabSpec>() {

        @Override
        public UITabSpec apply(UITab tab) {
            String base = tab.contentIsHtml() ? HTML_UI_TAB_BASE_URL : TEXT_UI_TAB_BASE_URL;
            return new UITabSpec(tab.getName(), base + index.getAndIncrement(), tab.contentIsHtml(), tab.getUITabType());
        }
    });
    // move out of Google's TransformingRandomAccessList
    names = Lists.newArrayList(names);
    GenericEntity<List<UITabSpec>> entity = new GenericEntity<List<UITabSpec>>(names) {
    };
    return Response.ok(entity).build();
}
Also used : UITabSpec(com.netflix.exhibitor.core.entities.UITabSpec) AtomicInteger(java.util.concurrent.atomic.AtomicInteger) GenericEntity(javax.ws.rs.core.GenericEntity) ImmutableList(com.google.common.collect.ImmutableList) List(java.util.List) Path(javax.ws.rs.Path) Produces(javax.ws.rs.Produces) GET(javax.ws.rs.GET)

Aggregations

ImmutableList (com.google.common.collect.ImmutableList)1 UITabSpec (com.netflix.exhibitor.core.entities.UITabSpec)1 List (java.util.List)1 AtomicInteger (java.util.concurrent.atomic.AtomicInteger)1 GET (javax.ws.rs.GET)1 Path (javax.ws.rs.Path)1 Produces (javax.ws.rs.Produces)1 GenericEntity (javax.ws.rs.core.GenericEntity)1