Re: Quick ActivationContext question

2013-08-14 Thread Tony Nelson

On Aug 13, 2013, at 6:52 PM, Thiago H de Paula Figueiredo 
thiag...@gmail.commailto:thiag...@gmail.com wrote:

On Tue, 13 Aug 2013 18:32:46 -0300, Tony Nelson 
tnel...@starpoint.commailto:tnel...@starpoint.com
wrote:

I have a simple page that has an ActivationContext.  I'd like to handle
a simple ajax call with one parameter.

When I use componentResource.createEventLink(foo), the URL contains
the ActivationContext, like this:

/ih/view:foo?t:ac=77

I don't need the ActivationContext for this call, and I want to post the
ajax call, so this URL won't work.

Please define this URL won't work. If you created it through
ComponentResources.createEventLink(), it will work. The activation context
of an event is separate from the activation context of the page
surrounding it.


The method that I expect to be called is:

public void onDeleteContactLog(ContactLog contactLog) {
logger.info(contactLog.getContactLogId().toString());
if (isShowEdit()) {
jacketLogic.deleteContactLog(contactLog);
}
}


I setup my JS the normal way:

@Import(library = { ViewJacket.js, context:/js/tiny_mce/tiny_mce.js })
public void afterRender() {
JSONObject specs = new JSONObject(
jacketId, jacket.getJacketId().toString(),
jacketName, jacket.getFullName(),
deleteContactLog, /instihire/jacket/view:deletecontactlog/
// componentResources.createEventLink(deleteContactLog, new 
Object[] {}).toURI()
);

javaScriptSupport.addInitializerCall(viewJacket, specs);
}

Pasted there is the working, hard coded URL for the event

The Javascript is simple click handler:

$(.deleteContactLog).click(function (event) {
event.stopPropagation();

var url = _specs.deleteContactLog + $(this).data('id');
var self = this;

$.post(url,
function (data) {
$(self).closest(tr).hide();
})
.fail(function (data) {
window.alert('Deleting the contact log failed.');
});
})

If I change the URL to the one created by component resources 
(/instihire/jacket/view:deletecontactlog?t:ac=98298828372) I get the following 
error:

[ERROR] TapestryModule.RequestExceptionHandler Processing of request failed 
with uncaught exception: Request event 'deletecontactlog' (on component 
jacket/View) was not handled; you must provide a matching event handler method 
in the component or in one of its containers.
org.apache.tapestry5.ioc.internal.util.TapestryException: Request event 
'deletecontactlog' (on component jacket/View) was not handled; you must provide 
a matching event handler method in the component or in one of its containers.
at 
org.apache.tapestry5.internal.services.AjaxComponentEventRequestHandler.handle(AjaxComponentEventRequestHandler.java:114)
at 
org.apache.tapestry5.internal.services.ajax.AjaxFormUpdateFilter.handle(AjaxFormUpdateFilter.java:56)


Thanks for your help.
Tony


Since 1982, Starpoint Solutions has been a trusted source of human capital and 
solutions. We are committed to our clients, employees, environment, community 
and social concerns. We foster an inclusive culture based on trust, respect, 
honesty and solid performance. Learn more about Starpoint and our social 
responsibility at http://www.starpoint.com/social_responsibility


This email message from Starpoint Solutions LLC is for the sole use of the 
intended recipient(s) and may contain confidential and privileged information. 
Any unauthorized review, use, disclosure or distribution is prohibited. If you 
are not the intended recipient, please contact the sender by reply email and 
destroy all copies of the original message. Opinions, conclusions and other 
information in this message that do not relate to the official business of 
Starpoint Solutions shall be understood as neither given nor endorsed by it.


Re: Quick ActivationContext question

2013-08-14 Thread Thiago H de Paula Figueiredo
On Wed, 14 Aug 2013 10:06:21 -0300, Tony Nelson tnel...@starpoint.com  
wrote:


componentResources.createEventLink(deleteContactLog, new Object[]  
{}).toURI()


Your mistake here is to think that the event context will come from the  
POST'ed data. It doesn't. It comes from the path in the URL.


You're passing an empty context to the createEventLink() method, so the  
URL it generates doesn't have any, so your onDeleteContactLog(ContactLog  
contactLog) (which has a parameter) won't be called. That's Tapestry  
behaving exactly as expected. When you're dealing with dynamic data being  
posted from JavaScript, use an event handler without parameters and use  
query parameters to pass the data:


void onDeleteContactLog() {
String id = request.getParameter(id);
...
}

Of course, on the JavaScript side, you need to make the AJAX request  
containing a query parameter named id with the right value.


--
Thiago H. de Paula Figueiredo

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



RE: Quick ActivationContext question

2013-08-14 Thread Tony Nelson


 -Original Message-
 From: Thiago H de Paula Figueiredo [mailto:thiag...@gmail.com]
 Sent: Wednesday, August 14, 2013 9:47 AM
 To: Tapestry users
 Subject: Re: Quick ActivationContext question

 On Wed, 14 Aug 2013 10:06:21 -0300, Tony Nelson tnel...@starpoint.com
 wrote:

  componentResources.createEventLink(deleteContactLog, new Object[]
  {}).toURI()

 Your mistake here is to think that the event context will come from the
 POST'ed data. It doesn't. It comes from the path in the URL.

 You're passing an empty context to the createEventLink() method, so the
 URL it generates doesn't have any, so your onDeleteContactLog(ContactLog
 contactLog) (which has a parameter) won't be called. That's Tapestry
 behaving exactly as expected. When you're dealing with dynamic data being
 posted from JavaScript, use an event handler without parameters and use
 query parameters to pass the data:

 void onDeleteContactLog() {
   String id = request.getParameter(id);
   ...
 }

 Of course, on the JavaScript side, you need to make the AJAX request
 containing a query parameter named id with the right value.


But if I hand craft the URL, /instihire/view/jacket:deletecontactlog/someidhere

And post that, it works just fine.

My fear is that it won't upgrade, but I'm pretty sure most of my stuff won't 
upgrade when 5.4 comes out anyways.

Since 1982, Starpoint Solutions has been a trusted source of human capital and 
solutions. We are committed to our clients, employees, environment, community 
and social concerns.  We foster an inclusive culture based on trust, respect, 
honesty and solid performance. Learn more about Starpoint and our social 
responsibility at http://www.starpoint.com/social_responsibility

This email message from Starpoint Solutions LLC is for the sole use of  the 
intended recipient(s) and may contain confidential and privileged  information. 
 Any unauthorized review, use, disclosure or distribution is prohibited.  If 
you are not the intended recipient, please contact the sender by reply email 
and destroy all copies of the original message.  Opinions, conclusions and 
other information in this message that do not relate to the official business 
of Starpoint Solutions shall be understood as neither given nor endorsed by it.

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


Re: Quick ActivationContext question

2013-08-14 Thread Thiago H de Paula Figueiredo
On Wed, 14 Aug 2013 10:50:32 -0300, Tony Nelson tnel...@starpoint.com  
wrote:


But if I hand craft the URL,  
/instihire/view/jacket:deletecontactlog/someidhere


And post that, it works just fine.


It does because you manually put the activation context in the URL, not  
because you put the id in the POST part of the request. With that URL, you  
could post nothing and it would work the exact same way.


My fear is that it won't upgrade, but I'm pretty sure most of my stuff  
won't upgrade when 5.4 comes out anyways.


What do you think will break when you upgrade?

It the handcrafted URL will very probably work after the upgrade, as  
nothing is being changed about URL handling. But, as you said,  
handcrafting URLs is not a good idea, and I agree with that.


Why don't you try what I suggested in my previous e-mail? ;)

--
Thiago H. de Paula Figueiredo

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



RE: Quick ActivationContext question

2013-08-14 Thread Tony Nelson


 -Original Message-
 From: Thiago H de Paula Figueiredo [mailto:thiag...@gmail.com]
 Sent: Wednesday, August 14, 2013 10:15 AM
 To: Tapestry users
 Subject: Re: Quick ActivationContext question

 On Wed, 14 Aug 2013 10:50:32 -0300, Tony Nelson tnel...@starpoint.com
 wrote:

  But if I hand craft the URL,
  /instihire/view/jacket:deletecontactlog/someidhere
 
  And post that, it works just fine.

 It does because you manually put the activation context in the URL, not
 because you put the id in the POST part of the request. With that URL, you
 could post nothing and it would work the exact same way.

  My fear is that it won't upgrade, but I'm pretty sure most of my stuff
  won't upgrade when 5.4 comes out anyways.

 What do you think will break when you upgrade?

 It the handcrafted URL will very probably work after the upgrade, as nothing
 is being changed about URL handling. But, as you said, handcrafting URLs is
 not a good idea, and I agree with that.

 Why don't you try what I suggested in my previous e-mail? ;)

Because I want to use Tapestry's built in Hibernate ValueEncoders.




