public class DefaultURLConstructor extends Object implements URLConstructor
Modifier and Type | Field and Description |
---|---|
protected WikiEngine |
m_engine |
protected String |
m_pathPrefix
Contains the absolute path of the JSPWiki Web application without the
actual servlet (which is the m_urlPrefix).
|
Constructor and Description |
---|
DefaultURLConstructor() |
Modifier and Type | Method and Description |
---|---|
protected String |
doReplacement(String baseptrn,
String name,
boolean absolute)
Does replacement of some particular variables.
|
String |
getForwardPage(javax.servlet.http.HttpServletRequest request)
This method is not needed for the DefaultURLConstructor.
|
static String |
getURLPattern(String context,
String name)
Returns the URL pattern for a supplied wiki request context.
|
void |
initialize(WikiEngine engine,
Properties properties)
Initializes.
|
String |
makeURL(String context,
String name,
boolean absolute,
String parameters)
Constructs the URL with a bunch of parameters.
|
String |
parsePage(String context,
javax.servlet.http.HttpServletRequest request,
Charset encoding)
Should parse the "page" parameter from the actual
request.
|
static String |
parsePageFromURL(javax.servlet.http.HttpServletRequest request,
Charset encoding)
Takes the name of the page from the request URI.
|
protected WikiEngine m_engine
protected String m_pathPrefix
public DefaultURLConstructor()
public void initialize(WikiEngine engine, Properties properties)
initialize
in interface URLConstructor
engine
- The WikiEngine that this URLConstructor belongs toproperties
- Properties used to initializeprotected final String doReplacement(String baseptrn, String name, boolean absolute)
baseptrn
- The pattern to usename
- The page nameabsolute
- If true, %u is always the entire base URL, otherwise it depends on
the setting in jspwiki.properties.public static String getURLPattern(String context, String name) throws IllegalArgumentException
context
- the wiki contextname
- the wiki pageIllegalArgumentException
- if the context cannot be foundpublic String makeURL(String context, String name, boolean absolute, String parameters)
makeURL
in interface URLConstructor
parameters
- If null or empty, no parameters are added.
An URL parameter string (these must be URL-encoded, and separated with &)context
- The request context (@see WikiContext) that you want the URL forname
- The page name (or in case of WikiContext.NONE, the auxiliary JSP page
or resource you want to point at). This must be URL encoded. Null is NOT safe.absolute
- True, if you need an absolute URL. False, if both relative and absolute URLs are fine.public String parsePage(String context, javax.servlet.http.HttpServletRequest request, Charset encoding)
parsePage
in interface URLConstructor
context
- In which request context the request was made (this should help in parsing)request
- The HTTP request that was used when coming hereencoding
- The encoding with which the request was made (UTF-8 or ISO-8859-1).public static String parsePageFromURL(javax.servlet.http.HttpServletRequest request, Charset encoding)
request
- The request to parseencoding
- The encoding to usepublic String getForwardPage(javax.servlet.http.HttpServletRequest request)
getForwardPage
in interface URLConstructor
request
- The HTTP Request that was used to end up in this page.Copyright © 2001-2019 The Apache Software Foundation. All rights reserved.