Re: How to get PageClass from BufferedResponseRequestHandler ? And how to "link" related requests?

2014-06-16 Thread Hendy Irawan
It seems ignoring BufferedResponseRequestHandler is harder than I thought
because IResponseFilter is only called during
BufferedResponseRequestHandler, not during the preceding
IPageRequestHandler.

What is the best way to achieve my goal? i.e. during the begin and end of
IPageRequestHandler I need to perform tasks
(i.e. noting the start values, calculating the delta of values during
request processing, and then manipulate the response).

for begin and end we have RequestCycleListener.onRequestHandlerResolved and
onEndRequest, but I don't know how to manipulate the response there (in
onEndRequest)??

The response manipulation is quite simple (adding dynamic JavaScripts before
) but I'd like to do it in CPU-efficient way if possible.

Hendy

--
View this message in context: 
http://apache-wicket.1842946.n4.nabble.com/How-to-get-PageClass-from-BufferedResponseRequestHandler-And-how-to-link-related-requests-tp4666247p4666282.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: Custom RequestLogger

2014-06-16 Thread Martin Grigorov
If the request handler is not ILoggableRequestHandler then there is no data
to log ...

BufferedResponseRequestHandler is a special handler that just writes the
buffered response (a String) to the web response after redirect. It doesn't
do any processing

Martin Grigorov
Wicket Training and Consulting


On Mon, Jun 16, 2014 at 5:34 PM, rexar  wrote:

> Then I will not logging some pages. Instead I want to know WHY and WHEN
> some
> pages cannot be cast to ILoggableRequestHandler and how I can fix it.
>
> --
> View this message in context:
> http://apache-wicket.1842946.n4.nabble.com/Custom-RequestLogger-tp4665676p4666278.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: Custom RequestLogger

2014-06-16 Thread rexar
Then I will not logging some pages. Instead I want to know WHY and WHEN some
pages cannot be cast to ILoggableRequestHandler and how I can fix it.

--
View this message in context: 
http://apache-wicket.1842946.n4.nabble.com/Custom-RequestLogger-tp4665676p4666278.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: Custom RequestLogger

2014-06-16 Thread Martin Grigorov
Hi,


On Mon, Jun 16, 2014 at 5:17 PM, rexar  wrote:

