@GET @Path("{id}") public Response getById(@PathParam("version") String version, @PathParam("id") String id) { CurrentRequestVersion.set(Version.toEnum(version)); List<InstanceInfo> list = registry.getInstancesById(id); if (list != null && !list.isEmpty()) { return Response.ok(list.get(0)).build(); } else { logger.info("Not Found: {}", id); return Response.status(Status.NOT_FOUND).build(); } } }
/** * Gets information about a particular {@link com.netflix.discovery.shared.Application}. * * @param version * the version of the request. * @param appId * the unique application identifier (which is the name) of the * application. * @return information about a particular application. */ @Path("{appId}") public ApplicationResource getApplicationResource( @PathParam("version") String version, @PathParam("appId") String appId) { CurrentRequestVersion.set(Version.toEnum(version)); return new ApplicationResource(appId, serverConfig, registry); }
/** * Replicates all ASG status changes to peer eureka nodes except for * replication traffic to this node. */ private void replicateASGInfoToReplicaNodes(final String asgName, final ASGStatus newStatus, final PeerEurekaNode node) { CurrentRequestVersion.set(Version.V2); try { node.statusUpdate(asgName, newStatus); } catch (Throwable e) { logger.error("Cannot replicate ASG status information to {}", node.getServiceUrl(), e); } }
protected Response getVipResponse(String version, String entityName, String acceptHeader, EurekaAccept eurekaAccept, Key.EntityType entityType) { if (!registry.shouldAllowAccess(false)) { return Response.status(Response.Status.FORBIDDEN).build(); } CurrentRequestVersion.set(Version.toEnum(version)); Key.KeyType keyType = Key.KeyType.JSON; if (acceptHeader == null || !acceptHeader.contains("json")) { keyType = Key.KeyType.XML; } Key cacheKey = new Key( entityType, entityName, keyType, CurrentRequestVersion.get(), eurekaAccept ); String payLoad = responseCache.get(cacheKey); if (payLoad != null) { logger.debug("Found: {}", entityName); return Response.ok(payLoad).build(); } else { logger.debug("Not Found: {}", entityName); return Response.status(Response.Status.NOT_FOUND).build(); } } }
@Override public void run() { logger.debug("Updating the client cache from response cache"); for (Key key : readOnlyCacheMap.keySet()) { if (logger.isDebugEnabled()) { logger.debug("Updating the client cache from response cache for key : {} {} {} {}", key.getEntityType(), key.getName(), key.getVersion(), key.getType()); } try { CurrentRequestVersion.set(key.getVersion()); Value cacheValue = readWriteCacheMap.get(key); Value currentCacheValue = readOnlyCacheMap.get(key); if (cacheValue != currentCacheValue) { readOnlyCacheMap.put(key, cacheValue); } } catch (Throwable th) { logger.error("Error while updating the client cache from response cache for key {}", key.toStringCompact(), th); } } } };
return Response.status(Status.FORBIDDEN).build(); CurrentRequestVersion.set(Version.toEnum(version)); KeyType keyType = Key.KeyType.JSON; String returnMediaType = MediaType.APPLICATION_JSON;
CurrentRequestVersion.set(Version.toEnum(version)); KeyType keyType = Key.KeyType.JSON; if (acceptHeader == null || !acceptHeader.contains("json")) {
CurrentRequestVersion.set(Version.toEnum(version)); KeyType keyType = Key.KeyType.JSON; String returnMediaType = MediaType.APPLICATION_JSON;
try { InstanceInfo infoFromRegistry = null; CurrentRequestVersion.set(Version.V2); switch (action) { case Cancel:
@GET @Path("{id}") public Response getById(@PathParam("version") String version, @PathParam("id") String id) { CurrentRequestVersion.set(Version.toEnum(version)); List<InstanceInfo> list = registry.getInstancesById(id); if (list != null && !list.isEmpty()) { return Response.ok(list.get(0)).build(); } else { logger.info("Not Found: {}", id); return Response.status(Status.NOT_FOUND).build(); } } }
/** * Replicates all ASG status changes to peer eureka nodes except for * replication traffic to this node. */ private void replicateASGInfoToReplicaNodes(final String asgName, final ASGStatus newStatus, final PeerEurekaNode node) { CurrentRequestVersion.set(Version.V2); try { node.statusUpdate(asgName, newStatus); } catch (Throwable e) { logger.error("Cannot replicate ASG status information to {}", node.getServiceUrl(), e); } }
/** * Gets information about a particular {@link com.netflix.discovery.shared.Application}. * * @param version * the version of the request. * @param appId * the unique application identifier (which is the name) of the * application. * @return information about a particular application. */ @Path("{appId}") public ApplicationResource getApplicationResource( @PathParam("version") String version, @PathParam("appId") String appId) { CurrentRequestVersion.set(Version.toEnum(version)); return new ApplicationResource(appId, serverConfig, registry); }
protected Response getVipResponse(String version, String entityName, String acceptHeader, EurekaAccept eurekaAccept, Key.EntityType entityType) { if (!registry.shouldAllowAccess(false)) { return Response.status(Response.Status.FORBIDDEN).build(); } CurrentRequestVersion.set(Version.toEnum(version)); Key.KeyType keyType = Key.KeyType.JSON; if (acceptHeader == null || !acceptHeader.contains("json")) { keyType = Key.KeyType.XML; } Key cacheKey = new Key( entityType, entityName, keyType, CurrentRequestVersion.get(), eurekaAccept ); String payLoad = responseCache.get(cacheKey); if (payLoad != null) { logger.debug("Found: {}", entityName); return Response.ok(payLoad).build(); } else { logger.debug("Not Found: {}", entityName); return Response.status(Response.Status.NOT_FOUND).build(); } } }
@Override public void run() { logger.debug("Updating the client cache from response cache"); for (Key key : readOnlyCacheMap.keySet()) { if (logger.isDebugEnabled()) { logger.debug("Updating the client cache from response cache for key : {} {} {} {}", key.getEntityType(), key.getName(), key.getVersion(), key.getType()); } try { CurrentRequestVersion.set(key.getVersion()); Value cacheValue = readWriteCacheMap.get(key); Value currentCacheValue = readOnlyCacheMap.get(key); if (cacheValue != currentCacheValue) { readOnlyCacheMap.put(key, cacheValue); } } catch (Throwable th) { logger.error("Error while updating the client cache from response cache for key {}", key.toStringCompact(), th); } } } };
CurrentRequestVersion.set(Version.toEnum(version)); KeyType keyType = Key.KeyType.JSON; if (acceptHeader == null || !acceptHeader.contains("json")) {
return Response.status(Status.FORBIDDEN).build(); CurrentRequestVersion.set(Version.toEnum(version)); KeyType keyType = Key.KeyType.JSON; String returnMediaType = MediaType.APPLICATION_JSON;
CurrentRequestVersion.set(Version.toEnum(version)); KeyType keyType = Key.KeyType.JSON; String returnMediaType = MediaType.APPLICATION_JSON;
try { InstanceInfo infoFromRegistry = null; CurrentRequestVersion.set(Version.V2); switch (action) { case Cancel: