From: <web...@ap...> - 2003-08-15 18:53:36
|
I have a trouble with calling another servlet. The following fragment of my code from my first servlet is: myCall = self.application().callMethodOfServlet file = 'servlets/second' self.writeln(myCall(self.transaction(), file, 'myMethod')) http://localhost/WK/MyContext/first works http://localhost/WK/MyContext/servlets/second works http://localhost/WK/MyContext/first/a/b/c/d does NOT work http://localhost/WK/MyContext/servlets/second/f/h/j does NOT work I have ExtraPathInfo=1 of course. Everything works with fine without .callMethodOfServlet(). But when I use it I get an error. WebKit cannot find 'myMethod' because it cannot find my second servlet. There is something wrong with paths there. I have even tried to add absolute path to that another servlet but without result. It looks like .callMethodOfServlet does not work with ExtraPathInfo=1 at all. :( |
From: <web...@ap...> - 2003-08-15 20:38:14
|
I did some research of Application.py code and I found the solution. There is a small problem in resolveInternalRelativePath() function which works only with relative paths like 'mypath/myservlet'. It does NOT work with absolute paths: /mycontext/mypath/myservlet' nor '/mypath/myservlet' nor full URI: http://localhost/WK/mycontext/mypath/myservlet The solution is to add a small line of code. def resolveInternalRelativePath(self, trans, url, context=None): # [cut] if context is None: # delete it context = req._contextName # delete it path = '/%s%s' % (context, url) # delete it path = '%s' % (url) # ADD this line # [cut] Now, I can execute http://localhost/WK/MyContext/first/fake1/fake2. This servlet can call the another without any problem. It is done using .callMethodOfServlet with '/MyContext/servlets/second' as a path (the path should include context name). I have no acces to CVS tree. Could anyone fix it? -- JZ |