1 15 package org.apache.tapestry.engine; 16 17 import java.io.IOException ; 18 import java.util.HashMap ; 19 import java.util.Map ; 20 21 import org.apache.tapestry.IRequestCycle; 22 import org.apache.tapestry.Tapestry; 23 import org.apache.tapestry.services.LinkFactory; 24 import org.apache.tapestry.services.ResponseRenderer; 25 import org.apache.tapestry.services.ServiceConstants; 26 27 35 36 public class HomeService implements IEngineService 37 { 38 39 private ResponseRenderer _responseRenderer; 40 41 42 43 private LinkFactory _linkFactory; 44 45 46 47 private String _pageName; 48 49 public ILink getLink(IRequestCycle cycle, Object parameter) 50 { 51 if (parameter != null) 52 throw new IllegalArgumentException (EngineMessages.serviceNoParameter(this)); 53 54 Map parameters = new HashMap (); 55 56 parameters.put(ServiceConstants.SERVICE, Tapestry.HOME_SERVICE); 57 58 return _linkFactory.constructLink(cycle, parameters, true); 59 } 60 61 public void service(IRequestCycle cycle) throws IOException 62 { 63 cycle.activate(_pageName); 64 65 _responseRenderer.renderResponse(cycle); 66 } 67 68 public String getName() 69 { 70 return Tapestry.HOME_SERVICE; 71 } 72 73 74 public void setResponseRenderer(ResponseRenderer responseRenderer) 75 { 76 _responseRenderer = responseRenderer; 77 } 78 79 80 public void setLinkFactory(LinkFactory linkFactory) 81 { 82 _linkFactory = linkFactory; 83 } 84 85 86 public void setPageName(String pageName) 87 { 88 _pageName = pageName; 89 } 90 91 92 public String getPageName() 93 { 94 return _pageName; 95 } 96 } | Popular Tags |