Đang chuẩn bị liên kết để tải về tài liệu:
Bắt đầu với IBM Websphere smash - p 6
Đang chuẩn bị nút TẢI XUỐNG, xin hãy chờ
Tải xuống
This page intentionally left blank Download from www.wowebook.com C H A P T E R 3 Your First Handler and Beyond Introduction In the previous chapter, you learned how to create a simple WebSphere sMash application using one of the Tools options. That application demonstrated simple file serving in a WebSphere sMash environment. To create a more complex application, we need to understand the structure of a typical WebSphere sMash application. In this chapter, we look at how to use conventions in the layout of your application to obtain default behaviors that can save you time and code. Web applications are built on request/response models, and we. | This page intentionally left blank Download from www.wowebook.com C HAPTER 3 Your First Handler and Beyond Introduction In the previous chapter you learned how to create a simple WebSphere sMash application using one of the Tools options. That application demonstrated simple file serving in a WebSphere sMash environment. To create a more complex application we need to understand the structure of a typical WebSphere sMash application. In this chapter we look at how to use conventions in the layout of your application to obtain default behaviors that can save you time and code. Web applications are built on request response models and we show you how to easily create handlers that process these requests. We create a slightly more complex application to illustrate some of these principles. In this chapter we touch on a number of topics to help you quickly create applications. We cover these topics in more detail in later chapters. Application Directory Layout One of the principles of radically simplified development environments is convention over configuration. This phrase simply means that where possible convention should be used to define application structure and behavior. Convention allows developers to take advantage of common coding patterns thus allowing them to specify only where their application differs from the norm. In most cases following the convention is sufficient where it is not configuration is required. WebSphere sMash applications are constructed using sets of conventions. We will try to call out significant conventions as we go and explain how to bypass the conventions using configuration when necessary. The first set of conventions we discuss is the directory layout of a WebSphere sMash application. When you created your first application in Chapter 2 Choose Your Development Environment you may have noticed that several directories were automatically created for you. This 33 Download from www.wowebook.com 34 Chapter 3 Your First Handler and .