Re: Wicket AjaxButton multiple responses

2010-09-14 Thread DmitryM

Igor,

I responded in another topic and I'm closing this one.
Basically, simple HTML streaming into IFrame just works for me.

The topic about 'live' html streaming is here (for anyone interested):
http://apache-wicket.1842946.n4.nabble.com/Live-streaming-on-Link-click-td2533475.html#a2533475
http://apache-wicket.1842946.n4.nabble.com/Live-streaming-on-Link-click-td2533475.html#a2533475
 

Thanks,
Dmitry
-- 
View this message in context: 
http://apache-wicket.1842946.n4.nabble.com/Wicket-AjaxButton-multiple-responses-tp2525096p2539294.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: HTML streaming on Link click

2010-09-12 Thread DmitryM

Okay, guys.
That was kind of 'false alarm'.
The output cache is on the NGINX level I have as a load balancer.

Wicket implementation itself works as expected.
A couple of notes here (for anybody interested in the topic):
- always add a 1Kb of 'padding' text in the beginning of the response (to
make browsers recognize the fact the stream data started to come)
- always do flush on the output stream after each 'meaningful' data chunk
written to the stream (to make it delivered to the browser)

That's it. 
Closing the topic.
-- 
View this message in context: 
http://apache-wicket.1842946.n4.nabble.com/Live-streaming-on-Link-click-tp2533475p2536127.html
Sent from the Wicket - User 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: HTML streaming on Link click

2010-09-09 Thread DmitryM

Rodolfo,

If you're asking about Wicket application settings, then yes, it's set to
default 2-pass request processing with buffered pages rendering.

I thought the way the link is implemented it should not matter since I
thought I would write directly into the HttpServlet output stream.
And I really see the 

((WebResponse)requestCycle.getResponse()).getHttpServletResponse().getOutputStream()

