Here's a possible solution. In WikiContext there's a method named
setDefaultTemplate(HttpServletRequest) that has a FIXME note, to the
effect that we need to check for the existence of the template directory.
If we were to replace the beginning of the WikiContext.java file with:
public class WikiContext
implements Cloneable, Command
{
/**
* The name used for the default template. The value is {@value}.
*/
public static final String DEFAULT_TEMPLATE_NAME = "default";
...
private String m_template = DEFAULT_TEMPLATE_NAME;
...
and the beginning of the setDefaultTemplate() method with:
protected void setDefaultTemplate( HttpServletRequest request )
{
String defaultTemplate = m_engine.getTemplateDir();
// check to see if the template directory actually exists
if ( !templateDirectoryExists( m_engine, request ) ) {
defaultTemplate = DEFAULT_TEMPLATE_NAME;
}
...
and provide this utility method, which returns true if it finds
ViewTemplate.jsp
in the template directory specified in the property file:
/**
* A test to see if the template directory specified in the wiki's
properties actually
* exists.
* <p>
* This checks the existence of the <tt>ViewTemplate.jsp</tt> file,
which exists in every
* template.
*
* @param engine the WikiEngine
* @param request the HttpServletRequest used to obtain the real path
* @return true if the template directory exists on the server
*/
private boolean templateDirectoryExists( WikiEngine engine,
HttpServletRequest request )
{
File templatesDir = new
File(request.getServletContext().getRealPath("/"), "templates");
File templateDir = new File(templatesDir, engine.getTemplateDir());
File viewTemplateJsp = new File(templateDir, "ViewTemplate.jsp");
return viewTemplateJsp.exists();
}
Would that do?
Yes, I can either provide the changed file or a patch, but the above is
the gist of it.
I haven't quite understood the responses so far, i.e., whether or not
this is considered serious enough to warrant not going forward. As I
mentioned my downvote is open to change. The above suggestion could go
in the next version...
Cheers,
Murray
...........................................................................
Murray Altheim <murray18 at altheim dot com> = = ===
http://www.altheim.com/murray/ === ===
= = ===
In the evening
The rice leaves in the garden
Rustle in the autumn wind
That blows through my reed hut.
-- Minamoto no Tsunenobu