Examples of ResourceEntry


Examples of org.apache.catalina.loader.ResourceEntry

  }


  @Override
  protected ResourceEntry findResourceInternal(String name, String path) {
    ResourceEntry entry = super.findResourceInternal(name, path);
    if (entry != null && entry.binaryContent != null && path.endsWith(CLASS_SUFFIX)) {
      String className = (name.endsWith(CLASS_SUFFIX) ? name.substring(0, name.length() - CLASS_SUFFIX.length()) : name);
      entry.binaryContent = this.weavingTransformer.transformIfNecessary(className, entry.binaryContent);
    }
    return entry;
View Full Code Here

Examples of org.apache.catalina.loader.ResourceEntry

      url = findResource(name);
      if (url != null)
      {
         if (getAntiJARLocking())
         {
            ResourceEntry entry = (ResourceEntry) this.resourceEntries.get(name);
            try
            {
               String repository = entry.codeBase.toString();
               if ((repository.endsWith(".jar")) && (!(name.endsWith(".class"))))
               {
View Full Code Here

Examples of org.apache.catalina.loader.ResourceEntry

    }

    @Override
    protected ResourceEntry findResourceInternal(String name, String path) {
        initInstrumentor();
        ResourceEntry entry = super.findResourceInternal(name, path);
        if (entry != null && path.endsWith(".class") && entry.binaryContent != null) {
            String className = name.substring(0, name.length() - ".class".length());
            try {
                entry.binaryContent = instrumentor.instrumentClass(className, entry.binaryContent);
            } catch (Exception ex) {
View Full Code Here

Examples of org.apache.catalina.loader.ResourceEntry

    }

    @Override
    protected ResourceEntry findResourceInternal(String name, String path) {
        initInstrumentor();
        ResourceEntry entry = super.findResourceInternal(name, path);
        if (entry != null && path.endsWith(".class")) {
            String className = name.substring(0, name.length() - ".class".length());
            try {
                entry.binaryContent = instrumentor.instrumentClass(className, entry.binaryContent);
            } catch (Exception ex) {
View Full Code Here

Examples of org.apache.marmotta.platform.core.api.modules.ResourceEntry

     * @param relativeURL a URL relative to the web application root of this web application
     * @return the resource identified by the relative URL, or null if it does not exist
     */
    @Override
    public ResourceEntry getResource(String relativeURL) {
        ResourceEntry data = null;

        // check the request path prefix whether it matches with one of the prefixes in the prefix mapping; if yes,
        // lookup the resource as follows:
        // 1. look in the cache using the path of the request url as cache key
        // 2. if not found: look in the jar file by mapping the resource to the correct jar file and retrieving it
        //    from the "web" folder contained therein
        // 3. if not found: proceed with the chain by calling chain.doFilter()
        // TODO: (FIXME) data_cache.get(path) might return null some times even though path is in cache
        if(isCached(relativeURL)) {
            data = getFromCache(relativeURL);
        } else {

            try {
                URL jarUrl = resolveResource(relativeURL);

                if(jarUrl != null) {
                    try {
                        byte[] bytes = ByteStreams.toByteArray(jarUrl.openStream());

                        data = new ResourceEntry(jarUrl,bytes,bytes.length,getMimeType(jarUrl));

                        log.debug("retrieved resource {} (mime type {}, length {} bytes)", jarUrl.toString(), data.getContentType(),data.getLength());
                    } catch (NullPointerException e) {
                        // This happens if a directory is accessed in the jar-file.
                        data = null;
                    }
                    putInCache(relativeURL,data);
View Full Code Here

Examples of org.apache.marmotta.platform.core.api.modules.ResourceEntry

        long starttime = System.currentTimeMillis();


        if(path != null && adminInterfaceService.isMenuEntry(path)) {

            ResourceEntry data = resourceService.getResource(path);

            // if no: proceed with the chain by calling chain.doFilter()
            if(data != null && data.getLength() > 0) {

                try {
                    byte [] templatedData = adminInterfaceService.process(data.getData(),path);
                    data = new ResourceEntry(data.getLocation(),templatedData,templatedData.length,data.getContentType());

                    HttpServletResponse hresponse = (HttpServletResponse) response;

                    if(configurationService.getBooleanConfiguration("resources.browsercache.enabled",true)) {
                        hresponse.setDateHeader("Expires", System.currentTimeMillis()+configurationService.getIntConfiguration("resources.browsercache.seconds",300)*1000);
                    } else {
                        hresponse.setHeader("Cache-Control", "no-store");
                        hresponse.setHeader("Pragma", "no-cache");
                        hresponse.setDateHeader("Expires", 0);
                    }

                    if(data.getContentType() != null && !data.getContentType().contains("unknown")) {
                        hresponse.setContentType(data.getContentType());
                    }
                    hresponse.setContentLength(data.getLength());

                    hresponse.getOutputStream().write(data.getData());
                    hresponse.getOutputStream().flush();
                    hresponse.getOutputStream().close();

                    if (log.isDebugEnabled()) {
                        log.debug("request for {} took {}ms", url, System.currentTimeMillis() - starttime);
View Full Code Here

Examples of org.apache.marmotta.platform.core.api.modules.ResourceEntry

     * @param relativeURL a URL relative to the web application root of this web application
     * @return the resource identified by the relative URL, or null if it does not exist
     */
    @Override
    public ResourceEntry getResource(String relativeURL) {
        ResourceEntry data = null;

        // check the request path prefix whether it matches with one of the prefixes in the prefix mapping; if yes,
        // lookup the resource as follows:
        // 1. look in the cache using the path of the request url as cache key
        // 2. if not found: look in the jar file by mapping the resource to the correct jar file and retrieving it
        //    from the "web" folder contained therein
        // 3. if not found: proceed with the chain by calling chain.doFilter()
        // TODO: (FIXME) data_cache.get(path) might return null some times even though path is in cache
        if(isCached(relativeURL)) {
            data = getFromCache(relativeURL);
        } else {

            try {
                URL jarUrl = resolveResource(relativeURL);

                if(jarUrl != null) {
                    try {
                        byte[] bytes = ByteStreams.toByteArray(jarUrl.openStream());

                        data = new ResourceEntry(jarUrl,bytes,bytes.length,getMimeType(jarUrl));

                        log.debug("retrieved resource {} (mime type {}, length {} bytes)", jarUrl.toString(), data.getContentType(),data.getLength());
                    } catch (NullPointerException e) {
                        // This happens if a directory is accessed in the jar-file.
                        data = null;
                    }
                    putInCache(relativeURL,data);
View Full Code Here

Examples of org.apache.marmotta.platform.core.api.modules.ResourceEntry


        if(path != null) {
            long starttime = System.currentTimeMillis();

            ResourceEntry data = resourceService.getResource(path);


            // if no: proceed with the chain by calling chain.doFilter()
            if(data != null && data.getLength() > 0) {


                HttpServletResponse hresponse = (HttpServletResponse) response;

                if(configurationService.getBooleanConfiguration("resources.browsercache.enabled",true)) {
                    hresponse.setDateHeader("Expires", System.currentTimeMillis()+configurationService.getIntConfiguration("resources.browsercache.seconds",300)*1000);
                } else {
                    hresponse.setHeader("Cache-Control", "no-store");
                    hresponse.setHeader("Pragma", "no-cache");
                    hresponse.setDateHeader("Expires", 0);
                }

                if(data.getContentType() != null && !data.getContentType().contains("unknown")) {
                    hresponse.setContentType(data.getContentType());
                }
                hresponse.setContentLength(data.getLength());

                hresponse.getOutputStream().write(data.getData());
                hresponse.getOutputStream().flush();
                hresponse.getOutputStream().close();

                if (log.isDebugEnabled()) {
                    log.debug("request for {} took {}ms", url, System.currentTimeMillis() - starttime);
View Full Code Here

Examples of org.apache.marmotta.platform.core.api.modules.ResourceEntry

        long starttime = System.currentTimeMillis();


        if(path != null && adminInterfaceService.isMenuEntry(path)) {

            ResourceEntry data = resourceService.getResource(path);

            // if no: proceed with the chain by calling chain.doFilter()
            if(data != null && data.getLength() > 0) {

                try {
                    byte [] templatedData = adminInterfaceService.process(data.getData(),path);
                    data = new ResourceEntry(data.getLocation(),templatedData,templatedData.length,data.getContentType());

                    HttpServletResponse hresponse = (HttpServletResponse) response;

                    if(configurationService.getBooleanConfiguration("resources.browsercache.enabled",true)) {
                        hresponse.setDateHeader("Expires", System.currentTimeMillis()+configurationService.getIntConfiguration("resources.browsercache.seconds",300)*1000);
                    } else {
                        hresponse.setHeader("Cache-Control", "no-store");
                        hresponse.setHeader("Pragma", "no-cache");
                        hresponse.setDateHeader("Expires", 0);
                    }

                    if(data.getContentType() != null && !data.getContentType().contains("unknown")) {
                        hresponse.setContentType(data.getContentType());
                    }
                    hresponse.setContentLength(data.getLength());

                    hresponse.getOutputStream().write(data.getData());
                    hresponse.getOutputStream().flush();
                    hresponse.getOutputStream().close();

                    if (log.isDebugEnabled()) {
                        log.debug("request for {} took {}ms", url, System.currentTimeMillis() - starttime);
View Full Code Here

Examples of org.boris.pecoff4j.ResourceEntry

        if (id == -1)
            id = name;
        if (id == -1)
            id = language;
        for (int i = 0; i < parent.size(); i++) {
            ResourceEntry e = parent.get(i);
            if (id == -1 || id == e.getId()) {
                if (e.getData() != null)
                    entries.add(e);
                else {
                    ResourceDirectory rd = e.getDirectory();
                    if (rd != null) {
                        if (type != -1)
                            type = -1;
                        else if (name != -1)
                            name = -1;
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.