{"action":"created","issue":{"url":"https://api.github.com/repos/vaadin/flow/issues/2644","repository_url":"https://api.github.com/repos/vaadin/flow","labels_url":"https://api.github.com/repos/vaadin/flow/issues/2644/labels{/name}","comments_url":"https://api.github.com/repos/vaadin/flow/issues/2644/comments","events_url":"https://api.github.com/repos/vaadin/flow/issues/2644/events","html_url":"https://github.com/vaadin/flow/issues/2644","id":264180082,"number":2644,"title":"Static resources are not found if referenced from frontend folder","user":{"login":"SomeoneToIgnore","id":2690773,"avatar_url":"https://avatars0.githubusercontent.com/u/2690773?v=4","gravatar_id":"","url":"https://api.github.com/users/SomeoneToIgnore","html_url":"https://github.com/SomeoneToIgnore","followers_url":"https://api.github.com/users/SomeoneToIgnore/followers","following_url":"https://api.github.com/users/SomeoneToIgnore/following{/other_user}","gists_url":"https://api.github.com/users/SomeoneToIgnore/gists{/gist_id}","starred_url":"https://api.github.com/users/SomeoneToIgnore/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/SomeoneToIgnore/subscriptions","organizations_url":"https://api.github.com/users/SomeoneToIgnore/orgs","repos_url":"https://api.github.com/users/SomeoneToIgnore/repos","events_url":"https://api.github.com/users/SomeoneToIgnore/events{/privacy}","received_events_url":"https://api.github.com/users/SomeoneToIgnore/received_events","type":"User","site_admin":false},"labels":[{"id":205765017,"url":"https://api.github.com/repos/vaadin/flow/labels/bug","name":"bug","color":"fc2929","default":true}],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":9,"created_at":"2017-10-10T10:41:06Z","updated_at":"2017-10-11T13:02:53Z","closed_at":null,"author_association":"CONTRIBUTOR","body":"Take the skeleton app, modify `src/main/webapp/frontend/ExampleTemplate.html` file to reference something in the same folder.\r\n\r\nFor instance, if we add `src/main/webapp/frontend/images/puppy.jpg` file and have `ExampleTemplate.html` contents as \r\n```\r\n<!-- Dependency resources -->\r\n<link rel=\"import\" href=\"./bower_components/polymer/polymer-element.html\">\r\n\r\n<!-- Defines the example-template element -->\r\n<dom-module id=\"example-template\">\r\n    <template>\r\n        <style>\r\n            .puppy {\r\n                width: 300px;\r\n                height: 300px;\r\n                background-image: url(\"images/puppy.jpg\");\r\n                background-size: 300px 300px;\r\n            }\r\n        </style>\r\n        <div class=\"puppy\"></div>\r\n        <img src=\"images/puppy.jpg\">\r\n    </template>\r\n\r\n    <!-- Polymer boilerplate to register the example-template element -->\r\n    <script>\r\n        class ExampleTemplate extends Polymer.Element {\r\n            static get is() {\r\n                return 'example-template'\r\n            }\r\n        }\r\n        customElements.define(ExampleTemplate.is, ExampleTemplate);\r\n    </script>\r\n</dom-module>\r\n```\r\n\r\nthe `background-image: url(\"images/puppy.jpg\");` works and shows the image, but `<img src=\"images/puppy.jpg\">` does not.\r\n\r\nThis is wrong and should be behaving the similar way.\r\n\r\nThe root cause with `<img src=\"images/puppy.jpg\">` is in `StaticFileServer#isStaticResourceRequest` method: `request.getServletContext().getResource(requestFilename);` returns `null` for request `Request(GET //localhost:8080/images/puppy.jpg)`, since the image in context is actually located at `/frontend/images/puppy.jpg`, but we look it as `/images/puppy.jpg` in the context.\r\n"},"comment":{"url":"https://api.github.com/repos/vaadin/flow/issues/comments/335802148","html_url":"https://github.com/vaadin/flow/issues/2644#issuecomment-335802148","issue_url":"https://api.github.com/repos/vaadin/flow/issues/2644","id":335802148,"user":{"login":"SomeoneToIgnore","id":2690773,"avatar_url":"https://avatars0.githubusercontent.com/u/2690773?v=4","gravatar_id":"","url":"https://api.github.com/users/SomeoneToIgnore","html_url":"https://github.com/SomeoneToIgnore","followers_url":"https://api.github.com/users/SomeoneToIgnore/followers","following_url":"https://api.github.com/users/SomeoneToIgnore/following{/other_user}","gists_url":"https://api.github.com/users/SomeoneToIgnore/gists{/gist_id}","starred_url":"https://api.github.com/users/SomeoneToIgnore/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/SomeoneToIgnore/subscriptions","organizations_url":"https://api.github.com/users/SomeoneToIgnore/orgs","repos_url":"https://api.github.com/users/SomeoneToIgnore/repos","events_url":"https://api.github.com/users/SomeoneToIgnore/events{/privacy}","received_events_url":"https://api.github.com/users/SomeoneToIgnore/received_events","type":"User","site_admin":false},"created_at":"2017-10-11T13:02:53Z","updated_at":"2017-10-11T13:02:53Z","author_association":"CONTRIBUTOR","body":"Sorry, got the wrong answer, I think it's the 2nd one.\r\nWhat I mean is that we can modify `StaticFileServer` to be able to find those files and serve them."}}
{"actor":{"display_login":"SomeoneToIgnore"}}