Project

General

Profile

« Previous | Next » 

Revision 3757

Added by Jing Tao over 16 years ago

Using reponse.getOutputStream to replace reponse.getWriter in query and read method. So metacat can send correct special character back.

View differences:

src/edu/ucsb/nceas/metacat/MetaCatServlet.java
636 636
            // request
637 637
            // to a particular action handler
638 638
            if (action.equals("query")) {
639
                PrintWriter out = response.getWriter();
639
            	ServletOutputStream streamOut = response.getOutputStream();
640
                PrintWriter out = new PrintWriter(streamOut);
640 641
                handleQuery(out, params, response, username, groupnames,
641 642
                        sess_id);
642 643
                out.close();
643 644
            } else if (action.equals("squery")) {
644
                PrintWriter out = response.getWriter();
645
            	ServletOutputStream streamOut = response.getOutputStream();
646
                PrintWriter out = new PrintWriter(streamOut);
645 647
                if (params.containsKey("query")) {
646 648
                    handleSQuery(out, params, response, username, groupnames,
647 649
                            sess_id);
......
654 656
            } else if ( action.trim().equals("spatial_query")) {
655 657
                
656 658
                logMetacat.debug("******************* SPATIAL QUERY ********************");
657
                PrintWriter out = response.getWriter();
659
                ServletOutputStream streamOut = response.getOutputStream();
660
                PrintWriter out = new PrintWriter(streamOut);
658 661
                handleSpatialQuery(out, params, response, username, groupnames, sess_id);
659 662
                out.close();
660 663
                
......
1632 1635
                
1633 1636
            } else {
1634 1637
                // this is metadata doc
1638
            	ServletOutputStream streamOut = response.getOutputStream();
1635 1639
                if (qformat.equals("xml") || qformat.equals("")) {
1636 1640
                    // if equals "", that means no qformat is specified. hence
1637 1641
                    // by default the document should be returned in xml format
......
1639 1643
                    response.setContentType("text/xml"); //MIME type
1640 1644
                    response.setHeader("Content-Disposition",
1641 1645
                            "attachment; filename=" + docid + ".xml");
1642
                    PrintWriter out = response.getWriter();
1646
                    PrintWriter out = new PrintWriter(streamOut);
1643 1647
                    doc.toXml(out, user, groups, withInlineData);
1644 1648
                } else {
1645 1649
                    //*** This is a metadata doc, to be returned in a skin/custom format.
......
1652 1656
                    }
1653 1657
                    
1654 1658
                    response.setContentType("text/html"); //MIME type
1655
                    PrintWriter out = response.getWriter();
1659
                    PrintWriter out = new PrintWriter(streamOut);
1656 1660
                    
1657 1661
                    // Look up the document type
1658 1662
                    String doctype = doc.getDoctype();

Also available in: Unified diff