1 15 package org.apache.tapestry.services.impl; 16 17 import java.io.IOException ; 18 19 import org.apache.tapestry.Constants; 20 import org.apache.tapestry.IEngine; 21 import org.apache.tapestry.services.EngineManager; 22 import org.apache.tapestry.services.Infrastructure; 23 import org.apache.tapestry.services.RequestGlobals; 24 import org.apache.tapestry.services.WebRequestServicer; 25 import org.apache.tapestry.web.WebRequest; 26 import org.apache.tapestry.web.WebResponse; 27 28 39 public class InvokeEngineTerminator implements WebRequestServicer 40 { 41 private EngineManager _engineManager; 42 43 private Infrastructure _infrastructure; 44 45 private RequestGlobals _requestGlobals; 46 47 public void service(WebRequest request, WebResponse response) throws IOException 48 { 49 _requestGlobals.store(request, response); 50 51 IEngine engine = _engineManager.getEngineInstance(); 52 53 56 request.setAttribute(Constants.INFRASTRUCTURE_KEY, _infrastructure); 57 58 try 59 { 60 engine.service(request, response); 61 } 62 finally 63 { 64 _engineManager.storeEngineInstance(engine); 65 } 66 67 } 68 69 public void setEngineManager(EngineManager manager) 70 { 71 _engineManager = manager; 72 } 73 74 public void setInfrastructure(Infrastructure infrastructure) 75 { 76 _infrastructure = infrastructure; 77 } 78 79 public void setRequestGlobals(RequestGlobals requestGlobals) 80 { 81 _requestGlobals = requestGlobals; 82 } 83 } | Popular Tags |