tbk
tbk

Reputation: 1526

Alter URL prefix for Wicket resource URLs?

Wicket automatically generates URLs to resources (images etc.) with the prefix "resources" (e.g. "http://localhost:8080/resources/org.apache.wicket.ajax.WicketAjaxReference/wicket-ajax.js"). Is it possible to change this prefix from "resources" to something else (like "res")?

I have another servlet providing stuff under "resources" and I cannot change it (don't ask...), hence I would like Wicket to serve its resources with a different prefix.

Thanks!

Upvotes: 5

Views: 933

Answers (1)

Heri
Heri

Reputation: 2124

This is not possible in Wicket 1.4, since the path is defined as the constant org.apache.wicket.protocol.http.request.WebRequestCodingStrategy.RESOURCES_PATH_PREFIX and is used hardcoded in the Wicket filter.

In Wicket 1.5 it seems you have to override org.apache.wicket.Application.getEncoderContext() with an IMapperContext which returns your new prefix in getResourceIdentifier().

Upvotes: 3

Related Questions