Package org.apache.myfaces.trinidad.resource

Examples of org.apache.myfaces.trinidad.resource.ResourceLoader


  protected void doGet(
    HttpServletRequest request,
    HttpServletResponse response
    ) throws ServletException, IOException
  {
    ResourceLoader loader = _getResourceLoader(request);
    String resourcePath = getResourcePath(request);
    URL url = loader.getResource(resourcePath);

    // Make sure the resource is available
    if (url == null)
    {
      response.sendError(HttpServletResponse.SC_NOT_FOUND);
View Full Code Here


  protected long getLastModified(
    HttpServletRequest request)
  {
    try
    {
      ResourceLoader loader = _getResourceLoader(request);
      String resourcePath = getResourcePath(request);
      URL url = loader.getResource(resourcePath);

      if (url == null)
        return super.getLastModified(request);

      URLConnection connection = url.openConnection();
View Full Code Here

   */
  private ResourceLoader _getResourceLoader(
    HttpServletRequest request)
  {
    final String servletPath = request.getServletPath();
    ResourceLoader loader = _loaders.get(servletPath);

    if (loader == null)
    {
      try
      {
        String key = "META-INF/servlets/resources" +
                    servletPath +
                    ".resources";
        ClassLoader cl = Thread.currentThread().getContextClassLoader();
        URL url = cl.getResource(key);

        if (url != null)
        {
          Reader r = new InputStreamReader(url.openStream());
          BufferedReader br = new BufferedReader(r);
          try
          {
            String className = br.readLine().trim();
            Class<?> clazz = cl.loadClass(className);
            try
            {
              Constructor<?> decorator = clazz.getConstructor(_DECORATOR_SIGNATURE);
              ServletContext context = getServletContext();
              File tempdir = (File)
                context.getAttribute("javax.servlet.context.tempdir");
              ResourceLoader delegate = new DirectoryResourceLoader(tempdir);
              loader = (ResourceLoader)
                decorator.newInstance(new Object[]{delegate});
            }
            catch (InvocationTargetException e)
            {
View Full Code Here

  protected void doGet(
    HttpServletRequest request,
    HttpServletResponse response
    ) throws ServletException, IOException
  {
    ResourceLoader loader = _getResourceLoader(request);
    String resourcePath = getResourcePath(request);
    URL url = loader.getResource(resourcePath);

    // Make sure the resource is available
    if (url == null)
    {
      response.sendError(HttpServletResponse.SC_NOT_FOUND);
View Full Code Here

  protected long getLastModified(
    HttpServletRequest request)
  {
    try
    {
      ResourceLoader loader = _getResourceLoader(request);
      String resourcePath = getResourcePath(request);
      URL url = loader.getResource(resourcePath);

      if (url == null)
        return super.getLastModified(request);

      return URLUtils.getLastModified(url);
View Full Code Here

   */
  private ResourceLoader _getResourceLoader(
    HttpServletRequest request)
  {
    final String servletPath = request.getServletPath();
    ResourceLoader loader = _loaders.get(servletPath);

    if (loader == null)
    {
      try
      {
        String key = "META-INF/servlets/resources" +
                    servletPath +
                    ".resources";
        ClassLoader cl = Thread.currentThread().getContextClassLoader();
        URL url = cl.getResource(key);

        if (url != null)
        {
          Reader r = new InputStreamReader(url.openStream());
          BufferedReader br = new BufferedReader(r);
          try
          {
            String className = br.readLine();
            if (className != null)
            {
              className = className.trim();
              Class<?> clazz = cl.loadClass(className);
              try
              {
                Constructor<?> decorator = clazz.getConstructor(_DECORATOR_SIGNATURE);
                ServletContext context = getServletContext();
                File tempdir = (File)
                context.getAttribute("javax.servlet.context.tempdir");
                ResourceLoader delegate = new DirectoryResourceLoader(tempdir);
                loader = (ResourceLoader)
                decorator.newInstance(new Object[]{delegate});
              }
              catch (InvocationTargetException e)
              {
View Full Code Here

  protected void doGet(
    HttpServletRequest request,
    HttpServletResponse response
    ) throws ServletException, IOException
  {
    ResourceLoader loader = _getResourceLoader(request);
    String resourcePath = getResourcePath(request);
    URL url = loader.getResource(resourcePath);

    // Make sure the resource is available
    if (url == null)
    {
      response.sendError(HttpServletResponse.SC_NOT_FOUND);
View Full Code Here

  protected long getLastModified(
    HttpServletRequest request)
  {
    try
    {
      ResourceLoader loader = _getResourceLoader(request);
      String resourcePath = getResourcePath(request);
      URL url = loader.getResource(resourcePath);

      if (url == null)
        return super.getLastModified(request);

      return URLUtils.getLastModified(url);
View Full Code Here

   */
  private ResourceLoader _getResourceLoader(
    HttpServletRequest request)
  {
    final String servletPath = request.getServletPath();
    ResourceLoader loader = _loaders.get(servletPath);

    if (loader == null)
    {
      try
      {
        String key = "META-INF/servlets/resources" +
                    servletPath +
                    ".resources";
        ClassLoader cl = Thread.currentThread().getContextClassLoader();
        URL url = cl.getResource(key);

        if (url != null)
        {
          Reader r = new InputStreamReader(url.openStream());
          BufferedReader br = new BufferedReader(r);
          try
          {
            String className = br.readLine();
            if (className != null)
            {
              className = className.trim();
              Class<?> clazz = cl.loadClass(className);
              try
              {
                Constructor<?> decorator = clazz.getConstructor(_DECORATOR_SIGNATURE);
                ServletContext context = getServletContext();
                File tempdir = (File)
                context.getAttribute("javax.servlet.context.tempdir");
                ResourceLoader delegate = new DirectoryResourceLoader(tempdir);
                loader = (ResourceLoader)
                decorator.newInstance(new Object[]{delegate});
              }
              catch (InvocationTargetException e)
              {
View Full Code Here

  protected void doGet(
    HttpServletRequest request,
    HttpServletResponse response
    ) throws ServletException, IOException
  {
    ResourceLoader loader = _getResourceLoader(request);
    String resourcePath = getResourcePath(request);
    URL url = loader.getResource(resourcePath);

    // Make sure the resource is available
    if (url == null)
    {
      response.sendError(HttpServletResponse.SC_NOT_FOUND);
View Full Code Here

TOP

Related Classes of org.apache.myfaces.trinidad.resource.ResourceLoader

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.