com.sun.xml.internal.ws.util.ByteArrayBuffer Java Examples

The following examples show how to use com.sun.xml.internal.ws.util.ByteArrayBuffer. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: MimeMultipartParser.java    From hottub with GNU General Public License v2.0 6 votes vote down vote up
@Override
public byte[] asByteArray() {
    if (buf == null) {
        ByteArrayBuffer baf = new ByteArrayBuffer();
        try {
            baf.write(part.readOnce());
        } catch(IOException ioe) {
            throw new WebServiceException(ioe);
        } finally {
            if (baf != null) {
                try {
                    baf.close();
                } catch (IOException ex) {
                    Logger.getLogger(MimeMultipartParser.class.getName()).log(Level.FINE, null, ex);
                }
            }
        }
        buf = baf.toByteArray();
    }
    return buf;
}
 
Example #2
Source File: HttpAdapter.java    From openjdk-jdk9 with GNU General Public License v2.0 6 votes vote down vote up
private Packet decodePacket(@NotNull WSHTTPConnection con, @NotNull Codec codec) throws IOException {
    String ct = con.getRequestHeader("Content-Type");
    InputStream in = con.getInput();
    Packet packet = new Packet();
    packet.soapAction = fixQuotesAroundSoapAction(con.getRequestHeader("SOAPAction"));
    packet.wasTransportSecure = con.isSecure();
    packet.acceptableMimeTypes = con.getRequestHeader("Accept");
    packet.addSatellite(con);
    addSatellites(packet);
    packet.isAdapterDeliversNonAnonymousResponse = true;
    packet.component = this;
    packet.transportBackChannel = new Oneway(con);
    packet.webServiceContextDelegate = con.getWebServiceContextDelegate();
    packet.setState(Packet.State.ServerRequest);
    if (dump || LOGGER.isLoggable(Level.FINER)) {
        ByteArrayBuffer buf = new ByteArrayBuffer();
        buf.write(in);
        in.close();
        dump(buf, "HTTP request", con.getRequestHeaders());
        in = buf.newInputStream();
    }
    codec.decode(in, ct, packet);
    return packet;
}
 
Example #3
Source File: MimeMultipartParser.java    From openjdk-jdk9 with GNU General Public License v2.0 6 votes vote down vote up
@Override
public byte[] asByteArray() {
    if (buf == null) {
        ByteArrayBuffer baf = new ByteArrayBuffer();
        try {
            baf.write(part.readOnce());
        } catch(IOException ioe) {
            throw new WebServiceException(ioe);
        } finally {
            if (baf != null) {
                try {
                    baf.close();
                } catch (IOException ex) {
                    Logger.getLogger(MimeMultipartParser.class.getName()).log(Level.FINE, null, ex);
                }
            }
        }
        buf = baf.toByteArray();
    }
    return buf;
}
 
Example #4
Source File: MimeMultipartParser.java    From TencentKona-8 with GNU General Public License v2.0 6 votes vote down vote up
@Override
public byte[] asByteArray() {
    if (buf == null) {
        ByteArrayBuffer baf = new ByteArrayBuffer();
        try {
            baf.write(part.readOnce());
        } catch(IOException ioe) {
            throw new WebServiceException(ioe);
        } finally {
            if (baf != null) {
                try {
                    baf.close();
                } catch (IOException ex) {
                    Logger.getLogger(MimeMultipartParser.class.getName()).log(Level.FINE, null, ex);
                }
            }
        }
        buf = baf.toByteArray();
    }
    return buf;
}
 
Example #5
Source File: HttpAdapter.java    From jdk8u60 with GNU General Public License v2.0 6 votes vote down vote up
private Packet decodePacket(@NotNull WSHTTPConnection con, @NotNull Codec codec) throws IOException {
    String ct = con.getRequestHeader("Content-Type");
    InputStream in = con.getInput();
    Packet packet = new Packet();
    packet.soapAction = fixQuotesAroundSoapAction(con.getRequestHeader("SOAPAction"));
    packet.wasTransportSecure = con.isSecure();
    packet.acceptableMimeTypes = con.getRequestHeader("Accept");
    packet.addSatellite(con);
    addSatellites(packet);
    packet.isAdapterDeliversNonAnonymousResponse = true;
    packet.component = this;
    packet.transportBackChannel = new Oneway(con);
    packet.webServiceContextDelegate = con.getWebServiceContextDelegate();
    packet.setState(Packet.State.ServerRequest);
    if (dump || LOGGER.isLoggable(Level.FINER)) {
        ByteArrayBuffer buf = new ByteArrayBuffer();
        buf.write(in);
        in.close();
        dump(buf, "HTTP request", con.getRequestHeaders());
        in = buf.newInputStream();
    }
    codec.decode(in, ct, packet);
    return packet;
}
 
