1 16 17 package org.apache.cocoon.transformation; 18 19 import org.apache.avalon.framework.service.ServiceException; 20 import org.apache.avalon.framework.service.ServiceManager; 21 import org.apache.cocoon.environment.ObjectModelHelper; 22 import org.apache.cocoon.environment.Request; 23 import org.apache.cocoon.components.deli.Deli; 24 25 import java.util.Map ; 26 import java.util.HashMap ; 27 28 41 public class DeliTransformer extends TraxTransformer { 42 43 44 private Deli deli; 45 46 50 public void service(ServiceManager manager) throws ServiceException { 51 super.service(manager); 52 53 this.deli = (Deli) this.manager.lookup(Deli.ROLE); 54 } 55 56 59 protected Map getLogicSheetParameters() { 60 Map map = super.getLogicSheetParameters(); 61 62 if (this.deli != null) { 63 try { 64 Request request = ObjectModelHelper.getRequest(objectModel); 65 if (map == null) { 66 map = new HashMap (); 67 } 68 69 org.w3c.dom.Document deliCapabilities = this.deli.getUACapabilities(request); 70 map.put("deli-capabilities", deliCapabilities); 71 72 String accept = request.getParameter("accept"); 73 if (accept == null) { 74 accept = request.getHeader("accept"); 75 } 76 77 map.put("accept", accept); 79 } catch (Exception e) { 80 getLogger().error("Error setting DELI info", e); 81 } 82 } 83 84 this.logicSheetParameters = map; 85 return this.logicSheetParameters; 86 } 87 88 91 public void dispose() { 92 if ( this.manager != null ) { 93 this.manager.release(this.deli); 94 this.deli = null; 95 } 96 super.dispose(); 97 } 98 } 99 | Popular Tags |