Add new attachment

Only authorized users are allowed to upload new attachments.

List of attachments

Kind Attachment Name Size Version Date Modified Author Change note
xml
build-library.xml 11.1 kB 1 20-Apr-2004 03:11 66.167.248.121
html
index.html 42.4 kB 1 14-Jun-2007 18:01 220.227.68.5

This page (revision-37) was last changed on 23-Feb-2012 21:58 by Harry Metske  

This page was created on 17-Apr-2004 19:06 by AndrewJaquith

Only authorized users are allowed to rename pages.

Only authorized users are allowed to delete pages.

Difference between version and

At line 147 changed one line
This tells Apache to pass all JSP calls through to Tomcat, as well as any requests for the web context's root (/jspwiki). Note the addition of the last directive; make sure that ''templatename'' matches the name of the template declared in your {{jspwiki.properties}} file.
This tells Apache to pass all JSP calls through to Tomcat, as well as any requests for the web context's root (/jspwiki). Note the addition of the last directive; make sure that ''templatename'' matches the name of the template declared in your {{jspwiki.properties}} file. Note: I have NOT added JKMount directives for the RPC servlets yet. If anyone has done this yet, feel free to mark this page up!
At line 149 changed one line
Note: I have NOT added JKMount directives for the RPC servlets yet. If anyone has done this yet, feel free to mark this page up!
With respect to the second task, copying static content to Apache, it is best to let Ant do it. To make life easier, I have enclosed a sample Ant task that extracts the static content to a tar file, automagically, from a given WAR file. You can use this script (build-library.xml, attached) with ''any'' WAR file, not just JSPWiki. All you need to do is use an {{antfile}} task to call an external file, for example:
{{{ <target name="tar-static" depends="war" description="Builds static content tar file for Apache/IIS.">
<property name="build" value="${basedir}/build" />
<property name="tar.static" value="${build}/${ant.project.name}-static.tar.gz"/>
<ant antfile="${ant.library}" target="static" inheritAll="false">
<property name="build" value="${build}" />
<property name="srcwar" value="${basedir}/build/${ant.project.name}.war" />
<property name="desttar" value="${tar.static}" />
<property name="static.user" value="mywiki" />
<property name="static.group" value="apache" />
<property name="static.mode" value="550" />
</ant>
</target>}}}
You will need to set the {{ant.library}} property to reflect the location of {{build-library.xml}}. Once you have the tar file generated, all you need to do is move it to your web server, and unpack the contents into the Apache webroot for your wiki. In the example above, the web root is {{/home/jspwiki/mywiki.org/html}}.
At line 164 added one line
At line 166 added one line
Another tweak that I am rather fond of involves pre-compiling JSPs so that Tomcat doesn't need to do it at runtime. In addition to instant gratification (deploy the WAR and it is ready to go; no need wait for Tomcat to re-compile), it also means that our security worries decrease a bit too. Among other things, because we no longer compile after deployment, Jasper won't leave JSPC droppings all over the server (specifically, {{$CATALINA_HOME/work}}).
At line 168 added 44 lines
Pre-compiling JSPs requires that you work a copy of JSPWiki's source tree, rather than with a binary distribution. Assuming you are comfortable working with Ant and so forth, here is what we need to do to precompile JSPWiki's JSPs:
# Download a CVS version of Tomcat, to enable client-side pre-compilation (see the note below)
# Add a placeholder to JSPWiki's out-of-the-box {{web.xml}} file
# Create a batch compilation script (see the example below)
# Change Tomcat's {{server.xml}} file to reflect the new WAR file location
# Tweak Tomcat's default servlet configuration {{$CATALINA_HOME/conf/web.xml}} to turn off performance-killing Jasper features
Note: as of this writing, Tomcat 5 (and likely Tomcat 4, too) contains a run-time bug that necessitates that JSPs be pre-compiled with the "tag-pooling" feature turned OFF. Unfortunately, the Ant {{JSPC}} task that compiles the JSPs only recently acquired the ability to turn off tag pooling. So you will need to download a CVS version of Tomcat 5 LATER than April 5, 2004. When Tomcat 5.20 becomes available, this should also work.
!Download CVS Tomcat
You should know where to get this. :). Any recent nightly build should work. Note: you do NOT need to deploy this to your server; you will only need it for compilation purposes.
!Add JSPWiki web.xml placeholder
In the JSPWiki projecct directory, open {{etc/web.xml}}. Add the following text in between the {{<servlet>}} and {{<servlet-mapping>}} elements:
{{{
<!-- PLACEHOLDER FOR PRE-COMPILED JSP SERVLETS -->
}}}
Specifically, the text needs to be in between these items:
{{{ <servlet>
<servlet-name>AttachmentServlet</servlet-name>
<servlet-class>com.ecyrd.jspwiki.attachment.AttachmentServlet</servlet-class>
</servlet>}}}
and
{{{ <!--
And finally, let us tell the servlet container which
URLs should correspond to which XML RPC servlet.
-->}}}
After the JSPC task parses the JSPs and generates Java based on their contents, our handy Ant task (see below) will inject the appropriate mappings back into {{web.xml}}.
!Create Ant batch compilation script
JSP compilation is best implemented as a series of Ant tasks. Using the JSPC task, Ant will generate Java source that implements the JSP markup as a series of servlets, then create an XML fragment containing {{<servlet-mapping>}} elements that point JSP calls to them. Afterwards, typically one would compile the servlets and bundle them into the WAR file.
To make life easier, I have enclosed a sample Ant task that does all of the above, automagically, from a given WAR file. You can use this script (build-library.xml, attached) with ''any'' WAR file, not just JSPWiki. All you need to do is use an {{antfile}} task to call an external file, for example:
{{{ <target name="war-tomcat" depends="war" description="Builds the WAR file for Tomcat (with pre-compiled JSPs).">
<property name="build" value="${basedir}/build" />
<property name="war.tomcat" value="${build}/${ant.project.name}-precompiled-jsp.war"/>
<ant antfile="${ant.library}" target="war-tomcat" inheritAll="false">
<property name="build" value="${build}" />
<property name="srcwar" value="${basedir}/build/${ant.project.name}.war" />
<property name="destwar" value="${war.tomcat}" />
</ant>
</target>}}}
You will need to set the {{ant.library}} property to reflect the location of {{build-library.xml}}. In addition, in the {{build.properties}} file that resides in the same directory as {{build-library.xml}}, you should specify the installation location of Tomcat 5 by storing its path in the property {{tomcat.home}}.
Version Date Modified Size Author Changes ... Change note
37 23-Feb-2012 21:58 1.32 kB Harry Metske to previous restored previous version
36 23-Feb-2012 12:24 1.321 kB 211.62.95.227 to previous | to last
35 16-Apr-2006 18:50 1.32 kB Janne Jalkanen to previous | to last
34 16-Apr-2006 13:06 1.279 kB Anthony Petrillo to previous | to last
33 16-Apr-2006 11:15 3.639 kB Janne Jalkanen to previous | to last
32 16-Apr-2006 04:54 3.137 kB Anthony Petrillo to previous | to last
31 16-Apr-2006 04:53 3.169 kB Anthony Petrillo to previous | to last
30 16-Apr-2006 04:49 3.065 kB Anthony Petrillo to previous | to last
29 16-Apr-2006 04:35 2.224 kB Anthony Petrillo to previous | to last
28 16-Apr-2006 02:50 2.068 kB Anthony Petrillo to previous | to last
27 11-Apr-2006 16:17 1.279 kB Anthony Petrillo to previous | to last
26 09-Apr-2006 12:33 2.745 kB Janne Jalkanen to previous | to last
25 08-Apr-2006 18:22 2.363 kB Anthony Petrillo to previous | to last
24 14-Mar-2006 16:40 1.277 kB 62.197.78.84 to previous | to last
23 14-Mar-2006 16:40 1.917 kB 62.197.78.84 to previous | to last
22 02-Feb-2006 11:00 1.987 kB 196.13.231.16 to previous | to last
21 28-Sep-2004 11:30 1.898 kB AlainRavet to previous | to last
« This page (revision-37) was last changed on 23-Feb-2012 21:58 by Harry Metske