in src/main/java/org/apache/sling/models/impl/via/AbstractResourceTypeViaProvider.java [32:60]
public Object getAdaptable(Object original, String value) {
if (!handle(value)) {
return ORIGINAL;
}
if (original instanceof Resource) {
final Resource resource = (Resource) original;
final String resourceType = getResourceType(resource, value);
if (resourceType == null) {
log.warn("Could not determine forced resource type for {} using via value {}.", resource, value);
return null;
}
return new ResourceTypeForcingResourceWrapper(resource, resourceType);
} else if (original instanceof SlingHttpServletRequest) {
final SlingHttpServletRequest request = (SlingHttpServletRequest) original;
final Resource resource = request.getResource();
if (resource == null) {
return null;
}
final String resourceType = getResourceType(resource, value);
if (resourceType == null) {
log.warn("Could not determine forced resource type for {} using via value {}.", resource, value);
return null;
}
return new ResourceTypeForcingRequestWrapper(request, resource, resourceType);
} else {
log.warn("Received unexpected adaptable of type {}.", original.getClass().getName());
return null;
}
}