DWR's analysis DWRServlet category

org.directwebremoting.servlet.DwrServlet be divided into three parts, that is, the three main methods: init; doGet; doPost

1, init, initialize.
DWR containers for internal Servelet a configuration container, the container load dwr mapping information.

public void init (ServletConfig servletConfig) throws ServletException
(
super.init (servletConfig);
ServletContext servletContext = servletConfig.getServletContext ();

try
(
/ / SetupLogging () only needed for servlet logging if commons-logging is unavailable
/ / LogStartup () just outputs some version numbers
Log initialization begin
StartupUtil.logStartup (servletConfig);

/ / Create and setup a DefaultContainer
DWR for a Servelet internal configuration container vessel, the vessel loaded with relevant information indicate dwr.
container = ContainerUtil.createAndSetupDefaultContainer (servletConfig);

StartupUtil.initContainerBeans (servletConfig, servletContext, container);
webContextBuilder = container.getBean (WebContextBuilder.class);

ContainerUtil.prepareForWebContextFilter (servletContext, servletConfig, container, webContextBuilder, this);
ContainerUtil.publishContainer (container, servletConfig);
ContainerUtil.configureContainerFully (container, servletConfig);
)
catch (ExceptionInInitializerError ex)
(
log.fatal ( "ExceptionInInitializerError. Nested exception:", ex.getException ());
throw new ServletException (ex);
)
catch (Exception ex)
(
log.fatal ( "DwrServlet.init () failed", ex);
throw new ServletException (ex);
)
finally
(
if (webContextBuilder! = null)
(
webContextBuilder.unset ();
)
)
)

The aspect in detail:
init () call
createAndSetupDefaultContainer () call
setupDefaultContainer (defaultContainer, servletConfig)
Call the following steps
1) setupDefaults (container);
Include: containers related to configuration management tool set, that is, to achieve a number of interfaces. Fine this way, when the containers have required a lot of interface functions, to make all of these interfaces hint, and set of implementation can be configured
container.addImplementation (AccessControl.class, DefaultAccessControl.class);
/ / Mapping handlers to URLs, the path configuration
createUrlMapping (container, "/ index.html", IndexHandler.class, "indexHandlerUrl");
/ / Read configuration servlet property
2) setupFromServletConfig (container, servletConfig);

Additional treatment 1) in many types of election
3) resolveMultipleImplementations (container, servletConfig);

Which the use of a common type compressor yui
【YUI Compressor using Javascript and CSS compression
YUI Compressor is a tool for the preparation of the use of Java, Java version required greater than or equal to 1.4.
Introduction of job:
Mainly to remove redundant blank, including spaces, line breaks, tabs.
For Javascript, also uses a variable name of the method to shorten the compressed file, that is, to ensure code correctness in the case of only the variable name in a string of characters to replace, or two, three characters, try a short short.
For CSS, also used to optimize the value of 0 the value of the property that the color values Optimize files.
CSS Optimization CSSTidy function than the weak. CSSTidy also supports the merger of some of the relevant property. 】
/ / Instrument configuration set load, appear, check
4) container.setupFinished ();
Initialize bean container contents, including the system default? ? ?
initContainerBeans

2, doGet
The actual call doPost, seen here under the best study of the servlet's doGet method and the difference between doPost
protected void doGet (HttpServletRequest req, HttpServletResponse resp) throws IOException, ServletException
(
doPost (req, resp);
)

3, doPost
In the project, there is a sample Dynamically Text, address http://localhost:5050/dwr/simpletext/index.html, when click button, is in fact triggered the following methods org.directwebremoting.servlet.DwrServlet .
protected void doPost (HttpServletRequest request, HttpServletResponse response) throws IOException, ServletException
(
try
(
webContextBuilder.set (request, response, getServletConfig (), getServletContext (), container);

UrlProcessor processor = container.getBean (UrlProcessor.class);
processor.handle (request, response);
)
finally
(
webContextBuilder.unset ();
)
)

分类:AJAX 时间:2009-05-18 人气:514
分享到:
blog comments powered by Disqus

相关文章

  • 从"void*"到指向非"void"的指针的转换要求显式类型转换错误 2014-12-01

    错误代码:struct People * p = malloc(sizeof(struct People)); 正确代码:struct People * p = ( People *)malloc(sizeof(struct People));

  • hibernate in the interceptor EmptyInterceptor interface functions 2010-05-26

    Interceptor interface from the session (session) callback (callback) applications (application) of the mechanism, this callback mechanism to allow the application to be saved in the persistent object, update, delete, or load, check and ( or) to modif

  • Spring + JPA integration 2010-03-30

    Reference: Spring Recipes 1. Concerning the contents: * Configure JPA EntityManagerFactory in the Spring * Note declarative transaction configuration * Use JPA persistent objects into the context of 2. To achieve these steps: 0). Depends Package: hib

  • what is CMMI 2009-07-16

    CMMI called: Capability Maturity Model Integration, or Capability Maturity Model Integration. CMMI is the latest version of CMM model. Early the CMMI (CMMI-SE/SW/IPPD) 1.02 version was used in the software industry in project management, SEI in some

  • SCM 2009-09-15

    Single-chip microprocessor (SCM) SCM has the same meaning MCU, micro-control unit, also known as single-chip micro-computer, popular name for the single-chip [Edit this paragraph] SCM video format SCM is a format to support DRM (Digital Rights Manage

  • Taobao java engineer recruitment 2009-10-27

    If you want to find a place where old-age do not come on, Directed at the money you want to met on the other. Education is not a problem, Did not graduate from primary school on the No talk (except self-taught), A waste of their clinics to save time.

  • Software Configuration Management 2010-06-23

    Software Configuration Management (Software Configuration Management , SCM ) is an identity, organization and control of the technology changes. Software configuration management applied to the entire software engineering process. We know when the ch

  • ClearCase Introduction 2010-07-07

    First, the need for software configuration management No development of the industry as the computer industry so quickly. Especially in today's software industry, ever-changing technology and product updates to ensure that all technical staff and man

  • CMMI standard terminology database 2010-09-12

    1 AT Assessment Team assessment panel 2 ATM Assessment Team Member panel members 3 BA Baseline Assessment Baseline Review 4 CAR Causal Analysis and Resolution Analysis and Decision Making 5 CBA CMM-Based Appraisal CMM-based assessment of 6 CBA-IPI CM

iOS 开发

Android 开发

Python 开发

JAVA 开发

开发语言

PHP 开发

Ruby 开发

搜索

前端开发

数据库

开发工具

开放平台

Javascript 开发

.NET 开发

云计算

服务器

Copyright (C) codeweblog.com, All Rights Reserved.

CodeWeblog.com 版权所有 黔ICP备15002463号-1

processed in 0.436 (s). 10 q(s)