src/share/jaxws_classes/com/sun/xml/internal/ws/transport/http/HttpAdapter.java

changeset 408
b0610cd08440
parent 384
8f2986ff0235
child 637
9c07ef4934dd
     1.1 --- a/src/share/jaxws_classes/com/sun/xml/internal/ws/transport/http/HttpAdapter.java	Thu Sep 26 10:43:28 2013 -0700
     1.2 +++ b/src/share/jaxws_classes/com/sun/xml/internal/ws/transport/http/HttpAdapter.java	Fri Oct 04 16:21:34 2013 +0100
     1.3 @@ -89,6 +89,8 @@
     1.4   */
     1.5  public class HttpAdapter extends Adapter<HttpAdapter.HttpToolkit> {
     1.6  
     1.7 +    private static final Logger LOGGER = Logger.getLogger(HttpAdapter.class.getName());
     1.8 +
     1.9      /**
    1.10       * {@link com.sun.xml.internal.ws.api.server.SDDocument}s keyed by the query string like "?abc".
    1.11       * Used for serving documents via HTTP GET.
    1.12 @@ -852,7 +854,14 @@
    1.13                  }
    1.14              }
    1.15          }
    1.16 -        buf.writeTo(baos);
    1.17 +        if (buf.size() > dump_threshold) {
    1.18 +            byte[] b = buf.getRawData();
    1.19 +            baos.write(b, 0, dump_threshold);
    1.20 +            pw.println();
    1.21 +            pw.println(WsservletMessages.MESSAGE_TOO_LONG(HttpAdapter.class.getName() + ".dumpTreshold"));
    1.22 +        } else {
    1.23 +            buf.writeTo(baos);
    1.24 +        }
    1.25          pw.println("--------------------");
    1.26  
    1.27          String msg = baos.toString();
    1.28 @@ -946,6 +955,8 @@
    1.29       */
    1.30      public static volatile boolean dump = false;
    1.31  
    1.32 +    public static volatile int dump_threshold = 4096;
    1.33 +
    1.34      public static volatile boolean publishStatusPage = true;
    1.35  
    1.36      public static synchronized void setPublishStatus(boolean publish) {
    1.37 @@ -954,19 +965,32 @@
    1.38  
    1.39      static {
    1.40          try {
    1.41 -            dump = Boolean.getBoolean(HttpAdapter.class.getName()+".dump");
    1.42 -        } catch( Throwable t ) {
    1.43 -            // OK to ignore this
    1.44 +            dump = Boolean.getBoolean(HttpAdapter.class.getName() + ".dump");
    1.45 +        } catch (SecurityException se) {
    1.46 +            if (LOGGER.isLoggable(Level.CONFIG)) {
    1.47 +                LOGGER.log(Level.CONFIG, "Cannot read ''{0}'' property, using defaults.",
    1.48 +                        new Object[] {HttpAdapter.class.getName() + ".dump"});
    1.49 +            }
    1.50          }
    1.51          try {
    1.52 -            setPublishStatus(System.getProperty(HttpAdapter.class.getName()+".publishStatusPage").equals("true"));
    1.53 -        } catch( Throwable t ) {
    1.54 -            // OK to ignore this
    1.55 +            dump_threshold = Integer.getInteger(HttpAdapter.class.getName() + ".dumpTreshold", 4096);
    1.56 +        } catch (SecurityException se) {
    1.57 +            if (LOGGER.isLoggable(Level.CONFIG)) {
    1.58 +                LOGGER.log(Level.CONFIG, "Cannot read ''{0}'' property, using defaults.",
    1.59 +                        new Object[] {HttpAdapter.class.getName() + ".dumpTreshold"});
    1.60 +            }
    1.61 +        }
    1.62 +        try {
    1.63 +            setPublishStatus(Boolean.getBoolean(HttpAdapter.class.getName() + ".publishStatusPage"));
    1.64 +        } catch (SecurityException se) {
    1.65 +            if (LOGGER.isLoggable(Level.CONFIG)) {
    1.66 +                LOGGER.log(Level.CONFIG, "Cannot read ''{0}'' property, using defaults.",
    1.67 +                        new Object[] {HttpAdapter.class.getName() + ".publishStatusPage"});
    1.68 +            }
    1.69          }
    1.70      }
    1.71  
    1.72      public static void setDump(boolean dumpMessages) {
    1.73          HttpAdapter.dump = dumpMessages;
    1.74      }
    1.75 -    private static final Logger LOGGER = Logger.getLogger(HttpAdapter.class.getName());
    1.76  }

mercurial