else
{
ResourceModel currentCollectionResource = currentResource;
if (currentResource.getKeys().isEmpty())
{
throw new RoutingException(String.format("Path key not supported on resource '%s' for URI '%s'",
currentResource.getName(),
context.getRequestURI()),
HttpStatus.S_400_BAD_REQUEST.getCode());
}
else if (currentResource.getKeyClass() == ComplexResourceKey.class)
{
parseComplexKey(currentResource, context, currentPathSegment);
currentLevel = ResourceLevel.ENTITY;
}
else if (currentResource.getKeyClass() == CompoundKey.class)
{
CompoundKey compoundKey;
try
{
compoundKey = parseCompoundKey(currentCollectionResource, context, currentPathSegment);
}
catch (IllegalArgumentException e)
{
throw new RoutingException(String.format("Malformed Compound Key: '%s'", currentPathSegment),
HttpStatus.S_400_BAD_REQUEST.getCode(),
e);
}
if (compoundKey != null
&& compoundKey.getPartKeys().containsAll(currentResource.getKeyNames()))
{
// full match on key parts means that we are targeting a unique entity
currentLevel = ResourceLevel.ENTITY;
}
}
else // Must be a simple key then
{
parseSimpleKey(currentResource, context, currentPathSegment);
currentLevel = ResourceLevel.ENTITY;
}
}
if (currentResource == null)
{
throw new RoutingException(HttpStatus.S_404_NOT_FOUND.getCode());
}
}
parseBatchKeysParameter(currentResource, context); //now we know the key type, look for batch parameter