< prev index next >

test/java/net/URLConnection/HandleContentTypeWithAttrs.java

Print this page

        

*** 30,53 **** */ import java.net.*; import java.io.*; import sun.net.www.content.text.*; import sun.net.www.MessageHeader; public class HandleContentTypeWithAttrs { URL url; public HandleContentTypeWithAttrs (int port) throws Exception { - String localHostName = InetAddress.getLocalHost().getHostName(); - // Request echo.html from myHttpServer. // In the header of the response, we make // the content type have some attributes. ! url = new URL("http://" + localHostName + ":" + port + "/echo.html"); ! URLConnection urlConn = url.openConnection(); // the method getContent() calls the method // getContentHandler(). With the fix, the method // getContentHandler() gets the correct content // handler for our response - it should be the --- 30,52 ---- */ import java.net.*; import java.io.*; import sun.net.www.content.text.*; import sun.net.www.MessageHeader; + import static java.net.Proxy.NO_PROXY; public class HandleContentTypeWithAttrs { URL url; public HandleContentTypeWithAttrs (int port) throws Exception { // Request echo.html from myHttpServer. // In the header of the response, we make // the content type have some attributes. ! url = new URL("http://localhost:" + port + "/echo.html"); ! URLConnection urlConn = url.openConnection(NO_PROXY); // the method getContent() calls the method // getContentHandler(). With the fix, the method // getContentHandler() gets the correct content // handler for our response - it should be the
< prev index next >