use of io.apiman.gateway.engine.beans.GatewayEndpoint in project apiman by apiman.
the class WarPlatform method getEndpoint.
/**
* @see io.apiman.gateway.api.rest.impl.IPlatform#getEndpoint()
*/
@Override
public GatewayEndpoint getEndpoint() {
GatewayEndpoint gatewayEndpoint = new GatewayEndpoint();
gatewayEndpoint.setEndpoint(getGatewayEndpoint().toString());
return gatewayEndpoint;
}
use of io.apiman.gateway.engine.beans.GatewayEndpoint in project apiman by apiman.
the class GatewayClient method getGatewayEndpoint.
/**
* @see ISystemResource#getEndpoint()
*/
public GatewayEndpoint getGatewayEndpoint() throws GatewayAuthenticationException {
InputStream is = null;
try {
@SuppressWarnings("nls") URI uri = new URI(this.endpoint + SYSTEM_ENDPOINT);
HttpGet get = new HttpGet(uri);
HttpResponse response = httpClient.execute(get);
int actualStatusCode = response.getStatusLine().getStatusCode();
if (actualStatusCode == 401 || actualStatusCode == 403) {
throw new GatewayAuthenticationException();
}
if (actualStatusCode != 200) {
// $NON-NLS-1$
throw new RuntimeException("Failed to get the API endpoint: " + actualStatusCode);
}
is = response.getEntity().getContent();
return mapper.reader(GatewayEndpoint.class).readValue(is);
} catch (GatewayAuthenticationException | RuntimeException e) {
throw e;
} catch (Exception e) {
throw new RuntimeException(e);
} finally {
IOUtils.closeQuietly(is);
}
}
use of io.apiman.gateway.engine.beans.GatewayEndpoint in project apiman by apiman.
the class GatewayResourceImpl method getGatewayEndpoint.
/**
* @see IGatewayResource#getGatewayEndpoint(java.lang.String)
*/
public GatewayEndpointSummaryBean getGatewayEndpoint(String gatewayId) throws GatewayNotFoundException {
// No permission check is needed
try {
GatewayBean gateway = storage.getGateway(gatewayId);
if (gateway == null) {
throw ExceptionFactory.gatewayNotFoundException(gatewayId);
} else {
// $NON-NLS-1$
LOGGER.debug(String.format("Got endpoint summary: %s", gateway));
}
IGatewayLink link = gatewayLinkFactory.create(gateway);
GatewayEndpoint endpoint = link.getGatewayEndpoint();
GatewayEndpointSummaryBean gatewayEndpoint = new GatewayEndpointSummaryBean();
gatewayEndpoint.setEndpoint(endpoint.getEndpoint());
return gatewayEndpoint;
} catch (AbstractRestException e) {
throw e;
} catch (Exception e) {
throw new SystemErrorException(e);
}
}
use of io.apiman.gateway.engine.beans.GatewayEndpoint in project apiman by apiman.
the class SystemResourceImpl method getEndpoint.
@Override
public GatewayEndpoint getEndpoint() {
EndpointHelper endpointHelper = new EndpointHelper(apimanConfig);
String endpoint = endpointHelper.getGatewayEndpoint();
GatewayEndpoint endpointObj = new GatewayEndpoint();
endpointObj.setEndpoint(endpoint);
return endpointObj;
}
use of io.apiman.gateway.engine.beans.GatewayEndpoint in project apiman by apiman.
the class GatewayMicroServicePlatform method getEndpoint.
/**
* @see io.apiman.gateway.api.rest.impl.IPlatform#getEndpoint()
*/
@Override
public GatewayEndpoint getEndpoint() {
GatewayEndpoint gatewayEndpoint = new GatewayEndpoint();
gatewayEndpoint.setEndpoint(getGatewayEndpoint().toString());
return gatewayEndpoint;
}
Aggregations