Ah that's why, thanks Josh. I didn't specify any order, so some of the time
my filter (and the TimingFilter) would be added before the StaticFilesFilter
in which case the timing filter will print out the time, and sometimes it
will be placed after, so the static files filter handles the request first
without passing it on.

For reference, my fix was to change:
        configuration.add("Timing", filter);
to
        configuration.add("Timing", filter, "before:StaticFiles");


On Mon, Feb 21, 2011 at 1:21 PM, Josh Canfield <joshcanfi...@gmail.com>wrote:

> > I've made a RequestFilter that's only loaded in development mode, but the
> > problem is it isn't always loaded properly - when I start tapestry (maven
> > jetty:run) about 1/3rd of the time it works, but the rest of the time it
> > doesn't.
>
> Where in the list are you putting your request filter? RequestFilter's
> are added via an ordered configuration so if you want to make sure
> yours runs then you need to put it "before:*". Other RequestFilters
> may handle the request without forwarding it on to you, for instance
> Tapestry's ResourceStreamer will return 304 if the "if-modified-since"
> http header is sent and the file has not been modified. Both the
> context and classpath request handlers use the resource streamer.
>
> Josh
>
> On Sat, Feb 19, 2011 at 8:07 AM, Donny Nadolny <donny.nado...@gmail.com>
> wrote:
> > I have a few static javascript files which are used on 3rd party
> websites,
> > so they have the full url to my website hard coded in to them (for ajax
> > calls). In order to test things locally, I need to replace that url with
> > localhost. I've made a page which returns the modified file, and I want
> to
> > replace all requests for /js/myfile.js with page render requests to
> > /js/localhostjs which gives the modified file.
> >
> > I've made a RequestFilter that's only loaded in development mode, but the
> > problem is it isn't always loaded properly - when I start tapestry (maven
> > jetty:run) about 1/3rd of the time it works, but the rest of the time it
> > doesn't.
> > I tried this out with the quickstart app and the same thing happens: if
> you
> > run the quickstart app and grab a css file (
> > http://localhost:8080/tapestryquickstart/layout/layout.css) then
> sometimes
> > you'll see the timing filter, sometimes you won't. It doesn't change
> during
> > the run, so in order to see this you need to start jetty, hit the file,
> kill
> > jetty, repeat.
> >
> > This seems like a bug, the RequestFilter isn't always used for static
> file
> > requests (race condition in Tapestry's startup?)
> >
> > How can I consistently rewrite the request for the js file (for
> development
> > only)? (I tried the new LinkTransformer api but it seems it isn't called
> for
> > static file requests. Same for the old URL Rewriting api)
> >
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org
> For additional commands, e-mail: users-h...@tapestry.apache.org
>
>

Reply via email to