Bắt đầu với IBM Websphere smash - p 17

142 Chapter 6 Response Rendering Listing XML Rendering with Groovy //-------------------------------------------------------// From: /app/resources/ //-------------------------------------------------------def quiz = invokeMethod('', 'getQuizData', null) = 'XML' = quiz // Always set root element name. Default is 'linkedHashMap' = 'quiz' = true render() Listing XML Rendering with PHP //-------------------------------------------------------// From: /app/resources/ //------------------------------------------------------- Conclusion This chapter has provided a variety of different ways to respond to incoming requests. The type of response is always dependent. | 142 Chapter 6 Response Rendering Listing XML Rendering with Groovy ---------------------------------------------------------- From app resources ---------------------------------------------------------- def quiz invokeMethod getQuizData null XML quiz Always set root element name. Default is linkedHashMap quiz true render Listing XML Rendering with PHP ---------------------------------------------------------- From app resources ---------------------------------------------------------- php include quiz getQuizData zput request view XML zput request xml output quiz zput request xml rootElement quiz zput request xml idRefs true render_view Conclusion This chapter has provided a variety of different ways to respond to incoming requests. The type of response is always dependent on the type of request and how you should render your output. Humans making a direct browser request will typically want an HTML page in response whereas a remote computer or AJAX response will generally want a native data format such as JSON or XML in response. WebSphere sMash provides the tools to enable you to properly respond to any of these requests. The next chapter delves deeper into dealing with REST-based requests and helps you dynamically respond to these requests based on content negotiations. Download from C HAPTER 7 REST Programming REST as a technology certainly has caused a stir in the web development space. There is a lot of detractors that dismiss REST for not being as robust as a classic SOAP-based SOA solution. And basically they are right but that s the point. REST is based on the HTTP protocol which is well understood and easy to adopt without changing your existing web infrastructure. This simplicity allows for an easy-to-implement solution while allowing for the existing web standards for authentication and security to maintain

Không thể tạo bản xem trước, hãy bấm tải xuống
TỪ KHÓA LIÊN QUAN
TÀI LIỆU MỚI ĐĂNG
Đã 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.