URLs Resolution

Version 50.4 by Vincent Massol on 2013/02/18

In a single instance of XWiki you have many sections and the URLs need to reflect all that. This documentation details the way URLs are parsed by XWiki and what each part of it means.

url.png

Protocol

By default "http" is used when generating an url in XWiki.

In virtual mode, you can set the "secure" parameter to true in a wiki descriptor to generate URLs with "https" instead of "http". See how to modify the wiki descriptor.

Host

In virtual mode it is used to determine the wiki to access. See the domain name based wiki access for more details.

In non-virtual mode is has no effect.

Application context (OPTIONAL)

See Short URLs for more details on how to remove this part of the url.

It's what the web container (jetty, tomcat, glassfish, etc.) use to find XWiki in all the web applications it contains. Removing it mainly depends on the possibilities and configuration of your web container.

Servlet mapping name (OPTIONAL)

See Short URLs for more details on how to remove this part of the url.

This is used by the container to call the right servlet.

It can be:

  • /bin/: this calls the Struts servlet which will call the right action for the following part of the URL
  • /wiki/[wikialias]: calls the same servlet but will be used to determine the subwiki to access if xwiki.virtiual.usepath is enabled in xwiki.cfg. Note that you can change the "wiki" part with anything else using xwiki.virtual.usepath.servletpath and by modifying web.xml to reflect the new Struts action name (see the URL path based wiki access for more details)
  • /xmlrpc/: call xmlrpc servlet (see XMLRPC for more details)
  • /webdav/: call webdav servlet (see Web DAV for more details)
  • /rest/: call REST servlet (see XWiki RESTful API for more details)

Struts action (OPTIONAL)

See the struts action name section for more details on how to remove this part of the url.

When the servlet mapping name is bin or the value of xwiki.virtual.usepath.servletpath XWiki uses "action" identifiers to determine what the goal of the user when going to a page is.

For example if the action is "edit" XWiki will print the editor the user used to modify the page content but if the "view" action is used, XWiki will execute the page content to print/render the content.

Space

Any wiki page is located in what is called a "space".

See Spaces for more details about spaces.

Page (OPTIONAL)

The page contains wiki contents, objects/classes and attachments.

If no page is specified like in the url http://host/xwiki/bin/view/Space/  the "WebHome" page name is used.

Attachment

This part indicates the attachment you want to download from a particular page.

See Attachments for more details about attachments.

Query string

Standard parameters

Some of the parameters in the URL have a "system" meaning depending of the context.

view mode

xpage

  • plain: this value indicates that only the content of the page is printed (no UI). With a document that's not using the XWiki 1.0 syntax you can control the output syntax using outputSyntax and outputSyntaxVersion. You can also pass another parameter named raw which allows you more control:
    • raw=1: Returns the page source as is without any formatting but XML-escaped
    • raw=2: Returns the page source as is without any formatting (without any escaping)
  • xml: print the exported form of a document. This is what you can find in the xar for each document.

outputSyntax and outputSyntaxVersion

With a document that's not using the XWiki 1.0 syntax it's possible to explicitly indicate the renderer to use for the page content. For example with outputSyntax=plain you will get the result in plain text. outputSyntaxVersion is an optional parameter, if it's not provided XWiki will search for the last version of the renderer for the given outputSyntax syntax name. Note that outputSyntax controls only the document content output syntax. If you only want the document content you can use xpage=plain.

See Rendering Module for more details on renderers.

export mode

See Exports.

Generic

Actions can use URL parameters to modify their action depending on their value.

For example you can make a velocity script that prints the content of this value with:

The value of the parameter is: $request.param1

if you have a parameter "param1=Hello World" the result will be

The value of the parameter is: Hello World

See Scripting for more details about scripting.

Get Connected