returns me an instance of something from the web server itself (in my case
it's Jetty HttpConnection$Output)

Did I miss something?

-Dmitry
-- 
View this message in context: 
http://apache-wicket.1842946.n4.nabble.com/Live-streaming-on-Link-click-tp2533475p2533591.html
Sent from the Wicket - User 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: HTML streaming on Link click

2010-09-09 Thread DmitryM

Rodolfo,

No, I didn't test it w/WireShark or similar packet sniffer.
I can give it a shot...
I only tested it in Safari and FireFox (the matter is I only care about
Safari, or, rather, WebKit) for now, this would be an app to be accessed
from the phone.

The behaviour of the browsers (including iPhone Safari) is the same. I
click/tap the link, the browser waits for those 5 seconds I set up... then
displays 1st alert and after clicking/tapping OK immediately displays the
2nd alert.

Very frustrating. =(

-Dmitry
-- 
View this message in context: 
http://apache-wicket.1842946.n4.nabble.com/Live-streaming-on-Link-click-tp2533475p2533644.html
Sent from the Wicket - User 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



Wicket AjaxButton multiple responses

2010-09-02 Thread DmitryM

Hello, everybody

I have a long-running Ajax request (about 7 seconds) and would like to
notify user about its progress.
A preferred way would be to push multiple ajax responses back to the
Response (for the current request).

Is there any way to do that?
I would prefer to avoid using 'push' from the server since it doesn't
support Comet anyway.

I can do a kind of lame implementation via JavaScript (to display fake
process status updates) but would prefer something corresponding to the
actual request processing status.
Any other suggestions?

Regards,
Dmitry
-- 
View this message in context: 
http://apache-wicket.1842946.n4.nabble.com/Wicket-AjaxButton-multiple-responses-tp2525096p2525096.html
Sent from the Wicket - User 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 AjaxButton multiple responses

2010-09-02 Thread DmitryM

Thanks for the immediate response.

But that's not really what I was asking for. =(
I didn't really want to start a session-attached thread on the server and
then poll it for the status.

I would really appreciate if the AjaxButton.onSubmit allowed for several XML
responses to be pushed down the response output stream to be picket up in
the browser.
I would push some Javascript calls which would update the page to indicate
the request processing progress.

That would save on requests (only one request would be made to the server).
I appreciate the fact it's like AjaxStreaming and may not be supported
consistently by all browsers. =(
Right now I'm only concerned about WebKit (mobile Safari).

Regards,
Dmitry

-- 
View this message in context: 
http://apache-wicket.1842946.n4.nabble.com/Wicket-AjaxButton-multiple-responses-tp2525096p2525149.html
Sent from the Wicket - User 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 AjaxButton multiple responses

2010-09-02 Thread DmitryM

Igor, one more thing:

I can probably 'hack' the system and try to get to the current request's
response output stream and even make up a chunk of XML emulating an ajax
response.

But most likely the client Wicket javascript would not allow for multiple
XML chunks returned from one request.
Am I right here?

-Dmitry
-- 
View this message in context: 
http://apache-wicket.1842946.n4.nabble.com/Wicket-AjaxButton-multiple-responses-tp2525096p2525151.html
Sent from the Wicket - User 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: DynamicWebResource duplicate request

2010-08-17 Thread DmitryM

Missed an obvious thing (use the source, Luke) - there is the getLength()
method on the resourcestate (which also needs to load the data).
So, needed more accurate implementation of the getResourceState.

Closing the topic.
-- 
View this message in context: 
http://apache-wicket.1842946.n4.nabble.com/DynamicWebResource-duplicate-request-tp2327741p2328645.html
Sent from the Wicket - User 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



DynamicWebResource double request

2010-08-16 Thread DmitryM

Hello, guys

Can you please advise me on the proper implementation of the
DynamicWebResource subclass?

When I override the abstract methods I see that my getResourceState() is
called twice.
The resource is registered in Wicket and is used to generate a JavaScript
data.

Thanks,
Dmitry
-- 
View this message in context: 
http://apache-wicket.1842946.n4.nabble.com/DynamicWebResource-double-request-tp2327741p2327741.html
Sent from the Wicket - User 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: AjaxRequestTarget.appendJavascript broken arrays

2010-07-19 Thread DmitryM

Double checked.
Confirming no issue (probably my JS was broken at the time of initial
testing).

-Dmitry
-- 
View this message in context: 
http://apache-wicket.1842946.n4.nabble.com/AjaxRequestTarget-appendJavascript-broken-arrays-tp2290353p2294403.html
Sent from the Wicket - User 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



AjaxRequestTarget.appendJavascript broken arrays

2010-07-15 Thread DmitryM

Hello, guys

I've noticed one thing recently (could not find anything related in the
forum).
My Wicket is 1.4.9 and I needed a JSON data with arrays which is attached to
the Ajax response.

Currently I see that all arrays' closing brackets ']' are turned into ']^'
which technically breaks my JSON (and even simple javascript) being
returned.

Is it a bug or an expected behavior and I can do something about it?

Because when Ajax response is being evaluated javascript gets parsing error
and I'm not sure I have any control over it.

Thanks,
Dmitry
-- 
View this message in context: 
http://apache-wicket.1842946.n4.nabble.com/AjaxRequestTarget-appendJavascript-broken-arrays-tp2290353p2290353.html
Sent from the Wicket - User 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: AjaxRequestTarget.appendJavascript broken arrays

2010-07-15 Thread DmitryM

Okay, I will double check that (since it's still in the XML response coming
back to the page)
-- 
View this message in context: 
http://apache-wicket.1842946.n4.nabble.com/AjaxRequestTarget-appendJavascript-broken-arrays-tp2290353p2290924.html
Sent from the Wicket - User 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: SessionStore life cycle in cluster?

2010-06-04 Thread DmitryM

Igor,

Can you please comment on the following couple of points I got?

