org.xwiki.rendering.internal.parser.reference
Class XWiki20LinkReferenceParser

java.lang.Object
  extended by org.xwiki.rendering.internal.parser.reference.XWiki20LinkReferenceParser
All Implemented Interfaces:
ResourceReferenceParser
Direct Known Subclasses:
GenericLinkReferenceParser

@Component
@Named(value="xwiki/2.0/link")
@Singleton
public class XWiki20LinkReferenceParser
extends java.lang.Object
implements ResourceReferenceParser

Parses the content of XWiki 2.0 resource references. The supported generic format is as follows: (link)(@interWikiAlias)?, where:

Examples of valid wiki links: Note that allowed URIs are URLs of the form http://, mailto:, image: and attach:.

Since:
2.5RC1
Version:
$Id$

Field Summary
static char ESCAPE_CHAR
          Escape character to allow "#", "@" and "?" characters in a reference's name.
static java.lang.String SEPARATOR_ANCHOR
          Anchor separator.
static java.lang.String SEPARATOR_INTERWIKI
          Interwiki separator.
static java.lang.String SEPARATOR_QUERYSTRING
          Query String separator.
 
Constructor Summary
XWiki20LinkReferenceParser()
           
 
Method Summary
protected  java.util.List<java.lang.String> getAllowedURIPrefixes()
           
 ResourceReference parse(java.lang.String rawReference)
          Parses a resource reference represented (reference to a link, image, attachment, etc) as a String into a ResourceReference object.
protected  java.lang.String parseElementAfterString(java.lang.StringBuffer content, java.lang.String separator)
          Find out the element located to the right of the passed separator.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

SEPARATOR_INTERWIKI

public static final java.lang.String SEPARATOR_INTERWIKI
Interwiki separator.

See Also:
Constant Field Values

SEPARATOR_QUERYSTRING

public static final java.lang.String SEPARATOR_QUERYSTRING
Query String separator.

See Also:
Constant Field Values

SEPARATOR_ANCHOR

public static final java.lang.String SEPARATOR_ANCHOR
Anchor separator.

See Also:
Constant Field Values

ESCAPE_CHAR

public static final char ESCAPE_CHAR
Escape character to allow "#", "@" and "?" characters in a reference's name.

See Also:
Constant Field Values
Constructor Detail

XWiki20LinkReferenceParser

public XWiki20LinkReferenceParser()
Method Detail

getAllowedURIPrefixes

protected java.util.List<java.lang.String> getAllowedURIPrefixes()
Returns:
the list of URI prefixes the link parser recognizes

parse

public ResourceReference parse(java.lang.String rawReference)
Parses a resource reference represented (reference to a link, image, attachment, etc) as a String into a ResourceReference object.

Specified by:
parse in interface ResourceReferenceParser
Parameters:
rawReference - the string representation of the resource reference to parse (the supported syntax depends on the parser implementation used)
Returns:
the parsed resource reference
See Also:
ResourceReferenceParser.parse(java.lang.String)

parseElementAfterString

protected java.lang.String parseElementAfterString(java.lang.StringBuffer content,
                                                   java.lang.String separator)
Find out the element located to the right of the passed separator.

Parameters:
content - the string to parse. This parameter will be modified by the method to remove the parsed content.
separator - the separator string to locate the element
Returns:
the parsed element or null if the separator string wasn't found


Copyright © 2004-2011 XWiki. All Rights Reserved.