/lib/docs/org/apache/xmlrpc/util/HttpUtil.html
HTML | 401 lines | 337 code | 42 blank | 22 comment | 0 complexity | 24086d266105390b98a569a6a8c7af5e MD5 | raw file
1<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> 2<!--NewPage--> 3<HTML> 4<HEAD> 5<!-- Generated by javadoc (build 1.6.0_0) on Mon Apr 20 21:45:57 CEST 2009 --> 6<META http-equiv="Content-Type" content="text/html; charset=UTF-8"> 7<TITLE> 8HttpUtil (Apache XML-RPC 3.1.2 API) 9</TITLE> 10 11<META NAME="date" CONTENT="2009-04-20"> 12 13<LINK REL ="stylesheet" TYPE="text/css" HREF="../../../../stylesheet.css" TITLE="Style"> 14 15<SCRIPT type="text/javascript"> 16function windowTitle() 17{ 18 if (location.href.indexOf('is-external=true') == -1) { 19 parent.document.title="HttpUtil (Apache XML-RPC 3.1.2 API)"; 20 } 21} 22</SCRIPT> 23<NOSCRIPT> 24</NOSCRIPT> 25 26</HEAD> 27 28<BODY BGCOLOR="white" onload="windowTitle();"> 29<HR> 30 31 32<!-- ========= START OF TOP NAVBAR ======= --> 33<A NAME="navbar_top"><!-- --></A> 34<A HREF="#skip-navbar_top" title="Skip navigation links"></A> 35<TABLE BORDER="0" WIDTH="100%" CELLPADDING="1" CELLSPACING="0" SUMMARY=""> 36<TR> 37<TD COLSPAN=2 BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> 38<A NAME="navbar_top_firstrow"><!-- --></A> 39<TABLE BORDER="0" CELLPADDING="0" CELLSPACING="3" SUMMARY=""> 40 <TR ALIGN="center" VALIGN="top"> 41 <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../../overview-summary.html"><FONT CLASS="NavBarFont1"><B>Overview</B></FONT></A> </TD> 42 <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="package-summary.html"><FONT CLASS="NavBarFont1"><B>Package</B></FONT></A> </TD> 43 <TD BGCOLOR="#FFFFFF" CLASS="NavBarCell1Rev"> <FONT CLASS="NavBarFont1Rev"><B>Class</B></FONT> </TD> 44 <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="class-use/HttpUtil.html"><FONT CLASS="NavBarFont1"><B>Use</B></FONT></A> </TD> 45 <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="package-tree.html"><FONT CLASS="NavBarFont1"><B>Tree</B></FONT></A> </TD> 46 <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../../deprecated-list.html"><FONT CLASS="NavBarFont1"><B>Deprecated</B></FONT></A> </TD> 47 <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../../index-all.html"><FONT CLASS="NavBarFont1"><B>Index</B></FONT></A> </TD> 48 <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../../help-doc.html"><FONT CLASS="NavBarFont1"><B>Help</B></FONT></A> </TD> 49 </TR> 50</TABLE> 51</TD> 52<TD ALIGN="right" VALIGN="top" ROWSPAN=3><EM> 53</EM> 54</TD> 55</TR> 56 57<TR> 58<TD BGCOLOR="white" CLASS="NavBarCell2"><FONT SIZE="-2"> 59 PREV CLASS 60 <A HREF="../../../../org/apache/xmlrpc/util/LimitedInputStream.html" title="class in org.apache.xmlrpc.util"><B>NEXT CLASS</B></A></FONT></TD> 61<TD BGCOLOR="white" CLASS="NavBarCell2"><FONT SIZE="-2"> 62 <A HREF="../../../../index.html?org/apache/xmlrpc/util/HttpUtil.html" target="_top"><B>FRAMES</B></A> 63 <A HREF="HttpUtil.html" target="_top"><B>NO FRAMES</B></A> 64 <SCRIPT type="text/javascript"> 65 <!-- 66 if(window==top) { 67 document.writeln('<A HREF="../../../../allclasses-noframe.html"><B>All Classes</B></A>'); 68 } 69 //--> 70</SCRIPT> 71<NOSCRIPT> 72 <A HREF="../../../../allclasses-noframe.html"><B>All Classes</B></A> 73</NOSCRIPT> 74 75 76</FONT></TD> 77</TR> 78<TR> 79<TD VALIGN="top" CLASS="NavBarCell3"><FONT SIZE="-2"> 80 SUMMARY: NESTED | FIELD | <A HREF="#constructor_summary">CONSTR</A> | <A HREF="#method_summary">METHOD</A></FONT></TD> 81<TD VALIGN="top" CLASS="NavBarCell3"><FONT SIZE="-2"> 82DETAIL: FIELD | <A HREF="#constructor_detail">CONSTR</A> | <A HREF="#method_detail">METHOD</A></FONT></TD> 83</TR> 84</TABLE> 85<A NAME="skip-navbar_top"></A> 86<!-- ========= END OF TOP NAVBAR ========= --> 87 88<HR> 89<!-- ======== START OF CLASS DATA ======== --> 90<H2> 91<FONT SIZE="-1"> 92org.apache.xmlrpc.util</FONT> 93<BR> 94Class HttpUtil</H2> 95<PRE> 96java.lang.Object 97 <IMG SRC="../../../../resources/inherit.gif" ALT="extended by "><B>org.apache.xmlrpc.util.HttpUtil</B> 98</PRE> 99<HR> 100<DL> 101<DT><PRE>public class <B>HttpUtil</B><DT>extends java.lang.Object</DL> 102</PRE> 103 104<P> 105Provides utility functions useful in HTTP communications 106<P> 107 108<P> 109<HR> 110 111<P> 112 113<!-- ======== CONSTRUCTOR SUMMARY ======== --> 114 115<A NAME="constructor_summary"><!-- --></A> 116<TABLE BORDER="1" WIDTH="100%" CELLPADDING="3" CELLSPACING="0" SUMMARY=""> 117<TR BGCOLOR="#CCCCFF" CLASS="TableHeadingColor"> 118<TH ALIGN="left" COLSPAN="2"><FONT SIZE="+2"> 119<B>Constructor Summary</B></FONT></TH> 120</TR> 121<TR BGCOLOR="white" CLASS="TableRowColor"> 122<TD><CODE><B><A HREF="../../../../org/apache/xmlrpc/util/HttpUtil.html#HttpUtil()">HttpUtil</A></B>()</CODE> 123 124<BR> 125 </TD> 126</TR> 127</TABLE> 128 129<!-- ========== METHOD SUMMARY =========== --> 130 131<A NAME="method_summary"><!-- --></A> 132<TABLE BORDER="1" WIDTH="100%" CELLPADDING="3" CELLSPACING="0" SUMMARY=""> 133<TR BGCOLOR="#CCCCFF" CLASS="TableHeadingColor"> 134<TH ALIGN="left" COLSPAN="2"><FONT SIZE="+2"> 135<B>Method Summary</B></FONT></TH> 136</TR> 137<TR BGCOLOR="white" CLASS="TableRowColor"> 138<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"> 139<CODE>static java.lang.String</CODE></FONT></TD> 140<TD><CODE><B><A HREF="../../../../org/apache/xmlrpc/util/HttpUtil.html#encodeBasicAuthentication(java.lang.String, java.lang.String, java.lang.String)">encodeBasicAuthentication</A></B>(java.lang.String pUser, 141 java.lang.String pPassword, 142 java.lang.String pEncoding)</CODE> 143 144<BR> 145 Creates the Base64 encoded credentials for HTTP Basic Authentication.</TD> 146</TR> 147<TR BGCOLOR="white" CLASS="TableRowColor"> 148<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"> 149<CODE>static java.lang.String</CODE></FONT></TD> 150<TD><CODE><B><A HREF="../../../../org/apache/xmlrpc/util/HttpUtil.html#getNonIdentityTransferEncoding(java.lang.String)">getNonIdentityTransferEncoding</A></B>(java.lang.String pHeaderValue)</CODE> 151 152<BR> 153 Returns, whether the HTTP header value <code>pHeaderValue</code> 154 indicates, that another encoding than "identity" is used.</TD> 155</TR> 156<TR BGCOLOR="white" CLASS="TableRowColor"> 157<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"> 158<CODE>static boolean</CODE></FONT></TD> 159<TD><CODE><B><A HREF="../../../../org/apache/xmlrpc/util/HttpUtil.html#isUsingGzipEncoding(java.util.Enumeration)">isUsingGzipEncoding</A></B>(java.util.Enumeration pValues)</CODE> 160 161<BR> 162 Returns, whether the HTTP header values in <code>pValues</code> 163 indicate, that GZIP encoding is used or may be used.</TD> 164</TR> 165<TR BGCOLOR="white" CLASS="TableRowColor"> 166<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"> 167<CODE>static boolean</CODE></FONT></TD> 168<TD><CODE><B><A HREF="../../../../org/apache/xmlrpc/util/HttpUtil.html#isUsingGzipEncoding(java.lang.String)">isUsingGzipEncoding</A></B>(java.lang.String pHeaderValue)</CODE> 169 170<BR> 171 Returns, whether the HTTP header value <code>pHeaderValue</code> 172 indicates, that GZIP encoding is used or may be used.</TD> 173</TR> 174<TR BGCOLOR="white" CLASS="TableRowColor"> 175<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"> 176<CODE>static void</CODE></FONT></TD> 177<TD><CODE><B><A HREF="../../../../org/apache/xmlrpc/util/HttpUtil.html#parseAuthorization(org.apache.xmlrpc.common.XmlRpcHttpRequestConfigImpl, java.lang.String)">parseAuthorization</A></B>(<A HREF="../../../../org/apache/xmlrpc/common/XmlRpcHttpRequestConfigImpl.html" title="class in org.apache.xmlrpc.common">XmlRpcHttpRequestConfigImpl</A> pConfig, 178 java.lang.String pLine)</CODE> 179 180<BR> 181 Parses an "Authorization" header and adds the username and password 182 to <code>pConfig</code>.</TD> 183</TR> 184<TR BGCOLOR="white" CLASS="TableRowColor"> 185<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"> 186<CODE>static java.lang.String</CODE></FONT></TD> 187<TD><CODE><B><A HREF="../../../../org/apache/xmlrpc/util/HttpUtil.html#readLine(java.io.InputStream, byte[])">readLine</A></B>(java.io.InputStream pIn, 188 byte[] pBuffer)</CODE> 189 190<BR> 191 Reads a header line from the input stream <code>pIn</code> 192 and converts it into a string.</TD> 193</TR> 194</TABLE> 195 <A NAME="methods_inherited_from_class_java.lang.Object"><!-- --></A> 196<TABLE BORDER="1" WIDTH="100%" CELLPADDING="3" CELLSPACING="0" SUMMARY=""> 197<TR BGCOLOR="#EEEEFF" CLASS="TableSubHeadingColor"> 198<TH ALIGN="left"><B>Methods inherited from class java.lang.Object</B></TH> 199</TR> 200<TR BGCOLOR="white" CLASS="TableRowColor"> 201<TD><CODE>clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait</CODE></TD> 202</TR> 203</TABLE> 204 205<P> 206 207<!-- ========= CONSTRUCTOR DETAIL ======== --> 208 209<A NAME="constructor_detail"><!-- --></A> 210<TABLE BORDER="1" WIDTH="100%" CELLPADDING="3" CELLSPACING="0" SUMMARY=""> 211<TR BGCOLOR="#CCCCFF" CLASS="TableHeadingColor"> 212<TH ALIGN="left" COLSPAN="1"><FONT SIZE="+2"> 213<B>Constructor Detail</B></FONT></TH> 214</TR> 215</TABLE> 216 217<A NAME="HttpUtil()"><!-- --></A><H3> 218HttpUtil</H3> 219<PRE> 220public <B>HttpUtil</B>()</PRE> 221<DL> 222</DL> 223 224<!-- ============ METHOD DETAIL ========== --> 225 226<A NAME="method_detail"><!-- --></A> 227<TABLE BORDER="1" WIDTH="100%" CELLPADDING="3" CELLSPACING="0" SUMMARY=""> 228<TR BGCOLOR="#CCCCFF" CLASS="TableHeadingColor"> 229<TH ALIGN="left" COLSPAN="1"><FONT SIZE="+2"> 230<B>Method Detail</B></FONT></TH> 231</TR> 232</TABLE> 233 234<A NAME="encodeBasicAuthentication(java.lang.String, java.lang.String, java.lang.String)"><!-- --></A><H3> 235encodeBasicAuthentication</H3> 236<PRE> 237public static java.lang.String <B>encodeBasicAuthentication</B>(java.lang.String pUser, 238 java.lang.String pPassword, 239 java.lang.String pEncoding) 240 throws java.io.UnsupportedEncodingException</PRE> 241<DL> 242<DD>Creates the Base64 encoded credentials for HTTP Basic Authentication. 243<P> 244<DD><DL> 245<DT><B>Parameters:</B><DD><CODE>pUser</CODE> - User name, or null, if no Basic Authentication is being used.<DD><CODE>pPassword</CODE> - Users password, or null, if no Basic Authentication is being used.<DD><CODE>pEncoding</CODE> - Encoding being used for conversion of the credential string into a byte array. 246<DT><B>Returns:</B><DD>Base64 encoded credentials, for use in the HTTP header 247<DT><B>Throws:</B> 248<DD><CODE>java.io.UnsupportedEncodingException</CODE> - The encoding <code>pEncoding</code> is invalid.</DL> 249</DD> 250</DL> 251<HR> 252 253<A NAME="isUsingGzipEncoding(java.lang.String)"><!-- --></A><H3> 254isUsingGzipEncoding</H3> 255<PRE> 256public static boolean <B>isUsingGzipEncoding</B>(java.lang.String pHeaderValue)</PRE> 257<DL> 258<DD>Returns, whether the HTTP header value <code>pHeaderValue</code> 259 indicates, that GZIP encoding is used or may be used. 260<P> 261<DD><DL> 262<DT><B>Parameters:</B><DD><CODE>pHeaderValue</CODE> - The HTTP header value being parsed. This is typically 263 the value of "Content-Encoding", or "Accept-Encoding". 264<DT><B>Returns:</B><DD>True, if the header value suggests that GZIP encoding is or may 265 be used.</DL> 266</DD> 267</DL> 268<HR> 269 270<A NAME="getNonIdentityTransferEncoding(java.lang.String)"><!-- --></A><H3> 271getNonIdentityTransferEncoding</H3> 272<PRE> 273public static java.lang.String <B>getNonIdentityTransferEncoding</B>(java.lang.String pHeaderValue)</PRE> 274<DL> 275<DD>Returns, whether the HTTP header value <code>pHeaderValue</code> 276 indicates, that another encoding than "identity" is used. 277 This is typically the value of "Transfer-Encoding", or "TE". 278<P> 279<DD><DL> 280 281<DT><B>Returns:</B><DD>Null, if the transfer encoding in use is "identity". 282 Otherwise, another transfer encoding.</DL> 283</DD> 284</DL> 285<HR> 286 287<A NAME="isUsingGzipEncoding(java.util.Enumeration)"><!-- --></A><H3> 288isUsingGzipEncoding</H3> 289<PRE> 290public static boolean <B>isUsingGzipEncoding</B>(java.util.Enumeration pValues)</PRE> 291<DL> 292<DD>Returns, whether the HTTP header values in <code>pValues</code> 293 indicate, that GZIP encoding is used or may be used. 294<P> 295<DD><DL> 296<DT><B>Parameters:</B><DD><CODE>pValues</CODE> - The HTTP header values being parsed. These are typically 297 the values of "Content-Encoding", or "Accept-Encoding". 298<DT><B>Returns:</B><DD>True, if the header values suggests that GZIP encoding is or may 299 be used.</DL> 300</DD> 301</DL> 302<HR> 303 304<A NAME="readLine(java.io.InputStream, byte[])"><!-- --></A><H3> 305readLine</H3> 306<PRE> 307public static java.lang.String <B>readLine</B>(java.io.InputStream pIn, 308 byte[] pBuffer) 309 throws java.io.IOException</PRE> 310<DL> 311<DD>Reads a header line from the input stream <code>pIn</code> 312 and converts it into a string. 313<P> 314<DD><DL> 315<DT><B>Parameters:</B><DD><CODE>pIn</CODE> - The input stream being read.<DD><CODE>pBuffer</CODE> - A buffer being used for temporary storage. 316 The buffers length is a limit of the header lines length. 317<DT><B>Returns:</B><DD>Next header line or null, if no more header lines 318 are available. 319<DT><B>Throws:</B> 320<DD><CODE>java.io.IOException</CODE> - Reading the header line failed.</DL> 321</DD> 322</DL> 323<HR> 324 325<A NAME="parseAuthorization(org.apache.xmlrpc.common.XmlRpcHttpRequestConfigImpl, java.lang.String)"><!-- --></A><H3> 326parseAuthorization</H3> 327<PRE> 328public static void <B>parseAuthorization</B>(<A HREF="../../../../org/apache/xmlrpc/common/XmlRpcHttpRequestConfigImpl.html" title="class in org.apache.xmlrpc.common">XmlRpcHttpRequestConfigImpl</A> pConfig, 329 java.lang.String pLine)</PRE> 330<DL> 331<DD>Parses an "Authorization" header and adds the username and password 332 to <code>pConfig</code>. 333<P> 334<DD><DL> 335<DT><B>Parameters:</B><DD><CODE>pConfig</CODE> - The request configuration being created.<DD><CODE>pLine</CODE> - The header being parsed, including the "basic" part.</DL> 336</DD> 337</DL> 338<!-- ========= END OF CLASS DATA ========= --> 339<HR> 340 341 342<!-- ======= START OF BOTTOM NAVBAR ====== --> 343<A NAME="navbar_bottom"><!-- --></A> 344<A HREF="#skip-navbar_bottom" title="Skip navigation links"></A> 345<TABLE BORDER="0" WIDTH="100%" CELLPADDING="1" CELLSPACING="0" SUMMARY=""> 346<TR> 347<TD COLSPAN=2 BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> 348<A NAME="navbar_bottom_firstrow"><!-- --></A> 349<TABLE BORDER="0" CELLPADDING="0" CELLSPACING="3" SUMMARY=""> 350 <TR ALIGN="center" VALIGN="top"> 351 <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../../overview-summary.html"><FONT CLASS="NavBarFont1"><B>Overview</B></FONT></A> </TD> 352 <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="package-summary.html"><FONT CLASS="NavBarFont1"><B>Package</B></FONT></A> </TD> 353 <TD BGCOLOR="#FFFFFF" CLASS="NavBarCell1Rev"> <FONT CLASS="NavBarFont1Rev"><B>Class</B></FONT> </TD> 354 <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="class-use/HttpUtil.html"><FONT CLASS="NavBarFont1"><B>Use</B></FONT></A> </TD> 355 <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="package-tree.html"><FONT CLASS="NavBarFont1"><B>Tree</B></FONT></A> </TD> 356 <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../../deprecated-list.html"><FONT CLASS="NavBarFont1"><B>Deprecated</B></FONT></A> </TD> 357 <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../../index-all.html"><FONT CLASS="NavBarFont1"><B>Index</B></FONT></A> </TD> 358 <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../../help-doc.html"><FONT CLASS="NavBarFont1"><B>Help</B></FONT></A> </TD> 359 </TR> 360</TABLE> 361</TD> 362<TD ALIGN="right" VALIGN="top" ROWSPAN=3><EM> 363</EM> 364</TD> 365</TR> 366 367<TR> 368<TD BGCOLOR="white" CLASS="NavBarCell2"><FONT SIZE="-2"> 369 PREV CLASS 370 <A HREF="../../../../org/apache/xmlrpc/util/LimitedInputStream.html" title="class in org.apache.xmlrpc.util"><B>NEXT CLASS</B></A></FONT></TD> 371<TD BGCOLOR="white" CLASS="NavBarCell2"><FONT SIZE="-2"> 372 <A HREF="../../../../index.html?org/apache/xmlrpc/util/HttpUtil.html" target="_top"><B>FRAMES</B></A> 373 <A HREF="HttpUtil.html" target="_top"><B>NO FRAMES</B></A> 374 <SCRIPT type="text/javascript"> 375 <!-- 376 if(window==top) { 377 document.writeln('<A HREF="../../../../allclasses-noframe.html"><B>All Classes</B></A>'); 378 } 379 //--> 380</SCRIPT> 381<NOSCRIPT> 382 <A HREF="../../../../allclasses-noframe.html"><B>All Classes</B></A> 383</NOSCRIPT> 384 385 386</FONT></TD> 387</TR> 388<TR> 389<TD VALIGN="top" CLASS="NavBarCell3"><FONT SIZE="-2"> 390 SUMMARY: NESTED | FIELD | <A HREF="#constructor_summary">CONSTR</A> | <A HREF="#method_summary">METHOD</A></FONT></TD> 391<TD VALIGN="top" CLASS="NavBarCell3"><FONT SIZE="-2"> 392DETAIL: FIELD | <A HREF="#constructor_detail">CONSTR</A> | <A HREF="#method_detail">METHOD</A></FONT></TD> 393</TR> 394</TABLE> 395<A NAME="skip-navbar_bottom"></A> 396<!-- ======== END OF BOTTOM NAVBAR ======= --> 397 398<HR> 399Copyright © 2001-2009 <a href="http://www.apache.org/">The Apache Software Foundation</a>. All Rights Reserved. 400</BODY> 401</HTML>