Example #6
Source File: AbstractSchemaValidationTube.java    From TencentKona-8 with GNU General Public License v2.0 6 votes vote down vote up
private Document createDOM(SDDocument doc) {
    // Get infoset
    ByteArrayBuffer bab = new ByteArrayBuffer();
    try {
        doc.writeTo(null, resolver, bab);
    } catch (IOException ioe) {
        throw new WebServiceException(ioe);
    }

    // Convert infoset to DOM
    Transformer trans = XmlUtil.newTransformer();
    Source source = new StreamSource(bab.newInputStream(), null); //doc.getURL().toExternalForm());
    DOMResult result = new DOMResult();
    try {
        trans.transform(source, result);
    } catch(TransformerException te) {
        throw new WebServiceException(te);
    }
    return (Document)result.getNode();
}
 
Example #7
Source File: MimeMultipartParser.java    From openjdk-8 with GNU General Public License v2.0 6 votes vote down vote up
@Override
public byte[] asByteArray() {
    if (buf == null) {
        ByteArrayBuffer baf = new ByteArrayBuffer();
        try {
            baf.write(part.readOnce());
        } catch(IOException ioe) {
            throw new WebServiceException(ioe);
        } finally {
            if (baf != null) {
                try {
                    baf.close();
                } catch (IOException ex) {
                    Logger.getLogger(MimeMultipartParser.class.getName()).log(Level.FINE, null, ex);
                }
            }
        }
        buf = baf.toByteArray();
    }
    return buf;
}
 
Example #8
Source File: HttpAdapter.java    From openjdk-8 with GNU General Public License v2.0 6 votes vote down vote up
private Packet decodePacket(@NotNull WSHTTPConnection con, @NotNull Codec codec) throws IOException {
    String ct = con.getRequestHeader("Content-Type");
    InputStream in = con.getInput();
    Packet packet = new Packet();
    packet.soapAction = fixQuotesAroundSoapAction(con.getRequestHeader("SOAPAction"));
    packet.wasTransportSecure = con.isSecure();
    packet.acceptableMimeTypes = con.getRequestHeader("Accept");
    packet.addSatellite(con);
    addSatellites(packet);
    packet.isAdapterDeliversNonAnonymousResponse = true;
    packet.component = this;
    packet.transportBackChannel = new Oneway(con);
    packet.webServiceContextDelegate = con.getWebServiceContextDelegate();
    packet.setState(Packet.State.ServerRequest);
    if (dump || LOGGER.isLoggable(Level.FINER)) {
        ByteArrayBuffer buf = new ByteArrayBuffer();
        buf.write(in);
        in.close();
        dump(buf, "HTTP request", con.getRequestHeaders());
        in = buf.newInputStream();
    }
    codec.decode(in, ct, packet);
    return packet;
}
 
Example #9
Source File: AbstractSchemaValidationTube.java    From openjdk-jdk9 with GNU General Public License v2.0 6 votes vote down vote up
private Document createDOM(SDDocument doc) {
    // Get infoset
    ByteArrayBuffer bab = new ByteArrayBuffer();
    try {
        doc.writeTo(null, resolver, bab);
    } catch (IOException ioe) {
        throw new WebServiceException(ioe);
    }

    // Convert infoset to DOM
    Transformer trans = XmlUtil.newTransformer();
    Source source = new StreamSource(bab.newInputStream(), null); //doc.getURL().toExternalForm());
    DOMResult result = new DOMResult();
    try {
        trans.transform(source, result);
    } catch(TransformerException te) {
        throw new WebServiceException(te);
    }
    return (Document)result.getNode();
}
 
