TAILIEUCHUNG - Professional Portal Development with Open Source Tools Java Portlet API phần 2

Cũng giống như servlet, vòng đời của portlet được quản lý bởi container, và có một phương pháp init được sử dụng để quản lý các yêu cầu khởi tạo (tạo ra nguồn lực, cấu hình, và như vậy). Portlet không đảm bảo được nạp cho đến khi cần thiết, trừ khi bạn cấu hình container để tải chúng khi khởi động. | Chapter 1 The Portlet Interface and the GenericPortlet The Portlet interface defines the behaviors that all portlets must implement. Typically you would prefer to extend the GenericPortlet class to build a portlet because it provides structures for providing all of the typical portlet implementation methods not simply the required ones. Portlet Life Cycle Much like servlets a portlet s life cycle is managed by the container and has an init method that is used to manage the initialization requirements creating resources configuring and so on . Portlets are not guaranteed to be loaded until needed unless you configure the container to load them on startup. The init method takes an object that implements the PortletConfig interface which manages initialization parameters and the portlet s ResourceBundle. This object can be used to get a reference to the object that implements the PortletContext interface. Portlet developers don t typically spend a lot of time worrying about the intricacies of portlet container initialization exceptions because generally they are thrown and the developer reacts to them debugging the circumstance that led to the exception and correcting it if appropriate . However it is worth noting that an UnavailableException is able to specify a time for which the portlet will be unavailable. This could be both useful keeping the portlet container from continuously trying to load the portlet and aggravating Why isn t the portlet container reloading my portlet to a developer. The destroy method provides the opportunity to clean up resources that were established in the init method. This is analogous to the destroy method in a servlet and is called once when the container disposes of the portlet. When an exception is thrown in the portlet init method the destroy method is guaranteed not to be called. Therefore if resources are created in the init method prior to the exception being thrown the developer cannot expect the destroy method to clean them up

TÀI LIỆU MỚI ĐĂNG
TAILIEUCHUNG - Chia sẻ tài liệu không giới hạn
Địa chỉ : 444 Hoang Hoa Tham, Hanoi, Viet Nam
Website : tailieuchung.com
Email : tailieuchung20@gmail.com
Tailieuchung.com là thư viện tài liệu trực tuyến, nơi chia sẽ trao đổi hàng triệu tài liệu như luận văn đồ án, sách, giáo trình, đề thi.
Chúng tôi không chịu trách nhiệm liên quan đến các vấn đề bản quyền nội dung tài liệu được thành viên tự nguyện đăng tải lên, nếu phát hiện thấy tài liệu xấu hoặc tài liệu có bản quyền xin hãy email cho chúng tôi.
Đã phát hiện trình chặn quảng cáo AdBlock
Trang web này phụ thuộc vào doanh thu từ số lần hiển thị quảng cáo để tồn tại. Vui lòng tắt trình chặn quảng cáo của bạn hoặc tạm dừng tính năng chặn quảng cáo cho trang web này.