You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@wicket.apache.org by "Peter Ertl (JIRA)" <ji...@apache.org> on 2012/05/08 00:32:48 UTC

[jira] [Commented] (WICKET-4457) setTextEncoding on JavascriptResourceReferences/CssResourceReferences

    [ https://issues.apache.org/jira/browse/WICKET-4457?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13270064#comment-13270064 ] 

Peter Ertl commented on WICKET-4457:
------------------------------------

sample (wicket 1.5.x)


		JavaScriptResourceReference reference = new JavaScriptResourceReference(Home.class, "foo.js")
		{
			@Override
			public IResource getResource()
			{
				PackageResource resource = (PackageResource)super.getResource();
				resource.setTextEncoding("ISO-8859-1");
				return resource;
			}
		};


sample (wicket 6.x, no cast need like in 1.5.x):


		JavaScriptResourceReference reference = new JavaScriptResourceReference(Home.class, "foo.js")
		{
			@Override
			public JavaScriptPackageResource getResource()
			{
				JavaScriptPackageResource resource = super.getResource();
				resource.setTextEncoding("ISO-8859-1");
				return resource;
			}
		};

                
> setTextEncoding on JavascriptResourceReferences/CssResourceReferences
> ---------------------------------------------------------------------
>
>                 Key: WICKET-4457
>                 URL: https://issues.apache.org/jira/browse/WICKET-4457
>             Project: Wicket
>          Issue Type: Improvement
>          Components: wicket
>    Affects Versions: 1.5.4, 6.0.0-beta1
>            Reporter: David Loidolt
>            Assignee: Peter Ertl
>             Fix For: 6.0.0-beta1, 1.5.7
>
>
> Setting the encoding of JavascriptResources and CssResources in wicket is by now not easily to achieve.
> By now only html files are equipped with the charset option afterwads, but not CSS or JS files. 
> Content-Type: application/javascript;charset=UTF8
> org.apache.wicket.request.resource.AbstractResource#setResponseHeaders() does take the textEncoding into account,
> but there is no way to set it from the outside without introducing new classes by copy/pasting existing Resources and adapt them. 
> The only resource which is able to modify the content-type through the constructor is the TextTemplateResource. 
> One can specify "application/javascript; charset=UTF8" and pass it as the content-type parameter. 
> It's a hack,  but  this string then used for the content-type header.
> A separate charset parameter would be better in my opinion. 
> UserGroup post: http://apache-wicket.1842946.n4.nabble.com/setTextEncoding-on-JavascriptResourceReferences-CssResourceReferences-td4472204.html
>  

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira