You are viewing a plain text version of this content. The canonical link for it is here.
Posted to soap-dev@xml.apache.org by km...@locus.apache.org on 2000/09/18 17:12:11 UTC

cvs commit: xml-soap/java/src/org/apache/soap/util/net HTTPUtils.java

kmitchell    00/09/18 08:12:11

  Modified:    java/src/org/apache/soap/messaging Message.java
               java/src/org/apache/soap/rpc Call.java
               java/src/org/apache/soap/server SMTP2HTTPBridge.java
               java/src/org/apache/soap/util/net HTTPUtils.java
  Log:
  Timeout implementation
  
  Revision  Changes    Path
  1.4       +10 -1     xml-soap/java/src/org/apache/soap/messaging/Message.java
  
  Index: Message.java
  ===================================================================
  RCS file: /home/cvs/xml-soap/java/src/org/apache/soap/messaging/Message.java,v
  retrieving revision 1.3
  retrieving revision 1.4
  diff -u -r1.3 -r1.4
  --- Message.java	2000/09/05 14:08:07	1.3
  +++ Message.java	2000/09/18 15:12:05	1.4
  @@ -80,6 +80,7 @@
    */
   public class Message {
     SOAPTransport st;
  +  private int timeout = 0;
   
     public Message () {
     }
  @@ -92,6 +93,14 @@
       return st;
     }
   
  +    public void setTimeout(int _timeout) {
  +	timeout = _timeout;
  +    }
  +
  +    public int getTimeout() {
  +	return timeout;
  +    }
  +
     /**
      * Send an envelope to the given URL via the SOAPTransport that has
      * been configured for this instance (or SOAPHTTPConnection by default).
  @@ -108,7 +117,7 @@
       if (st == null) {
         st = new SOAPHTTPConnection ();
       }
  -    st.send (url, actionURI, null, env, null);
  +    st.send (url, actionURI, null, env, null, timeout);
     }
   
     /**
  
  
  
  1.3       +8 -2      xml-soap/java/src/org/apache/soap/rpc/Call.java
  
  Index: Call.java
  ===================================================================
  RCS file: /home/cvs/xml-soap/java/src/org/apache/soap/rpc/Call.java,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- Call.java	2000/05/30 10:24:00	1.2
  +++ Call.java	2000/09/18 15:12:06	1.3
  @@ -83,7 +83,7 @@
     private XMLParserLiaison    xpl = new XercesParserLiaison();
     private SOAPMappingRegistry smr = new SOAPMappingRegistry();
     private SOAPTransport       st  = new SOAPHTTPConnection();
  -
  +  private int timeout = 0;
     public Call()
     {
       this(null, null, null, null, null);
  @@ -115,6 +115,12 @@
       return st;
     }
   
  +  public void setTimeout(int _timeout) {
  +      timeout = _timeout;
  +  }
  +    
  +    public int getTimeout() {return timeout;}
  +
     public Envelope buildEnvelope()
     {
       return super.buildEnvelope(false);
  @@ -142,7 +148,7 @@
         Envelope callEnv = buildEnvelope();
   
         // Post the call envelope.
  -      st.send(url, SOAPActionURI, null, callEnv, smr);
  +      st.send(url, SOAPActionURI, null, callEnv, smr, timeout);
   
         // Get the input stream to read the response envelope from.
         BufferedReader in = st.receive();
  
  
  
  1.4       +1 -1      xml-soap/java/src/org/apache/soap/server/SMTP2HTTPBridge.java
  
  Index: SMTP2HTTPBridge.java
  ===================================================================
  RCS file: /home/cvs/xml-soap/java/src/org/apache/soap/server/SMTP2HTTPBridge.java,v
  retrieving revision 1.3
  retrieving revision 1.4
  diff -u -r1.3 -r1.4
  --- SMTP2HTTPBridge.java	2000/09/01 03:52:53	1.3
  +++ SMTP2HTTPBridge.java	2000/09/18 15:12:08	1.4
  @@ -177,7 +177,7 @@
       headers.put (Constants.HEADER_SOAP_ACTION, actionURI);
       org.apache.soap.util.net.HTTPUtils$Response httpResponse = 
         HTTPUtils.post (httpURL, headers, Constants.HEADERVAL_CONTENT_TYPE,
  -          new String (ba));
  +          new String (ba), 0);
       System.err.println ("HTTP RESPONSE IS: ");
       int contentLength = httpResponse.contentLength;
       String payload = null;
  
  
  
  1.6       +2 -2      xml-soap/java/src/org/apache/soap/util/net/HTTPUtils.java
  
  Index: HTTPUtils.java
  ===================================================================
  RCS file: /home/cvs/xml-soap/java/src/org/apache/soap/util/net/HTTPUtils.java,v
  retrieving revision 1.5
  retrieving revision 1.6
  diff -u -r1.5 -r1.6
  --- HTTPUtils.java	2000/09/01 03:53:05	1.5
  +++ HTTPUtils.java	2000/09/18 15:12:09	1.6
  @@ -108,7 +108,7 @@
      * @param content the body of the post
      */
     public static Response post (URL url, Hashtable headers,
  -                               String contentType, String content)
  +                               String contentType, String content, int timeout)
                  throws IllegalArgumentException {
       PrintWriter out = null;
       BufferedReader in = null;
  @@ -119,7 +119,7 @@
           port = HTTP_DEFAULT_PORT;
   
         Socket s = new Socket (url.getHost (), port);
  -
  +      s.setSoTimeout(timeout);
         out = new PrintWriter (s.getOutputStream ());
         in = new BufferedReader (new InputStreamReader (s.getInputStream ()));
       } catch (Exception e) {