Re: Display PDF in new tab

2017-03-03 Thread SeldonCrisis
Got it figured out. Thank you everyone for your help  

--
View this message in context: 
http://apache-wicket.1842946.n4.nabble.com/Display-PDF-in-new-tab-tp4677202p4677240.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-03 Thread Martin Grigorov
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#reque
stTime(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