How to print ServerVariables with Java/JavaScript

I am working on a problem with a one of our web pages and need to review the request string coming in. I know that in ASP you can do something like the following to print out the HTTP headers sent by the client:
Request.ServerVariables(�ALL_HTTP�)
Is there something similar to this that I can do in Java?
Thank you!

What the ASP page is doing is getting the HTTP headers. Here is the equivalent java code
response.setContentType("text/html");
java.io.PrintWriter out = response.getWriter();
Enumeration headers = request.getHeaderNames();
String headerName;
String headerValue;
while (headers.hasMoreElements()) {
headerName = (String)headers.nextElement();
headerValue = request.getHeader(headerName);
out.print(headerName);
out.print(headerValue);}
Venkat

Similar Messages

  • How to Print reports with Java Application

    I'm developing a database application in java using rmi and swings. Now I want to take some printout of reports from that application. Is any report designer available for java applications. How can i solve this problem. Please help me.

    Hi
    I don't know i f exist a tool like you want, but, in Java
    the print job is implemented by a class implementing the Printable interface.
    A class "Printable" must implement the print method like is defined at scpec. This method, via the params, can do print by "drawing" the page and, finally, return an integer
    indicate if the print loop must continue or not.
    The drawing op over the printer Graphics context is realized by methos of Graphics object (if you want "print"
    some text you can do g.drawString("some text",x,y) and so on).
    See the tutorials for more info
    Hope this help

  • How to print Text with Java

    I am new to java, learning fast, lots of new stuff every day. i want to develop an application that can print a report (Text mostly eg. Like an Invoice) to a printer. i am searching the net still cant find nothing that i can understand. Help please

    To learn java printing, you may want to visit:
    http://java.sun.com/j2se/1.4.2/docs/guide/jps/
    or
    http://java.sun.com/docs/books/tutorial/2d/printing/
    Or you can download reporting tool, please visit:
    http://jasperreports.sourceforge.net/
    or
    http://www.elixirtech.com/
    Okie! God bless :)

  • How to print "Text" in JAVA(TM)....

    Does anyone know how to print "text" using Java?
    - Here's an example output...
    NOTE: # == 'empty spaces'
    --------------------------- <- Paper
    |###################|
    |####Welcome#########|
    |###################|
    |########to##########|
    |###########JAVA(TM)##|
    |###################|
    |#######Programming####|
    |###################|
    Please post a complete << SAMPLE CODE >> for printing the "text" (Welcome to JAVA(TM) Programming. Including the indentions. So it will not be like this...
    -------------------- <- Paper
    |Welcome |
    |to |
    |JAVA(TM) |
    |Programming |
    | |
    | |
    | |
    | |
    Thanks.

    Please read How To Ask Questions The Smart Way

  • Hyperion Anaylzer - how to Print report with information in pages?

    Hi,<BR><BR>I use Hyperion Analyzer Version: 6.1.1.00206 (from Help | About menu).<BR><BR>I created report with pages (on Navigate button selected the Pages). In pages are months (January, February, March, etc).<BR><BR>Now I would like to print current report. So I did:<BR>1. click on arrow beside Print button<BR>2. Print Current Report windows is displayed. I selected default options and press OK button.<BR><BR>Report is printed, but there is no page information printed out. So on paper there is report without months (January, February, March, etc).<BR><BR>How to print report with information in pages?<BR><BR>Thanks,<BR>Grofaty

    Jia Shun,
    I had the same issue for printing A/R Invoices - I created a Crystal Report based on a SQL View, works fine with A/R Invoice document, but the Draft Invoice printing has 3 pages: 1st page blank, 2nd page with watermark "DRAFT", 3rd page my Crystal Report layout without any data. When printing normally it is only 1 page.
    Here is what I did as a work around:
    Create two SQL Views, one select from OINV (joining INV1 and other tables needed), the other select from ODRF (joining DRF1 and other tables needed), for the draft printing.
    Create two identicle Crystal Reports, only difference are: datasource location (from different views), the "draft" crystal report has a watermark section.
    Go to Administration>System Initialization>Print Preferences and uncheck "Print draft watermark..."
    Import both crystal reports. Invoice can be printed normally. But the Draft Invoice has more steps: Open Draft document report, change settings so it shows the DocEntry in the Draft Table. Select and open the desired document, hit Print Preview, and enter the DocEntry, it displays the layout with data and "DRAFT" watermark.
    This is a workaround. I don't like it because it is not scalable - too much workload if you want to print 100 invoices.
    Hopefully someone will provide a better solution.
    regards,
    G

  • Funtion is returning jstring, how to print it in java code

    Plz let me know how to print a jstirng which is returning by a native function in java.
    When i use System.out.print(view());
    it gives me error.
    what i shoulr do with jsting so that i can use/print it in java.

    dscdscWhat do you mean by that?

  • How to print PDF under Java control

    Hi, all - thank you for reading this message.
    I'm working with Java 1.4.2_12 and Tomcat but planning to migrate upward Real Soon Now. We are running on Windows Server 2003 (customer's choice).
    My application, using iText, creates a PDF, which comprises a new coversheet plus some existing PDFs appended. The new PDF is needed for archival. This part works OK.
    Now, still in my Java app, I would like to print the new PDF, to a printer chosen in my code. At present I have only PCL and basic PS (2?) capable laser printers, mostly HPs, available and these are all networked - not local - printers.
    I have tried some things using PrintService and this cannot find any PDF printers from the server, though for comparison it did correctly find some PostScript capable devices. Attempts to actually print have resulted in garbage, with the printer obviously mangling the PDF over several trees-worth of paper, if not stopped.
    Has anyone else managed to 'filter' a PDF (under program control) and send it to a regular, networked printer, such as I have described?
    Can anyone confirm that a PS 3 capable printer would handle a PDF direct and if so what DocFlavor would be appropriate?
    Sorry if this is a trivial issue but I have spent quite some time on it and would appreciate any input.
    Thanks - Edwin
    Message was edited by:
    EdwinBolton

    jPDFPrint by Qoppa Software. It's a 100% java library to print PDF documents.

  • How to print envelopes with correct orientation?

    Hi all,
    This one has been driving me mad and, despite many searches for help, just can't find a solution. As someone who knows their way around most IT related problems it is also very frustrating!
    The problem: How to print a DL envelope using Pages (or Word come to think about it) so that the text is positioned on the envelope where you would expect it to be.
    Printer: Epson Stylus Photo R800 - although I would guess this happens to any printer.
    Tried: I have selected the DL Envelope setting in page setup (11x22cm)and selected landscape. The envelope is positioned in the printer so that the smaller side goes in first (too wide to go in the same way a page of A4 would go). If I select print then the address details are printed at 90° to the envelope. If I choose portrait then the whole thing is messed up with the text flowing down the page (which is now shown as 11x22).
    Strangely, if I do this in Word but go to Print Preview first then print it is fine.
    Best option for me is to use Address Book though and click on the 'Orientation' tab, select the landscape option and everything is OK. Pain to have to use this each time I an envelope though.
    I have tried everything in pages including leaving the page set to 11x22 and trying to rotate the text but this is messy and have not found an easy way to rotate text in Pages as yet!
    Has anyone a solution to this or am I simply missing something that is glaringly obvious?!!
    Thanks all, Mike

    Michael Mackay wrote:
    I have tried everything in pages including leaving the page set to 11x22 and trying to rotate the text but this is messy and have not found an easy way to rotate text in Pages as yet!
    It's really easy and it's perfectly described in the Help in the chapter entitled: *Flipping and Rotating Objects*
    Create a Text Box (which is an object).
    Type what you want in it.
    Metrics Inspector > use the rotate button or enter directly 90 in the Angle field.
    We may also do that without the Inspector.
    Select the Text Box Put the cursor on the top_right handle
    Press Shift + cmd while we drag the handle to rotate once of 45°
    Repeat the process 45° + 45° will give a 90° rotation.
    Yvan KOENIG (from FRANCE dimanche 13 juillet 2008 15:59:49)

  • How to use connec with java 6.0 ?

    I often use the function below to connect Database:
         public Connection getConnection(){
    try{
    Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
    conn=DriverManager.getConnection("jdbc:odbc:EmployeeManagerDB","sa","sa");
    System.out.println("Get connection successfully!");
    catch(Exception e){
                   System.out.println("Error: " +e);
    return conn;
    but now, with Java 6.0 . don't use "class.forName....for method"
    can you tell me how to use it??
    thanks !

    but now, with Java 6.0 . don't use
    "class.forName....for method" Where did you get this idea?He's perfectly correct. JDBC 4.0 takes advantage of the Java SE Service Provide mechanism in Java 6 to do away with the requirement. So, if you have Java 6 and a JDBC 4 driver (it's a mandatory feature) you simply omit the forName() call.
    The only problem is that there aren't that many complete JDBC 4 drivers out there yet.

  • Monitor Print Queue with java program

    I'm plan to write a client/server based application which control the printing for every user. I've no idea how to start on the application.
    1. Is it possible to monitor the print queue or print job using java application?
    2. How does the server react if the client sending the print job to there? How's the client can trigger the signal during printing and send to the server?
    Thank you!

    I'm plan to write a client/server based application
    which control the printing for every user. I've no
    idea how to start on the application.You should establish feasibility first, before planning to write anything
    1. Is it possible to monitor the print queue or print
    job using java application?Not really. Print queues are highly system-dependent things and some e.g. Windows can really only be accessed via system calls in a native language.
    2. How does the server react if the client sending
    the print job to there?Err, it prints the file?
    How's the client can trigger the signal during printing and send to the server? What signal?
    But I suspect the answer to the first question makes the others irrelevant.

  • Printing HTML with Java Printing Service(JDK1.4 beta)

    Hi there!
    I'm currently checking out the new Java Printing Service (JPS) in the new JDK1.4 beta. This looks like a very promising printing API, with amongst others printer discovery and support for MIME types - but I have some problems with printing HTML displayed in a JEditorPane.
    I'm developing an application that should let the user edit a (HTML)document displayed in a JEditorPane and the print this document to a printer. I have understood that this should be peace-of-cake using the JPS which has pre-defined HTML DocFlavor amongst others, in fact here is what Eric Armstrong says on Javaworld (http://www.javaworld.com/javaone01/j1-01-coolapis.html):
    "With JPS, data formats are specified using MIME types, for example: image/jpeg, text/plain, and text/html. Even better, the API includes a formatting engine that understands HTML, and an engine that, given a document that implements the Printable or Pageable interface, generates PostScript. The HTML formatting engine looks particularly valuable given the prevalence of XML data storage. You only need to set up an XSLT (eXtensible Stylesheet Language Transformation) stylesheet, use it to convert the XML data to HTML, and send the result to the printer."
    After one week of reasearch I have not been able to do what Armstrong describes; print a String that contains text of MIME type text/html.
    I have checked the supported MIMI types of the Print Service returned by PrintServiceLookup.lookupDefaultPrintService(). This is the result:
    DocFlavor flavor = DocFlavor.INPUT_STREAM.GIF;
    PrintRequestAttributeSet aset = new HashPrintRequestAttributeSet();
    aset.add(MediaSizeName.ISO_A4);
    aset.add(new Copies(2));
    PrintService[] service = PrintServiceLookup.lookupPrintServices(flavor,aset);
    if (service.length > 0) {
    System.out.println("Selected printer " + service[0].getName());
    DocFlavor[] flavors = service[0].getSupportedDocFlavors();
    for (int i = 0;i<flavors.length;i++) {
    System.out.println("Flavor "+i+": "+flavors.toString());
    Selected printer \\MUNIN-SERVER\HP LaserJet 2100 Series PCL 6
    Flavor 0: image/gif; class="[B"
    Flavor 1: image/gif; class="java.io.InputStream"
    Flavor 2: image/gif; class="java.net.URL"
    Flavor 3: image/jpeg; class="[B"
    Flavor 4: image/jpeg; class="java.io.InputStream"
    Flavor 5: image/jpeg; class="java.net.URL"
    Flavor 6: image/png; class="[B"
    Flavor 7: image/png; class="java.io.InputStream"
    Flavor 8: image/png; class="java.net.URL"
    Flavor 9: application/x-java-jvm-local-objectref; class="java.awt.print.Pageable"
    Flavor 10: application/x-java-jvm-local-objectref; class="java.awt.print.Printable"
    As you can see there is no support for text/html here.
    If anyone has a clue to what I'm missing here or any other (elegant, simple) way to print the contents of a JEditorPane, please speak up!
    Reply to: [email protected] or [email protected] or here in this forum

    Since you have 'printable' as one of your flavors, try this using a JTextPane (assuming you can dump your HTML into a JTextPane, which shouldn't be a big problem)...
    1. Have your JTextPane implement Printable
    ie. something like this:
    public class FormattedDocument extends JTextPane implements Printable 2. Read your HTML into the associated doc in the text pane.
    3. Implement the printable interface, since you have it as one of your available flavors (I'd imagine everybody has printable in their available flavors). Something like this:
    public int print(Graphics g, PageFormat pf, int pageIndex) {
            Graphics2D g2 = (Graphics2D) g;
            g2.translate((int)pf.getImageableX(), (int)pf.getImageableY());
            g2.setClip(0, 0, (int)pf.getImageableWidth(), (int)pf.getImageableHeight()); 
            if (pageIndex == 0)
                setupPrintView(pf);
            if (!pv.paintPage(g2, pageIndex))
                return NO_SUCH_PAGE;
            return PAGE_EXISTS;
        }Here's my setupPrintView function, which is executed once on page 0 (which still needs some polishing in case I want to start from page 5). It sets up a 'print view' class based on the root view of the document. PrintView class follows...
    public void setupPrintView(PageFormat pf) {
    View root = this.getUI().getRootView(this);
            pv = new PrintView(this.getStyledDocument().getDefaultRootElement(), root,
                               (int)pf.getImageableWidth(), (int)pf.getImageableHeight());Note of obvious: 'pv' is of type PrintView.
    Here's my PrintView class that paints your text pane line by line, a page at a time, until there is no more.
    class PrintView extends BoxView
        public PrintView(Element elem, View root, int w, int h) {
            super(elem, Y_AXIS);
            setParent(root);
            setSize(w, h);
            layout(w, h);
        public boolean paintPage(Graphics2D g2, int pageIndex) {
            int viewIndex = getTopOfViewIndex(pageIndex);
            if (viewIndex == -1) return false;
            int maxY = getHeight();
            Rectangle rc = new Rectangle();
            int fillCounter = 0;
            int Ytotal = 0;
            for (int k = viewIndex; k < getViewCount(); k++) {
                rc.x = 0;
                rc.y = Ytotal;
                rc.width = getSpan(X_AXIS, k);
                rc.height = getSpan(Y_AXIS, k);
                if (Ytotal + getSpan(Y_AXIS, k) > maxY) break;
                paintChild(g2, rc, k);
                Ytotal += getSpan(Y_AXIS, k);
            return true;
    // find top of page for a given page number
        private int getTopOfViewIndex(int pageNumber) {
            int pageHeight = getHeight() * pageNumber;
            for (int k = 0; k < getViewCount(); k++)
                if (getOffset(Y_AXIS, k) >= pageHeight) return k;
            return -1;
    }That's my 2 cents. Any questions?

  • How to use Entrust with java application on unix platform

    Hi all,
    i have question regarding the use of Entrust with java application on unix
    1)I want to use Entrust for encryption/decryption of the file in my core java application on unix platform.
    What should be requiremnet for the same and how it is implemented?.
    2) I want to Use Entrust for Authentication purpose in my java based web application on unix platform.
    What are requirements for Entrust Authentication and how it is implemented ?

    any one has solution?

  • How to realize them with Java Swing?

    1.I want to realize the function - Save, which is similar with "save" in windows notepad - after clicking "save", a dialog box is poped up, then i can input the filename and save it. Is there any ready class like JFileChooser in Java Swing?
    2.I want to set Font and color in the text area. I can do it now. But I must set the font and color b4 input the words. How can I do it like Windows Word - I just input my words, then I highlight them and select the font and colour....all highlighted words r change....can I don it with Java swing and how?
    Thanks..

    1.I want to realize the function - Save, which is
    similar with "save" in windows notepad - after
    clicking "save", a dialog box is poped up, then i can
    input the filename and save it. Is there any ready
    class like JFileChooser in Java Swing?JFileChooser is a Swing based dialog, use it for your problem.
    >
    2.I want to set Font and color in the text area. I can
    do it now. But I must set the font and color b4 input
    the words. How can I do it like Windows Word - I just
    input my words, then I highlight them and select the
    font and colour....all highlighted words r
    change....can I don it with Java swing and how?
    Thanks..I am currently working this, try the ElementIterator w/ the Document that your inputing, as you iterate throught the nodes, you modify the attribute sets there.
    Hope this helps.
    >

  • Do you know how to call RDF with java code?

    Say me a tip!
    Environment:
    Linux, Reports 6i,java beans, jsp
    My mission is to run a report with java code.
    But I don't know how to.
    Basic flow is :
    On web browser, call jsp a program and
    that jsp call a java module,
    and the java module call a reports RDF with parameters
    I don't need reponse message from rwcgi60 or rwrun60.

    hello,
    the easiest way is to use the regular HTTP request to either the servlet or the CGI to run a report request from within a java-class.
    regards,
    the oracle reports team --pw                                                                                                                                                                                                                                                                                                                                                                                       

  • Research - how to build OS with Java

    I intend to build the basic functionality of an OS with Java.
    Can anyone recommend a good book:
    - that explains the OS achitecture in depth.
    - gives a headstart to start programming OS concepts in Java

    you only need to know two things:
    - How to schedule threads
    - How to create a file system

Maybe you are looking for

  • Fastest possible disk access in os9

    hi there as the topic says im interested in achieving the best possible disk speeds in os9 for use with old media programs. i have resurrected an old g4 450mhz sawtooth that im using to run some old music production programs im pretty sure that the d

  • Can I run a Sawtooth without an internal HDD?

    Hey all, I recently started seeing my S.M.A.R.T. staus on my non-factory internal HDD as "failing" once in a while. Having some experience with this in the past, I decided to immediately dump the entirety of my 100GB WD internal ATA onto my maxtor fi

  • Java buffer overflow help

    class test      public static void main(String[]args) System.out.println(1.20+4.90-4.90);          System.out.println(1.20+4.90-4.90-1.20); please run the following program i have a similar problem with this buffer overflow. i am doing a cshier progr

  • My PC sings to me..how do I shut it off?

    So, I am assuming that my itunes application on my PC is responsible for singing to me at random times. How can I shut off this feature? Thank you

  • Error SPAM UPDATE

    good morning I am aplying SPAM/SAINT update version 38 for 701 in the phase IMPOR_PROPER have a error Error -601-PAT03_SDA in R3CDEDATA type *FILE already when executing ADD-FIELD of Error in DDL statement for when executing ADD-FIELD of (dummy, do n