thuylinh19803

New Member

Download miễn phí Ebook Tối ưu cho lập trình





Phương pháp thiết kếMVC bắt nguồn từviệc phát triển giao diện người dùng trong ngôn ngữlập
trình Smalltalk, đây là một trong những phương pháp thiết kếthành công nhất trong các phương pháp thiết kếhướng đối tượng. Hiện nay, MVC được dùng rộng rãi trong nhiều hệthống phần mềm hướng đối tượng, bất kể được viết bằng ngôn ngữhướng đối tượng nào.
Bài viết này giới thiệu tổng quan vềphương pháp thiết kếMVC, và minh họa cách sửdụng MVC trong thiết kếhướng đối tượng bằng việc xây dựng chương trình Java Web Mail. Bạn đọc phải quen thuộc với ngôn ngữlập trình Java, các khái niệm vềJSP, Servlet, Java Mail API.
Thiết kếMVC và Java
MVC là viết tắt của Model-View-Controller. Phương pháp thiết kếMVC (MVC Design Pattern)[1] là phương pháp chia nhỏmột ứng dụng nhiều lớp hay chia nhỏphần giao diện người dùng (user interface) của một ứng dụng thành ba thành phần chính là Model, View và Controller (hình 1).
- Model (tạm dịch là phần “Mô hình” [2]): Là một đối tượng hay tập hợp các đối tượng biểu diễn cho phần dữliệu của chương trình, ví dụcác dữliệu được lưu trong cơsởdữliệu (CSDL) hay từcác hệthống ứng dụng khác (nhưmail.).
- View (tạm dịch là phần “Hiển thị”): Là phần giao diện với người dùng, bao gồm việc hiện dữliệu ra màn hình, cung cấp các menu, nút bấm, hộp đối thoại, chọn lựa., đểngười dùng có thểthêm, xóa, sửa, tìm kiếm và làm các thao tác khác đối với dữliệu trong hệthống.
- Controller (tạm dịch là phần “Điều khiển”): Là phần điều khiển toàn bộlogic vềhoạt động của giao diện, tương tác với thao tác của người dùng (từchuột, bàn phím và các thiết bịngoại vi khác) và cập nhật, thao tác trên dữliệu theo đầu vào nhận được và điều khiển việc chọn phần “Hiển thị” thích hợp đểtruyền dữliệu tới người dùng.



Để tải bản Đầy Đủ của tài liệu, xin Trả lời bài viết này, Mods sẽ gửi Link download cho bạn sớm nhất qua hòm tin nhắn.
Ai cần download tài liệu gì mà không tìm thấy ở đây, thì đăng yêu cầu down tại đây nhé:
Nhận download tài liệu miễn phí

Tóm tắt nội dung tài liệu:

