Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

The methods and steps of building enterprise wiki platform by JSPWiki

2025-01-16 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Internet Technology >

Share

Shulou(Shulou.com)06/03 Report--

Open source Wiki engine Apache JSPWiki, based on standard JEE components (Java, servlet, JSP), supports templates, CSS styles, plug-ins, fine-grained security control, autocomplete and other functions, easy to use, rich features, very suitable for building a simple enterprise wiki platform.

Installation

It is recommended to deploy on a Tomcat server, requiring Tomcat 8.x or later, JDK 1.8 or later. The installation steps are as follows:

Download JSPWiki

Select the Apache mirror address, enter the binaries/webapp/ directory, and download JSPWiki.war.

Optionally, rename war, for example, change it to wiki.war, put war in the $TOMCAT_HOME/webapps directory, and start tomcat to access http://myhost/appname/Install.jsp, for initial configuration

The installer will write the settings to $TOMCAT_HOME/temp/jspwiki-custom.properties and create an admin account (the password is randomly generated) and an Admin group. Be careful to save the password prompted on the page.

Stop tomcat and move jspwiki-custom.properties to the $TOMCAT_HOME/lib directory

You can specify the location of the jspwiki-custom.properties by defining the jspwiki.custom.config in the system properties or within the context-param of the web.xml.

You can also move jspwiki-custom.properties to the $TOMCAT_HOME/webapp/appname/WEB-INF directory, but this is not good for upgrading.

By default, the created users and groups are saved in the userdatabase.xml and groupdatabase.xml files in the WEB-INF directory.

The jspwiki-custom.properties content is as follows:

# Wed Feb 26 23:19:26 CST 2020jspwiki.basicAttachmentProvider.storageDir=C\:\ Work\ wikipagesjspwiki.fileSystemProvider.pageDir=C\:\ Work\ wikipagesjspwiki.pageProvider=VersioningFileProviderjspwiki.applicationName=iTRunnerWikijspwiki.workDir=C\:\ Work\ apache-tomcat-9.0.14\ temp

In order to facilitate upgrading, it is best to specify the save location of users and groups within the jspwiki-custom.properties:

Jspwiki.xmlUserDatabaseFilejspwiki.xmlGroupDatabaseFile

You can also use the database:

Jspwiki.userdatabase = org.apache.wiki.auth.user.JDBCUserDatabasejspwiki.groupdatabase = org.apache.wiki.auth.authorize.JDBCGroupDatabase install core pages

Download the wikipages for the language of your choice, then unzip and copy the contents to the jspwiki.fileSystemProvider.pageDir directory you specified earlier. Start tomcat.

Visit wiki

You will be taken to the Main pages where you can learn about JSPWiki and edit these pages.

JSPWiki Configuration

To view the configuration items supported by jspwiki.properties, you can visit the official website, or you can extract the WEB-INF/lib/jspwiki-main.jar,ini directory containing this file, which contains all the attributes.

Some commonly used attributes are listed below:

Jspwiki.baseURL= http://www.itrunner.org/wiki# If this property is set to "true", then page titles are rendered# using an extra space between every capital letter.jspwiki.breakTitleWithSpaces=true# Set the default pagejspwiki.frontPage=Main# Set the default template used by the Wiki enginejspwiki.templateDir=default# Set position of the favorites menu (aka left menu Sidebar) # The value determines the css-class used to change the position of the # favorites block# Possible values: fav-left or fav-right# Default value is fav-leftjspwiki.defaultprefs.template.orientation=fav-right## By default JSPWiki accepts all types of attachments. However, you# can allow some types only, or forbid some other types. # These allow/forbid statements are not enforced for users with AdminPermissions.## These both are space-separated lists of file suffixes## Example: Allow only PNG, JPG, ZIP and JAR file attachmentsjspwiki.attachment.allowed=.png .jpg .zip .jar # Example: Forbid HTML, PHP, ASP and EXEjspwiki.attachment.forbidden=.html .htm .php .asp .exe # Example: Attachment links to HTML, HTM and MP3 files would force a download rather then opening the attachmentjspwiki.attachment.forceDownload= .html .htm # Inline all JPG files, PNG files GIF filesjspwiki.translatorReader.inlinePattern.1 = * .jpgjspwiki.translatorReader.inlinePattern.2 = * .pngjspwiki.translatorReader.inlinePattern.3 = * .gifSecurity

