Hi Christian, Christian Sprecher schrieb: > Hi Felix > > I think you mean the *jcr:enconding* property of the respective
Ehrm, yes of course. My bad. > jcr:content child node. And this had been set to an empty value. > Changing this to UTF-8 does work. > Now, the file hasn't been created via Sling/http but rather via JCR API, > and there I do set jcr:encoding explicitely to "" (empty string, doh!). Ah, that explains it. > How do you do this in Sling? Do you simply set the encoding to UTF-8, or > do you retrieve this value from somewhere? Usually I upload scripts using WebDAV and this stores the file data as UTF-8 and sets the encoding accordingly IIRC. Regards Felix > > Thx & Cheers > > Christian > > Felix Meschberger schrieb: >> Hi Christian, >> >> This is kind of unexpected. But lets recap. The >> DefaultSlingScript.getScriptReader method uses the >> ResourceMetadata.getCharacterEncoding() to find the encoding of the >> script file. Now if this is based on a JCR nt:file node, this would be >> the jcr:mimeType property. >> >> To what value is this property set ? Could it be, that this property has >> a non-empty value, which is not a valid character encoding ? >> >> I think, we should catch this exception and create some better logging >> and probably try some other encoding - maybe UTF-8 or the platform >> default. >> >> WDYT ? >> >> Regards >> Felix >> >> Christian Sprecher schrieb: >> >>> Hi all >>> >>> I've tried to trigger a script, both groovy and esp. I am recieving the >>> exception pasted below. Can anybody make any sense out of it? >>> >>> Cheers >>> >>> Christian >>> >>> >>> (500) >>> >>> The requested URL /controlmanagement/rulebook.html resulted in an error >>> in /apps/test/html.esp. >>> >>> >>> Exception: >>> >>> java.io.UnsupportedEncodingException: at >>> sun.nio.cs.StreamDecoder.forInputStreamReader(Unknown Source) >>> at java.io.InputStreamReader.<init>(Unknown Source) >>> at >>> org.apache.sling.scripting.core.impl.DefaultSlingScript.getScriptReader(DefaultSlingScript.java:301) >>> >>> >>> at >>> org.apache.sling.scripting.core.impl.DefaultSlingScript.call(DefaultSlingScript.java:129) >>> >>> >>> at >>> org.apache.sling.scripting.core.impl.DefaultSlingScript.eval(DefaultSlingScript.java:106) >>> >>> >>> at >>> org.apache.sling.scripting.core.impl.DefaultSlingScript.service(DefaultSlingScript.java:225) >>> >>> >>> at >>> org.apache.sling.engine.impl.request.RequestData.service(RequestData.java:520) >>> >>> >>> at >>> org.apache.sling.engine.impl.SlingMainServlet.processRequest(SlingMainServlet.java:409) >>> >>> >>> at >>> org.apache.sling.engine.impl.filter.RequestSlingFilterChain.render(RequestSlingFilterChain.java:48) >>> >>> >>> at >>> org.apache.sling.engine.impl.filter.AbstractSlingFilterChain.doFilter(AbstractSlingFilterChain.java:59) >>> >>> >>> at >>> org.apache.sling.engine.impl.debug.RequestProgressTrackerLogFilter.doFilter(RequestProgressTrackerLogFilter.java:59) >>> >>> >>> at >>> org.apache.sling.engine.impl.filter.AbstractSlingFilterChain.doFilter(AbstractSlingFilterChain.java:57) >>> >>> >>> at >>> org.apache.sling.engine.impl.SlingMainServlet.service(SlingMainServlet.java:296) >>> >>> >>> at >>> org.apache.sling.engine.impl.SlingMainServlet.service(SlingMainServlet.java:183) >>> >>> >>> at >>> org.mortbay.jetty.servlet.ServletHolder.handle(ServletHolder.java:502) >>> at >>> org.mortbay.jetty.servlet.ServletHandler.handle(ServletHandler.java:389) >>> at >>> org.ops4j.pax.web.service.internal.HttpServiceServletHandler.handle(HttpServiceServletHandler.java:64) >>> >>> >>> at >>> org.mortbay.jetty.servlet.SessionHandler.handle(SessionHandler.java:181) >>> at >>> org.mortbay.jetty.handler.ContextHandler.handle(ContextHandler.java:765) >>> at >>> org.ops4j.pax.web.service.internal.HttpServiceContext.handle(HttpServiceContext.java:111) >>> >>> >>> at >>> org.ops4j.pax.web.service.internal.JettyServerHandlerCollection.handle(JettyServerHandlerCollection.java:64) >>> >>> >>> at >>> org.mortbay.jetty.handler.HandlerWrapper.handle(HandlerWrapper.java:152) >>> at org.mortbay.jetty.Server.handle(Server.java:324) >>> at >>> org.mortbay.jetty.HttpConnection.handleRequest(HttpConnection.java:535) >>> at >>> org.mortbay.jetty.HttpConnection$RequestHandler.headerComplete(HttpConnection.java:865) >>> >>> >>> at org.mortbay.jetty.HttpParser.parseNext(HttpParser.java:539) >>> at org.mortbay.jetty.HttpParser.parseAvailable(HttpParser.java:212) >>> at org.mortbay.jetty.HttpConnection.handle(HttpConnection.java:404) >>> at >>> org.mortbay.io.nio.SelectChannelEndPoint.run(SelectChannelEndPoint.java:409) >>> >>> >>> at >>> org.mortbay.thread.QueuedThreadPool$PoolThread.run(QueuedThreadPool.java:520) >>> >>> >>> >>> >>> Request Progress: >>> >>> 0 (2009-05-14 21:38:17) Starting Request Processing >>> 1 (2009-05-14 21:38:17) Starting ResourceResolution >>> 7 (2009-05-14 21:38:17) URI=/controlmanagement/rulebook.html >>> resolves to Resource=JcrNodeResource, type=test, >>> path=/controlmanagement/rulebook, elapsed = 6ms >>> 8 (2009-05-14 21:38:17) Resource Path Info: SlingRequestPathInfo: >>> path='/controlmanagement/rulebook', selectorString='null', >>> extension='html', suffix='null' >>> 8 (2009-05-14 21:38:17) Starting ServletResolution >>> 8 (2009-05-14 21:38:17) Starting resolverServlet(JcrNodeResource, >>> type=test, path=/controlmanagement/rulebook) >>> 530 (2009-05-14 21:38:17) Using Servlet /apps/test/html.esp, elapsed >>> = 522ms >>> 530 (2009-05-14 21:38:17) URI=/controlmanagement/rulebook.html >>> handled by Servlet=/apps/test/html.esp, elapsed = 522ms >>> 531 (2009-05-14 21:38:17) Applying request filters >>> 531 (2009-05-14 21:38:17) Calling filter: >>> org.apache.sling.engine.impl.debug.RequestProgressTrackerLogFilter >>> 531 (2009-05-14 21:38:17) Starting /apps/test/html.esp#0 >>> 551 (2009-05-14 21:38:17) SCRIPT ERROR: 551 (2009-05-14 21:38:17) >>> /apps/test/html.esp#0, elapsed = 20ms >>> 552 (2009-05-14 21:38:17) Starting >>> handleError:throwable=java.io.UnsupportedEncodingException >>> 561 (2009-05-14 21:38:17) Using handler Sling Default Error Handler >>> Servlet, elapsed = 9ms >>> 584 (2009-05-14 21:38:17) Dumping SlingRequestProgressTracker >>> Entries, elapsed = 584ms >>> >>> ------------------------------------------------------------------------ >>> ApacheSling/2.0 (Java HotSpot(TM) Client VM 1.6.0_13; Windows Vista 6.0 >>> x86) >>> >>> >>> >>> > >
