cziegeler    02/02/18 06:51:27

  Modified:    src/java/org/apache/cocoon/components/source URLSource.java
  Log:
  Fixed indenting
  
  Revision  Changes    Path
  1.9       +48 -48    
xml-cocoon2/src/java/org/apache/cocoon/components/source/URLSource.java
  
  Index: URLSource.java
  ===================================================================
  RCS file: 
/home/cvs/xml-cocoon2/src/java/org/apache/cocoon/components/source/URLSource.java,v
  retrieving revision 1.8
  retrieving revision 1.9
  diff -u -r1.8 -r1.9
  --- URLSource.java    13 Feb 2002 13:26:33 -0000      1.8
  +++ URLSource.java    18 Feb 2002 14:51:27 -0000      1.9
  @@ -91,7 +91,7 @@
    * Description of a source which is described by an URL.
    *
    * @author <a href="mailto:[EMAIL PROTECTED]";>Carsten Ziegeler</a>
  - * @version CVS $Id: URLSource.java,v 1.8 2002/02/13 13:26:33 cziegeler Exp $
  + * @version CVS $Id: URLSource.java,v 1.9 2002/02/18 14:51:27 cziegeler Exp $
    */
   
   public class URLSource implements ModifiableSource {
  @@ -249,57 +249,57 @@
                       String userInfo = this.getUserInfo();
                       if (this.url.getProtocol().startsWith("http") && userInfo != 
null) {
                           this.connection.setRequestProperty("Authorization","Basic 
"+SourceUtil.encodeBASE64(userInfo));
  -                }
  -                if (this.followRedirects == false && this.connection instanceof 
HttpURLConnection) {
  -                   
((HttpURLConnection)connection).setInstanceFollowRedirects(false);
  -                }
  -                // do a post operation
  -                if (this.connection instanceof HttpURLConnection
  -                    && this.postParameters != null) {
  -                    StringBuffer buffer = new StringBuffer(2000);
  -                    String key;
  -                    Iterator i = postParameters.getParameterNames();
  -                    Iterator values;
  -                    String value;
  -                    boolean first = true;
  -                    while ( i.hasNext() ) {
  -                        key = (String)i.next();
  -                        values = this.postParameters.getParameterValues(key);
  -                        while (values.hasNext() == true) {
  -                            value = SourceUtil.encode((String)values.next());
  -                            if (first == false) buffer.append('&');
  -                            first = false;
  -                            buffer.append(key.toString());
  -                            buffer.append('=');
  -                            buffer.append(value);
  -                        }
                       }
  -                    HttpURLConnection httpCon = (HttpURLConnection)connection;
  -                    httpCon.setDoInput(true);
  -
  -                    if (buffer.length() > 1) { // only post if we have parameters
  -                        String postString = buffer.toString();
  -                        httpCon.setRequestMethod("POST"); // this is POST
  -                        httpCon.setDoOutput(true);
  -                        httpCon.setRequestProperty("Content-type", 
"application/x-www-form-urlencoded");
  -
  -                        // A content-length header must be contained in a POST 
request
  -                        httpCon.setRequestProperty("Content-length", 
Integer.toString(postString.length()));
  -                        java.io.OutputStream out = new 
java.io.BufferedOutputStream(httpCon.getOutputStream());
  -                        out.write(postString.getBytes());
  -                        out.close();
  +                    if (this.followRedirects == false && this.connection instanceof 
HttpURLConnection) {
  +                       
((HttpURLConnection)connection).setInstanceFollowRedirects(false);
                       }
  -                    if ("text/html".equals(httpCon.getContentType()) == true) {
  -                        this.isHTMLContent = true;
  +                    // do a post operation
  +                    if (this.connection instanceof HttpURLConnection
  +                        && this.postParameters != null) {
  +                        StringBuffer buffer = new StringBuffer(2000);
  +                        String key;
  +                        Iterator i = postParameters.getParameterNames();
  +                        Iterator values;
  +                        String value;
  +                        boolean first = true;
  +                        while ( i.hasNext() ) {
  +                            key = (String)i.next();
  +                            values = this.postParameters.getParameterValues(key);
  +                            while (values.hasNext() == true) {
  +                                value = SourceUtil.encode((String)values.next());
  +                                if (first == false) buffer.append('&');
  +                                first = false;
  +                                buffer.append(key.toString());
  +                                buffer.append('=');
  +                                buffer.append(value);
  +                            }
  +                        }
  +                        HttpURLConnection httpCon = (HttpURLConnection)connection;
  +                        httpCon.setDoInput(true);
  +
  +                        if (buffer.length() > 1) { // only post if we have 
parameters
  +                            String postString = buffer.toString();
  +                            httpCon.setRequestMethod("POST"); // this is POST
  +                            httpCon.setDoOutput(true);
  +                            httpCon.setRequestProperty("Content-type", 
"application/x-www-form-urlencoded");
  +
  +                            // A content-length header must be contained in a POST 
request
  +                            httpCon.setRequestProperty("Content-length", 
Integer.toString(postString.length()));
  +                            java.io.OutputStream out = new 
java.io.BufferedOutputStream(httpCon.getOutputStream());
  +                            out.write(postString.getBytes());
  +                            out.close();
  +                        }
  +                        if ("text/html".equals(httpCon.getContentType()) == true) {
  +                            this.isHTMLContent = true;
  +                        }
  +                        input = httpCon.getInputStream();
  +                        this.connection = null; // make sure a new connection is 
created next time
  +                        return input;
                       }
  -                    input = httpCon.getInputStream();
  -                    this.connection = null; // make sure a new connection is 
created next time
  -                    return input;
                   }
  -            }
  -            if ("text/html".equals(this.connection.getContentType()) == true) {
  -                this.isHTMLContent = true;
  -            }
  +                if ("text/html".equals(this.connection.getContentType()) == true) {
  +                    this.isHTMLContent = true;
  +                }
                   input = this.connection.getInputStream();
                   this.connection = null; // make sure a new connection is created 
next time
               }
  
  
  

----------------------------------------------------------------------
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