public Resource getResource()

in src/main/java/org/apache/sling/resourceaccesssecurity/it/impl/providers/SimpleResourceProvider.java [39:62]


    public Resource getResource(ResourceResolver resourceResolver, String path) {
        if (path.contains("/nonexisting/")) {
            return null;
        }
        return new SyntheticResource(resourceResolver, path, "test/resource"){
            @SuppressWarnings("unchecked")
            public <AdapterType> AdapterType adaptTo(Class<AdapterType> type) {
                AdapterType result = super.adaptTo(type);
                
                if ( result == null && type == InputStream.class )
                {
                    try {
                        result = (AdapterType) new ByteArrayInputStream("Test".getBytes("UTF-8") );
                    } catch (UnsupportedEncodingException e) {
                        // TODO Auto-generated catch block
                        e.printStackTrace();
                    }
                }
                
                return result;
            }
            
        };
    }