[undertow-dev] Undertow 1.3.0 - rewrite HTML content

Miere Teixeira miere.teixeira at gmail.com
Wed Mar 9 19:20:41 EST 2016


I'd suggest you to create a random token (or any minor release number) and
store it at the build time. Then, use it as a query parameter on your
asset... Something like this:

<link rel="stylesheet" href="/css/theme.css
<http://localhost:9090/css/theme.css>?yourTokenWillBeHere" />

Last, but not the least, use a template engine like JMustache
<https://github.com/samskivert/jmustache> or Freemarker to this. They used
to be versatile enough to handle HTML rendering and offers a nice API to
define template variables.

I'm sure there must be an easier approach, like Grails used to do, but I
think this would be good enough.


On Wed, Mar 9, 2016 at 7:51 PM Stuart Douglas <sdouglas at redhat.com> wrote:

> Why not just rewrite them at build time? It will be much more efficient
> than trying to do it every time you serve the file.
>
> In general this is not an easy problem, you need to use a HTML parser to
> parse the page, modify it and then rewrite it, which will be slow
> (alternatively you could try hacking up something using regex's or similar,
> but it hard to make it work all the time).
>
> Stuart
>
> ----- Original Message -----
> > From: "Hugo Calado" <hugo.calado at gmail.com>
> > To: "Stuart Douglas" <sdouglas at redhat.com>
> > Cc: undertow-dev at lists.jboss.org
> > Sent: Wednesday, 9 March, 2016 9:37:27 PM
> > Subject: Re: [undertow-dev] Undertow 1.3.0 - rewrite HTML content
> >
> > Just static files.
> >
> > Hugo
> >
> > 2016-03-08 21:44 GMT+00:00 Stuart Douglas <sdouglas at redhat.com>:
> >
> > > Are these simply static files, or dynamically generated?
> > >
> > > Stuart
> > >
> > > ----- Original Message -----
> > > > From: "Hugo Calado" <hugo.calado at gmail.com>
> > > > To: undertow-dev at lists.jboss.org
> > > > Sent: Wednesday, 9 March, 2016 3:55:28 AM
> > > > Subject: [undertow-dev] Undertow 1.3.0 - rewrite HTML content
> > > >
> > > > Greetings,
> > > >
> > > >
> > > > How can i rewrite the path inside html files.
> > > >
> > > > Original HTML file:
> > > >
> > > > .... < script type = "text/javascript" src = " /v/js/abc.js " ></
> script
> > > >
> > > >
> > > > After rewrite:
> > > >
> > > > .... < script type = "text/javascript" src = " /v123/js/abc.js " ></
> > > script >
> > > >
> > > > The main objective is to solve browser cache issues assuring that in
> > > each new
> > > > release the url's of static objects are modified,
> > > >
> > > > Thank you,
> > > > Hugo Calado
> > > >
> > > >
> > > >
> > > >
> > > >
> > > >
> > > >
> > > >
> > > >
> > > >
> > > >
> > > >
> > > > _______________________________________________
> > > > undertow-dev mailing list
> > > > undertow-dev at lists.jboss.org
> > > > https://lists.jboss.org/mailman/listinfo/undertow-dev
> > >
> >
> _______________________________________________
> undertow-dev mailing list
> undertow-dev at lists.jboss.org
> https://lists.jboss.org/mailman/listinfo/undertow-dev
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.jboss.org/pipermail/undertow-dev/attachments/20160310/6999736e/attachment.html 


More information about the undertow-dev mailing list