from WebKit.Page import Page class IncludeURLTest(Page): """Test includeURL redirection. This test will test out the callMethodOfServlet and includeURL redirection. The forward() method works similar to these but is not tested here. The following operations are performed: The form fields are displayed, as seen by this servlet. The request environment of this servlet is displayed. The writeStatus method on the servlet IncludeURLTest2 which is found in the Dir subdirectory under Testing is called. The title method is called on several other servlets to demonstrate calling methods on servlets in different areas relative to here. Finally, the top level page of this context is included with includeURL. A 'Test Complete' message is displayed at the very end. """ def writeBody(self): self.writeln('
') fields = self.request().fields() self.writeln('%s
' % self.__class__.__doc__.replace('\n\n', '')) self.writeln('
")
w("serverSidePath(): %s" % req.serverSidePath())
w("adapterName(): %s" % req.adapterName())
w("servletPath(): %s" % req.servletPath())
w("contextName(): %s" % req.contextName())
w("serverSideContextPath(): %s" % req.serverSideContextPath())
w("extraURLPath(): %s" % req.extraURLPath())
w("urlPath(): %s" % req.urlPath())
w("previousURLPaths(): %s" % ', '.join(req.previousURLPaths()))
w("Environment:")
w("REQUEST_URI: %s" % env.get('REQUEST_URI', ''))
w("PATH_INFO: %s" % env.get('PATH_INFO', ''))
w("SCRIPT_NAME: %s" % env.get('SCRIPT_NAME', ''))
w("SCRIPT_FILENAME: %s" % env.get('SCRIPT_FILENAME', ''))
self.writeln('')
def w(self, msg):
self.writeln(self.htmlEncode(msg))
def cmos(self, url, method, desc):
app = self.application()
trans = self.transaction()
self.writeln('Calling' ' callMethodOfServlet(t, "%s", "%s"):
' '%s
' % (url, method, desc)) self.write('callMethodOfServlet returned %s.
' % (ret is not None and '%s' % self.htmlEncode(repr(ret)) or 'nothing'))