Show last authors
1 {{box cssClass="floatinginfobox" title="**Contents**"}}
2 {{toc/}}
3 {{/box}}
4
5 This is how URLs are handled when entering an XWiki instance:
6
7 {{image reference="url-architecture-overall.png" width="800px"/}}
8
9 Specifically:
10
11 * 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.
12 * 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.
13
14 For more details see the [[Resource API>>extensions:Extension.Resource API]] and the [[URL API>>extensions:Extension.URL API]] reference documentation.
15
16 = Standard URL Scheme =
17
18 This is the default URL format used by XWiki. See [[Standard URL Scheme>>platform:DevGuide.Standard URL Format]].
19
20 = Customizing URLs =
21
22 There are several solutions to customize XWiki URLs:
23
24 * You can tune them to some degree by modifying XWiki's configuration. The various options are described in the [[Short URL documentation>>platform:Main.ShortURLs]].
25 * You can rewrite both incoming URLs but also outbound URLs using a Rewrite Filter. An example is also provided in the [[Short URL documentation>>platform:Main.ShortURLs]].
26 * You can implement a new URL Scheme. See the [[URL API>>extensions:Extension.URL API]].
27 * You can simply register new Resource Types or new Entity Actions. See the [[Resource API>>extensions:Extension.Resource API]].
28
29 {{info}}
30 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. However, [[dynamic outbound rules are not yet possiblet>>https://code.google.com/p/urlrewritefilter/issues/detail?id=73]].
31
32 [[Here's an example of writing a custom ##class-rule##>>https://github.com/xwiki-contrib/url-rewrite-reference]].
33 {{/info}}
34
35 = Struts Servlet Architecture =
36
37 As shown above, when there's no Resource Reference Handler registered to handle a Resource Type, the rest of ##web.xml## is processed and if the URL type is ##bin## or ##wiki##, the Struts Servlet is then called and the following happens:
38
39 {{image reference="xwiki-struts.png" width="800px"/}}
40
41 For example for the ##http:~/~/www.xwiki.org/xwiki/bin/view/Main/WebHome## URL, the following happens:
42
43 * The URL path contains ##/view/## and thus the ##ViewAction.java## class is executed (configured in ##struts-config.xml##) and called by the Struts Action, itself configured in ##web.xml##.
44 * The wiki is the main wiki in this example (since the server name starts by ##www##). See [[Accessing a wiki>>platform:AdminGuide.AccessWiki]] for more details on how wikis are accessed from URLs.
45 * ##ViewAction## specifies that ##view.vm## will be rendered using Velocity
46 * The space asked is ##Main## and the document's name is ##WebHome##

Get Connected