myfaces-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Sylvain Vieujot <svieu...@apache.org>
Subject Re: New s:graphicImageAjax component.
Date Thu, 29 Sep 2005 13:26:24 GMT
Sure, using the extension filter would be a solution, but right now,
this filter is in Tomahawk, and I wouldn't like to start modifying it
for the sole purpose of a sandbox component.
Also, I don't think storing anything in the session is the solution
because then you have to manage a lot of other problems (when to delete
them from the session, how are you sure they'll be deleted, won't it
generate too high trafic in a clustered environment, ...).

On the other hand, adding to the extensions filter a hook mechanism for
individual components would be nice.
Just have to find out how to do this in a clean and general purpose way.

I like Mike's idea to serialize just a minimal tree, as it would work in
every situation. We just have to see how to do it.

Thanks,

Sylvain.

On Thu, 2005-09-29 at 10:03 +0200, Mathias Brökelmann wrote:

> We have created a similar component for our application which depends
> on a servlet. We use an interface for the value which must be
> implemented to return the binary data and the content type. The value
> is stored into the session by using an unique key. That key is used in
> a param for the url. When the request for the binary data is processed
> the instance is fetched from the session which creates the binary
> response.
> 
> We could utilise the existing extension filter to support this. So we
> wouldn´t need an additional servlet or filter.
> 
> Even if we would make it work by using a post it wouldn´t be a good
> solution if someone has a lot of images. If the state has a
> considerable size it would be posted for every image and slows down
> the rendering of the page in the browser.
> 
> The patch for the action event isn´t the problem. But we should
> discuss whats the best solution before changing everything.
> 
> 2005/9/28, Sylvain Vieujot <svieujot@apache.org>:
> >  As for the URL limitation, this can indeed be a problem, but not @ 1024
> > chars.
> >  There is no spec limiting the number of chars in the URL, but browsers can
> > have problems :
> >  http://www.aspfaq.com/show.asp?id=2222
> >
> >  But, as I didn't find any way to use a post request to load an image, I see
> > no workaround for this.
> >  We'll just have to experiment if in real life it causes really problems,
> > and put a warning on this.
> >
> >  About your phase listener comment, could you send me a patch for this ?
> >
> >  Thanks !
> >
> >  Sylvain.
> >
> >
> >  On Wed, 2005-09-28 at 10:06 +0200, Mathias Brökelmann wrote:
> >  Great! We definitely need a component to render dynamic images.
> >
> > I took a view into the code and saw that the state is appended to the
> > image url. IMO it will not work in every case since the state could be
> > very large and as far as I know there is a limitation around 1024
> > chars in a request url.
> >
> > The other thing is the phase listener which will not work if the
> > component is used in a uidata component. Try using a custom faces
> > event which is queued through UIComponent.queueEvent(...).
> >
> >
> > 2005/9/28, Sylvain Vieujot <svieujot@apache.org>:
> > > I just committed a first working version of a graphicImage component that
> > > displays the images from bytes, and that doesn't need an additional
> > servlet.
> > >
> > > It works, but there is still work to be done (See the TODOs in the
> > > component's java file).
> > >
> > > The most important things are :
> > > 1) Find a good name for this component. Right now, it says Ajax whereas
> > > it's not really Ajax.
> > > 2) Extend it to make download links (uses an <a> instead of an <img>
> > >
> > > Thanks for your ideas,
> > >
> > > Sylvain.
> > >
> > > On Tue, 2005-09-27 at 12:35 -0400, Mike Kienenberger wrote:
> > > Sylvain,
> > >
> > > I'm definitely interested in a component that can display an image
> > > from bytes as well, if you want any assistance.
> > >
> > > "-- need a dynamic image servlet" is the next item on my todo list :)
> > >
> > > On 9/26/05, Sylvain Vieujot <svieujot@apache.org> wrote:
> > > > Yes, you're right, but I was looking for a way to use the same code with
> > a
> > > > get request instead of a post request.
> > > > So, I think this will work.
> > > >
> > > > I'll post this soon so that you can check it.
> > > >
> > > > Thanks,
> > > >
> > > > Sylvain.
> > > >
> > > >
> > > > On Mon, 2005-09-26 at 23:24 +0200, Martin Marinschek wrote:
> > > > The snippet you posted is just about remembering the state of the
> > > > application client side - it doesn't have to do anything with dynamic
> > > > loading of images...
> > > >
> > > > Or do I get you completely wrong?
> > > >
> > > > regards,
> > > >
> > > > Martin
> > > >
> > > > On 9/26/05, Sylvain Vieujot <svieujot@apache.org> wrote:
> > > > > You're right, Ajax isn't the perfect term for this, as the result
> > won't
> > > be
> > > > > XML.
> > > > >
> > > > > But maybe it can work using something similar to that :
> > > > > " callback: function(element,entry) {return
> > > > >
> > > >
> > >
> > entry+'&jsf_tree_64='+encodeURIComponent(document.getElementById('jsf_tree_64').value)+'&jsf_state_64='+encodeURIComponent(document.getElementById('jsf_state_64').value)+'&jsf_viewid='+encodeURIComponent(document.getElementById('jsf_viewid').value)}"
> > > > > +
> > > > >
> > > > > (extracted from the inputSuggestAjax code).
> > > > >
> > > > > Thanks for the clue.
> > > > >
> > > > > Sylvain.
> > > > >
> > > > >
> > > > > On Mon, 2005-09-26 at 16:27 -0400, Matt Blum wrote:
> > > > >
> > > > > The XMLHttpRequest object (or the equivalent ActiveX control)'s open
> > > > method
> > > > > takes as its first argument the request method you want to use. So
you
> > > > > could make a get request simply by saying:
> > > > >
> > > > > xHR.open("GET", url[, asyncflag][, username][, password]);
> > > > >
> > > > > I believe that answers your question, but I'm not sure I understand
> > how
> > > > > that helps you. I mean, AJAX will return a text string, and possibly
a
> > > > > document object if the response is valid XML. It won't return an
> > image.
> > > > > The only way to load an image is, as you say, using the src property
> > of
> > > > the
> > > > > image object, and that will always do a GET. I don't see how you
get
> > > AJAX
> > > > > to work into this scenario, unless you plan to use it to generate
the
> > > URL
> > > > > for the image object to load.
> > > > >
> > > > > Or am I just missing something in your original message?
> > > > >
> > > > > -Matt
> > > > >
> > > > >
> > > > > On 9/26/05, Sylvain Vieujot <svieujot@apache.org> wrote:
> > > > >
> > > > > Hello,
> > > > >
> > > > > I'm trying to make a new component that would display an image, but
> > > > without
> > > > > the need to have a dedicated servlet.
> > > > > It would make applications that use images from a lot of different
> > > sources
> > > > > (i.e. servlets) much simpler.
> > > > > Basically, it would be a component like :
> > > > > <x:graphicImageAjax getBytesMethod="#{myBean.imageBytes}"/>
> > > > >
> > > > > As the only way I found to load an image in javascript is
> > > image.src="...",
> > > > > I can't use a post request.
> > > > >
> > > > > Does someone know a way either to load an image in javascript with
the
> > > > > result of a post request, or a way to use ajax like in
> > inputSuggestAjax,
> > > > but
> > > > > with a get url ?
> > > > >
> > > > > Thanks,
> > > > >
> > > > > Sylvain.
> > > > >
> > > > >
> > > >
> > > >
> > > > --
> > > >
> > > > http://www.irian.at
> > > > Your JSF powerhouse -
> > > > JSF Trainings in English and German
> > > >
> > > >
> > >
> > >
> >
> >
> > --
> > Mathias
> >
> >
> 
> 
> --
> Mathias

Mime
View raw message