gedi-geode-rest-app/src/main/java/gedi/solutions/geode/rest/app/GeodeRegionRestService.java
@GetMapping(path = "{region}/{key}",produces = "application/json")
	String getValueByKey(@PathVariable String region,@PathVariable String  key)
	{
		try
		{
			if(region == null || region.length() == 0 || key == null)
				return null;
			
			Region<String, Object> gemRegion = geode.getRegion(region);
			
			Object value = gemRegion.get(key);
			
			if(value == null)
				return null;
			
			
			
				return gson.toJson(value);
		}
		catch(ServerOperationException serverError)
		{
			Throwable cause = serverError.getRootCause();
			if(cause instanceof RegionDestroyedException)
			{
				throw new DataServiceSystemException("Region \""+region+"\" not found");
			}
			throw new DataServiceSystemException(serverError.getMessage(),serverError);
		}
		catch (RuntimeException e)
		{
		
			e.printStackTrace();
			
			throw new DataServiceSystemException(e.getMessage(),e);
		}
	}
@GetMapping(path = "{region}/{key}",produces = "application/json")
	String getValueByKey(@PathVariable String region,@PathVariable String  key)
	{
		try
		{
			if(region == null || region.length() == 0 || key == null)
				return null;
			
			Region<String, Object> gemRegion = geode.getRegion(region);
			
			Object value = gemRegion.get(key);
			
			if(value == null)
				return null;
			
			
			
				return gson.toJson(value);
		}
		catch(ServerOperationException serverError)
		{
			Throwable cause = serverError.getRootCause();
			if(cause instanceof RegionDestroyedException)
			{
				throw new DataServiceSystemException("Region \""+region+"\" not found");
			}
			throw new DataServiceSystemException(serverError.getMessage(),serverError);
		}
		catch (RuntimeException e)
		{
		
			e.printStackTrace();
			
			throw new DataServiceSystemException(e.getMessage(),e);
		}
	}
@ GetMapping ( path = "{region}/{key}" , produces = "application/json" ) String getValueByKey ( @ PathVariable String region , @ PathVariable String key ) { try { if ( region == null || region . length ( ) == 0 || key == null ) return null ; Region < String , Object > gemRegion = geode . getRegion ( region ) ; Object value = gemRegion . get ( key ) ; if ( value == null ) return null ; return gson . toJson ( value ) ; } catch ( ServerOperationException serverError ) { Throwable cause = serverError . getRootCause ( ) ; if ( cause instanceof RegionDestroyedException ) { throw new DataServiceSystemException ( "Region \"" + region + "\" not found" ) ; } throw new DataServiceSystemException ( serverError . getMessage ( ) , serverError ) ; } catch ( RuntimeException e ) { e . printStackTrace ( ) ; throw new DataServiceSystemException ( e . getMessage ( ) , e ) ; } }
Get a value by a given key
@param region the region name
@param key the region key
@return the value of the region in JSON format
Get a value by a given key