Since 1982, Starpoint Solutions has been a trusted source of human capital and 
solutions. We are committed to our clients, employees, environment, community 
and social concerns.  We foster an inclusive culture based on trust, respect, 
honesty and solid performance. Learn more about Starpoint and our social 
responsibility at http://www.starpoint.com/social_responsibility

This email message from Starpoint Solutions LLC is for the sole use of  the 
intended recipient(s) and may contain confidential and privileged  information. 
 Any unauthorized review, use, disclosure or distribution is prohibited.  If 
you are not the intended recipient, please contact the sender by reply email 
and destroy all copies of the original message.  Opinions, conclusions and 
other information in this message that do not relate to the official business 
of Starpoint Solutions shall be understood as neither given nor endorsed by it.


RE: Quick ActivationContext question

2013-08-14 Thread Tony Nelson
Try now, I made your user account, olwi

Tony

 -Original Message-
 From: Tony Nelson [mailto:tnel...@starpoint.com]
 Sent: Wednesday, August 14, 2013 10:33 AM
 To: Tapestry users
 Subject: RE: Quick ActivationContext question



  -Original Message-
  From: Thiago H de Paula Figueiredo [mailto:thiag...@gmail.com]
  Sent: Wednesday, August 14, 2013 10:15 AM
  To: Tapestry users
  Subject: Re: Quick ActivationContext question
 
  On Wed, 14 Aug 2013 10:50:32 -0300, Tony Nelson
  tnel...@starpoint.com
  wrote:
 
   But if I hand craft the URL,
   /instihire/view/jacket:deletecontactlog/someidhere
  
   And post that, it works just fine.
 
  It does because you manually put the activation context in the URL,
  not because you put the id in the POST part of the request. With that
  URL, you could post nothing and it would work the exact same way.
 
   My fear is that it won't upgrade, but I'm pretty sure most of my
   stuff won't upgrade when 5.4 comes out anyways.
 
  What do you think will break when you upgrade?
 
  It the handcrafted URL will very probably work after the upgrade, as
  nothing is being changed about URL handling. But, as you said,
  handcrafting URLs is not a good idea, and I agree with that.
 
  Why don't you try what I suggested in my previous e-mail? ;)

 Because I want to use Tapestry's built in Hibernate ValueEncoders.




 Since 1982, Starpoint Solutions has been a trusted source of human capital
 and solutions. We are committed to our clients, employees, environment,
 community and social concerns.  We foster an inclusive culture based on
 trust, respect, honesty and solid performance. Learn more about Starpoint
 and our social responsibility at
 http://www.starpoint.com/social_responsibility

 This email message from Starpoint Solutions LLC is for the sole use of  the
 intended recipient(s) and may contain confidential and privileged
 information.  Any unauthorized review, use, disclosure or distribution is
 prohibited.  If you are not the intended recipient, please contact the sender
 by reply email and destroy all copies of the original message.  Opinions,
 conclusions and other information in this message that do not relate to the
 official business of Starpoint Solutions shall be understood as neither given
 nor endorsed by it.
 B
 KK
 KKCB  [  X  ܚX KK[XZ[

  \ \  ][  X  ܚX P\\  K \X K ܙ B  ܈Y][ۘ[  [X[  K[XZ[

  \ \  Z[\\  K \X K ܙ B

Since 1982, Starpoint Solutions has been a trusted source of human capital and 
solutions. We are committed to our clients, employees, environment, community 
and social concerns.  We foster an inclusive culture based on trust, respect, 
honesty and solid performance. Learn more about Starpoint and our social 
responsibility at http://www.starpoint.com/social_responsibility

This email message from Starpoint Solutions LLC is for the sole use of  the 
intended recipient(s) and may contain confidential and privileged  information. 
 Any unauthorized review, use, disclosure or distribution is prohibited.  If 
you are not the intended recipient, please contact the sender by reply email 
and destroy all copies of the original message.  Opinions, conclusions and 
other information in this message that do not relate to the official business 
of Starpoint Solutions shall be understood as neither given nor endorsed by it.


Re: Quick ActivationContext question

2013-08-14 Thread Nathan Quirynen

  
  
And what is the reason that you can't
  add the context when creating the event link as mentioned before:
  componentResources.createEventLink("deleteContactLog", contactLogId)



  
  On 14/08/13 16:32, Tony Nelson wrote:


  


  
-Original Message-
From: Thiago H de Paula Figueiredo [mailto:thiag...@gmail.com]
Sent: Wednesday, August 14, 2013 10:15 AM
To: Tapestry users
Subject: Re: Quick ActivationContext question

On Wed, 14 Aug 2013 10:50:32 -0300, Tony Nelson tnel...@starpoint.com
wrote:



  But if I hand craft the URL,
"/instihire/view/jacket:deletecontactlog/someidhere

And post that, it works just fine.



It does because you manually put the activation context in the URL, not
because you put the id in the POST part of the request. With that URL, you
could post nothing and it would work the exact same way.



  My fear is that it won't upgrade, but I'm pretty sure most of my stuff
won't upgrade when 5.4 comes out anyways.



What do you think will break when you upgrade?

It the handcrafted URL will very probably work after the upgrade, as nothing
is being changed about URL handling. But, as you said, handcrafting URLs is
not a good idea, and I agree with that.

Why don't you try what I suggested in my previous e-mail? ;)

  
  
Because I want to use Tapestry's built in Hibernate ValueEncoders.




Since 1982, Starpoint Solutions has been a trusted source of human capital and solutions. We are committed to our clients, employees, environment, community and social concerns.  We foster an inclusive culture based on trust, respect, honesty and solid performance. Learn more about Starpoint and our social responsibility at http://www.starpoint.com/social_responsibility

This email message from Starpoint Solutions LLC is for the sole use of  the intended recipient(s) and may contain confidential and privileged  information.  Any unauthorized review, use, disclosure or distribution is prohibited.  If you are not the intended recipient, please contact the sender by reply email and destroy all copies of the original message.  Opinions, conclusions and other information in this message that do not relate to the official business of Starpoint Solutions shall be understood as neither given nor endorsed by it.

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




-- 
  
  Een klare kijk op aanvullende
pensioenen
  
  Nathan Quirynen
  03 340 04 60 | 0494 28 45 15
  nat...@pensionarchitects.be
  
  Follow us on Web | Twitter | LinkedIn
| RSS
| YouTube
  

  



RE: Quick ActivationContext question

2013-08-14 Thread Tony Nelson


From: Nathan Quirynen [mailto:nat...@pensionarchitects.be]
Sent: Wednesday, August 14, 2013 10:41 AM
To: users@tapestry.apache.org
Subject: Re: Quick ActivationContext question

And what is the reason that you can't add the context when creating the event 
link as mentioned before:


componentResources.createEventLink(deleteContactLog, contactLogId)







Because I have a table of between 0 and N contactlogs, all that changes is the 
ID that I pass in, so I add that just before the ajax call.


Since 1982, Starpoint Solutions has been a trusted source of human capital and 
solutions. We are committed to our clients, employees, environment, community 
and social concerns. We foster an inclusive culture based on trust, respect, 
honesty and solid performance. Learn more about Starpoint and our social 
responsibility at http://www.starpoint.com/social_responsibility


This email message from Starpoint Solutions LLC is for the sole use of the 
intended recipient(s) and may contain confidential and privileged information. 
Any unauthorized review, use, disclosure or distribution is prohibited. If you 
are not the intended recipient, please contact the sender by reply email and 
destroy all copies of the original message. Opinions, conclusions and other 
information in this message that do not relate to the official business of 
Starpoint Solutions shall be understood as neither given nor endorsed by it.


Re: Quick ActivationContext question

2013-08-14 Thread Thiago H de Paula Figueiredo
On Wed, 14 Aug 2013 11:32:57 -0300, Tony Nelson tnel...@starpoint.com  
wrote:



Why don't you try what I suggested in my previous e-mail? ;)


Because I want to use Tapestry's built in Hibernate ValueEncoders.


Just @Inject ValueEncoderSource, which is what Tapestry itself uses. Or  
add the id to the URL itself, not to the post data.


--
Thiago H. de Paula Figueiredo

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



Quick ActivationContext question

2013-08-13 Thread Tony Nelson
I have a simple page that has an ActivationContext.  I'd like to handle a 
simple ajax call with one parameter.

When I use componentResource.createEventLink(foo), the URL contains the 
ActivationContext, like this:

/ih/view:foo?t:ac=77

I don't need the ActivationContext for this call, and I want to post the ajax 
call, so this URL won't work.

I know that I can hard code the URL as:

/ih/view:foo

Then add my parameter

/ih/view:foo/someval


And handle it just fine...

void onFoo(String param) { ... }

But hard coding the URL doesn't feel like the tapestry way.. is there a better 
way?

Thanks in advance
Tony


Since 1982, Starpoint Solutions has been a trusted source of human capital and 
solutions. We are committed to our clients, employees, environment, community 
and social concerns. We foster an inclusive culture based on trust, respect, 
honesty and solid performance. Learn more about Starpoint and our social 
responsibility at http://www.starpoint.com/social_responsibility


This email message from Starpoint Solutions LLC is for the sole use of the 
intended recipient(s) and may contain confidential and privileged information. 
Any unauthorized review, use, disclosure or distribution is prohibited. If you 
are not the intended recipient, please contact the sender by reply email and 
destroy all copies of the original message. Opinions, conclusions and other 
information in this message that do not relate to the official business of 
Starpoint Solutions shall be understood as neither given nor endorsed by it.


Re: Quick ActivationContext question

2013-08-13 Thread Lenny Primak
Have you tried to create onPassivate() that returns void / null?  Maybe that 
will solve your issue,
or you can just ignore the context.

On Aug 13, 2013, at 5:32 PM, Tony Nelson wrote:

 I have a simple page that has an ActivationContext.  I'd like to handle a 
 simple ajax call with one parameter.
 
 When I use componentResource.createEventLink(foo), the URL contains the 
 ActivationContext, like this:
 
 /ih/view:foo?t:ac=77
 
 I don't need the ActivationContext for this call, and I want to post the ajax 
 call, so this URL won't work.
 
 I know that I can hard code the URL as:
 
 /ih/view:foo
 
 Then add my parameter
 
 /ih/view:foo/someval
 
 
 And handle it just fine...
 
 void onFoo(String param) { ... }
 
 But hard coding the URL doesn't feel like the tapestry way.. is there a 
 better way?
 
 Thanks in advance
 Tony
 
 
 Since 1982, Starpoint Solutions has been a trusted source of human capital 
 and solutions. We are committed to our clients, employees, environment, 
 community and social concerns. We foster an inclusive culture based on trust, 
 respect, honesty and solid performance. Learn more about Starpoint and our 
 social responsibility at http://www.starpoint.com/social_responsibility
 
 
 This email message from Starpoint Solutions LLC is for the sole use of the 
 intended recipient(s) and may contain confidential and privileged 
 information. Any unauthorized review, use, disclosure or distribution is 
 prohibited. If you are not the intended recipient, please contact the sender 
 by reply email and destroy all copies of the original message. Opinions, 
 conclusions and other information in this message that do not relate to the 
 official business of Starpoint Solutions shall be understood as neither given 
 nor endorsed by it.


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



Re: Quick ActivationContext question

2013-08-13 Thread Dusko Jovanovski
I'm not sure what your exact scenario is, but are you aware that you can
pass an varargs parameter to the createEventLink method?

http://tapestry.apache.org/current/apidocs/org/apache/tapestry5/ComponentResourcesCommon.html#createEventLink(java.lang.String,
java.lang.Object...)

Seems like exactly what you are trying to accomplish.


On Tue, Aug 13, 2013 at 11:36 PM, Lenny Primak lpri...@hope.nyc.ny.uswrote:

 Have you tried to create onPassivate() that returns void / null?  Maybe
 that will solve your issue,
 or you can just ignore the context.

 On Aug 13, 2013, at 5:32 PM, Tony Nelson wrote:

  I have a simple page that has an ActivationContext.  I'd like to handle
 a simple ajax call with one parameter.
 
  When I use componentResource.createEventLink(foo), the URL contains
 the ActivationContext, like this:
 
  /ih/view:foo?t:ac=77
 
  I don't need the ActivationContext for this call, and I want to post the
 ajax call, so this URL won't work.
 
  I know that I can hard code the URL as:
 
  /ih/view:foo
 
  Then add my parameter
 
  /ih/view:foo/someval
 
 
  And handle it just fine...
 
  void onFoo(String param) { ... }
 
  But hard coding the URL doesn't feel like the tapestry way.. is there a
 better way?
 
  Thanks in advance
  Tony
 
  
  Since 1982, Starpoint Solutions has been a trusted source of human
 capital and solutions. We are committed to our clients, employees,
 environment, community and social concerns. We foster an inclusive culture
 based on trust, respect, honesty and solid performance. Learn more about
 Starpoint and our social responsibility at
 http://www.starpoint.com/social_responsibility
 
  
  This email message from Starpoint Solutions LLC is for the sole use of
 the intended recipient(s) and may contain confidential and privileged
 information. Any unauthorized review, use, disclosure or distribution is
 prohibited. If you are not the intended recipient, please contact the
 sender by reply email and destroy all copies of the original message.
 Opinions, conclusions and other information in this message that do not
 relate to the official business of Starpoint Solutions shall be understood
 as neither given nor endorsed by it.


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