JSPWiki includes a rich and flexible set of security features.

JSPWiki Policy

The default policy file, jspwiki.policy, is located in the WEB-INF directory, and you can use configuration properties to specify a custom policy file location:

Jspwiki.policy.file=jspwiki-custom.policy

JSPWiki Security supports Role and Group, and Role includes the following five types:

All anyone Anonymous anonymous user Asserted does not need to log in, as long as you have edited User Preferences, Authenticated has logged in user Admin administrator

The admin user originally created belongs to the Admin role, Admin group, and has full permissions.

The initial policy is very loose, anonymous users can register, log in, view, modify, and create pages. The default policy is as follows:

PermissionAnonymous usersAsserted users (with cookie) Authenticated usersAdmin groupView all pagesxxxxEdit all pagesxxxxUpload attachments to all pagesxxModify all pages (edit + upload) xxComment on all existing pagesxxxxCreate new pagesxxxxRename all pagesxxDelete all pagesxView all groupsxxxEdit all groupsxxRename all groupsxxDelete all groupsxCreate new groupsxxCreate profilexxxxEdit user preferencesxxEdit user profilexx

Policies are divided into four main types of permissions:

PagePermission: view, edit, modify, comment, rename, upload, deleteGroupPermission: view, edit, deleteWikiPermission: createGroups, createPages, login, editPreferences, editProfileAllPermission Grant all permissions

Some permissions mean other permissions:

The "rename" PagePermission implies "modify" The "modify" PagePermission implies "edit" and "upload" The "edit" PagePermission implies "view" and "comment" The "upload" PagePermission implies "view" The "delete" PagePermission implies "edit" The "createGroups" WikiPermission implies "createPages" The "edit" GroupPermission implies "view" The "delete" GroupPermission "implies" edit "edit"

In addition to configuring permissions uniformly in the policy file, you can also set permissions individually on each page, such as:

[{ALLOW edit Admin}]

[{ALLOW view All}]

Permissions can be granted to roles, groups, or users.

AdminPages

For security reasons, AdminPages is not enabled by default. To enable adding the following configuration:

Jspwiki-x.adminui.enable=truejspwiki-x.securityconfig.enable=true

There are two administrative pages with the following paths:

/ admin/Admin.jsp/admin/SecurityConfig.jsp

Admin.jsp can create and edit users and groups:

SecurityConfig.jsp checks the security configuration of JSPWiki, allowing you to view users, groups, and ACL configurations in the current Wiki:

Edit Wiki

JSPWiki provides a friendly editing interface:

Two modes are supported: plain and wysiwyg. The default is plain. Click the drip button to pop up the toolbar:

Selecting a tool will output the corresponding wiki statement, and plugin, style, font, special character, ACL and other tools will also display supported options. After you are familiar with wiki syntax, you can leave the toolbar and enter directly, which is very convenient.

Wiki Syntax

Clicking Help while editing wiki displays the following information:

