随笔-0  评论-0  文章-9  trackbacks-0
WebAdapterServlet运行机制(3) --对request的处理

首先处理变量改变,并处罚变量改变事件,最后形成连锁反映执行各种操作
 // Change  all variables based on request parameters
                Map unhandledParameters =
                    variableMap.handleVariables(request, application);

判断request是否是一个downloadstream.
private DownloadStream handleURI(
        Application application,
        HttpServletRequest request,
        HttpServletResponse response) 
{

        String uri 
= request.getPathInfo();

        
// If no URI is available
        if (uri == null || uri.length() == 0 || uri.equals("/"))
            
return null;

        
// Remove the leading / 
        while (uri.startsWith("/"&& uri.length() > 0)
            uri 
= uri.substring(1);

        
// Handle the uri
        DownloadStream stream = null;
        
try {
            stream 
= application.handleURI(application.getURL(), uri);
        }
 catch (Throwable t) {
            application.terminalError(
new URIHandlerErrorImpl(application, t));
        }


        
return stream;
    }
如果stream 为null,则不是下载请求.

 window = getApplicationWindow(request, application);
处理参数
// Handle the unhandled parameters if the application is still running
                    if (window != null
                        
&& unhandledParameters != null
                        
&& !unhandledParameters.isEmpty()) {
                        
try {
                            window.handleParameters(unhandledParameters);
                        }
 catch (Throwable t) {
                            application.terminalError(
                                
new ParameterHandlerErrorImpl(window, t));
                        }

                    }
然后,确定一个UIDLTransformerType,
 transformer =
                        
this.transformerFactory.getTransformer(transformerType);
建立
// Create UIDL writer
                    WebPaintTarget paintTarget =
                        transformer.getPaintTarget(variableMap);
将数据更改后的window中的部件,形成xml stream
// Paint window     
                    window.paint(paintTarget);
                    paintTarget.close();
最后转换输出
transformer.transform(out);

全部结束
posted on 2005-08-05 20:14 staunch 阅读(221) 评论(0)  编辑  收藏

只有注册用户登录后才能发表评论。


网站导航: