Wiki source code of URL Architecture
Version 1.1 by Vincent Massol on 2015/04/20
Show last authors
author | version | line-number | content |
---|---|---|---|
1 | This is how URLs are handled when entering an XWiki instance: | ||
2 | |||
3 | {{image reference="url-architecture-overall.png"/}} | ||
4 | |||
5 | Specifically: | ||
6 | * When parsing an incoming URL, the Routing Filter will use a ##default## Resource Type Resolver (##ResourceTypeResolver##) component to extract the Resource Type (##ResourceType##) from the URL (the Resource Type is the type of URL pointed to, e.g. an Entity if the URL is pointing to a Document for example, a WebJar URL, a Skin URL, a REST URL, etc). In turn the ##default## Resource Type Resolver will read the XWiki configuration to see what URL Scheme is configured (through the ##url.format## configuration parameter) and will then locate a ##ResourceTypeResolver## component with a hint corresponding to the URL Scheme. It'll use it to extract the Resource Type. | ||
7 | * The Resource Reference Handler Servlet will use a ##default## Resource Reference Resolver (##ResourceReferenceResolver##) component to parse the passed URL into a ##ResourceReference## object that can then be given to a ##ResourceReferenceHandler## to perform an action. In turn the ##default## Resource Reference Resolver will read the XWiki configuration to see what URL Scheme is configured (through the ##url.format## configuration parameter) and will then locate a ##ResourceReferenceResolver## component with a hint corresponding to the URL Scheme. It'll use it to extract the Resource Reference. | ||
8 | |||
9 | For more details see the [[Resource API>>extensions:Extension.Resource API]] and the [[URL API>>extensions:Extension.URL API]] reference documentation. | ||
10 | |||
11 | == Customizing URLs == | ||
12 | |||
13 | There are several solutions to customize XWiki URLs: | ||
14 | * You can tune them to some degree by modifying XWiki's configuration. The various options are described in the [[Short URL documentation>>Main.ShortURLs]]. | ||
15 | * You can rewrite both incoming URLs but also outbound URLs using a Rewrite Filter. An example is also provided in the [[Short URL documentation>>Main.ShortURLs]]. | ||
16 | * You can implement a new URL Scheme. See the [[URL API>>extensions:Extension.URL API]]. | ||
17 | * You can simply register new Resource Types or new Entity Actions. See the [[URL API>>extensions:Extension.URL API]]. | ||
18 | |||
19 | {{info}} | ||
20 | Note that using Tuckey's [[Rewrite Filter>>http://tuckey.org/urlrewrite/]] is very powerful as it also allows using dynamic rules written in Java by using the [[##<class-rule>##>>http://tuckey.org/urlrewrite/manual/4.0/index.html#class-rule]] feature. | ||
21 | {{/info}} |