test release xwiki-0.9.1252 doesn't support context path other than /xwiki

Trevor Cox xwiki at skahasoftware.com
Tue Jul 18 04:33:39 CEST 2006


It seems that xwiki-0.9.1252 can only be deployed to the context path 
"/xwiki". If deployed elsewhere, all the links will still point to 
/xwiki. In XWikiServletURLFactory::init(), a local variable 
"servletpath" is set but never really used, and this.servletPath is not 
set. Since I don't understand the related actionPath code, and 
getEngineContext()).getServletContext().getServletContextName() returns 
"" for me, I don't have a complete fix. But the following code seems to 
work for my purposes:

package com.xpn.xwiki.web;
  ...
public class XWikiServletURLFactory extends XWikiDefaultURLFactory {
  ...

 public void init(XWikiContext context) {
        URL url = context.getURL();
        String path = url.getPath();
        //String servletpath = context.getRequest().getServletPath();

        servletPath = (context.getWiki()==null) ? "" : 
context.getWiki().Param("xwiki.servletpath", "");
        if (servletPath.equals("")) {
            //try {
            //    servletPath = 
((XWikiServletContext)context.getEngineContext()).getServletContext().getServletContextName() 
+ "/";
            //} catch (Exception e) {
                servletPath = path.substring(0, path.indexOf('/', 1) + 1);
            //}
        }

        actionPath = context.getWiki().Param("xwiki.actionpath", "");
        if (actionPath.equals("")) {
            //if (servletPath.startsWith ("/bin")) {
                actionPath = "bin/";
            //}
            //else
            if (context.getRequest().getServletPath().startsWith 
("/testbin")) {
                actionPath = "testbin/";
            } //else {
            //    actionPath = 
context.getWiki().Param("xwiki.defaultactionpath", "xwiki/");;
            //}
        }

        try {
            serverURL = new URL(url, "/");
        } catch (MalformedURLException e) {
            // This can't happen
        }
    }

Ludovic Dubost wrote:

>
> Hi,
>
> There is a new test release 0.9.1252 which is a major evolution versus 
> 0.9.840 and contains mainly fixes since 0.9.1252
> Any user is welcome to test it and report any problems.
>
> Ludovic
>
>------------------------------------------------------------------------
>


-- 
Trevor Cox
skahasoftware.com
Vancouver, Canada

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.xwiki.org/pipermail/devs/attachments/20060717/079a57d7/attachment.htm 


More information about the devs mailing list