1. Project Clover database Tue Dec 20 2016 21:24:09 CET
  2. Package com.xpn.xwiki.web

File XWikiURLFactory.java

 

Code metrics

0
0
0
1
180
33
0
-
-
0
-

Classes

Class Line # Actions
XWikiURLFactory 27 0 - 0 0
-1.0 -
 

Contributing tests

No tests hitting this source file were found.

Source view

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 com.xpn.xwiki.web;
21   
22    import java.net.MalformedURLException;
23    import java.net.URL;
24   
25    import com.xpn.xwiki.XWikiContext;
26   
 
27    public interface XWikiURLFactory
28    {
29    void init(XWikiContext context);
30   
31    /**
32    * @param spaces a serialized space reference which can contain one or several spaces (e.g. "space1.space2"). If
33    * a space name contains a dot (".") it must be passed escaped as in "space1\.with\.dot.space2"
34    */
35    URL createURL(String spaces, String name, XWikiContext context);
36   
37    /**
38    * @param spaces a serialized space reference which can contain one or several spaces (e.g. "space1.space2"). If
39    * a space name contains a dot (".") it must be passed escaped as in "space1\.with\.dot.space2"
40    */
41    URL createURL(String spaces, String name, String action, XWikiContext context);
42   
43    /**
44    * @param spaces a serialized space reference which can contain one or several spaces (e.g. "space1.space2"). If
45    * a space name contains a dot (".") it must be passed escaped as in "space1\.with\.dot.space2"
46    */
47    URL createURL(String spaces, String name, String action, boolean redirect, XWikiContext context);
48   
49    /**
50    * @param spaces a serialized space reference which can contain one or several spaces (e.g. "space1.space2"). If
51    * a space name contains a dot (".") it must be passed escaped as in "space1\.with\.dot.space2"
52    * @param querystring the URL-encoded Query String. It's important to realize that the implementation of this
53    * method cannot encode it automatically since the Query String is passed as a String (and it's not possible
54    * to differentiate between a '=' character that should be encoded and one that shouldn't. Imagine an input
55    * of 'a=&b=c' which can be understood either as 'a' = '&b=c' or as 'a' = '' and 'b' = 'c'). Ideally
56    * we would need an API signature that accepts a {@code Map<String, String>} for the Query String, for
57    * example
58    */
59    URL createURL(String spaces, String name, String action, String querystring, String anchor, XWikiContext context);
60   
61    /**
62    * @param spaces a serialized space reference which can contain one or several spaces (e.g. "space1.space2"). If
63    * a space name contains a dot (".") it must be passed escaped as in "space1\.with\.dot.space2"
64    * @param querystring the URL-encoded Query String. It's important to realize that the implementation of this
65    * method cannot encode it automatically since the Query String is passed as a String (and it's not possible
66    * to differentiate between a '=' character that should be encoded and one that shouldn't. Imagine an input
67    * of 'a=&b=c' which can be understood either as 'a' = '&b=c' or as 'a' = '' and 'b' = 'c'). Ideally
68    * we would need an API signature that accepts a {@code Map<String, String>} for the Query String, for
69    * example
70    */
71    URL createExternalURL(String spaces, String name, String action, String querystring, String anchor,
72    XWikiContext context);
73   
74    /**
75    * @param spaces a serialized space reference which can contain one or several spaces (e.g. "space1.space2"). If
76    * a space name contains a dot (".") it must be passed escaped as in "space1\.with\.dot.space2"
77    * @param querystring the URL-encoded Query String. It's important to realize that the implementation of this
78    * method cannot encode it automatically since the Query String is passed as a String (and it's not possible
79    * to differentiate between a '=' character that should be encoded and one that shouldn't. Imagine an input
80    * of 'a=&b=c' which can be understood either as 'a' = '&b=c' or as 'a' = '' and 'b' = 'c'). Ideally
81    * we would need an API signature that accepts a {@code Map<String, String>} for the Query String, for
82    * example
83    */
84    URL createURL(String spaces, String name, String action, String querystring, String anchor, String xwikidb,
85    XWikiContext context);
86   
87    /**
88    * @param spaces a serialized space reference which can contain one or several spaces (e.g. "space1.space2"). If
89    * a space name contains a dot (".") it must be passed escaped as in "space1\.with\.dot.space2"
90    * @param querystring the URL-encoded Query String. It's important to realize that the implementation of this
91    * method cannot encode it automatically since the Query String is passed as a String (and it's not possible
92    * to differentiate between a '=' character that should be encoded and one that shouldn't. Imagine an input
93    * of 'a=&b=c' which can be understood either as 'a' = '&b=c' or as 'a' = '' and 'b' = 'c'). Ideally
94    * we would need an API signature that accepts a {@code Map<String, String>} for the Query String, for
95    * example
96    */
97    URL createExternalURL(String spaces, String name, String action, String querystring, String anchor,
98    String xwikidb, XWikiContext context);
99   
100    URL createSkinURL(String filename, String skin, XWikiContext context);
101   
102    URL createSkinURL(String filename, String spaces, String name, XWikiContext context);
103   
104    URL createSkinURL(String filename, String spaces, String name, String xwikidb, XWikiContext context);
105   
106    URL createResourceURL(String filename, boolean forceSkinAction, XWikiContext context);
107   
108    /**
109    * @param spaces a serialized space reference which can contain one or several spaces (e.g. "space1.space2"). If
110    * a space name contains a dot (".") it must be passed escaped as in "space1\.with\.dot.space2"
111    * @param querystring the URL-encoded Query String. It's important to realize that the implementation of this
112    * method cannot encode it automatically since the Query String is passed as a String (and it's not possible
113    * to differentiate between a '=' character that should be encoded and one that shouldn't. Imagine an input
114    * of 'a=&b=c' which can be understood either as 'a' = '&b=c' or as 'a' = '' and 'b' = 'c'). Ideally
115    * we would need an API signature that accepts a {@code Map<String, String>} for the Query String, for
116    * example
117    */
118    URL createAttachmentURL(String filename, String spaces, String name, String action, String querystring,
119    XWikiContext context);
120   
121    /**
122    * @param spaces a serialized space reference which can contain one or several spaces (e.g. "space1.space2"). If
123    * a space name contains a dot (".") it must be passed escaped as in "space1\.with\.dot.space2"
124    * @param querystring the URL-encoded Query String. It's important to realize that the implementation of this
125    * method cannot encode it automatically since the Query String is passed as a String (and it's not possible
126    * to differentiate between a '=' character that should be encoded and one that shouldn't. Imagine an input
127    * of 'a=&b=c' which can be understood either as 'a' = '&b=c' or as 'a' = '' and 'b' = 'c'). Ideally
128    * we would need an API signature that accepts a {@code Map<String, String>} for the Query String, for
129    * example
130    */
131    URL createAttachmentURL(String filename, String spaces, String name, String action, String querystring, String xwikidb,
132    XWikiContext context);
133   
134    /**
135    * @param spaces a serialized space reference which can contain one or several spaces (e.g. "space1.space2"). If
136    * a space name contains a dot (".") it must be passed escaped as in "space1\.with\.dot.space2"
137    * @param querystring the URL-encoded Query String. It's important to realize that the implementation of this
138    * method cannot encode it automatically since the Query String is passed as a String (and it's not possible
139    * to differentiate between a '=' character that should be encoded and one that shouldn't. Imagine an input
140    * of 'a=&b=c' which can be understood either as 'a' = '&b=c' or as 'a' = '' and 'b' = 'c'). Ideally
141    * we would need an API signature that accepts a {@code Map<String, String>} for the Query String, for
142    * example
143    */
144    URL createAttachmentRevisionURL(String filename, String spaces, String name, String revision, String querystring,
145    XWikiContext context);
146   
147    /**
148    * @param spaces a serialized space reference which can contain one or several spaces (e.g. "space1.space2"). If
149    * a space name contains a dot (".") it must be passed escaped as in "space1\.with\.dot.space2"
150    * @param querystring the URL-encoded Query String. It's important to realize that the implementation of this
151    * method cannot encode it automatically since the Query String is passed as a String (and it's not possible
152    * to differentiate between a '=' character that should be encoded and one that shouldn't. Imagine an input
153    * of 'a=&b=c' which can be understood either as 'a' = '&b=c' or as 'a' = '' and 'b' = 'c'). Ideally
154    * we would need an API signature that accepts a {@code Map<String, String>} for the Query String, for
155    * example
156    */
157    URL createAttachmentRevisionURL(String filename, String spaces, String name, String revision, String querystring,
158    String xwikidb, XWikiContext context);
159   
160    URL getRequestURL(XWikiContext context);
161   
162    /**
163    * Converts a URL to a string representation. It's up to the implementation to decide whether to perform
164    * transformations or not on the URL. For example some implementations will convert the URL to a relative URL if the
165    * URL is an internal XWiki URL.
166    *
167    * @param url the URL to convert
168    * @return the converted URL as a string
169    */
170    String getURL(URL url, XWikiContext context);
171   
172    /**
173    * Generate the base external URL to access this server.
174    *
175    * @param context the XWiki context.
176    * @return the URL of the server.
177    * @throws MalformedURLException error when creating the {@link URL}.
178    */
179    URL getServerURL(XWikiContext context) throws MalformedURLException;
180    }