1. Pulling session from memcached node: I double checked the
recommendation and it looks like fetching session from the memcached node
doesn't take much time (around 200ms at most). But there was a
recommendation about immediate session attributes deserialization after
session replication
(http://apache-wicket.1842946.n4.nabble.com/A-few-clustering-questions-td1863992.html#a1863993).
Do you think it may be a potential issue causing the request processing
delay I experienced?

2. The memcached-session-manager's developer suggested I could try to use
plain HttpSessionStore (instead of default SecondLevelCacheSessionStore).
But when I tried his suggestion I got the following stacktrace:

java.lang.ExceptionInInitializerError
at sun.misc.Unsafe.ensureClassInitialized(Native Method)
at
sun.reflect.UnsafeFieldAccessorFactory.newFieldAccessor(UnsafeFieldAccessorFactory.java:25)
at
sun.reflect.ReflectionFactory.newFieldAccessor(ReflectionFactory.java:122)
at java.lang.reflect.Field.acquireFieldAccessor(Field.java:918)
at java.lang.reflect.Field.getFieldAccessor(Field.java:899)
at java.lang.reflect.Field.getLong(Field.java:528)
at 
java.io.ObjectStreamClass.getDeclaredSUID(ObjectStreamClass.java:1614)
at java.io.ObjectStreamClass.access$700(ObjectStreamClass.java:52)
at java.io.ObjectStreamClass$2.run(ObjectStreamClass.java:425)
at java.security.AccessController.doPrivileged(Native Method)
at java.io.ObjectStreamClass.init(ObjectStreamClass.java:413)
at java.io.ObjectStreamClass.lookup(ObjectStreamClass.java:310)
at java.io.ObjectStreamClass.initNonProxy(ObjectStreamClass.java:547)
at 
java.io.ObjectInputStream.readNonProxyDesc(ObjectInputStream.java:1583)
at java.io.ObjectInputStream.readClassDesc(ObjectInputStream.java:1496)
at
java.io.ObjectInputStream.readOrdinaryObject(ObjectInputStream.java:1732)
at java.io.ObjectInputStream.readObject0(ObjectInputStream.java:1329)
at 
java.io.ObjectInputStream.defaultReadFields(ObjectInputStream.java:1947)
at java.io.ObjectInputStream.readSerialData(ObjectInputStream.java:1871)
at
java.io.ObjectInputStream.readOrdinaryObject(ObjectInputStream.java:1753)
at java.io.ObjectInputStream.readObject0(ObjectInputStream.java:1329)
at 
java.io.ObjectInputStream.defaultReadFields(ObjectInputStream.java:1947)
at java.io.ObjectInputStream.readSerialData(ObjectInputStream.java:1871)
at
java.io.ObjectInputStream.readOrdinaryObject(ObjectInputStream.java:1753)
at java.io.ObjectInputStream.readObject0(ObjectInputStream.java:1329)
at 
java.io.ObjectInputStream.defaultReadFields(ObjectInputStream.java:1947)
at 
java.io.ObjectInputStream.defaultReadObject(ObjectInputStream.java:480)
at org.apache.wicket.Component.readObject(Component.java:4457)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
at 
java.io.ObjectStreamClass.invokeReadObject(ObjectStreamClass.java:974)
at java.io.ObjectInputStream.readSerialData(ObjectInputStream.java:1849)
at
java.io.ObjectInputStream.readOrdinaryObject(ObjectInputStream.java:1753)
at java.io.ObjectInputStream.readObject0(ObjectInputStream.java:1329)
at java.io.ObjectInputStream.readArray(ObjectInputStream.java:1667)
at java.io.ObjectInputStream.readObject0(ObjectInputStream.java:1323)
at 
java.io.ObjectInputStream.defaultReadFields(ObjectInputStream.java:1947)
at java.io.ObjectInputStream.readSerialData(ObjectInputStream.java:1871)
at
java.io.ObjectInputStream.readOrdinaryObject(ObjectInputStream.java:1753)
at java.io.ObjectInputStream.readObject0(ObjectInputStream.java:1329)
at java.io.ObjectInputStream.readArray(ObjectInputStream.java:1667)
at java.io.ObjectInputStream.readObject0(ObjectInputStream.java:1323)
at 
java.io.ObjectInputStream.defaultReadFields(ObjectInputStream.java:1947)
at java.io.ObjectInputStream.readSerialData(ObjectInputStream.java:1871)
at
java.io.ObjectInputStream.readOrdinaryObject(ObjectInputStream.java:1753)
at java.io.ObjectInputStream.readObject0(ObjectInputStream.java:1329)
at java.io.ObjectInputStream.readArray(ObjectInputStream.java:1667)
at java.io.ObjectInputStream.readObject0(ObjectInputStream.java:1323)
at 
java.io.ObjectInputStream.defaultReadFields(ObjectInputStream.java:1947)
at java.io.ObjectInputStream.readSerialData(ObjectInputStream.java:1871)
at

SessionStore life cycle in cluster?

2010-06-03 Thread DmitryM

Hello, guys

I managed to have Tomcat cluster working with memcached-session-manager
(http://groups.google.com/group/memcached-session-manager) from Martin.

Everything works perfectly fine unless tomcats start getting shut down.
I have 2 tomcats running with the session replicated (see above). Then I
shut down one of them.
When on a page with ajax behavior after I click an ajax button the response
to the request gets delayed (about 2-3 seconds extra compared to the case
when all tomcats are live and running).

I tried this with Wicket's SecondLevelCacheSessionStore(+ DiskPageStore, I
assume) and I also tried to use a Hazelcast-based PageStore (ex. from here:
http://wicketbyexample.com/apache-wicket-clustering-with-multiple-options/).
That bizarre delay happens in both cases.

Can anyone please try to come up with some explanation what may be happening
in that case?
I guess, the scenario is as follows:
- tomcat cluster with proper session distribution in place,
- request hits tomcat1 and gets page with ajax button
- tomcat1 is shutdown
- ajax button is clicked
- request hits tomcat2 and gets processed successfully (but with delay)

Thanks in advance,
Dmitry
-- 
View this message in context: 
http://apache-wicket.1842946.n4.nabble.com/SessionStore-life-cycle-in-cluster-tp2242105p2242105.html
Sent from the Wicket - User 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: SessionStore life cycle in cluster?

2010-06-03 Thread DmitryM

Only the very first one.

I'm not 100% sure but the session seems to be always retrieved from
memcached...

That's what I don't quite understand. When all nodes/tomcats in the cluster
are up then request are fast.
And the thing is, if that's not an Ajax action, then the request is
responded at the same speed (like switching between pages in the app).

-Dmitry
-- 
View this message in context: 
http://apache-wicket.1842946.n4.nabble.com/SessionStore-life-cycle-in-cluster-tp2242105p2242134.html
Sent from the Wicket - User 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: SessionStore life cycle in cluster?

2010-06-03 Thread DmitryM

Igor,

I was wrong.
When it's a first request hitting a page (after shutting down one of 2
tomcats) then regardless of the type of request (ajax or bookmarkable page
link) there is a delay of 2+ seconds.

-Dmitry
-- 
View this message in context: 
http://apache-wicket.1842946.n4.nabble.com/SessionStore-life-cycle-in-cluster-tp2242105p2242198.html
Sent from the Wicket - User 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 clustering without web server clustering

2010-05-30 Thread DmitryM

Martin,

Thanks a lot for the reply.
Actually, I would appreciate if you helped me.
I tried your tomcat session manager with my wicket app.
I followed the configuration instructions for Tomcat you listed on the
session manager page.
But it didn't seem to work for ajax requests.
I believe I used sticky haproxy configuration (to add  session id to the
request) but it still blew up with PageExpiredException on ajax requests.

And there is even more significant issue: the protocol will eventually be
secured (https) and haproxy (used in production) wouldn't be able to support
sticky sessions in that case.

I can verify one more time my configuration (to make sure I use sticky
sessions, sync session storage/retrieval, same request renderng etc.) and
will let you know if it worked for me or not.

Thanks,
Dmitry
-- 
View this message in context: 
http://apache-wicket.1842946.n4.nabble.com/Wicket-clustering-without-web-server-clustering-tp2234048p2236689.html
Sent from the Wicket - User 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 clustering without web server clustering

2010-05-28 Thread DmitryM

Thanks a lot for a prompt response, Jeremy


Jeremy Thomerson wrote:
 
 A lot of stuff is stored in the session:
 
 https://svn.apache.org/repos/asf/wicket/branches/wicket-1.4.x/wicket/src/main/java/org/apache/wicket/Session.java
 

Well, I'm know about this class (probably, not that much as really
needed)...
It doesn't seem to have _a lot_ of stuff (those transient fields don't get
replicated with session clustering, do they?)...

