if ( contextId.startsWith( ":" ) || contextId.matches( "^[A-z]\t:.*" ) ) { //$NON-NLS-1$
//
// The context is a repository file (A)
//
final RepositoryFile file = repository.getFile( FileResource.idToPath( contextId ) );
if ( file == null ) {
logger.error( MessageFormat.format( "Repository file [{0}] not found", contextId ) );
return Response.serverError().build();
}
Response response = null;
ctxt( "Yep, [{0}] is a repository file id", contextId ); //$NON-NLS-1$
final String ext = RepositoryFilenameUtils.getExtension( file.getName() );
String pluginId = pluginManager.getPluginIdForType( ext );
if ( pluginId == null ) {
// A.3.a (faux content generator for .url files)
response = getUrlResponse( file, resourceId );
if ( response != null ) {
return response;
} else {
logger.error( MessageFormat.format( "No plugin was found to service content of type [{0}]", ext ) );
return Response.serverError().build();
}
}
// A.1.
response = getPluginFileResponse( pluginId, resourceId );
if ( response != null ) {
return response;
}
// A.2.
response = getRepositoryFileResponse( file.getPath(), resourceId );
if ( response != null ) {
return response;
}
// A.3.b (real content generator)