I'm a little puzzled by something. Using 1.1M1, I set up a router like so:

        this.attachDefault(new NotFoundRestlet());
        this.attach("/", new HomePageRestlet());


Then I test it like this:

        assertThat(route("/"), is(HomePageRestlet.class));
        assertThat(route("/flibbertygibbet"), is(NotFoundRestlet.class));

The first line passes, but the second line fails; the request I would
expect to 404 instead would display the home page.

Looking further, I see that the default is for a "starts with" match, and
the "/" route is returning 0.53, which is enough  call it a good match.
This seems like an odd outcome to me.

Naively, I would think I could fix this by changing the required score to
something higher, like 0.9. However, the "/" route adjusts its score for
"/flibbertygibbet" to 0.90625, still qualifying. That seems a bit
perverse.

Am I going about this the wrong way? If so, what's the right way to do the
standard 404 page?

Thanks,

William



Reply via email to