Do you know if _all_ that stuff (which will be serialized when clustered) is
absolutely needed for the app?
Like app meta data... or usedPageMaps (to me it shows as empty collection in
debugger)...

Thanks again,
Dmitry

-- 
View this message in context: 
http://apache-wicket.1842946.n4.nabble.com/Wicket-clustering-without-web-server-clustering-tp2234048p2234132.html
Sent from the Wicket - User 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 clustering without web server clustering

2010-05-28 Thread DmitryM

Jeremy,

That makes perfect sense.
I will look into it.

Regards,
Dmitry
-- 
View this message in context: 
http://apache-wicket.1842946.n4.nabble.com/Wicket-clustering-without-web-server-clustering-tp2234048p2234170.html
Sent from the Wicket - User 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



Wicket clustering without web server clustering

2010-05-27 Thread DmitryM

Hello, guys

I need your advice for the following case.
The Wicket application I'm working on is supposed to be deployed to Amazon
EC2 cloud. This way standard Tomcat (used as a webapp container) clustering
won't work (cloud doesn't accept multicasts). There is a third-party session
manager available for Tomcat but it still needs sticky sessions from the
load balancer (which is not conceptually good for app scaling).

I tried Hazelcast distributed data support (which allows for TCP unicasts)
as a PageStore implementation (thanks this blog post:
http://wicketbyexample.com/apache-wicket-clustering-with-multiple-options/)
It works fine but needs session clustering (though Hazelcast makes PageStore
available for each webapp instance already which seems to be an overhead.
And I would like to use Hazelcast alone for this kind of 'clustering').

My question is about non-sticky sessions w/o clustering. I can try to extend
SecondLevelCacheSessionStore to get the PageStore/page map etc. from
Hazelcast and stick it to a newly created session (when load balancer
forwards a request to the server which is different from the session's
original server).

But do I need to try to transfer something else except for the PageMap to
the fresh session (the webapp doesn't store anything in the Http session
directly)?

I mean, does Wicket store anything else for its functional purposes in the
Http Session (which I may need to distribute via Hazelcast)?

Thanks,
Dmitry
-- 
View this message in context: 
http://apache-wicket.1842946.n4.nabble.com/Wicket-clustering-without-web-server-clustering-tp2234048p2234048.html
Sent from the Wicket - User 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: Exception propagation

2010-04-19 Thread DmitryM

Okay, eventually I figured that out myself:

- so, as per the wiki, the web.xml should have the following for the wicket
filter:

filter-mapping
filter-namewicket/filter-name
url-pattern/*/url-pattern
dispatcherREQUEST/dispatcher
dispatcherERROR/dispatcher
/filter-mapping

- the WebApplication subclass would have something like this (may be
unconditional if needed for both development and deployment modes):

if (DEPLOYMENT.equalsIgnoreCase(getConfigurationType())) {

getExceptionSettings().setUnexpectedExceptionDisplay(IExceptionSettings.SHOW_NO_EXCEPTION_PAGE);
}

...

public final RequestCycle newRequestCycle(final Request request, final
Response response) {
return new ExceptionHandlingRequestCycle (this, (WebRequest)request,
(WebResponse)response);
}


- the exception handling request cycle subclass would have (again, may be
unconditional if needed for both development and deployment modes)

public final Page onRuntimeException(final Page page, final
RuntimeException e) {
if
(WebApplication.DEPLOYMENT.equalsIgnoreCase(getApplication().getConfigurationType()))
{
throw new
AbortWithWebErrorCodeException(HttpServletResponse.SC_INTERNAL_SERVER_ERROR);
} else {
return super.onRuntimeException(page, e);
}
}

Note the AbortWithWebErrorCodeException - it's not the
AbortWithHttpStatusException (which doesn't work).

- now in the web.xml you can have:

error-page
error-code500/error-code
location/xxx/location
/error-page

/xxx may be either another wicket mounted path or it may be a static
resource not managed by wicket. Now you have standard (specwise) error
handling support in the web app.
-- 
View this message in context: 
http://n4.nabble.com/Exception-propagation-tp1934370p2016271.html
Sent from the Wicket - User 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