260 likes | 276 Views
WAS for z/OS V5: Web Container. After completing this unit, you should be able to: Describe the components needed to run a WebSphere V5 web application Configure the administration objects that are needed to activate web client access to a WebSphere application
E N D
After completing this unit, you should be able to: Describe the components needed to run a WebSphere V5 web application Configure the administration objects that are needed to activate web client access to a WebSphere application Describe how the request URL is processed so that the required servlet class file is loaded for a request Define the configuration elements needed to support the IBM HTTP server plug-in for WebSphere V5 Unit Objectives
Client Access to EJBs TSO or Telnet Session z/OS WebSphere EJB Environment 1 Fat Client 2 EJB Web Environment 4 1 - 3270 or Telnet 2,4,5 - RMI / IIOP 3 - HTTP 5 WebApp (Servlet) EJB 3 Browser Session • First type of client is a "fat client" running in OMVS. • Fairly easy to configure • Quick validation of EJB environment • Another type of client is a Web application ... • And a third is another EJB
What's a "Web Application"? Web Application Servlets Other Utility Classes HTML files JSPs GIF/JPG Images Enterprise JavaBeans • "Web Applications" consist of servlets AND other elements that comprise the solution. • Web Applications are not equivalent to EJBs; however, Web Applications can access EJBs and get information from them.
Basics of Accessing Web Applications http://www.host.com/PolicyIVP/PolicyServlet Servlet Engine HTTP PROTOCOL HTTP Protocol "Catcher" 2 Was40Ivp Was40Ivp 1 3 • Three key steps: • A "protocol catcher" takes HTTP protocol off network and interprets its meaning • Based on the format of the URL, the request must be directed to the correct application server to execute • The web container must identify which web application and servlet to execute and then use the servlet engine to run the servlet
J2EE application server SR CR EJB container Web container HTTP Internal Transport Browser client P xxx WebApp (Servlet) EJB 2 http: TCP/IP 1 IBM HTTP server for z/OS HTTP Server Daemon WebSphere V5 Plugin P 80 z/OS HTTP Protocol Catchers in z/OS
Overview of HTTP Internal Transport J2EE application server SR CR EJB container Web container HTTP HTTP Internal Transport client P xxxx WebApp (Servlet) EJB P yyyy HTTPS • No FRCA support but there is Edge Side Include (ESI) cache • Only protocol sender/receiver • Other functions handled in Web Container • Client authentication • Session management • Authorization to execute servlet Application Server Web Container server.xml HTTP Transports Host Port SSL w.x.y.z xxxx false w.x.y.z yyyy true
Servant Region ZOS1 EJB Container Cell D Container Services for EJBs EJB CR SR Web Container HFS Servlet optional Container Services for Servlets/JSPs Base infra- structure tcp rrs wlm JSP • A "Web Container" is a structure within the J2EE SR that provide the ability to run Servlets and JSPs. • The Web Container configuration is defined as part of the application server configuration Web Container Definition server.xml WebSphere V5 Web Containers
Configuration Options of the Web Container • General section • Default virtual host • Enable servlet caching • Thread pool • Pool minimum/maximum sizes • Thread inactivity timeout • Session management • Type of tracking - SSL ID tracking, cookies, URL rewriting • Session timeout • Security integration and session serialization • Session persistence • HTTP transports • Internal transport host name and port addresses
Virtual Hosts Application Server J2EE Application Web App Modules Server Web Application Configuration • Virtual Host • a configuration object enabling a single host machine to resemble multiple host machines • Is associated with one or more host aliases • <host_name/IP address><port number> • Application Server • Defines the web container where servlets execute • Defines HTTP "end points" (ports) for server HTTP Internal Transport • Application • Has an index of all *.war files in the application • Information for each war file, • Virtual host map • Context root • Web App Module (= a war file) • Define Servlet names • Defines Servlet mappings • Names the Servlet class file
http://fire.state.md.us/safety/seminars http://police.state.md.us/crime/ReportTheft http://taxes.state.md.us/auto/tax_filing DNS Entries GOAL TOOLS police.state.md.us 59.1.1.8 fire.state.md.us 59.1.1.8 taxes.state.md.us 59.1.1.8 "use virtual hosts and bind the applications to the virtual host" "keep applications isolated to their respective domains" WebSphere application HTTP Transport Handler WebSphere Plugin /safety/seminars /crime/ReportTheft /auto/tax_filing Execute appls for URLs from taxes.state.md.usonly Execute appls for URLs from police.state.md.usonly Execute appls for URLs from fire.state.md.usonly Hosting Multiple Domain Names
application.xml AAT <!DOCTYPE application PUBLIC "-//Sun Microsystems,.. <application id="AutoPolicy"> <display-name>AutoPolicy</display-name> <module id="AutoPolicy WebApp > <web> <web-uri>AutoTax.war</web-uri> <context-root>/auto</context-root> </web> </module> Context Root: /auto *.ear file 2 Install application in AppServer1 Server: AppServer1 Web Container Default virtual host: default_host 1 Define virtual hosts Map to virtual hosts 3 Virtual Host: fire Host Alias: fire.state.md.us:8020 Virtual Host: taxes Host Alias: taxes.state.md.us:8020 Application: AutoPolicy Web App: AutoPolicy WebApp Context Root = /auto Virtual host mapping: taxes 2 Virtual Host: police Host Alias: police.state.md.us:8020 Connecting Applications to Virtual Hosts
How the Web Container Accepts a Request http:// taxes.state.md.us:8020 /auto /tax_filing 1 2 Web Container CR HTTP Transports HTTP HTTP Internal Transport Host Port SSL * 8020 false * 8021 true app server initialization P 8020 read request P 8021 HTTPS Application: AutoPolicy Web App: AutoPolicy WebApp Context Root = /auto Virtual host mapping: taxes 1 Application present? N Fail request Y 2 Does virtual host match? N Virtual Host: taxes Host Alias: taxes.state.md.us:8020 Fail request Y Accept request
The Base Server Default Definitions These are HTTP Internal Transport ports for base application server Sample Applications • PlantsByWebSphere • Context root: /PlantsByWebSphere • SamplesGallery • Context root: /WSsamples • TechnologySamples • Context root: /TechnologySamples/xxx (where xxx identifies the sample app) • adminconsole • Context root: /admin • ivtApp • Context root: /ivt • petstore • Context root: /petstore Virtual Host: default_host Host Alias: * : 9080 Host Alias: * : 9443 Host Alias: * : 80 Host Alias <hostname>:9080 Host Alias <hostname>:9443 Example of some URLs that will work http://10.31.227.198:9080/PlantsByWebSphere http://10.31.227.198:9080/PlantsByWebSphere/servlet/ShoppingServlet http://mvsw21.ilsvpn.ibm.com:9080/PlantsByWebSphere/servlet/ShoppingServlet
Web Applications Packaged in WAR Files Web Application Server Instance Servlet.class Web Container Output.jsp war file war file Input.html Logo.jpg Container Services for Servlets/JSPs /(base or root) HTML, GIF/JPG and JSP files /META-INF MANIFEST.MF /theme Master.css /WEB-INF web.xml /classes /lib • "WAR" stands for Web ARchive • A "zip format" file, much like a JAR • Has both files and sub-directories • WAR created by tools such as WebSphere Studio • The "deployment descriptor" web.xml tells the WebSphere web container about this web application
The web.xml "Deployment Descriptor" Web Module PlantsByWebSphere.war - web.xml <?xml version="1.0" encoding="UTF-8"?> <!DOCTYPE web-app PUBLIC "-//Sun Microsystems, Inc.//DTD Web Application <web-app id="WebApp_1"> <display-name>PlantsByWebSphere Web Application</display-name> ....... <servlet id="Servlet_2"> <servlet-name>ShoppingServlet</servlet-name> <description>Shopping Servlet</description> <servlet-class>com.ibm.websphere.samples.plantsbywebspherewar. ShoppingServlet</servlet-class> </servlet> ........ <servlet-mapping id="ServletMapping_2"> <servlet-name>ShoppingServlet</servlet-name> <url-pattern>/servlet/ShoppingServlet</url-pattern> </servlet-mapping> ........ </web-app> 1 2 This file is read at server startup time when the web application is started and the war module is loaded 3 SERVLET MAPPING STRING VIRTUAL HOST MAPPING CONTEXT ROOT http:// 10.31.227.198:9080 /PlantsByWebSphere /servlet/ShoppingServlet
Putting It All Together SERVLET MAPPING STRING VIRTUAL HOST MAPPING CONTEXT ROOT http:// 10.31.227.198:9080 /PlantsByWebSphere /servlet/ShoppingServlet Server: BaseServer Transport Handler: end points = 9080, 9443 (SSL) Appl: PlantsByWebSphere Virtual Host: default_host Host Alias: * : 9080 Host Alias: * : 9443 server BaseServer 1 3 Application: PlantsByWebSphere Web App name: PlantsByWebSphere WebApp Web App module: PlantsByWebSphere.war Virtual host: default_host Context root: /PlantsByWebSphere application PlantsBy WebSphere 2 4 Web Module: PlantsByWebSphere.war Servlet Mappings: Servlet name: ShoppingServlet Url pattern: /servlet/ShoppingServlet Servlet Servlet name: ShoppingServlet Class: com.ibm.websphere.samples.Plantsbywebspherewar.ShoppingServlet 6 web module PlantsBy WebSphere.war 5
How Web Apps Are Stored in the HFS /ILS/WAS510/APPCNFG/AppServer/installedApps /Base_CB Application Name /PlantsByWebSphere.ear Cell Name /PlantsByWebSphere.war account.jsp applycss.js banner.html login.jsp ...... /Images add_to_cart.jpg button_change.gif ...... /META-INF MANIFEST.MF /WEB-INF /classes /com /... web.xml ibm-web-bnd.xmi ibm-web-ext.xmi Initial WAR file name, now used as a directory name Static Files (html, jsp, css) Static images (gif, jpg) Deep directory structure that contains the actual servlet class file. This represents a Java "package" • All files either BINARY or ASCII ... no EBCDIC! • WAR file expanded during deployment similar to structure in the original WAR file Deployment Descriptor
non-z/OS IBM HTTP Server • Lotus Domino • Apache • iPlanet • Microsoft IIS Web Server P xxx HTTP(S) WebSphere V5 distributed plug-in J2EE application server Browser client HTTP(S) SR CR HTTP(S) Internal Transport HTTP(S) P xxx WEB CONTAINER HTTP(S) Servlet WebSphere for z/OS V5 Plug-in • WebSphere V5 plug-in for z/OS HTTP server • No more SCO support or GIOP connection to web container • Functionality for z/OS plugin now equivalent to non-z/OS plugins httpd.conf P xxx z/OS HTTP server plugin-cfg.xml WebSphere V5 Plug-in for z/OS HTTP Server
Turning on the Plug-in in httpd.conf CONTEXT ROOT http:// 10.31.227.198:8068 /PlantsByWebSphere /servlet/ShoppingServlet 1 httpd.conf ServerInit /usr/lpp/zWebSphere/V5R1M0/bin/>> >>ihs390WAS50Plugin_http.so:init_exit /u/es68/web/plugin-cfg.xml Service /PlantsByWebSphere/* /usr/lpp/zWebSphere/V5R1M0/>> >>bin/ihs390WAS50Plugin_http.so:service_exit ServerTerm /usr/lpp/zWebSphere/V5R1M0/>> >>bin/ihs390WAS50Plugin_http.so:term_exit 2 z/OS HTTP server CR WebSphere V5 Plug-in HTTP Internal Transport plug-in configuration file • Should request be accepted? • Which App Server gets it? "business as usual" 4 3 P xxx
The Plug-in Configuration File VIRTUAL HOST MAPPING CONTEXT ROOT http:// 10.31.227.198:8068 /PlantsByWebSphere /servlet/ShoppingServlet /u/es68/web/plugin-cfg.xml <?xml version="1.0"?> <Config> <Log LogLevel="Error" Name="/ILS/WAS510/APPCNFG/AppServer/logs/native.log"/> <ServerCluster Name="Plant_group"> <Server Name="PlantServer"> <Transport Hostname="mvs21.ilsvpn.ibm.com" Port="9080" Protocol="http"/> <Transport Hostname="mvs21.ilsvpn.ibm.com" Port="9443" Protocol="https"/> </Server> </ServerCluster> <VirtualHostGroup Name="web_vhosts"/> <VirtualHost Name=" * : 8068 "/> </VirtualHostGroup> <UriGroup Name="plug_URIs"> <Uri Name=" /PlantsByWebSphere* "/ > </UriGroup> <Route ServerGroup="Plant_group" UriGroup="plug_URIs" VirtualHostGroup="web_vhosts"/> <\Config>
How the Plug-in Works http:// 10.31.227.198:8068/PlantsByWebSphere/servlet/ShoppingServlet Match on virtual host Plugin Logic N VirtualHostGroup name web_vhosts Y Match on URI? N UriGroup name plug_URIs Y Find Route that includes these names found? ServerGroup name N Plant_group Y Forward URL to app server Fail request
Other Comments on Using the Plug-In http:// 10.31.227.198:8068 /PlantsByWebSphere /servlet/ShoppingServlet WebSphere V5 Plug-in http:// 10.31.227.198:9080 /PlantsByWebSphere /servlet/ShoppingServlet Virtual Host: default_host Host Alias: * : 9080 Host Alias: * : 9443 Host Alias: * : 8068 Server: BaseServer Transport Handler: end points = 9080, 9443 (SSL) Appl: PlantsByWebSphere server BaseServer Application: PlantsByWebSphere Web App name: PlantsByWebSphere WebApp Web App module: PlantsByWebSphere.war Virtual host: default_host Context root: /PlantsByWebSphere application PlantsBy WebSphere • The virtual host mapped to by the application needs an alias to match original URL • The plugin can route requests to WebSphere servers running on a different host • Once the transport handler takes the request, it is handled in the same way as a request that did not go through plug-in
Creating the plugin-cfg.xml File • Use the GenPluginCfg.sh utility • Run it as a command from the OMVS shell command line • Syntax: GenPluginCfg.sh -cell.name <cell> -node.name <node> -server.name <server> -output.file.name <file_name> • Get help GenPluginCfg.sh -help • From the administration tool console • Select: Environment > Update Web Server Plugin • Written to same default location as GenPluginCfg.sh <WAS_HOME>/AppServer/config/cells/plugin-cfg.xml • Other issues • Generation ignores manual updates made in existing files • Plug-in dynamically refreshes configuration after updates • Must set attribute TrustedProxy on for application server
The Edge Side Include (ESI) Cache HTTP Server • ESI Cache will store • Static files (HTML, images, style files) • Output from JSPs and servlets • WebSphere tells ESI what to cache • Only cache JSP or servlet output if application says so • Always caches static files ESI Cache Client Application Server plug-in • Try retrieve object from cache first • Send request • Cache entry if server tells ESI to do so • Return response Webapp • Automatically switched on by default - explicitly switched on if WebSphere generates plugin-cfg.xml • Complements FRCA caching for non-WebSphere objects <Property Name="esiEnable" Value="true"/> <Property Name="esiMaxCacheSize" Value="1024"/> <Property Name="esiInvalidationMonitor" Value="false"/>
Having completed this unit, you should be able to: Describe the components needed to run a WebSphere V5 web application Configure the administration objects that are needed to activate web client access to a WebSphere application Describe how the request URL is processed so that the required servlet class file is loaded for a request Define the configuration elements needed to support the IBM HTTP server plug-in for WebSphere V5 Unit Summary