adam bien's blog

Wicket 1.4, Too many path parts... Exception, Reason And Workaround 📎

The following exception:

java.lang.IllegalArgumentException: Too many path parts, please provide sufficient number of path parameter names
     at org.apache.wicket.request.target.coding.MixedParamUrlCodingStrategy.decodeParameters(MixedParamUrlCodingStrategy.java:181)
     at org.apache.wicket.request.target.coding.BookmarkablePageRequestTargetUrlCodingStrategy.decode(BookmarkablePageRequestTargetUrlCodingStrategy.java:80)
     at org.apache.wicket.protocol.http.request.WebRequestCodingStrategy.targetForRequest(WebRequestCodingStrategy.java:484)
     ...

occurs after mounting a page with the MixedParamUrlCodingStrategy (the "RESTFul way"). This exception happens in pages with relative links (e.g. ./img/picture.jpg). The MixedParamUrlCodingStrategy seems to prepend the "resource" context before each relative URL what results in this exception.

Workaround: the use of absolute URLs, or other UrlCodingStrategies.