Package java.net

Examples of java.net.NetPermission


      URLStreamHandler handler = new TestURLStreamHandler();

      URL context = new URL("http://www.redhat.com/");
     
      Permission[] specifyStreamHandler = new Permission[] {
  new NetPermission("specifyStreamHandler")};

      Permission[] checkSetFactory = new Permission[] {
  new RuntimePermission("setFactory")};

      TestSecurityManager sm = new TestSecurityManager(harness);
View Full Code Here


        sm.addPermission(source, new PropertyPermission("javax.xml.datatype.DatatypeFactory", "read"));
        sm.addPermission(source, new PropertyPermission("jaxp.debug", "read"));
        sm.addPermission(source, new PropertyPermission("sun.boot.class.path", "read"));
        sm.addPermission(source, new PropertyPermission("sun.timezone.ids.oldmapping", "read"));
        sm.addPermission(source, new ReflectPermission("suppressAccessChecks"));
        sm.addPermission(source, new NetPermission("specifyStreamHandler"));
        sm.setReadOnly();
        System.setSecurityManager(sm);

        // uses implicit Sun14ReflectionProvider in JDK >= 1.4, since it has the appropriate
        // rights
View Full Code Here

        sm.addPermission(source, new PropertyPermission("javax.xml.datatype.DatatypeFactory", "read"));
        sm.addPermission(source, new PropertyPermission("jaxp.debug", "read"));
        sm.addPermission(source, new PropertyPermission("sun.boot.class.path", "read"));
        sm.addPermission(source, new PropertyPermission("sun.timezone.ids.oldmapping", "read"));
        sm.addPermission(source, new ReflectPermission("suppressAccessChecks"));
        sm.addPermission(source, new NetPermission("specifyStreamHandler"));
        sm.setReadOnly();
        System.setSecurityManager(sm);

        xstream = new XStream(new PureJavaReflectionProvider());
View Full Code Here

        sm.addPermission(source, new PropertyPermission("javax.xml.parsers.DocumentBuilderFactory", "read"));
        sm.addPermission(source, new PropertyPermission("jaxp.debug", "read"));
        sm.addPermission(source, new PropertyPermission("maxOccurLimit", "read"));
        sm.addPermission(source, new PropertyPermission("sun.boot.class.path", "read"));
        sm.addPermission(source, new PropertyPermission("sun.timezone.ids.oldmapping", "read"));
        sm.addPermission(source, new NetPermission("specifyStreamHandler"));
        sm.addPermission(source, new ReflectPermission("suppressAccessChecks"));
        sm.setReadOnly();
        System.setSecurityManager(sm);

        xstream = new XStream(new PureJavaReflectionProvider(), new DomDriver());
View Full Code Here

  /**
   * @tests java.net.NetPermission#NetPermission(java.lang.String)
   */
  public void test_ConstructorLjava_lang_String() {
    // Test for method java.net.NetPermission(java.lang.String)
    NetPermission n = new NetPermission("requestPasswordAuthentication");
    assertEquals("Returned incorrect name",
        "requestPasswordAuthentication", n.getName());
  }
View Full Code Here

   *        java.lang.String)
   */
  public void test_ConstructorLjava_lang_StringLjava_lang_String() {
    // Test for method java.net.NetPermission(java.lang.String,
    // java.lang.String)
    NetPermission n = new NetPermission("requestPasswordAuthentication",
        null);
    assertEquals("Returned incorrect name",
        "requestPasswordAuthentication", n.getName());
  }
View Full Code Here

        } else if (claz.equals(RuntimePermission.class)) {
            return new RuntimePermission(name, actions);
        } else if (claz.equals(PropertyPermission.class)) {
            return new PropertyPermission(name, actions);
        } else if (claz.equals(NetPermission.class)) {
            return new NetPermission(name, actions);
        } else if (claz.equals(AllPermission.class)) {
            return SecurityConstants.ALL_PERMISSION;
        } else if (claz.equals(AWTPermission.class)) {
            return new AWTPermission(name, actions);
/*
 
View Full Code Here

  /**
   * @tests java.net.NetPermission#NetPermission(java.lang.String)
   */
  public void test_ConstructorLjava_lang_String() {
    // Test for method java.net.NetPermission(java.lang.String)
    NetPermission n = new NetPermission("requestPasswordAuthentication");
    assertEquals("Returned incorrect name",
        "requestPasswordAuthentication", n.getName());
  }
View Full Code Here

   *        java.lang.String)
   */
  public void test_ConstructorLjava_lang_StringLjava_lang_String() {
    // Test for method java.net.NetPermission(java.lang.String,
    // java.lang.String)
    NetPermission n = new NetPermission("requestPasswordAuthentication",
        null);
    assertEquals("Returned incorrect name",
        "requestPasswordAuthentication", n.getName());
  }
View Full Code Here

        /*
         * Setting the ability to specify a TestHandler stream handler
         * when constructing a HTTPMD URL object
         */
        NetPermission np = new NetPermission("specifyStreamHandler");

        /*
         * Checking the ability to specify a TestHandler stream handler
         * when constructing a HTTPMD URL object
         */
 
View Full Code Here

TOP

Related Classes of java.net.NetPermission

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.