Project

General

Profile

1
Index: build.xml
2
===================================================================
3
RCS file: /cvs/utilities/build.xml,v
4
retrieving revision 1.8
5
diff -w -r1.8 build.xml
6
66a67,68
7
>       <property name="jglobusjar"  value="${libdir}/cog-jglobus.jar" />
8
>       <property name="jgssjar"  value="${libdir}/jgss.jar" />
9
69c71
10
<                 value="${xercesjar}:${log4jjar}:${httpjar}" />
11
---
12
>                 value="${xercesjar}:${log4jjar}:${httpjar}:${jglobusjar}:${jgssjar}:${xalanjar}" />
13
97a100
14
>              source="1.4" target="1.4"
15
164a168
16
>              source="1.4" target="1.4"
17
Index: src/java/edu/ucsb/nceas/utilities/HttpMessage.java
18
===================================================================
19
RCS file: /cvs/utilities/src/java/edu/ucsb/nceas/utilities/HttpMessage.java,v
20
retrieving revision 1.3
21
diff -w -r1.3 HttpMessage.java
22
27,30d26
23
< import java.io.*;
24
< import java.net.*;
25
< import java.util.*;
26
< 
27
32a29,36
28
> import java.io.*;
29
> import java.net.HttpURLConnection;
30
> import java.net.URL;
31
> import java.net.URLConnection;
32
> import java.net.URLEncoder;
33
> import java.util.Enumeration;
34
> import java.util.Properties;
35
> 
36
35,39c39,42
37
<   private URL servlet = null;
38
<   private String argString = null;
39
<   private static String cookie = null;
40
<   private OutputStream out = null;
41
<   private URLConnection con = null;
42
---
43
>   protected URL servlet = null;
44
>   protected String cookie = null;
45
>   protected OutputStream out = null;
46
>   protected URLConnection con = null;
47
61c64
48
<     argString = "";//default
49
---
50
>     String argString = "";
51
79c82
52
<   private void openPostConnection() throws IOException
53
---
54
>   protected void openPostConnection() throws IOException
55
153c156
56
<       ((HttpURLConnection)con).setRequestProperty("Content-Type", ctype);
57
---
58
>       con.setRequestProperty("Content-Type", ctype);
59
155,156c158
60
<       ((HttpURLConnection)con).setRequestProperty("Content-Length",
61
<                new Long(contentLength).toString());
62
---
63
>       con.setRequestProperty("Content-Length", Long.toString(contentLength));
64
159c161
65
<       out = con.getOutputStream();
66
---
67
>       out = getConOutputStream();
68
214c216
69
<     ((HttpURLConnection)con).setRequestProperty("Content-Type", ctype);
70
---
71
>     con.setRequestProperty("Content-Type", ctype);
72
216,217c218
73
<     ((HttpURLConnection)con).setRequestProperty("Content-Length",
74
<              new Long(contentLength).toString());
75
---
76
>     con.setRequestProperty("Content-Length", Long.toString(contentLength));
77
220c221
78
<     out = con.getOutputStream();
79
---
80
>     out = getConOutputStream();
81
227a229,256
82
> 	/** If true, ignore all flush() calls during POST connections
83
> 	 *  (that is, during <tt>sendPostData</tt> calls) until the connection is
84
> 	 *  closed.  Useful because flush() calls on a GSS SSL stream close the
85
> 	 *  stream. */
86
> 	protected boolean ignoreOutputStreamFlushes = false;
87
> 
88
> 	/** If <tt>ignoreOutputStreamFlushes</tt> is true, wrap <tt>o</tt> in a
89
> 	 *  stream that simply ignores all flush()es until it is closed.
90
> 	 *  No effect if <tt>ignoreOutputStreamFlushes</tt> is false. */
91
> 	private OutputStream wrapFlushes(OutputStream o) {
92
> 		if (!ignoreOutputStreamFlushes) return o;
93
> 		else return new FilterOutputStream(o) {
94
> 			public void flush() {} // ignore flushes
95
> 			public void close() throws IOException {
96
> 				//noinspection EmptyCatchBlock
97
> 				try { super.flush(); } // but make sure they happen on close
98
> 				catch (IOException ignored) {}
99
> 				super.close();
100
> 			}
101
> 		};
102
> 	}
103
> 
104
> 	/** Call this rather than calling con.getOutputStream() directly,
105
> 	 *  to properly wrap a GSI SSL output stream. */
106
> 	protected OutputStream getConOutputStream() throws IOException {
107
> 		return wrapFlushes(con.getOutputStream());
108
> 	}
109
> 
110
240c269
111
<     out = new DataOutputStream(con.getOutputStream());
112
---
113
>     out = new DataOutputStream(getConOutputStream());
114
272c301
115
<   private InputStream closePostConnection() throws IOException
116
---
117
>   protected InputStream closePostConnection() throws IOException
118
297c326
119
<     return sendPostMessage(null);
120
---
121
>     return sendPostData(null);
122
319c348
123
<   private String toEncodedString(Properties args)
124
---
125
>   protected static String toEncodedString(Properties args)
126
327c356,357
127
<         buf.append(URLEncoder.encode(name) + "=" + URLEncoder.encode(value));
128
---
129
> 		buf.append(URLEncoder.encode(name)).append("=")
130
> 		   .append(URLEncoder.encode(value));
131
337c367
132
<   public static String getCookie()
133
---
134
>   public String getCookie()
135
345c375
136
<   public static void setCookie(String newCookie)
137
---
138
>   public void setCookie(String newCookie)
(4-4/5)