You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@click.apache.org by "Hans C. Poo" <ha...@welinux.cl> on 2011/07/14 15:47:10 UTC

Problem serving extensions pdf or xls fixed

Hi,

The click servlet is reconnizing as resource not only files under /click, but any extension distinct to htm or jsp.

In our application we generate pdf or xls, using theses extensions, and were correctly mapped to clickServlet and working under 1.4.2. With the upgrade from 1.4.2 to 2.3.0 (yes a mega upgrade) these files are sent with size 0.

We modified the file ClickResourceService to include a validation to handle just resources under /click as the documentation says:

	public boolean isResourceRequest(HttpServletRequest request) {
		String resourcePath = ClickUtils.getResourcePath(request);

		// If not a click page and not JSP and not a directory
		if (!resourcePath.contains("/click"))
			return false;

		return !configService.isTemplate(resourcePath)
				&& !resourcePath.endsWith("/");
	}

The added line is:


Hans Poo, Welinux S.A.
Bombero Ossa #1010, oficina 800, 
+56-2-3729770, Movil: +56-9-3199305
Santiago, Chile



Re: Problem serving extensions pdf or xls fixed

Posted by Gilberto <gi...@gmail.com>.
I think in your case there is no need to modify the
ClickResourceService, just put your static resources in the
META-INF/resources folder as the docs says[1]. Otherwise you could
extends the own ClickResourceService, overriding the
getCacheableDirs[2] method to serve resources from other directories.

Hth,

Gilberto

[1] http://click.apache.org/docs/click-api/org/apache/click/service/ClickResourceService.html
[2] http://click.apache.org/docs/click-api/org/apache/click/service/ClickResourceService.html#getCacheableDirs%28%29

On Thu, Jul 14, 2011 at 10:47 AM, Hans C. Poo <ha...@welinux.cl> wrote:
> Hi,
>
> The click servlet is reconnizing as resource not only files under /click, but any extension distinct to htm or jsp.
>
> In our application we generate pdf or xls, using theses extensions, and were correctly mapped to clickServlet and working under 1.4.2. With the upgrade from 1.4.2 to 2.3.0 (yes a mega upgrade) these files are sent with size 0.
>
> We modified the file ClickResourceService to include a validation to handle just resources under /click as the documentation says:
>
>        public boolean isResourceRequest(HttpServletRequest request) {
>                String resourcePath = ClickUtils.getResourcePath(request);
>
>                // If not a click page and not JSP and not a directory
>                if (!resourcePath.contains("/click"))
>                        return false;
>
>                return !configService.isTemplate(resourcePath)
>                                && !resourcePath.endsWith("/");
>        }
>
> The added line is:
>
>
> Hans Poo, Welinux S.A.
> Bombero Ossa #1010, oficina 800,
> +56-2-3729770, Movil: +56-9-3199305
> Santiago, Chile
>
>
>