Serialize exceptions

2012-03-21 Thread nino martinez wael
Hi I get a serialize exception in a panel of mine its correct that one of
the contained fields cannot be serialized, however this field are injected
and should not be touched by the checker, the field are marked with the
@inject  annotation. I'm using guice for injection.. Any thing obvious
wrong with this?


RE: Serialize exceptions

2012-03-21 Thread Wilhelmsen Tor Iver
 Hi I get a serialize exception in a panel of mine its correct that one of the 
 contained fields cannot be serialized, however this field are injected and 
 should not be touched by the checker, the field are marked with the @inject  
 annotation. I'm using guice for injection.. Any thing obvious wrong with this?

Java serialization does not care for that annotation, only whether it is 
declared transient or sports the Serializable marker interface. Frankly it 
baffles me that they didn't just default to letting everything be serializable 
and let the programmer deal with stuff that's not supposed to be, since it 
otherwise just causes endless exceptions and adding an otherwise pointless 
interface inheritance...

- Tor Iver

-
To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
For additional commands, e-mail: users-h...@wicket.apache.org



Re: support for L10N in templates

2012-03-21 Thread Martin Grigorov
Create a ticket about this.
With a patch will be even better!

On Wed, Mar 21, 2012 at 12:55 AM, infiniter infini...@gmail.com wrote:
 I can't use that TextTemplateResourceReference 'cause the style and locale
 are set to null by default in the constructors and the filename passed to
 PackagedTextTemplate is exactly the one passed in the constructor.
 See:
 public TextTemplateResourceReference(final Class? scope, final String
 fileName,
        final String contentType, final String encoding, IModelMaplt;String,
 Object variablesModel) {
        super(scope, fileName); //STYLE AND LOCALE ARE NULL

        textTemplate = new PackagedTextTemplate(scope, fileName, contentType,
 encoding);
        this.variablesModel = variablesModel;
 }

 i guess I'll have to implement that filename-solving part manually by
 creating my own PackagedTextTemplate and changing the constructor where that
 logic happens.



 --
 View this message in context: 
 http://apache-wicket.1842946.n4.nabble.com/support-for-L10N-in-templates-tp4479741p4490640.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




-- 
Martin Grigorov
jWeekend
Training, Consulting, Development
http://jWeekend.com

-
To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
For additional commands, e-mail: users-h...@wicket.apache.org



Re: How to set HTTP Header Content-Length in IResourceListener?

2012-03-21 Thread Martin Grigorov
On Tue, Mar 20, 2012 at 8:12 PM, eugenebalt eugeneb...@yahoo.com wrote:
 As I wrote in other messages, I have a custom widget that implements
 IResourceListener.

 I override onResourceRequested(). When rendering the resource I need to set
 the ContentLength of the response that sends the binary data to the client.
 Where is the best place to do it? I have access to
 getRequestCycle().getResponse(), but that gives me a Response. I need a
 WebResponse.

Just cast it


 Do I need to set it in onResourceRequested()? Thanks

 --
 View this message in context: 
 http://apache-wicket.1842946.n4.nabble.com/How-to-set-HTTP-Header-Content-Length-in-IResourceListener-tp4489832p4489832.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




-- 
Martin Grigorov
jWeekend
Training, Consulting, Development
http://jWeekend.com

-
To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
For additional commands, e-mail: users-h...@wicket.apache.org



Re: Serialize exceptions

2012-03-21 Thread Martin Grigorov
Wicket-Guice will inject serializable Proxy.
It seems Guice's plain Injector injects the binding. Check why.

On Wed, Mar 21, 2012 at 9:55 AM, Wilhelmsen Tor Iver toriv...@arrive.no wrote:
 Hi I get a serialize exception in a panel of mine its correct that one of 
 the contained fields cannot be serialized, however this field are injected 
 and should not be touched by the checker, the field are marked with the 
 @inject  annotation. I'm using guice for injection.. Any thing obvious wrong 
 with this?

 Java serialization does not care for that annotation, only whether it is 
 declared transient or sports the Serializable marker interface. Frankly it 
 baffles me that they didn't just default to letting everything be 
 serializable and let the programmer deal with stuff that's not supposed to 
 be, since it otherwise just causes endless exceptions and adding an otherwise 
 pointless interface inheritance...

 - Tor Iver

 -
 To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
 For additional commands, e-mail: users-h...@wicket.apache.org




-- 
Martin Grigorov
jWeekend
Training, Consulting, Development
http://jWeekend.com

-
To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
For additional commands, e-mail: users-h...@wicket.apache.org



Re: How to set HTTP Header Content-Length in IResourceListener?

2012-03-21 Thread Martijn Dashorst
Response is there to provide an abstraction for e.g. portlets, and
other types of requests. As long as you are working in a web container
and don't install or use extensions (that I am unaware of exist),
casting is fine.

Martijn

On Wed, Mar 21, 2012 at 9:56 AM, Martin Grigorov mgrigo...@apache.org wrote:
 On Tue, Mar 20, 2012 at 8:12 PM, eugenebalt eugeneb...@yahoo.com wrote:
 As I wrote in other messages, I have a custom widget that implements
 IResourceListener.

 I override onResourceRequested(). When rendering the resource I need to set
 the ContentLength of the response that sends the binary data to the client.
 Where is the best place to do it? I have access to
 getRequestCycle().getResponse(), but that gives me a Response. I need a
 WebResponse.

 Just cast it


 Do I need to set it in onResourceRequested()? Thanks

 --
 View this message in context: 
 http://apache-wicket.1842946.n4.nabble.com/How-to-set-HTTP-Header-Content-Length-in-IResourceListener-tp4489832p4489832.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




 --
 Martin Grigorov
 jWeekend
 Training, Consulting, Development
 http://jWeekend.com

 -
 To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
 For additional commands, e-mail: users-h...@wicket.apache.org




-- 
Become a Wicket expert, learn from the best: http://wicketinaction.com

-
To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
For additional commands, e-mail: users-h...@wicket.apache.org



Two submit buttons in a form, one of them does not trigger validation

2012-03-21 Thread stoupa
I have a form that has two submit buttons. One is a Save button that just
persists the model object of the form and the other is a Send for approval
button that causes the data in the form to be processed in the application.
I need to make some of the fields mandatory, but there is a requirement that
the Save button should not trigger any validators, the user should always
be able to save his form.
Is there a clean way how to achieve this behaviour in Wicket? I'm using
version 1.4.

--
View this message in context: 
http://apache-wicket.1842946.n4.nabble.com/Two-submit-buttons-in-a-form-one-of-them-does-not-trigger-validation-tp4491781p4491781.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: Two submit buttons in a form, one of them does not trigger validation

2012-03-21 Thread Martin Grigorov
Hi,

We needed once to do something similar and we came with the following solution:
override FormComponent#validate() for the components which have
validators and do:
public void validate() {
   if (getForm().findSubmittingButton() != saveButton) {
 super.validate()
   }
}

i.e. validate for all buttons but the one you want to skip.

HTH

On Wed, Mar 21, 2012 at 12:03 PM, stoupa vladimirkro...@gmail.com wrote:
 I have a form that has two submit buttons. One is a Save button that just
 persists the model object of the form and the other is a Send for approval
 button that causes the data in the form to be processed in the application.
 I need to make some of the fields mandatory, but there is a requirement that
 the Save button should not trigger any validators, the user should always
 be able to save his form.
 Is there a clean way how to achieve this behaviour in Wicket? I'm using
 version 1.4.

 --
 View this message in context: 
 http://apache-wicket.1842946.n4.nabble.com/Two-submit-buttons-in-a-form-one-of-them-does-not-trigger-validation-tp4491781p4491781.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




-- 
Martin Grigorov
jWeekend
Training, Consulting, Development
http://jWeekend.com

-
To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
For additional commands, e-mail: users-h...@wicket.apache.org



Wicket 1.4.20 : error message Access denied to (static) package resource

2012-03-21 Thread Pierre Goiffon
Hello,

After upgrading from Wicket 1.4.19 to Wicket 1.4.20 I get exceptions in 
TinyMCE. We're using the Wicketstuff integration.
When opening TinyMCE lightboxes I get exception like :

org.apache.wicket.markup.html.PackageResource$PackageResourceBlockedException: 
Access denied to (static) package resource 
com/interview/tool/wicketstuff/tinymce/themes/advanced/image.htm. See 
IPackageResourceGuard

