Hello!
It is not required to get File and StreamResource to set resource from META-INF/resource.
For instance, if your HTM is placed under META-INF/resource/hpgames/crossword/1/index.htm, so you should set:
@ViewComponent
private IFrame iframe;
@Subscribe
public void onInit(final InitEvent event) {
iframe.setSrc("hpgames/crossword/1/index.htm");
}
XML example:
<iframe id="iframe" width="300px" height="200px" resource="hpgames/crossword/1/index.htm"/>
Take a look at How to load resources dynamically in Vaadin.
Also, note that to show HTM/HTML files in IFrame you should configure security (see X-Frame-Options - #11 by d.kremnev):
@EnableWebSecurity
public static class DefaultFlowuiSecurityConfiguration extends FlowuiSecurityConfiguration {
@Override
protected void configure(HttpSecurity http) throws Exception {
super.configure(http);
http.headers(headers ->
headers.contentSecurityPolicy(secPolicy ->
secPolicy.policyDirectives("frame-ancestors localhost:8080")
)
);
}
}