Package java.security

Examples of java.security.CodeSource


            }

            try {
                clazz = defineClass(name, entry.binaryContent, 0,
                        entry.binaryContent.length,
                        new CodeSource(entry.codeBase, entry.certificates));
            } catch (UnsupportedClassVersionError ucve) {
                throw new UnsupportedClassVersionError(
                        ucve.getLocalizedMessage() + " " +
                        sm.getString("webappClassLoader.wrongVersion",
                                name));
View Full Code Here


        // Setup the PermissionCollection for this web app context
        // based on the permissions configured for the root of the
        // web app context directory, then add a file read permission
        // for that directory.
        Policy policy = Policy.getPolicy();
        CodeSource source = null;
        PermissionCollection permissions = null;
        if( policy != null ) {
            try {
                // Get the permissions for the web app context
                String docBase = context.getRealPath("/");
                if( docBase == null ) {
                    docBase = options.getScratchDir().toString();
                }
                String codeBase = docBase;
                if (!codeBase.endsWith(File.separator)){
                    codeBase = codeBase + File.separator;
                }
                File contextDir = new File(codeBase);
                URL url = contextDir.getCanonicalFile().toURI().toURL();
                source = new CodeSource(url,(Certificate[])null);
                permissions = policy.getPermissions(source);

                // Create a file read permission for web app context directory
                if (!docBase.endsWith(File.separator)){
                    permissions.add
View Full Code Here

                if (!codeBase.endsWith(File.separator)){
                    codeBase = codeBase + File.separator;
                }
                File contextDir = new File(codeBase);
                URL url = contextDir.getCanonicalFile().toURL();
                final CodeSource codeSource = new CodeSource(url,(Certificate[])null);
                permissionCollection = policy.getPermissions(codeSource);

                // Create a file read permission for web app context directory
                if (!docBase.endsWith(File.separator)){
                    permissionCollection.add
View Full Code Here

    BundleProtectionDomain(Felix felix, BundleImpl bundle, Object certificates)
        throws MalformedURLException
    {
        super(
            new CodeSource(
                RevisionAsJarURL.create(bundle),
                (Certificate[]) certificates),
            null, null, null);
        m_felix = new WeakReference(felix);
        m_bundle = new WeakReference(bundle);
View Full Code Here

         if (domainConstructor != null)
         {
            Principal[] principals = (Principal[])subject.getPrincipals().toArray(new Principal[0]);
            try
            {
               domain = (ProtectionDomain)domainConstructor.newInstance(new Object[]{new CodeSource(null, (java.security.cert.Certificate[])null), null, null, principals});
            }
            catch (Exception x)
            {
            }
         }

         if (domain == null)
         {
            // This is done for JDK 1.3 compatibility.
            domain = new SubjectProtectionDomain(new CodeSource(null, (java.security.cert.Certificate[])null), subject);
         }
      }
View Full Code Here

   
            }

            clazz = defineClass(name, entry.binaryContent, 0,
                    entry.binaryContent.length,
                    new CodeSource(entry.codeBase, entry.certificates));
            entry.loadedClass = clazz;
            entry.binaryContent = null;
            entry.source = null;
            entry.codeBase = null;
            entry.manifest = null;
View Full Code Here

        }

        private Manifest readManifest() {
            ProtectionDomain domain = VersionBean.class.getProtectionDomain();
            if (domain != null) {
                CodeSource codeSource = domain.getCodeSource();
                if (codeSource != null) {
                    URL url = codeSource.getLocation();
                    if (url != null) {
                        InputStream manifestStream = null;
                        try {
                            URL manifestFileUrl;
                            if ("vfs".equals(url.getProtocol())) {
View Full Code Here

     * Gets the default installation path for the current OS.
     * @return a string containing the default install path for the current OS.
     */
    public static String getDefInstallPath () {
        try {
            CodeSource codeSource = LaunchFrame.class.getProtectionDomain().getCodeSource();
            File jarFile;
            jarFile = new File(codeSource.getLocation().toURI().getPath());
            return jarFile.getParentFile().getPath();
        } catch (URISyntaxException e) {
            Logger.logError("Unexcepted error", e);
        }
        Logger.logWarn("Failed to get path for current directory - falling back to user's home directory.");
View Full Code Here

  }
  private static URI getJarURI()
          throws URISyntaxException
      {
          final ProtectionDomain domain;
          final CodeSource       source;
          final URL              url;
          final URI              uri;

          domain = TimeTest.class.getProtectionDomain();
          source = domain.getCodeSource();
          url    = source.getLocation();
          uri    = url.toURI();

          return (uri);
      }
View Full Code Here

            if (entry.loadedClass == null) {
                try {
                    clazz = defineClass(name, entry.binaryContent, 0,
                            entry.binaryContent.length,
                            new CodeSource(entry.codeBase, entry.certificates));
                } catch (UnsupportedClassVersionError ucve) {
                    throw new UnsupportedClassVersionError(
                            ucve.getLocalizedMessage() + " " +
                            sm.getString("webappClassLoader.wrongVersion",
                                    name));
View Full Code Here

TOP

Related Classes of java.security.CodeSource

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.