Re: best way of incorporating static pages?
I created a Static.java page class like this... public StreamResponse onActivate(String filename) { File file = new File("C://Temp//jetty-6.1.16//webapps/portal//static//help//"+filename); return new PageStreamResponse(file); } It serves the html content but for some of the static files there is a blank in the filename which seems to cause this problem... [ERROR] TapestryModule.RequestExceptionHandler Processing of request failed with uncaught exception: Input string 'Customise Your Presence.bmp' is not valid; the character ' ' at position 10 is not valid. java.lang.IllegalArgumentException: Input string 'Customise Your Presence.bmp' is not valid; the character ' ' at position 10 is not valid. at org.apache.tapestry5.internal.services.URLEncoderImpl.decode(URLEncoderImpl.java:144) at $URLEncoder_275016f422cdb7.decode(Unknown Source) I also don't see a foolproof way to set the content type in th response header, but it would be better if my static page could pass these non html resource requests back to the container for serving somehow anyway? John
Re: best way of incorporating static pages?
I'm not sure how that would work. If the static content has been placed in a directory under the tapestry webapp directory then it is servable directly by the container and potentially not secure. It will also potentially invoke the tapestry filter and conflict. If the content is placed outside the container then how will the URL below work? John - Original Message - From: Barry Books To: Tapestry users Sent: Wednesday, June 12, 2013 2:05 PM Subject: Re: best way of incorporating static pages? I would use new URL("http://localhost/static"; + path).openStream() to fetch the data instead of File(). Leave the security up to Tomcat. On Wed, Jun 12, 2013 at 7:01 AM, Thiago H de Paula Figueiredo < thiag...@gmail.com> wrote: > On Wed, 12 Jun 2013 07:08:10 -0300, John wrote: > > Hi, >> > > Hi! > > > I have a need to link to some static HTML generated by a CMS app. >> Assuming this content is in a directory outside my Tapestry app, what would >> be the best way of linking/serving it via Tapestry? >> > > I'd create a page that receives the file name or path in the activation > context and returns a StreamResponse wrapping the file (which is probably > in a fixed folder or its subfolders). Pay attention to security, refusing > file names or paths with '..' (without the quotes) on it so no file outside > the HTML folder is ever returned. > > -- > Thiago H. de Paula Figueiredo > > > --**--**- > To unsubscribe, e-mail: users-unsubscribe@tapestry.**apache.org > For additional commands, e-mail: users-h...@tapestry.apache.org > >
Re: best way of incorporating static pages?
Hi Magnus! I tend to believe a CMS is way to slow to combine it with Tapestry. Furthermore if you serve pages by a CMS link you will notice a difference in Look and Feel and linking back to the T5 app may be difficult. CMS is perfect to allow a user (non dev) to edit pages like "about us", "we hire" aso without the need of a deployment (tml change) for example. And you get versioning and a wysiwyg editor for free. I would integrate parts of the CMS pages by streaming fragments, which keeps the webapp conscise and allows caching. Just my 2 cents... Jens Sent from my iPhone On 15.06.2013, at 20:42, Bård Magnus Kvalheim wrote: > Maybe it's just me and I didn't see the problem, but can't you just link to > the cms content? > The cms content has a link so why should tapestry service it? > > Is it on the same base domain? Then use request services to generate an > absolute url. > > -magnus > > HTC one > Den 12. juni 2013 13:07 skrev "John" følgende: > >> Hi, >> >> I have a need to link to some static HTML generated by a CMS app. Assuming >> this content is in a directory outside my Tapestry app, what would be the >> best way of linking/serving it via Tapestry? >> >> Perhaps I should just configure a seperate Jetty context and provide >> absolute URLs in someway? >> >> I'd also consider the static content being part of the projects Java >> resources, not so keen though. >> >> John - To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org For additional commands, e-mail: users-h...@tapestry.apache.org
Re: best way of incorporating static pages?
Maybe it's just me and I didn't see the problem, but can't you just link to the cms content? The cms content has a link so why should tapestry service it? Is it on the same base domain? Then use request services to generate an absolute url. -magnus HTC one Den 12. juni 2013 13:07 skrev "John" følgende: > Hi, > > I have a need to link to some static HTML generated by a CMS app. Assuming > this content is in a directory outside my Tapestry app, what would be the > best way of linking/serving it via Tapestry? > > Perhaps I should just configure a seperate Jetty context and provide > absolute URLs in someway? > > I'd also consider the static content being part of the projects Java > resources, not so keen though. > > John
Re: best way of incorporating static pages?
I would use new URL("http://localhost/static"; + path).openStream() to fetch the data instead of File(). Leave the security up to Tomcat. On Wed, Jun 12, 2013 at 7:01 AM, Thiago H de Paula Figueiredo < thiag...@gmail.com> wrote: > On Wed, 12 Jun 2013 07:08:10 -0300, John wrote: > > Hi, >> > > Hi! > > > I have a need to link to some static HTML generated by a CMS app. >> Assuming this content is in a directory outside my Tapestry app, what would >> be the best way of linking/serving it via Tapestry? >> > > I'd create a page that receives the file name or path in the activation > context and returns a StreamResponse wrapping the file (which is probably > in a fixed folder or its subfolders). Pay attention to security, refusing > file names or paths with '..' (without the quotes) on it so no file outside > the HTML folder is ever returned. > > -- > Thiago H. de Paula Figueiredo > > > --**--**- > To unsubscribe, e-mail: > users-unsubscribe@tapestry.**apache.org > For additional commands, e-mail: users-h...@tapestry.apache.org > >
Re: best way of incorporating static pages?
On Wed, 12 Jun 2013 07:08:10 -0300, John wrote: Hi, Hi! I have a need to link to some static HTML generated by a CMS app. Assuming this content is in a directory outside my Tapestry app, what would be the best way of linking/serving it via Tapestry? I'd create a page that receives the file name or path in the activation context and returns a StreamResponse wrapping the file (which is probably in a fixed folder or its subfolders). Pay attention to security, refusing file names or paths with '..' (without the quotes) on it so no file outside the HTML folder is ever returned. -- Thiago H. de Paula Figueiredo - To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org For additional commands, e-mail: users-h...@tapestry.apache.org
Re: best way of incorporating static pages?
Hi John I use (basically) OutputRaw for something similar. You can either try to use a regex to strip all unwanted elements from the CMS html or mark a div or introduce a new element (easier to exactly find the content and drop the rest). Unfortunately most work is related to "links": you have to make CMS links compatible to the Tapestry way. So write a component which accepts the url/name/id of your CMS content as parameter and when rendering load the page, strip unwanted content and uses OutputRaw to stream the CMS data in your page. Furthermore I propose you cache the stripped content (use guava cache for example) to avoid accesing a slow CMS on each request. Jens Sent from my iPhone On 12.06.2013, at 12:08, "John" wrote: > Hi, > > I have a need to link to some static HTML generated by a CMS app. Assuming > this content is in a directory outside my Tapestry app, what would be the > best way of linking/serving it via Tapestry? > > Perhaps I should just configure a seperate Jetty context and provide absolute > URLs in someway? > > I'd also consider the static content being part of the projects Java > resources, not so keen though. > > John - To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org For additional commands, e-mail: users-h...@tapestry.apache.org
best way of incorporating static pages?
Hi, I have a need to link to some static HTML generated by a CMS app. Assuming this content is in a directory outside my Tapestry app, what would be the best way of linking/serving it via Tapestry? Perhaps I should just configure a seperate Jetty context and provide absolute URLs in someway? I'd also consider the static content being part of the projects Java resources, not so keen though. John