Java Code Examples for com.sun.xml.internal.ws.util.ByteArrayBuffer#writeTo()

The following examples show how to use com.sun.xml.internal.ws.util.ByteArrayBuffer#writeTo() . 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: HttpAdapter.java    From TencentKona-8 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 2
Source File: HttpTransportPipe.java    From TencentKona-8 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 3
Source File: HttpAdapter.java    From jdk8u60 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 4
Source File: HttpTransportPipe.java    From jdk8u60 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 5
Source File: HttpAdapter.java    From openjdk-jdk8u 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 6
Source File: HttpTransportPipe.java    From openjdk-jdk8u 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 7
Source File: HttpAdapter.java    From openjdk-jdk8u-backup 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 8
Source File: HttpTransportPipe.java    From openjdk-jdk8u-backup 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 9
Source File: HttpAdapter.java    From openjdk-jdk9 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 10
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 11
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 12
Source File: HttpTransportPipe.java    From hottub 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 13
Source File: HttpAdapter.java    From openjdk-8-source 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 14
Source File: HttpTransportPipe.java    From openjdk-8-source 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 15
Source File: HttpAdapter.java    From openjdk-8 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 16
Source File: HttpTransportPipe.java    From openjdk-8 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);
    }
}