Re: IAjaxIndicatorAware - busy indicator running forever

2017-03-06 Thread Martin Grigorov
Hi,

On Mon, Mar 6, 2017 at 11:06 PM, Sergiu  wrote:

> Hello,
> I have a main Panel implementing IAjaxIndicatorAware . The panel contains
> multiple AjaxTabbedPanel. and in one tab I have a form with a list of items
> and an AjaxButton that I use to trigger a download based on selected items.
> Now the content of the AjaxButton looks like this:
> AbstractResourceStreamWriter resourceStream = new
> AbstractResourceStreamWriter() {
> @Override
> public void write(OutputStream output) throws IOException {
> writeFileContent(output);
> };
> ResourceStreamRequestHandler handler = new
> ResourceStreamRequestHandler(resourceStream, "Package.zip")
> getRequestCycle().scheduleRequestHandlerAfterCurrent(handler);
>

The problem starts here.
getRequestCycle().scheduleRequestHandlerAfterCurrent(handler) basically
tells Wicket to throw away the AjaxRequestHandler and thus there is no Ajax
(XML) response that will hide the loading indicator.

To accomplish what you need you need to use
https://cwiki.apache.org/confluence/display/WICKET/AJAX+update+and+file+download+in+one+blow
The idea is that the Ajax response is a normal XML response that also
contains a redirect command that will trigger the download of the bibary in
another (non-Ajax) request.

This solution is used by many applications so we decided to include it in
Wicket itself: https://issues.apache.org/jira/browse/WICKET-6286


> ignore the ignore the
> It seems that scheduleRequestHandlerAfterCurrent leaves the busy indicator
> spinning forever after the download of the file gets completed. Is there
> anything that I am missing or is this a bug?
>
> I'm using Wicket 7.3
>
> --
> View this message in context: http://apache-wicket.1842946.n4.nabble.com/
> IAjaxIndicatorAware-busy-indicator-running-forever-tp4677251.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
>
>


IAjaxIndicatorAware - busy indicator running forever

2017-03-06 Thread Sergiu
Hello,
I have a main Panel implementing IAjaxIndicatorAware . The panel contains
multiple AjaxTabbedPanel. and in one tab I have a form with a list of items
and an AjaxButton that I use to trigger a download based on selected items.
Now the content of the AjaxButton looks like this:
AbstractResourceStreamWriter resourceStream = new
AbstractResourceStreamWriter() {
@Override
public void write(OutputStream output) throws IOException {
writeFileContent(output);
};
ResourceStreamRequestHandler handler = new
ResourceStreamRequestHandler(resourceStream, "Package.zip") 
getRequestCycle().scheduleRequestHandlerAfterCurrent(handler);

It seems that scheduleRequestHandlerAfterCurrent leaves the busy indicator
spinning forever after the download of the file gets completed. Is there
anything that I am missing or is this a bug?

I'm using Wicket 7.3  

--
View this message in context: 
http://apache-wicket.1842946.n4.nabble.com/IAjaxIndicatorAware-busy-indicator-running-forever-tp4677251.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



Re: Wicket 8 and servlet 3.1 async nio

2017-03-06 Thread Sven Meier

Hi,

I haven't seen async processing in real-life yet, so I can't really 
comment on its usefulness.


> my very first idea was to be able to serve more request with the same 
thread count


Most examples I've found just move processing to a different thread - as 
I have done it in my example too :(.
You'd be able to server more requests by utilizing a notification based 
API which doesn't block a thread, e.g. with async HTTP requests:|||

|

|   public void onClick() {|

||| Suspension suspension = getRequestCycle().suspend(5000);|  ||

httpclient.execute(request2, new FutureCallback()
{
  public void completed(final HttpResponse response) {
analyseResponse(response)

suspension.resume();
  }
});

>Any other thought is welcome.

Branch "suspend_request_cycle" is just a proof-of-concept. Regretfully 
at the moment I can't make use of it in any of my projects.


Have fun
Sven


On 04.03.2017 18:26, guillaume.mary wrote:

Hi,

Thank you for your code, I gave it a try and looked at it closer, and I'm
ont sure it feets a real need, well at least mine : it delegates the answer
to another thread, so it's as if we add a worker thread to the container,
kind of machine load. It is not what I expected : my very first idea was to
be able to serve more request with the same thread count, not to overload
the machine. I thought that async nio would allow this, but I'm far from an
expert about nio, even after reading more about it.
So even if your code works, I don't see a real benefit for Wicket, and even
less a feature for it.

Any other thought is welcome.

(I didn't post on @dev as you offered since we're more on a "feature"
discussion)

--
View this message in context: 
http://apache-wicket.1842946.n4.nabble.com/Wicket-8-and-servlet-3-1-async-nio-tp4677098p4677242.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





Re: Error: Not detached model found in Wicket session

2017-03-06 Thread Ihor Parashynets
hello Martin

Thank you for the update!

Best regards,
Ihor Parashynets

On 6 March 2017 at 12:40, Martin Grigorov  wrote:

> https://issues.apache.org/jira/browse/WICKET-6334
>
> On Fri, Mar 3, 2017 at 10:08 PM, Martin Grigorov <
> martin.grigo...@gmail.com>
> wrote:
>
> > Hi,
> >
> >
> >
> > On Mar 3, 2017 2:38 PM, "Ihor Parashynets"  wrote:
> >
> > Hi all
> >
> > I need some help/clarification on NotDetachedModelChecker. I've checked
> > markmail.org and found this one http://markmail.org/search/?q=
> > NotDetachedModelChecker#query:NotDetachedModelChecker%20list
> > %3Aorg.apache.wicket.users+page:1+mid:i77wqsp7hpbwgtyp+state:results
> > which is close but not the same what I'm facing at.
> >
> > Long story short:
> > 1. I have a Wicket Session, which has LoadableDetachableModel property.
> > 2. This property is being detached on public void detach() method.
> > 3. I have a Wicket test app that adds some additional config for tests'
> > purpose", like this
> >
> > public class TestWebApplication extends MyWebApplication {
> >
> > @Override
> > protected void init() {
> > super.init();
> >
> > //for test's purpose added some extended configuration
> > getRequestLoggerSettings().setRecordSessionSize(true);
> > getRequestLoggerSettings().setRequestLoggerEnabled(true);
> > getRequestLoggerSettings().setRequestsWindowSize(10);
> >
> > getFrameworkSettings().setSerializer(new 
> > JavaSerializer(getApplicationKey())
> {
> > @Override
> > protected ObjectOutputStream newObjectOutputStream(OutputStream
> out) throws IOException {
> > return new CheckingObjectOutputStream(out, new
> NotDetachedModelChecker());
> > }
> > });
> > }
> > }
> >
> > 4. I run the test and it passes but in log file I can see an error
> > message, that the model in Session is not detached. Even though I know
> that
> > it's detached properly.
> >
> > I checked the error stack trace and figured out that if there is a logger
> > enabled (getRequestLoggerSettings().setRequestLoggerEnabled(true)) in
> > combination with NotDetachedModelChecker then in AbstractRequestLogger#
> > requestTime(long timeTaken) there is a serialization of session (
> > sizeInBytes = session.getSizeInBytes()) to check the session size. But it
> > will trigger a chain, where session will be validated for detached models
> > (instance of LoadableDetachabelModel), which is to early (actually at
> > RequestCycle#onDetach() --> listeners#onDetach(this))  such as Session
> will
> > be detach only one step later.
> >
> > I've attached a simple maven project (I was trying to mimic our big real
> > Wicket project) to show the use-case. It's enough to run:  mvn
> > -Dtest=TestNonDetachableModels test to see the error message.
> >
> > And now is the question: do I use it wrong (I mean
> NotDetachedModelChecker)
> > or is there another explanation for such error?
> >
> >
> > It seems Wicket doesn't detach the Session before calculating its size
> and
> > this leads to the error log..
> > I don't have access to the code at the moment but I know that Wicket
> > detaches the Components before calculating their size.
> > I'll be able to say more at Monday.
> >
> >
> > Thank you in advance.
> >
> > --
> > Best regards,
> > Ihor Parashynets
> >
> >
> > -
> > To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
> > For additional commands, e-mail: users-h...@wicket.apache.org
> >
> >
> >
>



-- 
Best regards,
Ihor Parashynets


Re: Error: Not detached model found in Wicket session

2017-03-06 Thread Martin Grigorov
https://issues.apache.org/jira/browse/WICKET-6334

On Fri, Mar 3, 2017 at 10:08 PM, Martin Grigorov 
wrote:

> Hi,
>
>
>
> On Mar 3, 2017 2:38 PM, "Ihor Parashynets"  wrote:
>
> Hi all
>
> I need some help/clarification on NotDetachedModelChecker. I've checked
> markmail.org and found this one http://markmail.org/search/?q=
> NotDetachedModelChecker#query:NotDetachedModelChecker%20list
> %3Aorg.apache.wicket.users+page:1+mid:i77wqsp7hpbwgtyp+state:results
> which is close but not the same what I'm facing at.
>
> Long story short:
> 1. I have a Wicket Session, which has LoadableDetachableModel property.
> 2. This property is being detached on public void detach() method.
> 3. I have a Wicket test app that adds some additional config for tests'
> purpose", like this
>
> public class TestWebApplication extends MyWebApplication {
>
> @Override
> protected void init() {
> super.init();
>
> //for test's purpose added some extended configuration
> getRequestLoggerSettings().setRecordSessionSize(true);
> getRequestLoggerSettings().setRequestLoggerEnabled(true);
> getRequestLoggerSettings().setRequestsWindowSize(10);
>
> getFrameworkSettings().setSerializer(new 
> JavaSerializer(getApplicationKey()) {
> @Override
> protected ObjectOutputStream newObjectOutputStream(OutputStream 
> out) throws IOException {
> return new CheckingObjectOutputStream(out, new 
> NotDetachedModelChecker());
> }
> });
> }
> }
>
> 4. I run the test and it passes but in log file I can see an error
> message, that the model in Session is not detached. Even though I know that
> it's detached properly.
>
> I checked the error stack trace and figured out that if there is a logger
> enabled (getRequestLoggerSettings().setRequestLoggerEnabled(true)) in
> combination with NotDetachedModelChecker then in AbstractRequestLogger#
> requestTime(long timeTaken) there is a serialization of session (
> sizeInBytes = session.getSizeInBytes()) to check the session size. But it
> will trigger a chain, where session will be validated for detached models
> (instance of LoadableDetachabelModel), which is to early (actually at
> RequestCycle#onDetach() --> listeners#onDetach(this))  such as Session will
> be detach only one step later.
>
> I've attached a simple maven project (I was trying to mimic our big real
> Wicket project) to show the use-case. It's enough to run:  mvn
> -Dtest=TestNonDetachableModels test to see the error message.
>
> And now is the question: do I use it wrong (I mean NotDetachedModelChecker)
> or is there another explanation for such error?
>
>
> It seems Wicket doesn't detach the Session before calculating its size and
> this leads to the error log..
> I don't have access to the code at the moment but I know that Wicket
> detaches the Components before calculating their size.
> I'll be able to say more at Monday.
>
>
> Thank you in advance.
>
> --
> Best regards,
> Ihor Parashynets
>
>
> -
> To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
> For additional commands, e-mail: users-h...@wicket.apache.org
>
>
>


Re: Websockets for graph data streaming

2017-03-06 Thread Martin Grigorov
Hi,


On Mon, Mar 6, 2017 at 3:57 AM, Gonzalo Aguilar Delgado <
gagui...@aguilardelgado.com> wrote:

> Hello,
>
> I'm using the fantastic Decebals dashboard, adding a widget json
> registry and some other improvements. The idea is to provide data
> streaming functionality like the one provided by graphana, kibana and
> friends.
>
> So the server will contain the datasources. And the dashboard will apply
> to one or more datasources on the server.
>
> But I don't know what's the best way to go with wicket.
>
> My first idea is to provide a websocket connection with a DataManager
> for each user dashboard (only 1 at a time active), subscribe to
> datasources, and receive the streaming over the websockets. The
> DataManager then will keep track of what topic each chart wants to
> receive and multiplex the result to each chart via Javascript.
>
> This way there's only 1 connection to the server. But data can be shared
> among widgets. I suppose it's not easy task.
>
> The other way is do ajax with each chart. But I think this would make a
> lot of calls to the server and I suppose it's not scalable.
>
> S. What's the best way to go?!
>

I'd use WebSockets for this!


>
>
> Any good chart integration on wicket apart of highcharts? D3js or
> similar...
>

The demo app for
http://wicketinaction.com/2012/07/wicket-6-native-websockets/ uses Google
Charts library without any Wicket component integration.


>
>
> Preview of the current work is this link:
>
> https://pbs.twimg.com/media/C6M_hG6WYAEeysz.jpg
>
>
>