ShortViewURLConstructor replaces the Wiki.jsp page with a servlet at the /wiki/ servlet. This allows you to have URLs of the form http://www.example.com/JSPWiki/wiki/PageName, which can be useful in many ways.

ShortViewURLConstructor will attempt to guess your wiki location from your jspwiki.baseURL -setting, but if it gets it wrong, you can use the jspwiki.shortURLConstructor.prefix -setting to point at a different location.

Troubleshooting#

If you get a 404 error when you're using this, check that your web.xml contains the following lines:

   <servlet>
       <servlet-name>WikiServlet</servlet-name>
       <servlet-class>com.ecyrd.jspwiki.WikiServlet</servlet-class>     
   </servlet>

   <servlet-mapping>
       <servlet-name>WikiServlet</servlet-name>
       <url-pattern>/wiki/*</url-pattern>
   </servlet-mapping>

Detailed Configuration Example#

By default, the wiki page URL is something like http://localhost:8080/wiki/Edit.jsp?page=About. However, this URL is not so common like ordinary web urls.

An effective way to change this is to change the URL Constructor in jspwiki.properties. See details below:

Step One: Enable Base URL#

Enable the base URL setting in the configuration file like below:

jspwiki.baseURL =http://localhost:8080/wiki/

Step Two: enable short view URL constructor#

Locate the following text in jspwiki.properties:
#jspwiki.urlConstructor = DefaultURLConstructor
#jspwiki.urlConstructor = ShortViewURLConstructor
#jspwiki.shortURLConstructor.prefix = /wiki

Uncomment the ShortViewURLConstructor line, and uncomment the URL Constructor prefix line if you want to use something other than wiki as the prefix.

#jspwiki.urlConstructor = DefaultURLConstructor
jspwiki.urlConstructor = ShortViewURLConstructor
jspwiki.shortURLConstructor.prefix = KnowlegeBase/

Step Three: update web.xml file (if necessary)#

If you use different prefix for URL constructor, you need to change something in web.xml. Locate the following in web.xml and replace wiki with your desired string.
   <servlet-mapping>
       <servlet-name>WikiServlet</servlet-name>
       <url-pattern>/KnowlegeBase/*</url-pattern>
   </servlet-mapping>

Start Tomcat when you finish the changes. The URL will become something like http://localhost:8080/wiki/Main

Back to Wiki.Admin.URL Constructors.

Add new attachment

In order to upload a new attachment to this page, please use the following box to find the file, then click on “Upload”.
« This page (revision-6) was last changed on 28-May-2009 22:56 by Stone Brooks