Return-Path: Delivered-To: apmail-cocoon-cvs-archive@www.apache.org Received: (qmail 71119 invoked from network); 26 Apr 2005 16:07:26 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (209.237.227.199) by minotaur.apache.org with SMTP; 26 Apr 2005 16:07:26 -0000 Received: (qmail 74157 invoked by uid 500); 26 Apr 2005 16:08:04 -0000 Delivered-To: apmail-cocoon-cvs-archive@cocoon.apache.org Received: (qmail 73846 invoked by uid 500); 26 Apr 2005 16:08:02 -0000 Mailing-List: contact cvs-help@cocoon.apache.org; run by ezmlm Precedence: bulk Reply-To: dev@cocoon.apache.org list-help: list-unsubscribe: List-Post: Delivered-To: mailing list cvs@cocoon.apache.org Received: (qmail 73685 invoked by uid 99); 26 Apr 2005 16:08:00 -0000 X-ASF-Spam-Status: No, hits=0.2 required=10.0 tests=NO_REAL_NAME X-Spam-Check-By: apache.org Received: from minotaur.apache.org (HELO minotaur.apache.org) (209.237.227.194) by apache.org (qpsmtpd/0.28) with SMTP; Tue, 26 Apr 2005 09:07:56 -0700 Received: (qmail 70779 invoked by uid 65534); 26 Apr 2005 16:07:12 -0000 Message-ID: <20050426160712.70778.qmail@minotaur.apache.org> Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Subject: svn commit: r164808 [1/3] - in /cocoon/branches/BRANCH_2_1_X/src: blocks/authentication-fw/java/org/apache/cocoon/webapps/authentication/context/ blocks/authentication-fw/java/org/apache/cocoon/webapps/authentication/generation/ blocks/chaperon/java/org/apache/cocoon/transformation/ blocks/forms/java/org/apache/cocoon/forms/datatype/ blocks/mail/java/org/apache/cocoon/generation/ blocks/mail/java/org/apache/cocoon/mail/ blocks/ojb/java/org/apache/cocoon/ojb/components/ blocks/portal-fw/java/org/apache/cocoon/webapps/portal/components/ blocks/portal/java/org/apache/cocoon/portal/tools/generation/ blocks/profiler/java/org/apache/cocoon/generation/ blocks/proxy/java/org/apache/cocoon/generation/ blocks/qdox/java/org/apache/cocoon/components/source/impl/ blocks/repository/java/org/apache/cocoon/components/source/helpers/ blocks/repository/java/org/apache/cocoon/generation/ blocks/slop/java/org/apache/cocoon/slop/parsing/ blocks/web3/java/org/apache/cocoon/components/web3/impl/ blocks/webdav/java/org/apache/cocoon/components/source/impl/ blocks/webdav/java/org/apache/cocoon/transformation/ blocks/woody/java/org/apache/cocoon/woody/ blocks/xsp/java/org/apache/cocoon/components/language/markup/ blocks/xsp/java/org/apache/cocoon/components/language/markup/xsp/ deprecated/java/org/apache/cocoon/transformation/ java/org/apache/cocoon/components/notification/ java/org/apache/cocoon/generation/ java/org/apache/cocoon/serialization/ java/org/apache/cocoon/sitemap/ java/org/apache/cocoon/transformation/ java/org/apache/cocoon/xml/dom/ samples/org/apache/cocoon/samples/errorhandling/ samples/org/apache/cocoon/samples/parentcm/ Date: Tue, 26 Apr 2005 16:07:05 -0000 To: cvs@cocoon.apache.org From: vgritsenko@apache.org X-Mailer: svnmailer-1.0.0-dev X-Virus-Checked: Checked X-Spam-Rating: minotaur.apache.org 1.6.2 0/1000/N Author: vgritsenko Date: Tue Apr 26 09:07:03 2005 New Revision: 164808 URL: http://svn.apache.org/viewcvs?rev=3D164808&view=3Drev Log: Use EMPTY_PROPERTIES Modified: cocoon/branches/BRANCH_2_1_X/src/blocks/authentication-fw/java/org/apac= he/cocoon/webapps/authentication/context/AuthenticationContext.java cocoon/branches/BRANCH_2_1_X/src/blocks/authentication-fw/java/org/apac= he/cocoon/webapps/authentication/generation/ConfigurationGenerator.java cocoon/branches/BRANCH_2_1_X/src/blocks/chaperon/java/org/apache/cocoon= /transformation/PatternTransformer.java cocoon/branches/BRANCH_2_1_X/src/blocks/forms/java/org/apache/cocoon/fo= rms/datatype/DynamicSelectionList.java cocoon/branches/BRANCH_2_1_X/src/blocks/mail/java/org/apache/cocoon/gen= eration/IMAPGenerator.java cocoon/branches/BRANCH_2_1_X/src/blocks/mail/java/org/apache/cocoon/mai= l/MailContentHandlerDelegate.java cocoon/branches/BRANCH_2_1_X/src/blocks/ojb/java/org/apache/cocoon/ojb/= components/LoggerImpl.java cocoon/branches/BRANCH_2_1_X/src/blocks/portal-fw/java/org/apache/cocoo= n/webapps/portal/components/PortalManagerImpl.java cocoon/branches/BRANCH_2_1_X/src/blocks/portal/java/org/apache/cocoon/p= ortal/tools/generation/I18nCatalogueGenerator.java cocoon/branches/BRANCH_2_1_X/src/blocks/profiler/java/org/apache/cocoon= /generation/ProfilerGenerator.java cocoon/branches/BRANCH_2_1_X/src/blocks/proxy/java/org/apache/cocoon/ge= neration/GenericProxyGenerator.java cocoon/branches/BRANCH_2_1_X/src/blocks/proxy/java/org/apache/cocoon/ge= neration/HttpProxyGenerator.java cocoon/branches/BRANCH_2_1_X/src/blocks/qdox/java/org/apache/cocoon/com= ponents/source/impl/QDoxSource.java cocoon/branches/BRANCH_2_1_X/src/blocks/repository/java/org/apache/coco= on/components/source/helpers/SourceProperty.java cocoon/branches/BRANCH_2_1_X/src/blocks/repository/java/org/apache/coco= on/generation/TraversableSourceDescriptionGenerator.java cocoon/branches/BRANCH_2_1_X/src/blocks/slop/java/org/apache/cocoon/slo= p/parsing/SimpleSlopParser.java cocoon/branches/BRANCH_2_1_X/src/blocks/web3/java/org/apache/cocoon/com= ponents/web3/impl/DefaultWeb3StreamerImpl.java cocoon/branches/BRANCH_2_1_X/src/blocks/webdav/java/org/apache/cocoon/c= omponents/source/impl/WebDAVSource.java cocoon/branches/BRANCH_2_1_X/src/blocks/webdav/java/org/apache/cocoon/t= ransformation/DASLTransformer.java cocoon/branches/BRANCH_2_1_X/src/blocks/woody/java/org/apache/cocoon/wo= ody/Constants.java cocoon/branches/BRANCH_2_1_X/src/blocks/xsp/java/org/apache/cocoon/comp= onents/language/markup/CocoonMarkupLanguage.java cocoon/branches/BRANCH_2_1_X/src/blocks/xsp/java/org/apache/cocoon/comp= onents/language/markup/xsp/XSPMarkupLanguage.java cocoon/branches/BRANCH_2_1_X/src/blocks/xsp/java/org/apache/cocoon/comp= onents/language/markup/xsp/XSPObjectHelper.java cocoon/branches/BRANCH_2_1_X/src/deprecated/java/org/apache/cocoon/tran= sformation/CachingCIncludeTransformer.java cocoon/branches/BRANCH_2_1_X/src/java/org/apache/cocoon/components/noti= fication/Notifier.java cocoon/branches/BRANCH_2_1_X/src/java/org/apache/cocoon/generation/Link= StatusGenerator.java cocoon/branches/BRANCH_2_1_X/src/java/org/apache/cocoon/generation/Sess= ionAttributeGenerator.java cocoon/branches/BRANCH_2_1_X/src/java/org/apache/cocoon/generation/Stat= usGenerator.java cocoon/branches/BRANCH_2_1_X/src/java/org/apache/cocoon/serialization/A= bstractTextSerializer.java cocoon/branches/BRANCH_2_1_X/src/java/org/apache/cocoon/serialization/T= extSerializer.java cocoon/branches/BRANCH_2_1_X/src/java/org/apache/cocoon/sitemap/Content= Aggregator.java cocoon/branches/BRANCH_2_1_X/src/java/org/apache/cocoon/transformation/= AbstractSAXTransformer.java cocoon/branches/BRANCH_2_1_X/src/java/org/apache/cocoon/transformation/= CIncludeTransformer.java cocoon/branches/BRANCH_2_1_X/src/java/org/apache/cocoon/xml/dom/DOMUtil= .java cocoon/branches/BRANCH_2_1_X/src/samples/org/apache/cocoon/samples/erro= rhandling/ExceptionGenerator.java cocoon/branches/BRANCH_2_1_X/src/samples/org/apache/cocoon/samples/pare= ntcm/Generator.java Modified: cocoon/branches/BRANCH_2_1_X/src/blocks/authentication-fw/java/or= g/apache/cocoon/webapps/authentication/context/AuthenticationContext.java URL: http://svn.apache.org/viewcvs/cocoon/branches/BRANCH_2_1_X/src/blocks/= authentication-fw/java/org/apache/cocoon/webapps/authentication/context/Aut= henticationContext.java?rev=3D164808&r1=3D164807&r2=3D164808&view=3Ddiff =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D --- cocoon/branches/BRANCH_2_1_X/src/blocks/authentication-fw/java/org/apac= he/cocoon/webapps/authentication/context/AuthenticationContext.java (origin= al) +++ cocoon/branches/BRANCH_2_1_X/src/blocks/authentication-fw/java/org/apac= he/cocoon/webapps/authentication/context/AuthenticationContext.java Tue Apr= 26 09:07:03 2005 @@ -1,12 +1,12 @@ /* - * Copyright 1999-2004 The Apache Software Foundation. - *=20 + * Copyright 1999-2005 The Apache Software Foundation. + * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at - *=20 + * * http://www.apache.org/licenses/LICENSE-2.0 - *=20 + * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. @@ -15,16 +15,10 @@ */ package org.apache.cocoon.webapps.authentication.context; =20 -import java.io.IOException; -import java.util.ArrayList; -import java.util.HashMap; -import java.util.List; -import java.util.Map; -import java.util.StringTokenizer; - import org.apache.avalon.framework.CascadingRuntimeException; import org.apache.avalon.framework.context.Context; import org.apache.avalon.framework.parameters.Parameters; + import org.apache.cocoon.ProcessingException; import org.apache.cocoon.components.ContextHelper; import org.apache.cocoon.components.source.SourceUtil; @@ -36,7 +30,9 @@ import org.apache.cocoon.webapps.authentication.user.UserHandler; import org.apache.cocoon.webapps.session.context.SessionContext; import org.apache.cocoon.webapps.session.context.SimpleSessionContext; +import org.apache.cocoon.xml.XMLUtils; import org.apache.cocoon.xml.dom.DOMUtil; + import org.apache.excalibur.source.SourceParameters; import org.apache.excalibur.source.SourceResolver; import org.apache.excalibur.xml.xpath.XPathProcessor; @@ -47,16 +43,21 @@ import org.xml.sax.ContentHandler; import org.xml.sax.SAXException; import org.xml.sax.ext.LexicalHandler; -import org.xml.sax.helpers.AttributesImpl; + +import java.io.IOException; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.StringTokenizer; =20 /** * This is the implementation for the authentication context - *=20 + * * @author Carsten Ziegeler - * @version CVS $Id$ + * @version $Id$ */ -public class AuthenticationContext -implements SessionContext { +public class AuthenticationContext implements SessionContext { =20 protected String name; protected UserHandler handler; @@ -68,14 +69,14 @@ protected SourceResolver resolver; /** A list of roles the user is in */ protected List roles; - =20 + /** Constructor */ public AuthenticationContext(Context context, XPathProcessor processor= , SourceResolver resolver) { this.context =3D context; this.xpathProcessor =3D processor; this.resolver =3D resolver; } - =20 + /** * Initialize the context. This method has to be called right after * the constructor. @@ -91,25 +92,25 @@ throw new CascadingRuntimeException("Unable to create simple c= ontext.", pe); } } - =20 + /** * Return the current authentication state */ protected RequestState getState() { return DefaultAuthenticationManager.getRequestState( this.context = ); } - =20 + /** * Initialize this context */ - public void init(Document doc)=20 + public void init(Document doc) throws ProcessingException { if ( initialized ) { throw new ProcessingException("The context can only be initial= ized once."); } this.authContext.setNode("/", doc.getFirstChild()); } - =20 + /* (non-Javadoc) * @see org.apache.cocoon.webapps.session.context.SessionContext#setup= (java.lang.String, java.lang.String, java.lang.String) */ @@ -135,7 +136,7 @@ if (!path.startsWith("/")) path =3D '/' + path; =20 final String applicationName =3D this.getState().getApplicationNam= e(); - =20 + DocumentFragment frag =3D null; =20 if ( path.equals("/") ) { @@ -222,7 +223,7 @@ this.cleanParametersCache(); this.authContext.setXML(path, fragment); =20 - } else if (path.equals("/application")=20 + } else if (path.equals("/application") || path.startsWith("/application/") ) { =20 if (applicationName =3D=3D null) { @@ -302,7 +303,7 @@ this.cleanParametersCache(); this.authContext.removeXML(path); =20 - } else if (path.equals("/application")=20 + } else if (path.equals("/application") || path.startsWith("/application/") ) { if (applicationName =3D=3D null) { throw new ProcessingException("removeXML: Application is r= equired for path " + path); @@ -398,12 +399,12 @@ =20 if (path.equals("/") ) { // get all: first authentication then application - contentHandler.startElement("", "authentication", "authenticat= ion", new AttributesImpl()); + contentHandler.startElement("", "authentication", "authenticat= ion", XMLUtils.EMPTY_ATTRIBUTES); this.authContext.streamXML("/authentication", contentHandler, = lexicalHandler); contentHandler.endElement("", "authentication", "authenticatio= n"); =20 if (applicationName !=3D null) { - contentHandler.startElement("", "application", "applicatio= n", new AttributesImpl()); + contentHandler.startElement("", "application", "applicatio= n", XMLUtils.EMPTY_ATTRIBUTES); this.authContext.streamXML("/applications/" + applicationN= ame, contentHandler, lexicalHandler); contentHandler.endElement("", "application", "application"= ); } @@ -561,7 +562,7 @@ throws ProcessingException { String authLoadResource =3D this.handler.getHandlerConfiguration()= .getLoadResource(); SourceParameters authLoadResourceParameters =3D this.handler.getHa= ndlerConfiguration().getLoadResourceParameters(); - =20 + if (authLoadResource =3D=3D null) { throw new ProcessingException("The context " + this.name + " d= oes not support loading."); } @@ -576,14 +577,14 @@ } parameters =3D this.createParameters(parameters, path, - false);=20 + false); DocumentFragment frag; - =20 - frag =3D SourceUtil.readDOM(authLoadResource,=20 - null,=20 - parameters,=20 + + frag =3D SourceUtil.readDOM(authLoadResource, + null, + parameters, resolver); - =20 + this.setXML(path, frag); =20 } // end synchronized @@ -617,9 +618,9 @@ path, true); DocumentFragment fragment; - fragment =3D SourceUtil.readDOM(loadResource,=20 - null,=20 - parameters,=20 + fragment =3D SourceUtil.readDOM(loadResource, + null, + parameters, resolver); this.authContext.setXML("/applications/" + applicationName + '= /', fragment); =20 @@ -745,7 +746,7 @@ } } =20 - public Map getContextInfo()=20 + public Map getContextInfo() throws ProcessingException { Map map =3D (Map)this.authContext.getAttribute( "cachedmap" ); if (map =3D=3D null) { @@ -765,8 +766,8 @@ } return map; } - =20 - public SourceParameters getContextInfoAsParameters()=20 + + public SourceParameters getContextInfoAsParameters() throws ProcessingException { SourceParameters pars =3D (SourceParameters)this.authContext.getAt= tribute( "cachedpar" ); if (pars =3D=3D null) { @@ -779,14 +780,14 @@ /** * Load XML of an application */ - public void loadApplicationXML(ApplicationConfiguration appConf,=20 + public void loadApplicationXML(ApplicationConfiguration appConf, SourceResolver resolver) throws ProcessingException { String loadResource =3D appConf.getLoadResource(); SourceParameters loadResourceParameters =3D appConf.getLoadResourc= eParameters(); if ( !this.handler.isApplicationLoaded(appConf) && loadResource != =3D null ) { synchronized (this.authContext) { - =20 + SourceParameters parameters; if (loadResourceParameters !=3D null) { parameters =3D (SourceParameters)loadResourceParameter= s=2Eclone(); @@ -797,12 +798,12 @@ null, true); DocumentFragment fragment; - fragment =3D SourceUtil.readDOM(loadResource,=20 - null,=20 - parameters,=20 + fragment =3D SourceUtil.readDOM(loadResource, + null, + parameters, resolver); this.authContext.setXML("/applications/" + appConf.getName= () + '/', fragment); - =20 + } // end synchronized } this.handler.setApplicationIsLoaded(appConf); Modified: cocoon/branches/BRANCH_2_1_X/src/blocks/authentication-fw/java/or= g/apache/cocoon/webapps/authentication/generation/ConfigurationGenerator.ja= va URL: http://svn.apache.org/viewcvs/cocoon/branches/BRANCH_2_1_X/src/blocks/= authentication-fw/java/org/apache/cocoon/webapps/authentication/generation/= ConfigurationGenerator.java?rev=3D164808&r1=3D164807&r2=3D164808&view=3Ddiff =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D --- cocoon/branches/BRANCH_2_1_X/src/blocks/authentication-fw/java/org/apac= he/cocoon/webapps/authentication/generation/ConfigurationGenerator.java (or= iginal) +++ cocoon/branches/BRANCH_2_1_X/src/blocks/authentication-fw/java/org/apac= he/cocoon/webapps/authentication/generation/ConfigurationGenerator.java Tue= Apr 26 09:07:03 2005 @@ -1,12 +1,12 @@ /* - * Copyright 1999-2004 The Apache Software Foundation. - *=20 + * Copyright 1999-2005 The Apache Software Foundation. + * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at - *=20 + * * http://www.apache.org/licenses/LICENSE-2.0 - *=20 + * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. @@ -15,15 +15,11 @@ */ package org.apache.cocoon.webapps.authentication.generation; =20 - -import java.io.IOException; -import java.util.Enumeration; -import java.util.Map; - import org.apache.avalon.framework.configuration.Configuration; import org.apache.avalon.framework.configuration.ConfigurationException; import org.apache.avalon.framework.service.ServiceException; import org.apache.avalon.framework.service.ServiceManager; + import org.apache.cocoon.ProcessingException; import org.apache.cocoon.components.source.SourceUtil; import org.apache.cocoon.environment.ObjectModelHelper; @@ -39,6 +35,7 @@ import org.apache.cocoon.xml.XMLConsumer; import org.apache.cocoon.xml.XMLUtils; import org.apache.cocoon.xml.dom.DOMUtil; + import org.apache.excalibur.source.Source; import org.apache.excalibur.source.SourceException; import org.apache.excalibur.source.SourceParameters; @@ -48,17 +45,19 @@ import org.w3c.dom.Node; import org.w3c.dom.NodeList; import org.xml.sax.SAXException; -import org.xml.sax.helpers.AttributesImpl; import org.xml.sax.helpers.DefaultHandler; =20 +import java.io.IOException; +import java.util.Enumeration; +import java.util.Map; + /** * This is the authentication Configuration Generator. * * @author Carsten Ziegeler - * @version CVS $Id: ConfigurationGenerator.java,v 1.9 2004/03/19 13:59:22= cziegeler Exp $ + * @version $Id$ */ -public final class ConfigurationGenerator -extends ServiceableGenerator { +public final class ConfigurationGenerator extends ServiceableGenerator { =20 /** Request parameter */ public static final String REQ_PARAMETER_STATE =3D "authstate"; @@ -70,7 +69,7 @@ =20 /** The XPath Processor */ protected XPathProcessor xpathProcessor; - =20 + /* (non-Javadoc) * @see org.apache.avalon.framework.activity.Disposable#dispose() */ @@ -101,15 +100,15 @@ try { authManager =3D (AuthenticationManager)this.manager.lookup(Aut= henticationManager.ROLE); state =3D authManager.getState(); - =20 + } catch (Exception ignore) { } - =20 + this.xmlConsumer.startDocument(); if ( state !=3D null ) { try { UserHandler userhandler =3D state.getHandler(); - =20 + Configuration conf =3D state.getModuleConfiguration("singl= e-role-user-management"); if (conf =3D=3D null) { throw new ProcessingException("Module configuration 's= ingle-role-user-management' for authentication user management generator no= t found."); @@ -117,7 +116,7 @@ UserManagementHandler handler =3D new UserManagementHandle= r(conf, = state.getApplicationName()); this.showConfiguration(this.xmlConsumer, this.source, hand= ler, userhandler.getContext()); - =20 + } catch (ConfigurationException ex) { throw new ProcessingException("ConfigurationException: " += ex, ex); } @@ -147,32 +146,31 @@ Request request =3D ObjectModelHelper.getRequest(this.objectModel); Response response =3D ObjectModelHelper.getResponse(this.objectMod= el); Session session =3D request.getSession(); - =20 + boolean isAdmin =3D (src =3D=3D null || src.equals("admin")); =20 // now start producing xml: - AttributesImpl attr =3D new AttributesImpl(); - consumer.startElement("", "configuration", "configuration", attr); + consumer.startElement("", "configuration", "configuration", XMLUti= ls.EMPTY_ATTRIBUTES); =20 // set the conf uri: // This is a bug in the servlet 2.2 API!!! // It does not contain the context: String uri =3D HttpUtils.getR= equestURL(this.request).toString(); // So: ABSOLUTELY USELESS String uri =3D response.encodeURL(request.getRequestURI()); - consumer.startElement("", "uri", "uri", attr); + consumer.startElement("", "uri", "uri", XMLUtils.EMPTY_ATTRIBUTES); consumer.characters(uri.toCharArray(), 0, uri.length()); consumer.endElement("", "uri", "uri"); =20 if (isAdmin =3D=3D true) { // build the menue - consumer.startElement("", "menue", "menue", attr); + consumer.startElement("", "menue", "menue", XMLUtils.EMPTY_ATT= RIBUTES); =20 if (handler.getNewRoleResource() !=3D null) { - consumer.startElement("", "addrole", "addrole", attr); + consumer.startElement("", "addrole", "addrole", XMLUtils.E= MPTY_ATTRIBUTES); consumer.endElement("", "addrole", "addrole"); } if (handler.getDeleteRoleResource() !=3D null) { - consumer.startElement("", "delrole", "delrole", attr); + consumer.startElement("", "delrole", "delrole", XMLUtils.E= MPTY_ATTRIBUTES); consumer.endElement("", "delrole", "delrole"); } =20 @@ -180,7 +178,7 @@ } =20 =20 - synchronized (session) {=20 + synchronized (session) { =20 String state =3D request.getParameter(REQ_PARAMETER_STATE); if (state =3D=3D null) { @@ -256,7 +254,7 @@ } addingNewUserFailed =3D !this.addUser(role, id, pa= rs, handler); if (addingNewUserFailed =3D=3D false) { - consumer.startElement("", "addeduser", "addedu= ser", attr); + consumer.startElement("", "addeduser", "addedu= ser", XMLUtils.EMPTY_ATTRIBUTES); consumer.characters(id.toCharArray(), 0, id.le= ngth()); consumer.endElement("", "addeduser", "addeduse= r"); } @@ -308,7 +306,7 @@ } catch (javax.xml.transform.TransformerException loca= l) { throw new ProcessingException("TransformerExceptio= n: " + local, local); } - consumer.startElement("", "uservalues", "uservalues", = attr); + consumer.startElement("", "uservalues", "uservalues", = XMLUtils.EMPTY_ATTRIBUTES); if (users !=3D null && users.hasChildNodes() =3D=3D tr= ue) { NodeList childs =3D users.getChildNodes(); for(int i =3D 0; i < childs.getLength(); i++) { @@ -318,11 +316,11 @@ } consumer.endElement("", "uservalues", "uservalues"); } - consumer.startElement("", "user", "user", attr); + consumer.startElement("", "user", "user", XMLUtils.EMPTY_A= TTRIBUTES); consumer.characters("old".toCharArray(), 0, 3); consumer.endElement("", "user", "user"); if (isAdmin =3D=3D false) { - consumer.startElement("", "role", "role", attr); + consumer.startElement("", "role", "role", XMLUtils.EMP= TY_ATTRIBUTES); consumer.characters(role.toCharArray(), 0, role.length= ()); consumer.endElement("", "role", "role"); } @@ -351,7 +349,7 @@ } catch (javax.xml.transform.TransformerException loca= l) { throw new ProcessingException("TransformerExceptio= n: " + local, local); } - consumer.startElement("", "uservalues", "uservalues", = attr); + consumer.startElement("", "uservalues", "uservalues", = XMLUtils.EMPTY_ATTRIBUTES); if (users !=3D null && users.hasChildNodes() =3D=3D tr= ue) { NodeList childs =3D users.getChildNodes(); for(int i =3D 0; i < childs.getLength(); i++) { @@ -361,18 +359,18 @@ } consumer.endElement("", "uservalues", "uservalues"); } - consumer.startElement("", "user", "user", attr); + consumer.startElement("", "user", "user", XMLUtils.EMPTY_A= TTRIBUTES); consumer.characters("error".toCharArray(), 0, 5); consumer.endElement("", "user", "user"); if (isAdmin =3D=3D false) { - consumer.startElement("", "role", "role", attr); + consumer.startElement("", "role", "role", XMLUtils.EMP= TY_ATTRIBUTES); consumer.characters(role.toCharArray(), 0, role.length= ()); consumer.endElement("", "role", "role"); } } =20 if (state.equals("adduser") =3D=3D true) { - consumer.startElement("", "user", "user", attr); + consumer.startElement("", "user", "user", XMLUtils.EMPTY_A= TTRIBUTES); consumer.characters("new".toCharArray(), 0, 3); consumer.endElement("", "user", "user"); } @@ -405,7 +403,7 @@ // include selected role String role =3D (String)session.getAttribute(SESSION_CONTE= XT_ATTRIBUTE_ADMIN_ROLE); if (role !=3D null) { - consumer.startElement("", "role", "role", attr); + consumer.startElement("", "role", "role", XMLUtils.EMP= TY_ATTRIBUTES); consumer.characters(role.toCharArray(), 0, role.length= ()); consumer.endElement("", "role", "role"); } @@ -671,18 +669,18 @@ throws IOException, ProcessingException, SAXException { Source source =3D null; try { - source =3D SourceUtil.getSource(resource,=20 - null,=20 - parameters,=20 + source =3D SourceUtil.getSource(resource, + null, + parameters, this.resolver); - SourceUtil.parse(this.manager, source, new DefaultHandler()); = =20 + SourceUtil.parse(this.manager, source, new DefaultHandler()); } catch (SourceException se) { throw SourceUtil.handle(se); } finally { this.resolver.release(source); } } - =20 + /** * Load XML resource */ @@ -691,9 +689,9 @@ throws IOException, ProcessingException, SAXException { Source source =3D null; try { - source =3D SourceUtil.getSource(resource,=20 - null,=20 - parameters,=20 + source =3D SourceUtil.getSource(resource, + null, + parameters, this.resolver); return SourceUtil.toDOM(source); } catch (SourceException se) { @@ -708,11 +706,11 @@ =20 /** The name of the current application */ private String applicationName; - =20 + /** The load-users resource */ private String loadUsersResource; private SourceParameters loadUsersResourceParameters; - =20 + /** The load-roles resource */ private String loadRolesResource; private SourceParameters loadRolesResourceParameters; @@ -744,9 +742,9 @@ String appName) throws ConfigurationException { Configuration child; - =20 + this.applicationName =3D appName; - =20 + // get load-users resource (optional) child =3D conf.getChild("load-users", false); if (child !=3D null) { @@ -801,7 +799,7 @@ * Get the name of the current application */ public String getApplicationName() { return this.applicationName; } - =20 + /** * Get the load users resource */ Modified: cocoon/branches/BRANCH_2_1_X/src/blocks/chaperon/java/org/apache/= cocoon/transformation/PatternTransformer.java URL: http://svn.apache.org/viewcvs/cocoon/branches/BRANCH_2_1_X/src/blocks/= chaperon/java/org/apache/cocoon/transformation/PatternTransformer.java?rev= =3D164808&r1=3D164807&r2=3D164808&view=3Ddiff =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D --- cocoon/branches/BRANCH_2_1_X/src/blocks/chaperon/java/org/apache/cocoon= /transformation/PatternTransformer.java (original) +++ cocoon/branches/BRANCH_2_1_X/src/blocks/chaperon/java/org/apache/cocoon= /transformation/PatternTransformer.java Tue Apr 26 09:07:03 2005 @@ -1,19 +1,18 @@ /* - * Copyright 1999-2004 The Apache Software Foundation. - *=20 + * Copyright 1999-2005 The Apache Software Foundation. + * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at - *=20 + * * http://www.apache.org/licenses/LICENSE-2.0 - *=20 + * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ - package org.apache.cocoon.transformation; =20 import net.sourceforge.chaperon.build.LexicalAutomatonBuilder; @@ -35,6 +34,7 @@ import org.apache.avalon.framework.service.Serviceable; =20 import org.apache.cocoon.ProcessingException; +import org.apache.cocoon.xml.XMLUtils; import org.apache.cocoon.caching.CacheableProcessingComponent; import org.apache.cocoon.components.source.SourceUtil; import org.apache.cocoon.environment.SourceResolver; @@ -57,7 +57,7 @@ =20 /** * This transfomer transforms text pattern of a XML file into lexemes by u= sing a lexicon file. - *=20 + * *

