Java tutorial
/*- * #%L * che-starter * %% * Copyright (C) 2017 Red Hat, Inc. * %% * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at * http://www.eclipse.org/legal/epl-v10.html * #L% */ package io.fabric8.che.starter.client; import java.util.List; import org.springframework.core.ParameterizedTypeReference; import org.springframework.http.HttpMethod; import org.springframework.http.ResponseEntity; import org.springframework.stereotype.Component; import org.springframework.web.client.RestTemplate; import io.fabric8.che.starter.model.Stack; @Component public class StackClient { public List<Stack> listStacks(String cheServerUrl) { String url = CheRestEndpoints.LIST_STACKS.generateUrl(cheServerUrl); RestTemplate template = new RestTemplate(); ResponseEntity<List<Stack>> response = template.exchange(url, HttpMethod.GET, null, new ParameterizedTypeReference<List<Stack>>() { }); return response.getBody(); } }