|
engine.js compression: msg#00211java.dwr.user
I've
been playing around with the DWR js compression parameters to reduce
the transferred file size and I encountered a small
bug.
When
you set it to remove single-line comments, it seems to remove also important
code from the JS file :) This is from v2 RC2
engine.js:
>> Line 637:
dwr.engine._handleWarning(batch, { name:"dwr.engine.oldSafari",
message:"Safari GET support disabled. See http://getahead.ltd.uk/dwr/server/servlet and allowGetForSafariButMakeForgeryEasier."
});
after
compress:
>> dwr.engine._handleWarning(batch, { name:"dwr.engine.oldSafari",
message:"Safari GET support disabled. See http:
obviously, it mistakes the url in the string as a comment and removes the
rest of the line.....
I
guess the fastest way to fix this is to make sure there are no "//" used
anywhere except comments (rather than having the compression code have to check
this stuff).
From: Rickardsson Daniel
[mailto:darik-rKFwPUNGxSPQT0dZR+AlfA@xxxxxxxxxxxxxxxx]
Sent: Tuesday, February 27, 2007 01:14 To: users-EyPigyGktj4FDOXUYO6UHQ@xxxxxxxxxxxxxxxx Subject: [dwr-user] How to display (browser) images (inputstream) from the server? Your java server side code falls generally in 3 categories:
1. you generate UI with some framework or a pile of frameworks
(Struts, Webworks, Spring MVC. JSF....). In this case the framework
manages the output stream and you generate just a part of the UI from
within one specific part of the code. You cannot/should not touch the
output stream.
2. you generate a PDF, XLS or some other output, in this case you
have full control over the output stream
3. you use some type of remoting framework like the Spring Http
Invoker or DWR. in this case you return objects and the output is
managed by the remoting framework.
If you really want to you can always get to the real output stream
(for example insert a custom servlet filter in web.xml, save the
object in session or thread local storage) but you will have to fight
against all the rest of the environment. Has the http header been
sent already or not? Is this a buffered stream and there is a partial
output from one of the other components? Is this encoded as chunks or
is the content-length set?
Marius
--
Marius Seritan
marius-ALVOsWIOdiJWk0Htik3J/w@xxxxxxxxxxxxxxxx
On Feb 26, 2007, at 1:36 PM, Rickardsson Daniel wrote:
> Hi!
> Thanks for your reply...
> But this is very annoying.
> I mean... of all examples I have read on the web they all say that
> you have to write to the outputstream of the httpservletresponse
> object.
> But when doing so i'm getting the irritating
> illegalargumentexception...
> Does dwr set the response to "read only"?!
> But if using dwr and getting the correct inputstream in my
> javamethod, what object type could I return to the _javascript_ (File/
> OutputStream) for making it work?!
> And how should I write my _javascript_... is it correct to use a div-
> tag?!
> /Daniel.
> Content-Type: multipart/signed; micalg=sha1; boundary=Apple-
> Mail-9-932872763; protocol="application/pkcs7-signature"
> From: Marius Seritan <marius-ALVOsWIOdiJWk0Htik3J/w@xxxxxxxxxxxxxxxx>
> Date: Mon, 26 Feb 2007 10:13:20 -0800
> Subject: [dwr-user] How to display (browser) images (inputstream)
> from the server?
>
> Typically you would read URLs through DWR and use _javascript_ to
> generate img nodes to display the URLs. Basically the download of the
> binary data is done by the browser. If you do want to return through
> DWR the binary data that makes up the images you can add it as
> members in your class/objects. I do not know how/if DWR will
> serialize the data and how you will process it on the _javascript_ side.
>
> --
> Marius Seritan
> marius-ALVOsWIOdiJWk0Htik3J/w@xxxxxxxxxxxxxxxx
>
>
>
> On Feb 26, 2007, at 9:57 AM, Rickardsson Daniel wrote:
>
> > Hi!
> >
> > How can I display images that is being read from a server?!
> >
> > I want to read many images and therfore using dwr.
> >
> > In my ajax-java-method I use:
> > WebContext ctx = WebContextFactory.get();
> > HttpServletRequest request = ctx.getHttpServletRequest();
> > HttpServletResponse response = ctx.getHttpServletResponse();
> >
> > //then gets the outputstream
> > ServletOutputStream out = response.getOutputStream();
> >
> > //writes my picture (inputstream) to my outputstream
> > StreamUtils.copyStream(is, out);
> >
> > And on client side I have the following:
> > document.getElementById('map').style.backgroundImage =
> > MapClass.getMap(<parameters>);
> >
> > No picture is shown and my log says:
> > 2007-02-26 18:02:57,528 ERROR [http-8080-1]
> > org.apache.catalina.core.StandardWrapperValve.invoke()
> > Servlet.service() for servlet myApplication threw exception
> > java.lang.IllegalStateException: getOutputStream() has already been
> > called for this response
> > at org.apache.catalina.connector.Response.getWriter(Response.java:
> > 599)
> > at org.apache.catalina.connector.ResponseFacade.getWriter
> > (ResponseFacade.java:195)
> > at uk.ltd.getahead.dwr.impl.DefaultExecProcessor.handle
> > (DefaultExecProcessor.java:157)
> > at uk.ltd.getahead.dwr.impl.DefaultProcessor.handle
> > (DefaultProcessor.java:81)
> > at uk.ltd.getahead.dwr.AbstractDWRServlet.doPost
> > (AbstractDWRServlet.java:162)
> > at javax.servlet.http.HttpServlet.service(HttpServlet.java:709)
> > at javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
> > at
> >
> org.springframework.web.servlet.mvc.ServletWrappingController.handleRe
> > questInternal(ServletWrappingController.java:174)
> > at
> > org.springframework.web.servlet.mvc.AbstractController.handleRequest
> > (AbstractController.java:153)
> > at
> >
> org.springframework.web.servlet.mvc.SimpleControllerHandlerAdapter.han
> > dle(SimpleControllerHandlerAdapter.java:45)
> > at org.springframework.web.servlet.DispatcherServlet.doDispatch
> > (DispatcherServlet.java:806)
> > at org.springframework.web.servlet.DispatcherServlet.doService
> > (DispatcherServlet.java:736)
> > at org.springframework.web.servlet.FrameworkServlet.processRequest
> > (FrameworkServlet.java:396)
> > at org.springframework.web.servlet.FrameworkServlet.doPost
> > (FrameworkServlet.java:360)
> > at javax.servlet.http.HttpServlet.service(HttpServlet.java:709)
> > at javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
> > at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter
> > (ApplicationFilterChain.java:252)
> > at org.apache.catalina.core.ApplicationFilterChain.doFilter
> > (ApplicationFilterChain.java:173)
> > at org.apache.catalina.core.StandardWrapperValve.invoke
> > (StandardWrapperValve.java:213)
> > at org.apache.catalina.core.StandardContextValve.invoke
> > (StandardContextValve.java:178)
> > at org.apache.catalina.core.StandardHostValve.invoke
> > (StandardHostValve.java:126)
> > at org.apache.catalina.valves.ErrorReportValve.invoke
> > (ErrorReportValve.java:105)
> > at org.apache.catalina.core.StandardEngineValve.invoke
> > (StandardEngineValve.java:107)
> > at org.apache.catalina.connector.CoyoteAdapter.service
> > (CoyoteAdapter.java:148)
> > at org.apache.coyote.http11.Http11AprProcessor.process
> > (Http11AprProcessor.java:833)
> > at org.apache.coyote.http11.Http11AprProtocol
> > $Http11ConnectionHandler.process(Http11AprProtocol.java:639)
> > at org.apache.tomcat.util.net.AprEndpoint$Worker.run
> > (AprEndpoint.java:1285)
> > at java.lang.Thread.run(Unknown Source)
> >
> > Does anyone have any idea what to do?!
Attachments
|
|
| <Prev in Thread] | Current Thread | [Next in Thread> |
|---|---|---|
| Previous by Date: | RE: begginers spring integration, Thierry Olivier |
|---|---|
| Next by Date: | engine.js compression (cont), matan-FP6co0geiwbQT0dZR+AlfA |
| Previous by Thread: | How to display (browser) images (inputstream) from the server?, Rickardsson Daniel |
| Next by Thread: | Re: engine.js compression, Thomas Manson |
| Indexes: | [Date] [Thread] [Top] [All Lists] |
| News | FAQ | advertise |