cocoon-cvs mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From sylv...@apache.org
Subject cvs commit: cocoon-2.0/src/java/org/apache/cocoon/components/language/markup/xsp/java soap.xsl
Date Sun, 19 Oct 2003 12:42:11 GMT
sylvain     2003/10/19 05:42:11

  Modified:    src/java/org/apache/cocoon/components/language/markup/xsp
                        SOAPHelper.java
               src/java/org/apache/cocoon/components/language/markup/xsp/java
                        soap.xsl
  Log:
  Add @authentication on soap:call to allow basic authentication
  
  Revision  Changes    Path
  1.3       +9 -3      cocoon-2.0/src/java/org/apache/cocoon/components/language/markup/xsp/SOAPHelper.java
  
  Index: SOAPHelper.java
  ===================================================================
  RCS file: /home/cvs/cocoon-2.0/src/java/org/apache/cocoon/components/language/markup/xsp/SOAPHelper.java,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- SOAPHelper.java	21 Aug 2003 02:11:59 -0000	1.2
  +++ SOAPHelper.java	19 Oct 2003 12:42:11 -0000	1.3
  @@ -67,7 +67,7 @@
   import org.apache.commons.httpclient.HttpConnection;
   import org.apache.commons.httpclient.HttpState;
   import org.apache.commons.httpclient.methods.PostMethod;
  -
  +import org.apache.excalibur.source.SourceUtil;
   import org.xml.sax.InputSource;
   
   /**
  @@ -83,15 +83,17 @@
       URL url;
       String action = "";
       XScriptObject xscriptObject;
  +    String authorization = "";
   
       public SOAPHelper(ComponentManager manager, String urlContext, String url,
  -                      String action, XScriptObject xscriptObject)
  +                      String action, String authorization, XScriptObject xscriptObject)
               throws MalformedURLException, ComponentException
       {
           this.xscriptManager = (XScriptManager) manager.lookup(XScriptManager.ROLE);
           URL context = new URL(urlContext);
           this.url = new URL(context, url);
           this.action = action;
  +        this.authorization = authorization;
           this.xscriptObject = xscriptObject;
       }
   
  @@ -155,6 +157,10 @@
                       new Header("Content-type", "text/xml; charset=\"utf-8\""));
               method.setRequestHeader(new Header("SOAPAction", action));
               method.setRequestBody(request);
  +
  +            if (authorization != null && !authorization.equals("")) {
  +               method.setRequestHeader(new Header("Authorization","Basic "+SourceUtil.encodeBASE64(authorization)));
  +            }
   
               method.execute(new HttpState(), conn);
   
  
  
  
  1.3       +13 -2     cocoon-2.0/src/java/org/apache/cocoon/components/language/markup/xsp/java/soap.xsl
  
  Index: soap.xsl
  ===================================================================
  RCS file: /home/cvs/cocoon-2.0/src/java/org/apache/cocoon/components/language/markup/xsp/java/soap.xsl,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- soap.xsl	22 May 2003 21:26:26 -0000	1.2
  +++ soap.xsl	19 Oct 2003 12:42:11 -0000	1.3
  @@ -91,6 +91,14 @@
         </xsl:choose>
       </xsl:variable>
   
  +   <xsl:variable name="authorization">
  +      <xsl:choose>
  +        <xsl:when test="soap:authorization"><xsl:value-of select="soap:authorization"/></xsl:when>
  +        <xsl:when test="@authorization">"<xsl:value-of select="@authorization"/>"</xsl:when>
  +        <xsl:otherwise>""</xsl:otherwise>
  +      </xsl:choose>
  +    </xsl:variable>
  +
       <xsl:variable name="method">
         <xsl:choose>
           <xsl:when test="soap:method"><xsl:value-of select="soap:method"/></xsl:when>
  @@ -133,6 +141,7 @@
                                XSPRequestHelper.getRequestedURL(objectModel),
                                String.valueOf(<xsl:value-of select="$url"/>),
                                <xsl:value-of select="$method"/>,
  +                             <xsl:value-of select="$authorization"/>,
                                <xscript:get scope="request" name="{$tempvar}" as="object"/>).invoke(),
                 <xsl:value-of select="$scope"/>);
             if (getLogger().isDebugEnabled()) {
  @@ -167,6 +176,7 @@
         <SOAP-ENV:Header xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/">
           <xsl:apply-templates select="*[name() != 'soap:url'
                                          and name() != 'soap:method'
  +                                       and name() != 'soap:authorization'             
                         
                                          and name() != 'soap:namespace']"/>
         </SOAP-ENV:Header>
     </xsl:template>
  @@ -183,6 +193,7 @@
       <SOAP-ENV:Body xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/">
         <xsl:apply-templates select="*[name() != 'soap:url'
                                        and name() != 'soap:method'
  +                                     and name() != 'soap:authorization'
                                        and name() != 'soap:namespace']"/>
       </SOAP-ENV:Body>
       <xsp:logic>
  
  
  

Mime
View raw message