Re: setTextEncoding on JavascriptResourceReferences/CssResourceReferences
Hi, I also think this is not easy to do at the moment. Please file a ticket. The only way at the moment I see is to override + copy/paste org.apache.wicket.request.resource.PackageResourceReference#getResource() and then override org.apache.wicket.request.resource.AbstractResource#setResponseHeaders() for the returned IResource. Not nice at all... On Wed, Mar 14, 2012 at 5:43 PM, exaptis david.loid...@gmail.com wrote: Hi, i'm currently dealing with an encoding issue in wicket 1.5.4. When accessing js or css files the content-type header information only includes the content-type but not the encoding, but all our html files are send with the correct content-type header information. curl has the following output: *curl -I -k https://localhost/wicket/resource/com.sample.wicket.resources.js.ResourcesJsScope/sample.js *HTTP/1.1 200 OK Server: Apache-Coyote/1.1 Last-Modified: Wed, 14 Mar 2012 09:14:39 GMT Date: Wed, 14 Mar 2012 14:46:55 GMT Expires: Thu, 14 Mar 2013 14:46:55 GMT Cache-Control: public Cache-Control: max-age=31536000 Pragma: cache Content-Disposition: inline Content-Type: application/javascript Content-Length: 1285 As some of our js and css files are included from different sources we can't influence the sites encoding and therefore it's necessary to deliver these files with the proper charset in the content-type. Content-Type: *application/javascript;charset=UTF8* Now i was searching for a solution to solve this problem in wicket. I found out that the AbstractResource.ResourceResponse class has a class member textEncoding which is used for rendering the header response, but i didn't find a way to set it by using the provided Javascript/Css Resources (as they are automatically generated by their *ResourceReference classes). This link seemed to be good, but doesn't provide a global solution as i'm looking for a global setting to set utf-8 for all css/js resources at once. http://blog.sonxurxo.com/2011/04/06/setting-character-encoding-for-json-in-apache-wicket/ The second link I found (and my current solution) is to implement it via a spring filter. It seems to work and i'm okay with this solution - but I really would like to know how to archive the same effect in wicket? http://forum.springsource.org/showthread.php?14063-How-to-set-setCharacterEncoding-on-Request Cheers, David -- View this message in context: http://apache-wicket.1842946.n4.nabble.com/setTextEncoding-on-JavascriptResourceReferences-CssResourceReferences-tp4472204p4472204.html Sent from the Users forum mailing list archive at Nabble.com. - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org -- Martin Grigorov jWeekend Training, Consulting, Development http://jWeekend.com - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org
Re: setTextEncoding on JavascriptResourceReferences/CssResourceReferences
Hi Martin, thank you for your reply. Followed your advise, and filled a ticket: https://issues.apache.org/jira/browse/WICKET-4457 Cheers, David -- View this message in context: http://apache-wicket.1842946.n4.nabble.com/setTextEncoding-on-JavascriptResourceReferences-CssResourceReferences-tp4472204p4475232.html Sent from the Users forum mailing list archive at Nabble.com. - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org
setTextEncoding on JavascriptResourceReferences/CssResourceReferences
Hi, i'm currently dealing with an encoding issue in wicket 1.5.4. When accessing js or css files the content-type header information only includes the content-type but not the encoding, but all our html files are send with the correct content-type header information. curl has the following output: *curl -I -k https://localhost/wicket/resource/com.sample.wicket.resources.js.ResourcesJsScope/sample.js *HTTP/1.1 200 OK Server: Apache-Coyote/1.1 Last-Modified: Wed, 14 Mar 2012 09:14:39 GMT Date: Wed, 14 Mar 2012 14:46:55 GMT Expires: Thu, 14 Mar 2013 14:46:55 GMT Cache-Control: public Cache-Control: max-age=31536000 Pragma: cache Content-Disposition: inline Content-Type: application/javascript Content-Length: 1285 As some of our js and css files are included from different sources we can't influence the sites encoding and therefore it's necessary to deliver these files with the proper charset in the content-type. Content-Type: *application/javascript;charset=UTF8* Now i was searching for a solution to solve this problem in wicket. I found out that the AbstractResource.ResourceResponse class has a class member textEncoding which is used for rendering the header response, but i didn't find a way to set it by using the provided Javascript/Css Resources (as they are automatically generated by their *ResourceReference classes). This link seemed to be good, but doesn't provide a global solution as i'm looking for a global setting to set utf-8 for all css/js resources at once. http://blog.sonxurxo.com/2011/04/06/setting-character-encoding-for-json-in-apache-wicket/ The second link I found (and my current solution) is to implement it via a spring filter. It seems to work and i'm okay with this solution - but I really would like to know how to archive the same effect in wicket? http://forum.springsource.org/showthread.php?14063-How-to-set-setCharacterEncoding-on-Request Cheers, David -- View this message in context: http://apache-wicket.1842946.n4.nabble.com/setTextEncoding-on-JavascriptResourceReferences-CssResourceReferences-tp4472204p4472204.html Sent from the Users forum mailing list archive at Nabble.com. - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org