< prev index next >

src/java.desktop/unix/classes/sun/print/IPPPrintService.java

Print this page




1667 
1668 
1669     public boolean usesClass(Class<?> c) {
1670         return (c == sun.print.PSPrinterJob.class);
1671     }
1672 
1673 
1674     public static HttpURLConnection getIPPConnection(URL url) {
1675         HttpURLConnection connection;
1676         URLConnection urlc;
1677         try {
1678             urlc = url.openConnection();
1679         } catch (java.io.IOException ioe) {
1680             return null;
1681         }
1682         if (!(urlc instanceof HttpURLConnection)) {
1683             return null;
1684         }
1685         connection = (HttpURLConnection)urlc;
1686         connection.setUseCaches(false);
1687         connection.setDefaultUseCaches(false);
1688         connection.setDoInput(true);
1689         connection.setDoOutput(true);
1690         connection.setRequestProperty("Content-type", "application/ipp");
1691         return connection;
1692     }
1693 
1694 
1695     public synchronized boolean isPostscript() {
1696         if (isPS == null) {
1697            isPS = Boolean.TRUE;
1698             if (isCupsPrinter) {
1699                 try {
1700                     urlConnection = getIPPConnection(
1701                                              new URL(myURL+".ppd"));
1702 
1703                    InputStream is = urlConnection.getInputStream();
1704                    if (is != null) {
1705                        BufferedReader d =
1706                            new BufferedReader(new InputStreamReader(is,
1707                                                           Charset.forName("ISO-8859-1")));




1667 
1668 
1669     public boolean usesClass(Class<?> c) {
1670         return (c == sun.print.PSPrinterJob.class);
1671     }
1672 
1673 
1674     public static HttpURLConnection getIPPConnection(URL url) {
1675         HttpURLConnection connection;
1676         URLConnection urlc;
1677         try {
1678             urlc = url.openConnection();
1679         } catch (java.io.IOException ioe) {
1680             return null;
1681         }
1682         if (!(urlc instanceof HttpURLConnection)) {
1683             return null;
1684         }
1685         connection = (HttpURLConnection)urlc;
1686         connection.setUseCaches(false);        

1687         connection.setDoInput(true);
1688         connection.setDoOutput(true);
1689         connection.setRequestProperty("Content-type", "application/ipp");
1690         return connection;
1691     }
1692 
1693 
1694     public synchronized boolean isPostscript() {
1695         if (isPS == null) {
1696            isPS = Boolean.TRUE;
1697             if (isCupsPrinter) {
1698                 try {
1699                     urlConnection = getIPPConnection(
1700                                              new URL(myURL+".ppd"));
1701 
1702                    InputStream is = urlConnection.getInputStream();
1703                    if (is != null) {
1704                        BufferedReader d =
1705                            new BufferedReader(new InputStreamReader(is,
1706                                                           Charset.forName("ISO-8859-1")));


< prev index next >