* Input: *

@@ -66,7 +66,7 @@ * Text 123 bla * </section> * - *=20 + * *

* can be transformed into the following output: *

@@ -79,13 +79,12 @@ * * * @author Stephan Michels - * @version CVS $Id$ + * @version $Id$ */ -public class PatternTransformer extends AbstractTransformer implements Log= Enabled, Serviceable, - Rec= yclable, Disposable, - Par= ameterizable, - Cac= heableProcessingComponent -{ +public class PatternTransformer extends AbstractTransformer + implements LogEnabled, Serviceable, Recycl= able, + Disposable, Parameterizable, Ca= cheableProcessingComponent { + /** Namespace for the SAX events. */ public static final String NS =3D "http://chaperon.sourceforge.net/schem= a/lexemes/2.0"; private String lexicon =3D null; @@ -425,15 +424,13 @@ atts.addAttribute("", "text", "text", "CDATA", lexemetext); contentHandler.startElement(NS, "lexeme", "lexeme", atts); =20 - if (this.groups) - { - for (int group =3D 0; group * * Instructions: get the JavaMail API jar from http://java.sun.com/product= s/javamail/, and - * the JAF activation.jar from http://java.sun.com/beans/glasgow/jaf.html.= Put mail.jar=20 + * the JAF activation.jar from http://java.sun.com/beans/glasgow/jaf.html.= Put mail.jar * and activation.jar in xml-cocoon2/lib/local/, and recompile. These jar= s could actually be * moved to lib/optional and added to jars.xml in the future. * - * TODO Refactor all of this to use the MailCommandManager, etc... + *
TODO Refactor all of this to use the MailCommandManager, etc... * * @author Tony Collen - * @version CVS $Id: IMAPGenerator.java,v 1.6 2004/03/06 02:26:09 antonio = Exp $ + * @version $Id$ */ public class IMAPGenerator extends AbstractGenerator { - =20 + static final String URI =3D "http://apache.org/cocoon/imap/1.0/"; static final String PREFIX =3D "imap"; =20 private String host; private String user; private String pass; - =20 + private Properties props =3D new Properties(); - private Message message[] =3D null; - =20 + private Message message[]; + public void setup(SourceResolver resolver, Map objectModel, String src= , Parameters par) - throws ProcessingException, SAXException, IOException { - =20 + throws ProcessingException, SAXException, IOException { + // TODO: the default values should be something else... this.host =3D par.getParameter("host", "none"); this.user =3D par.getParameter("user", "none"); this.pass =3D par.getParameter("pass", "none"); =20 - if (this.host.equals("none") ||=20 - this.user.equals("none") ||=20 + if (this.host.equals("none") || + this.user.equals("none") || this.pass.equals("none")) { =20 throw new ProcessingException("You must configure this generat= or with host, user, and pass parameters."); } } - =20 + public void generate() throws SAXException, ProcessingException { - =20 + try { Session sess =3D Session.getDefaultInstance(this.props, null); Store st =3D sess.getStore("imap"); =20 - AttributesImpl attr =3D new AttributesImpl(); - log("Connecting to IMAP server @ " + this.host); st.connect(this.host, this.user, this.pass); =20 @@ -107,34 +107,32 @@ this.contentHandler.startDocument(); this.contentHandler.startPrefixMapping(PREFIX, URI); =20 - start("imap", attr); - - start("messages", attr); + start("imap", XMLUtils.EMPTY_ATTRIBUTES); + start("messages", XMLUtils.EMPTY_ATTRIBUTES); =20 for (i =3D 0; i < this.message.length; i++) { + // Loop through the messages and output XML. + // TODO: actually use the attributes... =20 - // loop through the messages and output XML. - // TODO: actually use the attributes... - - start("msg", attr); + start("msg", XMLUtils.EMPTY_ATTRIBUTES); =20 - start("subject", attr); - data( this.message[i].getSubject() ); - end("subject"); + start("subject", XMLUtils.EMPTY_ATTRIBUTES); + data(this.message[i].getSubject()); + end("subject"); =20 - start("from", attr); - data( this.message[i].getFrom()[0].toString() ); - end("from"); + start("from", XMLUtils.EMPTY_ATTRIBUTES); + data(this.message[i].getFrom()[0].toString()); + end("from"); =20 - start("sentDate", attr); - data( this.message[i].getSentDate().toString() ); - end("sentDate"); + start("sentDate", XMLUtils.EMPTY_ATTRIBUTES); + data(this.message[i].getSentDate().toString()); + end("sentDate"); =20 - start("num", attr); - data( Integer.toString( this.message[i].getMessageNumber() ) ); - end("num"); + start("num", XMLUtils.EMPTY_ATTRIBUTES); + data(Integer.toString(this.message[i].getMessageNumber())); + end("num"); =20 - end("msg"); + end("msg"); } =20 end("messages"); @@ -148,9 +146,8 @@ } catch (AuthenticationFailedException afe) { throw new ProcessingException("Failed to authenticate with the= IMAP server."); } catch (Exception e) { - // TODO: be more specific when catching this exception... - throw new ProcessingException( e.toString() ); + throw new ProcessingException(e.toString()); } } =20 @@ -158,7 +155,6 @@ * Recycle the generator by removing references */ public void recycle() { - this.host =3D null; this.user =3D null; this.pass =3D null; @@ -167,33 +163,24 @@ this.message =3D null; =20 super.recycle(); - } =20 - private void start(String name, AttributesImpl attr) - throws SAXException=20 - { + private void start(String name, Attributes attr) + throws SAXException { super.contentHandler.startElement(URI, name, PREFIX + ":" + name, = attr); - attr.clear(); } =20 - private void end(String name)=20 - throws SAXException - { + private void end(String name) + throws SAXException { super.contentHandler.endElement(URI, name, PREFIX + ":" + name); } - =20 - private void data(String data)=20 - throws SAXException - { + + private void data(String data) + throws SAXException { super.contentHandler.characters( data.toCharArray(), 0, data.lengt= h() ); } - =20 - private void log(String msg) - { - if (this.getLogger().isDebugEnabled()) { - this.getLogger().debug(msg); - } + + private void log(String msg) { + getLogger().debug(msg); } - =20 } Modified: cocoon/branches/BRANCH_2_1_X/src/blocks/mail/java/org/apache/coco= on/mail/MailContentHandlerDelegate.java URL: http://svn.apache.org/viewcvs/cocoon/branches/BRANCH_2_1_X/src/blocks/= mail/java/org/apache/cocoon/mail/MailContentHandlerDelegate.java?rev=3D1648= 08&r1=3D164807&r2=3D164808&view=3Ddiff =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D --- cocoon/branches/BRANCH_2_1_X/src/blocks/mail/java/org/apache/cocoon/mai= l/MailContentHandlerDelegate.java (original) +++ cocoon/branches/BRANCH_2_1_X/src/blocks/mail/java/org/apache/cocoon/mai= l/MailContentHandlerDelegate.java Tue Apr 26 09:07:03 2005 @@ -1,12 +1,12 @@ /* - * Copyright 1999-2004 The Apache Software Foundation. - *=20 + * Copyright 1999-2005 The Apache Software Foundation. + * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at - *=20 + * * http://www.apache.org/licenses/LICENSE-2.0 - *=20 + * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. @@ -49,7 +49,7 @@ * * @author Bernhard Huber * @since 24. Oktober 2002 - * @version CVS $Id: MailContentHandlerDelegate.java,v 1.6 2004/03/05 13:0= 2:00 bdelacretaz Exp $ + * @version $Id$ */ =20 /* @@ -303,7 +303,6 @@ this.contentHandler.startPrefixMapping(PREFIX, URI); =20 attributes =3D new AttributesImpl(); - attributes.clear(); attributes.addAttribute("", PREFIX, "xmlns:" + PREFIX, "CDATA", UR= I); startElement("mail", attributes); } @@ -801,7 +800,7 @@ * *@author Bernhard Huber *@created 30. Dezember 2002 - *@version CVS Version: $Id: MailContentHandlerDelegate.java,v 1.6 = 2004/03/05 13:02:00 bdelacretaz Exp $ + *@version CVS Version: $Id$ */ static class FolderXMLizer extends AbstractLogEnabled implements XMLizable { @@ -852,7 +851,7 @@ * *@author Bernhard Huber *@created 30. Dezember 2002 - *@version CVS Version: $Id: MailContentHandlerDelegate.java,v 1.6 = 2004/03/05 13:02:00 bdelacretaz Exp $ + *@version CVS Version: $Id$ */ static class MessageEnvelopeXMLizer extends AbstractLogEnabled implements XMLizable { @@ -928,7 +927,7 @@ * *@author Bernhard Huber *@created 30. Dezember 2002 - *@version CVS Version: $Id: MailContentHandlerDelegate.java,v 1.6 = 2004/03/05 13:02:00 bdelacretaz Exp $ + *@version CVS Version: $Id$ */ static class MessageXMLizer extends AbstractLogEnabled implements XMLizable { Modified: cocoon/branches/BRANCH_2_1_X/src/blocks/ojb/java/org/apache/cocoo= n/ojb/components/LoggerImpl.java URL: http://svn.apache.org/viewcvs/cocoon/branches/BRANCH_2_1_X/src/blocks/= ojb/java/org/apache/cocoon/ojb/components/LoggerImpl.java?rev=3D164808&r1= =3D164807&r2=3D164808&view=3Ddiff =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D --- cocoon/branches/BRANCH_2_1_X/src/blocks/ojb/java/org/apache/cocoon/ojb/= components/LoggerImpl.java (original) +++ cocoon/branches/BRANCH_2_1_X/src/blocks/ojb/java/org/apache/cocoon/ojb/= components/LoggerImpl.java Tue Apr 26 09:07:03 2005 @@ -23,6 +23,7 @@ import org.apache.ojb.broker.util.configuration.Configuration; import org.apache.ojb.broker.util.configuration.ConfigurationException; import org.apache.ojb.broker.util.logging.Logger; +import org.apache.ojb.broker.util.logging.LoggingConfiguration; =20 /** * OJB logger implementation delegating to the Avalon logger @@ -51,10 +52,17 @@ } =20 /** - * Constructor used by OJB to create a logger instance + * Constructor used by OJB 1.0 to create a logger instance */ public LoggerImpl(String name) { this.name =3D name.startsWith("org.apache.ojb.")? name.substring(1= 5): name; + } + + /** + * Constructor used by OJB 1.1 to create a logger instance + */ + public LoggerImpl(String name, LoggingConfiguration config) { + this(name); } =20 /** Modified: cocoon/branches/BRANCH_2_1_X/src/blocks/portal-fw/java/org/apache= /cocoon/webapps/portal/components/PortalManagerImpl.java URL: http://svn.apache.org/viewcvs/cocoon/branches/BRANCH_2_1_X/src/blocks/= portal-fw/java/org/apache/cocoon/webapps/portal/components/PortalManagerImp= l=2Ejava?rev=3D164808&r1=3D164807&r2=3D164808&view=3Ddiff =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D --- cocoon/branches/BRANCH_2_1_X/src/blocks/portal-fw/java/org/apache/cocoo= n/webapps/portal/components/PortalManagerImpl.java (original) +++ cocoon/branches/BRANCH_2_1_X/src/blocks/portal-fw/java/org/apache/cocoo= n/webapps/portal/components/PortalManagerImpl.java Tue Apr 26 09:07:03 2005 @@ -1,12 +1,12 @@ /* * Copyright 1999-2004 The Apache Software Foundation. - *=20 + * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at - *=20 + * * http://www.apache.org/licenses/LICENSE-2.0 - *=20 + * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. @@ -92,16 +92,16 @@ =20 /** The media manager */ private MediaManager mediaManager; - =20 + /** The XPath Processor */ private XPathProcessor xpathProcessor; =20 /** The session manager */ private SessionManager sessionManager; - =20 + /** The Context manager */ private ContextManager contextManager; - =20 + /** The transaction manager */ private TransactionManager transactionManager; =20 @@ -113,10 +113,10 @@ =20 /** The context */ protected Context componentContext; - =20 + /** Are we already setup for this request? */ protected boolean initialized =3D false; - =20 + /* (non-Javadoc) * @see org.apache.avalon.excalibur.pool.Recyclable#recycle() */ @@ -145,7 +145,7 @@ AuthenticationManager authManager =3D null; try { authManager =3D (AuthenticationManager)this.manager.lookup(Aut= henticationManager.ROLE); - return authManager.getState(); =20 + return authManager.getState(); } catch (ComponentException ce) { // ignore this here return null; @@ -157,7 +157,7 @@ /* (non-Javadoc) * @see org.apache.avalon.framework.component.Composable#compose(org.a= pache.avalon.framework.component.ComponentManager) */ - public void compose(ComponentManager manager)=20 + public void compose(ComponentManager manager) throws ComponentException { this.manager =3D manager; this.resolver =3D (SourceResolver)manager.lookup(SourceResolver.RO= LE); @@ -241,16 +241,16 @@ protected void setup() throws ProcessingException { if ( !this.initialized ) { - =20 + final Request request =3D ContextHelper.getRequest(this.compon= entContext); - =20 + if ( request.getAttribute(PortalManager.ROLE) =3D=3D null ) { - =20 + request.setAttribute(PortalManager.ROLE, Boolean.TRUE); - =20 + // Get and ignore the configuration this.getConfiguration(); - =20 + try { this.changeProfile(); } catch (SAXException se) { @@ -259,7 +259,7 @@ throw new ProcessingException(ioe); } } - =20 + this.initialized =3D true; } } @@ -268,14 +268,14 @@ * @see org.apache.cocoon.webapps.portal.components.PortalManager#conf= igurationTest() */ public void configurationTest() - throws ProcessingException, IOException, SAXException { =20 + throws ProcessingException, IOException, SAXException { // no sync required if (this.getLogger().isDebugEnabled()) { this.getLogger().debug("BEGIN configurationTest"); } =20 this.setup(); - =20 + // Ignore result this.getConfiguration(); =20 @@ -308,7 +308,7 @@ if (context =3D=3D null && create) { =20 // create new context - =20 + context =3D this.getAuthenticationManager().createAppl= icationContext(attrName, null, null); =20 } @@ -333,7 +333,7 @@ // synchronized not req. this.setup(); Response response =3D ContextHelper.getResponse(this.componentCont= ext); - =20 + XMLUtils.startElement(consumer, PortalConstants.ELEMENT_CONFIGURAT= ION); =20 // set the portal-page uri: @@ -548,12 +548,12 @@ if (saveResource =3D=3D null) { throw new ProcessingException("portal: No save= resource defined for type coplet-base."); } else { - =20 - SourceUtil.writeDOM(saveResource,=20 - null,=20 - pars,=20 - copletsFragment,=20 - this.resolver,=20 + + SourceUtil.writeDOM(saveResource, + null, + pars, + copletsFragment, + this.resolver, "xml"); =20 // now the hardest part, clean up the whole ca= che @@ -576,11 +576,10 @@ } =20 // now start producing xml: - AttributesImpl attr =3D new AttributesImpl(); - consumer.startElement("", PortalConstants.ELEMENT_ADMINCONF, P= ortalConstants.ELEMENT_ADMINCONF, attr); + consumer.startElement("", PortalConstants.ELEMENT_ADMINCONF, P= ortalConstants.ELEMENT_ADMINCONF, XMLUtils.EMPTY_ATTRIBUTES); =20 context.setAttribute(ATTRIBUTE_ADMIN_STATE, state); - consumer.startElement("", PortalConstants.ELEMENT_STATE, Porta= lConstants.ELEMENT_STATE, attr); + consumer.startElement("", PortalConstants.ELEMENT_STATE, Porta= lConstants.ELEMENT_STATE, XMLUtils.EMPTY_ATTRIBUTES); consumer.characters(state.toCharArray(), 0, state.length()); consumer.endElement("", PortalConstants.ELEMENT_STATE, PortalC= onstants.ELEMENT_STATE); =20 @@ -634,7 +633,7 @@ } context.setAttribute(ATTRIBUTE_ADMIN_ROLE, role); if (role !=3D null) { - consumer.startElement("", PortalConstants.ELEMENT_ROLE= , PortalConstants.ELEMENT_ROLE, attr); + consumer.startElement("", PortalConstants.ELEMENT_ROLE= , PortalConstants.ELEMENT_ROLE, XMLUtils.EMPTY_ATTRIBUTES); consumer.characters(role.toCharArray(), 0, role.length= ()); consumer.endElement("", PortalConstants.ELEMENT_ROLE, = PortalConstants.ELEMENT_ROLE); profileID =3D this.getProfileID(PortalManagerImpl.BUIL= DTYPE_VALUE_ROLE, role, null, true); @@ -658,10 +657,10 @@ context.setAttribute(ATTRIBUTE_ADMIN_ID, id); context.setAttribute(ATTRIBUTE_ADMIN_ROLE, role); if (role !=3D null && id !=3D null) { - consumer.startElement("", PortalConstants.ELEMENT_ROLE= , PortalConstants.ELEMENT_ROLE, attr); + consumer.startElement("", PortalConstants.ELEMENT_ROLE= , PortalConstants.ELEMENT_ROLE, XMLUtils.EMPTY_ATTRIBUTES); consumer.characters(role.toCharArray(), 0, role.length= ()); consumer.endElement("", PortalConstants.ELEMENT_ROLE, = PortalConstants.ELEMENT_ROLE); - consumer.startElement("", PortalConstants.ELEMENT_ID, = PortalConstants.ELEMENT_ID, attr); + consumer.startElement("", PortalConstants.ELEMENT_ID, = PortalConstants.ELEMENT_ID, XMLUtils.EMPTY_ATTRIBUTES); consumer.characters(id.toCharArray(), 0, id.length()); consumer.endElement("", PortalConstants.ELEMENT_ID, Po= rtalConstants.ELEMENT_ID); =20 @@ -686,7 +685,7 @@ } } if (state.equals(PortalConstants.STATE_COPLETS) ) { - consumer.startElement("", PortalConstants.ELEMENT_COPLETS,= PortalConstants.ELEMENT_COPLETS, attr); + consumer.startElement("", PortalConstants.ELEMENT_COPLETS,= PortalConstants.ELEMENT_COPLETS, XMLUtils.EMPTY_ATTRIBUTES); =20 // load the base coplets profile if (copletsFragment =3D=3D null) { @@ -697,9 +696,9 @@ if (res =3D=3D null) { throw new ProcessingException("No configuration fo= r portal-coplet base profile found."); } - copletsFragment =3D SourceUtil.readDOM(res,=20 - null,=20 - pars,=20 + copletsFragment =3D SourceUtil.readDOM(res, + null, + pars, this.resolver); context.setAttribute(ATTRIBUTE_ADMIN_COPLETS, copletsF= ragment); } @@ -770,7 +769,7 @@ configMode+", adminProfile=3D"+adminProfile); } this.setup(); - =20 + SessionContext context =3D this.getContext(true); String profileID =3D null; Map storedProfile =3D null; @@ -1608,7 +1607,7 @@ public String getProfileID(String type, String role, String id, - boolean adminProfile)=20 + boolean adminProfile) throws ProcessingException { // No sync required this.setup(); @@ -2632,9 +2631,9 @@ // each attribute of first must be in second with the same value while (i < l && ok) { value =3D attr1.item(i).getNodeName(); - if (!value.equals("formtype")=20 - && !value.equals("formpath")=20 - && !value.equals("formdescription")=20 + if (!value.equals("formtype") + && !value.equals("formpath") + && !value.equals("formdescription") && !value.startsWith("xmlns:")) { ok =3D false; m =3D 0; @@ -2855,7 +2854,7 @@ if (children !=3D null && children.getLength() > 0) { int l =3D children.getLength(); for(int i =3D 0; i < l; i++) { - if (!children.item(i).getNodeName().equals("status")=20 + if (!children.item(i).getNodeName().equals("status") && children.item(i).getNodeType() =3D=3D Node.ELEM= ENT_NODE) { IncludeXMLConsumer.includeNode(children.item(i), c= onsumer, consumer); } @@ -2928,18 +2927,18 @@ /* (non-Javadoc) * @see org.apache.cocoon.webapps.portal.components.PortalManager#getM= ediaType() */ - public String getMediaType()=20 + public String getMediaType() throws ProcessingException { this.setup(); return this.getMediaManager().getMediaType(); } - =20 + /** * Get the coplet with the id */ private Element getCopletConfiguration(String copletID, Map defaultCoplets, - Map mediaCoplets)=20 + Map mediaCoplets) throws ProcessingException { // calling method is synced String media =3D this.getMediaManager().getMediaType(); @@ -3244,7 +3243,7 @@ boolean result =3D false; SessionContext context =3D this.getContext(false); if (context !=3D null - && (String)context.getAttribute(PortalManagerImpl.ATTRIBUTE_PO= RTAL_ROLE) !=3D null) { + && context.getAttribute(PortalManagerImpl.ATTRIBUTE_PORTAL_ROL= E) !=3D null) { =20 try { this.getTransactionManager().startReadingTransaction(conte= xt); @@ -3502,9 +3501,9 @@ if (this.getLogger().isInfoEnabled()) { this.getLogger().info("Building portal profile: " + resour= ce); } - SourceUtil.readDOM(resource,=20 - null,=20 - pars,=20 + SourceUtil.readDOM(resource, + null, + pars, this.resolver); } else { this.buildProfile(type, role, id, adminProfile); @@ -3549,9 +3548,9 @@ if (this.getLogger().isDebugEnabled()) { this.getLogger().debug("Loading coplet base profile"); } - copletsFragment =3D SourceUtil.readDOM(res,=20 - null,=20 - pars,=20 + copletsFragment =3D SourceUtil.readDOM(res, + null, + pars, this.resolver); =20 if (this.getLogger().isDebugEnabled()) { @@ -3565,9 +3564,9 @@ this.getLogger().debug("loading layout base profile"); } pars.setSingleParameterValue("profile", "layout-base"); - layoutFragment =3D SourceUtil.readDOM(res,=20 - null,=20 - pars,=20 + layoutFragment =3D SourceUtil.readDOM(res, + null, + pars, this.resolver); =20 if (this.getLogger().isDebugEnabled()) { @@ -3595,9 +3594,9 @@ if (this.getLogger().isDebugEnabled()) { this.getLogger().debug("loading type base profile"); } - typeFragment =3D SourceUtil.readDOM(res,=20 - null,=20 - pars,=20 + typeFragment =3D SourceUtil.readDOM(res, + null, + pars, this.resolver); profileRoot.appendChild(profileDoc.importNode(DOMUtil.selectSi= ngleNode(typeFragment, "type-profile", this.xpathProcessor), true)); @@ -3638,9 +3637,9 @@ if (this.getLogger().isDebugEnabled()) { this.getLogger().debug("loading global profile"); } - globalFragment =3D SourceUtil.readDOM(res,=20 - null,=20 - pars,=20 + globalFragment =3D SourceUtil.readDOM(res, + null, + pars, this.resolver); if (this.getLogger().isDebugEnabled()) { this.getLogger().debug("global profile loaded"); @@ -3657,9 +3656,9 @@ if (this.getLogger().isDebugEnabled()) { this.getLogger().debug("loading global type profile"); } - globalFragment =3D SourceUtil.readDOM(res,=20 - null,=20 - pars,=20 + globalFragment =3D SourceUtil.readDOM(res, + null, + pars, this.resolver); if (this.getLogger().isDebugEnabled()) { this.getLogger().debug("global type profile loaded"); @@ -3695,9 +3694,9 @@ if (this.getLogger().isDebugEnabled()) { this.getLogger().debug("loading role profile"); } - roleFragment =3D SourceUtil.readDOM(res,=20 - null,=20 - pars,=20 + roleFragment =3D SourceUtil.readDOM(res, + null, + pars, this.resolver); if (this.getLogger().isDebugEnabled()) { this.getLogger().debug("role profile loaded"); @@ -3715,9 +3714,9 @@ if (this.getLogger().isDebugEnabled()) { this.getLogger().debug("loading role type profile"); } - roleFragment =3D SourceUtil.readDOM(res,=20 - null,=20 - pars,=20 + roleFragment =3D SourceUtil.readDOM(res, + null, + pars, this.resolver); if (this.getLogger().isDebugEnabled()) { this.getLogger().debug("role type profile loaded"); @@ -3751,9 +3750,9 @@ if (this.getLogger().isDebugEnabled()) { this.getLogger().debug("loading user profile"); } - userFragment =3D SourceUtil.readDOM(res,=20 - null,=20 - pars,=20 + userFragment =3D SourceUtil.readDOM(res, + null, + pars, this.resolver); if (this.getLogger().isDebugEnabled()) { this.getLogger().debug("user profile loaded"); @@ -3771,9 +3770,9 @@ if (this.getLogger().isDebugEnabled()) { this.getLogger().debug("loading user type profile"); } - userFragment =3D SourceUtil.readDOM(res,=20 - null,=20 - pars,=20 + userFragment =3D SourceUtil.readDOM(res, + null, + pars, this.resolver); if (this.getLogger().isDebugEnabled()) { this.getLogger().debug("user type profile loaded"); @@ -3812,9 +3811,9 @@ if (this.getLogger().isDebugEnabled()) { this.getLogger().debug("loading user status profile"); } - userFragment =3D SourceUtil.readDOM(res,=20 - null,=20 - pars,=20 + userFragment =3D SourceUtil.readDOM(res, + null, + pars, this.resolver); if (this.getLogger().isDebugEnabled()) { this.getLogger().debug("user status profile loaded"); @@ -3874,11 +3873,11 @@ pars.setSingleParameterValue("handler", reqstate.getHandle= rName()); pars.setSingleParameterValue("profile", "user-status"); =20 - SourceUtil.writeDOM(res,=20 - null,=20 + SourceUtil.writeDOM(res, + null, pars, - userFragment,=20 - this.resolver,=20 + userFragment, + this.resolver, "xml"); =20 } finally { @@ -4061,11 +4060,11 @@ if (role !=3D null) pars.setSingleParameterVal= ue("role", role); pars.setSingleParameterValue("application", re= qstate.getApplicationName()); pars.setSingleParameterValue("handler", reqsta= te.getHandlerName()); - SourceUtil.writeDOM(saveResource,=20 - null,=20 + SourceUtil.writeDOM(saveResource, + null, pars, - delta,=20 - this.resolver,=20 + delta, + this.resolver, "xml"); =20 if (delta.getParentNode() !=3D null) delta.get= ParentNode().removeChild(delta); @@ -4203,7 +4202,7 @@ if (child !=3D null) { String loadUsersResource =3D child.getAttribute("uri", nul= l); SourceParameters loadUsersResourceParameters =3D SourcePar= ameters.create(child); - =20 + if (loadUsersResource !=3D null) { SourceParameters parameters =3D (loadUsersResourcePara= meters =3D=3D null) ? new SourceParameters() =20 @@ -4218,11 +4217,11 @@ } if (role !=3D null) parameters.setSingleParameterValue= ("role", role); frag =3D this.loadResource(loadUsersResource, paramete= rs); - =20 + } } } - =20 + if (this.getLogger().isDebugEnabled()) { this.getLogger().debug("END getUsers fragment=3D"+(frag =3D=3D= null ? "null" : XMLUtils.serializeNode(frag, XMLUtils.createPropertiesForX= ML(false)))); } @@ -4280,9 +4279,9 @@ throws IOException, ProcessingException, SAXException { Source source =3D null; try { - source =3D SourceUtil.getSource(resource,=20 - null,=20 - parameters,=20 + source =3D SourceUtil.getSource(resource, + null, + parameters, this.resolver); return SourceUtil.toDOM(source); } catch (SourceException se) { Modified: cocoon/branches/BRANCH_2_1_X/src/blocks/portal/java/org/apache/co= coon/portal/tools/generation/I18nCatalogueGenerator.java URL: http://svn.apache.org/viewcvs/cocoon/branches/BRANCH_2_1_X/src/blocks/= portal/java/org/apache/cocoon/portal/tools/generation/I18nCatalogueGenerato= r=2Ejava?rev=3D164808&r1=3D164807&r2=3D164808&view=3Ddiff =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D --- cocoon/branches/BRANCH_2_1_X/src/blocks/portal/java/org/apache/cocoon/p= ortal/tools/generation/I18nCatalogueGenerator.java (original) +++ cocoon/branches/BRANCH_2_1_X/src/blocks/portal/java/org/apache/cocoon/p= ortal/tools/generation/I18nCatalogueGenerator.java Tue Apr 26 09:07:03 2005 @@ -1,12 +1,12 @@ /* * Copyright 1999-2005 The Apache Software Foundation. - *=20 + * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at - *=20 + * * http://www.apache.org/licenses/LICENSE-2.0 - *=20 + * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. @@ -15,46 +15,47 @@ */ package org.apache.cocoon.portal.tools.generation; =20 -import java.io.IOException; -import java.net.MalformedURLException; -import java.util.Iterator; -import java.util.List; -import java.util.Map; - import org.apache.avalon.framework.parameters.Parameters; import org.apache.avalon.framework.service.ServiceException; import org.apache.avalon.framework.service.ServiceManager; + import org.apache.cocoon.ProcessingException; import org.apache.cocoon.environment.SourceResolver; import org.apache.cocoon.generation.ServiceableGenerator; import org.apache.cocoon.portal.tools.PortalToolCatalogue; import org.apache.cocoon.portal.tools.PortalToolManager; import org.apache.cocoon.xml.IncludeXMLConsumer; +import org.apache.cocoon.xml.XMLUtils; + import org.apache.excalibur.source.Source; import org.apache.excalibur.xml.sax.SAXParser; import org.xml.sax.InputSource; import org.xml.sax.SAXException; -import org.xml.sax.helpers.AttributesImpl; + +import java.io.IOException; +import java.net.MalformedURLException; +import java.util.Iterator; +import java.util.List; +import java.util.Map; =20 /** - *=20 - * @version CVS $Id$ + * + * @version $Id$ */ public class I18nCatalogueGenerator extends ServiceableGenerator { - =20 + private SAXParser parser; private PortalToolManager ptm; private final String CATALOGUE_TAG =3D "catalogue"; private String lang =3D ".xml"; - private StringBuffer i18n =3D new StringBuffer(); - =20 + /* (non-Javadoc) * @see org.apache.cocoon.generation.Generator#generate() */ - public void generate() throws IOException, SAXException, - ProcessingException { + public void generate() + throws IOException, SAXException, ProcessingException { this.xmlConsumer.startDocument(); - this.xmlConsumer.startElement("", CATALOGUE_TAG, CATALOGUE_TAG, new A= ttributesImpl()); + this.xmlConsumer.startElement("", CATALOGUE_TAG, CATALOGUE_TAG, XMLUt= ils.EMPTY_ATTRIBUTES); List cats =3D ptm.getI18n(); for(Iterator it =3D cats.iterator(); it.hasNext();) { PortalToolCatalogue ptc =3D (PortalToolCatalogue) it.next(= ); @@ -73,11 +74,11 @@ this.xmlConsumer.endElement("", CATALOGUE_TAG, CATALOGUE_TAG); this.xmlConsumer.endDocument(); } - =20 + /* (non-Javadoc) * @see org.apache.cocoon.sitemap.SitemapModelComponent#setup(org.apac= he.cocoon.environment.SourceResolver, java.util.Map, java.lang.String, org.= apache.avalon.framework.parameters.Parameters) */ - public void setup(SourceResolver resolver, Map objectModel, String src= , Parameters par)=20 + public void setup(SourceResolver resolver, Map objectModel, String src= , Parameters par) throws ProcessingException, SAXException, IOException { super.setup(resolver, objectModel, src, par); if(src.indexOf("_") !=3D -1) { @@ -86,7 +87,7 @@ } =20 } - =20 + /* (non-Javadoc) * @see org.apache.cocoon.generation.ServiceableGenerator#service(org.apa= che.avalon.framework.service.ServiceManager) */ Modified: cocoon/branches/BRANCH_2_1_X/src/blocks/profiler/java/org/apache/= cocoon/generation/ProfilerGenerator.java URL: http://svn.apache.org/viewcvs/cocoon/branches/BRANCH_2_1_X/src/blocks/= profiler/java/org/apache/cocoon/generation/ProfilerGenerator.java?rev=3D164= 808&r1=3D164807&r2=3D164808&view=3Ddiff =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D --- cocoon/branches/BRANCH_2_1_X/src/blocks/profiler/java/org/apache/cocoon= /generation/ProfilerGenerator.java (original) +++ cocoon/branches/BRANCH_2_1_X/src/blocks/profiler/java/org/apache/cocoon= /generation/ProfilerGenerator.java Tue Apr 26 09:07:03 2005 @@ -1,12 +1,12 @@ /* - * Copyright 1999-2004 The Apache Software Foundation. - *=20 + * Copyright 1999-2005 The Apache Software Foundation. + * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at - *=20 + * * http://www.apache.org/licenses/LICENSE-2.0 - *=20 + * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. @@ -27,6 +27,8 @@ import org.apache.cocoon.environment.Request; import org.apache.cocoon.environment.SourceResolver; import org.apache.cocoon.xml.IncludeXMLConsumer; +import org.apache.cocoon.xml.XMLUtils; + import org.xml.sax.SAXException; import org.xml.sax.helpers.AttributesImpl; =20 @@ -44,7 +46,7 @@ * @author Vadim Gritsenko * @author Bruno Dumon * @author Stephan Michels - * @version CVS $Id: ProfilerGenerator.java,v 1.6 2004/03/05 13:02:20 bdel= acretaz Exp $ + * @version $Id$ */ public class ProfilerGenerator extends ServiceableGenerator { =20 @@ -158,7 +160,7 @@ } else { this.contentHandler.startDocument(); this.contentHandler.startPrefixMapping(PREFIX, PROFILER_NS= ); - this.contentHandler.startElement(PROFILER_NS, "fragment-er= ror", PREFIX_COLON + "fragment-error", new AttributesImpl()); + this.contentHandler.startElement(PROFILER_NS, "fragment-er= ror", PREFIX_COLON + "fragment-error", XMLUtils.EMPTY_ATTRIBUTES); char[] message =3D "Fragment is not available.".toCharArra= y(); this.contentHandler.characters(message, 0, message.length); this.contentHandler.endElement(PROFILER_NS, "fragment-erro= r", PREFIX_COLON + "fragment-error"); @@ -188,7 +190,6 @@ String dateTime =3D DateFormat.getDateTimeInstance().format(new Da= te()); =20 AttributesImpl atts =3D new AttributesImpl(); - atts.addAttribute("", "date", "date", "CDATA", dateTime); this.contentHandler.startElement(PROFILER_NS, PROFILERINFO_ELEMENT, PREFIX_COLON + PROFILERINFO_ELEME= NT, atts); @@ -211,11 +212,12 @@ /** * * - * @param key =20 - * @param result =20 + * @param key + * @param result */ private void generateResults(Long key, - ProfilerResult result) throws SAXExceptio= n { + ProfilerResult result) + throws SAXException { AttributesImpl atts =3D new AttributesImpl(); =20 int count =3D result.getCount(); @@ -231,8 +233,9 @@ // Total time of all requests long totalTimeSum =3D 0; =20 - for (int i =3D 0; iTODO: doesn't handle authentication properly + *
TODO: doesn't handle (and doubt it'll ever will) HTTP/1.1 keep-alive + * * @author Gianugo Rabellino - * @version $Id: GenericProxyGenerator.java,v 1.5 2004/03/05 13:02:20 bdel= acretaz Exp $ + * @version $Id$ */ public class GenericProxyGenerator extends ServiceableGenerator { -=20 + /** The real URL to forward requests to */ HttpURL destination; /** The current request */ @@ -64,7 +65,7 @@ =20 /** * Compose and get a SAX parser for further use. - *=20 + * * @see org.apache.avalon.framework.service.Serviceable#service(org.ap= ache.avalon.framework.service.ServiceManager) */ public void service(ServiceManager manager) throws ServiceException { @@ -82,14 +83,14 @@ } super.dispose(); } - =20 + /** - * Setup this component by getting the (required) "url" parameter and = the=20 + * Setup this component by getting the (required) "url" parameter and = the * (optional) "path" parameter. If path is not specified, the request= URI will * be used and forwarded. - *=20 + * * TODO: handle query string - *=20 + * * @see org.apache.cocoon.sitemap.SitemapModelComponent#setup(org.apac= he.cocoon.environment.SourceResolver, java.util.Map, java.lang.String, org.= apache.avalon.framework.parameters.Parameters) */ public void setup( @@ -109,69 +110,68 @@ if (path =3D=3D null) path =3D request.getRequestURI(); destination =3D new HttpURL(url); - =20 + } - =20 - =20 + + /** * Get the request data, pass them on to the forwarder and return the = result. - *=20 + * * TODO: much better header handling - * TODO: handle non XML and bodyless responses (probably needs a smart= er Serializer,=20 + * TODO: handle non XML and bodyless responses (probably needs a smart= er Serializer, * since some XML has to go through the pipeline anyway. - *=20 + * * @see org.apache.cocoon.generation.Generator#generate() */ public void generate() throws IOException, SAXException, ProcessingException { - RequestForwardingHttpMethod method =3D=20 + RequestForwardingHttpMethod method =3D new RequestForwardingHttpMethod(request, destination); - =20 - // Build the forwarded connection =20 - HttpConnection conn =3D new HttpConnection(destination.getHost= (), destination.getPort()); =20 + + // Build the forwarded connection + HttpConnection conn =3D new HttpConnection(destination.getHost= (), destination.getPort()); HttpState state =3D new HttpState(); - state.setCredentials(null, destination.getHost(),=20 + state.setCredentials(null, destination.getHost(), new UsernamePasswordCredentials(destination.getUser(), des= tination.getPassword())); method.setPath(path); - =20 + // Execute the method method.execute(state, conn); - =20 + // Send the output to the client: set the status code... response.setStatus(method.getStatusCode()); - =20 - // ... retrieve the headers from the origin server and pass th= em on=20 + + // ... retrieve the headers from the origin server and pass th= em on Header[] methodHeaders =3D method.getResponseHeaders(); for (int i =3D 0; i < methodHeaders.length; i++) { // there is more than one DAV header if (methodHeaders[i].getName().equals("DAV")) { response.addHeader(methodHeaders[i].getName(), methodH= eaders[i].getValue()); } else if (methodHeaders[i].getName().equals("Content-Leng= th")) { - // drop the original Content-Length header. Don't ask = me why but there=20 + // drop the original Content-Length header. Don't ask = me why but there // it's always one byte off } else { response.setHeader(methodHeaders[i].getName(), methodH= eaders[i].getValue()); - } =20 + } } - =20 + // no HTTP keepalives here... response.setHeader("Connection", "close"); =20 // Parse the XML, if any - if (method.getResponseHeader("Content-Type").getValue().starts= With("text/xml")) { =20 - InputStream stream =3D method.getResponseBodyAsStream(); = =20 + if (method.getResponseHeader("Content-Type").getValue().starts= With("text/xml")) { + InputStream stream =3D method.getResponseBodyAsStream(); parser.parse(new InputSource(stream), this.contentHandler,= this.lexicalHandler); } else { // Just send a dummy XML this.contentHandler.startDocument(); - this.contentHandler.startElement("", "no-xml-content", "no= -xml-content", new AttributesImpl()); + this.contentHandler.startElement("", "no-xml-content", "no= -xml-content", XMLUtils.EMPTY_ATTRIBUTES); this.contentHandler.endElement("", "no-xml-content", "no-x= ml-content"); this.contentHandler.endDocument(); } - =20 + // again, no keepalive here. conn.close(); - =20 } =20 }