Example #10
Source File: HttpAdapter.java    From TencentKona-8 with GNU General Public License v2.0 6 votes vote down vote up
private Packet decodePacket(@NotNull WSHTTPConnection con, @NotNull Codec codec) throws IOException {
    String ct = con.getRequestHeader("Content-Type");
    InputStream in = con.getInput();
    Packet packet = new Packet();
    packet.soapAction = fixQuotesAroundSoapAction(con.getRequestHeader("SOAPAction"));
    packet.wasTransportSecure = con.isSecure();
    packet.acceptableMimeTypes = con.getRequestHeader("Accept");
    packet.addSatellite(con);
    addSatellites(packet);
    packet.isAdapterDeliversNonAnonymousResponse = true;
    packet.component = this;
    packet.transportBackChannel = new Oneway(con);
    packet.webServiceContextDelegate = con.getWebServiceContextDelegate();
    packet.setState(Packet.State.ServerRequest);
    if (dump || LOGGER.isLoggable(Level.FINER)) {
        ByteArrayBuffer buf = new ByteArrayBuffer();
        buf.write(in);
        in.close();
        dump(buf, "HTTP request", con.getRequestHeaders());
        in = buf.newInputStream();
    }
    codec.decode(in, ct, packet);
    return packet;
}
 
Example #11
Source File: AbstractSchemaValidationTube.java    From openjdk-8 with GNU General Public License v2.0 6 votes vote down vote up
private Document createDOM(SDDocument doc) {
    // Get infoset
    ByteArrayBuffer bab = new ByteArrayBuffer();
    try {
        doc.writeTo(null, resolver, bab);
    } catch (IOException ioe) {
        throw new WebServiceException(ioe);
    }

    // Convert infoset to DOM
    Transformer trans = XmlUtil.newTransformer();
    Source source = new StreamSource(bab.newInputStream(), null); //doc.getURL().toExternalForm());
    DOMResult result = new DOMResult();
    try {
        trans.transform(source, result);
    } catch(TransformerException te) {
        throw new WebServiceException(te);
    }
    return (Document)result.getNode();
}
 
Example #12
Source File: AbstractSchemaValidationTube.java    From openjdk-8-source with GNU General Public License v2.0 6 votes vote down vote up
private Document createDOM(SDDocument doc) {
    // Get infoset
    ByteArrayBuffer bab = new ByteArrayBuffer();
    try {
        doc.writeTo(null, resolver, bab);
    } catch (IOException ioe) {
        throw new WebServiceException(ioe);
    }

    // Convert infoset to DOM
    Transformer trans = XmlUtil.newTransformer();
    Source source = new StreamSource(bab.newInputStream(), null); //doc.getURL().toExternalForm());
    DOMResult result = new DOMResult();
    try {
        trans.transform(source, result);
    } catch(TransformerException te) {
        throw new WebServiceException(te);
    }
    return (Document)result.getNode();
}
 
Example #13
Source File: AbstractSchemaValidationTube.java    From openjdk-jdk8u-backup with GNU General Public License v2.0 6 votes vote down vote up
private Document createDOM(SDDocument doc) {
    // Get infoset
    ByteArrayBuffer bab = new ByteArrayBuffer();
    try {
        doc.writeTo(null, resolver, bab);
    } catch (IOException ioe) {
        throw new WebServiceException(ioe);
    }

    // Convert infoset to DOM
    Transformer trans = XmlUtil.newTransformer();
    Source source = new StreamSource(bab.newInputStream(), null); //doc.getURL().toExternalForm());
    DOMResult result = new DOMResult();
    try {
        trans.transform(source, result);
    } catch(TransformerException te) {
        throw new WebServiceException(te);
    }
    return (Document)result.getNode();
}
 
Example #14
Source File: MimeMultipartParser.java    From openjdk-8-source with GNU General Public License v2.0 6 votes vote down vote up
@Override
public byte[] asByteArray() {
    if (buf == null) {
        ByteArrayBuffer baf = new ByteArrayBuffer();
        try {
            baf.write(part.readOnce());
        } catch(IOException ioe) {
            throw new WebServiceException(ioe);
        } finally {
            if (baf != null) {
                try {
                    baf.close();
                } catch (IOException ex) {
                    Logger.getLogger(MimeMultipartParser.class.getName()).log(Level.FINE, null, ex);
                }
            }
        }
        buf = baf.toByteArray();
    }
    return buf;
}
 
Example #15
Source File: MimeMultipartParser.java    From jdk8u60 with GNU General Public License v2.0 6 votes vote down vote up
@Override
public byte[] asByteArray() {
    if (buf == null) {
        ByteArrayBuffer baf = new ByteArrayBuffer();
        try {
            baf.write(part.readOnce());
        } catch(IOException ioe) {
            throw new WebServiceException(ioe);
        } finally {
            if (baf != null) {
                try {
                    baf.close();
                } catch (IOException ex) {
                    Logger.getLogger(MimeMultipartParser.class.getName()).log(Level.FINE, null, ex);
                }
            }
        }
        buf = baf.toByteArray();
    }
    return buf;
}
 
