morgand     2003/01/25 20:04:36

  Modified:    jelly/jelly-tags/http/src/java/org/apache/commons/jelly/tags/http
                        BodyTag.java HeaderTag.java HttpTagSupport.java
                        ParameterTag.java SessionTag.java
  Log:
  converted http taglib from Exception to JellyTagException
  
  Revision  Changes    Path
  1.4       +12 -2     
jakarta-commons-sandbox/jelly/jelly-tags/http/src/java/org/apache/commons/jelly/tags/http/BodyTag.java
  
  Index: BodyTag.java
  ===================================================================
  RCS file: 
/home/cvs/jakarta-commons-sandbox/jelly/jelly-tags/http/src/java/org/apache/commons/jelly/tags/http/BodyTag.java,v
  retrieving revision 1.3
  retrieving revision 1.4
  diff -u -r1.3 -r1.4
  --- BodyTag.java      4 Jan 2003 14:17:13 -0000       1.3
  +++ BodyTag.java      26 Jan 2003 04:04:36 -0000      1.4
  @@ -61,9 +61,12 @@
   
   package org.apache.commons.jelly.tags.http;
   
  +import java.net.MalformedURLException;
  +
   import org.apache.commons.httpclient.HttpMethod;
   import org.apache.commons.httpclient.methods.PostMethod;
   import org.apache.commons.httpclient.methods.PutMethod;
  +import org.apache.commons.jelly.JellyTagException;
   import org.apache.commons.jelly.TagSupport;
   import org.apache.commons.jelly.XMLOutput;
   
  @@ -87,10 +90,17 @@
        * @param xmlOutput for writing output to
        * @throws Exception when any error occurs
        */
  -    public void doTag(XMLOutput xmlOutput) throws Exception {
  +    public void doTag(XMLOutput xmlOutput) throws JellyTagException {
           HttpTagSupport httpTag = (HttpTagSupport) findAncestorWithClass(
               HttpTagSupport.class);
  -        HttpMethod httpMethod = httpTag.getHttpMethod();
  +        
  +        HttpMethod httpMethod = null;
  +        try {
  +            httpMethod = httpTag.getHttpMethod();
  +        } catch (MalformedURLException e) {
  +            throw new JellyTagException(e);
  +        }
  +        
           String bodyText = getBodyText();
           if (httpMethod instanceof PostMethod) {
               PostMethod postMethod = (PostMethod) httpMethod;
  
  
  
  1.4       +4 -1      
jakarta-commons-sandbox/jelly/jelly-tags/http/src/java/org/apache/commons/jelly/tags/http/HeaderTag.java
  
  Index: HeaderTag.java
  ===================================================================
  RCS file: 
/home/cvs/jakarta-commons-sandbox/jelly/jelly-tags/http/src/java/org/apache/commons/jelly/tags/http/HeaderTag.java,v
  retrieving revision 1.3
  retrieving revision 1.4
  diff -u -r1.3 -r1.4
  --- HeaderTag.java    23 Oct 2002 16:35:35 -0000      1.3
  +++ HeaderTag.java    26 Jan 2003 04:04:36 -0000      1.4
  @@ -61,6 +61,9 @@
   
   package org.apache.commons.jelly.tags.http;
   
  +import java.net.MalformedURLException;
  +
  +import org.apache.commons.jelly.JellyTagException;
   import org.apache.commons.jelly.TagSupport;
   import org.apache.commons.jelly.XMLOutput;
   
  @@ -86,7 +89,7 @@
        * @param xmlOutput where to send output
        * @throws Exception when an error occurs
        */
  -    public void doTag(XMLOutput xmlOutput) throws Exception {
  +    public void doTag(XMLOutput xmlOutput) throws JellyTagException {
           HttpTagSupport http = (HttpTagSupport) findAncestorWithClass(
               HttpTagSupport.class);
           http.addRequestHeader(getName(), getValue());
  
  
  
  1.4       +17 -4     
jakarta-commons-sandbox/jelly/jelly-tags/http/src/java/org/apache/commons/jelly/tags/http/HttpTagSupport.java
  
  Index: HttpTagSupport.java
  ===================================================================
  RCS file: 
/home/cvs/jakarta-commons-sandbox/jelly/jelly-tags/http/src/java/org/apache/commons/jelly/tags/http/HttpTagSupport.java,v
  retrieving revision 1.3
  retrieving revision 1.4
  diff -u -r1.3 -r1.4
  --- HttpTagSupport.java       4 Jan 2003 14:17:13 -0000       1.3
  +++ HttpTagSupport.java       26 Jan 2003 04:04:36 -0000      1.4
  @@ -61,6 +61,7 @@
   
   package org.apache.commons.jelly.tags.http;
   
  +import java.io.IOException;
   import java.net.MalformedURLException;
   import java.util.ArrayList;
   import java.util.List;
  @@ -68,6 +69,7 @@
   import org.apache.commons.httpclient.HttpClient;
   import org.apache.commons.httpclient.HttpMethod;
   import org.apache.commons.httpclient.NameValuePair;
  +import org.apache.commons.jelly.JellyTagException;
   import org.apache.commons.jelly.TagSupport;
   import org.apache.commons.jelly.XMLOutput;
   
  @@ -150,14 +152,25 @@
        * @param xmlOutput where to send output
        * @throws Exception when an error occurs
        */
  -    public void doTag(XMLOutput xmlOutput) throws Exception {
  +    public void doTag(XMLOutput xmlOutput) throws JellyTagException {
           // allow nested tags first, e.g body
           invokeBody(xmlOutput);
  -        HttpMethod urlMethod = getConfiguredHttpMethod();
  +
           // track request execution
  -        long start = System.currentTimeMillis();
  -        getHttpClient().executeMethod(urlMethod);
  +        long start = System.currentTimeMillis();        
  +        HttpMethod urlMethod = null;
  +        try {
  +            urlMethod = getConfiguredHttpMethod();
  +            getHttpClient().executeMethod(urlMethod);
  +        } 
  +        catch (MalformedURLException e) {
  +            throw new JellyTagException(e);
  +        }
  +        catch (IOException e) {
  +            throw new JellyTagException(e);
  +        }
           long end = System.currentTimeMillis();
  +        
           // set variable to value
           if (getVar() != null) {
               getContext().setVariable(getVar(), urlMethod);
  
  
  
  1.3       +2 -1      
jakarta-commons-sandbox/jelly/jelly-tags/http/src/java/org/apache/commons/jelly/tags/http/ParameterTag.java
  
  Index: ParameterTag.java
  ===================================================================
  RCS file: 
/home/cvs/jakarta-commons-sandbox/jelly/jelly-tags/http/src/java/org/apache/commons/jelly/tags/http/ParameterTag.java,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- ParameterTag.java 23 Oct 2002 16:35:35 -0000      1.2
  +++ ParameterTag.java 26 Jan 2003 04:04:36 -0000      1.3
  @@ -61,6 +61,7 @@
   
   package org.apache.commons.jelly.tags.http;
   
  +import org.apache.commons.jelly.JellyTagException;
   import org.apache.commons.jelly.TagSupport;
   import org.apache.commons.jelly.XMLOutput;
   
  @@ -86,7 +87,7 @@
        * @param xmlOutput where to send output
        * @throws Exception when an error occurs
        */
  -    public void doTag(XMLOutput xmlOutput) throws Exception {
  +    public void doTag(XMLOutput xmlOutput) throws JellyTagException {
           HttpTagSupport http = (HttpTagSupport) findAncestorWithClass(
               HttpTagSupport.class);
           http.addParameter(getName(), getValue());
  
  
  
  1.4       +2 -1      
jakarta-commons-sandbox/jelly/jelly-tags/http/src/java/org/apache/commons/jelly/tags/http/SessionTag.java
  
  Index: SessionTag.java
  ===================================================================
  RCS file: 
/home/cvs/jakarta-commons-sandbox/jelly/jelly-tags/http/src/java/org/apache/commons/jelly/tags/http/SessionTag.java,v
  retrieving revision 1.3
  retrieving revision 1.4
  diff -u -r1.3 -r1.4
  --- SessionTag.java   4 Jan 2003 14:17:13 -0000       1.3
  +++ SessionTag.java   26 Jan 2003 04:04:36 -0000      1.4
  @@ -62,6 +62,7 @@
   package org.apache.commons.jelly.tags.http;
   
   import org.apache.commons.httpclient.HttpClient;
  +import org.apache.commons.jelly.JellyTagException;
   import org.apache.commons.jelly.TagSupport;
   import org.apache.commons.jelly.XMLOutput;
   
  @@ -100,7 +101,7 @@
        * @param xmlOutput to write output
        * @throws Exception when any error occurs
        */
  -    public void doTag(XMLOutput xmlOutput) throws Exception {
  +    public void doTag(XMLOutput xmlOutput) throws JellyTagException {
           if (isProxyAvailable()) {
               _httpClient = new HttpClient();
               _httpClient.getHostConfiguration().setProxy(getProxyHost(), 
getProxyPort());
  
  
  

--
To unsubscribe, e-mail:   <mailto:[EMAIL PROTECTED]>
For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>

Reply via email to