Hello
The complex way of solving your problem would be by means of an
IRequestHandler and an IRequestMapper. I use this same system to generate
JSON responses in my projects without the need of using another servlet
thus sharing all of my wicket Session security information.

Your IRequestHandler should proxy the WebCam output to your response in a
way similar to this:

public void respond(IRequestCycle requestCycle) {
//Send bytes to the response you would need to gather your bytes first
requestCycle.getResponse().write(/* bytes*/);
//Get direct acces to outputStream so you can send bytes without holding
them in memory...
requestCycle.getResponse().getOutputStream();
//This may also be useful
if (requestCycle.getResponse() instanceof WebResponse) {
            ((WebResponse)
requestCycle.getResponse()).setContentType("YOUR/MIME/TYPE;
charset=YOUR-CONTENT-ENCODING");
}
}

Then you should program some kind of IRequestMapper that will handle your
Requests and return your custom IRequestHandler.

Regards
--
Marc Nuri
www.marcnuri.com


On Fri, Jan 11, 2013 at 11:19 PM, Martin Grigorov <[email protected]>wrote:

> You may try to push the updates with Atmosphere/Native WebSockets.
>
> Also see https://github.com/videlalvaro/gifsockets. May be useful for you.
>
>
> On Sat, Jan 12, 2013 at 12:14 AM, Decebal Suiu <[email protected]>
> wrote:
>
> > Hi
> >
> > @Marc Implementation using AjaxSelfUpdatingTimerBehavior is better that
> > nothing, it's quick and dirty but it's not scalable. Think at some
> webcams
> > on the same page with a FPS (frame per second) around 5.
> >
> > @Ernesto Cabzola has a streamer based on "multipart/x-mixed-replace" mime
> > type but it uses a SocketServer to servers the clients and I want to use
> my
> > servlet container that host my wicket application. I can use
> mjpg-streamer
> > [1] or motion [2] to achieve the same functionality but I don't want to
> > install additional software on my machine.
> >
> > Also I can write a StreamerServlet that serves requests related  to
> motion
> > jpeg but my idea is to use the security, page parameters from my wicket
> > application. For example on
> http://webcamapp/webcam?fps=2&webcamId=1request
> > I want to have the freedom to response with a "multipart/x-mixed-replace"
> > mime type and writing my image bytes on response.getOutputStream(); I
> want
> > here to do what I must do in a StreamerServlet [3] . Is it possible to
> have
> > access completely to http response from wicket? Must I use a mapper or a
> > bookmarkable page? Does my idea make sense?
> >
> > Another idea of mine is to use websocket (I want to explore more on this
> > field :)) but I don't know if it's recommended for my scenario.
> >
> >
> > [1] http://sourceforge.net/projects/mjpg-streamer/
> > [2] http://www.lavrsen.dk/foswiki/bin/view/Motion/WebHome
> >
> > [3] out.writeBytes("Content-Type: multipart/x-mixed-replace;boundary=" +
> > BOUNDARY + "\r\n");
> >      out.writeBytes("\r\n");
> >      out.writeBytes("--" + BOUNDARY + "\n");
> >
> >      byte[] imageBytes = ... ;
> >      while (true) {
> >           out.writeBytes("Content-type: image/jpeg\n\n");
> >           out.write(imageBytes); // pseudo code
> >           out.writeBytes("--" + BOUNDARY + "\n");
> >           out.flush();
> >           Thread.sleep(500);
> >      }
> >
> >
> > Best regards,
> > Decebal
> >
> >
> >
> > --
> > View this message in context:
> >
> http://apache-wicket.1842946.n4.nabble.com/motion-jpeg-and-wicket-tp4655294p4655309.html
> > Sent from the Users forum mailing list archive at Nabble.com.
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: [email protected]
> > For additional commands, e-mail: [email protected]
> >
> >
>
>
> --
> Martin Grigorov
> jWeekend
> Training, Consulting, Development
> http://jWeekend.com <http://jweekend.com/>
>

Reply via email to