butlermh    02/02/22 03:30:02

  Modified:    src/java/org/apache/cocoon/transformation
                        TraxTransformer.java
  Log:
  Resolved problem detecting DELI component / removed unnecessary configuration option.
  
  Revision  Changes    Path
  1.16      +13 -30    
xml-cocoon2/src/java/org/apache/cocoon/transformation/TraxTransformer.java
  
  Index: TraxTransformer.java
  ===================================================================
  RCS file: 
/home/cvs/xml-cocoon2/src/java/org/apache/cocoon/transformation/TraxTransformer.java,v
  retrieving revision 1.15
  retrieving revision 1.16
  diff -u -r1.15 -r1.16
  --- TraxTransformer.java      22 Feb 2002 07:03:56 -0000      1.15
  +++ TraxTransformer.java      22 Feb 2002 11:30:02 -0000      1.16
  @@ -157,7 +157,7 @@
    * @author <a href="mailto:[EMAIL PROTECTED]";>Giacomo Pati</a>
    * @author <a href="mailto:[EMAIL PROTECTED]";>Ovidiu Predescu</a>
    * @author <a href="mailto:[EMAIL PROTECTED]";>Mark H. Butler</a>
  - * @version CVS $Id: TraxTransformer.java,v 1.15 2002/02/22 07:03:56 cziegeler Exp $
  + * @version CVS $Id: TraxTransformer.java,v 1.16 2002/02/22 11:30:02 butlermh Exp $
    */
   public class TraxTransformer extends AbstractTransformer
   implements Transformer, Composable, Configurable, Cacheable, Disposable {
  @@ -178,10 +178,6 @@
       private boolean useBrowserCap = false;
       private boolean _useBrowserCap = false;
   
  -    /* Should we make the DELI CC/PP profile available to the stylesheet (default 
is off) */
  -    private boolean useDeli = false;
  -    private boolean _useDeli = false;
  -
       /** Should we make the cookies availalbe in the stylesheet? (default is off) */
       private boolean useCookies = false;
       private boolean _useCookies = false;
  @@ -231,16 +227,11 @@
             child = conf.getChild("xslt-processor-role");
             String xsltRole = child.getValue(XSLTProcessor.ROLE);
   
  -          child = conf.getChild("use-deli");
  -          this.useDeli = child.getValueAsBoolean(false);
  -          this._useDeli = this.useDeli;
  -
             if (this.getLogger().isDebugEnabled()) {
                   this.getLogger().debug("Use parameters is " + this.useParameters + 
" for " + this);
                   this.getLogger().debug("Use cookies is " + this.useCookies + " for 
" + this);
                   this.getLogger().debug("Use browser capabilities is " + 
this.useBrowserCap + " for " + this);
                   this.getLogger().debug("Use session info is " + this.useSessionInfo 
+ " for " + this);
  -                this.getLogger().debug("Use DELI is " + this.useDeli + " for " + 
this);
                   this.getLogger().debug("Use XSLTProcessor of role " + xsltRole);
               }
   
  @@ -264,20 +255,19 @@
           }
           this.browser = (Browser) manager.lookup(Browser.ROLE);
   
  -        // FIXME (VG): Replace try with hasComponent() check when it works as 
expected
  -        // System.out.println(Deli.ROLE + ": " + 
this.manager.hasComponent(Deli.ROLE));
  -        // if (this.manager.hasComponent(Deli.ROLE)) {
  +
  +        if (this.manager.hasComponent(Deli.ROLE)) {
           try {
               if (this.getLogger().isDebugEnabled()) {
                   getLogger().debug("Looking up " + Deli.ROLE);
               }
               this.deli = (Deli) this.manager.lookup(Deli.ROLE);
  -        // } else {
           } catch (ComponentException e) {
               getLogger().debug("Deli is not available");
           } catch (NoClassDefFoundError e) {
               getLogger().debug("Deli is not available");
           }
  +        }
       }
   
       /**
  @@ -298,7 +288,6 @@
           this.xsltProcessor.setSourceResolver(resolver);
           _useParameters = par.getParameterAsBoolean("use-request-parameters", 
this.useParameters);
           _useBrowserCap = par.getParameterAsBoolean("use-browser-capabilities-db", 
this.useBrowserCap);
  -        _useDeli = par.getParameterAsBoolean("use-deli", this.useDeli);
           _useCookies = par.getParameterAsBoolean("use-cookies", this.useCookies);
           _useSessionInfo = par.getParameterAsBoolean("use-session-info", 
this.useSessionInfo);
           if (this.getLogger().isDebugEnabled()) {
  @@ -493,27 +482,22 @@
               getLogger().error("Error setting Browser info", e);
           }
   
  -        if (this._useDeli) {
  +        if (this.deli != null) {
               try {
                   Request request = ObjectModelHelper.getRequest(objectModel);
                   if (map == null) {
                       map = new HashMap();
                   }
   
  -                if (this.deli != null) {
  -                    org.w3c.dom.Document deliCapabilities = 
this.deli.getUACapabilities(request);
  -                    map.put("deli-capabilities", deliCapabilities);
  -
  -                    String accept = request.getParameter("accept");
  -                    if (accept == null)
  -                        accept = request.getHeader("accept");
  -
  -                    /* add the accept param */
  -                    map.put("accept", accept);
  -                } else {
  -                    getLogger().warn("TraxTransformer configured to use DELI in 
sitemap.xmap but DELI not enabled in cocoon.xconf.");
  -                }
  +                org.w3c.dom.Document deliCapabilities = 
this.deli.getUACapabilities(request);
  +                map.put("deli-capabilities", deliCapabilities);
  +
  +                String accept = request.getParameter("accept");
  +                if (accept == null)
  +                   accept = request.getHeader("accept");
   
  +                /* add the accept param */
  +                map.put("accept", accept);
               } catch (Exception e) {
                   getLogger().error("Error setting DELI info", e);
               }
  @@ -568,7 +552,6 @@
           this._useParameters = this.useParameters;
           this._useCookies = this.useCookies;
           this._useBrowserCap = this.useBrowserCap;
  -        this._useDeli = this.useDeli;
           this._useSessionInfo = this.useSessionInfo;
           super.recycle();
       }
  
  
  

----------------------------------------------------------------------
In case of troubles, e-mail:     [EMAIL PROTECTED]
To unsubscribe, e-mail:          [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to