Đang chuẩn bị liên kết để tải về tài liệu:
Bắt đầu với IBM Websphere smash - p 17

Không đóng trình duyệt đến khi xuất hiện nút TẢI XUỐNG

142 Chapter 6 Response Rendering Listing 6.21 XML Rendering with Groovy //-------------------------------------------------------// From: /app/resources/quiz.groovy //-------------------------------------------------------def quiz = invokeMethod('quiz.groovy', 'getQuizData', null) request.view = 'XML' request.xml.output = quiz // Always set root element name. Default is 'linkedHashMap' request.xml.rootElement = 'quiz' request.xml.idRefs = true render() Listing 6.22 XML Rendering with PHP //-------------------------------------------------------// From: /app/resources/quizXml.php //------------------------------------------------------- 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 6.21 XML Rendering with Groovy ---------------------------------------------------------- From app resources quiz.groovy ---------------------------------------------------------- def quiz invokeMethod quiz.groovy getQuizData null request.view XML request.xml.output quiz Always set root element name. Default is linkedHashMap request.xml.rootElement quiz request.xml.idRefs true render Listing 6.22 XML Rendering with PHP ---------------------------------------------------------- From app resources quizXml.php ---------------------------------------------------------- php include quiz.php 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 www.wowebook.com 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

Đã 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.