rong MailUserBean, vì MailUserBean đã lấy
những thông tin này khi nhận được yêu cầu log in từ MailUtilServlet. Vì thế, những loại yêu cầu này thuộc về
loại yêu cầu hiển thị, không có logic phức tạp, nên không cần gửi qua MailUtilServlet.
Tập hợp các trang JSP:
* menu.jsp dùng để hiện menu lệnh bao gồm Log in, Inbox, Compose và Exit.
* first.jsp là trang để nhập username, password, mailserver cho việc login.
* messageheaders.jsp là trang hiện danh sách mail có trong mail box để người dùng chọn xem và xóa mail.
* messagecontent.jsp là trang để hiện nội dung của mail đã chọn từ danh sách.
* compose.jsp là trang để soạn thảo mail cần gửi.
* status.jsp là trang dùng để báo về lỗi khi log in, log out không thành công, và thông báo về kết quả gửi mail
thành công hay không.
* errordetails.jsp là trang dùng để cung cấp thông tin chi tiết mỗi khi có lỗi log in, log out, gửi mail không
thành công. Thông tin trong trang này bao gồm cả Stack Trace của exception khi sinh ra lỗi, chủ yếu dành
cho lập trình viên dùng để xem chi tiết về vấn đề đã xảy ra.
* logout.jsp là trang hiện ra khi người dùng log in ra khỏi hệ thống mail.
Một vài trang JSP và text file khác dùng để trang trí.
* Một CSS (Cascade Style Sheet) tên là styleSheet.txt, dùng để định dạng về font và màu sắc cho tất cả các
file JSP.
Trong hệ thống này, không có database sever. MailUserBean lấy và cập nhật dữ liệu từ POP mail server, gửi
mail từ SMTP server, sử dụng Java Mail API.
Đây là một ứng dụng web sử dụng JSP/Servlet nên phải được cài đặt trên một web server có hỗ trợ servlet
engine (ví dụ BEA WebLogic, IBM Web Sphere, Sun One, JBoss, Tomcat, Alaire JRun...) hay một web
server kết nối với servlet engine (ví dụ như IIS + Tomcat, Apache + Tomcat, IIS + JRun, Apache + Jrun...).
Bạn đọc có thể tải về toàn bộ mã nguồn chương trình hoặc:
Châu Hồng Lĩnh
[email protected]
Theo PCWorld Việt Nam
Phân tích phát hiện tấn công
DDos và giải pháp
9/5/2005 13h:58
CERT® Advisory CA-1996-21 TCP SYN Flooding and IP Spoofing
Attacks
Original issue date: September 19, 1996
Last revised: November 29, 2000
Updated vendor information for the Linux kernel.
A complete revision history is at the end of this file. This advisory supersedes the IP spoofing portion of
CA-95.01.
Two "underground magazines" have recently published code to conduct denial-of-service attacks by creating
TCP "half-open" connections. This code is actively being used to attack sites connected to the Internet. There
is, as yet, no complete solution for this problem, but there are steps that can be taken to lessen its impact.
Although discovering the origin of the attack is difficult, it is possible to do; we have received reports of
attack origins being identified.
Any system connected to the Internet and providing TCP-based network services (such as a Web server, FTP
server, or mail server) is potentially subject to this attack. Note that in addition to attacks launched at specific
hosts, these attacks could also be launched against your routers or other network server systems if these hosts
enable (or turn on) other TCP services (e.g., echo). The consequences of the attack may vary depending on
the system; however, the attack itself is fundamental to the TCP protocol used by all systems.
If you are an Internet service provider, please pay particular attention to Section III and Appendix A, which
describes step we urge you to take to lessen the effects of these attacks. If you are the customer of an Internet
service provider, please encourage your provider to take these steps.
This advisory provides a brief outline of the problem and a partial solution. We will update this advisory as
we receive new information. If the change in information warrants, we may post an updated advisory on
comp.security.announce and redistribute an update to our cert-advisory mailing list. As always, the latest
information is available at the URLs listed at the end of this advisory.
I. I. DESCRIPTION
When a system (called the client) attempts to establish a TCP connection to a system providing a service (the
server), the client and server exchange a set sequence of messages. This connection technique applies to all
TCP connections--telnet, Web, email, etc.
The client system begins by sending a SYN message to the server. The server then acknowledges the SYN
message by sending SYN-ACK message to the client. The client then finishes establishing the connection by
responding with an ACK message. The connection between the client and the server is then open, and the
service-specific data can be exchanged between the client and the server. Here is a view of this message flow:
Client Server
------ ------
SYN-------------------->
<--------------------SYN-ACK
ACK-------------------->
Client and server can now
send service-specific data
The potential for abuse arises at the point where the server system has sent an acknowledgment (SYN-ACK)
back to client but has not yet received the ACK message. This is what we mean by half-open connection. The
server has built in its system memory a data structure describing all pending connections. This data structure
is of finite size, and it can be made to overflow by intentionally creating too many partially-open connections.
Creating half-open connections is easily accomplished with IP spoofing. The attacking system sends SYN
messages to the victim server system; these appear to be legitimate but in fact reference a client system that is
unable to respond to the SYN-ACK messages. This means that the final ACK message will never be sent to
the victim server system.
The half-open connections data structure on the victim server system will eventually fill; then the system will
be unable to accept any new incoming connections until the table is emptied out. Normally there is a timeout
associated with a pending connection, so the half-open connections will eventually expire and the victim
server system will recover. However, the attacking system can simply continue sending IP-spoofed packets
requesting new connections faster than the victim system can expire the pending connections.
In most cases, the victim of such an attack will have difficulty in accepting any new incoming network
connection. In these cases, the attack does not affect existing incoming connections nor the ability to
originate outgoing network connections.
However, in some cases, the system may exhaust memory, crash, or be rendered otherwise inoperative.
The location of the attacking system is obscured because the source addresses in the SYN packets are often
implausible. When the packet arrives at the victim server system, there is no way to determine its true source.
Since the network forwards packets based on destination address, the only way to validate the source of a
packet is to use input source filtering (see Appendix A).
II. II. IMPACT
Systems providing TCP-based services to the Internet community may be unable to provide those services
while under attack and for some time after the attack ceases. The service itself is not harmed by the attack;
usually only the ability to provide the service is impaired. In some cases, the system may exhaust memory,
crash, or be rendered otherwise inoperative.
III. III. SOLUTION
There is, as yet, no generally accepted solution to this problem with the current IP protocol technology.
However, proper router configuration can reduce the likelihood that your site will be the source of one of
these attacks.
Appendix A contains details about how to filter packets to reduce the number of IP-spoofed packets entering
and exiting your network. It also contains a list of vendors that have reported support for this type of filtering.
NOTE to Internet Service Providers:
We STRONGLY urge you to càithese filters in your routers to protect your customers against this type of
an attack. Although these filters do not directly protect your customers from attack, the filters do prevent
attacks from originating at the sites of any of your customers. We are aware of the ramifications of these
filters on some current Mobile IP schemes and are seeking a position statement from the appropriate
organizations.
NOTE to customers of Internet service providers:
We STRONGLY recommend that you contact your service provider to verify th...
 

Các chủ đề có liên quan khác

Top