Example #16
Source File: AbstractSchemaValidationTube.java    From jdk8u60 with GNU General Public License v2.0 6 votes vote down vote up
private Document createDOM(SDDocument doc) {
    // Get infoset
    ByteArrayBuffer bab = new ByteArrayBuffer();
    try {
        doc.writeTo(null, resolver, bab);
    } catch (IOException ioe) {
        throw new WebServiceException(ioe);
    }

    // Convert infoset to DOM
    Transformer trans = XmlUtil.newTransformer();
    Source source = new StreamSource(bab.newInputStream(), null); //doc.getURL().toExternalForm());
    DOMResult result = new DOMResult();
    try {
        trans.transform(source, result);
    } catch(TransformerException te) {
        throw new WebServiceException(te);
    }
    return (Document)result.getNode();
}
 
Example #17
Source File: MimeMultipartParser.java    From openjdk-jdk8u-backup with GNU General Public License v2.0 6 votes vote down vote up
@Override
public byte[] asByteArray() {
    if (buf == null) {
        ByteArrayBuffer baf = new ByteArrayBuffer();
        try {
            baf.write(part.readOnce());
        } catch(IOException ioe) {
            throw new WebServiceException(ioe);
        } finally {
            if (baf != null) {
                try {
                    baf.close();
                } catch (IOException ex) {
                    Logger.getLogger(MimeMultipartParser.class.getName()).log(Level.FINE, null, ex);
                }
            }
        }
        buf = baf.toByteArray();
    }
    return buf;
}
 
Example #18
Source File: HttpAdapter.java    From openjdk-8-source with GNU General Public License v2.0 6 votes vote down vote up
private Packet decodePacket(@NotNull WSHTTPConnection con, @NotNull Codec codec) throws IOException {
    String ct = con.getRequestHeader("Content-Type");
    InputStream in = con.getInput();
    Packet packet = new Packet();
    packet.soapAction = fixQuotesAroundSoapAction(con.getRequestHeader("SOAPAction"));
    packet.wasTransportSecure = con.isSecure();
    packet.acceptableMimeTypes = con.getRequestHeader("Accept");
    packet.addSatellite(con);
    addSatellites(packet);
    packet.isAdapterDeliversNonAnonymousResponse = true;
    packet.component = this;
    packet.transportBackChannel = new Oneway(con);
    packet.webServiceContextDelegate = con.getWebServiceContextDelegate();
    packet.setState(Packet.State.ServerRequest);
    if (dump || LOGGER.isLoggable(Level.FINER)) {
        ByteArrayBuffer buf = new ByteArrayBuffer();
        buf.write(in);
        in.close();
        dump(buf, "HTTP request", con.getRequestHeaders());
        in = buf.newInputStream();
    }
    codec.decode(in, ct, packet);
    return packet;
}
 
Example #19
Source File: HttpAdapter.java    From openjdk-jdk8u with GNU General Public License v2.0 6 votes vote down vote up
private Packet decodePacket(@NotNull WSHTTPConnection con, @NotNull Codec codec) throws IOException {
    String ct = con.getRequestHeader("Content-Type");
    InputStream in = con.getInput();
    Packet packet = new Packet();
    packet.soapAction = fixQuotesAroundSoapAction(con.getRequestHeader("SOAPAction"));
    packet.wasTransportSecure = con.isSecure();
    packet.acceptableMimeTypes = con.getRequestHeader("Accept");
    packet.addSatellite(con);
    addSatellites(packet);
    packet.isAdapterDeliversNonAnonymousResponse = true;
    packet.component = this;
    packet.transportBackChannel = new Oneway(con);
    packet.webServiceContextDelegate = con.getWebServiceContextDelegate();
    packet.setState(Packet.State.ServerRequest);
    if (dump || LOGGER.isLoggable(Level.FINER)) {
        ByteArrayBuffer buf = new ByteArrayBuffer();
        buf.write(in);
        in.close();
        dump(buf, "HTTP request", con.getRequestHeaders());
        in = buf.newInputStream();
    }
    codec.decode(in, ct, packet);
    return packet;
}
 