It works perfectly in Wicket 1.4.18 or 1.4.19, but when updating in the 
pom to the 1.4.20 version we get that exception.
I can't figure what ticket could be related in the 1.4.20 changelog 
(https://issues.apache.org/jira/secure/ReleaseNote.jspa?projectId=12310561version=12317570)

Any idea ?
-
To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
For additional commands, e-mail: users-h...@wicket.apache.org



Re: Wicket 1.4.20 : error message Access denied to (static) package resource

2012-03-21 Thread Martin Grigorov
Hi,

Yes, in 1.4.20 Wicket uses SecurePackageResourceGuard by default
because there was a security related issue. We will send an official
mail soon.
Many of the common extensions are allowed by default but .htm is not
one of them. You need to add this to YourApp#init():

IPackageResourceGuard packageResourceGuard =
getResourceSettings().getPackageResourceGuard();
if (packageResourceGuard instanceof SecurePackageResourceGuard)
{
SecurePackageResourceGuard guard = 
(SecurePackageResourceGuard)
packageResourceGuard;
guard.addPattern(+*.htm);
}

On Wed, Mar 21, 2012 at 12:42 PM, Pierre Goiffon
pierre.goif...@interview-efm.com wrote:
 Hello,

 After upgrading from Wicket 1.4.19 to Wicket 1.4.20 I get exceptions in
 TinyMCE. We're using the Wicketstuff integration.
 When opening TinyMCE lightboxes I get exception like :

 org.apache.wicket.markup.html.PackageResource$PackageResourceBlockedException:
 Access denied to (static) package resource
 com/interview/tool/wicketstuff/tinymce/themes/advanced/image.htm. See
 IPackageResourceGuard

 It works perfectly in Wicket 1.4.18 or 1.4.19, but when updating in the
 pom to the 1.4.20 version we get that exception.
 I can't figure what ticket could be related in the 1.4.20 changelog
 (https://issues.apache.org/jira/secure/ReleaseNote.jspa?projectId=12310561version=12317570)

 Any idea ?
 -
 To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
 For additional commands, e-mail: users-h...@wicket.apache.org




-- 
Martin Grigorov
jWeekend
Training, Consulting, Development
http://jWeekend.com

-
To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
For additional commands, e-mail: users-h...@wicket.apache.org



Re: Wicket 1.4.20 : error message Access denied to (static) package resource

2012-03-21 Thread Antoine Angenieux

Hi !

I faced a similar issue, but with PDF files used as PackageResource.

It boils down to wicket relying now by default on 
SecurePackageResourceGuard which only authorizes file with some 
extensions (defined in the SecurePackageResourceGuard constructor).


What I did was create my own subclass of SecurePackageResourceGuard as 
follows:

public class MyResourceGuard extends SecurePackageResourceGuard {

/**
 * Default constructor
 */
public EDCResourceGuard() {
super(new SimpleCache(100));
addPattern(+*.pdf);
}

}

And then in my Application subclass, in the init method, I do
getResourceSettings().setPackageResourceGuard(new MyResourceGuard ());

I guess if you simply add the following line
addPattern(+*.htm) to your MyResourceGuard constructor, your error 
will go away.


Hope this helps !

Antoine.


Le 21/03/2012 11:42, Pierre Goiffon a écrit :

Hello,

After upgrading from Wicket 1.4.19 to Wicket 1.4.20 I get exceptions in
TinyMCE. We're using the Wicketstuff integration.
When opening TinyMCE lightboxes I get exception like :

org.apache.wicket.markup.html.PackageResource$PackageResourceBlockedException:
Access denied to (static) package resource
com/interview/tool/wicketstuff/tinymce/themes/advanced/image.htm. See
IPackageResourceGuard

It works perfectly in Wicket 1.4.18 or 1.4.19, but when updating in the
pom to the 1.4.20 version we get that exception.
I can't figure what ticket could be related in the 1.4.20 changelog
(https://issues.apache.org/jira/secure/ReleaseNote.jspa?projectId=12310561version=12317570)

Any idea ?
-
To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
For additional commands, e-mail: users-h...@wicket.apache.org





-
To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
For additional commands, e-mail: users-h...@wicket.apache.org



Re: Wicket 1.4.20 : error message Access denied to (static) package resource

2012-03-21 Thread Pierre Goiffon
Martin and Antoine, thanks very much for your quick answers, it solves 
of course my problem !
SecurePackageResourceGuard has already a lot of common extensions, and 
it's easy to add the ones you eventualy need !

Martin, I still can't see in the 1.4.20 changelog 
(https://issues.apache.org/jira/secure/ReleaseNote.jspa?projectId=12310561version=12318545)
 
what ticket could be related to this change ?
And nothing in the version announcement : 
http://wicket.apache.org/2012/03/12/wicket-1.4.20-released.html.

For us this is a major regression and I just discovered it by chance... 
I recommend to have a word maybe in the 1.4.20 announcement, and change 
the title of the related 1.4.20 ticket to be more comprehensive ?
Thanks !
-
To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
For additional commands, e-mail: users-h...@wicket.apache.org



Re: Wicket 1.4.20 : error message Access denied to (static) package resource

2012-03-21 Thread Martin Grigorov
As I said this change is due to a security related problem.
An official announcement will come very soon.
We haven't sent it so far because we wanted to give you some time to
upgrade to 1.4.20/1.5.5 before making the problem public.
Sorry for the troubles!

On Wed, Mar 21, 2012 at 1:19 PM, Pierre Goiffon
pierre.goif...@interview-efm.com wrote:
 Martin and Antoine, thanks very much for your quick answers, it solves
 of course my problem !
 SecurePackageResourceGuard has already a lot of common extensions, and
 it's easy to add the ones you eventualy need !

 Martin, I still can't see in the 1.4.20 changelog
 (https://issues.apache.org/jira/secure/ReleaseNote.jspa?projectId=12310561version=12318545)
 what ticket could be related to this change ?
 And nothing in the version announcement :
 http://wicket.apache.org/2012/03/12/wicket-1.4.20-released.html.

 For us this is a major regression and I just discovered it by chance...
 I recommend to have a word maybe in the 1.4.20 announcement, and change
 the title of the related 1.4.20 ticket to be more comprehensive ?
 Thanks !
 -
 To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
 For additional commands, e-mail: users-h...@wicket.apache.org




-- 
Martin Grigorov
jWeekend
Training, Consulting, Development
http://jWeekend.com

-
To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
For additional commands, e-mail: users-h...@wicket.apache.org



[1.5] unwanted page refresh

2012-03-21 Thread Pierre Goupil
Good afternoon,

I have a couple of ModalWindow s in my code that respond to closing using
an AjaxButton and its AjaxRequestTarget. My problem is that, in 1.5, after
the page displays its components added to the target, the page refreshes
itself. Which I don't want, indeed.

The problem is weird since the same code used to work in 1.4 without any
such side-effects.

Details: Wicket 1.5.5, Firefox 11, Opera (?), Debian Linux 6, Tomcat 7.0.22.

Any help will be much appreciated.

Regards,

Pierre Goupil


Re: [1.5] unwanted page refresh

2012-03-21 Thread Bas Gooren

Hi,

Sounds like you have a redirect somewhere.
Do you have any components on the page which at some point in time call 
setResponsePage or an equivalent?


Bas

Op 21-3-2012 12:49, schreef Pierre Goupil:

Good afternoon,

I have a couple of ModalWindow s in my code that respond to closing using
an AjaxButton and its AjaxRequestTarget. My problem is that, in 1.5, after
the page displays its components added to the target, the page refreshes
itself. Which I don't want, indeed.

The problem is weird since the same code used to work in 1.4 without any
such side-effects.

Details: Wicket 1.5.5, Firefox 11, Opera (?), Debian Linux 6, Tomcat 7.0.22.

Any help will be much appreciated.

Regards,

Pierre Goupil



-
To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
For additional commands, e-mail: users-h...@wicket.apache.org



Re: [1.5] unwanted page refresh

2012-03-21 Thread Pierre Goupil
 Sounds like you have a redirect somewhere.


Yes, but one which didn't triggered in 1.4!




 Do you have any components on the page which at some point in time call
 setResponsePage or an equivalent?


I have no setResponsePage. I'll look through the js to see if there is any
window.location but it's doubtful.

Thank you,

 Pierre






 Bas

 Op 21-3-2012 12:49, schreef Pierre Goupil:

  Good afternoon,

 I have a couple of ModalWindow s in my code that respond to closing using
 an AjaxButton and its AjaxRequestTarget. My problem is that, in 1.5, after
 the page displays its components added to the target, the page refreshes
 itself. Which I don't want, indeed.

 The problem is weird since the same code used to work in 1.4 without any
 such side-effects.

 Details: Wicket 1.5.5, Firefox 11, Opera (?), Debian Linux 6, Tomcat
 7.0.22.

 Any help will be much appreciated.

 Regards,

 Pierre Goupil


 --**--**-
 To unsubscribe, e-mail: 
 users-unsubscribe@wicket.**apache.orgusers-unsubscr...@wicket.apache.org
 For additional commands, e-mail: users-h...@wicket.apache.org




-- 
Si tu penses que la violence ne résout rien, c'est que tu n'as pas tapé
assez fort.


Re: Wicket 1.4.20 : error message Access denied to (static) package resource

2012-03-21 Thread Pierre Goiffon
Le 21/03/2012 12:24, Martin Grigorov a écrit :
 As I said this change is due to a security related problem.
 An official announcement will come very soon.
 We haven't sent it so far because we wanted to give you some time to
 upgrade to 1.4.20/1.5.5 before making the problem public.
 Sorry for the troubles!

I understand your concern about revealing details of a security problem. 
As a wicket user, I'd rather be aware of the details when the version is 
out, and make my own decision beceause almost everytime you have to 
choose the best compromise between changing your code and the risk your 
application is exposed to. Upgrading and finding out that you have to 
change your code without knowing why, you just feel inconfortable and 
fear that there are lots of things you miss, that will brings you some 
extra bugs.
But this is a long debate :)

Thanks anyway very much for your almost immediate help, it was much 
appreciate !

Best regards,
P. Goiffon

-
To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
For additional commands, e-mail: users-h...@wicket.apache.org



Mysterious application crash

2012-03-21 Thread Jürgen Lind

Hi,

I've run into a very odd situation and I have no idea, how to find out what is
going on... The situation is as follows:

1. I have a base page that contains some markup and components.

2. I have a second page, that extends the base page but does not add
   any markup or components, i.e the HTML is empty besides des wicket:extend tag
   and the Java Class is entirely empty

3. The base page is mounted as 'base', the child page is mounted as 'child'

4. I open the child page in the browser, it shows ok (all the contents of the
   base page)

5. I open the base page in the browser and I get an exception:
   Root cause:

org.apache.wicket.markup.MarkupNotFoundException: Markup not found for Component: 
[HtmlHeaderContainer [Component id = _header_0]]

at org.apache.wicket.Component.internalRender(Component.java:2315)
at org.apache.wicket.Component.render(Component.java:2275)
at org.apache.wicket.MarkupContainer.renderNext(MarkupContainer.java:1474)
at org.apache.wicket.MarkupContainer.renderAll(MarkupContainer.java:1638)

6. I try to open the base page in another browser, I get the same exception!

For me, that indicates that the application was somehow corrupted. Is that 
possible?
Or do I miss something obvious here? I've been trying to track down the error 
for
the last couple of hours, but I have not found anything useful...

J.

-
To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
For additional commands, e-mail: users-h...@wicket.apache.org



RE: Error in dynamic form with any number of drop down ,enu

2012-03-21 Thread Michal Wegrzyn
Hi,

You should add organizationList to the registerForm object.

Best regards,
Michal Wegrzyn

 -Original Message-
 From: kshitiz [mailto:k.agarw...@gmail.com]
 Sent: Wednesday, March 21, 2012 15:57
 To: users@wicket.apache.org
 Subject: Error in dynamic form with any number of drop down ,enu
 
 Hi,
 
 I want to create a form where user can have any number of drop down
 menus.
 Here is my code:
 
 *private ListViewDropDownChoicelt;String organizationList;* public
 Register() throws InvalidEmailException, Exception
   {
   add(new FeedbackPanel(feedbackPanel));
   final DropDownChoiceString organizationDropDown = new
 DropDownChoiceString(
   organizations, new
 PropertyModelString(this, selected), SEARCH_ENGINES);
   StatelessForm Register registerForm = new StatelessForm
 Register(registerForm, new
 CompoundPropertyModelRegister(userDomain));
   add(registerForm);
   Label nameLabel = new Label(nameLabel, Name);
 registerForm.add(nameLabel);
 RequiredTextFieldString nameField = new
 RequiredTextFieldString(name, new PropertyModelString(this,
 name));
 
 nameField.add(LengthBetweenValidator.lengthBetween(MIN_LOCATION_NAME_LE
 NGTH,
 MAX_LOCATION_NAME_LENGTH));
 registerForm.add(nameField);
 
 *this.add(organizationList = new ListView(organizationList) {
 
 /**
*
*/
   private static final long
 serialVersionUID = 1L;
 
   @Override
 protected void populateItem(final ListItem item) {
 item.add(organizationDropDown);
 
 }
 }); *
 
 
 
 
 
 Button submitButton = new Button(submitButton) {
 @Override
 public void onSubmit() {
   info(Selected search engine :  + selected);
   System.out.println(selected);
   organizationList.add(organizationDropDown);
 }
 };
 
 registerForm.add(submitButton);
 
 
   }
 
 
 
 And my html files is:
 
 form wicket:id=registerForm
   div
  label for=name wicket:id=nameLabelName/label
 input type=text id=name wicket:id=name/
 * tr wicket:id=organizationList
  tdselect wicket:id=organizations/select/td
  /tr*
 
  input type=submit value=Register
 class=formbutton
 name=Register wicket:id=submitButton/
   /div
 /form
 
 
 But I am getting the error:
 *Unable to find component with id 'organizationList' in
 [MarkupContainer [Component id = registerForm]]. *
 
 I have followed the same procedure as given in various examples in
 google.
 So what is the cause of error?
 
 --
 View this message in context: http://apache-
 wicket.1842946.n4.nabble.com/Error-in-dynamic-form-with-any-number-of-
 drop-down-enu-tp4492543p4492543.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


-
To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
For additional commands, e-mail: users-h...@wicket.apache.org



Re: Error in dynamic form with any number of drop down ,enu

2012-03-21 Thread kshitiz
Sorry..I missed to add *registerForm.add(organizationList);* in java class.
After adding that with proper getters and setters..I am getting the error:

WicketMessage: No get method defined for class: class domain.UserDomain
expression: organizationList

Root cause:

org.apache.wicket.WicketRuntimeException: No get method defined for class:
class domain.UserDomain expression: organizationList
 at
org.apache.wicket.util.lang.PropertyResolver.getGetAndSetter(PropertyResolver.java:499)
...

What is the reason ... I have added getters and setters...

--
View this message in context: 
http://apache-wicket.1842946.n4.nabble.com/Error-in-dynamic-form-with-any-number-of-drop-down-enu-tp4492543p4492627.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: Dynamically sized image

2012-03-21 Thread jarnis
Hey Dan, sorry for the late reply and thanks for your suggestion.

If it is necessary with ajax for a good solution, I'm not fanatic in
resisting it. I would prefer to wrap it in a reusable wicket component,
thou, and I have not yet figured out to do this.

It seems that depending on 
http://benalman.com/projects/jquery-resize-plugin/ Ben Alman's jQuery resize
event  might save a bit of coding and avoid minding custom js code to the
window's resize event. 

I have tried to use various WiQuery classes to implement it with no success.
Just recently I became aware of the  AjaxLazyLoadPanel class, and my current
idea is to override the protected void handleCallbackScript(final
IHeaderResponse response, final String callbackScript) method to make a
script that also provides the size for the first rendering cycle. I'm a bit
stuck on how to construct the js callbackScript, thou.

If someone has a pointer on how to get started on this I would appreciate
it. Otherwise I will post the solution when I finally work one out. It may
take a while as this is a nice-to-have feature in the current project I'm
working on and I rarely have time to throw after it,

--
View this message in context: 
http://apache-wicket.1842946.n4.nabble.com/Dynamically-sized-image-tp4456657p4492790.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: Two submit buttons in a form, one of them does not trigger validation

2012-03-21 Thread Martin Grigorov
On Wed, Mar 21, 2012 at 6:10 PM, Igor Vaynberg igor.vaynb...@gmail.com wrote:
 button.setdefaultformprocessing(false) ?

He needs to save the values without validation. Calling
button.setdefaultformprocessing(false) wont update the models.


 -igor


 On Wed, Mar 21, 2012 at 3:30 AM, Martin Grigorov mgrigo...@apache.org wrote:
 Hi,

 We needed once to do something similar and we came with the following 
 solution:
 override FormComponent#validate() for the components which have
 validators and do:
 public void validate() {
   if (getForm().findSubmittingButton() != saveButton) {
     super.validate()
   }
 }

 i.e. validate for all buttons but the one you want to skip.

 HTH

 On Wed, Mar 21, 2012 at 12:03 PM, stoupa vladimirkro...@gmail.com wrote:
 I have a form that has two submit buttons. One is a Save button that just
 persists the model object of the form and the other is a Send for approval
 button that causes the data in the form to be processed in the application.
 I need to make some of the fields mandatory, but there is a requirement that
 the Save button should not trigger any validators, the user should always
 be able to save his form.
 Is there a clean way how to achieve this behaviour in Wicket? I'm using
 version 1.4.

 --
 View this message in context: 
 http://apache-wicket.1842946.n4.nabble.com/Two-submit-buttons-in-a-form-one-of-them-does-not-trigger-validation-tp4491781p4491781.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




 --
 Martin Grigorov
 jWeekend
 Training, Consulting, Development
 http://jWeekend.com

 -
 To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
 For additional commands, e-mail: users-h...@wicket.apache.org


 -
 To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
 For additional commands, e-mail: users-h...@wicket.apache.org




-- 
Martin Grigorov
jWeekend
Training, Consulting, Development
http://jWeekend.com

-
To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
For additional commands, e-mail: users-h...@wicket.apache.org



Re: Two submit buttons in a form, one of them does not trigger validation

2012-03-21 Thread Igor Vaynberg
yeah, but its pretty easy to visit all formcomponents and call
convertinput()/updatemodel() from one place rather then changing every
form component to be aware of the button...just sayin...

-igor

On Wed, Mar 21, 2012 at 9:22 AM, Martin Grigorov mgrigo...@apache.org wrote:
 On Wed, Mar 21, 2012 at 6:10 PM, Igor Vaynberg igor.vaynb...@gmail.com 
 wrote:
 button.setdefaultformprocessing(false) ?

 He needs to save the values without validation. Calling
 button.setdefaultformprocessing(false) wont update the models.


 -igor


 On Wed, Mar 21, 2012 at 3:30 AM, Martin Grigorov mgrigo...@apache.org 
 wrote:
 Hi,

 We needed once to do something similar and we came with the following 
 solution:
 override FormComponent#validate() for the components which have
 validators and do:
 public void validate() {
   if (getForm().findSubmittingButton() != saveButton) {
     super.validate()
   }
 }

 i.e. validate for all buttons but the one you want to skip.

 HTH

 On Wed, Mar 21, 2012 at 12:03 PM, stoupa vladimirkro...@gmail.com wrote:
 I have a form that has two submit buttons. One is a Save button that just
 persists the model object of the form and the other is a Send for 
 approval
 button that causes the data in the form to be processed in the application.
 I need to make some of the fields mandatory, but there is a requirement 
 that
 the Save button should not trigger any validators, the user should always
 be able to save his form.
 Is there a clean way how to achieve this behaviour in Wicket? I'm using
 version 1.4.

 --
 View this message in context: 
 http://apache-wicket.1842946.n4.nabble.com/Two-submit-buttons-in-a-form-one-of-them-does-not-trigger-validation-tp4491781p4491781.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




 --
 Martin Grigorov
 jWeekend
 Training, Consulting, Development
 http://jWeekend.com

 -
 To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
 For additional commands, e-mail: users-h...@wicket.apache.org


 -
 To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
 For additional commands, e-mail: users-h...@wicket.apache.org




 --
 Martin Grigorov
 jWeekend
 Training, Consulting, Development
 http://jWeekend.com

 -
 To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
 For additional commands, e-mail: users-h...@wicket.apache.org


-
To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
For additional commands, e-mail: users-h...@wicket.apache.org



Re: Dynamically sized image

2012-03-21 Thread Dan Retzlaff
Nice, I share the vision. There's definitely room for something reusable
there. Keep us posted. :)

On Wed, Mar 21, 2012 at 9:03 AM, jarnis jarnis.bertel...@exedio.com wrote:

 Hey Dan, sorry for the late reply and thanks for your suggestion.

 If it is necessary with ajax for a good solution, I'm not fanatic in
 resisting it. I would prefer to wrap it in a reusable wicket component,
 thou, and I have not yet figured out to do this.

 It seems that depending on
 http://benalman.com/projects/jquery-resize-plugin/ Ben Alman's jQuery
 resize
 event  might save a bit of coding and avoid minding custom js code to the
 window's resize event.

 I have tried to use various WiQuery classes to implement it with no
 success.
 Just recently I became aware of the  AjaxLazyLoadPanel class, and my
 current
 idea is to override the protected void handleCallbackScript(final
 IHeaderResponse response, final String callbackScript) method to make a
 script that also provides the size for the first rendering cycle. I'm a bit
 stuck on how to construct the js callbackScript, thou.

 If someone has a pointer on how to get started on this I would appreciate
 it. Otherwise I will post the solution when I finally work one out. It may
 take a while as this is a nice-to-have feature in the current project I'm
 working on and I rarely have time to throw after it,

 --
 View this message in context:
 http://apache-wicket.1842946.n4.nabble.com/Dynamically-sized-image-tp4456657p4492790.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




Streaming a zip file then going back to previous BreadCrumbPanel

2012-03-21 Thread Josh Chappelle
Hi,

I have a Wizard that is inside a BreadCrumbPanel. I have implemented a
method in the onCancel that goes back to the previous BreadCrumbPanel. This
is how it is implemented:

ListIBreadCrumbParticipant participants =
crumbModel.allBreadCrumbParticipants();
crumbModel.setActive(participants.get(participants.size() - 2));

This works fine. The problem is in my onFinish. This wizard creates a zip
file that exports some documents from our system. The code for this is
below. I would like the onFinish to send the zip file back to the user and
then return to the previous BreadCrumbPanel. I'm not able to do that with
the code below. Does anyone have any ideas on how to do this?


ResourceStreamRequestHandler target = new ResourceStreamRequestHandler(new
AbstractResourceStreamWriter()
{
public void write(Response response)
{
try
{
ResponseOutputStream out = new ResponseOutputStream(response);
ZipOutputStream zip = new ZipOutputStream(out);
policyService.exportPolicies(zip, policyService.getPolicies());
zip.close();
}
catch(IOException e)
{
throw new RuntimeException(Failed to export all policies., e);
}
}
 @Override
public String getContentType()
{
return application/zip;
}
});
target.setFileName(All Policies.zip);

getRequestCycle().scheduleRequestHandlerAfterCurrent(target);
ListIBreadCrumbParticipant participants =
crumbModel.allBreadCrumbParticipants();
crumbModel.setActive(participants.get(participants.size() - 2));


I'm using wicket 1.5.4 by the way.

Thanks,

Josh


LDM - correct construction

2012-03-21 Thread Jeffrey Schneller
Is this the correct construction of a LDM where I need to use a service bean to 
access my database?  The IMyService bean  is injected on the page and passed to 
the LDM.  Does this make the LDM hold a reference to the IMyService bean and 
possibly keep a connection from being put back into the c3p0 db connection 
pool?  After some period of time my application is blocked with all threads 
waiting on a connection to the db.

Should I be injected the IMyService bean into the LDM using the commented out 
code.  Thanks for any help.

public class MyLDM extends LoadableDetachableModelcom.example.MyObject {

//@SpringBean
private IMyService service;

private String id;

public MyLDM(String id, IMyService service)   {
this.id = id;
this.service = service;
}


//public MyLDM(String id)   {
//this.id = id;
//}


@Override
protected com.example.MyObject load() {
//InjectorHolder.getInjector().inject(this);
return service.getMyObject(this.id);
}
}


Re: LDM - correct construction

2012-03-21 Thread Dan Retzlaff
Jeffrey,

That won't prevent a connection from being released. The LDM holds a
reference to the page, and the page has a serializable proxy to the service
implementation. No problem there. Injecting the service into the LDM is
only an advantage if you want to share it among pages; then the LDM can be
static and its page reference goes away.

It sounds like your service implementation may have an issue. Does your
service manage its own connections? If so, is it a singleton? Other than
that, I'd guess there's a bug in your transaction management such that a
transaction gets started but not finished.

HTH,
Dan

On Wed, Mar 21, 2012 at 1:45 PM, Jeffrey Schneller 
jeffrey.schnel...@envisa.com wrote:

 Is this the correct construction of a LDM where I need to use a service
 bean to access my database?  The IMyService bean  is injected on the page
 and passed to the LDM.  Does this make the LDM hold a reference to the
 IMyService bean and possibly keep a connection from being put back into the
 c3p0 db connection pool?  After some period of time my application is
 blocked with all threads waiting on a connection to the db.

 Should I be injected the IMyService bean into the LDM using the commented
 out code.  Thanks for any help.

 public class MyLDM extends LoadableDetachableModelcom.example.MyObject {

//@SpringBean
private IMyService service;

private String id;

public MyLDM(String id, IMyService service)   {
this.id = id;
this.service = service;
}


//public MyLDM(String id)   {
//this.id = id;
//}


@Override
protected com.example.MyObject load() {
 //InjectorHolder.getInjector().inject(this);
return service.getMyObject(this.id);
}
 }



OSIV with requestCycleListener

2012-03-21 Thread grazia
Would you recommend using a requestCycleListener to implement the OSIV
pattern and storing the hibernate session in a threadlocal ? 
Any comments ? tips ?

public class MyRequestCycleListener extends AbstractRequestCycleListener {

private static final ThreadLocalSession requestCycleThread = new
ThreadLocalSession();

/** Keys for session factories that have been opened for this request */
//protected static HashSet keys = new HashSet();

public static ThreadLocalSession getRequestCycleThread() {
return requestCycleThread;
}

@Override
public void onBeginRequest(RequestCycle cycle) {

if (requestCycleThread.get() == null) {
Session session = MyRequestCycle.getHibernateSession(null); 
requestCycleThread.set(session);
 }
 }

@Override
public void onEndRequest(RequestCycle cycle) {
if (requestCycleThread.get()!= null){
MyRequestCycle.closeHibernateSessions();
requestCycleThread.set(null);
 }
}


--
View this message in context: 
http://apache-wicket.1842946.n4.nabble.com/OSIV-with-requestCycleListener-tp4493806p4493806.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: LDM - correct construction

2012-03-21 Thread Jeffrey Schneller
My service implementation uses hibernate dao objects which should be managing 
its own connections via the c3p0 connection pool.  All my service objects and 
Dao objects are marked as singletons in my Spring applicationContext.xml file.  
I don't think any of my transactions are failing as it would most likely throw 
an exception if the there was a problem performing a transactions and all 
exceptions are logged (at least I believe they are).

I will most likely put the following c3p0 settings in place and wait to see 
what comes out of this in production.  

c3p0.unreturnedConnectionTimeout=30
c3p0.debugUnreturnedConnectionStackTraces=true

This should give me a stack trace of what checked out a connection, where that 
connection hasn't been returned to the pool in 30 seconds.  It will be a slight 
performance hit on production but I should be able to find the problem very 
quickly.

Thanks.

Jeff

-Original Message-
From: Dan Retzlaff [mailto:dretzl...@gmail.com] 
Sent: Wednesday, March 21, 2012 5:04 PM
To: users@wicket.apache.org
Subject: Re: LDM - correct construction

Jeffrey,

That won't prevent a connection from being released. The LDM holds a reference 
to the page, and the page has a serializable proxy to the service 
implementation. No problem there. Injecting the service into the LDM is only an 
advantage if you want to share it among pages; then the LDM can be static and 
its page reference goes away.

It sounds like your service implementation may have an issue. Does your service 
manage its own connections? If so, is it a singleton? Other than that, I'd 
guess there's a bug in your transaction management such that a transaction gets 
started but not finished.

HTH,
Dan

On Wed, Mar 21, 2012 at 1:45 PM, Jeffrey Schneller  
jeffrey.schnel...@envisa.com wrote:

 Is this the correct construction of a LDM where I need to use a 
 service bean to access my database?  The IMyService bean  is injected 
 on the page and passed to the LDM.  Does this make the LDM hold a 
 reference to the IMyService bean and possibly keep a connection from 
 being put back into the
 c3p0 db connection pool?  After some period of time my application is 
 blocked with all threads waiting on a connection to the db.

 Should I be injected the IMyService bean into the LDM using the 
 commented out code.  Thanks for any help.

 public class MyLDM extends 
 LoadableDetachableModelcom.example.MyObject {

//@SpringBean
private IMyService service;

private String id;

public MyLDM(String id, IMyService service)   {
this.id = id;
this.service = service;
}


//public MyLDM(String id)   {
//this.id = id;
//}


@Override
protected com.example.MyObject load() { 
 //InjectorHolder.getInjector().inject(this);
return service.getMyObject(this.id);
}
 }


-
To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
For additional commands, e-mail: users-h...@wicket.apache.org



Re: LDM - correct construction

2012-03-21 Thread Dan Retzlaff
That sounds like a good strategy. Generally speaking, applications use an
open-session-in-view pattern which makes it easy to ensure that the
Hibernate session gets closed. As long as that happens, the (mis)handling
of transactions shouldn't cause your symptoms.

On Wed, Mar 21, 2012 at 2:31 PM, Jeffrey Schneller 
jeffrey.schnel...@envisa.com wrote:

 My service implementation uses hibernate dao objects which should be
 managing its own connections via the c3p0 connection pool.  All my service
 objects and Dao objects are marked as singletons in my Spring
 applicationContext.xml file.  I don't think any of my transactions are
 failing as it would most likely throw an exception if the there was a
 problem performing a transactions and all exceptions are logged (at least I
 believe they are).

 I will most likely put the following c3p0 settings in place and wait to
 see what comes out of this in production.

 c3p0.unreturnedConnectionTimeout=30
 c3p0.debugUnreturnedConnectionStackTraces=true

 This should give me a stack trace of what checked out a connection, where
 that connection hasn't been returned to the pool in 30 seconds.  It will be
 a slight performance hit on production but I should be able to find the
 problem very quickly.

 Thanks.

 Jeff

 -Original Message-
 From: Dan Retzlaff [mailto:dretzl...@gmail.com]
 Sent: Wednesday, March 21, 2012 5:04 PM
 To: users@wicket.apache.org
 Subject: Re: LDM - correct construction

 Jeffrey,

 That won't prevent a connection from being released. The LDM holds a
 reference to the page, and the page has a serializable proxy to the service
 implementation. No problem there. Injecting the service into the LDM is
 only an advantage if you want to share it among pages; then the LDM can be
 static and its page reference goes away.

 It sounds like your service implementation may have an issue. Does your
 service manage its own connections? If so, is it a singleton? Other than
 that, I'd guess there's a bug in your transaction management such that a
 transaction gets started but not finished.

 HTH,
 Dan

 On Wed, Mar 21, 2012 at 1:45 PM, Jeffrey Schneller 
 jeffrey.schnel...@envisa.com wrote:

  Is this the correct construction of a LDM where I need to use a
  service bean to access my database?  The IMyService bean  is injected
  on the page and passed to the LDM.  Does this make the LDM hold a
  reference to the IMyService bean and possibly keep a connection from
  being put back into the
  c3p0 db connection pool?  After some period of time my application is
  blocked with all threads waiting on a connection to the db.
 
  Should I be injected the IMyService bean into the LDM using the
  commented out code.  Thanks for any help.
 
  public class MyLDM extends
  LoadableDetachableModelcom.example.MyObject {
 
 //@SpringBean
 private IMyService service;
 
 private String id;
 
 public MyLDM(String id, IMyService service)   {
 this.id = id;
 this.service = service;
 }
 
 
 //public MyLDM(String id)   {
 //this.id = id;
 //}
 
 
 @Override
 protected com.example.MyObject load() {
  //InjectorHolder.getInjector().inject(this);
 return service.getMyObject(this.id);
 }
  }
 

 -
 To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
 For additional commands, e-mail: users-h...@wicket.apache.org




RE: LDM - correct construction

2012-03-21 Thread Jeffrey Schneller
The application is using the open-session-in-view pattern which is what makes 
this so troubling to figure out.  



-Original Message-
From: Dan Retzlaff [mailto:dretzl...@gmail.com] 
Sent: Wednesday, March 21, 2012 5:44 PM
To: users@wicket.apache.org
Subject: Re: LDM - correct construction

That sounds like a good strategy. Generally speaking, applications use an 
open-session-in-view pattern which makes it easy to ensure that the Hibernate 
session gets closed. As long as that happens, the (mis)handling of transactions 
shouldn't cause your symptoms.

On Wed, Mar 21, 2012 at 2:31 PM, Jeffrey Schneller  
jeffrey.schnel...@envisa.com wrote:

 My service implementation uses hibernate dao objects which should be 
 managing its own connections via the c3p0 connection pool.  All my 
 service objects and Dao objects are marked as singletons in my Spring 
 applicationContext.xml file.  I don't think any of my transactions are 
 failing as it would most likely throw an exception if the there was a 
 problem performing a transactions and all exceptions are logged (at 
 least I believe they are).

 I will most likely put the following c3p0 settings in place and wait 
 to see what comes out of this in production.

 c3p0.unreturnedConnectionTimeout=30
 c3p0.debugUnreturnedConnectionStackTraces=true

 This should give me a stack trace of what checked out a connection, 
 where that connection hasn't been returned to the pool in 30 seconds.  
 It will be a slight performance hit on production but I should be able 
 to find the problem very quickly.

 Thanks.

 Jeff

 -Original Message-
 From: Dan Retzlaff [mailto:dretzl...@gmail.com]
 Sent: Wednesday, March 21, 2012 5:04 PM
 To: users@wicket.apache.org
 Subject: Re: LDM - correct construction

 Jeffrey,

 That won't prevent a connection from being released. The LDM holds a 
 reference to the page, and the page has a serializable proxy to the 
 service implementation. No problem there. Injecting the service into 
 the LDM is only an advantage if you want to share it among pages; then 
 the LDM can be static and its page reference goes away.

 It sounds like your service implementation may have an issue. Does 
 your service manage its own connections? If so, is it a singleton? 
 Other than that, I'd guess there's a bug in your transaction 
 management such that a transaction gets started but not finished.

 HTH,
 Dan

 On Wed, Mar 21, 2012 at 1:45 PM, Jeffrey Schneller  
 jeffrey.schnel...@envisa.com wrote:

  Is this the correct construction of a LDM where I need to use a 
  service bean to access my database?  The IMyService bean  is 
  injected on the page and passed to the LDM.  Does this make the LDM 
  hold a reference to the IMyService bean and possibly keep a 
  connection from being put back into the
  c3p0 db connection pool?  After some period of time my application 
  is blocked with all threads waiting on a connection to the db.
 
  Should I be injected the IMyService bean into the LDM using the 
  commented out code.  Thanks for any help.
 
  public class MyLDM extends
  LoadableDetachableModelcom.example.MyObject {
 
 //@SpringBean
 private IMyService service;
 
 private String id;
 
 public MyLDM(String id, IMyService service)   {
 this.id = id;
 this.service = service;
 }
 
 
 //public MyLDM(String id)   {
 //this.id = id;
 //}
 
 
 @Override
 protected com.example.MyObject load() { 
  //InjectorHolder.getInjector().inject(this);
 return service.getMyObject(this.id);
 }
  }
 

 -
 To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
 For additional commands, e-mail: users-h...@wicket.apache.org



-
To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
For additional commands, e-mail: users-h...@wicket.apache.org



Re: OSIV with requestCycleListener

2012-03-21 Thread Dan Retzlaff
Grazia,

Those are good lifecycle events, but consider configuring
org.hibernate.context.ManagedSessionContext and using its ThreadLocal. Then
client code can use the more conventional
SessionFactory#getCurrentSession().

Dan

On Wed, Mar 21, 2012 at 2:28 PM, grazia grazia.russolass...@gmail.comwrote:

 Would you recommend using a requestCycleListener to implement the OSIV
 pattern and storing the hibernate session in a threadlocal ?
 Any comments ? tips ?

 public class MyRequestCycleListener extends AbstractRequestCycleListener {

private static final ThreadLocalSession requestCycleThread = new
 ThreadLocalSession();

/** Keys for session factories that have been opened for this request */
//protected static HashSet keys = new HashSet();

public static ThreadLocalSession getRequestCycleThread() {
return requestCycleThread;
}

@Override
public void onBeginRequest(RequestCycle cycle) {

if (requestCycleThread.get() == null) {
Session session = MyRequestCycle.getHibernateSession(null);
requestCycleThread.set(session);
 }
 }

@Override
public void onEndRequest(RequestCycle cycle) {
if (requestCycleThread.get()!= null){
MyRequestCycle.closeHibernateSessions();
requestCycleThread.set(null);
 }
}


 --
 View this message in context:
 http://apache-wicket.1842946.n4.nabble.com/OSIV-with-requestCycleListener-tp4493806p4493806.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: OSIV with requestCycleListener

2012-03-21 Thread grazia
Thank you for the suggestion, I will try it. 

--
View this message in context: 
http://apache-wicket.1842946.n4.nabble.com/OSIV-with-requestCycleListener-tp4493806p4493927.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: Streaming a zip file then going back to previous BreadCrumbPanel

2012-03-21 Thread Dan Retzlaff
Can you initiate the download *after* your redirect? Otherwise I think you
can have your resource set a session variable when the upload is complete,
and poll for that with AJAX.

Dan

On Wed, Mar 21, 2012 at 10:53 AM, Josh Chappelle jchappe...@4redi.comwrote:

 Hi,

 I have a Wizard that is inside a BreadCrumbPanel. I have implemented a
 method in the onCancel that goes back to the previous BreadCrumbPanel. This
 is how it is implemented:

 ListIBreadCrumbParticipant participants =
 crumbModel.allBreadCrumbParticipants();
 crumbModel.setActive(participants.get(participants.size() - 2));

 This works fine. The problem is in my onFinish. This wizard creates a zip
 file that exports some documents from our system. The code for this is
 below. I would like the onFinish to send the zip file back to the user and
 then return to the previous BreadCrumbPanel. I'm not able to do that with
 the code below. Does anyone have any ideas on how to do this?


 ResourceStreamRequestHandler target = new ResourceStreamRequestHandler(new
 AbstractResourceStreamWriter()
 {
 public void write(Response response)
 {
 try
 {
 ResponseOutputStream out = new ResponseOutputStream(response);
 ZipOutputStream zip = new ZipOutputStream(out);
 policyService.exportPolicies(zip, policyService.getPolicies());
 zip.close();
 }
 catch(IOException e)
 {
 throw new RuntimeException(Failed to export all policies., e);
 }
 }
  @Override
 public String getContentType()
 {
 return application/zip;
 }
 });
 target.setFileName(All Policies.zip);

 getRequestCycle().scheduleRequestHandlerAfterCurrent(target);
 ListIBreadCrumbParticipant participants =
 crumbModel.allBreadCrumbParticipants();
 crumbModel.setActive(participants.get(participants.size() - 2));


 I'm using wicket 1.5.4 by the way.

 Thanks,

 Josh



After upgrading from wicket 1.5.0 to 1.5.1+ we have a simple problem

2012-03-21 Thread Bas Gooren

We have the following simple setup:

BasePage checks if user is logged in, if not (and this is not the 
LoginPage), RestartResponseException(LoginPage.class);


LoginPage extends BasePage; contains a form to login;

The application runs in the root context.

Now on 1.5.0 this works like a charm;
After upgrading to 1.5.5 we get infinite redirects; testing versions in 
between, we've found that the problem occurs = 1.5.1;


Here's what debugging shows:

1) When we hit the root url (homepage), it redirects to /login

2) When the LoginPage (mounted at /login) is hit, WebPageRenderer:266 
redirects from /login to /login?0
3) When /login?0 is hit, WebPageRenderer:214 redirects from /login?0 to 
/login

and this loops back to (2)

I've also learned that this does not occur if we do not run the app in 
the root context, so it appears to have to do with url handling.


Looking at the wicket 1.5.1 changelog I don't see anything that was 
changed to break this.

Before doing more debugging, does anyone have a clue what might cause this?

Kind regards,

Sebastian

-
To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
For additional commands, e-mail: users-h...@wicket.apache.org



Re: Streaming a zip file then going back to previous BreadCrumbPanel

2012-03-21 Thread jchappelle
When you say Can you initiate the download *after* your redirect? I'm
guessing you mean this:

ListIBreadCrumbParticipant participants =
crumbModel.allBreadCrumbParticipants(); 
crumbModel.setActive(participants.get(participants.size() - 2)); 
getRequestCycle().scheduleRequestHandlerAfterCurrent(target); 

I have tried this and it doesn't work either. 

The ajax idea is a good idea although I would use that as a last resort. I
was hoping that their was a cleaner way that doesn't generate a lot of
traffic to the server. I wonder if I could create an IRequestHandler that
holds a reference to two other IRequestHandlers. The first being the
streaming zip file, the second being one that updates the breadcrumb model
and refreshes via ajax. I don't know exactly how to implement that second
one though.

Thanks for the help.

--
View this message in context: 
http://apache-wicket.1842946.n4.nabble.com/Streaming-a-zip-file-then-going-back-to-previous-BreadCrumbPanel-tp4493168p4494225.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