-horizontal separator\\ force line break [link] to create a hyperlink of "link", where "link" can be an internal Wiki name (Wiki page name) or an external link (http://) [text | link] to create a hyperlink that displays text different from the actual hyperlink, where "text" is the text to be displayed. "link" is the actual hyperlink. [text | wiki:link] create a hyperlink that displays a different text from the actual hyperlink, and the hyperlink points to the specified Wiki (such as JSPWiki, MediaWiki, and so on). This kind of link supports links between Wiki. * create a list of items ('* 'must be the first character on the line). Secondary bullets are represented by consecutive asterisks (*). # create a numbered list ('# 'must be the first character on the line). Multiple consecutive # signs (# #, # #) are used to represent indented / secondary numbers. !,!!,! Add an exclamation point at the beginning of the line (! ) generate a title The more exclamation points, the larger the title. _ _ text__ text is bold.'' Text'' gives the text an italic effect (note that it is in single quotation marks) {{text}} to make the text an equivalent font. Term:def uses' def' to define 'term'. A short comment can be expressed with an empty 'term' (for example,;: Created on 2008-02-28). | text | more text generates tables. The two vertical bars "| |" represent the table title.

For more Wiki Syntax, please see the official website.

Wiki Style

CSS styles

Following styles are supported by the standard jspwiki.css file:

% small-Smaller then normal font%%sub-- Subscript%%sup-- Superscript%%strike-- Strike through text%%ltr-- left-to-right text formatting%%rtl-- right-to-left text formatting%%commentbox-- commentbox floating at the right margin

Dynamic styles

% collapse-Turn ordinary lists into collapsible trees.%%collapsebox-- Creates a collapsible box which slides in/out vertically.%%category-- Generates pop up with pages referenced by the category page.%%tip-- Generates a transparent fly-over tip with additional info.%%graphbar-- Add horizontal or vertical graph bars to your wikipages.%%sortable-- Turn ordinary wiki tables into sortable tables.%%table-filter-- Turn ordinary wiki tables into Excel-like filtered tables.%%zebra-table-- Add alternate row colors to your tables .% columns-- Format text in multi-column news-paper format.%%tabbedSection % tab-Create pages with tabular sections.%%tabbedAccordion-Generates a tabbed section, with smooth transition effects based on accordion.%%accordion-Generates vertical accordion.%%prettify-Add code-coloring to a preformatted block of text.%%slimbox-Generates a fancy picture viewer for all enclosed links, similar to the attachment viewer.%%reflection-Generates a reflection at the bottom of the image.

For example:

The LeftMenu of the official JSPWiki page, combined with% list-unstyled-hover,%%accordion:

%% list Mustang unstyled Getting Started%% accordion general general * [News] * [Getting Started] * [Wiki Syntax] * [Downloads] * [ReleaseNotes | NewIn] * [FAQ] * [License | http://www.apache.org/licenses/]!Community* [Getting Started] * [Getting Involved] * [Documentation] * [Legacy site | http://www.ecyrd.com/JSPWiki/]* [Mailing lists | Mailing Lists] * [Social media | Social Media] * [People]! Development* [ Browse sources | https://github.com/apache/jspwiki]* [JavaDoc | http://jspwiki.apache.org/apidocs/index.html]* [Binary compatibility reports | http://jspwiki.apache.org/japicmp/index.html]* [Get and build source | Building from source code] * [Issue tracker | https://issues.apache.org/jira/browse/JSPWIKI]* [Jenkins build | https://builds.apache.org/job/JSPWiki/]* [Sonar Analysis | https://sonarcloud.io/dashboard?id=jspwiki-builder ] * [ChangeLog | https://jspwiki.apache.org/development/changelog.html]* [Other stuff]! PMC* [How to release] * [Board Reports]! Special Pages* [Recent Changes] * [Search] * [PageIndex | PageIndex] * [SystemInfo]! Referenced by [{ReferringPagesPlugin max=20] Maxwidth=50}] /% /%

Unframed table:

%% table-noborder | | Column 1 | | Column 2 | | Column 3 | Text | Text | Text /%

JSPWiki supports custom styles, such as:

Add-css

Table {

Margin: 20px

Width: 100%

Text-align: center

}

Table td {

Text-align: center

}

/%

You can also add attributes, such as:

[{Image src='Main/tool.JPG' style='text-align: center; width: 800pxbot'}] Wiki Plugin

JSPWiki provides many plug-ins, which are not listed here, such as commonly used directory plug-ins [{TableOfContents}], ACL plug-ins [{ALLOW plugin principal}], Image plug-ins [{Image src='image.jpg'}].

Reserved Pages

Reserved pages are fixed-name pages for special purposes, such as CopyrightNotice, LeftMenu, LeftMenuFooter, which are used in Wiki Template.

WikiTemplate

Currently, JSPWiki provides four sets of templates: default, 210, raw and reader, which are located in the templates directory of war and can be customized by users.

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Internet Technology

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report