| java.lang.Object com.ecyrd.jspwiki.WikiEngine
WikiEngine | public class WikiEngine (Code) | | Provides Wiki services to the JSP page.
This is the main interface through which everything should go.
Using this class: Always get yourself an instance from JSP page
by using the WikiEngine.getInstance() method. Never create a new
WikiEngine() from scratch, unless you're writing tests.
There's basically only a single WikiEngine for each web application, and
you should always get it using the WikiEngine.getInstance() method.
author: Janne Jalkanen |
Constructor Summary | |
public | WikiEngine(Properties properties) Instantiate the WikiEngine using a given set of properties. | protected | WikiEngine(ServletContext context, String appid, Properties props) Instantiate using this method when you're running as a servlet and
WikiEngine will figure out where to look for the property
file. |
Method Summary | |
public String | beautifyTitle(String title) Beautifies the title of the page by appending spaces in suitable
places, if the user has so decreed in the properties when constructing
this WikiEngine. | public String | beautifyTitleNoBreak(String title) Beautifies the title of the page by appending non-breaking spaces
in suitable places. | public WikiContext | createContext(HttpServletRequest request, String requestContext) | public WikiContext | createContext(HttpServletRequest request, HttpServletResponse response, String requestContext) Shortcut to create a WikiContext from the Wiki page. | public String | decodeName(String pagerequest) | public void | deletePage(String pageName) Deletes a page or an attachment completely, including all versions. | public void | deleteVersion(WikiPage page) Deletes a specific version of a page or an attachment. | public String | encodeName(String pagename) Turns a WikiName into something that can be
called through using an URL. | public Collection | findPages(String query) Parses an incoming search request, then
does a search. | public Collection | getAllInlinedImagePatterns() Returns a collection of all image types that get inlined. | public Collection | getAllInterWikiLinks() Returns a collection of all supported InterWiki links. | public String | getApplicationName() Returns the name of the application. | public AttachmentManager | getAttachmentManager() Returns the current AttachmentManager. | public String | getAttachmentURL(String attName) Returns the basic attachment URL. | public AuthorizationManager | getAuthorizationManager() Returns the currently used authorization manager. | public String | getBaseURL() Returns the base URL. | public CommunityContext | getCommunityContext() | public String | getContentEncoding() Returns the IANA name of the character set encoding we're
supposed to be using right now. | public String | getCurrentProvider() | public String | getCurrentProviderInfo() return information about current provider. | public String | getDiff(String page, int version1, int version2) Returns a diff of two versions of a page.
Parameters: page - Page to return Parameters: version1 - Version number of the old page. | public String | getEditURL(String pageName) Returns the basic URL to an editor. | public FilterManager | getFilterManager() Returns the manager responsible for the filters. | public String | getFinalPageName(String page) Returns the correct page name, or null, if no such
page can be found. | public String | getFrontPage() Returns the default front page, if no page is used. | public String | getGlobalRSSURL() Returns the URL of the global RSS file. | public String | getHTML(WikiContext context, WikiPage page) Returns the converted HTML of the page using a different
context than the default context. | public String | getHTML(String page) Returns the converted HTML of the page. | public String | getHTML(String pagename, int version) Returns the converted HTML of the page's specific version. | public static synchronized WikiEngine | getInstance(ServletConfig config) Gets a WikiEngine related to this servlet. | public static synchronized WikiEngine | getInstance(ServletConfig config, Properties props) Gets a WikiEngine related to the servlet. | public static synchronized WikiEngine | getInstance(ServletContext context, Properties props) Gets a WikiEngine related to the servlet. | public String | getInterWikiURL(String wikiName) Returns an URL to some other Wiki that we know. | public WikiPage | getPage(String pagereq) Return a bunch of information from the web page. | public WikiPage | getPage(String pagereq, int version) Returns specific information about a Wiki page. | public int | getPageCount() | public PageManager | getPageManager() Returns the current PageManager. | public PluginManager | getPluginManager() Returns the current plugin manager. | public String | getPluginSearchPath() Don't use. | public String | getPureText(String page, int version) Returns the pure text of a page, no conversions. | public String | getPureText(WikiPage page) Returns the pure text of a page, no conversions. | public RSSGenerator | getRSSGenerator() | public Collection | getRecentChanges() Returns a Collection of WikiPages, sorted in time
order of last change. | public String | getRedirectURL(WikiContext context) Figure out to which page we are really going to. | public ReferenceManager | getReferenceManager() Returns this object's ReferenceManager. | public static String | getRelativePageName(String page) | public static String | getRelativeToWikiPageName(String page) | public static String | getRequiredProperty(Properties props, String key) Throws an exception if a property is not found.
Parameters: props - A set of properties to search the key in. Parameters: key - The key to look for. | public String | getRootPath() | public SearchManager | getSearchManager() Returns the manager responsible for searching the Wiki. | public ServletContext | getServletContext() Returns the ServletContext that this particular WikiEngine was
initialized with. | public String | getSpecialPageReference(String original) If the page is a special page, then returns a direct URL
to that page. | public Date | getStartTime() Returns the moment when this engine was started. | public String | getTemplateDir() Returns the current template directory. | public TemplateManager | getTemplateManager() | public String | getText(String page) Returns the un-HTMLized text of the latest version of a page.
This method also replaces the < and & -characters with
their respective HTML entities, thus making it suitable
for inclusion on an HTML page. | public String | getText(String page, int version) Returns the un-HTMLized text of the given version of a page.
This method also replaces the < and & -characters with
their respective HTML entities, thus making it suitable
for inclusion on an HTML page. | public String | getText(WikiContext context, WikiPage page) Returns the un-HTMLized text of the given version of a page in
the given context. | public String | getURL(String context, String pageName, String params, boolean absolute) Returns an URL if a WikiContext is not available.
Parameters: context - The WikiContext (VIEW, EDIT, etc...) Parameters: pageName - Name of the page, as usual Parameters: params - List of parameters. | public URLConstructor | getURLConstructor() | public UserManager | getUserManager() Returns the currently used user manager. | public String | getVariable(WikiContext context, String name) Shortcut to getVariableManager().getValue(). | public VariableManager | getVariableManager() | public List | getVersionHistory(String page) Returns a Collection of WikiPages containing the
version history of a page. | public String | getViewURL(String pageName) Returns the basic URL to a page, without any modifications. | public static String | getWikiName(String page) | public Properties | getWikiProperties() Internal method for getting a property. | public String | getWorkDir() Returns the JSPWiki working directory. | public static String | makeAbsolutePageName(String page) | public static String | makeProviderPageName(String page) | public boolean | pageExists(String page) Returns true, if the requested page (or an alias) exists. | public boolean | pageExists(String page, int version) Returns true, if the requested page (or an alias) exists with the
requested version. | public boolean | pageExists(WikiPage page) Returns true, if the requested page (or an alias) exists, with the
specified version in the WikiPage. | public String | safeGetParameter(ServletRequest request, String name) This is a safe version of the Servlet.Request.getParameter() routine. | public String | safeGetQueryString(HttpServletRequest request) Returns the query string (the portion after the question mark).
The query string. | public void | saveText(WikiContext context, String text) Writes the WikiText of a page into the
page repository. | protected Collection | scanWikiLinks(WikiPage page, String pagedata) Reads a WikiPageful of data from a String and returns all links
internal to this Wiki in a Collection. | public void | setCommunityContext(CommunityContext cctx) | public String | textToHTML(WikiContext context, String pagedata) Converts raw page data to HTML. | public String | textToHTML(WikiContext context, String pagedata, StringTransmutator localLinkHook, StringTransmutator extLinkHook) Just convert WikiText to HTML. | public String | textToHTML(WikiContext context, String pagedata, StringTransmutator localLinkHook, StringTransmutator extLinkHook, StringTransmutator attLinkHook) Just convert WikiText to HTML. | public void | updateReferences(WikiPage page) Updates all references for the given page. |
DEFAULT_PROPERTYFILE | final public static String DEFAULT_PROPERTYFILE(Code) | | Path to the default property file.
|
PARAM_PROPERTYFILE | final public static String PARAM_PROPERTYFILE(Code) | | The web.xml parameter that defines where the config file is to be found.
If it is not defined, uses the default as defined by DEFAULT_PROPERTYFILE.
|
PREFS_COOKIE_NAME | final public static String PREFS_COOKIE_NAME(Code) | | The name of the cookie that gets stored to the user browser.
|
PROP_APPNAME | final public static String PROP_APPNAME(Code) | | Property for application name
|
PROP_BASEURL | final public static String PROP_BASEURL(Code) | | The name for the base URL to use in all references.
|
PROP_BEAUTIFYTITLE | final public static String PROP_BEAUTIFYTITLE(Code) | | Property name for the "spaces in titles" -hack.
|
PROP_ENCODING | final public static String PROP_ENCODING(Code) | | Define the used encoding. Currently supported are ISO-8859-1 and UTF-8
|
PROP_FRONTPAGE | final public static String PROP_FRONTPAGE(Code) | | Property name for the default front page.
|
PROP_INTERWIKIREF | final public static String PROP_INTERWIKIREF(Code) | | Property start for any interwiki reference.
|
PROP_MATCHPLURALS | final public static String PROP_MATCHPLURALS(Code) | | Property name for the "match english plurals" -hack.
|
PROP_PAGETEMPLATESCONFIGDIR | final public static String PROP_PAGETEMPLATESCONFIGDIR(Code) | | repository template location (nb: main wiki is already initialised by page provider)
|
PROP_RUNFILTERS | final public static String PROP_RUNFILTERS(Code) | | If this property is set to false, all filters are disabled when translating.
|
PROP_STOREUSERNAME | final public static String PROP_STOREUSERNAME(Code) | | If true, then the user name will be stored with the page data.
|
PROP_TEMPLATEDIR | final public static String PROP_TEMPLATEDIR(Code) | | Property name for the template that is used.
|
PROP_URLCONSTRUCTOR | final public static String PROP_URLCONSTRUCTOR(Code) | | Property name for setting the url generator instance
|
PROP_WORKDIR | final public static String PROP_WORKDIR(Code) | | Property name for where the jspwiki work directory should be.
If not specified, reverts to ${java.tmpdir}.
|
WikiEngine | public WikiEngine(Properties properties) throws WikiException(Code) | | Instantiate the WikiEngine using a given set of properties.
Use this constructor for testing purposes only.
|
WikiEngine | protected WikiEngine(ServletContext context, String appid, Properties props) throws WikiException(Code) | | Instantiate using this method when you're running as a servlet and
WikiEngine will figure out where to look for the property
file.
Do not use this method - use WikiEngine.getInstance() instead.
|
beautifyTitle | public String beautifyTitle(String title)(Code) | | Beautifies the title of the page by appending spaces in suitable
places, if the user has so decreed in the properties when constructing
this WikiEngine. However, attachment names are not beautified, no
matter what.
since: 1.7.11 |
beautifyTitleNoBreak | public String beautifyTitleNoBreak(String title)(Code) | | Beautifies the title of the page by appending non-breaking spaces
in suitable places. This is really suitable only for HTML output,
as it uses the -character.
since: 2.1.127 |
deletePage | public void deletePage(String pageName) throws ProviderException(Code) | | Deletes a page or an attachment completely, including all versions.
Parameters: pageName - throws: ProviderException - |
deleteVersion | public void deleteVersion(WikiPage page) throws ProviderException(Code) | | Deletes a specific version of a page or an attachment.
Parameters: page - throws: ProviderException - |
encodeName | public String encodeName(String pagename)(Code) | | Turns a WikiName into something that can be
called through using an URL.
since: 1.4.1 |
findPages | public Collection findPages(String query) throws ProviderException, IOException(Code) | | Parses an incoming search request, then
does a search.
The query is dependent on the actual chosen search provider - each one of them has
a language of its own.
|
getAllInlinedImagePatterns | public Collection getAllInlinedImagePatterns()(Code) | | Returns a collection of all image types that get inlined.
|
getAllInterWikiLinks | public Collection getAllInterWikiLinks()(Code) | | Returns a collection of all supported InterWiki links.
|
getApplicationName | public String getApplicationName()(Code) | | Returns the name of the application.
|
getAttachmentManager | public AttachmentManager getAttachmentManager()(Code) | | Returns the current AttachmentManager.
since: 1.9.31. |
getAttachmentURL | public String getAttachmentURL(String attName)(Code) | | Returns the basic attachment URL.
since: 2.0.42. |
getAuthorizationManager | public AuthorizationManager getAuthorizationManager()(Code) | | Returns the currently used authorization manager.
|
getBaseURL | public String getBaseURL()(Code) | | Returns the base URL. Always prepend this to any reference
you make.
since: 1.6.1 |
getContentEncoding | public String getContentEncoding()(Code) | | Returns the IANA name of the character set encoding we're
supposed to be using right now.
since: 1.5.3 |
getCurrentProvider | public String getCurrentProvider()(Code) | | Returns the provider name
|
getCurrentProviderInfo | public String getCurrentProviderInfo()(Code) | | return information about current provider.
since: 1.6.4 |
getDiff | public String getDiff(String page, int version1, int version2)(Code) | | Returns a diff of two versions of a page.
Parameters: page - Page to return Parameters: version1 - Version number of the old page. If WikiPageProvider.LATEST_VERSION (-1), then uses current page. Parameters: version2 - Version number of the new page. If WikiPageProvider.LATEST_VERSION (-1), then uses current page. A HTML-ized difference between two pages. If there is no difference,returns an empty string. |
getEditURL | public String getEditURL(String pageName)(Code) | | Returns the basic URL to an editor.
since: 2.0.3 |
getFilterManager | public FilterManager getFilterManager()(Code) | | Returns the manager responsible for the filters.
since: 2.1.88 |
getFinalPageName | public String getFinalPageName(String page) throws ProviderException(Code) | | Returns the correct page name, or null, if no such
page can be found. Aliases are considered.
In some cases, page names can refer to other pages. For example,
when you have matchEnglishPlurals set, then a page name "Foobars"
will be transformed into "Foobar", should a page "Foobars" not exist,
but the page "Foobar" would. This method gives you the correct
page name to refer to.
This facility can also be used to rewrite any page name, for example,
by using aliases. It can also be used to check the existence of any
page.
since: 2.0 Parameters: page - Page name. The rewritten page name, or null, if the page does not exist. |
getFrontPage | public String getFrontPage()(Code) | | Returns the default front page, if no page is used.
|
getGlobalRSSURL | public String getGlobalRSSURL()(Code) | | Returns the URL of the global RSS file. May be null, if the
RSS file generation is not operational.
since: 1.7.10 |
getHTML | public String getHTML(WikiContext context, WikiPage page)(Code) | | Returns the converted HTML of the page using a different
context than the default context.
|
getHTML | public String getHTML(String page)(Code) | | Returns the converted HTML of the page.
Parameters: page - WikiName of the page to convert. |
getHTML | public String getHTML(String pagename, int version)(Code) | | Returns the converted HTML of the page's specific version.
The version must be a positive integer, otherwise the current
version is returned.
Parameters: pagename - WikiName of the page to convert. Parameters: version - Version number to fetch |
getInstance | public static synchronized WikiEngine getInstance(ServletConfig config) throws InternalWikiException(Code) | | Gets a WikiEngine related to this servlet. Since this method
is only called from JSP pages (and JspInit()) to be specific,
we throw a RuntimeException if things don't work.
Parameters: config - The ServletConfig object for this servlet. A WikiEngine instance. throws: InternalWikiException - in case something fails. Thisis a RuntimeException, so be prepared for it. |
getInstance | public static synchronized WikiEngine getInstance(ServletConfig config, Properties props)(Code) | | Gets a WikiEngine related to the servlet. Works like getInstance(ServletConfig),
but does not force the Properties object. This method is just an optional way
of initializing a WikiEngine for embedded JSPWiki applications; normally, you
should use getInstance(ServletConfig).
Parameters: config - The ServletConfig of the webapp servlet/JSP calling this method. Parameters: props - A set of properties, or null, if we are to load JSPWiki's default jspwiki.properties (this is the usual case). |
getInstance | public static synchronized WikiEngine getInstance(ServletContext context, Properties props) throws InternalWikiException(Code) | | Gets a WikiEngine related to the servlet. Works just like getInstance( ServletConfig )
Parameters: config - The ServletContext of the webapp servlet/JSP calling this method. Parameters: props - A set of properties, or null, if we are to load JSPWiki's default jspwiki.properties (this is the usual case). |
getInterWikiURL | public String getInterWikiURL(String wikiName)(Code) | | Returns an URL to some other Wiki that we know.
null, if no such reference was found. |
getPage | public WikiPage getPage(String pagereq)(Code) | | Return a bunch of information from the web page.
|
getPage | public WikiPage getPage(String pagereq, int version)(Code) | | Returns specific information about a Wiki page.
since: 1.6.7. |
getPageCount | public int getPageCount()(Code) | | Returns the number of pages in this Wiki
|
getPageManager | public PageManager getPageManager()(Code) | | Returns the current PageManager.
|
getPluginManager | public PluginManager getPluginManager()(Code) | | Returns the current plugin manager.
since: 1.6.1 |
getPluginSearchPath | public String getPluginSearchPath()(Code) | | Don't use.
since: 1.8.0 |
getPureText | public String getPureText(String page, int version)(Code) | | Returns the pure text of a page, no conversions. Use this
if you are writing something that depends on the parsing
of the page. Note that you should always check for page
existence through pageExists() before attempting to fetch
the page contents.
Parameters: page - The name of the page to fetch. Parameters: version - If WikiPageProvider.LATEST_VERSION, then uses the latest version. The page contents. If the page does not exist,returns an empty string. |
getPureText | public String getPureText(WikiPage page)(Code) | | Returns the pure text of a page, no conversions. Use this
if you are writing something that depends on the parsing
the page. Note that you should always check for page
existence through pageExists() before attempting to fetch
the page contents.
Parameters: page - A handle to the WikiPage String of WikiText. since: 2.1.13. |
getRSSGenerator | public RSSGenerator getRSSGenerator()(Code) | | since: 2.1.165 |
getRecentChanges | public Collection getRecentChanges()(Code) | | Returns a Collection of WikiPages, sorted in time
order of last change.
|
getRedirectURL | public String getRedirectURL(WikiContext context)(Code) | | Figure out to which page we are really going to. Considers
special page names from the jspwiki.properties, and possible aliases.
Parameters: context - The Wiki Context in which the request is being made. A complete URL to the new page to redirect to since: 2.2 |
getReferenceManager | public ReferenceManager getReferenceManager()(Code) | | Returns this object's ReferenceManager.
since: 1.6.1 |
getRelativeToWikiPageName | public static String getRelativeToWikiPageName(String page)(Code) | | Return a page name relative to the curent wiki
eg, if current wiki is blah then blah:Main -> Main, blech:Main -> blech:Main
|
getRequiredProperty | public static String getRequiredProperty(Properties props, String key) throws NoRequiredPropertyException(Code) | | Throws an exception if a property is not found.
Parameters: props - A set of properties to search the key in. Parameters: key - The key to look for. The required property throws: NoRequiredPropertyException - If the search key is not in the property set. |
getSearchManager | public SearchManager getSearchManager()(Code) | | Returns the manager responsible for searching the Wiki.
since: 2.2.21 |
getServletContext | public ServletContext getServletContext()(Code) | | Returns the ServletContext that this particular WikiEngine was
initialized with. It may return null, if the WikiEngine is not
running inside a servlet container!
since: 1.7.10 ServletContext of the WikiEngine, or null. |
getSpecialPageReference | public String getSpecialPageReference(String original)(Code) | | If the page is a special page, then returns a direct URL
to that page. Otherwise returns null.
Special pages are non-existant references to other pages.
For example, you could define a special page reference
"RecentChanges" which would always be redirected to "RecentChanges.jsp"
instead of trying to find a Wiki page called "RecentChanges".
|
getStartTime | public Date getStartTime()(Code) | | Returns the moment when this engine was started.
since: 2.0.15. |
getTemplateDir | public String getTemplateDir()(Code) | | Returns the current template directory.
since: 1.9.20 |
getTemplateManager | public TemplateManager getTemplateManager()(Code) | | |
getText | public String getText(String page)(Code) | | Returns the un-HTMLized text of the latest version of a page.
This method also replaces the < and & -characters with
their respective HTML entities, thus making it suitable
for inclusion on an HTML page. If you want to have the
page text without any conversions, use getPureText().
Parameters: page - WikiName of the page to fetch. WikiText. |
getText | public String getText(String page, int version)(Code) | | Returns the un-HTMLized text of the given version of a page.
This method also replaces the < and & -characters with
their respective HTML entities, thus making it suitable
for inclusion on an HTML page. If you want to have the
page text without any conversions, use getPureText().
Parameters: page - WikiName of the page to fetch Parameters: version - Version of the page to fetch WikiText. |
getText | public String getText(WikiContext context, WikiPage page)(Code) | | Returns the un-HTMLized text of the given version of a page in
the given context. USE THIS METHOD if you don't know what
doing.
This method also replaces the < and & -characters with
their respective HTML entities, thus making it suitable
for inclusion on an HTML page. If you want to have the
page text without any conversions, use getPureText().
since: 1.9.15. |
getURL | public String getURL(String context, String pageName, String params, boolean absolute)(Code) | | Returns an URL if a WikiContext is not available.
Parameters: context - The WikiContext (VIEW, EDIT, etc...) Parameters: pageName - Name of the page, as usual Parameters: params - List of parameters. May be null, if no parameters. Parameters: absolute - If true, will generate an absolute URL regardless of properties setting. |
getURLConstructor | public URLConstructor getURLConstructor()(Code) | | since: 2.2.6 |
getUserManager | public UserManager getUserManager()(Code) | | Returns the currently used user manager.
|
getVariable | public String getVariable(WikiContext context, String name)(Code) | | Shortcut to getVariableManager().getValue(). However, this method does not
throw a NoSuchVariableException, but returns null in case the variable does
not exist.
since: 2.2 |
getVariableManager | public VariableManager getVariableManager()(Code) | | |
getVersionHistory | public List getVersionHistory(String page)(Code) | | Returns a Collection of WikiPages containing the
version history of a page.
|
getViewURL | public String getViewURL(String pageName)(Code) | | Returns the basic URL to a page, without any modifications.
You may add any parameters to this.
since: 2.0.3 |
getWikiProperties | public Properties getWikiProperties()(Code) | | Internal method for getting a property. This is used by the
TranslatorReader for example.
|
getWorkDir | public String getWorkDir()(Code) | | Returns the JSPWiki working directory.
since: 2.1.100 |
pageExists | public boolean pageExists(String page)(Code) | | Returns true, if the requested page (or an alias) exists. Will consider
any version as existing. Will also consider attachments.
Parameters: page - WikiName of the page. |
pageExists | public boolean pageExists(String page, int version) throws ProviderException(Code) | | Returns true, if the requested page (or an alias) exists with the
requested version.
Parameters: page - Page name |
pageExists | public boolean pageExists(WikiPage page) throws ProviderException(Code) | | Returns true, if the requested page (or an alias) exists, with the
specified version in the WikiPage.
since: 2.0 |
safeGetParameter | public String safeGetParameter(ServletRequest request, String name)(Code) | | This is a safe version of the Servlet.Request.getParameter() routine.
Unfortunately, the default version always assumes that the incoming
character set is ISO-8859-1, even though it was something else.
This means that we need to make a new string using the correct
encoding.
For more information, see:
JGuru FAQ.
Incidentally, this is almost the same as encodeName(), below.
I am not yet entirely sure if it's safe to merge the code.
since: 1.5.3 |
safeGetQueryString | public String safeGetQueryString(HttpServletRequest request)(Code) | | Returns the query string (the portion after the question mark).
The query string. If the query string is null,returns an empty string. since: 2.1.3 |
saveText | public void saveText(WikiContext context, String text) throws WikiException(Code) | | Writes the WikiText of a page into the
page repository.
since: 2.1.28 Parameters: context - The current WikiContext Parameters: text - The Wiki markup for the page. |
scanWikiLinks | protected Collection scanWikiLinks(WikiPage page, String pagedata)(Code) | | Reads a WikiPageful of data from a String and returns all links
internal to this Wiki in a Collection.
|
textToHTML | public String textToHTML(WikiContext context, String pagedata)(Code) | | Converts raw page data to HTML.
Parameters: pagedata - Raw page data to convert to HTML |
textToHTML | public String textToHTML(WikiContext context, String pagedata, StringTransmutator localLinkHook, StringTransmutator extLinkHook)(Code) | | Just convert WikiText to HTML.
|
textToHTML | public String textToHTML(WikiContext context, String pagedata, StringTransmutator localLinkHook, StringTransmutator extLinkHook, StringTransmutator attLinkHook)(Code) | | Just convert WikiText to HTML.
|
updateReferences | public void updateReferences(WikiPage page)(Code) | | Updates all references for the given page.
|
|
|