Example #20
Source File: HttpAdapter.java    From hottub with GNU General Public License v2.0 6 votes vote down vote up
private Packet decodePacket(@NotNull WSHTTPConnection con, @NotNull Codec codec) throws IOException {
    String ct = con.getRequestHeader("Content-Type");
    InputStream in = con.getInput();
    Packet packet = new Packet();
    packet.soapAction = fixQuotesAroundSoapAction(con.getRequestHeader("SOAPAction"));
    packet.wasTransportSecure = con.isSecure();
    packet.acceptableMimeTypes = con.getRequestHeader("Accept");
    packet.addSatellite(con);
    addSatellites(packet);
    packet.isAdapterDeliversNonAnonymousResponse = true;
    packet.component = this;
    packet.transportBackChannel = new Oneway(con);
    packet.webServiceContextDelegate = con.getWebServiceContextDelegate();
    packet.setState(Packet.State.ServerRequest);
    if (dump || LOGGER.isLoggable(Level.FINER)) {
        ByteArrayBuffer buf = new ByteArrayBuffer();
        buf.write(in);
        in.close();
        dump(buf, "HTTP request", con.getRequestHeaders());
        in = buf.newInputStream();
    }
    codec.decode(in, ct, packet);
    return packet;
}
 
Example #21
Source File: HttpAdapter.java    From openjdk-jdk8u-backup with GNU General Public License v2.0 6 votes vote down vote up
private Packet decodePacket(@NotNull WSHTTPConnection con, @NotNull Codec codec) throws IOException {
    String ct = con.getRequestHeader("Content-Type");
    InputStream in = con.getInput();
    Packet packet = new Packet();
    packet.soapAction = fixQuotesAroundSoapAction(con.getRequestHeader("SOAPAction"));
    packet.wasTransportSecure = con.isSecure();
    packet.acceptableMimeTypes = con.getRequestHeader("Accept");
    packet.addSatellite(con);
    addSatellites(packet);
    packet.isAdapterDeliversNonAnonymousResponse = true;
    packet.component = this;
    packet.transportBackChannel = new Oneway(con);
    packet.webServiceContextDelegate = con.getWebServiceContextDelegate();
    packet.setState(Packet.State.ServerRequest);
    if (dump || LOGGER.isLoggable(Level.FINER)) {
        ByteArrayBuffer buf = new ByteArrayBuffer();
        buf.write(in);
        in.close();
        dump(buf, "HTTP request", con.getRequestHeaders());
        in = buf.newInputStream();
    }
    codec.decode(in, ct, packet);
    return packet;
}
 
Example #22
Source File: MimeMultipartParser.java    From openjdk-jdk8u with GNU General Public License v2.0 6 votes vote down vote up
@Override
public byte[] asByteArray() {
    if (buf == null) {
        ByteArrayBuffer baf = new ByteArrayBuffer();
        try {
            baf.write(part.readOnce());
        } catch(IOException ioe) {
            throw new WebServiceException(ioe);
        } finally {
            if (baf != null) {
                try {
                    baf.close();
                } catch (IOException ex) {
                    Logger.getLogger(MimeMultipartParser.class.getName()).log(Level.FINE, null, ex);
                }
            }
        }
        buf = baf.toByteArray();
    }
    return buf;
}
 
Example #23
Source File: AbstractSchemaValidationTube.java    From openjdk-jdk8u with GNU General Public License v2.0 6 votes vote down vote up
private Document createDOM(SDDocument doc) {
    // Get infoset
    ByteArrayBuffer bab = new ByteArrayBuffer();
    try {
        doc.writeTo(null, resolver, bab);
    } catch (IOException ioe) {
        throw new WebServiceException(ioe);
    }

    // Convert infoset to DOM
    Transformer trans = XmlUtil.newTransformer();
    Source source = new StreamSource(bab.newInputStream(), null); //doc.getURL().toExternalForm());
    DOMResult result = new DOMResult();
    try {
        trans.transform(source, result);
    } catch(TransformerException te) {
        throw new WebServiceException(te);
    }
    return (Document)result.getNode();
}
 
Example #24
Source File: AbstractSchemaValidationTube.java    From hottub with GNU General Public License v2.0 6 votes vote down vote up
private Document createDOM(SDDocument doc) {
    // Get infoset
    ByteArrayBuffer bab = new ByteArrayBuffer();
    try {
        doc.writeTo(null, resolver, bab);
    } catch (IOException ioe) {
        throw new WebServiceException(ioe);
    }

    // Convert infoset to DOM
    Transformer trans = XmlUtil.newTransformer();
    Source source = new StreamSource(bab.newInputStream(), null); //doc.getURL().toExternalForm());
    DOMResult result = new DOMResult();
    try {
        trans.transform(source, result);
    } catch(TransformerException te) {
        throw new WebServiceException(te);
    }
    return (Document)result.getNode();
}
 
