Tabnine Logo
SimpleServletResource
Code IndexAdd Tabnine to your IDE (free)

How to use
SimpleServletResource
in
leap.lang.servlet

Best Java code snippets using leap.lang.servlet.SimpleServletResource (Showing top 7 results out of 315)

origin: org.leapframework/leap-lang

/**
 * Gets a resource in the given servlet context.
 */
public static ServletResource getResource(ServletContext sc,String path){
  return new SimpleServletResource(sc,path);
}

origin: org.leapframework/leap-lang

/**
 * This implementation delegates to {@code ServletContext.getResourceAsStream},
 * but throws a FileNotFoundException if no resource found.
 * @see javax.servlet.ServletContext#getResourceAsStream(String)
 */
public InputStream getInputStream() throws IOException {
  InputStream is = this.servletContext.getResourceAsStream(this.path);
  if (is == null) {
    throw new FileNotFoundException("Could not open " + getDescription());
  }
  return is;
}
origin: org.leapframework/leap-lang

public static ServletResource getResource(ServletContext sc,String path, Locale locale) {
  String[] paths = Locales.getLocaleFilePaths(locale, path);
  
  for (String p : paths) {
    try {
      if (null != sc.getResource(p)) {
        return new SimpleServletResource(sc, p);
      }
    } catch (MalformedURLException ex) {
    }
  }
  
  return null;
}
origin: org.leapframework/leap-lang

/**
 * This implementation delegates to {@code ServletContext.getResource},
 * but throws a FileNotFoundException if no resource found.
 * @see javax.servlet.ServletContext#getResource(String)
 */
@Override
public URL getURL() throws IOException {
  URL url = this.servletContext.getResource(this.path);
  if (url == null) {
    throw new FileNotFoundException(
        getDescription() + " cannot be resolved to URL because it does not exist");
  }
  return url;
}
origin: org.leapframework/leap-lang

/**
 * This implementation creates a ServletContextResource, applying the given path
 * relative to the path of the underlying file of this resource descriptor.
 * @see org.springframework.util.StringUtils#applyRelativePath(String, String)
 */
@Override
public SimpleServletResource createRelative(String relativePath) {
  String pathToUse = Paths.applyRelative(this.path, relativePath);
  return new SimpleServletResource(this.servletContext, pathToUse);
}

origin: org.leapframework/leap-lang

@Override
@SuppressWarnings("unchecked")
public ServletResource[] scan(String subPattern) {
  Args.notEmpty(subPattern,"subPattern");
  
  Set<String> subPaths = this.servletContext.getResourcePaths(this.path);
  
  List<SimpleServletResource> resources = new ArrayList<>();
  
  PathMatcher matcher = Resources.getPathMatcher();
  
  for(String subPath : subPaths){
    if(matcher.match(subPattern, subPath)){
      resources.add(new SimpleServletResource(servletContext, subPath));
    }
  }
  
  return resources.toArray(new SimpleServletResource[resources.size()]);
}
origin: org.leapframework/leap-core

private void loadServletContextResource(ServletContext sc, String path, String pathPrefix) {
  ServletResource resource = new SimpleServletResource(sc, path);
  if(!resource.isDirectory()) {
    add(resource, Strings.removeStart(path, pathPrefix));
  }else{
    loadServletContextResources(sc, path, pathPrefix);
  }
}
leap.lang.servletSimpleServletResource

Javadoc

Resource implementation for javax.servlet.ServletContext resources, interpreting relative paths within the web application root directory.

Always supports stream access and URL access, but only allows java.io.File access when the web application archive is expanded.

Most used methods

  • <init>
    Create a new ServletContextResource.The Servlet spec requires that resource paths start with a slash
  • getDescription
    This implementation returns a description that includes the ServletContext resource location.

Popular in Java

  • Making http requests using okhttp
  • addToBackStack (FragmentTransaction)
  • scheduleAtFixedRate (Timer)
  • notifyDataSetChanged (ArrayAdapter)
  • VirtualMachine (com.sun.tools.attach)
    A Java virtual machine. A VirtualMachine represents a Java virtual machine to which this Java vir
  • SocketTimeoutException (java.net)
    This exception is thrown when a timeout expired on a socket read or accept operation.
  • KeyStore (java.security)
    KeyStore is responsible for maintaining cryptographic keys and their owners. The type of the syste
  • Hashtable (java.util)
    A plug-in replacement for JDK1.5 java.util.Hashtable. This version is based on org.cliffc.high_scale
  • Executor (java.util.concurrent)
    An object that executes submitted Runnable tasks. This interface provides a way of decoupling task s
  • TimeUnit (java.util.concurrent)
    A TimeUnit represents time durations at a given unit of granularity and provides utility methods to
  • Best plugins for Eclipse
Tabnine Logo
  • Products

    Search for Java codeSearch for JavaScript code
  • IDE Plugins

    IntelliJ IDEAWebStormVisual StudioAndroid StudioEclipseVisual Studio CodePyCharmSublime TextPhpStormVimGoLandRubyMineEmacsJupyter NotebookJupyter LabRiderDataGripAppCode
  • Company

    About UsContact UsCareers
  • Resources

    FAQBlogTabnine AcademyTerms of usePrivacy policyJava Code IndexJavascript Code Index
Get Tabnine for your IDE now