  | Mailing List | | Home | | Forum Home | | JBoss - Java Application Server | | Struts - A MVC web framework | | Tomcat - JSP/Servlet container | | iText - An open source PDF Java Library | | JDOM - JDOM XML Parser | | J2EE - A mailing list for Java(tm) 2 Platform, Enterprise Edition | | J2EE Pattern - An interest list for Sun Java Center J2EE Pattern Catalog | | Servlet - A mailing list for discussion about Sun Microsystem's Java Servlet API Technology | | JSP - A mailing list about Java Server Pages specification and reference | |
Struts & Hibernate
|
|
|
  | | | Problem with Web app, javax.print, SecurityManager, and printer discovery | Problem with Web app, javax.print, SecurityManager, and printer discovery 2004-01-08 - By Michael Duffy
Back I'm running a Web app that uses the javax.print API to do discovery on attached printers and passes a java.util.List of names to a JSP to display to clients in an HTML select box . I'm running under Tomcat 4.1.29 on Windows 2000 SP 4 and Sun's JDK 1.4.1_03.
The drop-down list box is empty - no printers were found. I have three attached printers, so I know the list box should not be empty.
I have a Command class that gets all the available printers. The pertinent lines are:
List availablePrinters = new ArrayList();
SecurityManager securityGuard = System.getSecurityManager();
if (securityGuard != null) securityGuard.checkPrintJobAccess(); else System.out.println("No security guard; could not check print job access");
PrintService [] ps = PrintServiceLookup.lookupPrintServices(DocFlavor.INPUT_STREAM.AUTOSENSE, null);
I put some print statements into the code so I could see what was happening. I get this out in the log file:
No security guard; could not check print job accessFound zero available printers
If I take this code and run it in a desktop app I get back three printers and I can print to my default printer without a problem.
I KNOW that I ran this app on Tomcat 4.1.24 and saw printers in the drop-down. I downloaded and tried running the app under the older version of Tomcat, but it, too, shows an empty drop-down.
My notes aren't telling me what I did to allow printer discovery. Can anyone refresh my memory? Thanks - MOD
__ ____ ____ ____ ____ ____ ______ Do you Yahoo!? Yahoo! Hotjobs: Enter the "Signing Bonus" Sweepstakes http://hotjobs.sweepstakes.yahoo.com/signingbonus
-- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ------ To unsubscribe, e-mail: tomcat-user-unsubscribe@(protected) For additional commands, e-mail: tomcat-user-help@(protected)
|
|
 |