|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
XWiki20LinkReferenceParser | Line # 68 | 1 | 0% | 1 | 0 | 100% |
1.0
|
|||||||||||||||||||||||||||||||||||||||||||||||||||||||
(40) | |||
Result | |||
1.0
|
org.xwiki.rendering.test.integration.RenderingTest.execute org.xwiki.rendering.test.integration.RenderingTest.execute | 1 PASS | |
1.0
|
org.xwiki.rendering.test.integration.RenderingTest.execute org.xwiki.rendering.test.integration.RenderingTest.execute | 1 PASS | |
1.0
|
org.xwiki.rendering.test.integration.RenderingTest.execute org.xwiki.rendering.test.integration.RenderingTest.execute | 1 PASS | |
1.0
|
org.xwiki.rendering.test.integration.RenderingTest.execute org.xwiki.rendering.test.integration.RenderingTest.execute | 1 PASS | |
1.0
|
org.xwiki.rendering.test.integration.RenderingTest.execute org.xwiki.rendering.test.integration.RenderingTest.execute | 1 PASS | |
1.0
|
org.xwiki.rendering.test.integration.RenderingTest.execute org.xwiki.rendering.test.integration.RenderingTest.execute | 1 PASS | |
1.0
|
org.xwiki.rendering.test.integration.RenderingTest.execute org.xwiki.rendering.test.integration.RenderingTest.execute | 1 PASS | |
1.0
|
org.xwiki.rendering.test.integration.RenderingTest.execute org.xwiki.rendering.test.integration.RenderingTest.execute | 1 PASS | |
1.0
|
org.xwiki.rendering.test.integration.RenderingTest.execute org.xwiki.rendering.test.integration.RenderingTest.execute | 1 PASS | |
1.0
|
org.xwiki.rendering.test.integration.RenderingTest.execute org.xwiki.rendering.test.integration.RenderingTest.execute | 1 PASS | |
1.0
|
org.xwiki.rendering.test.integration.RenderingTest.execute org.xwiki.rendering.test.integration.RenderingTest.execute | 1 PASS | |
1.0
|
org.xwiki.rendering.test.integration.RenderingTest.execute org.xwiki.rendering.test.integration.RenderingTest.execute | 1 PASS | |
1.0
|
org.xwiki.rendering.test.integration.RenderingTest.execute org.xwiki.rendering.test.integration.RenderingTest.execute | 1 PASS | |
1.0
|
org.xwiki.rendering.test.integration.RenderingTest.execute org.xwiki.rendering.test.integration.RenderingTest.execute | 1 PASS | |
1.0
|
org.xwiki.rendering.test.integration.RenderingTest.execute org.xwiki.rendering.test.integration.RenderingTest.execute | 1 PASS | |
1.0
|
org.xwiki.rendering.test.integration.RenderingTest.execute org.xwiki.rendering.test.integration.RenderingTest.execute | 1 PASS | |
1.0
|
org.xwiki.rendering.test.integration.RenderingTest.execute org.xwiki.rendering.test.integration.RenderingTest.execute | 1 PASS | |
1.0
|
org.xwiki.rendering.test.integration.RenderingTest.execute org.xwiki.rendering.test.integration.RenderingTest.execute | 1 PASS | |
1.0
|
org.xwiki.rendering.test.integration.RenderingTest.execute org.xwiki.rendering.test.integration.RenderingTest.execute | 1 PASS | |
1.0
|
org.xwiki.rendering.test.integration.RenderingTest.execute org.xwiki.rendering.test.integration.RenderingTest.execute | 1 PASS | |
1.0
|
org.xwiki.rendering.test.integration.RenderingTest.execute org.xwiki.rendering.test.integration.RenderingTest.execute | 1 PASS | |
1.0
|
org.xwiki.rendering.test.integration.RenderingTest.execute org.xwiki.rendering.test.integration.RenderingTest.execute | 1 PASS | |
1.0
|
org.xwiki.rendering.test.integration.RenderingTest.execute org.xwiki.rendering.test.integration.RenderingTest.execute | 1 PASS | |
1.0
|
org.xwiki.rendering.test.integration.RenderingTest.execute org.xwiki.rendering.test.integration.RenderingTest.execute | 1 PASS | |
1.0
|
org.xwiki.rendering.test.integration.RenderingTest.execute org.xwiki.rendering.test.integration.RenderingTest.execute | 1 PASS | |
1.0
|
org.xwiki.rendering.test.integration.RenderingTest.execute org.xwiki.rendering.test.integration.RenderingTest.execute | 1 PASS | |
1.0
|
org.xwiki.rendering.test.integration.RenderingTest.execute org.xwiki.rendering.test.integration.RenderingTest.execute | 1 PASS | |
1.0
|
org.xwiki.rendering.test.integration.RenderingTest.execute org.xwiki.rendering.test.integration.RenderingTest.execute | 1 PASS | |
1.0
|
org.xwiki.rendering.test.integration.RenderingTest.execute org.xwiki.rendering.test.integration.RenderingTest.execute | 1 PASS | |
1.0
|
org.xwiki.rendering.test.integration.RenderingTest.execute org.xwiki.rendering.test.integration.RenderingTest.execute | 1 PASS | |
1.0
|
org.xwiki.rendering.test.integration.RenderingTest.execute org.xwiki.rendering.test.integration.RenderingTest.execute | 1 PASS | |
1.0
|
org.xwiki.rendering.test.integration.RenderingTest.execute org.xwiki.rendering.test.integration.RenderingTest.execute | 1 PASS | |
1.0
|
org.xwiki.rendering.test.integration.RenderingTest.execute org.xwiki.rendering.test.integration.RenderingTest.execute | 1 PASS | |
1.0
|
org.xwiki.rendering.test.integration.RenderingTest.execute org.xwiki.rendering.test.integration.RenderingTest.execute | 1 PASS | |
1.0
|
org.xwiki.rendering.test.integration.RenderingTest.execute org.xwiki.rendering.test.integration.RenderingTest.execute | 1 PASS | |
1.0
|
org.xwiki.rendering.test.integration.RenderingTest.execute org.xwiki.rendering.test.integration.RenderingTest.execute | 1 PASS | |
1.0
|
org.xwiki.rendering.test.integration.RenderingTest.execute org.xwiki.rendering.test.integration.RenderingTest.execute | 1 PASS | |
1.0
|
org.xwiki.rendering.test.integration.RenderingTest.execute org.xwiki.rendering.test.integration.RenderingTest.execute | 1 PASS | |
1.0
|
org.xwiki.rendering.test.integration.RenderingTest.execute org.xwiki.rendering.test.integration.RenderingTest.execute | 1 PASS | |
1.0
|
org.xwiki.rendering.test.integration.RenderingTest.execute org.xwiki.rendering.test.integration.RenderingTest.execute | 1 PASS | |
1 | /* | |
2 | * See the NOTICE file distributed with this work for additional | |
3 | * information regarding copyright ownership. | |
4 | * | |
5 | * This is free software; you can redistribute it and/or modify it | |
6 | * under the terms of the GNU Lesser General Public License as | |
7 | * published by the Free Software Foundation; either version 2.1 of | |
8 | * the License, or (at your option) any later version. | |
9 | * | |
10 | * This software is distributed in the hope that it will be useful, | |
11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | |
12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | |
13 | * Lesser General Public License for more details. | |
14 | * | |
15 | * You should have received a copy of the GNU Lesser General Public | |
16 | * License along with this software; if not, write to the Free | |
17 | * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA | |
18 | * 02110-1301 USA, or see the FSF site: http://www.fsf.org. | |
19 | */ | |
20 | package org.xwiki.rendering.internal.parser.xwiki20; | |
21 | ||
22 | import java.util.Arrays; | |
23 | import java.util.List; | |
24 | ||
25 | import javax.inject.Named; | |
26 | import javax.inject.Singleton; | |
27 | ||
28 | import org.xwiki.component.annotation.Component; | |
29 | import org.xwiki.rendering.internal.parser.reference.GenericLinkReferenceParser; | |
30 | ||
31 | /** | |
32 | * Parses the content of XWiki 2.0 resource references. The supported generic format is as follows: | |
33 | * <code>(link)(@interWikiAlias)?</code>, where: | |
34 | * <ul> | |
35 | * <li><code>link</code>: The full link reference using the following syntax: | |
36 | * <code>(reference)(#anchor)?(?queryString)?</code>, where: | |
37 | * <ul> | |
38 | * <li><code>reference</code>: The link reference. This can be either a URI in the form <code>protocol:path</code> | |
39 | * (example: "http://xwiki.org", "mailto:john@smith.com) or a wiki page name (example: "wiki:Space.WebHome"). Note that | |
40 | * in the case of a wiki page name the character "\" is used as the escape character (for example if you wish to have | |
41 | * "#" or "?" in your page name you'll need to write "\#" and "\?").</li> | |
42 | * <li><code>anchor</code>: An optional anchor name pointing to an anchor defined in the referenced link. Note that in | |
43 | * XWiki anchors are automatically created for titles. Example: "TableOfContentAnchor".</li> | |
44 | * <li><code>queryString</code>: An optional query string for specifying parameters that will be used in the rendered | |
45 | * URL. Example: "mydata1=5&mydata2=Hello".</li> | |
46 | * </ul> | |
47 | * The <code>link</code> element is mandatory.</li> | |
48 | * <li><code>interWikiAlias</code>: An optional <a href="http://en.wikipedia.org/wiki/InterWiki">Inter Wiki</a> alias as | |
49 | * defined in the InterWiki Map. Example: "wikipedia"</li> | |
50 | * </ul> | |
51 | * Examples of valid wiki links: | |
52 | * <ul> | |
53 | * <li>Hello World</li> | |
54 | * <li>http://myserver.com/HelloWorld</li> | |
55 | * <li>HelloWorld#Anchor</li> | |
56 | * <li>Hello World@Wikipedia</li> | |
57 | * <li>mywiki:HelloWorld</li> | |
58 | * <li>Hello World?param1=1¶m2=2</li> | |
59 | * </ul> | |
60 | * Note that allowed URIs are URLs of the form {@code http://}, {@code mailto:}, {@code image:} and {@code attach:}. | |
61 | * | |
62 | * @version $Id: ae1afe2004a71b8a3d62152e7328aac254dd5e7f $ | |
63 | * @since 2.5RC1 | |
64 | */ | |
65 | @Component | |
66 | @Named("xwiki/2.0/link") | |
67 | @Singleton | |
68 | public class XWiki20LinkReferenceParser extends GenericLinkReferenceParser | |
69 | { | |
70 | /** | |
71 | * The list of recognized URL prefixes. | |
72 | */ | |
73 | public static final List<String> URI_PREFIXES = Arrays.asList("mailto", "image", "attach"); | |
74 | ||
75 | 62 | @Override |
76 | protected List<String> getAllowedURIPrefixes() | |
77 | { | |
78 | 62 | return URI_PREFIXES; |
79 | } | |
80 | } |
|