Hi tapestry users,
I'm developing my first bootique-tapestry project and I have some doubts. In "traditional" tapestry projects (using maven), we have the folder src/main/webapp. In this folder I usually put files like robots.txt or another files for google and google bot. This files always showed in the http(s)://mydomain.com/robots.txt. I would like where I can put this static files with bootique. For other hand, the app.properties to use in all webapp have to be placed into src/main/webapp/WEB-INF/app.properties. The same question, where do I put this files? As a tapestry user from 2010, I have to say that I love to see integrations like bootique (or spring boot) to deploy my webapps easily in new environments (AWS). Best regards Carlos Montero |
Hi,
regarding serving static resources if they can be served from URL path /assets/ (or other configured via tapestry.asset-path-prefix), then put them in META-INF/assets folder (inside src/main/resources for Maven project structure). They will handled by Tapestry's AssetsDispatcher and can be potentially pre-processed by Tapestry (e.g. compressed). For other files, like robots.txt, you can have special handling in your HomePage that either returns them as SteamResponse or redirects to assets. Alternatively you might also create your own Dispatcher (like AssetDispatcher). Finally, you can use static handling from the stack you are using. I don't know Bootique, so I cannot help you with that. I use Tapestry with Dropwizard, and e.g. Dropwizard's way for static assets is to use AssetsBundle. Just for explanation, "src/main/webapp" thing you mentioned is from standard Java mechanism for web applications packaged as WAR ("Web ARchive"). When the WAR is deployed on an app server, it unpacks the archive and configures an implicit servlet to serve static files from "webapp" folder. Regarding app.properties, I put them somewhere on classpath, and register them in Tapestry as contribution to ComponentMessagesSource. E.g.: @Contribute(ComponentMessagesSource.class) public static void setupMessages(OrderedConfiguration<Resource> configuration, AssetSource assetSource) { configuration.add("my-properties", assetSource.resourceForPath("com/example/my-app.properties")); } and put my-app.properties in "com/example" inside "src/main/resources" Cezary On Thu, Jan 9, 2020 at 8:46 PM Carlos Montero Canabal < [hidden email]> wrote: > Hi tapestry users, > > I'm developing my first bootique-tapestry project and I have some doubts. > > In "traditional" tapestry projects (using maven), we have the folder > src/main/webapp. In this folder I usually put files like robots.txt or > another files for google and google bot. This files always showed in the > http(s)://mydomain.com/robots.txt. I would like where I can put this > static > files with bootique. > > For other hand, the app.properties to use in all webapp have to be placed > into src/main/webapp/WEB-INF/app.properties. The same question, where do I > put this files? > > As a tapestry user from 2010, I have to say that I love to see integrations > like bootique (or spring boot) to deploy my webapps easily in new > environments (AWS). > > Best regards > > Carlos Montero > |
Hi Cezary,
For app.properties (app_XX.properties) @Contribute(ComponentMessagesSource.class) ... works perfectly. Thank you for you message! For static files... I was thinking that I will map directly into my apache/nginx before to redirect to jetty. I asked because until now, with war package, I had this problem solved very quickly and simple. Best regards Carlos Montero El vie., 10 ene. 2020 a las 14:20, Cezary Biernacki (<[hidden email]>) escribió: > Hi, > regarding serving static resources if they can be served from URL path > /assets/ (or other configured via tapestry.asset-path-prefix), then put > them in META-INF/assets folder (inside src/main/resources for Maven project > structure). They will handled by Tapestry's AssetsDispatcher and can be > potentially pre-processed by Tapestry (e.g. compressed). For other files, > like robots.txt, you can have special handling in your HomePage that > either returns them as SteamResponse or redirects to assets. Alternatively > you might also create your own Dispatcher (like AssetDispatcher). Finally, > you can use static handling from the stack you are using. I don't know > Bootique, so I cannot help you with that. I use Tapestry with Dropwizard, > and e.g. Dropwizard's way for static assets is to use AssetsBundle. > > Just for explanation, "src/main/webapp" thing you mentioned is from > standard Java mechanism for web applications packaged as WAR ("Web > ARchive"). When the WAR is deployed on an app server, it unpacks the > archive and configures an implicit servlet to serve static files from > "webapp" folder. > > Regarding app.properties, I put them somewhere on classpath, and register > them in Tapestry as contribution to ComponentMessagesSource. E.g.: > > @Contribute(ComponentMessagesSource.class) > public static void setupMessages(OrderedConfiguration<Resource> > configuration, AssetSource assetSource) { > configuration.add("my-properties", > assetSource.resourceForPath("com/example/my-app.properties")); > } > > and put my-app.properties in "com/example" inside "src/main/resources" > > Cezary > > > > > > > On Thu, Jan 9, 2020 at 8:46 PM Carlos Montero Canabal < > [hidden email]> wrote: > > > Hi tapestry users, > > > > I'm developing my first bootique-tapestry project and I have some doubts. > > > > In "traditional" tapestry projects (using maven), we have the folder > > src/main/webapp. In this folder I usually put files like robots.txt or > > another files for google and google bot. This files always showed in the > > http(s)://mydomain.com/robots.txt. I would like where I can put this > > static > > files with bootique. > > > > For other hand, the app.properties to use in all webapp have to be placed > > into src/main/webapp/WEB-INF/app.properties. The same question, where do > I > > put this files? > > > > As a tapestry user from 2010, I have to say that I love to see > integrations > > like bootique (or spring boot) to deploy my webapps easily in new > > environments (AWS). > > > > Best regards > > > > Carlos Montero > > > |
Free forum by Nabble | Edit this page |