JSPWiki/Glassfish Install (Part 13 of 18: Configure JSPWiki)

As with everything in this walk through I recommend poking around to gain an understanding of what is happening but to speed things along I will provide some blocks of configuration to include in certain files. Some if the items I provide may already exist in a give file but maybe commented out. It is your decision with regard to appending my configuration or editing/uncommenting those settings which already exist in the given file.

In the new folder that was created, “jspwiki-2.4.100-bin” locate the “war” file named “JSPWiki.war.”

  • Use 7-zip to decompress this file.

Important Note: Move the original “JSPWiki.war” file to a safe place just in case one of the configuration files gets scrambled when we make changes.

Navigate into the new folder and locate the WEB-INF folder. Most of our significant configuration changes will be performed on files within this folder:

  • jspwiki-2.4.100-bin\JSPWiki\JSPWiki\WEB-INF

web.xml File

The web.xml contains settings that determine what Glassfish understands about the JSPWiki application and much of how Glassfish and the JSPWiki application will interact. The settings in which we are most interested relate to:

  1. How JSPWiki will reference the JDBC data source we setup earlier

  2. The directives of when and how Glassfish will authenticate users

  • Open/Edit the web.xml file.
  • Append the following lines to the end of the web.xml file but before the ending entry:

[START web.xml snippet]

Resource reference to JNDI factory for the JDBCUserDatabase.

jdbc/WikiSource

javax.sql.DataSource

Container

Force Login

Force Login

/Wiki.jsp
GET
PUT
HEAD
POST
DELETE

Admin
Authenticated

Administrative Area
/Delete.jsp

Admin

CONFIDENTIAL

Authenticated area
/Edit.jsp
/Comment.jsp
/Login.jsp
/NewGroup.jsp
/Rename.jsp
/Upload.jsp
DELETE
GET
HEAD
POST
PUT

Read-only Area
/attach
DELETE
POST
PUT

Admin
Authenticated

CONFIDENTIAL

FORM
jdbc-realm

/LoginForm.jsp
/LoginForm.jsp

This logical role includes all authenticated users

Authenticated

This logical role includes all administrative users

Admin

[END web.xml snippet]

The biggest changes from those that exist in the file but are commented out are:

  1. Setting the reference to jdbc/WikiSource

  2. Adding the “Force Login” security-constraint section

  3. Adding the “jdbc-realm” realm-name to the login-config section

jspwiki.properties File

Open/Edit the jspwiki.properties file. Most of the items will remain at their default values but we need to alter a few. Remember to uncomment (remove the # before the setting if there is one) for each of these items:

jspwiki.pageProvider = VersioningFileProvider
jspwiki.usePageCache = true
jspwiki.fileSystemProvider.pageDir = C:\\java\\jspwiki\\pages
jspwiki.workDir = C:\\java\\jspwiki\\work
jspwiki.attachmentProvider = BasicAttachmentProvider
jspwiki.basicAttachmentProvider.storageDir = C:\\java\\jspwiki\\attachments

jspwiki.authorizer = com.ecyrd.jspwiki.auth.authorize.WebContainerAuthorizer
jspwiki.userdatabase = com.ecyrd.jspwiki.auth.user.JDBCUserDatabase
jspwiki.userdatabase.isSharedWithContainer = false

jspwiki.userdatabase.datasource=jdbc/WikiSource
jspwiki.userdatabase.table=auth
jspwiki.userdatabase.email=email
jspwiki.userdatabase.fullName=fullname
jspwiki.userdatabase.loginName=password
jspwiki.userdatabase.password=password
jspwiki.userdatabase.wikiName=wikiname
jspwiki.userdatabase.created=created
jspwiki.userdatabase.modified=modified
jspwiki.userdatabase.roleTable=authrole
jspwiki.userdatabase.role=role

log4j.appender.FileLog = org.apache.log4j.RollingFileAppender
log4j.appender.FileLog.MaxFileSize = 10MB
log4j.appender.FileLog.MaxBackupIndex = 14
##log4j.appender.FileLog.File = /tmp/jspwiki.log
log4j.appender.FileLog.File = C:\\java\\jspwiki\\logs\\jspwiki.log
log4j.appender.FileLog.layout = org.apache.log4j.PatternLayout
log4j.appender.FileLog.layout.ConversionPattern=%d [%t] %p %c %x – %m%n
log4j.rootCategory=INFO,FileLog
log4j.logger.SecurityLog=INFO, SecurityAppender
log4j.appender.SecurityAppender = org.apache.log4j.RollingFileAppender
log4j.appender.SecurityAppender.MaxFileSize = 10MB
log4j.appender.SecurityAppender.MaxBackupIndex = 14
log4j.appender.SecurityAppender.File = @securitylog@
log4j.appender.SecurityAppender.layout = org.apache.log4j.PatternLayout
log4j.appender.SecurityAppender.layout.ConversionPattern=%d %p – %m%n

Notice that the jspwiki.userdatabase reflect the name of the JDBC DataSource we setup earlier and the jspwiki.userdatabase fields reflect the columns of our database tables.

One thought on “JSPWiki/Glassfish Install (Part 13 of 18: Configure JSPWiki)

  1. I’ve modified my web.xml from this example just a bit to handle Glassfish trying to issue an ssl certificate which had been preventing my users from editing pages when used with mod_jk[START web.xml snippet] Resource reference to JNDI factory for the JDBCUserDatabase. jdbc/WikiSource javax.sql.DataSource Container Force Login Force Login /Wiki.jsp /Edit.jsp /Comment.jsp /Login.jsp /NewGroup.jsp /Rename.jsp /Upload.jspGET PUT HEAD POST DELETE Admin Authenticated Administrative Area /Delete.jsp Admin CONFIDENTIAL Authenticated area /Edit.jsp /Comment.jsp /Login.jsp /NewGroup.jsp /Rename.jsp /Upload.jsp DELETE GET HEAD POST PUT Read-only Area /attach DELETE POST PUT Admin Authenticated CONFIDENTIAL FORM jdbc-realm /LoginForm.jsp /LoginForm.jsp This logical role includes all authenticated users Authenticated This logical role includes all administrative users Admin [END web.xml snippet]

    Like

Comments are closed.