Example #25
Source File: StreamAttachment.java    From hottub with GNU General Public License v2.0 5 votes vote down vote up
public StreamAttachment(ByteArrayBuffer buffer, String contentId, String contentType) {
    this.contentId = contentId;
    this.contentType = contentType;
    this.byteArrayBuffer = buffer;
    this.data = byteArrayBuffer.getRawData();
    this.len = byteArrayBuffer.size();
}
 
Example #26
Source File: HttpAdapter.java    From hottub with GNU General Public License v2.0 5 votes vote down vote up
private static void dump(ByteArrayBuffer buf, String caption, Map<String, List<String>> headers) throws IOException {
    ByteArrayOutputStream baos = new ByteArrayOutputStream();
    PrintWriter pw = new PrintWriter(baos, true);
    pw.println("---["+caption +"]---");
    if (headers != null) {
        for (Entry<String, List<String>> header : headers.entrySet()) {
            if (header.getValue().isEmpty()) {
                // I don't think this is legal, but let's just dump it,
                // as the point of the dump is to uncover problems.
                pw.println(header.getValue());
            } else {
                for (String value : header.getValue()) {
                    pw.println(header.getKey() + ": " + value);
                }
            }
        }
    }
    if (buf.size() > dump_threshold) {
        byte[] b = buf.getRawData();
        baos.write(b, 0, dump_threshold);
        pw.println();
        pw.println(WsservletMessages.MESSAGE_TOO_LONG(HttpAdapter.class.getName() + ".dumpTreshold"));
    } else {
        buf.writeTo(baos);
    }
    pw.println("--------------------");

    String msg = baos.toString();
    if (dump) {
      System.out.println(msg);
    }
    if (LOGGER.isLoggable(Level.FINER)) {
      LOGGER.log(Level.FINER, msg);
    }
}
 
Example #27
Source File: JAXBAttachment.java    From openjdk-8-source with GNU General Public License v2.0 5 votes vote down vote up
@Override
public InputStream asInputStream() {
    ByteArrayBuffer bab = new ByteArrayBuffer();
    try {
        writeTo(bab);
    } catch (IOException e) {
        throw new WebServiceException(e);
    }
    return bab.newInputStream();
}
 
Example #28
Source File: XmlUtil.java    From openjdk-jdk9 with GNU General Public License v2.0 5 votes vote down vote up
public static InputStream getUTF8Stream(String s) {
    try {
        ByteArrayBuffer bab = new ByteArrayBuffer();
        Writer w = new OutputStreamWriter(bab, "utf-8");
        w.write(s);
        w.close();
        return bab.newInputStream();
    } catch (IOException e) {
        throw new RuntimeException("should not happen");
    }
}
 
Example #29
Source File: HttpTransportPipe.java    From openjdk-jdk9 with GNU General Public License v2.0 5 votes vote down vote up
private void dump(ByteArrayBuffer buf, String caption, Map<String, List<String>> headers) throws IOException {
    ByteArrayOutputStream baos = new ByteArrayOutputStream();
    PrintWriter pw = new PrintWriter(baos, true);
    pw.println("---["+caption +"]---");
    for (Entry<String,List<String>> header : headers.entrySet()) {
        if(header.getValue().isEmpty()) {
            // I don't think this is legal, but let's just dump it,
            // as the point of the dump is to uncover problems.
            pw.println(header.getValue());
        } else {
            for (String value : header.getValue()) {
                pw.println(header.getKey()+": "+value);
            }
        }
    }

    if (buf.size() > HttpAdapter.dump_threshold) {
        byte[] b = buf.getRawData();
        baos.write(b, 0, HttpAdapter.dump_threshold);
        pw.println();
        pw.println(WsservletMessages.MESSAGE_TOO_LONG(HttpAdapter.class.getName() + ".dumpTreshold"));
    } else {
        buf.writeTo(baos);
    }
    pw.println("--------------------");

    String msg = baos.toString();
    if (dump) {
        System.out.println(msg);
    }
    if (LOGGER.isLoggable(Level.FINER)) {
        LOGGER.log(Level.FINER, msg);
    }
}
 
Example #30
Source File: JAXBAttachment.java    From hottub with GNU General Public License v2.0 5 votes vote down vote up
@Override
public InputStream asInputStream() {
    ByteArrayBuffer bab = new ByteArrayBuffer();
    try {
        writeTo(bab);
    } catch (IOException e) {
        throw new WebServiceException(e);
    }
    return bab.newInputStream();
}