> Hi Martin!
>
> Thank you for advice, but now I have another problem :(
> In my RequestLogger class I do next:
>
> /@Override
> protected void log(RequestData rd, SessionData sd)
> {
> Long requestDuration = rd.getTimeTaken();
> IRequestHandler requesthandler = rd.getEventTarget();
> if(requesthandler != null) {
>

change the line above to:
if (requesthandler instanceof ILoggableRequestHandler) {


> ILogData logData = ((ILoggableRequestHandler)
> requesthandler).getLogData();
> String requestHandlerData = logData.toString();
>
> Map handlerData =
> parseHandlerData(requestHandlerData);
>
> Tuple2 monitorinProperties =
> makeMonitoringProperties(handlerData);
> monitoring.add(monitorinProperties.e1, monitorinProperties.e2,
> MonblankConst.MS, requestDuration);
> }
> }/
>
> But sometimes I have an exception:
> HTTP Status 500 -
> org.apache.wicket.core.request.handler.BufferedResponseRequestHandler
> cannot
> be cast to org.apache.wicket.request.ILoggableRequestHandler
>
> It appears when trying onSubmit on Form on some ExternalPage. Actually I
> cant say more concrete, because there is project-specific.
>
> --
> View this message in context:
> http://apache-wicket.1842946.n4.nabble.com/Custom-RequestLogger-tp4665676p4666276.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: Custom RequestLogger

2014-06-16 Thread rexar
Hi Martin!

Thank you for advice, but now I have another problem :(
In my RequestLogger class I do next:

/@Override
protected void log(RequestData rd, SessionData sd)
{
Long requestDuration = rd.getTimeTaken();
IRequestHandler requesthandler = rd.getEventTarget();
if(requesthandler != null) {
ILogData logData = ((ILoggableRequestHandler)
requesthandler).getLogData();
String requestHandlerData = logData.toString();

Map handlerData =
parseHandlerData(requestHandlerData);

Tuple2 monitorinProperties =
makeMonitoringProperties(handlerData);
monitoring.add(monitorinProperties.e1, monitorinProperties.e2,
MonblankConst.MS, requestDuration);
}
}/

But sometimes I have an exception:
HTTP Status 500 -
org.apache.wicket.core.request.handler.BufferedResponseRequestHandler cannot
be cast to org.apache.wicket.request.ILoggableRequestHandler

It appears when trying onSubmit on Form on some ExternalPage. Actually I
cant say more concrete, because there is project-specific.

--
View this message in context: 
http://apache-wicket.1842946.n4.nabble.com/Custom-RequestLogger-tp4665676p4666276.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 urls - how to change "get" url to instance cached one

2014-06-16 Thread Martin Grigorov
On Mon, Jun 16, 2014 at 2:06 PM, Yoav Stern  wrote:

> Scenario :
> When I
> 1.reach Page B using empty c'tor (B1)
> 2.change it using ajax (where as you have mentioned this page already has
> pageId where the one with the get url didnt !!!)
>

I guess it would be easier if you use some short use case descriptions with
sample urls.
It is hard for me to understand which page is "the one with the get url"

If Page B has Ajax component/behavior then it is a stateful page and must
have a pageId in the url.
Do you by chance use IRequestCycleSettings#ONE_PASS_RENDER or any custom
IRequestMapper that removes the page id from the url ?


> 3.move to page C
> 4.return to page B (the same B1)
>
>
> I want the same behavior in all the application pages,what should I do in
> order to get this behavior ?
>
> I thought about writing a middle page , redirect Page that will attach to
> my page page Id and manually admin it , bd idea and will cost me a lot
> !!
> so is there another Idea u can help me with please .
>
> martin thank u for all the help .
>
>
>
>
>
>
> On Mon, Jun 16, 2014 at 2:51 PM, Martin Grigorov 
> wrote:
>
> > Once again - please users@ mailing list for this kind of questions!
> >
> > When page B is loaded Wicket stores it in the disk - the key is
> > sessionId+pageId.
> > When you do Ajax calls to page B the sessionId and the pageId do not
> change
> > and Wicket overrides the old entry in the disk with the new one, i.e. the
> > new state of page B (B1) is stored over the initial state (B0).
> > When you go to page C and then go back Wicket will load B1.
> >
> > The above will fail only if B1 instance is not serializable. In this case
> > Wicket will log an error in the server logs and B0 won't be overridden.
> >
> > Martin Grigorov
> > Wicket Training and Consulting
> >
> >
> > On Mon, Jun 16, 2014 at 1:37 PM, Yoav Stern 
> > wrote:
> >
> > > in addition to what i have described
> > > I have Page A which redirect using the next link :
> > >
> > > Link link = new Link(propertyName) {
> > >
> > > private static final long serialVersionUID = 1L;
> > >
> > > @Override
> > > public void onClick() {
> > >  getRequestCycle().setResponsePage(HomePage.class, params);
> > > };
> > > };
> > >
> > >
> > > after this link get submited there is a url
> > >
> > >
> >
> http://localhost:8080/tp-backoffice/?navigateTo=Accounts+List&filterBy=online,true
> > > (this is page B )
> > > where the last (navigateTo=Accounts+List&filterBy=online,true) is sent
> > via
> > > the pageParameters to HomePage(pageParameters).
> > >
> > > now I am changing stuff inside B Model by doing Ajax Call which render
> > one
> > > section in this page (this is a list filter and I want the client to
> use
> > in
> > > his travel to this page) , lets call this page instance B1.
> > >
> > > now I once more click on link similer to the on above and I have
> reached
> > > page C .
> > >
> > > I see page C and want to come back to B1.
> > >
> > > when I use the browser back button I get B2 ,
> HomePage(pageParameters)
> > is
> > > called once again , but I want that even though I used get call I would
> > get
> > > http://localhost:8080/tp-backoffice/?2
> > > where 2 shows that the page i am looking for is instance B1
> > >
> > > what am I doing wrong ?
> > >
> > >
> > >
> > > On Mon, Jun 16, 2014 at 11:57 AM, Martin Grigorov <
> mgrigo...@apache.org>
> > > wrote:
> > >
> > > > http://markmail.org/message/bk5zwpx5w7xdlkoa
> > > >
> > > > please write to users@ for this kind of questions
> > > >
> > > > Martin Grigorov
> > > > Wicket Training and Consulting
> > > >
> > > >
> > > > On Mon, Jun 16, 2014 at 10:51 AM, Yoav Stern  >
> > > > wrote:
> > > >
> > > > > I am using wicket in my web application. Assuming I have pages a b
> c
> > > > where
> > > > > I move from A to B using page parameters change something in page B
> > > model
> > > > > using ajax and B to C (without using page params).
> > > > >
> > > > > problem : The scenario is moving A->B->C while changing page b
> model
> > > and
> > > > > pressing the back button B<-C cause when page B instance (B1)was
> > > > generated
> > > > > I used get parameters , therefore a new page B instance was
> > > > generated(B2) I
> > > > > would like to return every time to page B
> > > > >
> > > > > is there a wicket style solution to this problem ?
> > > > >
> > > > > thank u for getting this far in my post :).
> > > > >
> > > >
> > >
> >
>


Re: wicket urls - how to change "get" url to instance cached one

2014-06-16 Thread Yoav Stern
Scenario :
When I
1.reach Page B using empty c'tor (B1)
2.change it using ajax (where as you have mentioned this page already has
pageId where the one with the get url didnt !!!)
3.move to page C
4.return to page B (the same B1)


I want the same behavior in all the application pages,what should I do in
order to get this behavior ?

I thought about writing a middle page , redirect Page that will attach to
my page page Id and manually admin it , bd idea and will cost me a lot
!!
so is there another Idea u can help me with please .

martin thank u for all the help .






On Mon, Jun 16, 2014 at 2:51 PM, Martin Grigorov 
wrote:

> Once again - please users@ mailing list for this kind of questions!
>
> When page B is loaded Wicket stores it in the disk - the key is
> sessionId+pageId.
> When you do Ajax calls to page B the sessionId and the pageId do not change
> and Wicket overrides the old entry in the disk with the new one, i.e. the
> new state of page B (B1) is stored over the initial state (B0).
> When you go to page C and then go back Wicket will load B1.
>
> The above will fail only if B1 instance is not serializable. In this case
> Wicket will log an error in the server logs and B0 won't be overridden.
>
> Martin Grigorov
> Wicket Training and Consulting
>
>
> On Mon, Jun 16, 2014 at 1:37 PM, Yoav Stern 
> wrote:
>
> > in addition to what i have described
> > I have Page A which redirect using the next link :
> >
> > Link link = new Link(propertyName) {
> >
> > private static final long serialVersionUID = 1L;
> >
> > @Override
> > public void onClick() {
> >  getRequestCycle().setResponsePage(HomePage.class, params);
> > };
> > };
> >
> >
> > after this link get submited there is a url
> >
> >
> http://localhost:8080/tp-backoffice/?navigateTo=Accounts+List&filterBy=online,true
> > (this is page B )
> > where the last (navigateTo=Accounts+List&filterBy=online,true) is sent
> via
> > the pageParameters to HomePage(pageParameters).
> >
> > now I am changing stuff inside B Model by doing Ajax Call which render
> one
> > section in this page (this is a list filter and I want the client to use
> in
> > his travel to this page) , lets call this page instance B1.
> >
> > now I once more click on link similer to the on above and I have reached
> > page C .
> >
> > I see page C and want to come back to B1.
> >
> > when I use the browser back button I get B2 ,   HomePage(pageParameters)
> is
> > called once again , but I want that even though I used get call I would
> get
> > http://localhost:8080/tp-backoffice/?2
> > where 2 shows that the page i am looking for is instance B1
> >
> > what am I doing wrong ?
> >
> >
> >
> > On Mon, Jun 16, 2014 at 11:57 AM, Martin Grigorov 
> > wrote:
> >
> > > http://markmail.org/message/bk5zwpx5w7xdlkoa
> > >
> > > please write to users@ for this kind of questions
> > >
> > > Martin Grigorov
> > > Wicket Training and Consulting
> > >
> > >
> > > On Mon, Jun 16, 2014 at 10:51 AM, Yoav Stern 
> > > wrote:
> > >
> > > > I am using wicket in my web application. Assuming I have pages a b c
> > > where
> > > > I move from A to B using page parameters change something in page B
> > model
> > > > using ajax and B to C (without using page params).
> > > >
> > > > problem : The scenario is moving A->B->C while changing page b model
> > and
> > > > pressing the back button B<-C cause when page B instance (B1)was
> > > generated
> > > > I used get parameters , therefore a new page B instance was
> > > generated(B2) I
> > > > would like to return every time to page B
> > > >
> > > > is there a wicket style solution to this problem ?
> > > >
> > > > thank u for getting this far in my post :).
> > > >
> > >
> >
>


Re: javascript reference header item with async attribute

2014-06-16 Thread Martin Grigorov
Hi,

I don't like the number of constructors we have in the different impls of
CssHeaderItem and JavaScriptHeaderItem.
Recently I needed to set markup id to a CssHeaderItem to be able to replace
it with Ajax so I've added a new method [1] to CssHeaderItem: setId(String)
[2] that uses Fluent API pattern, i.e. returns "this".
Usage:  render(CssHeaderItem.forXyz(...).setId("someId"));

"async" is a new attribute added with HTML5 and is different than "defer"
I think we can do the same and add it without changing the current APIs,
i.e. adding more constructors/methods.
The usage would be: render(CssHeaderItem.forXyz(...).setAsync(true));

If you like the idea then please open a ticket at
https://issues.apache.org/jira/browse/WICKET

1. https://issues.apache.org/jira/browse/WICKET-5617
2.
https://github.com/apache/wicket/blob/master/wicket-core/src/main/java/org/apache/wicket/markup/head/CssHeaderItem.java#L80

Martin Grigorov
Wicket Training and Consulting


On Mon, Jun 9, 2014 at 4:45 PM, Simon B  wrote:

> Hello Andrea,
>
> Thank you for replying.  In the end I subclassed
> JavaScriptUrlReferenceHeaderItem creating my own
> AsyncJavaScriptUrlReferenceHeaderItem class
>
> and overrode the
>
>  public void render(Response response);
>
> method, take as a reference the implemenation from
> JavaScriptUtils.writeJavaScriptUrl and JavaScriptUrlHeaderItem and simply
> adding a async attribute in one of the response.write method calls:
>
>
>
> Seems a bit of a brutish way just to add an async attribute.
>
> Is this something that could // should be added to a future release of
> wicket, does anyone have any opinion about it?
>
> Cheers
> Simon
>
> --
> View this message in context:
> http://apache-wicket.1842946.n4.nabble.com/javascript-reference-header-item-with-async-attribute-tp4666155p4666159.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 urls - wicket wont display the get url and insted display page instance number

2014-06-16 Thread Martin Grigorov
Hi,

The description is not very clear.
Could you please rephrase it ?

Martin Grigorov
Wicket Training and Consulting


On Mon, Jun 16, 2014 at 9:10 AM, Yoav Stern  wrote:

> I am using wicket in my web application. Assuming I have pages a b c where
> I move from A to B using page parameters change something in page B model
> using ajax and B to C (without using page params).
>
> problem : The scenario is moving A->B->C while changing page b model and
> pressing the back button B<-C cause when page B instance (B1)was generated
> I used get parameters , therefore a new page B instance was generated(B2) I
> would like to return every time to page B
>
> is there a wicket style solution to this problem ?
>
> thank u for getting this far in my post :).
>


wicket urls - wicket wont display the get url and insted display page instance number

2014-06-16 Thread Yoav Stern
I am using wicket in my web application. Assuming I have pages a b c where
I move from A to B using page parameters change something in page B model
using ajax and B to C (without using page params).

problem : The scenario is moving A->B->C while changing page b model and
pressing the back button B<-C cause when page B instance (B1)was generated
I used get parameters , therefore a new page B instance was generated(B2) I
would like to return every time to page B

is there a wicket style solution to this problem ?

thank u for getting this far in my post :).


wicket urls - wicket wont display the get url and insted display page instance number

2014-06-16 Thread Yoav Stern
I am using wicket in my web application. Assuming I have pages a b c where
I move from A to B using page parameters change something in page B model
using ajax and B to C (without using page params).

problem : The scenario is moving A->B->C while changing page b model and
pressing the back button B<-C cause when page B instance (B1)was generated
I used get parameters , therefore a new page B instance was generated(B2) I
would like to return every time to page B

is there a wicket style solution to this problem ?

thank u for getting this far in my post :).