Re: How to write to sitemap

2014-06-03 Thread Magnus Kvalheim
Hi.
Yes, you can generate the sitemap and place it an arbitrary location -
another domain even.

You provide a path to the sitemap in the robots.txt (which is located on
our real domain)

By doing so you have proven ownership of the domain and can basically host
the sitemap on any path/domain.
http://www.sitemaps.org/protocol.html#location

For google you can also use the webmaster tools for domain verification and
can also upload the sitemap.

best
Magnus



On Tue, Jun 3, 2014 at 8:30 AM, Lance Java lance.j...@googlemail.com
wrote:

 Another couple of options :

 1. Assuming you're building with maven and you don't have an Index page at
 root, save sitemap.xml to src/main/webapp and maven will add it to the root
 of your war. Note that this file is considered read only one your app has
 started.

 2. Use an index page. If the page activation context is sitemap.xml, return
 a textstreamresponse containing the sitemap (classpath?).
  On 3 Jun 2014 03:01, George Christman gchrist...@cardaddy.com wrote:

  Hi guys, I'm trying to automatically generate my sitemaps and I'm having
 a
  difficult time trying to figure out how to read/write to it. I currently
  have it in the root of my class path, is this the correct location? If
 so,
  how do I read/write to it?
 
  I'm using sitemapgen4j and this example
  http://www.codingpedia.org/ama/generate-sitemaps-with-sitemapgen4j/
 
  --
  George Christman
  www.CarDaddy.com
  P.O. Box 735
  Johnstown, New York
 



Exception reporting with mixed http https

2014-04-15 Thread Magnus Kvalheim
Hi guys.

We have used the recipe for Exception reporting - version 3
http://tapestry.apache.org/overriding-exception-reporting.html

This way we can render the exception page with the current uri (no redirect
and proper 40x).

The website have both http and https pages (@Secure).

The problem we're seeing is that if an error occur on a secure page it will
render our errorpage.
The errorpage does not have a Secure annotation and any eventlinks will
then expand to absolute http links - which does not work for ajax events.

Is this a known issue and should I file a proper JIRA?

Question 1.
It is possible somehow to problematically state that the page should be
secure/non secure depending on the current scheme?

Question 2.
Would it make sense to be able to specify if a page should be able to
operate in BOTH http and https modes? Something like @Secure(strict=false)
or @Scheme(http|https|both = true)

Thanks in advance
Magnus


Re: [5.4-beta-2] Two JavaScript Errors - Quick Fixes

2014-01-24 Thread Magnus Kvalheim
Thanks Howard, that's good tip :-)

Not verified, but think that will solve current issue I'm having with with
5.4 beta. Ajax radio submit, https://issues.apache.org/jira/browse/TAP5-2231

Have been unsuccessful in approach to override forms module and tried
unsuccessfully approaches like this:
@Contribute(JavaScriptStack.class)
@Core
public static void
setupCoreJavaScriptStack(OrderedConfigurationStackExtension
configuration) {
 configuration.override(t5/core/forms, new
StackExtension(StackExtensionType.MODULE, t5-custom/core/forms));
}

previously forms was not part of stack - so the fix by Thiago to customize
requirejs helped me patch it in the past that way
http://apache-tapestry-mailing-list-archives.1045711.n5.nabble.com/5-4-25-Ajax-submit-with-Radiogroup-submits-all-values-td5724905.html#a5724916

I have verified that Dimitris suggestion with naming works, but agree that
the ModuleManager approach seems like the best solution now.


A bit curious though - is a stack extension override supposed to work?
Seems like stack module name (override) in core keep name
't5-custom/core/forms',
while other modules keep referencing 't5/core/forms'. Possibly just a
documentation issue..?

/magnus


On Fri, Jan 24, 2014 at 7:05 PM, Howard Lewis Ship hls...@gmail.com wrote:

 Also, you can contribute overrides of modules to the ModuleManager service;
 this allows you to provide any old resource, including a patched version of
 a core module.  This is less error-prone that having two different files on
 the classpath with the same path and name ... you aren't beholden to a
 specific search order for the jars and files on the classpath.

 On my projects, I often have a T5PatchModule that contains all such
 contributions and overrides.


 On Fri, Jan 24, 2014 at 12:01 AM, Peter Hvass p.hv...@albourne.com
 wrote:

  Awesome tip! Thanks Dimitris! :D Even simpler!
 
  - Original Message -
 
  From: Dimitris Zenios dimitris.zen...@gmail.com
  To: Tapestry users users@tapestry.apache.org
  Sent: Thursday, January 23, 2014 11:43:58 PM
  Subject: Re: [5.4-beta-2] Two JavaScript Errors - Quick Fixes
 
  Until this is fixed a quick tip.
 
  You dont have to create custom jars.just create a new js file with the
 same
  filename as the one you want to fix and place it on your meta-inf using
 the
  same folder structure as the originall
 
  Dimitris Zenios
  On 23 Jan 2014 10:26, Peter Hvass p.hv...@albourne.com wrote:
 
   Hi Thiago,
  
   Many, many thanks indeed! Have a great weekend!
  
   Peter
  
   - Original Message -
  
   From: Thiago H de Paula Figueiredo thiag...@gmail.com
   To: Tapestry users users@tapestry.apache.org
   Sent: Wednesday, January 22, 2014 6:33:37 PM
   Subject: Re: [5.4-beta-2] Two JavaScript Errors - Quick Fixes
  
   On Wed, 22 Jan 2014 06:40:19 -0200, Peter Hvass p.hv...@albourne.com
   wrote:
  
Hi all,
  
   Hi!
  
Through the alphas and now the betas we've been running with custom
tapestry-core JARs given
two JavaScript issues; one which cripples AjaxFormLoop and the other
causing pageinit.js errors
and thus interrupting script execution on IE8.
   
These are both super quick fixes and so was wondering if I could ask
that they be included in the
upcoming beta-3?
   
Both on the JIRA;
https://issues.apache.org/jira/browse/TAP5-2230?filter=-2
https://issues.apache.org/jira/browse/TAP5-2272?filter=-2
  
   I'll try to apply the fixes this week.
  
   --
   Thiago H. de Paula Figueiredo
   Tapestry, Java and Hibernate consultant and developer
   http://machina.com.br
  
   -
   To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org
   For additional commands, e-mail: users-h...@tapestry.apache.org
  
  
  
 
 


 --
 Howard M. Lewis Ship

 Creator of Apache Tapestry

 The source for Tapestry training, mentoring and support. Contact me to
 learn how I can get you up and productive in Tapestry fast!

 (971) 678-5210
 http://howardlewisship.com



Re: [5.4-beta-2] Two JavaScript Errors - Quick Fixes

2014-01-24 Thread Magnus Kvalheim
Okay, so I've tried the override through ModuleManager, but seems like it
don't work in case it's part of stack?

@Contribute(ModuleManager.class)
public static void overrideCoreModules(MappedConfigurationString,
JavaScriptModuleConfiguration configuration,
 Resource forms =
assetSource.resourceForPath(/META-INF/modules/t5-custom/core/forms.coffee);
configuration.override(t5/core/forms, new
JavaScriptModuleConfiguration(forms));
}

org.apache.tapestry5.ioc.internal.OperationException: Override for key
t5/core/forms  (at
com.movellas.web.drama.services.AppModule.overrideCoreModules(MappedConfiguration,
AssetSource) (at AppModule.java:614)) does not match an existing key.

Perhaps missing something obvious?

/magnus


On Sat, Jan 25, 2014 at 12:04 AM, Magnus Kvalheim mag...@kvalheim.euwrote:

 Thanks Howard, that's good tip :-)

 Not verified, but think that will solve current issue I'm having with with
 5.4 beta. Ajax radio submit,
 https://issues.apache.org/jira/browse/TAP5-2231

 Have been unsuccessful in approach to override forms module and tried
 unsuccessfully approaches like this:
 @Contribute(JavaScriptStack.class)
 @Core
 public static void
 setupCoreJavaScriptStack(OrderedConfigurationStackExtension
 configuration) {
  configuration.override(t5/core/forms, new
 StackExtension(StackExtensionType.MODULE, t5-custom/core/forms));
 }

 previously forms was not part of stack - so the fix by Thiago to customize
 requirejs helped me patch it in the past that way

 http://apache-tapestry-mailing-list-archives.1045711.n5.nabble.com/5-4-25-Ajax-submit-with-Radiogroup-submits-all-values-td5724905.html#a5724916

 I have verified that Dimitris suggestion with naming works, but agree that
 the ModuleManager approach seems like the best solution now.


 A bit curious though - is a stack extension override supposed to work?
 Seems like stack module name (override) in core keep name 
 't5-custom/core/forms',
 while other modules keep referencing 't5/core/forms'. Possibly just a
 documentation issue..?

 /magnus


 On Fri, Jan 24, 2014 at 7:05 PM, Howard Lewis Ship hls...@gmail.comwrote:

 Also, you can contribute overrides of modules to the ModuleManager
 service;
 this allows you to provide any old resource, including a patched version
 of
 a core module.  This is less error-prone that having two different files
 on
 the classpath with the same path and name ... you aren't beholden to a
 specific search order for the jars and files on the classpath.

 On my projects, I often have a T5PatchModule that contains all such
 contributions and overrides.


 On Fri, Jan 24, 2014 at 12:01 AM, Peter Hvass p.hv...@albourne.com
 wrote:

  Awesome tip! Thanks Dimitris! :D Even simpler!
 
  - Original Message -
 
  From: Dimitris Zenios dimitris.zen...@gmail.com
  To: Tapestry users users@tapestry.apache.org
  Sent: Thursday, January 23, 2014 11:43:58 PM
  Subject: Re: [5.4-beta-2] Two JavaScript Errors - Quick Fixes
 
  Until this is fixed a quick tip.
 
  You dont have to create custom jars.just create a new js file with the
 same
  filename as the one you want to fix and place it on your meta-inf using
 the
  same folder structure as the originall
 
  Dimitris Zenios
  On 23 Jan 2014 10:26, Peter Hvass p.hv...@albourne.com wrote:
 
   Hi Thiago,
  
   Many, many thanks indeed! Have a great weekend!
  
   Peter
  
   - Original Message -
  
   From: Thiago H de Paula Figueiredo thiag...@gmail.com
   To: Tapestry users users@tapestry.apache.org
   Sent: Wednesday, January 22, 2014 6:33:37 PM
   Subject: Re: [5.4-beta-2] Two JavaScript Errors - Quick Fixes
  
   On Wed, 22 Jan 2014 06:40:19 -0200, Peter Hvass p.hv...@albourne.com
 
   wrote:
  
Hi all,
  
   Hi!
  
Through the alphas and now the betas we've been running with custom
tapestry-core JARs given
two JavaScript issues; one which cripples AjaxFormLoop and the other
causing pageinit.js errors
and thus interrupting script execution on IE8.
   
These are both super quick fixes and so was wondering if I could ask
that they be included in the
upcoming beta-3?
   
Both on the JIRA;
https://issues.apache.org/jira/browse/TAP5-2230?filter=-2
https://issues.apache.org/jira/browse/TAP5-2272?filter=-2
  
   I'll try to apply the fixes this week.
  
   --
   Thiago H. de Paula Figueiredo
   Tapestry, Java and Hibernate consultant and developer
   http://machina.com.br
  
   -
   To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org
   For additional commands, e-mail: users-h...@tapestry.apache.org
  
  
  
 
 


 --
 Howard M. Lewis Ship

 Creator of Apache Tapestry

 The source for Tapestry training, mentoring and support. Contact me to
 learn how I can get you up and productive in Tapestry fast!

 (971) 678-5210
 http://howardlewisship.com





Re: Any thoughts on Tapestry with PhoneGap?

2014-01-23 Thread Magnus Kvalheim
Yes, I'm also a little puzzled how Exfm got away with it.. :)


Think apps that are distributed through appstore needs to go through the
normal approval process.

... but, Apple does have an Enterprise program where apps are not required
to be approved by them. Could be a viable option, but comes with a steeper
price-tag.
https://developer.apple.com/programs/ios/enterprise

/magnus



On Thu, Jan 23, 2014 at 3:44 AM, Geoff Callender 
geoff.callender.jumpst...@gmail.com wrote:

 Excellent point, Magnus. I wonder how Exfm got away with it?

 My app is actually for use within a business, ie. it's not public, but the
 users will be very geographically dispersed; so I will look into whether
 the App Store has more relaxed rules for Enterprise apps.

 BTW, the tips in the Exfm blog entry are great. Thanks.

 Geoff

 On 22/01/2014, at 9:42 PM, Magnus Kvalheim wrote:

  Hi Geoff.
 
  Think Apple guys officially don't look too kind on views(full markup,
  assets) created outside of app.
  It could mean that look'n feel - and possibly behavior may change after
  it's been approved as it's controlled from server.
  You 'may' risk a possible rejection based on that.
 
  That said, I know Exfm quite successfully and publicly have gone down
  similar routes so chances are you could be fine..
  http://phonegap.com/blog/2013/04/23/story-behind-exfm/
 
  Just my 2 cents :-)
 
  /magnus
 
  On Wed, Jan 22, 2014 at 11:29 AM, Lance Java lance.j...@googlemail.com
 wrote:
 
  You're not going to be able to host a tapestry app on the phone since
 (to
  my knowledge) you can't run a jvm / servlet container on IOS. I've heard
  that jetty has been ported to android but you still won't be able to run
  Tapestry on android since ASM won't work on Dalvik.
 
  So, these things taken into account, I think you are left with the phone
  maknig request / response calls to a remote tapestry app. I guess your
  choice is to generate the html serverside or to get json responses from
  tapestry and render the DOM clientside in javascript.
 
  Since you've already taken the performance hit of a request / response,
 I
  don't see a problem with using tapestry to generate the HTML serverside.
  I'm slightly biased towards generating markup serverside. I try to avoid
  javascript where possible which is why I love tapestry. This would mean
  your app is basically a glorified browser :)
 
  If you want to render the dom clientside using javascript then you might
  want to use tapestry-resteasy to help with the restful backend services
 


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




Re: Any thoughts on Tapestry with PhoneGap?

2014-01-22 Thread Magnus Kvalheim
Hi Geoff.

Think Apple guys officially don't look too kind on views(full markup,
assets) created outside of app.
It could mean that look'n feel - and possibly behavior may change after
it's been approved as it's controlled from server.
You 'may' risk a possible rejection based on that.

That said, I know Exfm quite successfully and publicly have gone down
similar routes so chances are you could be fine..
http://phonegap.com/blog/2013/04/23/story-behind-exfm/

Just my 2 cents :-)

/magnus

On Wed, Jan 22, 2014 at 11:29 AM, Lance Java lance.j...@googlemail.comwrote:

 You're not going to be able to host a tapestry app on the phone since (to
 my knowledge) you can't run a jvm / servlet container on IOS. I've heard
 that jetty has been ported to android but you still won't be able to run
 Tapestry on android since ASM won't work on Dalvik.

 So, these things taken into account, I think you are left with the phone
 maknig request / response calls to a remote tapestry app. I guess your
 choice is to generate the html serverside or to get json responses from
 tapestry and render the DOM clientside in javascript.

 Since you've already taken the performance hit of a request / response, I
 don't see a problem with using tapestry to generate the HTML serverside.
 I'm slightly biased towards generating markup serverside. I try to avoid
 javascript where possible which is why I love tapestry. This would mean
 your app is basically a glorified browser :)

 If you want to render the dom clientside using javascript then you might
 want to use tapestry-resteasy to help with the restful backend services



Re: Changing to default localization without extension for the language

2013-12-17 Thread Magnus Kvalheim
Hi Geoff.

A bit of an old thread now, but am also looking for a way to clear/reset
persistent locale.

Did you/anyone come up with a solution?

/magnus


On Sat, Nov 24, 2012 at 3:57 AM, Geoff Callender 
geoff.callender.jumpst...@gmail.com wrote:

 Once I have gone to a specific locale I can't get back to the default
 locale in a way that leaves locale out of the URL.

 eg. from
 http://localhost:8080/myapp/mypage
 to
 http://localhost:8080/myapp/en_GB/mypage
 and back to
 http://localhost:8080/myapp/mypage

 I have tried LocalizationSetter#setLocaleFromLocaleName() but the locale
 won't change because it isn't supported.
 So I tried adding  to the SUPPORTED_LOCALES, and that gave me an invalid
 URL:

 http://localhost:8080/myapp//mypage

 Exactly the same effect using Locale.ROOT, because Locale.ROOT.toString()
 is  and Locale.ROOT.getDisplayName() is .

 The source of the problem seems to be that locale starts off as null in
 ThreadLocaleImpl and PersistentLocaleImpl but it's not possible to set it
 back to null.

 What have I missed?

 On 20/11/2012, at 12:55 AM, Ivan Khalopik wrote:

  I don't understand your question.
  But if you change locale using PersistentLocale service it will be
  persisted in URL and be changed for next page request. The new localale
  should also be configured in tapestry.supported-locales symbol.
  If you want to chnge locale just for this request you can use
  ThreadLocale#setLocale(...) method.
  If you need both variants with safety and advantage of finding the
 closest
  supported locale use LocalizationSetter#setLocaleFromLocaleName(en)
 
  All message catalogs will be accessed by tapestry with right choose. Just
  use .properties for default locale, _ro.properties to override properties
  for ro locale, _en.properties for en locale.
  If you want to change locale to default (not ro) use Locale.ROOT constant
  for java 6, and new Locale() for older versions.
 
  On Mon, Nov 19, 2012 at 3:10 PM, o3005659 o3005...@rtrtr.com wrote:
 
  I have made localization ro and en. Ro is by default, however I didn't
  extend
  my property files with_ro extension, but I simply put
  thisispropertyfile.properties. Now I have implemented for English
 
   public String onActionFromGoEnglish()
 {
 persistentLocale.set(new Locale(en));
 return null;
 }
 
  however, I don't know how to access property files that have no _ro
  extension in example when user switches from en to ro. What to points my
  persistenLocale then?
 
 
 
  --
  View this message in context:
 
 http://tapestry.1045711.n5.nabble.com/Changing-to-default-localization-without-extension-for-the-language-tp5718092.html
  Sent from the Tapestry - User mailing list archive at Nabble.com.
 
  -
  To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org
  For additional commands, e-mail: users-h...@tapestry.apache.org
 
 
 
 
  --
  BR
  Ivan


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




Re: Changing to default localization without extension for the language

2013-12-17 Thread Magnus Kvalheim
Yes, decorating didn't seem possible - so have (for now) copied and
overridden PersistentLocaleImpl to allow null.

It is part of a requirement to always force locale through uri, except for
english which is on unlocalized. So need to clear persistentlocale when
switching to english.

Locale switch also set's cookie, so preferred locale is
remembered(redirect).
Approach is similar to how aws locale resolution works,
http://aws.amazon.com/ .

Have also replaced and overridden PageRender/- and
ComponentEventDispatchers to insert locale resolution logic in between
decoding of request parameters and it's delegation to request handler.
Seems to work, but let me know if someone can think of a more elegant
solution.

/magnus

On Tue, Dec 17, 2013 at 9:03 PM, Lance Java lance.j...@googlemail.comwrote:

 I'm surprised that PersistentLocale does not have the ability to clear the
 value once it's set. Looking at PersistentLocaleImpl it doesn't allow
 setting to null.

 Perhaps you could override / decorate PersistentLocale to support clearing
 the value (by setting null).

 If decorating, you'll likely require a PerThreadValue. If overriding,
 you'll likely copy / paste / tweak PersistentLocaleImpl.



Re: domain change with path added

2013-11-23 Thread Magnus Kvalheim
Hi Alex.

Typically you don't set the context path. And if you do, then it's often in
the app server(container) config.

The value of context path is normally the same as the warfile name, and
then you use the (httpservlet)request-interface to access it.

I can see that 5.4 have deprected Request#getContextPath and added a
symbolconstant for it. Not sure why, but probably for some good reason. -
perhaps abstraction as Request interface if different from
httpservletrequest

I've only used ROOT tap apps myself, but you can still inject use
httpservletrequest or tapestry request to access context path.

If you need to set it then you can:
1. change war file name
2. configure appsever/container config appropriately for your app
3. configure tapestry SymbolConstants#CONTEXT_PATH

-magnus

On Sat, Nov 23, 2013 at 5:43 PM, Alexander Sommer 
alexander.som...@gmail.com wrote:

 Hi!

 I would like to set the context path but as it seems the setting is just
 part of tapestry 5.4 but i am using 5.3.7.

 I just want to know what i need to set because my web app now runs under
 root/production (before it was running under root)

 thx!!!

 tapestry.context-path
 *Added in 5.4*

 Identifies the context path of the application, as determined from
 ServletContext.getContextPath() method. This is either a blank string or a
 string that starts with a slash but does not end with one.


 2013/11/23 Alexander Sommer alexander.som...@gmail.com

  no, my app is wired since changing to root/production. i think i need to
  set the context path somewhere.
 
 
  2013/11/23 Alexander Sommer alexander.som...@gmail.com
 
  thx for the answers. how can i set the context path in tapestry? by the
  way it seems that my app is normally running ( i did not set anything
  despite the new contxt root/production)
 
 
  2013/11/15 Thiago H de Paula Figueiredo thiag...@gmail.com
 
  On Fri, 15 Nov 2013 17:39:32 -0200, Alexander Sommer 
  alexander.som...@gmail.com wrote:
 
Hi!
 
 
  Hi!
 
I was moving my tapestry application on another server from domain to
  domain/production, and now, my custom made sitemap viewer does not
  generate appropriate urls anymore. (the normal tapestry page links are
  working well - so the application in general is working well)
 
   but not my custom sitemapViewer page. The links which are generated
  with writer.element(a, href, / + item.getPage()); only generate
  domain/url but not domain/production/url
 
 
  If the URLs you're generating are Tapestry pages, use
  PageRenderLinkSource and Link.toAbsoluteURL() and they'll take care of
 it
  for you. See also the BaseURLSource service for an alternative.
 
  --
  Thiago H. de Paula Figueiredo
  Tapestry, Java and Hibernate consultant and developer
  http://machina.com.br
 
 
  -
  To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org
  For additional commands, e-mail: users-h...@tapestry.apache.org
 
 
 
 



Re: [5.4.25] Ajax submit with Radiogroup submits all values

2013-11-22 Thread Magnus Kvalheim
Just verified again with a simple form like this one:
http://tapestry.apache.org/current/apidocs/org/apache/tapestry5/corelib/components/Radio.html

=tml=
h2Selected type: ${type}/h2
t:zone t:id=formZone
t:form t:zone=^ t:id=radioForm

t:label for=type /:

 t:radiogroup t:id=type
 t:radio t:id=masterCard /
t:label for=masterCard /
t:radio t:id=visa /
 t:label for=visa /
t:radio t:id=amex /
t:label for=amex /
 t:radio t:id=dinersClub /
t:label for=dinersClub /
t:radio t:id=discover /
 t:label for=discover /
/t:radiogroup
 t:submit/

/t:form
/t:zone

=Java=
public enum CardType{MASTER_CARD, VISA, AMERICAN_EXPRESS, DINERS_CLUB,
DISCOVER}

@InjectComponent private Zone formZone;
@Inject private Request request;

@Property
@Persist
private CardType type;

public CardType getMasterCard() { return CardType.MASTER_CARD; }

public CardType getVisa() { return CardType.VISA; }

public CardType getAmex() { return CardType.AMERICAN_EXPRESS; }

public CardType getDinersClub() { return CardType.DINERS_CLUB; }

public CardType getDiscover() { return CardType.DISCOVER; }

Object onSubmitFromRadioForm() {
return request.isXHR() ? formZone.getBody() : null;
}

=Request Form data=
t:zoneid:formZone
t:submit:[submit_19b3a276fbae1_0,submit_0]
t:formdata:hxLFSgWPQ9kZJpyI3CYQavAif/A=:H4sIAFvzloG1XIxBpCS1uEQ/KLW4ID+vOLMs1aqksiC1uIjBIr8oXS+xIDE5I1WvJBEoVFJUaaqXnF+UmpOZBKRzgepT80qK9YISUzLz3YvySwtUglNLSgsmGuzT2cz3+RATA6MPA3dyfl5JUX6OX2JuagmDkE9WYlmifk5iXrp+cElRZl66dUVBCQMLyEo8TjEhwymGpypOndoU/HcfEwNDRUG5BIMYuuHFpUm5mSVA4x2INT4YrEMloCg/ObW4GMwrLs7Mz5sZ/Ely65YWZyYGJh8GjuScTKBqz5RChjpwCKTmpOYCBUAhABYC+VgMYnm8oWWScaKRuVlaUmKqYbxBCQMHVMIAANTuUEWeAQAA
*type:MASTER_CARD*
*type:VISA*
*type:AMERICAN_EXPRESS*
*type:DINERS_CLUB*
*type:DISCOVER*

Looks like the forms.gatherParameters (forms.js) is adding all values -
and not just the checked one.

I'll create a JIRA.

magnus

On Thu, Nov 21, 2013 at 11:07 PM, Magnus Kvalheim mag...@kvalheim.euwrote:

 Hi guys.

 Just notised a strange issue with radio ajax/zone submit. It submits all
 values - selected and not selected.

 - If I disable javascript - then it submits single value. Correct
 - If I remove form t:zone then it also submits fine. Correct

 If I enable t:zone then it submits all possible radio values.


 Please let me know if anyone can confirm.

 Thanks
 Magnus



Re: [5.4.25] Ajax submit with Radiogroup submits all values

2013-11-22 Thread Magnus Kvalheim
JIRA is here: https://issues.apache.org/jira/browse/TAP5-2231

On Fri, Nov 22, 2013 at 9:10 AM, Magnus Kvalheim mag...@kvalheim.eu wrote:

 Just verified again with a simple form like this one:

 http://tapestry.apache.org/current/apidocs/org/apache/tapestry5/corelib/components/Radio.html

 =tml=
 h2Selected type: ${type}/h2
 t:zone t:id=formZone
 t:form t:zone=^ t:id=radioForm

 t:label for=type /:

  t:radiogroup t:id=type
  t:radio t:id=masterCard /
 t:label for=masterCard /
 t:radio t:id=visa /
  t:label for=visa /
 t:radio t:id=amex /
 t:label for=amex /
  t:radio t:id=dinersClub /
 t:label for=dinersClub /
 t:radio t:id=discover /
  t:label for=discover /
 /t:radiogroup
  t:submit/

 /t:form
 /t:zone

 =Java=
 public enum CardType{MASTER_CARD, VISA, AMERICAN_EXPRESS, DINERS_CLUB,
 DISCOVER}

 @InjectComponent private Zone formZone;
 @Inject private Request request;

 @Property
 @Persist
 private CardType type;

 public CardType getMasterCard() { return CardType.MASTER_CARD; }

 public CardType getVisa() { return CardType.VISA; }

 public CardType getAmex() { return CardType.AMERICAN_EXPRESS; }

 public CardType getDinersClub() { return CardType.DINERS_CLUB; }

 public CardType getDiscover() { return CardType.DISCOVER; }

 Object onSubmitFromRadioForm() {
 return request.isXHR() ? formZone.getBody() : null;
 }

 =Request Form data=
 t:zoneid:formZone
 t:submit:[submit_19b3a276fbae1_0,submit_0]

 t:formdata:hxLFSgWPQ9kZJpyI3CYQavAif/A=:H4sIAFvzloG1XIxBpCS1uEQ/KLW4ID+vOLMs1aqksiC1uIjBIr8oXS+xIDE5I1WvJBEoVFJUaaqXnF+UmpOZBKRzgepT80qK9YISUzLz3YvySwtUglNLSgsmGuzT2cz3+RATA6MPA3dyfl5JUX6OX2JuagmDkE9WYlmifk5iXrp+cElRZl66dUVBCQMLyEo8TjEhwymGpypOndoU/HcfEwNDRUG5BIMYuuHFpUm5mSVA4x2INT4YrEMloCg/ObW4GMwrLs7Mz5sZ/Ely65YWZyYGJh8GjuScTKBqz5RChjpwCKTmpOYCBUAhABYC+VgMYnm8oWWScaKRuVlaUmKqYbxBCQMHVMIAANTuUEWeAQAA
 *type:MASTER_CARD*
 *type:VISA*
 *type:AMERICAN_EXPRESS*
 *type:DINERS_CLUB*
 *type:DISCOVER*

 Looks like the forms.gatherParameters (forms.js) is adding all values -
 and not just the checked one.

 I'll create a JIRA.

 magnus

 On Thu, Nov 21, 2013 at 11:07 PM, Magnus Kvalheim mag...@kvalheim.euwrote:

 Hi guys.

 Just notised a strange issue with radio ajax/zone submit. It submits all
 values - selected and not selected.

 - If I disable javascript - then it submits single value. Correct
 - If I remove form t:zone then it also submits fine. Correct

 If I enable t:zone then it submits all possible radio values.


 Please let me know if anyone can confirm.

 Thanks
 Magnus





Re: [5.4.25] Ajax submit with Radiogroup submits all values

2013-11-22 Thread Magnus Kvalheim
So, was looking into fixing this myself as a temporary workaround.

I think the fix is quite clean, and of interest for others in similar
situation, so I'll briefly post it.

--
What I wanted to do was to make a modified version of forms.coffee and
contribute/override that somehow.
The forms.coffee mod is quite simple: (line 77)

Replace:  return if type is checkbox  field.checked() is false
with: return if (type is checkbox || type is radio)  field.checked()
is false


Then contribute to JavascriptStack like so
@Contribute(JavaScriptStack.class)
 @Core
public static void
setupCoreJavaScriptStack(OrderedConfigurationStackExtension
configuration) {
 configuration.override(t5/core/forms, new
StackExtension(StackExtensionType.MODULE, t5-custom/core/forms));
}

However, t5/core/forms is not actually added to the stack so I had to look
elsewhere.


The solution: Set and alias path on Requirejs config for forms module
Thiagos RequireJs config contribution have now made this possible,
https://issues.apache.org/jira/browse/TAP5-2196

jsSupport.addModuleConfigurationCallback(new ModuleConfigurationCallback() {
 @Override
public JSONObject configure(JSONObject configuration) {
 JSONObject paths = (JSONObject) configuration.opt(paths);
if(paths==null) paths = new JSONObject();
 paths.put(t5/core/forms, t5-custom/core/forms);
 configuration.put(paths, paths);
 return configuration;
}
});


Just great, thanks again Thiago :-)


On Fri, Nov 22, 2013 at 9:34 AM, Magnus Kvalheim mag...@kvalheim.eu wrote:

 JIRA is here: https://issues.apache.org/jira/browse/TAP5-2231

 On Fri, Nov 22, 2013 at 9:10 AM, Magnus Kvalheim mag...@kvalheim.euwrote:

 Just verified again with a simple form like this one:

 http://tapestry.apache.org/current/apidocs/org/apache/tapestry5/corelib/components/Radio.html

 =tml=
 h2Selected type: ${type}/h2
 t:zone t:id=formZone
 t:form t:zone=^ t:id=radioForm

 t:label for=type /:

  t:radiogroup t:id=type
  t:radio t:id=masterCard /
 t:label for=masterCard /
 t:radio t:id=visa /
  t:label for=visa /
 t:radio t:id=amex /
 t:label for=amex /
  t:radio t:id=dinersClub /
 t:label for=dinersClub /
 t:radio t:id=discover /
  t:label for=discover /
 /t:radiogroup
  t:submit/

 /t:form
 /t:zone

 =Java=
 public enum CardType{MASTER_CARD, VISA, AMERICAN_EXPRESS, DINERS_CLUB,
 DISCOVER}

 @InjectComponent private Zone formZone;
 @Inject private Request request;

 @Property
 @Persist
 private CardType type;

 public CardType getMasterCard() { return CardType.MASTER_CARD; }

 public CardType getVisa() { return CardType.VISA; }

 public CardType getAmex() { return CardType.AMERICAN_EXPRESS; }

 public CardType getDinersClub() { return CardType.DINERS_CLUB; }

 public CardType getDiscover() { return CardType.DISCOVER; }

 Object onSubmitFromRadioForm() {
 return request.isXHR() ? formZone.getBody() : null;
 }

 =Request Form data=
 t:zoneid:formZone
 t:submit:[submit_19b3a276fbae1_0,submit_0]

 t:formdata:hxLFSgWPQ9kZJpyI3CYQavAif/A=:H4sIAFvzloG1XIxBpCS1uEQ/KLW4ID+vOLMs1aqksiC1uIjBIr8oXS+xIDE5I1WvJBEoVFJUaaqXnF+UmpOZBKRzgepT80qK9YISUzLz3YvySwtUglNLSgsmGuzT2cz3+RATA6MPA3dyfl5JUX6OX2JuagmDkE9WYlmifk5iXrp+cElRZl66dUVBCQMLyEo8TjEhwymGpypOndoU/HcfEwNDRUG5BIMYuuHFpUm5mSVA4x2INT4YrEMloCg/ObW4GMwrLs7Mz5sZ/Ely65YWZyYGJh8GjuScTKBqz5RChjpwCKTmpOYCBUAhABYC+VgMYnm8oWWScaKRuVlaUmKqYbxBCQMHVMIAANTuUEWeAQAA
 *type:MASTER_CARD*
 *type:VISA*
 *type:AMERICAN_EXPRESS*
 *type:DINERS_CLUB*
 *type:DISCOVER*

 Looks like the forms.gatherParameters (forms.js) is adding all values -
 and not just the checked one.

 I'll create a JIRA.

 magnus

 On Thu, Nov 21, 2013 at 11:07 PM, Magnus Kvalheim mag...@kvalheim.euwrote:

 Hi guys.

 Just notised a strange issue with radio ajax/zone submit. It submits all
 values - selected and not selected.

 - If I disable javascript - then it submits single value. Correct
 - If I remove form t:zone then it also submits fine. Correct

 If I enable t:zone then it submits all possible radio values.


 Please let me know if anyone can confirm.

 Thanks
 Magnus






Re: [5.4.25] Ajax submit with Radiogroup submits all values

2013-11-22 Thread Magnus Kvalheim
Hi Chris, yes sure - will do that in the Jira.

I think also the solution is interesting because it shows what's possible
now with more flexible requirejs config on Tapestry side.
One obvious use case for paths is to configure 'local' paths for thirdparty
amd modules which themselves express dependencies.
(But can also be used to 'patch' tapestry modules as mentioned here)


On Fri, Nov 22, 2013 at 12:20 PM, Chris Poulsen mailingl...@nesluop.dkwrote:

 Why not submit a patch, now that you've spent the time figuring it out?


 On Fri, Nov 22, 2013 at 12:07 PM, Magnus Kvalheim mag...@kvalheim.eu
 wrote:

  So, was looking into fixing this myself as a temporary workaround.
 
  I think the fix is quite clean, and of interest for others in similar
  situation, so I'll briefly post it.
 
  --
  What I wanted to do was to make a modified version of forms.coffee and
  contribute/override that somehow.
  The forms.coffee mod is quite simple: (line 77)
 
  Replace:  return if type is checkbox  field.checked() is false
  with: return if (type is checkbox || type is radio) 
 field.checked()
  is false
 
 
  Then contribute to JavascriptStack like so
  @Contribute(JavaScriptStack.class)
   @Core
  public static void
  setupCoreJavaScriptStack(OrderedConfigurationStackExtension
  configuration) {
   configuration.override(t5/core/forms, new
  StackExtension(StackExtensionType.MODULE, t5-custom/core/forms));
  }
 
  However, t5/core/forms is not actually added to the stack so I had to
 look
  elsewhere.
 
 
  The solution: Set and alias path on Requirejs config for forms module
  Thiagos RequireJs config contribution have now made this possible,
  https://issues.apache.org/jira/browse/TAP5-2196
 
  jsSupport.addModuleConfigurationCallback(new
 ModuleConfigurationCallback()
  {
   @Override
  public JSONObject configure(JSONObject configuration) {
   JSONObject paths = (JSONObject) configuration.opt(paths);
  if(paths==null) paths = new JSONObject();
   paths.put(t5/core/forms, t5-custom/core/forms);
   configuration.put(paths, paths);
   return configuration;
  }
  });
 
 
  Just great, thanks again Thiago :-)
 
 
  On Fri, Nov 22, 2013 at 9:34 AM, Magnus Kvalheim mag...@kvalheim.eu
  wrote:
 
   JIRA is here: https://issues.apache.org/jira/browse/TAP5-2231
  
   On Fri, Nov 22, 2013 at 9:10 AM, Magnus Kvalheim mag...@kvalheim.eu
  wrote:
  
   Just verified again with a simple form like this one:
  
  
 
 http://tapestry.apache.org/current/apidocs/org/apache/tapestry5/corelib/components/Radio.html
  
   =tml=
   h2Selected type: ${type}/h2
   t:zone t:id=formZone
   t:form t:zone=^ t:id=radioForm
  
   t:label for=type /:
  
t:radiogroup t:id=type
t:radio t:id=masterCard /
   t:label for=masterCard /
   t:radio t:id=visa /
t:label for=visa /
   t:radio t:id=amex /
   t:label for=amex /
t:radio t:id=dinersClub /
   t:label for=dinersClub /
   t:radio t:id=discover /
t:label for=discover /
   /t:radiogroup
t:submit/
  
   /t:form
   /t:zone
  
   =Java=
   public enum CardType{MASTER_CARD, VISA, AMERICAN_EXPRESS, DINERS_CLUB,
   DISCOVER}
  
   @InjectComponent private Zone formZone;
   @Inject private Request request;
  
   @Property
   @Persist
   private CardType type;
  
   public CardType getMasterCard() { return CardType.MASTER_CARD; }
  
   public CardType getVisa() { return CardType.VISA; }
  
   public CardType getAmex() { return CardType.AMERICAN_EXPRESS; }
  
   public CardType getDinersClub() { return CardType.DINERS_CLUB; }
  
   public CardType getDiscover() { return CardType.DISCOVER; }
  
   Object onSubmitFromRadioForm() {
   return request.isXHR() ? formZone.getBody() : null;
   }
  
   =Request Form data=
   t:zoneid:formZone
   t:submit:[submit_19b3a276fbae1_0,submit_0]
  
  
 
 t:formdata:hxLFSgWPQ9kZJpyI3CYQavAif/A=:H4sIAFvzloG1XIxBpCS1uEQ/KLW4ID+vOLMs1aqksiC1uIjBIr8oXS+xIDE5I1WvJBEoVFJUaaqXnF+UmpOZBKRzgepT80qK9YISUzLz3YvySwtUglNLSgsmGuzT2cz3+RATA6MPA3dyfl5JUX6OX2JuagmDkE9WYlmifk5iXrp+cElRZl66dUVBCQMLyEo8TjEhwymGpypOndoU/HcfEwNDRUG5BIMYuuHFpUm5mSVA4x2INT4YrEMloCg/ObW4GMwrLs7Mz5sZ/Ely65YWZyYGJh8GjuScTKBqz5RChjpwCKTmpOYCBUAhABYC+VgMYnm8oWWScaKRuVlaUmKqYbxBCQMHVMIAANTuUEWeAQAA
   *type:MASTER_CARD*
   *type:VISA*
   *type:AMERICAN_EXPRESS*
   *type:DINERS_CLUB*
   *type:DISCOVER*
  
   Looks like the forms.gatherParameters (forms.js) is adding all
 values
  -
   and not just the checked one.
  
   I'll create a JIRA.
  
   magnus
  
   On Thu, Nov 21, 2013 at 11:07 PM, Magnus Kvalheim mag...@kvalheim.eu
  wrote:
  
   Hi guys.
  
   Just notised a strange issue with radio ajax/zone submit. It submits
  all
   values - selected and not selected.
  
   - If I disable javascript - then it submits single value. Correct
   - If I remove form t:zone then it also submits fine. Correct
  
   If I enable t:zone then it submits all possible radio values.
  
  
   Please let me know if anyone can confirm.
  
   Thanks
   Magnus
  
  
  
  
 



[5.4.25] Ajax submit with Radiogroup submits all values

2013-11-21 Thread Magnus Kvalheim
Hi guys.

Just notised a strange issue with radio ajax/zone submit. It submits all
values - selected and not selected.

- If I disable javascript - then it submits single value. Correct
- If I remove form t:zone then it also submits fine. Correct

If I enable t:zone then it submits all possible radio values.


Please let me know if anyone can confirm.

Thanks
Magnus


Re: domain change with path added

2013-11-15 Thread Bård Magnus Kvalheim
Hi Alex

Could you be missing to add contextpath when generating the url?
http://docs.oracle.com/cd/E17802_01/webservices/webservices/docs/1.6/api/javax/servlet/http/HttpServletRequest.html#getContextPath()

If the app was previously deployed in 'ROOT' context then the contextpath
was - well - empty. And now it's got a value to account for?

Btw - Here's also an example of how to generate/reconstruct urls
http://gabijack.com/reconstructing-original-request-url/

/magnus

On Fri, Nov 15, 2013 at 8:39 PM, Alexander Sommer 
alexander.som...@gmail.com wrote:

  Hi!

  I was moving my tapestry application on another server from domain to
 domain/production, and now, my custom made sitemap viewer does not
 generate appropriate urls anymore. (the normal tapestry page links are
 working well - so the application in general is working well)

  but not my custom sitemapViewer page. The links which are generated
 with writer.element(a, href, / + item.getPage()); only generate
 domain/url but not domain/production/url

  for sure, i could write now just production as prefix, but i have
 also a test instance on tomcat on domain/test

  so maybe, the easiest approach would be to get the absolut url of
 tapestry but the only thing i got so far was getting the url of
 tapestry via request.getServerName but this also only is giving me the
 servername (domain) but not domain/production/

  writer.element(td);

  writer.element(span, style, white-space:nowrap;);

  writer.write(prefix);

  writer.element(a, href, / + item.getPage());

  writer.write( messages.get(item.getPage()) );

  writer.end();

  writer.end();


  thx
  alex

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




Re: Apache Tapestry 5.4-alpha-25 preview release

2013-11-12 Thread Bård Magnus Kvalheim
Great. That looks very good indeed :-)

On Mon, Nov 11, 2013 at 11:01 PM, Howard Lewis Ship hls...@gmail.comwrote:

 This updates a number of bundled dependencies:
 - Bootstrap 3.0.2
 - RequireJS 2.1.9
 - Less4J 1.2.0
 - Closure Compiler v20131014

 It also fixes a bug that prevent JavaScript stacks from being minimized.
 There's also been a little bit of juggling to make Underscore a library
 within the core JavaScript stack (the underscore module is now just a
 little shim to allow underscore to be injected as an AMD module
 dependency).

 Tapestry preview releases are  available via Maven, from the Apache Staging
 repository:

 https://repository.apache.org/content/groups/staging


 --
 Howard M. Lewis Ship

 Creator of Apache Tapestry

 The source for Tapestry training, mentoring and support. Contact me to
 learn how I can get you up and productive in Tapestry fast!

 (971) 678-5210
 http://howardlewisship.com



[T5.4] - stack js not minified

2013-11-10 Thread Bård Magnus Kvalheim
Hi guys.

Just noised that stack js in not minified in 5.4.
Tried on 5.4.22 and 5.4.24 and seems to be missing on both.

I'm in production mode and have also set
combine-scripts=true
enable-minification=true

Modules and asset js + css seem to all minify correctly, so look like a
possible oversight for stacks?

Let me know if anyone can confirm/reproduce and a JIRA should be created.

Cheers
Magnus


Re: [T5.4] A Tapestry upgrade experience

2013-11-08 Thread Bård Magnus Kvalheim
On Fri, Nov 8, 2013 at 2:31 AM, Thiago H de Paula Figueiredo 
thiag...@gmail.com wrote:

 On Thu, 07 Nov 2013 19:27:11 -0200, Bård Magnus Kvalheim 
 mag...@kvalheim.eu wrote:

  ... On slightly different note while discussing 24 - the ordering of
 stack css have changed from 22-24 which I currently have no workaround for.


 Could you provide a concrete example? For another bug I fixed, I just made
 sure the CSS stylesheets from stacks are always put before the @Import'ed
 and the ones declared inside head directly. If any other ordering
 changed, then a regression happend and I should fix it.


Yes, so what I see in 24 is that core stack css is inserted after my own
stack css.
In 22 the core stack css was inserted before.
In practice, bootstrap.css is now ordered after my own css so the
'overrides' don't work no more.

Here's example screens:
https://docs.google.com/presentation/d/12R7MmvtsG3XF6H5XY3fiUmh7oY-LJmWnihlZPP38RQw/edit?usp=sharing

Let me know if more details is desired..




  True. Quite important to get rendered page as quick as possible. One
 sideeffect is that it may take a while for all javascript to actually
 execute and make all pieces work correctly. That could be ajax links for
 partial render - which instead will trigger another full page reload if
 not 'intercepted'.


 Yep. But, if the event handler is checking for AJAX vs non-AJAX
 (Request.isXHR()), it will work in both ways.


In most cases where it's an issue we actually want it to be ajax/javascript
functionality only.
Think I'll look into making an 'Event/bind' mixin that provides desired
properties. I see Tapestry-JQuery have a similar one -
http://tapestry5-jquery.com/mixins/docsbind .


[T5.4] A Tapestry upgrade experience

2013-11-07 Thread Bård Magnus Kvalheim
*Movellas - Our [T5.4] Tapestry upgrade experiences*

5.4 is underway and think a lot of users are wondering if or when they can
start using it for their applications. New or existing ones.
We've upgraded ours to 5.4 and hope our experiences can be helpful for
other and also help improving 5.4 towards a GA release.


Large site - tapestry from 2009/10

Initially 5.1.x line, but continuously upgraded up to 5.3.7

Movellas is today 150k registered users and about 1.5M visitors. And hope
to grow much larger :-)

As everywhere else in the industry - mobile traffic continues to grow.
Website is not mobile optimized, but have a separate version for that. As
well as a number of apps in the appstores.

Creating a responsive/adaptive experience on website is something we wanted
to get started, and after experimenting with 5.4.22 - we felt comfortable
enough about upgrading to an alpha.

Here are some of the experiences and challenges we’ve faced.

General process:

* Remove thirdparty modules incompatible or redundant for 5.4

* Set JQuery as infrastructure provider

* Migrate all(still valid) prototype scripts to JQuery

* Keep a checklist of pages and components to verify (can get from log or
T5Dashboard)

* On a page by page (and component) basis from checklist - update and
verify all

In general the migration took a lot of effort, but was not complicated.

For javascript and RequireJS some difficulties occurred, especially with
thirdparty js plugins/modules, but more on that below.

Thirdparty tapestry modules


   - tapestry-jquery. Mostly for jquery and jqueryui support. Have made
   alternative versions of the components used from tapestry-jquery
   - t5conduit (less  coffeescript). Used tapestry-webresources. Mostly
   effortless
   - tapestry-yuicompressor - tapestry-webresources


RequireJs

Never used that before, so was also a (good) learning experience.
Dependency management and injection of modules is great.

Combine files

We do have a lot of scripts which we’ve previously combined in stacks - and
cannot (easily) be done in 5.4.22.

New in 5.4.24. Howard have just announced possibility to add modules to
stacks - YAY.
Contribute to configuration

It is very common that thirdparty js modules also rely on RequireJs.
Therefore a way to configure/contribute to requirejs config is needed in
tapestry, especially paths. Would be great if it could be in
stack/page/component level so that the config is not global.

Have created a JIRA so please vote:
https://issues.apache.org/jira/browse/TAP5-2196

Underway: Thiago are working on it so think we’ll have a solution soon. YAY.

CDN / CloudFront

As a worldwide service we want to serve the assets as quickly as possible.
With AWS CloudFront we can configure the tapestry app as origin and the
assets will be ‘lazily’ populated to the edges around the world. This is
simple and effective and have served us well.

To enable this we’ve made a AssetPathConverter service which prepend the
CloudFront domain.

In 5.4 a few things changed that made it more difficult to support, at
least in our case - and have not yet been able to run reliably like in
5.3.x-
Expanded URLS in css

Now urls in css is expanded (which is good). However the AssetPathConverter
is eventually invoked and the full url with scheme and domain is inserted.
This is bad news for us for us as we do non atomic updates and rely on
sticky sessions while upgrading. After that we re-enable cloudfront ‘on the
fly’. This causes the checksums to mismatch and the site is broken.

I’ve made a workable hack to set a thread/request attribute once a css is
processed to avoid adding the full url and keep it relative to the css
domain. (See JIRA for more details:
https://issues.apache.org/jira/browse/TAP5-2201)

I’d like to have another pipeline for resolving css resources or
adding/knowing that it’s from inside a css so that we have better control.

Asset and module versioning

This have now been removed as it’s relying on checksums. However I do like
the extra control of versioning so I can easily force renewal of all
assets. Luckily it’s an easy way to bring this back by configuring the
“Asset path Prefix”. Great.

Module cache response headers

Requirejs modules have the following response headers

Cache-Control:max-age=0, must-revalidate

I think this means that they have to be checked at origin for every request
- and something I’d like to avoid as a global service. With module
versioning back in place I’d like to cache these aggressively for a long
period of time - just like the other assets.

I’ve adviced ResourceStreamer in order to cache js modules. See JIRA if
interested: https://issues.apache.org/jira/browse/TAP5-2201

Other challenges

As js is loaded and executed later, quite a bit of ajax functionality might
not have been bootstrapped and not working immediately on a rendered page.
It’s not really tapestry related I suppose, but sideeffect of late
(requirejs) execution.

Tapestry could possibly have some 

Re: [T5.4] A Tapestry upgrade experience

2013-11-07 Thread Bård Magnus Kvalheim
On Thu, Nov 7, 2013 at 2:03 PM, Thiago H de Paula Figueiredo 
thiag...@gmail.com wrote:

 On Thu, 07 Nov 2013 10:13:47 -0200, Bård Magnus Kvalheim 
 mag...@kvalheim.eu wrote:

  It is very common that thirdparty js modules also rely on RequireJs.
 Therefore a way to configure/contribute to requirejs config is needed in
 tapestry, especially paths. Would be great if it could be in
 stack/page/component level so that the config is not global.

 Have created a JIRA so please vote:
 https://issues.apache.org/jira/browse/TAP5-2196


 No need for that. :)


  Underway: Thiago are working on it so think we’ll have a solution soon.
 YAY.


 It's done already and it should have been included in alpha 24. Check the
 new ModuleConfigurationCallback interface and JavaScriptSupport.
 addModuleConfigurationCallback() method. Basically, you can implement a
 callback that will receive a JSONObject containing the RequireJS
 configuration, so you can change it in any way you need, then return it.


Okay, that's great. Didn't know it made it into alpha 24 - thanks again for
this!

... On slightly different note while discussing 24 - the ordering of stack
css have changed from 22-24 which I currently have no workaround for.
Howard mentioned you might have a something cooking for this too..?

 I’ve made a workable hack to set a thread/request attribute once a css is
 processed to avoid adding the full url and keep it relative to the css
 domain. (See JIRA for more details:
 https://issues.apache.org/jira/browse/TAP5-2201)

 I’d like to have another pipeline for resolving css resources or
 adding/knowing that it’s from inside a css so that we have better control.


 That's a very good idea. Is it included in TAP5-2201? If not, include it
 there or open a separate JIRA.


Yes, it's all there - but I'll try to clean it up a bit..



  As js is loaded and executed later, quite a bit of ajax functionality
 might not have been bootstrapped and not working immediately on a rendered
 page. It’s not really tapestry related I suppose, but sideeffect of late
 (requirejs) execution.


 The overall JavaScript good practice is to place the JS inclusions as late
 as possible in the page so it doesn't block the download of other assets.


True. Quite important to get rendered page as quick as possible. One
sideeffect is that it may take a while for all javascript to actually
execute and make all pieces work correctly. That could be ajax links for
partial render - which instead will trigger another full page reload if not
'intercepted'.

Top of my head - Some options could be to:
* disable link:
http://stackoverflow.com/questions/2091168/disable-a-link-using-css
* Use buttons instead of links - possibly use disabled attribute as well
* hide/show elements

Don't know if tapestry could help (or if it's place), but it is more of an
issue now coming from 5.3 where everything loaded upfront.

- magnus


[5.4.22] Serious issue with assets and checksums - different for same file

2013-10-11 Thread Bård Magnus Kvalheim
Hi everybody.

Today we've launched a website based on 5.4. We're very exited about the
upcoming release(5.4) and I'll post separately about our experiences
(mostly great).

Post release we've identified a potential serious issue related to assets
and their checksums.

What we see is that a handful of the assets generate different hashes for
the same file.

*=Example: bootstrap.css=*
Server 1:
/asset.gz/meta/92ffb14a/tapestry5/bootstrap_3_0_0/css/bootstrap.css

Server 2:
/asset.gz/meta/5787e482/tapestry5/bootstrap_3_0_0/css/bootstrap.css

Server 3:
/asset.gz/meta/f5e7c535/tapestry5/bootstrap_3_0_0/css/bootstrap.css

Server 3 - restart:
/asset.gz/meta/219ee41e/tapestry5/bootstrap_3_0_0/css/bootstrap.css


We also see the same behaviour for the non gzip version of bootstrap.css.


It is not only for /meta/
*=JCarouselWrapper.css=*
/asset/app/f59da774/mixins/ui/JCarouselWrapper.css
/asset/app/6ddc92ee/mixins/ui/JCarouselWrapper.css

As you can see - we're load balanced with app served from several nodes.
Normally I'd serve these through CloudFront on a cookieless domain (with
tapestry as origin), but it's not possible as load balanced assets could
hit 'wrong' server and get the 404 instead.
So for now they are served through website domain with sticky sessions -
and pray that it don't cause us problems... :)

All are served with same web container:
Apache Tomcat/7.0.39
JDK 1.7.0_11

Anyone got an idea of what's going on - and/or can verify?
Have created JIRA - https://issues.apache.org/jira/browse/TAP5-2201

many thanks in advance
Magnus


Re: Should the JQuery UI library be include with 5.4

2013-10-03 Thread Magnus Kvalheim
define([t5/core/dom, t5/core/events, jquery, //
code.jquery.com/ui/1.10.3/jquery-ui.js],
...

That's interesting - loading of scripts directly within a define. Seems
very useful and convenient.

Thought I might use same approach in some scenarios.
I tried to lookup on documentation of that to see use cases, but seems like
requirejs officially describes the paths and shim configurations as ways to
load non AMD modules.
(In my still limited knowledge)


A heads up though.
Looks like requirejs does not guarantee execution order for non AMD
scripts. So according to some sources there is a chance that jqueryui may
execute before jquery in this case.
Look at the update and comments in this post:
http://iamnotmyself.com/2012/09/07/getting-started-managing-client-side-scripts-with-require-js/

Also I wonder what would happen if there were more modules that depended on
the same jqueryui script..?

On Thu, Oct 3, 2013 at 4:40 AM, Lenny Primak lpri...@hope.nyc.ny.us wrote:

 I tried to do exactly what you are trying to do and that's what
 precipitated the discussion about JQuery and Bootstrap from CDN.
 I have brought back T5.4 zone highlight effect with this:

 https://code.google.com/p/flowlogix/source/browse/tapestry-services/src/main/resources/META-INF/modules/flowlogix/HighlightEffect.js?name=tapestry-5.4
 It requires JQueryUI and I just load it from CDN and it works perfectly.

  On Oct 2, 2013, at 7:14 PM, Barry Books trs...@gmail.com wrote:
 
  When I created the datapicker I also needed the JQuery UI library but it
  does not appear to be an option in the Tapestry Core. I think many jquery
  components may need this and without it in the core many modules will
 each
  end up with their own version. Is there any reason this is not included?

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




Re: Should the JQuery UI library be include with 5.4

2013-10-03 Thread Bård Magnus Kvalheim
define([t5/core/dom, t5/core/events, jquery, //
code.jquery.com/ui/1.10.3/jquery-ui.js],
...

That's interesting - loading of scripts directly within a define. Seems
very useful and convenient.

Thought I might use same approach in some scenarios.
I tried to lookup on documentation of that to see use cases, but seems like
requirejs officially describes the paths and shim configurations as ways to
load non AMD modules.
(In my still limited knowledge)


A heads up though.
Looks like requirejs does not guarantee execution order for non AMD
scripts. So according to some sources there is a chance that jqueryui may
execute before jquery in this case.
Look at the update and comments in this post:
http://iamnotmyself.com/2012/09/07/getting-started-managing-client-side-scripts-with-require-js/

Also I wonder what would happen if there were more modules that depended on
the same jqueryui script..? Would it load multiple times?

thoughts?

On Thu, Oct 3, 2013 at 4:40 AM, Lenny Primak lpri...@hope.nyc.ny.us wrote:

 I tried to do exactly what you are trying to do and that's what
 precipitated the discussion about JQuery and Bootstrap from CDN.
 I have brought back T5.4 zone highlight effect with this:

 https://code.google.com/p/flowlogix/source/browse/tapestry-services/src/main/resources/META-INF/modules/flowlogix/HighlightEffect.js?name=tapestry-5.4
 It requires JQueryUI and I just load it from CDN and it works perfectly.

  On Oct 2, 2013, at 7:14 PM, Barry Books trs...@gmail.com wrote:
 
  When I created the datapicker I also needed the JQuery UI library but it
  does not appear to be an option in the Tapestry Core. I think many jquery
  components may need this and without it in the core many modules will
 each
  end up with their own version. Is there any reason this is not included?

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




[5.4.22] RequireJs custom path contribution - perhaps on Stacks or JavaScriptSupport

2013-10-03 Thread Bård Magnus Kvalheim
Hi folks.

As part of 5.4 migration process we have some components that make use of
JQueryFileUpload, https://github.com/blueimp/jQuery-File-Upload .

This library uses the factory approach for defining the modules to work in
both AMD and non AMD environments.
Internally it handles loading of required modules, but work with paths.
(And does not try to load from a fixed directory structure).

So I think I need to specify things like
requirejs.config({
paths: {
 'jquery.fileupload':
'../library/jquery.fileupload/jquery.fileupload', //path to file
 'jquery.iframe-transport':
'../library/jquery.fileupload/jquery.iframe-transport', //path to file
 'jquery.ui.widget':
'../library/jquery.fileupload/vendor/jquery.ui.widget', //path to file
}
});

Is it possible to add path configuration with tapestry?

One possibility could be to configure shims through tapestry's
modulemanager, but that's for non-AMD scripts and is likely to cause
problems.
Also the shim config would be global (all pages) - which I'd like to avoid
as well.


In 5.3 I've used a JQueryFileUpload to define all the deps like so..
public ListAsset getJavaScriptLibraries() {
 ListAsset ret = new ArrayListAsset();
ret.add(assetSource.getContextAsset(jquery-file-upload/7.2.1/js/vendor/jquery.ui.widget.js,
null));
 
ret.add(assetSource.getContextAsset(jquery-file-upload/extra/js/load-image.min.js,
null));
ret.add(assetSource.getContextAsset(jquery-file-upload/extra/js/canvas-to-blob.min.js,
null));
 
ret.add(assetSource.getContextAsset(jquery-file-upload/7.2.1/js/jquery.iframe-transport.js,
null));
ret.add(assetSource.getContextAsset(jquery-file-upload/7.2.1/js/jquery.fileupload.js,
null));
 
ret.add(assetSource.getContextAsset(jquery-file-upload/7.2.1/js/jquery.fileupload-fp.js,
null));

I thought it would be nice if it was possible somehow to contribute to
requirejs configuration through stacks.
That way they could be added to the requirejs config if the stack was used.

If it was a service (perhaps exposed through JavaScriptSupport) one could
also contribute on a page/component level..?

I have no idea about the implications of this and if it's possible to
accomplish, but could potentially help solving some more advanced use cases.

In any case I do need to find a solution pretty soon, so let me know if you
have any ideas or suggestions.

Thanks
Magnus


Re: [5.4.22] Need example of custom javascript

2013-10-03 Thread Bård Magnus Kvalheim
Hi Geoff.

Believe the META-INF should be on the classpath (in resources if using
maven structure)


On Thu, Oct 3, 2013 at 1:52 PM, Geoff Callender 
geoff.callender.jumpst...@gmail.com wrote:

 I've dropped the @Import and tried many things inspired by Thiago and
 Lenny's source (thanks guys), but the module is still not found.

 Does the URL of the module look right?

 http://gc1.local:8080/myapp/asset.gz/module/pages/stuff.js

 My WAR has META-INF/ at the top level alongside WEB-INF/ and legacy
 directories like js/ . To be clear, stuff.js is at
 META-INF/modules/pages/stuff.js . That's right isn't it? The legacy
 directories won't mess up asset resolution of the module will they?

 Cheers,

 Geoff

 On 03/10/2013, at 4:29 AM, Thiago H de Paula Figueiredo wrote:

  Hi, Geoff!
 
  As Lance said, with JavaScriptSupport.require(), you shouldn't use
 @Import in the same file, because require() already does that.
 
  Check these examples from tapestry-wymeditor:
 
 
 https://github.com/thiagohp/tapestry-wymeditor/blob/master/src/main/java/br/com/arsmachina/tapestry_wymeditor/mixins/Wymeditor.java
 
 
 https://github.com/thiagohp/tapestry-wymeditor/blob/master/src/main/resources/META-INF/modules/wymeditor/wymeditor.js
 
  On Wed, 02 Oct 2013 11:16:00 -0300, Geoff Callender 
 geoff.callender.jumpst...@gmail.com wrote:
 
  Thanks, Lance, but no cigar. If I leave out the @Import line then I
 don't get the good news message. If I leave out the jsSupport.require line
 then I don't get the bad news message (and of course the javascript still
 doesn't run).
 
  BTW, notice that the URLs of the two messages differ. The first one
 includes the checksum that we probably want.
 
  On 02/10/2013, at 11:30 PM, Lance Java wrote:
 
  You are trying to import stuff.js twice. Once via require.js and once
 via
  @Import. I get the feeling it's the @Import that's failing.
  On 2 Oct 2013 14:13, Geoff Callender 
 geoff.callender.jumpst...@gmail.com
  wrote:
 
  I'm desperately seeking an up-to-date example of custom javascript,
  because nothing I've tried works.  Here's one attempt that failed...
 
  package myapp.pages;
 
  import javax.inject.Inject;
 
  import org.apache.tapestry5.annotations.Import;
  import org.apache.tapestry5.json.JSONObject;
  import org.apache.tapestry5.services.javascript.JavaScriptSupport;
 
  @Import(stack = { core }, library = { stuff.js })
  public class Index2 {
 
@Inject
private JavaScriptSupport jsSupport;
 
void afterRender() {
JSONObject params = new JSONObject();
jsSupport.require(pages/stuff).with(params);
}
 
  }
 
  ...In my WAR is /META-INF/modules/pages/stuff.js...
 
  define([jquery, t5/core/console], function($, console) {
return function(params) {
console.warn(jQuery version:  + $().jquery);
};
  });
 
  ...The javascript console shows good news...
 
  Loading library /myapp/asset.gz/app/495033b1/pages/stuff.js
 
  ...followed by bad news...
 
  Failed to load resource: the server responded with a status of 404
 (Not
  Found) http://gc1.local:8080/myapp/asset.gz/module/pages/stuff.js
 
  Cheers,
 
  Geoff
 
 
 
 
 
  -
  To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org
  For additional commands, e-mail: users-h...@tapestry.apache.org
 
 
 
  --
  Thiago H. de Paula Figueiredo
 
  -
  To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org
  For additional commands, e-mail: users-h...@tapestry.apache.org
 


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




Re: [5.4.22] RequireJs custom path contribution - perhaps on Stacks or JavaScriptSupport

2013-10-03 Thread Bård Magnus Kvalheim
Thanks Lenny, JIRA created https://issues.apache.org/jira/browse/TAP5-2196

Please vote guys :)


On Thu, Oct 3, 2013 at 8:02 PM, Lenny Primak lpri...@hope.nyc.ny.us wrote:

 +1. I can see lots of things needing this. JIRA please ill vote for it.

  On Oct 3, 2013, at 1:33 AM, Bård Magnus Kvalheim mag...@kvalheim.eu
 wrote:
 
  Hi folks.
 
  As part of 5.4 migration process we have some components that make use of
  JQueryFileUpload, https://github.com/blueimp/jQuery-File-Upload .
 
  This library uses the factory approach for defining the modules to work
 in
  both AMD and non AMD environments.
  Internally it handles loading of required modules, but work with paths.
  (And does not try to load from a fixed directory structure).
 
  So I think I need to specify things like
  requirejs.config({
 paths: {
  'jquery.fileupload':
  '../library/jquery.fileupload/jquery.fileupload', //path to file
  'jquery.iframe-transport':
  '../library/jquery.fileupload/jquery.iframe-transport', //path to file
  'jquery.ui.widget':
  '../library/jquery.fileupload/vendor/jquery.ui.widget', //path to file
 }
  });
 
  Is it possible to add path configuration with tapestry?
 
  One possibility could be to configure shims through tapestry's
  modulemanager, but that's for non-AMD scripts and is likely to cause
  problems.
  Also the shim config would be global (all pages) - which I'd like to
 avoid
  as well.
 
 
  In 5.3 I've used a JQueryFileUpload to define all the deps like so..
  public ListAsset getJavaScriptLibraries() {
  ListAsset ret = new ArrayListAsset();
 
 ret.add(assetSource.getContextAsset(jquery-file-upload/7.2.1/js/vendor/jquery.ui.widget.js,
  null));
 
 ret.add(assetSource.getContextAsset(jquery-file-upload/extra/js/load-image.min.js,
  null));
 
 ret.add(assetSource.getContextAsset(jquery-file-upload/extra/js/canvas-to-blob.min.js,
  null));
 
 ret.add(assetSource.getContextAsset(jquery-file-upload/7.2.1/js/jquery.iframe-transport.js,
  null));
 
 ret.add(assetSource.getContextAsset(jquery-file-upload/7.2.1/js/jquery.fileupload.js,
  null));
 
 ret.add(assetSource.getContextAsset(jquery-file-upload/7.2.1/js/jquery.fileupload-fp.js,
  null));
 
  I thought it would be nice if it was possible somehow to contribute to
  requirejs configuration through stacks.
  That way they could be added to the requirejs config if the stack was
 used.
 
  If it was a service (perhaps exposed through JavaScriptSupport) one could
  also contribute on a page/component level..?
 
  I have no idea about the implications of this and if it's possible to
  accomplish, but could potentially help solving some more advanced use
 cases.
 
  In any case I do need to find a solution pretty soon, so let me know if
 you
  have any ideas or suggestions.
 
  Thanks
  Magnus

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




Re: [5.4.22] Possible issue with Element#attribute for css class. - Class is replaced and not added

2013-10-01 Thread Bård Magnus Kvalheim
Okay, so just a short update this morning.

Stepping through I can see while writing the attribute value that:

before writing the 'state' is:
div class=tab-pane id=choose

After writing attribute, it makes it a 'duplicate' class attribute
cnt.attribute(class, active) - div *class=active class=tab-pane*
id=choose

then final markup is (somewhere the class attribute with empty namespace
got removed):
div *class=active* id=choose


Come to think about it I think I've seen cases of duplicate class
attributes prior to 5.4 (5.2/3) as well which also ended up in final markup.

The class attribute to add have a *null namespace* - while the existing
class attribute have a *empty namespace*.
As expected - if I step through and change the attribute namespace (of
existing class attribute) to null, then all 'checks pass' and the class
value is added correctly
div class=tab-pane active id=choose


I'm still not sure if it's a bug, or I'm just using it wrong (perhaps with
namespaces).
Does anyone have some more insight or have come across similar issues with
duplicate class attributes or missing class attribute values?

cheers
Magnus

On Mon, Sep 30, 2013 at 10:45 PM, Bård Magnus Kvalheim
mag...@kvalheim.euwrote:

 Hi again.

 So have still not been able to figure out how to resolve, but have the
 following observations in mixins and components.

 *Mixins:*
 Seems to work fine and work correctly by adding a css classname. I have
 several mixins that contribute css.

 *Component:*
 Still replaces the classname.

 Components have a template so that could be there's a namespace difference
 or a behaviour I've missed..


 *Example:*
 In this case what I'm trying to do is to make a component around bootstrap
 tabs.
 http://getbootstrap.com/javascript/#tabs

 div id=choose class=tab-pane
 is rendered
 div class=active id=choose (missing tab-pane)

  Planned to optimize the markup/code and add ajax loading of tab content,
 but want to make this work first. Any ideas to what I could be doing wrong?

 thanks in advance
 Magnus

 *Tabs.tml*
 !DOCTYPE html PUBLIC -//W3C//DTD XHTML 1.0 Strict//EN 
 http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd;
 t:container
 xmlns:t=http://tapestry.apache.org/schema/tapestry_5_3.xsd;
  xmlns:p=tapestry:parameter
 div id=${ClientId} class=tabsContainer
  ul class=nav nav-tabs
 t:body /
 /ul
  div class=tab-content
 t:delegate to=tabContent /
 /div
  /div
 /t:container

 *Tabs.java (snip)*
 @AfterRenderTemplate
 void handleActive(MarkupWriter writer) {
  Element e = writer.getElement();
 Element thisEl = e.getElementById(getClientId());
  Element activeLi = null;
 String contentId = show;
  //get first
 if(show==null) {
 activeLi = thisEl.find(ul/li);
  } else {
 Element a = thisEl.getElementByAttributeValue(href, #+show);
 if(a!=null) {
  activeLi = a.getContainer();
 }
 }
  if(activeLi!=null) {
 activeLi.attribute(class, active);
 if(contentId==null  activeLi.find(a)!=null) {
  contentId = activeLi.find(a).getAttribute(href);
 }
  }
  if(contentId!=null) {
 if(contentId.startsWith(#)) contentId = contentId.substring(1);
  Element cnt = thisEl.getElementById(contentId);
 if(cnt!=null) {
 cnt.attribute(class, active);
  }
 }
 }

 *Usage:*
 ul t:type=tabs t:show=literal:choose
  lia href=#choose data-toggle=tab${message:image.choose}/a/li
 lia href=#upload data-toggle=tab${message:image.upload}/a/li
  p:tabContent
 div id=choose class=tab-pane
 div t:id=as3GalleryBundle/
  /div
 div id=upload class=tab-pane
 t:ui.pickimage t:id=imgPick2 t:enableH5=true class=imgPick/
  /div
 /p:tabContent
 /ul



 On Fri, Sep 27, 2013 at 11:19 AM, Bård Magnus Kvalheim mag...@kvalheim.eu
  wrote:

 Hi guys.

 So I've might have come across a bug in 5.4.22 when trying to add a css
 class to an element.

 The Element#addClassName is deprecated and delegate to Element#attribute
 where attributes named class now gets special treatment.

 The problem I'm seeing is that Element#attribute overrides the class
 attribute.

 In Element#updateAttribute there is a namespace test and looks like it's
 failing as given namespace is null and attribute namespace is empty string.
 [1]

 If I instead provide empty string as namespace in the Element#attribute
 then the isClass test fails as the namespace is not null. [2]

 Can anyone confirm the issue - and should I open a JIRA?

 
 Element.class#updateAttribute
 [1] if (cursor.matches(namespace, name))
 {
 [2] boolean isClass = namespace == null  name.equals(class);

 if (!(force || isClass))
 {
 return;
  }

 cheers
 Magnus





Re: 5.4 Datepicker survey

2013-10-01 Thread Bård Magnus Kvalheim
This is great news and good timing. We're currently in process of making a
5.4 migration and will soon be in the market for a datepicker as well.

Have been looking at https://github.com/eternicode/bootstrap-datepicker and
seems like there are some efforts to bring it up to speed with bootstrap 3
https://github.com/eternicode/bootstrap-datepicker/pull/649

Don't know how far I get this week, but will let you know.

Would definitely take yours for a spin if you get things working as well.

cheers
Magnus

On Tue, Oct 1, 2013 at 1:26 PM, Barry Books trs...@gmail.com wrote:

 I'm trying to find a suitable javascript implementation for a 5.4
 datepicker. There are several Bootstrap datapickers but I have not found
 one that's really compatible with the release version of Bootstrap 3. So
 far I've looked at

 https://github.com/angular-ui/bootstrap

 https://github.com/ianserlin/bootstrap-datepicker

 https://github.com/eternicode/bootstrap-datepicker

 http://jqueryui.com/datepicker/

 Has anyone see any other interesting ones or have any opinions?


 Implementation Plan:

 The datepicker will be implemented in two parts. The first part consists of
 a Date Translator that is used with the TextField component. The only thing
 required is

 java

 @Property
 private Date date;

 tml

 t:textField value=date/

 It's possible to contribute alternate date translators and refer to them by
 name

 t:textFile value=date translate=(mm/dd/) /

 The good:

 The server side code is simple. The only thing that's required is the
 translator.
 Translators can write into the HTML stream and include the format like
 input type=date data-date-format=mm/dd/ /
 I think it should be possible to have t:textField type=hidden
 value=date/ and hide the date format from the user.
 It does not work like the current DateField.

 The bad:
 You have to write a date translator for every format and data type. The
 format could be fixed by creating a prefix like
 dateTranslater:mm-dd- and converting the date format into a
 FieldTranslator (does anyone think this would be useful?). The second
 problem has two parts. The first issue is if you want to use Calendar
 instead of Date you need a new Translator. The second problem/feature is
 the data type determines the format. If you want both a datetime picker and
 a date picker it's best to have two different object types. For a
 datetimepicker I'm leaning toward the java.sql.Timestamp type. Lastly it
 does not work like the current DateField.


 The client side is accomplished with a mixin. With Bootstrap style
 javascript the only thing the mixin does is include the javascript and add
 data-provider=datepicker to the element. The good thing about this is
 it's easy to swap out the Javascript client (except they all have different
 data- parameters).

 To override the existing DateField you just create your own DateField
 component like this

 *public* *class* DateField *extends* TextField {

  @Mixin

 *private* DateFieldMixin mixin;


 }


 I've got a few prototypes running and I'm expecting to have something
 finished by the end of the week. Any feedback would be helpful.


 Thanks

 Barry



Re: [5.4.22] Possible issue with Element#attribute for css class. - Class is replaced and not added

2013-09-30 Thread Bård Magnus Kvalheim
Hi again.

So have still not been able to figure out how to resolve, but have the
following observations in mixins and components.

*Mixins:*
Seems to work fine and work correctly by adding a css classname. I have
several mixins that contribute css.

*Component:*
Still replaces the classname.

Components have a template so that could be there's a namespace difference
or a behaviour I've missed..


*Example:*
In this case what I'm trying to do is to make a component around bootstrap
tabs.
http://getbootstrap.com/javascript/#tabs

div id=choose class=tab-pane
is rendered
div class=active id=choose (missing tab-pane)

 Planned to optimize the markup/code and add ajax loading of tab content,
but want to make this work first. Any ideas to what I could be doing wrong?

thanks in advance
Magnus

*Tabs.tml*
!DOCTYPE html PUBLIC -//W3C//DTD XHTML 1.0 Strict//EN 
http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd;
t:container
xmlns:t=http://tapestry.apache.org/schema/tapestry_5_3.xsd;
 xmlns:p=tapestry:parameter
div id=${ClientId} class=tabsContainer
 ul class=nav nav-tabs
t:body /
/ul
 div class=tab-content
t:delegate to=tabContent /
/div
 /div
/t:container

*Tabs.java (snip)*
@AfterRenderTemplate
void handleActive(MarkupWriter writer) {
 Element e = writer.getElement();
Element thisEl = e.getElementById(getClientId());
 Element activeLi = null;
String contentId = show;
 //get first
if(show==null) {
activeLi = thisEl.find(ul/li);
 } else {
Element a = thisEl.getElementByAttributeValue(href, #+show);
if(a!=null) {
 activeLi = a.getContainer();
}
}
 if(activeLi!=null) {
activeLi.attribute(class, active);
if(contentId==null  activeLi.find(a)!=null) {
 contentId = activeLi.find(a).getAttribute(href);
}
 }
 if(contentId!=null) {
if(contentId.startsWith(#)) contentId = contentId.substring(1);
 Element cnt = thisEl.getElementById(contentId);
if(cnt!=null) {
cnt.attribute(class, active);
 }
}
}

*Usage:*
ul t:type=tabs t:show=literal:choose
 lia href=#choose data-toggle=tab${message:image.choose}/a/li
lia href=#upload data-toggle=tab${message:image.upload}/a/li
 p:tabContent
div id=choose class=tab-pane
div t:id=as3GalleryBundle/
 /div
div id=upload class=tab-pane
t:ui.pickimage t:id=imgPick2 t:enableH5=true class=imgPick/
 /div
/p:tabContent
/ul



On Fri, Sep 27, 2013 at 11:19 AM, Bård Magnus Kvalheim
mag...@kvalheim.euwrote:

 Hi guys.

 So I've might have come across a bug in 5.4.22 when trying to add a css
 class to an element.

 The Element#addClassName is deprecated and delegate to Element#attribute
 where attributes named class now gets special treatment.

 The problem I'm seeing is that Element#attribute overrides the class
 attribute.

 In Element#updateAttribute there is a namespace test and looks like it's
 failing as given namespace is null and attribute namespace is empty string.
 [1]

 If I instead provide empty string as namespace in the Element#attribute
 then the isClass test fails as the namespace is not null. [2]

 Can anyone confirm the issue - and should I open a JIRA?

 
 Element.class#updateAttribute
 [1] if (cursor.matches(namespace, name))
 {
 [2] boolean isClass = namespace == null  name.equals(class);

 if (!(force || isClass))
 {
 return;
  }

 cheers
 Magnus



[5.4.22] Possible issue with Element#attribute for css class. - Class is replaced and not added

2013-09-27 Thread Bård Magnus Kvalheim
Hi guys.

So I've might have come across a bug in 5.4.22 when trying to add a css
class to an element.

The Element#addClassName is deprecated and delegate to Element#attribute
where attributes named class now gets special treatment.

The problem I'm seeing is that Element#attribute overrides the class
attribute.

In Element#updateAttribute there is a namespace test and looks like it's
failing as given namespace is null and attribute namespace is empty string.
[1]

If I instead provide empty string as namespace in the Element#attribute
then the isClass test fails as the namespace is not null. [2]

Can anyone confirm the issue - and should I open a JIRA?


Element.class#updateAttribute
[1] if (cursor.matches(namespace, name))
{
[2] boolean isClass = namespace == null  name.equals(class);

if (!(force || isClass))
{
return;
 }

cheers
Magnus


Re: T5.4 migration discussions

2013-09-24 Thread Bård Magnus Kvalheim
Thanks for reply.

Do the tapestry-jquery guys mentioned their plans for 5.4? The
 include-jQuery-and-**reimplement-everything-in-**jQuery isn't needed
 anymore, but the other parts should still be quite useful in 5.4.


Yes, think so too.
Looks like the plan is to get it updated, but not sure of timelines here..


  *Requirejs optimize*

 Since requirejs make you write the modules - one pr. file - it can
 quickly add up.
 Up until now we've made use of stacks to combine files, but guess this
 won't work reliably with with requirejs..?


 I guess nothing should change to stacks and they should keep on working in
 5.4. I haven't checked that, though.


Yes, it does work :-) Apart from the mentioned t5.3 compability which I
think need to be first in list. (Tapestry namespace)
However don't think it will work to 'stack'/combine requirejs modules in
current tapestry way.

(btw - did try to make my javascriptstack depend on core which seems to
help pushing t5.3 compability higher)



  I've seen there is an optimizer for requirejs.
 http://requirejs.org/docs/**optimization.htmlhttp://requirejs.org/docs/optimization.html
 Any plans to use this - or are there other approaches more suitable for
 tapestry?


 I'm not sure this would fit in Tapestry. The optimizer is written for
 Node.js.

Yes, it might be out of scope for tapestry. There is a Rhino option -
although it is reported to be very slow (perhaps Nashorn can change it?)
Have found other efforts like -
https://github.com/mcheely/requirejs-maven-plugin - which could be tested
as well...


Re: [5.4] LinkSubmit Client-side Validation Broken

2013-09-24 Thread Bård Magnus Kvalheim
Hi Peter.

I'm also seeing the same issue with alpha 22. Could reproduce with a simple
form having linksubmit.

Haven't done any further research, but possibly good idea to track as jira?

-magnus

On Thu, Sep 5, 2013 at 9:14 AM, Peter Hvass p.hv...@albourne.com wrote:

 Thanks Boris and Eugen. Boris; are you using a 5.4 alpha?


 Hoping one of the devs/maintainers could chime in just in case this is
 some kind of configuration issue (before creating a JIRA).


 Thanks!
 Peter



 - Original Message -

 From: Boris Horvat horvat.z.bo...@gmail.com
 To: Tapestry users users@tapestry.apache.org
 Sent: Wednesday, September 4, 2013 10:45:56 PM
 Subject: Re: [5.4] LinkSubmit Client-side Validation Broken

 I use the last stable version


 On Wed, Sep 4, 2013 at 9:37 PM, Eugen eugens...@gmail.com wrote:

  Hi,
  For me the client side validation by LinkSubmit also does not work. I use
  the last version of tapestry - 5.4-alpha-16
 
 
  Eugen
 
 
  2013/9/4 Boris Horvat horvat.z.bo...@gmail.com
 
   For me everything works as it should
  
  
   On Wed, Sep 4, 2013 at 12:08 PM, Peter Hvass p.hv...@albourne.com
  wrote:
  
Hello,
   
   
Just wanted to follow up on this; we're still experiencing this
 issue,
wondering if anyone has a moment to
try and reproduce this on their end too?
   
   
Thanks,
Peter
   
- Original Message -
   
From: Peter Hvass p.hv...@albourne.com
To: Tapestry users users@tapestry.apache.org
Sent: Thursday, August 29, 2013 4:02:03 PM
Subject: [5.4] LinkSubmit Client-side Validation Broken
   
Hello,
   
   
Just wanted to check if anyone else can reproduce this before I post
 an
issue;
   
   
Example tml;
   
!DOCTYPE html
html xmlns:t=http://tapestry.apache.org/schema/tapestry_5_3.xsd;
head
titleBob/title
/head
body
t:form
t:textfield value=bob validate=required /
t:linksubmitLink Submit/t:linksubmit
t:submit /
/t:form
/body
/html
   
   
Example java;
@Property
   
private String bob_;
   
   
Clicking the linksubmit causes a POST regardless of the client-side
validation on textfield bob, and when the page reloads we see the
validation message.
Clicking the submit causes no POST and client-side validation appears
immediately.
   
   
Hope someone can help confirm this as an issue!
   
   
Thanks,
Peter
   
  
  
  
   --
   Sincerely
   *Boris Horvat*
  
 



 --
 Sincerely
 *Boris Horvat*




Re: T5.4 migration discussions

2013-09-24 Thread Bård Magnus Kvalheim
Thanks, that sounds good and would go a long way.

Will make me worry less currently moving from stacks to modules - and it
does seem cleaner..

On Tue, Sep 24, 2013 at 9:13 PM, Howard Lewis Ship hls...@gmail.com wrote:

 Actually, I hope to extend the stack concept to allow modules to be
 included in the stack.

 RequireJS's optimize does a bit more; you specify some module names and it
 figures out the transitive dependencies and builds a single script. That
 would be great, but I'm not sure I can pull it off.


 On Tue, Sep 24, 2013 at 12:57 AM, Bård Magnus Kvalheim
 mag...@kvalheim.euwrote:

  Thanks for reply.
 
  Do the tapestry-jquery guys mentioned their plans for 5.4? The
   include-jQuery-and-**reimplement-everything-in-**jQuery isn't needed
   anymore, but the other parts should still be quite useful in 5.4.
  
 
  Yes, think so too.
  Looks like the plan is to get it updated, but not sure of timelines
 here..
 
  
*Requirejs optimize*
  
   Since requirejs make you write the modules - one pr. file - it can
   quickly add up.
   Up until now we've made use of stacks to combine files, but guess this
   won't work reliably with with requirejs..?
  
  
   I guess nothing should change to stacks and they should keep on working
  in
   5.4. I haven't checked that, though.
 
 
  Yes, it does work :-) Apart from the mentioned t5.3 compability which I
  think need to be first in list. (Tapestry namespace)
  However don't think it will work to 'stack'/combine requirejs modules in
  current tapestry way.
 
  (btw - did try to make my javascriptstack depend on core which seems to
  help pushing t5.3 compability higher)
 
  
  
I've seen there is an optimizer for requirejs.
   http://requirejs.org/docs/**optimization.html
  http://requirejs.org/docs/optimization.html
   Any plans to use this - or are there other approaches more suitable
 for
   tapestry?
  
  
   I'm not sure this would fit in Tapestry. The optimizer is written for
   Node.js.
 
  Yes, it might be out of scope for tapestry. There is a Rhino option -
  although it is reported to be very slow (perhaps Nashorn can change it?)
  Have found other efforts like -
  https://github.com/mcheely/requirejs-maven-plugin - which could be
 tested
  as well...
 



 --
 Howard M. Lewis Ship

 Creator of Apache Tapestry

 The source for Tapestry training, mentoring and support. Contact me to
 learn how I can get you up and productive in Tapestry fast!

 (971) 678-5210
 http://howardlewisship.com



T5.4 migration discussions

2013-09-23 Thread Bård Magnus Kvalheim
Hi guys and Howard :)

So I've been taking 5.4 out for a testdrive (alpha 22).

The application is fairly large 150+ pages, 250+ components and mixins.
*Plugins:* Is using tapestry-jquery, t5conduit (less 
coffieescript), tapestry-yuicompressor (with Lenny's workaround)
The plugins are omitted for 5.4. Think I need to make new components to
make up for loss of tapestry-jquery, but otherwise working good.

At this point I haven't gotten much longer than the home page and a couple
of additional pages, but it's looking really good. Great job on that :-)

There's already been a number of posts related to 5.4 so won't repeat on
those, but have a couple of 'new questions' that might deserve some
attention.

*t53-compatibility.js - load early as possible..?*
Great this one exist, but is is possible to have it load earlier..?
Currently it's loaded last of the @Import'ed libraries where some make
use of the Tapestry namespace.
I've manually tested to add it to my layout component (to get it higher in
list), and that mostly work, but not on all pages.
So - is it possible to have it loaded as first in list by default?

*Requirejs optimize*
Since requirejs make you write the modules - one pr. file - it can quickly
add up.
Up until now we've made use of stacks to combine files, but guess this
won't work reliably with with requirejs..?
I've seen there is an optimizer for requirejs.
http://requirejs.org/docs/optimization.html
Any plans to use this - or are there other approaches more suitable for
tapestry?


Will probably have additional questions/comments as I work my way through.
But overall very excited about this release..

cheers
Magnus


Re: tapestry 5.2.5 doesnot work on Jboss 6

2013-08-02 Thread Bård Magnus Kvalheim
Hi.
I know it's JBoss's fault and all that, but shouldn't 'we' support jboss
out of the box anyways? Either in core(preferred) or as a module?

Might be wrong, but it just seems like such a small thing to add. Community/
Benjamin/Geoff already did all the work.
Think it's a bad experience having to override IOC services as one of the
first steps learning tapestry - if they even get that far.

There might be other jiras, but think they should be reopened.
https://issues.apache.org/jira/browse/TAP5-576

thoughts?


On Fri, Aug 2, 2013 at 7:49 AM, Geoff Callender 
geoff.callender.jumpst...@gmail.com wrote:

 Thiago did respond, with an essential link to the wiki. Please follow the
 link and tell us the result.

 Cheers,

 Geoff




 On 2 August 2013 08:39, rukmini n rukmini...@gmail.com wrote:

  HI Thiago,
 
  Could you please respond. I'm really blocked because of this issue.
 
  Thanks,
  Rukmini
 
  https://plus.google.com/u/0/103689518864398263449?prsrc=4
  On Thu, Aug 1, 2013 at 10:43 AM, rukmini n rukmini...@gmail.com wrote:
 
  
   HI, Thank you for your response.
  
  
   Here is the full stack trace. Outputraw is class in the tapestry core
   library. i'm wondering why its not able to recognize this. The same
 code
   works fine in jboss 4.
  
   2013-07-31 16:47:41,367 [2880#1/http://www.srwd00.com/] priority=ERROR
   app_name=stubhubapps thread=ajp-127.0.0.13-8009-1
   location=PageRenderRequestHandler line=56 Exception:
   org.apache.tapestry5.ioc.internal.OperationException: Unable to resolve
   'outputraw' to a component class name. [at context:HomePage.tml, line
 6]
   at
  
 
 org.apache.tapestry5.ioc.internal.OperationTrackerImpl.logAndRethrow(OperationTrackerImpl.java:102)
   at
  
 
 org.apache.tapestry5.ioc.internal.OperationTrackerImpl.invoke(OperationTrackerImpl.java:69)
   at
  
 
 org.apache.tapestry5.ioc.internal.PerThreadOperationTracker.invoke(PerThreadOperationTracker.java:68)
   at
  
 
 org.apache.tapestry5.ioc.internal.RegistryImpl.invoke(RegistryImpl.java:1063)
   at
  
 
 org.apache.tapestry5.internal.pageload.PageLoaderImpl.createAssembler(PageLoaderImpl.java:218)
   at
  
 
 org.apache.tapestry5.internal.pageload.PageLoaderImpl.getAssembler(PageLoaderImpl.java:208)
   at
  
 
 org.apache.tapestry5.internal.pageload.PageLoaderImpl$3.invoke(PageLoaderImpl.java:180)
   at
  
 
 org.apache.tapestry5.internal.pageload.PageLoaderImpl$3.invoke(PageLoaderImpl.java:175)
   at
  
 
 org.apache.tapestry5.ioc.internal.OperationTrackerImpl.invoke(OperationTrackerImpl.java:65)
   at
  
 
 org.apache.tapestry5.ioc.internal.PerThreadOperationTracker.invoke(PerThreadOperationTracker.java:68)
   at
  
 
 org.apache.tapestry5.ioc.internal.RegistryImpl.invoke(RegistryImpl.java:1063)
   at
  
 
 org.apache.tapestry5.internal.pageload.PageLoaderImpl.loadPage(PageLoaderImpl.java:173)
   at $PageLoader_1403720b2b7.loadPage($PageLoader_1403720b2b7.java)
   at
  
 
 org.apache.tapestry5.internal.services.PageSourceImpl.getPage(PageSourceImpl.java:81)
   at $PageSource_1403720b2b6.getPage($PageSource_1403720b2b6.java)
   at
  
 
 org.apache.tapestry5.internal.services.NonPoolingRequestPageCacheImpl.get(NonPoolingRequestPageCacheImpl.java:74)
   at
   $RequestPageCache_1403720b2b5.get($RequestPageCache_1403720b2b5.java)
   at
   $RequestPageCache_1403720b28e.get($RequestPageCache_1403720b28e.java)
   at
  
 
 com.stubhub.ui.services.impl.ClientCacheHandler.handle(ClientCacheHandler.java:46)
   at
  
 
 $PageRenderRequestHandler_1403720b293.handle($PageRenderRequestHandler_1403720b293.java)
   at
  
 
 org.apache.tapestry5.services.TapestryModule$36.handle(TapestryModule.java:2326)
   at
  
 
 $PageRenderRequestHandler_1403720b293.handle($PageRenderRequestHandler_1403720b293.java)
   at
  
 
 $PageRenderRequestHandler_1403720b28c.handle($PageRenderRequestHandler_1403720b28c.java)
   at
  
 
 org.apache.tapestry5.internal.services.ComponentRequestHandlerTerminator.handlePageRender(ComponentRequestHandlerTerminator.java:48)
   at
  
 
 org.apache.tapestry5.services.InitializeActivePageName.handlePageRender(InitializeActivePageName.java:47)
   at
  
 
 $ComponentRequestHandler_1403720b28d.handlePageRender($ComponentRequestHandler_1403720b28d.java)
   at
  
 
 $ComponentRequestHandler_1403720b272.handlePageRender($ComponentRequestHandler_1403720b272.java)
   at
  
 
 org.apache.tapestry5.internal.services.PageRenderDispatcher.dispatch(PageRenderDispatcher.java:45)
   at $Dispatcher_1403720b274.dispatch($Dispatcher_1403720b274.java)
   at $Dispatcher_1403720b26e.dispatch($Dispatcher_1403720b26e.java)
   at
  
 
 org.apache.tapestry5.services.TapestryModule$RequestHandlerTerminator.service(TapestryModule.java:321)
   at
   com.stubhub.ui.services.StubHubModule$3.service(StubHubModule.java:194)
   at
   $RequestHandler_1403720b26f.service($RequestHandler_1403720b26f.java)
   

Re: best way of incorporating static pages?

2013-06-15 Thread Bård Magnus Kvalheim
Maybe it's just me and I didn't see the problem, but can't you just link to
the cms content?
The cms content has a link so why should tapestry service it?

Is it on the same base domain? Then use request services to generate an
absolute url.

-magnus

HTC one
Den 12. juni 2013 13:07 skrev John j...@quivinco.com følgende:

 Hi,

 I have a need to link to some static HTML generated by a CMS app. Assuming
 this content is in a directory outside my Tapestry app, what would be the
 best way of linking/serving it via Tapestry?

 Perhaps I should just configure a seperate Jetty context and provide
 absolute URLs in someway?

 I'd also consider the static content being part of the projects Java
 resources, not so keen though.

 John


Re: Is it possible to Import external sources

2013-05-28 Thread Bård Magnus Kvalheim
It does not come out of the box. But it is possible with little effort.

You need to make an assetfactory with friends (Resource+asset).

Check: http://osdir.com/ml/users-tapestry-apache/2009-03/msg00937.html

Would then be like this: @Import(stylesheet = {uri:
http://fonts.googleapis.com/css?family=Open+Sans:300italic,400italic,400,700,300
})

cheers
Magnus


On Tue, May 28, 2013 at 8:57 PM, Boris Horvat horvat.z.bo...@gmail.comwrote:

 I have tried

 @Import(stylesheet = {

 http://fonts.googleapis.com/css?family=Open+Sans:300italic,400italic,400,700,300
 }

 but no luck, is this possible or should I add it to html directly?

 --
 Sincerely
 *Boris Horvat*



Re: Why is AssetPathConverter not called for javascript stacks

2013-05-23 Thread Bård Magnus Kvalheim
Hi guys.

Sorry for keep asking for this, but I've still got no good solution for it.
Would like to serve stack javascript assets from cdn.

I think I'll try to patch tapestry internals, but would like to know if you
have pointers to where the best place would be.

I'm looking at JavaScriptStackPathConstructorImpl#combinedStackURL as
possible place to call AssetPathConverter.
Could possibly advice it and modify it's return value?

Or possibly higher up in JavaScriptSupportImpl#addAssetsFromStack


Let me know if you have thoughts.

Thanks
Magnus


On Wed, Nov 7, 2012 at 4:48 PM, Bård Magnus Kvalheim mag...@kvalheim.euwrote:

 I'm still searching for a way to resolve this - now in 5.3.6.

 Anyone have ideas on what potentially could be done? Creative ideas
 welcome :)

 cheers
 Magnus


 On Thu, Oct 25, 2012 at 2:13 PM, Bård Magnus Kvalheim 
 mag...@kvalheim.euwrote:


 Regarding AssetPathConverter - should I open a JIRA for stack assets?

 I just created Jira.
 https://issues.apache.org/jira/browse/TAP5-2019

 Let me know if you know of a workaround in tap 5.3.4.

 thanks
 Magnus





Re: Why is AssetPathConverter not called for javascript stacks

2013-05-23 Thread Bård Magnus Kvalheim
Hi.
On Thu, May 23, 2013 at 11:31 AM, Lance Java lance.j...@googlemail.comwrote:

 I think the easiest way would be to decorate the JavaScriptStackSource
 service. Wrap the default implementation with a version which decorates
 getStack(String name) to return a custom JavaScriptStack implementation.

 The custom JavaScriptStack will provide wrappers for:
 ListAsset getJavaScriptLibraries();
 ListStylesheetLink getStylesheets();

 You'll need to delegate to AssetPathConverter  in Asset.toClientURL() and
 StylesheetLink.getURL()


Was thinking about this and as far as I can see with this approach I would
then get 'cdn' urls for the different scripts that make up the stack, and
not the stack url itself - but could be wrong.

I did try to implement my own proposed solution with Advice - quite simple
and it seems to be working fine. Although there could be side-effects I'm
not aware of yet ...

*@Advise(serviceInterface = JavaScriptStackPathConstructor.class)*
*public static void adviseJavaScriptStackPathConstructor(*
* MethodAdviceReceiver receiver,*
* @Local final AssetPathConverter assetPathConverter) {*
*try {*
*  MethodAdvice ma = new MethodAdvice(){*
*  @Override*
*  public void advise(MethodInvocation invocation) {*
*  invocation.proceed();*
*  ListString paths = (ListString) invocation.getReturnValue();*
*  if(paths==null) return;*
*  *
*  ListString newList = new ArrayList(paths.size());*
*  for (String path : paths) {*
*  newList.add(assetPathConverter.convertAssetPath(path));*
*  }*
*  invocation.setReturnValue(newList);*
*  }*
*  };**   *
*  Class? serviceInterface = receiver.getInterface();*
*  
receiver.adviseMethod(serviceInterface.getMethod(constructPathsForJavaScriptStack,
String.class), ma);**   *
*  } catch (Exception e) {*
*  throw new RuntimeException(Can't find methods. Changed API?, e);*
*  }*
*}*

Let me know if you have further suggestions/ideas.

thanks
Magnus


Re: Why is AssetPathConverter not called for javascript stacks

2013-05-23 Thread Bård Magnus Kvalheim
 I did try to implement my own proposed solution with Advice


 That's a lot of messy byte code manipulation for a single method interface.


Yes, I have to agree. Delegate is probably a better choice in this case.
Cleaner and also typesafe.

Tried your suggestion - and it works just as well as the advice.

Thanks - I'm quite happy with that solution and will update the Jira with
the workaround as well.

cheers
Magnus


Re: [ANNOUNCE] Tapestry-cdi contribution

2013-05-16 Thread Bård Magnus Kvalheim
On Thu, May 16, 2013 at 12:08 PM, Nourredine Khadri 
nourredine.kha...@atos.net wrote:

 I do believe that the same could be said for tapestry-cdi and by
 extension FlowLogix
 Magnus, can you comment on this?
 I think that you have to rely on a specific container's implementation
 to exclude classes from scanning and avoid conficts between CDI and
 Tapestry IOC. I can be wrong.


This was container specific, but remember reading somewhere that it would
be a standard way to specify exclusions in cdi 1.1.  Couldn't find the
reference, but here is a commit though:
https://github.com/pmuir/cdi/commit/a4061ffd0ef52e4028e8cb5727335e7e25f1d493

tapestry-cdi should be portable across containers, think there was only an
issue when including a beans.xml in tapestry app where the weld extensions
could be used.


Re: [ANNOUNCE] Tapestry-cdi contribution

2013-05-15 Thread Bård Magnus Kvalheim
Congratulations guys - and thanks for putting this together. This is good
news.
One of my wishes was to have a solid cdi production quality module, but
never really made past pet-project as we're still on with spring. (Still
hoping for spring to implement the spec, but that might never gonna
happen...)

Yours looks really solid and I guess already used in your internal projects
and possibly in production?

On Wed, May 15, 2013 at 3:35 PM, Nourredine Nourredine 
nourredin...@gmail.com wrote:

 Hi,

 Atos is proud to announce the first release of Tapestry-cdi, part of
 the got5[1] project.

 This library is based on work of Romain Manni Bucau[2] and inspired
 from other contributions (Magnus Kvalheim[3] and FlowLogix
 projects[4]).
 We have updated the dependencies of this library to use Tapestry 5.3.7

 Tapestry-CDI module allows injecting all kind of JSR 299 managed beans
 (POJO, EJB, web service, ...) as they are managed by the
 CDI-container. This library also supports:

 - CDI beans injection
   @Inject CDI beans into pages, components and tapestry services.
   Both @Inject annotations are handled (@javax.inject.Inject and
 @org.apache.tapestry5.ioc.annotations.Inject)

 - Injection by constructor
   @Inject CDI beans into tapestry services constructors.
  Beans can then be injected by field or by constructor.

 - Qualifiers
   To disambiguate when injecting same type but different
 implementations, the module provides support for qualifier which is
 part of  CDI specification.
   You can use qualifiers into pages, components and services. Just use
 @javax.inject.Named annotation

 - Helpers
   Add method helpers to ease the cdi bean instantiation (uncommon but
 useful if you want to declare some CDI beans in your AppModule to let
 tapestry manage them)

 - IOC isolation
   The module assures to have no conflict with the tapestry's IOC
 (Inversion of Control).
   Indeed, as there are beans managed by the java EE container and
 others beans managed by the framework, work has been made to prevent
 one to take control over the beans it is not supposed to manage.


 Code is available at https://github.com/got5/tapestry-cdi

 If you want to see it in action, you just need to:

 - Download the sources and mvn install the project
 - Add the module as a maven dependency for your project
 - In your project, @Inject your CDI beans into pages, components or
 services, and that’s pretty much it.

   @Inject
   private MyCdiBean bean;

   @Inject
   @MyQualifier
   private MyQualifiedBean qualifiedBean;

 For  other use cases, you can already take a look at the unit tests.
 A demo project is coming soon. Stay tuned...

 The contributors of this release are :

 - Romain Manni Bucau
 - Nourredine Khadri
 - Pierre Marot
 - François Facon

 Feedbacks are welcome !

 Best Regards.

 [1] https://github.com/got5
 [2] https://github.com/rmannibucau/cdi-tapestry-contribution
 [3] https://github.com/magnuskvalheim/tapestry-cdi
 [4] http://code.google.com/p/flowlogix

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




Re: date field as 3 drop down fields

2013-04-18 Thread Bård Magnus Kvalheim
True that - learned the hard way :(

Using a threadlocal is quite convenient as well.
http://stackoverflow.com/questions/817856/when-and-how-should-i-use-a-threadlocal-variable
http://docs.oracle.com/javase/7/docs/api/java/lang/ThreadLocal.html



On Thu, Apr 18, 2013 at 12:15 AM, Lance Java lance.j...@googlemail.comwrote:

 Unfortunately, java.text.SimpleDateFormat is not thread safe so can't be
 declared as static. You'll need to use a local variable each time to be
 thread safe unfortunately.
 On 17 Apr 2013 05:06, Jeshurun Daniel sjeshu...@yahoo.ca wrote:

  One more time with the links
 
 
 http://apache-tapestry-mailing-list-archives.1045711.n5.nabble.com/Date-Field-with-day-month-year-and-datepicker-component-td4618810.html
 
 
 http://blog.jeshurun.ca/technology/tapestry-5-datefield-as-3-select-dropdowns
 
 
 
 
  
   From: Jeshurun Daniel sjeshu...@yahoo.ca
  To: Tapestry users users@tapestry.apache.org
  Sent: Tuesday, April 16, 2013 9:58:58 PM
  Subject: Re: date field as 3 drop down fields
 
 
 
  I had the same requirement today and found a version here in the mailing
  lists, but had some problems with it when used inside a loop.
 
  So I rolled my own and posted the code here. It hasn't been tested
  thoroughly, please feel free to suggest improvements to the code.
 
  
 
  From: captain_rhino graeme.kitc...@axa-travel-insurance.com
  To: users@tapestry.apache.org
  Sent: Tuesday, 6 December, 2011 3:25:48 AM
  Subject: date field as 3 drop down fields
 
  I am looking to implement a date field as 3 separate drop downs lists of
  day,
  month and year in T5.   Has anyone already developed a component that
 does
  this?
 
  --
  View this message in context:
 
 http://tapestry.1045711.n5.nabble.com/date-field-as-3-drop-down-fields-tp5051531p5051531.html
  Sent from the Tapestry - User mailing list archive at Nabble.com.
 
  -
  To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org
  For additional commands, e-mail: users-h...@tapestry.apache.org



Re: How to change HTML form action? Or is there any better option?

2013-03-30 Thread Bård Magnus Kvalheim
Hi dmitry. Think the activation context for forms is in a hidden field ,
possibly serialized.

Magnus
-sent from mobile
Den 30. mars 2013 09:30 skrev Dmitry Gusev dmitry.gu...@gmail.com
følgende:

 So, the onPassivate() didn't worked, there's no context in the form's
 action... looking for another options.

 On Sat, Mar 30, 2013 at 12:23 AM, Thiago H de Paula Figueiredo 
 thiag...@gmail.com wrote:

  On Fri, 29 Mar 2013 16:38:22 -0300, Dmitry Gusev dmitry.gu...@gmail.com
 
  wrote:
 
   Well, yes, I probably have to implement onPassivate() and this will
  restore activation context. I haven't think about that, thanks for
  mentioning.
 
 
  ;)
 
 
   Anyway, its just I don't need to involve the page with its
  activate/passivate logic for this action -- the registrationForm
  component is completely independent.
 
 
  That's exactly how it should be: independent.
 
 
  --
  Thiago H. de Paula Figueiredo
 
  --**--**-
  To unsubscribe, e-mail: users-unsubscribe@tapestry.**apache.org
 users-unsubscr...@tapestry.apache.org
  For additional commands, e-mail: users-h...@tapestry.apache.org
 
 


 --
 Dmitry Gusev

 AnjLab Team
 http://anjlab.com



Re: delegage or target

2013-03-25 Thread Bård Magnus Kvalheim
Hi Ken.

I think what you refer to as the target= approach is html frames and you
can certainly do that with tapestry or any other framework.

Here is my understanding of Tapestry 'best practices'.

*Master layouts*
In tapestry you can create master layouts. A master layout is a page
template that contains header, footer sidebars etc.. and defines a special
region to insert the specific page content. In a tapestry component this is
specified by; t:body/
http://tapestry.apache.org/layout-component.html


The other typical php/jsp way of doing things is to use includes for
header, footer sidebar - and that works, but consider having 30+ pages than
it's a lot of work to make modifications - like moving sidebar from left to
right hand side. Master templates is the way to go IMO.

Inside your master template/layout - if you need to display different
content at times you have a few options.
(A layout is 'just' another component and can be as simple/advanced as
you'd like. )

*Conditional if's*
use if statements to conditionally show the content.

*Blocks*
define blocks within layout template and have logic to display/delegate to
what you need.

*Template inheritance*
Should not be overused, but quite useful feature.
http://tapestry.apache.org/component-templates.html#ComponentTemplates-TemplateInheritance.
Can for example have master templates;
simple no sidebar,
standard with sidebar (which inherit from the simple)

*Blocks as parameters*
define block parameters to layout component. Say you have a sidebar where
you want to display different content depending on what page you're on then
give it as parameter. (From the page)
http://tapestry.apache.org/component-templates.html#ComponentTemplates-parameternamespaces

*Reusable components*
If you have pieces of markup and/or logic that is reusable, then it's easy
and useful to make it a component with own tml / java/ + resources files.
Think this is what you refer to as whole TML file


I use all of these approaches - they are all good but think only you know
when it's appropriate to use one over the others. I would definitely start
with a layout though.
Last time I checked the maven quickstart also included examples for blocks
and master layout/components.

cheers
Magnus

On Mon, Mar 25, 2013 at 2:24 AM, Ken in Nashua kcola...@live.com wrote:

 Well it seems there is a concept called blocks...

 And this construct has support for active block.

 This seems like it is what I am seeking hopefully.

 And the delegate component is the guy that operates and manipulates and
 detects?




Re: Keeping the session alive pattern?

2013-02-06 Thread Bård Magnus Kvalheim
If you can do with activation context - then look no further..

I guess though what you're requesting is user data/login persistence.

We have been quite happy with storing user 'tokens' in cookies - and
transparently logging in users (put in session) prior to any page or
component activity.

We have used a Dispatcher to do the 'cookielogin'.

We have also used a custom tapestry security(shiro) implementation
of CookieRememberMeManager to handle session cookies (but may have native
support by now).

--magnus


On Wed, Feb 6, 2013 at 6:29 PM, Lenny Primak lpri...@hope.nyc.ny.us wrote:

 I wouldn't recommend using spring security. I believe you are using
 tapestry-security already and it works wonderfully.

 On Feb 6, 2013, at 9:16 AM, sommeralex alexander.som...@gmail.com wrote:

  thx!
 
 
 
  --
  View this message in context:
 http://tapestry.1045711.n5.nabble.com/Keeping-the-session-alive-pattern-tp5719771p5719812.html
  Sent from the Tapestry - User mailing list archive at Nabble.com.
 
  -
  To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org
  For additional commands, e-mail: users-h...@tapestry.apache.org
 

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




Re: Tapestry 5 book is here

2013-01-25 Thread Bård Magnus Kvalheim
Thank you for this, looks very good.

Even as a tapestry 'veteran' by now, I'm sure I'll find nice gems and
tricks - and it will surely help new developers getting up to speed quickly.

Just great!

On Fri, Jan 25, 2013 at 11:42 AM, Christian Riedel
cr.ml...@googlemail.comwrote:

 Thank you, Igor!

 100 pages more than the early access version, good job! :-)



 Am 25.01.2013 um 10:20 schrieb Igor Drobiazko:

  Dear Tapestry community,
 
  I'm glad to announce that the long awaited Tapestry 5 book is now
 available
  for purchase as paperback:
 
  http://blog.tapestry5.de/index.php/2013/01/25/tapestry-5-book-is-here/
 
  Enjoy reading


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




Re: [ANNOUNCE] FlowLogix Tapestry JEE Integration Library, version 1.2.1

2013-01-11 Thread Magnus Kvalheim
Thanks and happy new year to you too.
Congrats, looks very impressive - will look forward to experiment.

Cheers and good weekend
Magnus

-sent from mobile
Den 11. jan. 2013 17:25 skrev Lenny Primak lpri...@hope.nyc.ny.us
følgende:

 Happy New Year,

 We are pleased to announce a major update to FlowLogix Tapestry LIbrary,
 Version 1.2.1

 The library is available from the Maven Central repository.
 Library Page :http://code.google.com/p/flowlogix/wiki/TapestryLibrary
 Project Page: http://code.google.com/p/flowlogix

 Major New in this release:

 - CDI support is turned on by default
 - Tynamo / Shiro security, including Annotations, now work in EJBs and CDI
 beans
 - New Ajax loading spinner mixin
 - Using @EJB for remote calls in Tapestry
 - Automatic pinging of SFSBs from Tapestry context

 Released under the Apache v2 License

 -
 Major Features

 New Tapestry annotations such as @AJAX for automated session tracking and
 graceful degradation
 Session tracking with automatic redirection to login page, even from AJAX
 requests, if required
 Form submits from the browser history are handled properly, automatically,
 instead of throwing exception to the user
 Components including DynImg, SessionMonitor and Login
 Mixins including DisableAfterSubmit, DeferZoneUpdate, AjaxLoadingSpinner,
 and UpdateEvent
 Use @EJB annotation in Tapestry objects, including Stateful session beans
 and bridge Tapestry and JEE
 CDI (Context and Dependency Injection) Support - Thanks to Magnus Kvalheim
 Use tapestry-jpa with multiple databases easily with PersistenceRegistry
 Improved Tapestry DateField calendar functionality
 Bridges Security between Tapestry-Security/Shiro, EJBs and REST Services
 Create GWT Components and use them in Tapestry pages / components with
 GwtSupport
 End-to-End integration with GWT and SmartGWT
 Override Tapestry Ajax highlight colors easily with a mixin
 Automatic wait cursor while waiting for Ajax request (ZoneLoadingSpinner
 mixin)
 build-core, a pre-made Maven POM parent for Tapestry and GWT to work with
 JEE
 Skinny WAR support, deploy-on-save support for Glassfish and NetBeans
 Runtime Environment
 The library will run on Java 7+ and in any Servlet or JEE container
 Some more advanced features require Servlet 3.0 and a full JEE container
 such as Glassfish.





Re: Why is AssetPathConverter not called for javascript stacks

2012-11-07 Thread Bård Magnus Kvalheim
I'm still searching for a way to resolve this - now in 5.3.6.

Anyone have ideas on what potentially could be done? Creative ideas welcome
:)

cheers
Magnus


On Thu, Oct 25, 2012 at 2:13 PM, Bård Magnus Kvalheim mag...@kvalheim.euwrote:


 Regarding AssetPathConverter - should I open a JIRA for stack assets?

 I just created Jira.
 https://issues.apache.org/jira/browse/TAP5-2019

 Let me know if you know of a workaround in tap 5.3.4.

 thanks
 Magnus



Re: Image lazy loading using tapestry without jquery.

2012-10-26 Thread Bård Magnus Kvalheim
Hi Anbazhagan.

Yes, Alex is right - you need some javascript for that.

jquery afaik works well with mobile devices. Don't know if you used a
plugin - or did it yourself, but I've wrapped a jquery library to do our
lazy loading: http://www.appelsiini.net/projects/lazyload . Works well for
us - also with mobile devices.

It is implemented/wrapped as a mixin.

It is not overly complex, but have some neat features:
* can be applied to a component (dough)
* can work in nested mode where it visits all child nodes and applies
lazyload to image tags.
* can skip for visiting crawlers (these don't execute javascript)

If you're interested I could possibly share some code (or host at github if
I get some free time).

cheers
Magnus

On Thu, Oct 25, 2012 at 5:05 PM, Alex Kotchnev akoch...@gmail.com wrote:

 I don't think you'll find an existing component that does this in Tapestry
 - it sounds like a general dynamic HTML kind of problem (and more
 specifically, how you can handle that problem on the phone browsers you are
 working with), for which you will most likely will need to write some
 javascript or use an existing js library.

 Cheers,

 Alex K

 On Thu, Oct 25, 2012 at 10:02 AM, Anbazhagan anbazhaga...@snovabits.net
 wrote:

  Hi,
 
  I am developing a web application for smart phones using tapestry. I am
  display more than 40 images in my index page using tapestry loop
 component.
 
  I want image lazy loading when I scroll down that page. I have achieved
  using jquery but still i have some problem while I am scrolling in smart
  phones.
 
  So I am searching tapestry component to achieve that.
 
  Please any one say is possible to achieve that using tapestry. Is any
  tapestry component to solve that problem.
 
 
 
 
 
 
  --
  View this message in context:
 
 http://tapestry.1045711.n5.nabble.com/Image-lazy-loading-using-tapestry-without-jquery-tp5717231.html
  Sent from the Tapestry - User mailing list archive at Nabble.com.
 
  -
  To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org
  For additional commands, e-mail: users-h...@tapestry.apache.org
 
 



Re: Why is AssetPathConverter not called for javascript stacks

2012-10-25 Thread Bård Magnus Kvalheim
 Regarding AssetPathConverter - should I open a JIRA for stack assets?

 I just created Jira.
https://issues.apache.org/jira/browse/TAP5-2019

Let me know if you know of a workaround in tap 5.3.4.

thanks
Magnus


Re: Why is AssetPathConverter not called for javascript stacks

2012-10-06 Thread Magnus Kvalheim
On Fri, Oct 5, 2012 at 6:28 PM, Howard Lewis Ship hls...@gmail.com wrote:

 Sounds nice; that's how I've always assumed CDNs worked (lazily)
 though I'm told other require an explicit load of assets into the CDN,
 which is tricky in the Tapestry world where many of those assets are
 dynamically generated (or compiled, or aggregated).


Yes, it works great with dynamic content - although we have to disable cdn
during releases as we currently don't do an atomic update in cluster. If we
didn't then users will be missing assets as we use a cookieless domain for
that. (Expect to do atomic updates soon though.)

Regarding AssetPathConverter - should I open a JIRA for stack assets?


On Fri, Oct 5, 2012 at 10:37 PM, trsvax trs...@gmail.com wrote:

 I wrote a CloudFront CDN while ago and also ran into a few problems. Is
 loading content other than from S3 a new feature?


It's not new - think they started beta back in 2008. However they launch
new features all of the time.


 I wrote a CDNManger
 service that Lazily loaded the assets onto S3. The problem I ran into is
 Tapestry uses the same URL to deliver compressed and uncompressed content
 depending on the client request. I suspect if you just point ClouldFront
 back to your Tapestry app you will have strange problems with old browsers


No, compressed files is supported with cloudfront so it should be a non
issue. It respects the Accept-Encoding header.
http://docs.amazonwebservices.com/AmazonCloudFront/latest/DeveloperGuide/ServingCompressedFiles.html

As a cdn, cloudfront is superior to s3. They serve different purposes, but
work well together.
s3 can easily be configured as origin to cloudfront and you pay no
additional cost for this. I'm a satisfied user of both.


Re: Why is AssetPathConverter not called for javascript stacks

2012-10-05 Thread Magnus Kvalheim
Hi Howard - thanks for your reply.

Looks like an oversight.  I'm not familiar with CloudFront; can you
 give me a thumbnail overview of how your CDN hooks work?

 Sure.

Well Cloudfront is at heart a CDN.
It has many features, but how it works is that it delivers content from
edges that are close to end users.
If it don't have the content (or it is expired) it will proxy back to an
'origin' (there can be several) get the content, store it at the edge and
deliver to user.

It is a lazy CDN approach that works well as there is no need to first
upload content to a CDN - like S3.
http://aws.amazon.com/cloudfront/


How it works in the tapestry application is that we have configured a
cookieless domain against the CloudFront with the tapestry app as origin.
It all works great - apart from the stack assets where the
AssetPathConverter#convertAssetPath is never called.

*public class CDNAssetPathConverter implements AssetPathConverter {*
* private IParameter ip;*
* private String applicationVersion;*
*
*
*public CDNAssetPathConverter(@Inject
@Symbol(SymbolConstants.APPLICATION_VERSION) String applicationVersion,*
*@Inject IParameter ip){*
*this.applicationVersion = applicationVersion;*
*this.ip = ip;*
*}*
*String getCDNDomain() {*
*return ip.getString(PKey.DOMAIN_CDN_VERSIONED, null);*
*}*
*@Override*
*public String convertAssetPath(String assetPath) {*
*String domain = getCDNDomain();*
*if(domain==null) return assetPath;*
**
*String result = convertToCDN(assetPath, domain);*
*return result;*
*}*
*private String convertToCDN(String path, String domain) {*
*String _path = path.replaceFirst(^/+, );*
*return String.format(http://%s/%s;, domain, _path);*
*}*
*@Override*
*public boolean isInvariant() {*
*return false;*
*}*
*} *


Re: Why is AssetPathConverter not called for javascript stacks

2012-10-05 Thread Bård Magnus Kvalheim
Hi Howard - thanks for your reply.

Looks like an oversight.  I'm not familiar with CloudFront; can you
 give me a thumbnail overview of how your CDN hooks work?

 Sure.

Well Cloudfront is at heart a CDN.
It has many features, but how it works is that it delivers content from
edges that are close to end users.
If it don't have the content (or it is expired) it will proxy back to an
'origin' (there can be several) get the content, store it at the edge and
deliver to user.

It is a lazy CDN approach that works well as there is no need to first
upload content to a CDN - like S3.
http://aws.amazon.com/cloudfront/


How it works in the tapestry application is that we have configured a
cookieless domain against the CloudFront with the tapestry app as origin.
It all works great - apart from the stack assets where the
AssetPathConverter#convertAssetPath is never called.

*public class CDNAssetPathConverter implements AssetPathConverter {*
* private IParameter ip;*
* private String applicationVersion;*
*
*
*public CDNAssetPathConverter(@Inject
@Symbol(SymbolConstants.APPLICATION_VERSION) String applicationVersion,*
*@Inject IParameter ip){*
*this.applicationVersion = applicationVersion;*
*this.ip = ip;*
*}*
*String getCDNDomain() {*
*return ip.getString(PKey.DOMAIN_CDN_VERSIONED, null);*
*}*
*@Override*
*public String convertAssetPath(String assetPath) {*
*String domain = getCDNDomain();*
*if(domain==null) return assetPath;*
**
*String result = convertToCDN(assetPath, domain);*
*return result;*
*}*
*private String convertToCDN(String path, String domain) {*
*String _path = path.replaceFirst(^/+, );*
*return String.format(http://%s/%s;, domain, _path);*
*}*
*@Override*
*public boolean isInvariant() {*
*return false;*
*}*
*} *


Why is AssetPathConverter not called for javascript stacks

2012-10-04 Thread Bård Magnus Kvalheim
Hi good people.

We were looking into serving assets from aws cloudfront and could quite
easily make a AssetPathConverter to support that thanks to previous
mailinglist discussions and examples.

The only issue now is that stacks (js) don't seem to go through the
AssetPathConverter. Applies to both custom and core stacks.

Tapestry 5.3.4
I've done this in module:
*binder.bind(AssetPathConverter.class,
CDNAssetPathConverter.class).withId(CDNAssetPathConverter);*
*
*
*public static void
contributeServiceOverride(MappedConfigurationClass,Object configuration,*
* @Local AssetPathConverter assetPathConverter) { *
* configuration.add(AssetPathConverter.class, assetPathConverter);*
*}*
*
*
Any idea how to convert paths for javascript stacks?

Many thanks in advance
Magnus Kvalheim


Re: Rendering cache

2012-07-29 Thread Bård Magnus Kvalheim
Hi Jens,

As it happens I too was thinking about this a while back.
I didn't make any research, but I would probably look into making mixin or
component using the before and after render phases.

Saving/caching the markup in after - and then short-circuit in before if
cache is valid. I think is should be possible to get the markup from the
MarkupWriter.

Providing a cache key as parameter
(like the 'watch' in
http://tapestry.apache.org/5.3.4/apidocs/org/apache/tapestry5/annotations/Cached.html
)
should be pretty strait forward to implement as well

Some known challenges/limitations:
* imported javascript/css in inner components
* use of javascriptsupport in inner components


Perhaps I'll give it a crack at it after the vacations if youre still
looking for a solution.

cheers
Magnus

On Sat, Jul 28, 2012 at 1:11 PM, Jens Breitenstein mailingl...@j-b-s.dewrote:

 Hi T5'ers

 we have some performance issues and started thinking about caching our
 pages (lets say parts of them to be precise). Due to the fact we are
 showing user related information along with public information on a page,
 we can not make use of a simple web proxy caching.

 Therefore we are thinking about a component rendering result cache.

 Assume we have several independent components to show an overview of items
 (and we have a lot of items rendered in a loop) and we want to cache the
 rendering result of one of these particular components for several seconds
 before rendering it again (to reflect new items or changes). I am aware
 this means we are showing stale data for some seconds, but honestly this is
 not an issue because after rendering and displaying it in the browser data
 is considerably old anyway :-)

 What might be a good place to intercept the rendering and store the output
 from a component and on the other hand use outputraw for sending cached
 data?
 Does anyone tried this before?

 Any idea or comment is appreciated, thanks in advance


 Jens




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




Re: Tapestry on OpenShift: did someone already tried it?

2012-05-30 Thread Magnus Kvalheim



 Do you know if there's some other use of a vfs HTTP protocol besides
 the JBoss one? If not, we could add the code in tapestry-core itself.
 Otherwise, I prefer a separate module. Is there a JIRA for that? If not,
 please post one.



 Yes there is one
https://issues.apache.org/jira/browse/TAP5-1912


Re: Tapestry on OpenShift: did someone already tried it?

2012-05-29 Thread Magnus Kvalheim
Hi Thiago.

This is unfortunately expected behavior. Openshift is running JBoss(7.1)
and tapestry is not supported on jboss out of the box.

I was a bit sad to discover this myself - I was kinda expecting it to work
for all major deployment env.

Basically what you need is a ClasspathURLConverter like this one
http://wiki.apache.org/tapestry/HowToRunTapestry5OnJBoss6Dot1

So far I've had no problems with this approach - so maybe we could bring it
into core or make an official tapestry-jboss module based on it?

As it happens I posted yesterday about official jboss support -
http://tapestry.1045711.n5.nabble.com/Official-jboss-support-td5713435.html

cheers
magnus

On Mon, May 28, 2012 at 11:48 PM, Thiago H de Paula Figueiredo 
thi...@arsmachina.com.br wrote:

 Hi, guys!

 Did anyone try to deploy a Tapestry application to RedHat's OpenShift?
 I've picked a very, very, very simple application with just a couple pages
 and no external dependency but every URL returns the same The requested
 resource (/) is not available. . Here's its URL:
 http://teste-thiagohp.rhcloud.**com/ http://teste-thiagohp.rhcloud.com/

 --
 Thiago

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




Re: Official jboss support

2012-05-29 Thread Magnus Kvalheim
@jon - yeah, I know how frustrating it can be when it's just not working
for whatever reason.
Tapestry have a great community though - so I'm sure you would have gotten
some intelligent replies and help to solve the issues you were facing.
Especially from Geoff.

Now back on topic.

I would really like to see tapestry just work out of the box on all major
deployment environments. I would expect nothing less.
Actually Thiago made a post earlier about tapestry not working on openshift
which also runs jboss as7.1
http://tapestry.1045711.n5.nabble.com/Tapestry-on-OpenShift-did-someone-already-tried-it-td5713476.html

Should I create a jira issue/feature request for ClasspathURLConverter[1]
and possibly cdi support as well [2] ?

[1]ClasspathURLConverter - It's needed on jboss as it's having an internal
vfs and can't find pages and components on it's own.
I think http://wiki.apache.org/tapestry/HowToRunTapestry5OnJBoss6Dot1 could
serve as initial codebase

[2]CDI support
With Jee6 it's highly desirable to use cdi(jsr 299) for managing beans. I
dare to say in most cases spring can be avoided completely and what you get
is a app(s) with far less dependencies and configuration.
To top it off you even get conversational scope for free!
The module - https://github.com/magnuskvalheim/tapestry-cdi - could be used
as initial codebase for tapestry cdi.

Let me know what you think

cheers
magnus

On Tue, May 29, 2012 at 2:19 AM, Geoff Callender 
geoff.callender.jumpst...@gmail.com wrote:

 Wow, you wasted a week with it and this is the first I've heard about it?
 Why?

 As far as I know the instructions work fine - I can't know differently if
 you don't tell me. So Jon,  for the benefit of all of us, please post
 specifics that can be acted on and I will see what I can do. Much more
 useful than a rant.

 Geoff

 On Tuesday, 29 May 2012, Jon Williams wrote:

  Well, the last version of the Jumpstart supposedly worked on JBoss also.
  Press 1 button, CPU cycles spin for 5 minutes, then your app is pooped
 out
  into the appropriate JBoss directory. At this point you are told by the
  directions that's all there is to do, proceed with the next stage of your
  project.
 
  But, try to follow these instructions, by the letter, you'll find holy
  jesus Jboss is incapable of managing your database connections. It works,
  next time, doesn't work, refresh, works, refresh. nope totally not
 working.
  Puzzle over this for a couple of days, reach the conclusion, OMG Jboss is
  total crap I can't use it. Then if you have a brain you go get Jetty,
 build
  the f'r yourself. Mess around with ant scripts for the Jumpstart (why the
  fuck they are ant scripts I can not answer), god damn 4 days later the
  stupid thing actually works.
 
  Summary: Don't fucking release your shit without proper docs or you are
  kicked out of the club forever.
 
  I know you are trying to be helpful, but we are noobs. If you do not
  accurately detail specifics in your docs, most particularly the basic 123
  get running doc. All your effort and good intention is regarded by people
  who really want to see your code working will end up 1)being too stupid
 to
  untangle the puzzle and abandon all efforts 2)smart enough to realize
  something is fundamentally screwy, then roll up sleeves and repair the
  rubbish that could not ever have worked properly ever.
  3)Get really really 1mm from total anyurism and god damn rant at the
  retards who wasted your week.
 
  On Mon, May 28, 2012 at 11:37 AM, Gmail daniel.ho...@gmail.com
 javascript:;
  wrote:
 
   Be advised that as7 is very different from previous versions so proceed
   with that in mind.
  
   Sent from my iPhone
  
   On May 28, 2012, at 7:58 AM, Geoff Callender 
   geoff.callender.jumpst...@gmail.com javascript:; wrote:
  
It's not what you'd call a mission critical app, but the JumpStart
 demo
   runs on JBoss AS 7.1.1.
   
On 28/05/2012, at 7:49 PM, Magnus Kvalheim wrote:
   
Hi tapestry friends.
   
We are in process of converting a project to deploy on JBoss AS7 in
production.
I've used
  http://wiki.apache.org/tapestry/HowToRunTapestry5OnJBoss6Dot1and
seems to work fine.
   
I'm wondering though if anyone else have/are using this in
 production.
   Is
it stable and efficient enough for production use?
   
The best would be if T5 would work in JBoss 'out of the box'.
An official Tapestry module would be fine as well.
   
Any thoughts or experiences on this?
   
   
-
Background:
We have spring jpa based apps that runs on jetty/tomcat for
   dev/production.
One of these apps is using tapestry
Spring is mainly used for transaction management and dependency
   injection.
   
   
The converted apps uses ejb's(tx management) and cdi. No spring
dependencies anymore.
Tapestry cdi support comes from my own module (
https://github.com/magnuskvalheim/tapestry-cdi). So far it's
 working
   fine

Re: Official jboss support

2012-05-29 Thread Magnus Kvalheim
On Tue, May 29, 2012 at 2:06 PM, Thiago H de Paula Figueiredo 
thiag...@gmail.com wrote:

 On Tue, 29 May 2012 07:47:12 -0300, Magnus Kvalheim mag...@kvalheim.dk
 wrote:

  [2]CDI support
 With Jee6 it's highly desirable to use cdi(jsr 299) for managing beans. I
 dare to say in most cases spring can be avoided completely and what you
 get is a app(s) with far less dependencies and configuration.
 To top it off you even get conversational scope for free!
 The module - 
 https://github.com/**magnuskvalheim/tapestry-cdihttps://github.com/magnuskvalheim/tapestry-cdi-
  could be used as initial codebase for tapestry cdi.


 Something I was thinking about Tapestry-IoC with CDI was the possibility
 of configuring all services in Tapestry-IoC and then somehow pass them to
 CDI, so CDI could handle transactions and stuff like that. We could also
 provide injections from T-IoC to CDI. In this scenario, I was thinking of
 having a different TapestryFilter implementation that sets a Registry
 instance in the ServletContext that pulls services from CDI (T-IoC
 indirectly) and not directly from T-IoC. This way, we can have the best of
 both worlds (transactions and other stuff from CDI and the nice features of
 T-IoC like distributed configuration, easy decoration of services, etc). We
 probably would need


*Bootstrap*
cdi (weld) is normally triggered on the existence of beans.xml in
web/meta-inf. Once started a beanmanager will be registered in jndi and
available through context.
In the current implementation of tapestry-cdi (among other things) a custom
injectionprovider is registered. It looks up and injects cdi beans on
@Inject.

*T-IoC to CDI*
It is quite possible to wrap and feed tapestry services to CDI. This is
done by making a portable extension.
http://docs.jboss.org/weld/reference/1.1.0.Final/en-US/html_single/#extend

*Transactions*
CDI don't offer transactions yet. Although I think it's on the roadmap I
believe it's recommended to use ejb's.
(Maybe a little too much detail, but guess it's possible to use
interceptors which work much the same way as a
tapestry ComponentClassTransformWorker,
http://docs.jboss.org/weld/reference/1.1.0.Final/en-US/html_single/#interceptors
)



 What do you think? I have no CDI experience, so I'm not sure what I'm
 describing above is feasible. And this idea would be an option to what
 you've done in tapestry-cdi, so people can choose what CDI integration they
 want.


I'm still learning cdi as well, but from what I know I think it's best to
let cdi bootstap normally and then inject in tapestry through
injectionprovider - and contribute t-services to cdi through a portable
extension.
Perhaps others have some more input though...




 --
 Thiago



Re: Tapestry on OpenShift: did someone already tried it?

2012-05-29 Thread Magnus Kvalheim
On Tue, May 29, 2012 at 1:55 PM, Thiago H de Paula Figueiredo 
thiag...@gmail.com wrote:

 On Tue, 29 May 2012 03:11:06 -0300, Magnus Kvalheim mag...@kvalheim.dk
 wrote:

  Hi Thiago.


 Hi, Magnus!


  This is unfortunately expected behavior. Openshift is running JBoss(7.1)
 and tapestry is not supported on jboss out of the box.
 I was a bit sad to discover this myself - I was kinda expecting it to
 work for all major deployment env.
 Basically what you need is a ClasspathURLConverter like this one
 http://wiki.apache.org/**tapestry/**HowToRunTapestry5OnJBoss6Dot1http://wiki.apache.org/tapestry/HowToRunTapestry5OnJBoss6Dot1


 Thanks for the tip. :) After I turned off my computer yesterday, I
 remembered this problem with Tapestry on JBoss. We just had another thread
 about this and somehow I didn't remember while I was playing with OpenShift.

 Do you know if there's some other use of a vfs HTTP protocol besides the
 JBoss one? If not, we could add the code in tapestry-core itself.
 Otherwise, I prefer a separate module. Is there a JIRA for that? If not,
 please post one.


I'm happy with that :)



 Yep, we can provide a solution for this, but I'd like to remember everyone
 that Tapestry isn't working out of the box in JBoss now due to a JBoss
 issue, not a Tapestry one. ;)


True, I completely understand and agree with you.
Although I think developers don't care about the details and might blame
tapestry when it don't work. Then they have to find and integrate a piece
of code from elsewhere...
That might leave them a bit insecure (I know I am about the thought of
putting it into production - I don't know if it's production quality).




 --
 Thiago

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




Official jboss support

2012-05-28 Thread Magnus Kvalheim
Hi tapestry friends.

We are in process of converting a project to deploy on JBoss AS7 in
production.
I've used http://wiki.apache.org/tapestry/HowToRunTapestry5OnJBoss6Dot1 and
seems to work fine.

I'm wondering though if anyone else have/are using this in production. Is
it stable and efficient enough for production use?

The best would be if T5 would work in JBoss 'out of the box'.
An official Tapestry module would be fine as well.

Any thoughts or experiences on this?


-
Background:
We have spring jpa based apps that runs on jetty/tomcat for dev/production.
One of these apps is using tapestry
Spring is mainly used for transaction management and dependency injection.


The converted apps uses ejb's(tx management) and cdi. No spring
dependencies anymore.
Tapestry cdi support comes from my own module (
https://github.com/magnuskvalheim/tapestry-cdi). So far it's working fine
and have no issues, but need more testing before it's ready for production


Re: Rendering components in Alerts

2012-03-08 Thread Magnus Kvalheim
Thanks Kalle,

For alerts I created issue:  https://issues.apache.org/jira/browse/TAP5-1863


For the more general renderer for blocks:
https://issues.apache.org/jira/browse/TAP5-1864

--magnus

On Wed, Mar 7, 2012 at 8:20 PM, Kalle Korhonen
kalle.o.korho...@gmail.comwrote:

 On Wed, Mar 7, 2012 at 12:17 AM, Magnus Kvalheim mag...@kvalheim.dk
 wrote:
  We've just upgraded to 5.3.2 and checked out some of the new components.
  The Alerts seems pretty useful, but looks like it's only possible to pass
  on strings.
  I'm thinking a pretty common use-case would be to render some
  components/markup in it - like links.
  I experimented a little by manually rendering a block and pass that on to
  alertManager. Got some inspiration from this thread about rendering
 blocks
  *alertManager.info(markupWriter.toString());*
  That seems to work, but it's a bit clumsy and don't know if it's
  the recommended approach for rendering blocks. Does a convenience method
  exist for rendering blocks/components?
  Not sure if it's possible, but how about if one could pass blocks to
 alerts
  directly. That could be pretty flexible as well...

 Certainly the recommended approach is to use the provided render
 queue, rather than create your own - but obviously the current
 implementation doesn't always allow to do so. Completely agree with
 you that rendering links, and, in general, rendering blocks would be
 very useful for alerts. I don't see any major issue why it couldn't be
 supported. Please open an issue for it.

 Kalle

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




Rendering components in Alerts

2012-03-07 Thread Magnus Kvalheim
Hi Tapestry friends,

We've just upgraded to 5.3.2 and checked out some of the new components.
The Alerts seems pretty useful, but looks like it's only possible to pass
on strings.

I'm thinking a pretty common use-case would be to render some
components/markup in it - like links.

I experimented a little by manually rendering a block and pass that on to
alertManager. Got some inspiration from this thread about rendering blocks
-
http://tapestry.1045711.n5.nabble.com/Howto-render-a-block-and-put-it-into-a-JSON-reply-td5486823.html


*RenderCommand renderCommand = (RenderCommand)alertBlock;*
*MarkupWriter markupWriter = new MarkupWriterImpl();*
*RenderQueueImpl renderQueue = new RenderQueueImpl(log);*
*renderQueue.push(renderCommand);*
*renderQueue.run(markupWriter);*
*
*
*alertManager.info(markupWriter.toString());*

That seems to work, but it's a bit clumsy and don't know if it's
the recommended approach for rendering blocks. Does a convenience method
exist for rendering blocks/components?


Not sure if it's possible, but how about if one could pass blocks to alerts
directly. That could be pretty flexible as well...


Thoughts?

Cheers
Magnus


Re: Rendering components in Alerts

2012-03-07 Thread Magnus Kvalheim
Haha... That's awesome - glad I could help out :)


Regarding the alerts.
How are you people using it-  is it only me that would like to render
components with it as well?


On Wed, Mar 7, 2012 at 11:28 AM, Lance Java lance.j...@googlemail.comwrote:

 Magnus, I think you've just answered my previous threads


 http://tapestry.1045711.n5.nabble.com/How-does-MultiZoneUpdateEventResultProcessor-get-a-html-string-from-a-RenderCommand-td5518968.html


 http://tapestry.1045711.n5.nabble.com/tml-parameter-rendered-into-a-JavaScript-string-td5512889.html#a5518439

 Thanks very much!!

 On Wednesday, 7 March 2012, Magnus Kvalheim mag...@kvalheim.dk wrote:
  Hi Tapestry friends,
 
  We've just upgraded to 5.3.2 and checked out some of the new components.
  The Alerts seems pretty useful, but looks like it's only possible to pass
  on strings.
 
  I'm thinking a pretty common use-case would be to render some
  components/markup in it - like links.
 
  I experimented a little by manually rendering a block and pass that on to
  alertManager. Got some inspiration from this thread about rendering
 blocks
  -
 

 http://tapestry.1045711.n5.nabble.com/Howto-render-a-block-and-put-it-into-a-JSON-reply-td5486823.html
 
  
  *RenderCommand renderCommand = (RenderCommand)alertBlock;*
  *MarkupWriter markupWriter = new MarkupWriterImpl();*
  *RenderQueueImpl renderQueue = new RenderQueueImpl(log);*
  *renderQueue.push(renderCommand);*
  *renderQueue.run(markupWriter);*
  *
  *
  *alertManager.info(markupWriter.toString());*
  
  That seems to work, but it's a bit clumsy and don't know if it's
  the recommended approach for rendering blocks. Does a convenience method
  exist for rendering blocks/components?
 
 
  Not sure if it's possible, but how about if one could pass blocks to
 alerts
  directly. That could be pretty flexible as well...
 
 
  Thoughts?
 
  Cheers
  Magnus
 



Re: tapestry-resteasy: How to Get IP Address on Resource Class

2011-12-27 Thread Bård Magnus Kvalheim
Hi Yohan,

Havent tried but you should be able to get it from
@Context HttpServletRequest request
http://docs.jboss.org/resteasy/docs/2.3.0.GA/userguide/html_single/index.html#_Context

Think context injection works on resource method as well as members.

Then use request.getRemoteAddr()

Guess you could also use tapestry inject for getting httpservletrequest.

Tip
With resteasy you can register providers that can intercept all resource
method invocations. That way you can handle logging from a single place.
http://docs.jboss.org/resteasy/docs/2.3.0.GA/userguide/html_single/index.html#Interceptors



Hope it helps

Cheers and merry christmas
Magnus

On Tue, Dec 27, 2011 at 9:48 AM, Yohan Yudanara yohan.yudan...@gmail.comwrote:

 Hi,

 I want to ask a question about tapestry-resteasy library from tynamo (
 www.tynamo.org)
 Is it possible to get client IP Address on tapestry-resteasy resource
 class?
 I need the IP address of incoming request for logging purpose.

 Thanks in advance

 Best regards,
 Yohan Yudanara



Re: Live reload in production?

2011-12-13 Thread Bård Magnus Kvalheim


 For 5.4, we can introduce yet another level of indirection that
 indicates that live reloading is desired in production mode; perhaps
 an enum to define what gets reloaded.  Is there a JIRA issue yet?


Thanks Howard - that sounds great.
Created issue: https://issues.apache.org/jira/browse/TAP5-1789




 
  Not a showstopper - just want to know what my options are...
 
  thanks
  Magnus
 
  On Fri, Apr 22, 2011 at 9:01 PM, Vangel V. Ajanovski a...@ii.edu.mk
 wrote:
 
  On 20.04.2011 21:03, Thiago H. de Paula Figueiredo wrote:
   On Wed, 20 Apr 2011 15:21:10 -0300, LLTYK ll...@mailinator.com
 wrote:
  
   Disabled, so you automatically get better performance. I don't think
 you
   should have to tweak Tapestry options to get better performance.
  
   Good point. But a similar argument can be used: enabled, so you get a
   faster development environment without tweaking options. My gosh,
   these decisions are hard. :)
 
  I would like to know what is truly the nature of the problem with live
  reload (besides possibility to get the application in an inconsistent
  state of which every developer is aware).
 
  What is the range of the performance penalty? 0.01%, 1%, 5%, 20%, ... is
  it raising exponentially on the number of all pages? Memory use? Permgen
  filling too quickly?
  Is it really only about performance, or does it have other problems too?
  What other (under the hood) differences do production and development
  modes have?
 
  Howard started this discussion without really explaining the reasons for
  not having it at all or even the reasons for not having an option that
  would enable it in production.
 
 



 --
 Howard M. Lewis Ship

 Creator of Apache Tapestry

 The source for Tapestry training, mentoring and support. Contact me to
 learn how I can get you up and productive in Tapestry fast!

 (971) 678-5210
 http://howardlewisship.com

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




Re: Live reload in production?

2011-12-12 Thread Magnus Kvalheim
Any update on this?

We're about to upgrade to T5.3, but conveniently use template reload in
production on rare occasions.
From prior discussions a symbol would/could be introduced, but don't seem
like it has..?

Any way of supporting reload(without production=false)? Or is the dynamic
component the way to go?

Not a showstopper - just want to know what my options are...

thanks
Magnus

On Fri, Apr 22, 2011 at 9:01 PM, Vangel V. Ajanovski a...@ii.edu.mk wrote:

 On 20.04.2011 21:03, Thiago H. de Paula Figueiredo wrote:
  On Wed, 20 Apr 2011 15:21:10 -0300, LLTYK ll...@mailinator.com wrote:
 
  Disabled, so you automatically get better performance. I don't think you
  should have to tweak Tapestry options to get better performance.
 
  Good point. But a similar argument can be used: enabled, so you get a
  faster development environment without tweaking options. My gosh,
  these decisions are hard. :)

 I would like to know what is truly the nature of the problem with live
 reload (besides possibility to get the application in an inconsistent
 state of which every developer is aware).

 What is the range of the performance penalty? 0.01%, 1%, 5%, 20%, ... is
 it raising exponentially on the number of all pages? Memory use? Permgen
 filling too quickly?
 Is it really only about performance, or does it have other problems too?
 What other (under the hood) differences do production and development
 modes have?

 Howard started this discussion without really explaining the reasons for
 not having it at all or even the reasons for not having an option that
 would enable it in production.




Re: Textarea with character count?

2011-09-27 Thread Magnus Kvalheim
Hi,


  I wonder in Tapestry world, is there such a component that while user
 types, it will counts how many characters have the user typed.
 Alternatively, I
 would like to know if there is a way to restrict the textarea to a fixed
 size, say 500 characters. If exceeded, no more text will be allowed.


 I guess there isn't one ready to use, but with a little bit of JavaScript
 you can easily write a mixin that does exactly that. ;)


I've used this jQuery plugin previously -
http://roy-jin.appspot.com/jsp/textareaCounter.jsp .
You can specify a fixed number of characters.

Works well and has good documentation.

Cheers
Magnus Kvalheim


Re: Tapestry 5.3 and JQuery

2011-08-31 Thread Magnus Kvalheim
No, you just need to call it once after jquery itself has loaded.

jQuery plugin authors (should) define the plugin in an capsuled
function/closure in order to avoid issues with other libraries - like
prototype.
see - http://docs.jquery.com/Plugins/Authoring#Summary_and_Best_Practices
So - although the plugin is using $ internally - it's an alias for jQuery,
but only in the scope of the closure.

It's the recommended approach and JQueryUI does this for sure.

You might also want to checkout
http://docs.jquery.com/Using_jQuery_with_Other_Libraries#Referencing_Magic_-_Shortcuts_for_jQuery
for
how to write blocks of jquery code without using jQuery namespace all of the
time.

cheers
Magnus

On Wed, Aug 31, 2011 at 3:09 PM, Julien Martin bal...@gmail.com wrote:

 Hello again,
 Do I also need to add the jQuery.noConflict() at the end of the JQuery UI
 file?
 J.

 2011/8/30 Gunnar Eketrapp gunnar.eketr...@gmail.com

  I use jQuery without any hazzle.
 
  Just remember to call jQuery.noConflict() and to use jQuery instead of $
  since prototype has taken that one.
 
  2011/8/30 Julien Martin bal...@gmail.com
 
   Hello all,
   Can someone please tell me what are the recommended patterns or
  frameworks
   -
   if any - I should rely if I want to use JQuery together with Tapestry
 5?
   For instance, can I just include the JQuery library in my template
 pages
   and
   go ahead and use JQuery features? Are there pitfalls I should avoid?
   Any clue or comment welcome.
   Thanks,
   Julien.
  
 
 
 
  --
  [Hem: 08-715 59 57, Mobil: 070-991 86 42]
  Allévägen 2A, 132 42 Saltsjö-Boo
 



Re: Problem with securing ajax enabled Tapestry pages with Annotations ...

2011-08-24 Thread Magnus Kvalheim
I sometimes use a proxy for doing redirects.

*public class RedirectProxy {*
* @Persist private String redirectURL;*
* @Inject private ComponentResources _resources;*
* Object onActivate(){*
* try {*
* URL url = new URL(redirectURL);*
* return url;*
* } catch (Exception e) {*
* // TODO: handle exception*
* } finally{*
* _resources.discardPersistentFieldChanges(); *
* }*
* return Index.class;*
* }*
* public void setRedirectURL(String redirectURL) {*
* this.redirectURL = redirectURL;*
* }*
*
*
* public String getRedirectURL() {*
* return redirectURL;*
* }*
*}*

Then from an eventhandler:
*redirectProxy.setRedirectURL(u);*
*return redirectProxy;*

It could perhaps be useful for this case?

--magnus

On Tue, Aug 23, 2011 at 11:00 PM, Gunnar Eketrapp gunnar.eketr...@gmail.com
 wrote:

 Hum .. this did not work so I guess I have to do something on the client
 side as well ...

   if (request.isXHR()) {
OutputStream os =
 response.getOutputStream(application/json;charset=UTF-8);
os.write(({\script\:\window.location.replace(' +
 link.toAbsoluteURI() + ');\}).getBytes());
os.close();
} else {
response.sendRedirect(link);
 }


 2011/8/23 Kalle Korhonen kalle.o.korho...@gmail.com

  On Mon, Aug 22, 2011 at 4:42 PM, Howard Lewis Ship hls...@gmail.com
  wrote:
   Actually, perhaps Tapestry's client-side support should, by default,
   handle 302 correctly.
 
  Yes, perhaps so. But the correctness is in the eye of the beholder.
  It's clear that a 302 response to a non-ajax request always causes a
  redirect, but not necessarily so for an ajax request. If the default
  behavior was easily overridable then yes, why not. Perhaps I should
  just bring tapestry-exceptionpage functionality to the core.
 
  Kalle
 
 
   Currently, Tapestry's JSON response for partial page updates includes
   a special key for performing a redirect.
  
   On Mon, Aug 22, 2011 at 2:20 PM, Kalle Korhonen
   kalle.o.korho...@gmail.com wrote:
   On Mon, Aug 22, 2011 at 1:27 PM, Gunnar Eketrapp
   gunnar.eketr...@gmail.com wrote:
   I just rewrote my very old ProtectedPageGateKeeper that implemented
   Dispatcher with a new one
   inspired by Howard's blog
   http://tapestryjava.blogspot.com/search/label/security
   The new one implements ComponentRequestFilter and is better suited
 for
   protecting ajax enabled pages.
   So I thought ...
   Now to my problem:
   The redirect that takes place after an ajax call seems to disappear
  into
   thin air. I.e. the page displaying
   a rollling ajax loader is not redirected to my /noacess page. I have
 to
  hit
   a full page refresh for the redirect to work.
   Is there some trick needed in order to get the redirect to work for
 an
  ajax
   call.
   Sorry for asking stupid newbie questions ... of course I have missed
   something again!
  
   I don't think it's a stupid newbie question but obviously you cannot
   just send 302 uri as a response to an ajax request. If you want a full
   page refresh, you can handle it similarly how the tynamo-exceptionpage
   module (http://tynamo.org/tapestry-exceptionpage+guide) handles
   exceptions in ajax responses
   (
 
 http://svn.codehaus.org/tynamo/trunk/tapestry-exceptionpage/src/main/java/org/tynamo/exceptionpage/services/ConfigurableRequestExceptionHandler.java
  ).
   Or, take a look at T5.3's new ajax error handler, rendering an iframe
   on the fly in response to an ajax error.
  
   Kalle
  
  
   2011-08-22 21:54:53.243 [btpool0-11] DEBUG
  u.s.UtskicketModule.RequestLogger
   - Request: /group/members.grid.pager/1/grid (Method=POST,
   browser=Mozilla/5.0 (Windows NT 6.1; rv:5.0) Gecko/20100101
  Firefox/5.0,
   isXHR=true)
   2011-08-22 21:54:53.243 [btpool0-11] DEBUG
   u.services.ProtectedPageGateKeeper2 - Page path:
   /group/members.grid.pager/1/grid
  
   2011-08-22 22:01:06.500 [btpool0-10] DEBUG
  u.s.UtskicketModule.RequestLogger
   - Request: /group/members.grid.pager/7/grid (Method=POST,
   browser=Mozilla/5.0 (Windows NT 6.1; rv:5.0) Gecko/20100101
  Firefox/5.0,
   isXHR=true)
   2011-08-22 22:01:06.500 [btpool0-10] DEBUG
   u.services.ProtectedPageGateKeeper2 - Page path:
   /group/members.grid.pager/7/grid
   2011-08-22 22:01:06.500 [btpool0-10] DEBUG
  u.s.UtskicketModule.RequestLogger
   - Request: /noaccess (Method=GET, browser=Mozilla/5.0 (Windows NT
 6.1;
   rv:5.0) Gecko/20100101 Firefox/5.0, isXHR=false)
  
   Note: The return from the request above does not show up in the
 browser
  ...
  
   2011-08-22 22:01:56.956 [btpool0-10] DEBUG
  u.s.UtskicketModule.RequestLogger
   - Request: /group/members/3 (Method=GET, browser=Mozilla/5.0 (Windows
  NT
   6.1; rv:5.0) Gecko/20100101 Firefox/5.0, isXHR=false)
   2011-08-22 22:01:56.960 [btpool0-10] DEBUG
   u.services.ProtectedPageGateKeeper2 - Page path: /group/members/3
   2011-08-22 22:01:56.964 [btpool0-10] DEBUG
  u.s.UtskicketModule.RequestLogger
   - Request: /noaccess (Method=GET, 

Re: Problem with securing ajax enabled Tapestry pages with Annotations ...

2011-08-24 Thread Magnus Kvalheim
No sorry, that's not relevant for this. Eager to help, but I should
have paid more attention to detail :)

On Wed, Aug 24, 2011 at 8:33 AM, Magnus Kvalheim mag...@kvalheim.dk wrote:

 I sometimes use a proxy for doing redirects.

 *public class RedirectProxy {*
 * @Persist private String redirectURL;*
 * @Inject private ComponentResources _resources;*
 * Object onActivate(){*
 * try {*
 * URL url = new URL(redirectURL);*
 * return url;*
 * } catch (Exception e) {*
 * // TODO: handle exception*
 * } finally{*
 * _resources.discardPersistentFieldChanges(); *
 * }*
 * return Index.class;*
 * }*
 * public void setRedirectURL(String redirectURL) {*
 * this.redirectURL = redirectURL;*
 * }*
 *
 *
 * public String getRedirectURL() {*
 * return redirectURL;*
 * }*
 *}*

 Then from an eventhandler:
 *redirectProxy.setRedirectURL(u);*
 *return redirectProxy;*

 It could perhaps be useful for this case?

 --magnus

 On Tue, Aug 23, 2011 at 11:00 PM, Gunnar Eketrapp 
 gunnar.eketr...@gmail.com wrote:

 Hum .. this did not work so I guess I have to do something on the client
 side as well ...

   if (request.isXHR()) {
OutputStream os =
 response.getOutputStream(application/json;charset=UTF-8);
os.write(({\script\:\window.location.replace(' +
 link.toAbsoluteURI() + ');\}).getBytes());
os.close();
} else {
response.sendRedirect(link);
 }


 2011/8/23 Kalle Korhonen kalle.o.korho...@gmail.com

  On Mon, Aug 22, 2011 at 4:42 PM, Howard Lewis Ship hls...@gmail.com
  wrote:
   Actually, perhaps Tapestry's client-side support should, by default,
   handle 302 correctly.
 
  Yes, perhaps so. But the correctness is in the eye of the beholder.
  It's clear that a 302 response to a non-ajax request always causes a
  redirect, but not necessarily so for an ajax request. If the default
  behavior was easily overridable then yes, why not. Perhaps I should
  just bring tapestry-exceptionpage functionality to the core.
 
  Kalle
 
 
   Currently, Tapestry's JSON response for partial page updates includes
   a special key for performing a redirect.
  
   On Mon, Aug 22, 2011 at 2:20 PM, Kalle Korhonen
   kalle.o.korho...@gmail.com wrote:
   On Mon, Aug 22, 2011 at 1:27 PM, Gunnar Eketrapp
   gunnar.eketr...@gmail.com wrote:
   I just rewrote my very old ProtectedPageGateKeeper that implemented
   Dispatcher with a new one
   inspired by Howard's blog
   http://tapestryjava.blogspot.com/search/label/security
   The new one implements ComponentRequestFilter and is better suited
 for
   protecting ajax enabled pages.
   So I thought ...
   Now to my problem:
   The redirect that takes place after an ajax call seems to disappear
  into
   thin air. I.e. the page displaying
   a rollling ajax loader is not redirected to my /noacess page. I have
 to
  hit
   a full page refresh for the redirect to work.
   Is there some trick needed in order to get the redirect to work for
 an
  ajax
   call.
   Sorry for asking stupid newbie questions ... of course I have missed
   something again!
  
   I don't think it's a stupid newbie question but obviously you cannot
   just send 302 uri as a response to an ajax request. If you want a
 full
   page refresh, you can handle it similarly how the
 tynamo-exceptionpage
   module (http://tynamo.org/tapestry-exceptionpage+guide) handles
   exceptions in ajax responses
   (
 
 http://svn.codehaus.org/tynamo/trunk/tapestry-exceptionpage/src/main/java/org/tynamo/exceptionpage/services/ConfigurableRequestExceptionHandler.java
  ).
   Or, take a look at T5.3's new ajax error handler, rendering an iframe
   on the fly in response to an ajax error.
  
   Kalle
  
  
   2011-08-22 21:54:53.243 [btpool0-11] DEBUG
  u.s.UtskicketModule.RequestLogger
   - Request: /group/members.grid.pager/1/grid (Method=POST,
   browser=Mozilla/5.0 (Windows NT 6.1; rv:5.0) Gecko/20100101
  Firefox/5.0,
   isXHR=true)
   2011-08-22 21:54:53.243 [btpool0-11] DEBUG
   u.services.ProtectedPageGateKeeper2 - Page path:
   /group/members.grid.pager/1/grid
  
   2011-08-22 22:01:06.500 [btpool0-10] DEBUG
  u.s.UtskicketModule.RequestLogger
   - Request: /group/members.grid.pager/7/grid (Method=POST,
   browser=Mozilla/5.0 (Windows NT 6.1; rv:5.0) Gecko/20100101
  Firefox/5.0,
   isXHR=true)
   2011-08-22 22:01:06.500 [btpool0-10] DEBUG
   u.services.ProtectedPageGateKeeper2 - Page path:
   /group/members.grid.pager/7/grid
   2011-08-22 22:01:06.500 [btpool0-10] DEBUG
  u.s.UtskicketModule.RequestLogger
   - Request: /noaccess (Method=GET, browser=Mozilla/5.0 (Windows NT
 6.1;
   rv:5.0) Gecko/20100101 Firefox/5.0, isXHR=false)
  
   Note: The return from the request above does not show up in the
 browser
  ...
  
   2011-08-22 22:01:56.956 [btpool0-10] DEBUG
  u.s.UtskicketModule.RequestLogger
   - Request: /group/members/3 (Method=GET, browser=Mozilla/5.0
 (Windows
  NT
   6.1; rv:5.0) Gecko/20100101 Firefox/5.0, isXHR=false)
   2011-08-22 22:01

Re: First stab at CDI module for tapestry

2011-08-18 Thread Magnus Kvalheim
Great news!

Ok, so I've made some good progress again after getting involved in this
thread:
http://tapestry.1045711.n5.nabble.com/Supporting-EJB-annotation-in-Tapestry-classes-td4696836.html

So the problem was:
When contributing to MasterObjectProvider my CDIObjectprovider will resolve
any tapestry services which also qualifies as a cdi bean.
This is because the MasterObjectProvider will ask Objectlocator for a
service after all providers have been asked.

I have instead contributed an CDIInjectionProvider.
*public static void contributeInjectionProvider(*
* OrderedConfigurationInjectionProvider configuration,*
* @Local CDIFactory cdiFactory) {*
* configuration.add(CDI, new CDIInjectionProvider(cdiFactory),
after:*,before:Service);*
*}*

So attempts to find a cdi bean is no longer through the MasterObjectProvider
but directly by the InjectWorker (through the chain of command).

The conundrum is: I want to ask CDIInjectionProvider last,
but ServiceInjectionProvider will 'blow up' if it fails to resolve a
service/bean.
So what I've done for now is this 'hack':

*@Override*
*public boolean provideInjection(String fieldName, Class fieldType,*
* ObjectLocator locator, ClassTransformation transformation,*
* MutableComponentModel componentModel) {*
* *
* /***
* * Problem: in many cases a tapestry service will qualify as a cdi bean.*
* * In order to prevent cdi for managing a service that should be provided
by tapestry we check if locator has the service.*
* */*
* try {*
* if(locator.getService(fieldType)!=null)*
* return false;*
* } catch (RuntimeException e) { *
   //it blew up, which means there is a chance cdi can resolve it
* }*
* *
* TransformField field = transformation.getField(fieldName); *
* final Object injectionValue = cdiFactory.get(fieldType); *
* if(injectionValue!=null) {*
* field.inject(injectionValue);*
* return true;*
* }*
* return false;*
*}*

It checks to see if a service could be resolved and does nothing as it
should be handled by ServiceInjectionProvider which is next in chain.
It does the job. A bit hacky, but I cannot think of another way of doing it.

For Tapestry-CDI I've implemented two means of injection:
* using @inject (either tapestry's or jsr-330). This goes through the
Injectionprovider chain
* using @CDI - this is handled by own ComponentClassTransformWorker.

I'll host the code somewhere, perhaps github, in case others would be
interested in giving it a spin as well.

..and please let me know if you have any suggestion for a cleaner approach

--magnus

On Thu, Jun 9, 2011 at 10:10 AM, Magnus Kvalheim mag...@kvalheim.dk wrote:

 Thanks Howard, great to hear I'm on the right track :)

 I haven't given much thought to exposing tapestry services to cdi.
 It's not something we currently require for our projects, but if it's
 requested by others I could look into that as well!

 *Question*
 I have one issue related to the CDIObjectProvider though.
 While testing the quickstart (which uses the CDIModule) I created and
 registered a tapestry service - which accidentally also satisfies as a CDI
 managed bean.
 *From quickstart appmodule*
 *public static void bind(ServiceBinder binder){*
 * binder.bind(AnotherService.class).withId(AnotherSrv);*
 *}*

 As posted earlier the CDIProvider is contributed to the
 MasterObjectProvider as last (after:*)?
 *configuration.add(cdiProvider, cdiProvider, after:*);*

 AnotherService is injected into a component/page
 *@Inject private AnotherService another;*
 *
 *
 What I would want is the cdiprovider to be asked last - so that if Tapestry
 itself cannot provide the service it will eventually get delegated to CDI.
 In this case - tapestry should provide the service.
 However, the cdiprovider is asked to provide the bean. (This is why I've
 specifically test for scope now.)

 So the question is. *How can I make sure that the CDIProvider is asked
 last in chain?*
 Do I have to contribute to InjectionProvider as well?

 thanks in advance
 Magnus

 On Wed, Jun 8, 2011 at 6:47 PM, Howard Lewis Ship hls...@gmail.comwrote:

 Nope, it's designed to be easy ... though contributions into
 MasterObjectProvider are always tricky since you can get into
 dependency cycles very easily. You've properly side-stepped this using
 @InjectService (using the special @Local marker annotation is always
 very important).

 The hard part, which is still difficult with Spring, is proper
 co-dependence:  allowing Tapestry services to be injected into Spring
 beans as well as the reverse.  It comes down to a turf battle about
 which framework is in charge.

 On Wed, Jun 8, 2011 at 4:56 AM, Magnus Kvalheim mag...@kvalheim.dk
 wrote:
  Hi all,
 
  We're looking into moving our apps from a 'traditional' servlet
 container
  with spring into a Java EE web profile server like glassfish 3.1.
  Motivations for doing this is to utilize cdi(jsr 299, 330), ejb3 and
 more.
  Not just for the tapestry app, but also the other applications in
  our portfoleo which share common

Re: First stab at CDI module for tapestry

2011-08-18 Thread Magnus Kvalheim
Yes, I've noticed. Great work Igor :)

I've intentionally not done anything for tapestry-cdi in terms of supporting
javax.inject.@Inject.

As Tap @inject and javax @inject are interchangeable - cdi bean injection
with either @inject should 'just work' with tapestry-cdi and T5.3 :)

On Thu, Aug 18, 2011 at 12:56 PM, Igor Drobiazko
igor.drobia...@gmail.comwrote:

 Just as a side note: starting with T5.3 it's possible to use JSR 330 for
 injection.

 Check this out:
 http://tapestry.apache.org/using-jsr-330-standard-annotations.html

 On Wed, Jun 8, 2011 at 1:56 PM, Magnus Kvalheim mag...@kvalheim.dk
 wrote:

  Hi all,
 
  We're looking into moving our apps from a 'traditional' servlet container
  with spring into a Java EE web profile server like glassfish 3.1.
  Motivations for doing this is to utilize cdi(jsr 299, 330), ejb3 and
 more.
  Not just for the tapestry app, but also the other applications in
  our portfoleo which share common core business logic.
 
  For reference on previous discussions:
 
 
 http://tapestry.1045711.n5.nabble.com/Java-based-spring-configuration-td3394086.html
  http://tapestry.1045711.n5.nabble.com/Discussion-td2421783i20.html
 
  Now, I've tried running the tapestry quickstart app in glassfish 3.1
 (with
  the eclipse connector for publishing).
  This works ok - although I cannot make live class reloading work. :(
 
  Glassfish uses Weld, so the CDIModule is basically an objectprovider for
  injecting Weld managed beans.
  (As you probably know CDI/Weld can also be used outside jee as
 alternative
  to tapestry-ioc, spring, etc)
 
  *CDIModule class*
  *public class CDIModule { *
  * public static void bind(ServiceBinder binder) {*
  *binder.bind(ObjectProvider.class,
  CDIObjectProvider.class).withId(CDIObjectProvider);*
  *} *
  * public static BeanManager buildBeanManager(Logger log) { *
  * try {*
  * BeanManager beanManager = (BeanManager) new
  InitialContext().lookup(java:comp/BeanManager);*
  * return beanManager; *
  * } catch (NamingException e) {*
  * log.error(Could not lookup jndi resource: java:comp/BeanManager, e);*
  * }*
  * return null;*
  * } *
  * public static void contributeMasterObjectProvider(*
  * @InjectService(CDIObjectProvider) ObjectProvider cdiProvider,*
  * OrderedConfigurationObjectProvider configuration) { *
  *// configuration.add(cdiProvider, cdiProvider,
 
 
 after:Service,after:AnnotationBasedContributions,after:Alias,after:Autobuild);
  *
  * configuration.add(cdiProvider, cdiProvider, after:*); *
  * } *
  *}*
  *
  *
  The beanmanager is expected to be found in jndi. If the beans.xml is
  present
  it will be available at this point.
  The BeanManager is also exposed as a service and injectable for other
  services or components.
  I've tested by adding the *@SubModule(CDIModule.class) *to my quickstart
  appmodule.
  *
  *
  *CDIObjectProvider class*
  *public class CDIObjectProvider implements ObjectProvider { *
  * private BeanManager beanManager;*
  * private Logger log;*
  * *
  * @SuppressWarnings({ unchecked, rawtypes })*
  * private Set allowedScopes = CollectionFactory.newSet(*
  * ApplicationScoped.class,*
  * Singleton.class);*
  *
  *
  * public CDIObjectProvider(*
  * Logger log,*
  * @InjectService(BeanManager) BeanManager manager) {*
  * this.beanManager = manager;*
  * this.log = log;*
  * }*
  * @SuppressWarnings(unchecked)*
  * public T T provide(ClassT objectType,*
  * AnnotationProvider annotationProvider, ObjectLocator locator) {*
  * SetBean? beans =  beanManager.getBeans(objectType);*
  * if(beans!=null  beans.size()0) {*
  * BeanT bean = (BeanT) beans.iterator().next(); *
  * if(hasValidScope(bean)) {*
  * CreationalContextT ctx = beanManager.createCreationalContext(bean);*
  * T o = (T) beanManager.getReference(bean, objectType, ctx); *
  * log.info(Found and returning: +objectType.getCanonicalName());*
  * return o; *
  * }*
  * }*
  * return null;*
  * } *
  * protected T boolean hasValidScope(BeanT bean) {*
  * return bean!=null  allowedScopes.contains(bean.getScope());*
  * }*
  *}*
 
  I've limited the scope to singleton/applicationscoped. Perhaps also
 Default
  could be accepted though.
  Until now I've only tested this with pojo's and not ejb's - but for that
  it's working as expected.
  I can inject CDI beans into pages and components using*
   org.apache.tapestry5.ioc.annotations.Inject*
 
  I'm no expert to tapestry internals - so there could be
  other considerations that needs to be addressed.
  In fact in seemed just a little to easy to implement - so I must have
  missed
  something. - Or perhaps it's just that easy to do in Tapestry :)
 
  Thoughts, comments?
 



 --
 Best regards,

 Igor Drobiazko
 http://tapestry5.de



Re: Supporting @EJB annotation in Tapestry classes

2011-08-17 Thread Magnus Kvalheim
I'm are still very interested in moving from tomcat to a EE6 server like
glassfish in order to adopt standards and benefit from the new stuff.

Have not found time to actually replace spring with cdi in our apps.
There were also stuff we need to find a different solution for when moving
away from spring/tomcat to glassfish.

Like:
* how to do opensessioninview (OSIV) pattern with ejb's (were currently
using spring here as well): (this looks promising though
http://ocpsoft.com/java/spring-to-java-ee-a-migration-guide-cdi-jsf-jpa-jta-ejb/
)
* live reload with glassfish - not yet resolved
* some issues where debugging failed with glassfish/wtp plugin for eclipse
(possibly a jdk issue)

I have today revisited the CDIModule I used for integration test/research.

In order to address the 'issue' with Ordering of CDIProvider I attempted to
make a new annotation - @CDI.
The idea was that this would be used for injection instead of tapestry's
@inject.
I took - as you suggested - inspiration from @PersistenceContext in
tapestry-jpa.
This actually worked fine and is now injecting beans from cdi.

Then I revisited the CDIProvider and its ordered contribution
to MasterObjectProvider.
Turns out it is indeed last in chain
 - I have however no idea why it is asked to provide object for a defined
tapestry service though. *Is there something called after that is supposed
to resolve a service after all Objectproviders have been asked?*
If so - then how can I get CDIProvider to come after this?

It is possible to specify exclusions in beans.xml (weld has extensions), but
I'd rather have it's just working out of the box.


So what I have implemented is:
* CDIProvider contributed to MasterObjectProvider - allows for cdi managed
beans to be injected with tapestry's @Inject
* @CDI annotation which can be used as alternative to @Inject. (An @EJB
annotation would have similar implementation). Using this annotation will
also sidestep the Objectprovider conendrum.

I've tested beans with @ApplicationScoped and @RequestScoped and it works
great! Guess @ConversationScoped would work too  - have got to test that
next :)

Perhaps I should upload/host the CDIModule somewhere - seems like others can
benefit from it as well...

--magnus

On Wed, Aug 17, 2011 at 5:28 AM, Lenny Primak lpri...@hope.nyc.ny.uswrote:

 I just took a look at that post, but it leaves a lot of unanswered
 questions,
 actually more questions than answers.

 I know tapestry-jpa made @PersistenceContext work within Tapestry,
 which is similar.  I am going to look at that.
 Perhaps Igor can shed some light on this.

 Thanks again.

 On Aug 14, 2011, at 8:10 AM, Thiago H. de Paula Figueiredo wrote:

  On Sat, 13 Aug 2011 15:37:43 -0300, Lenny Primak lpri...@hope.nyc.ny.us
 wrote:
 
  Hi guys,
 
  Hi!
 
  I am developing a front-end in Tapestry for an EJB application (EJB
 3.1/JEE 6) Its getting really annoying to build Tapestry services for each
 of the EJBs. Do you have any suggestions on how to support @EJB annotation
 instead?
 
  Magnus did something this, but for CDI, and posted in this mailing list:
 http://tapestry.1045711.n5.nabble.com/First-stab-at-CDI-module-for-tapestry-td4469281.html.
 I haven't used CDI nor EJB, so I don't know if its solution can be used for
 EJB without any changes. Even if not, the approach would be very similar.
 
  --
  Thiago H. de Paula Figueiredo
  Independent Java, Apache Tapestry 5 and Hibernate consultant, developer,
 and instructor
  Owner, Ars Machina Tecnologia da Informação Ltda.
  http://www.arsmachina.com.br
 


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




Re: Supporting @EJB annotation in Tapestry classes

2011-08-17 Thread Magnus Kvalheim
Hi Lenny,


On Wed, Aug 17, 2011 at 5:41 PM, Lenny Primak lpri...@hope.nyc.ny.uswrote:

 Can you create a github project for cdimodule?  I would love to be a part
 of that.


I have not yet tried git - so this could be a good excuse for that :)
I'll look into that soon - would be cool to have other try and
possibly contribute as well!


 Regarding live class reloading, my solution to that was to use 'skinny' war
 files and put tapestry jars into domain/lib directory in glassfish. This
 makes redeploys Lightning fast and glassfish saves session state to boot.
 Not quite live reloading but it works well and also works for EJBs and web
 services that are within the app.


Great - I'll have to test that with my setup. Hopefully the turnaround will
be acceptable


 Do you think you can make an EJB annotation so I can test and contribute to
 your module easier?  I have no 'plain' CDI beans to teat with nor do I have
 beans.xml.


The code for CDI annotationworker is simple.

*public class CDIAnnotationWorker implements ComponentClassTransformWorker {
*
* private CDIFactory cdiFactory;*
* public CDIAnnotationWorker(CDIFactory cdiFactory) {*
* this.cdiFactory = cdiFactory;*
* }*
* public void transform(ClassTransformation transformation,*
* MutableComponentModel model) {*
* for(final TransformField field :
transformation.matchFieldsWithAnnotation(CDI.class)) {*
* final CDI annotation = field.getAnnotation(CDI.class);*
* String fieldType = field.getType();*
*Class type = transformation.toClass(fieldType);*
*final Object injectionValue = cdiFactory.get(type);*
**
*if(injectionValue!=null) {*
*field.inject(injectionValue);*
*field.claim(annotation);*
*}*
* } *
* }*
*}*
*
*
 I'm sure you can adapt to support EJB by getting needed info from
annotation values and do the context lookup.
Perhaps use class/interface type as default jndi name so you don't need to
specify annotation values?
If no values are needed for ejb annotation, then an objectprovider could be
contributed to masterobjectprovider as well and you could use standard
@inject

Without knowing details I think you could possibly reuse
the JNDIObjectLocator from jumpstart for worker and/or masterobjectprovider.
*
*
*From CDIModule configuration*
*...*
@Contribute(ComponentClassTransformWorker.class)
public static void
provideClassTransformWorkers(OrderedConfigurationComponentClassTransformWorker
configuration) {
 configuration.addInstance(CDI, CDIAnnotationWorker.class,
before:Property);
}

Hope that helps a bit. As I mentioned I'll try to get CDIModule up in github
soon...

--magnus


 Thanks!

 On Aug 17, 2011, at 11:08 AM, Magnus Kvalheim mag...@kvalheim.dk wrote:

  I'm are still very interested in moving from tomcat to a EE6 server like
  glassfish in order to adopt standards and benefit from the new stuff.
 
  Have not found time to actually replace spring with cdi in our apps.
  There were also stuff we need to find a different solution for when
 moving
  away from spring/tomcat to glassfish.
 
  Like:
  * how to do opensessioninview (OSIV) pattern with ejb's (were currently
  using spring here as well): (this looks promising though
 
 http://ocpsoft.com/java/spring-to-java-ee-a-migration-guide-cdi-jsf-jpa-jta-ejb/
  )
  * live reload with glassfish - not yet resolved
  * some issues where debugging failed with glassfish/wtp plugin for
 eclipse
  (possibly a jdk issue)
 
  I have today revisited the CDIModule I used for integration
 test/research.
 
  In order to address the 'issue' with Ordering of CDIProvider I attempted
 to
  make a new annotation - @CDI.
  The idea was that this would be used for injection instead of tapestry's
  @inject.
  I took - as you suggested - inspiration from @PersistenceContext in
  tapestry-jpa.
  This actually worked fine and is now injecting beans from cdi.
 
  Then I revisited the CDIProvider and its ordered contribution
  to MasterObjectProvider.
  Turns out it is indeed last in chain
  - I have however no idea why it is asked to provide object for a defined
  tapestry service though. *Is there something called after that is
 supposed
  to resolve a service after all Objectproviders have been asked?*
  If so - then how can I get CDIProvider to come after this?
 
  It is possible to specify exclusions in beans.xml (weld has extensions),
 but
  I'd rather have it's just working out of the box.
 
 
  So what I have implemented is:
  * CDIProvider contributed to MasterObjectProvider - allows for cdi
 managed
  beans to be injected with tapestry's @Inject
  * @CDI annotation which can be used as alternative to @Inject. (An @EJB
  annotation would have similar implementation). Using this annotation will
  also sidestep the Objectprovider conendrum.
 
  I've tested beans with @ApplicationScoped and @RequestScoped and it works
  great! Guess @ConversationScoped would work too  - have got to test that
  next :)
 
  Perhaps I should upload/host

Re: Supporting @EJB annotation in Tapestry classes

2011-08-17 Thread Magnus Kvalheim
On Wed, Aug 17, 2011 at 6:12 PM, Thiago H. de Paula Figueiredo 
thiag...@gmail.com wrote:

 On Wed, 17 Aug 2011 12:08:12 -0300, Magnus Kvalheim mag...@kvalheim.dk
 wrote:

 I'm are still very interested in moving from tomcat to a EE6 server like
 glassfish in order to adopt standards and benefit from the new stuff.


 Why not EJB 3.1's embedded mode? This way, you can run EJB like a package
 instead as a container. At least OpenEJB supports that.


Yes sure, if that's feasible. I was attracted to glassfish as it's battle
tested, with great features and tooling, but it's worth having a look at
other options like OpenEJB. Thanks I'll check it out :)


  In order to address the 'issue' with Ordering of CDIProvider I attempted
 to
 make a new annotation - @CDI.
 The idea was that this would be used for injection instead of tapestry's
 @inject.


 Why not javax.injection.@Inject from JSR 330? Tapestry already supports
 that: http://tapestry.apache.org/**using-jsr-330-standard-**
 annotations.htmlhttp://tapestry.apache.org/using-jsr-330-standard-annotations.html
  and http://blog.tapestry5.de/**index.php/2011/01/17/javax-**
 inject-inject-support-in-**tapestry/http://blog.tapestry5.de/index.php/2011/01/17/javax-inject-inject-support-in-tapestry/


Aren't those interchangeable so that it will work same as tapestry's
@inject? wouldn't that conflict with tapestry 5.3?
@CDI annotation is the alternative that don't go though the
masterobjectprovider for providing injection.



  - I have however no idea why it is asked to provide object for a defined
 tapestry service though. *Is there something called after that is supposed
 to resolve a service after all Objectproviders have been asked?*


 I'm not sure, but I guess that's exactly how Tapestry-IoC deals with
 ObjectProviders.


hmm.. so perhaps I need to do it some other way. I'll debug and look closer
to whats actually going on when resolving dependencies and see if I can find
a better solution.
Please let me know if anyone has suggestions :)


 --
 Thiago H. de Paula Figueiredo
 Independent Java, Apache Tapestry 5 and Hibernate consultant, developer,
 and instructor
 Owner, Ars Machina Tecnologia da Informação Ltda.
 http://www.arsmachina.com.br



On Wed, Aug 17, 2011 at 9:45 PM, Magnus Kvalheim mag...@kvalheim.dk wrote:

 Hi Lenny,


 On Wed, Aug 17, 2011 at 5:41 PM, Lenny Primak lpri...@hope.nyc.ny.uswrote:

 Can you create a github project for cdimodule?  I would love to be a part
 of that.


 I have not yet tried git - so this could be a good excuse for that :)
 I'll look into that soon - would be cool to have other try and
 possibly contribute as well!


 Regarding live class reloading, my solution to that was to use 'skinny'
 war files and put tapestry jars into domain/lib directory in glassfish. This
 makes redeploys Lightning fast and glassfish saves session state to boot.
 Not quite live reloading but it works well and also works for EJBs and web
 services that are within the app.


 Great - I'll have to test that with my setup. Hopefully the turnaround will
 be acceptable


 Do you think you can make an EJB annotation so I can test and contribute
 to your module easier?  I have no 'plain' CDI beans to teat with nor do I
 have beans.xml.


 The code for CDI annotationworker is simple.

 *public class CDIAnnotationWorker implements ComponentClassTransformWorker
 {*
 * private CDIFactory cdiFactory;*
 * public CDIAnnotationWorker(CDIFactory cdiFactory) {*
 * this.cdiFactory = cdiFactory;*
 * }*
 * public void transform(ClassTransformation transformation,*
 * MutableComponentModel model) {*
 * for(final TransformField field :
 transformation.matchFieldsWithAnnotation(CDI.class)) {*
 * final CDI annotation = field.getAnnotation(CDI.class);*
 * String fieldType = field.getType();*
 *Class type = transformation.toClass(fieldType);*
 *final Object injectionValue = cdiFactory.get(type);*
 **
 *if(injectionValue!=null) {*
 *field.inject(injectionValue);*
 *field.claim(annotation);*
 *}*
 * } *
 * }*
 *}*
 *
 *
  I'm sure you can adapt to support EJB by getting needed info from
 annotation values and do the context lookup.
 Perhaps use class/interface type as default jndi name so you don't need to
 specify annotation values?
 If no values are needed for ejb annotation, then an objectprovider could be
 contributed to masterobjectprovider as well and you could use standard
 @inject

 Without knowing details I think you could possibly reuse
 the JNDIObjectLocator from jumpstart for worker and/or masterobjectprovider.
 *
 *
 *From CDIModule configuration*
 *...*
 @Contribute(ComponentClassTransformWorker.class)
 public static void
 provideClassTransformWorkers(OrderedConfigurationComponentClassTransformWorker
 configuration) {
  configuration.addInstance(CDI, CDIAnnotationWorker.class,
 before:Property);
 }

 Hope that helps a bit. As I mentioned I'll try to get CDIModule up

Re: Last visited pages

2011-08-10 Thread Magnus Kvalheim
Hi, I did something related and looked
at org.apache.tapestry5.internal.transform.CachedWorker for inspiration.

Basically you need access to BindingSource.. (Just put in in
ComponentClassTransformWorker constructor)

--from CachedWorker--
Binding binding = bindingSource.newBinding(@Cached watch,
invocation.getComponentResources(),
BindingConstants.PROP, watch);
then call binding.get();

'watch' is what you get from annotation like in your case prop:summary or
prop:context

Hope this is of some help

cheers
Magnus

On Wed, Aug 10, 2011 at 8:56 AM, Dominik Hurnaus
dominik.hurn...@gmail.comwrote:

 Hello Joakim

 I am also working on Gerolds project. The difference is that we do not only
 need a static string (or message key) for a single page, but dynamic text
 depending on what entity is shown on the page.

 Consider the page BusinessPartnerDetail. Your breadcrumb-implementation
 would show businesspartner.page.title for each business partner I opened.
 What we need is different, we need to have Businesspartner Hans Huber,
 Businesspartner Joakim Olsson, ... (what Gerold described as 'summary')

 Unfortunately we don't see a way to get this data, since the Dispatcher is
 called before the page is initialzed (before the onActivate methods are
 called), and therefore we cannot access this information.

 Any idea on how to achieve that?

 Best regards,

 Dominik

 2011/8/10 Joakim Olsson joa...@unbound.se

  Hi,
 
  I don't really see the difference between my module
  tapestry-breadcrumbs and what you are looking for. What is missing
  from tapestry-breadcrumbs for you to use it? Maybe it can be added?
 
  Regards,
  Joakim
 
 
  On Wed, Aug 10, 2011 at 8:04 AM, Gerold Glaser gerold.gla...@gmail.com
  wrote:
   Dear Listeners!
  
   In our application we want to track the pages a user has visited and
  provide
   a last visited object widget in the application for faster access.
  
   Our idea was to provide an Annotation @LastVisitedPage on the page to
  mark
   the pages that should be included in the history (like it is done in
 the
   breadcrumb project of https://github.com/argoyle/tapestry-breadcrumbs/
 ).
  
   The text shown in the last visited object should be rendered by the
 page
  due
   to performance and translation purposes. The track should be written
  after
   the page is rendererd.
  
   @LastVisitedPage(summary=prop:summary, context=prop:context)
   public class PageA
   {
  private Bean bean;
  
   @Inject
   private Messages messages;
@Inject
   private Repository repository;
  
   void onActivate(Long id)
   {
   this.bean = repository.loadBean(id);
  }
public String getSummary()
   {
   return messages.get(translationfor.this.page) +   +
  bean.getSummary();
   }
  
   public Long getContext()
   {
   return bean.getId();
   }
   }
  
   Is the following solution possible and could you provide an example for
   processing the properties?
   I don't know how to access the props from the Annotation in the
  Dispatcher.
  
   Best regards,
   Gerold
  
 
  -
  To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org
  For additional commands, e-mail: users-h...@tapestry.apache.org
 
 


 --

 Freundliche Grüße / Best regards,

 Dominik Hurnaus

 *C *a t a l y s t s
 Software Engineer

 Mobil: +43 (650) 723 6 723
 dominik.hurn...@catalysts.cc
 www.catalysts.cc
 Ottensheimer Straße 27, A-4040 Linz

 *task**mind** **
 ... Aufgaben im Team erledigen**
 www.taskmind.net* http://www.taskmind.net/

 Catalysts GmbH, Firmensitz: 4232 Hagenberg, Firmenbuchnummer: FN 292140v
 beim Landesgericht Linz



Re: Last visited pages

2011-08-10 Thread Magnus Kvalheim
Dough... I missed the part with dispatcher! Thought it was a
regular ComponentClassTransformWorker. Sorry guys.

Not sure how to do that on top of my head... Will let you know if I think of
any

--magnus

On Wed, Aug 10, 2011 at 12:28 PM, Magnus Kvalheim mag...@kvalheim.dkwrote:

 Hi, I did something related and looked
 at org.apache.tapestry5.internal.transform.CachedWorker for inspiration.

 Basically you need access to BindingSource.. (Just put in in
 ComponentClassTransformWorker constructor)

 --from CachedWorker--
 Binding binding = bindingSource.newBinding(@Cached watch,
 invocation.getComponentResources(),
 BindingConstants.PROP, watch);
 then call binding.get();

 'watch' is what you get from annotation like in your case prop:summary
 or prop:context

 Hope this is of some help

 cheers
 Magnus

 On Wed, Aug 10, 2011 at 8:56 AM, Dominik Hurnaus 
 dominik.hurn...@gmail.com wrote:

 Hello Joakim

 I am also working on Gerolds project. The difference is that we do not
 only
 need a static string (or message key) for a single page, but dynamic text
 depending on what entity is shown on the page.

 Consider the page BusinessPartnerDetail. Your breadcrumb-implementation
 would show businesspartner.page.title for each business partner I
 opened.
 What we need is different, we need to have Businesspartner Hans Huber,
 Businesspartner Joakim Olsson, ... (what Gerold described as 'summary')

 Unfortunately we don't see a way to get this data, since the Dispatcher is
 called before the page is initialzed (before the onActivate methods are
 called), and therefore we cannot access this information.

 Any idea on how to achieve that?

 Best regards,

 Dominik

 2011/8/10 Joakim Olsson joa...@unbound.se

  Hi,
 
  I don't really see the difference between my module
  tapestry-breadcrumbs and what you are looking for. What is missing
  from tapestry-breadcrumbs for you to use it? Maybe it can be added?
 
  Regards,
  Joakim
 
 
  On Wed, Aug 10, 2011 at 8:04 AM, Gerold Glaser gerold.gla...@gmail.com
 
  wrote:
   Dear Listeners!
  
   In our application we want to track the pages a user has visited and
  provide
   a last visited object widget in the application for faster access.
  
   Our idea was to provide an Annotation @LastVisitedPage on the page to
  mark
   the pages that should be included in the history (like it is done in
 the
   breadcrumb project of
 https://github.com/argoyle/tapestry-breadcrumbs/).
  
   The text shown in the last visited object should be rendered by the
 page
  due
   to performance and translation purposes. The track should be written
  after
   the page is rendererd.
  
   @LastVisitedPage(summary=prop:summary, context=prop:context)
   public class PageA
   {
  private Bean bean;
  
   @Inject
   private Messages messages;
@Inject
   private Repository repository;
  
   void onActivate(Long id)
   {
   this.bean = repository.loadBean(id);
  }
public String getSummary()
   {
   return messages.get(translationfor.this.page) +   +
  bean.getSummary();
   }
  
   public Long getContext()
   {
   return bean.getId();
   }
   }
  
   Is the following solution possible and could you provide an example
 for
   processing the properties?
   I don't know how to access the props from the Annotation in the
  Dispatcher.
  
   Best regards,
   Gerold
  
 
  -
  To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org
  For additional commands, e-mail: users-h...@tapestry.apache.org
 
 


 --

 Freundliche Grüße / Best regards,

 Dominik Hurnaus

 *C *a t a l y s t s
 Software Engineer

 Mobil: +43 (650) 723 6 723
 dominik.hurn...@catalysts.cc
 www.catalysts.cc
 Ottensheimer Straße 27, A-4040 Linz

 *task**mind** **
 ... Aufgaben im Team erledigen**
 www.taskmind.net* http://www.taskmind.net/

 Catalysts GmbH, Firmensitz: 4232 Hagenberg, Firmenbuchnummer: FN 292140v
 beim Landesgericht Linz





Re: Tapestry 5.3.0 and JPA - Errors hot-deploying using Glassfish Netbeans

2011-07-13 Thread Magnus Kvalheim
Hi Lenny,
Which version of glassfish? And have you been successful in getting
tapestry's live class reload working there?

best regards
Magnus Kvalheim

On Tue, Jul 12, 2011 at 6:58 PM, Lenny Primak lpri...@hope.nyc.ny.uswrote:

 Thanks, Igor!  Change in Tapestry is not required.
 I was using Persistens.createEntityManagerFactory() from ousite EJB or
 tapestry IOC
 which is apparently a big no-no which isn't documented anywhere besides
 stackoverflow.com

 On Jul 12, 2011, at 9:50 AM, Igor Drobiazko wrote:

  What was your fix? Is a change in Tapestry required?
 
  On Tue, Jul 12, 2011 at 2:14 PM, Lenny Primak lpri...@hope.nyc.ny.us
 wrote:
 
  I finally figured out what the problem here is.
  I was 'leaking EntityManagerFactory objects.  They can only be used
 within
  SessionBeans or such,
  or be closed manually.

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




Re: First stab at CDI module for tapestry

2011-06-09 Thread Magnus Kvalheim
Thanks Howard, great to hear I'm on the right track :)

I haven't given much thought to exposing tapestry services to cdi.
It's not something we currently require for our projects, but if it's
requested by others I could look into that as well!

*Question*
I have one issue related to the CDIObjectProvider though.
While testing the quickstart (which uses the CDIModule) I created and
registered a tapestry service - which accidentally also satisfies as a CDI
managed bean.
*From quickstart appmodule*
*public static void bind(ServiceBinder binder){*
* binder.bind(AnotherService.class).withId(AnotherSrv);*
*}*

As posted earlier the CDIProvider is contributed to the MasterObjectProvider
as last (after:*)?
*configuration.add(cdiProvider, cdiProvider, after:*);*

AnotherService is injected into a component/page
*@Inject private AnotherService another;*
*
*
What I would want is the cdiprovider to be asked last - so that if Tapestry
itself cannot provide the service it will eventually get delegated to CDI.
In this case - tapestry should provide the service.
However, the cdiprovider is asked to provide the bean. (This is why I've
specifically test for scope now.)

So the question is. *How can I make sure that the CDIProvider is asked last
in chain?*
Do I have to contribute to InjectionProvider as well?

thanks in advance
Magnus

On Wed, Jun 8, 2011 at 6:47 PM, Howard Lewis Ship hls...@gmail.com wrote:

 Nope, it's designed to be easy ... though contributions into
 MasterObjectProvider are always tricky since you can get into
 dependency cycles very easily. You've properly side-stepped this using
 @InjectService (using the special @Local marker annotation is always
 very important).

 The hard part, which is still difficult with Spring, is proper
 co-dependence:  allowing Tapestry services to be injected into Spring
 beans as well as the reverse.  It comes down to a turf battle about
 which framework is in charge.

 On Wed, Jun 8, 2011 at 4:56 AM, Magnus Kvalheim mag...@kvalheim.dk
 wrote:
  Hi all,
 
  We're looking into moving our apps from a 'traditional' servlet container
  with spring into a Java EE web profile server like glassfish 3.1.
  Motivations for doing this is to utilize cdi(jsr 299, 330), ejb3 and
 more.
  Not just for the tapestry app, but also the other applications in
  our portfoleo which share common core business logic.
 
  For reference on previous discussions:
 
 http://tapestry.1045711.n5.nabble.com/Java-based-spring-configuration-td3394086.html
  http://tapestry.1045711.n5.nabble.com/Discussion-td2421783i20.html
 
  Now, I've tried running the tapestry quickstart app in glassfish 3.1
 (with
  the eclipse connector for publishing).
  This works ok - although I cannot make live class reloading work. :(
 
  Glassfish uses Weld, so the CDIModule is basically an objectprovider for
  injecting Weld managed beans.
  (As you probably know CDI/Weld can also be used outside jee as
 alternative
  to tapestry-ioc, spring, etc)
 
  *CDIModule class*
  *public class CDIModule { *
  * public static void bind(ServiceBinder binder) {*
  *binder.bind(ObjectProvider.class,
  CDIObjectProvider.class).withId(CDIObjectProvider);*
  *} *
  * public static BeanManager buildBeanManager(Logger log) { *
  * try {*
  * BeanManager beanManager = (BeanManager) new
  InitialContext().lookup(java:comp/BeanManager);*
  * return beanManager; *
  * } catch (NamingException e) {*
  * log.error(Could not lookup jndi resource: java:comp/BeanManager, e);*
  * }*
  * return null;*
  * } *
  * public static void contributeMasterObjectProvider(*
  * @InjectService(CDIObjectProvider) ObjectProvider cdiProvider,*
  * OrderedConfigurationObjectProvider configuration) { *
  *// configuration.add(cdiProvider, cdiProvider,
 
 after:Service,after:AnnotationBasedContributions,after:Alias,after:Autobuild);
  *
  * configuration.add(cdiProvider, cdiProvider, after:*); *
  * } *
  *}*
  *
  *
  The beanmanager is expected to be found in jndi. If the beans.xml is
 present
  it will be available at this point.
  The BeanManager is also exposed as a service and injectable for other
  services or components.
  I've tested by adding the *@SubModule(CDIModule.class) *to my quickstart
  appmodule.
  *
  *
  *CDIObjectProvider class*
  *public class CDIObjectProvider implements ObjectProvider { *
  * private BeanManager beanManager;*
  * private Logger log;*
  * *
  * @SuppressWarnings({ unchecked, rawtypes })*
  * private Set allowedScopes = CollectionFactory.newSet(*
  * ApplicationScoped.class,*
  * Singleton.class);*
  *
  *
  * public CDIObjectProvider(*
  * Logger log,*
  * @InjectService(BeanManager) BeanManager manager) {*
  * this.beanManager = manager;*
  * this.log = log;*
  * }*
  * @SuppressWarnings(unchecked)*
  * public T T provide(ClassT objectType,*
  * AnnotationProvider annotationProvider, ObjectLocator locator) {*
  * SetBean? beans =  beanManager.getBeans(objectType);*
  * if(beans!=null  beans.size()0

Glassfish 3.1 - and tapestry live class reload

2011-06-09 Thread Magnus Kvalheim
Hi all,

We're considering switching from a servlet container to a java EE 6 server.
I've installed glassfish 3.1 and am using eclipse helios with glassfish
plugin.

Glassfish has a reloading feature built in, but it actually reloads the app
whenever a class file change. Tapestry's live class reload would
obviously be much faster!
I've tried to make eclipse output compiled classes directly into the
exploded war on the server.
I've also tried to manually replace the class, but none of these approaches
work. Seems like it's using a 'cached' version even though a newer exist...

I've posted on the glassfish forum, and they seem to be willing to add a
feature to the eclipse plugin that allows class replacement without
redeploy. Great!!
http://www.java.net/forum/topic/glassfish/glassfish/class-replace-no-redeploy
However I don't know if this will fix the issue...

*Have anyone successfully got live class reloading working on glassfish?*
*
*
thanks
Magnus


First stab at CDI module for tapestry

2011-06-08 Thread Magnus Kvalheim
Hi all,

We're looking into moving our apps from a 'traditional' servlet container
with spring into a Java EE web profile server like glassfish 3.1.
Motivations for doing this is to utilize cdi(jsr 299, 330), ejb3 and more.
Not just for the tapestry app, but also the other applications in
our portfoleo which share common core business logic.

For reference on previous discussions:
http://tapestry.1045711.n5.nabble.com/Java-based-spring-configuration-td3394086.html
http://tapestry.1045711.n5.nabble.com/Discussion-td2421783i20.html

Now, I've tried running the tapestry quickstart app in glassfish 3.1 (with
the eclipse connector for publishing).
This works ok - although I cannot make live class reloading work. :(

Glassfish uses Weld, so the CDIModule is basically an objectprovider for
injecting Weld managed beans.
(As you probably know CDI/Weld can also be used outside jee as alternative
to tapestry-ioc, spring, etc)

*CDIModule class*
*public class CDIModule { *
* public static void bind(ServiceBinder binder) {*
*binder.bind(ObjectProvider.class,
CDIObjectProvider.class).withId(CDIObjectProvider);*
*} *
* public static BeanManager buildBeanManager(Logger log) { *
* try {*
* BeanManager beanManager = (BeanManager) new
InitialContext().lookup(java:comp/BeanManager);*
* return beanManager; *
* } catch (NamingException e) {*
* log.error(Could not lookup jndi resource: java:comp/BeanManager, e);*
* }*
* return null;*
* } *
* public static void contributeMasterObjectProvider(*
* @InjectService(CDIObjectProvider) ObjectProvider cdiProvider,*
* OrderedConfigurationObjectProvider configuration) { *
*// configuration.add(cdiProvider, cdiProvider,
after:Service,after:AnnotationBasedContributions,after:Alias,after:Autobuild);
*
* configuration.add(cdiProvider, cdiProvider, after:*); *
* } *
*}*
*
*
The beanmanager is expected to be found in jndi. If the beans.xml is present
it will be available at this point.
The BeanManager is also exposed as a service and injectable for other
services or components.
I've tested by adding the *@SubModule(CDIModule.class) *to my quickstart
appmodule.
*
*
*CDIObjectProvider class*
*public class CDIObjectProvider implements ObjectProvider { *
* private BeanManager beanManager;*
* private Logger log;*
* *
* @SuppressWarnings({ unchecked, rawtypes })*
* private Set allowedScopes = CollectionFactory.newSet(*
* ApplicationScoped.class,*
* Singleton.class);*
*
*
* public CDIObjectProvider(*
* Logger log,*
* @InjectService(BeanManager) BeanManager manager) {*
* this.beanManager = manager;*
* this.log = log;*
* }*
* @SuppressWarnings(unchecked)*
* public T T provide(ClassT objectType,*
* AnnotationProvider annotationProvider, ObjectLocator locator) {*
* SetBean? beans =  beanManager.getBeans(objectType);*
* if(beans!=null  beans.size()0) {*
* BeanT bean = (BeanT) beans.iterator().next(); *
* if(hasValidScope(bean)) {*
* CreationalContextT ctx = beanManager.createCreationalContext(bean);*
* T o = (T) beanManager.getReference(bean, objectType, ctx); *
* log.info(Found and returning: +objectType.getCanonicalName());*
* return o; *
* }*
* }*
* return null;*
* } *
* protected T boolean hasValidScope(BeanT bean) {*
* return bean!=null  allowedScopes.contains(bean.getScope());*
* }*
*}*

I've limited the scope to singleton/applicationscoped. Perhaps also Default
could be accepted though.
Until now I've only tested this with pojo's and not ejb's - but for that
it's working as expected.
I can inject CDI beans into pages and components using*
 org.apache.tapestry5.ioc.annotations.Inject*

I'm no expert to tapestry internals - so there could be
other considerations that needs to be addressed.
In fact in seemed just a little to easy to implement - so I must have missed
something. - Or perhaps it's just that easy to do in Tapestry :)

Thoughts, comments?


Re: Java based spring configuration

2011-05-05 Thread Magnus Kvalheim
Hi Thiago - thanks for your answer,
See comments below...

On Wed, May 4, 2011 at 6:06 PM, Thiago H. de Paula Figueiredo 
thiag...@gmail.com wrote:

 On Wed, 04 May 2011 12:51:05 -0300, Magnus Kvalheim mag...@kvalheim.dk
 wrote:


  How would I make that play with Tapestry?
 *=Server=*
 * Use a JEE 6 Web Profile compliant server (like Glassfish).
 * Does anyone have experience with development? Does Tapestry live reload
 work?


 Live reload of Tapestry classes (pages, components and mixins) would work.
 Live reload of services (beans) wouldn't.


Sounds good - have yet to try development from anything other than jetty..


  *=Injecting beans from CDI=*

 Following this path my beans and ejb's are now managed by CDI(Weld).
 How would I get access to these beans in Tapestry?


 You can hook other IoC containers (CDI, Spring, EJB, etc) into
 Tapestry-IoC, so you can use Tapestry's @Inject or JSR 330 @Inject normally
 and get these outside-provided beans as if they were T-IoC ones. JumpStart
 code does this for EJB and tapestry-spring for Spring, so you can take a
 look at them for insipiration.

 http://jumpstart.doublenegative.com.au/jumpstart/examples/state/ejb3


 http://svn.apache.org/viewvc/tapestry/tapestry5/branches/maint-5-2/tapestry-spring/src/main/java/org/apache/tapestry5/spring/TapestrySpringFilter.java?view=markup

 http://svn.apache.org/viewvc/tapestry/tapestry5/branches/maint-5-2/tapestry-spring/src/main/java/org/apache/tapestry5/internal/spring/SpringModuleDef.java?view=markup


Think an implementation similar to tapestry-spring would the better
alternative of the two.
And looking at BeanManager the implementation would not be as different than
from tapestry-spring.
http://docs.jboss.org/cdi/api/1.0/javax/enterprise/inject/spi/BeanManager.html

It's not completely clear to me what the difference is between an
ObjectProvider and ObjectCreator.
Tried debugging tapestry-spring and the cant' see the ObjectCreator is used
for SpringBeanServiceDef's at all.
Both implementations lookup beans in springs applicationcontext, but only
the ObjectProvider actually locates them.

What do tapestry do with the beans after the're provided - are they cached
? (they seem to be cached as the provider is not called again)

And what about scopes? Again tapestry-spring give default(singleton) scope
to all, but can't see getServiceScope is called while debugging.



  I've seen long discussions on the list about tapestry and jsr 299 and 330.
 Believe Igor has committed something for 330. Don't know if there are any
 plans for jsr 299 though (as portable extension?).


 I don't know of any plans, but I'd love to see it. I just don't try to do
 that myself due to lack of time . . . :(


Yes, have the same problem - but will try to give it a go once I get my head
around it. Not too familiar with tapestry internals though...

Weld is bundled with glassfish so the BeanManager should be available from
jndi by the time tapestry starts up and loads the tapestry-cdi module.
(In other environments it's possible to bootstrap manually - or use the weld
servlet listener, org.jboss.weld.environment.servlet.Listener)

Thoughts?


 --
 Thiago H. de Paula Figueiredo
 Independent Java, Apache Tapestry 5 and Hibernate consultant, developer,
 and instructor
 Owner, Ars Machina Tecnologia da Informação Ltda.
 http://www.arsmachina.com.br

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




Re: Java based spring configuration

2011-05-04 Thread Magnus Kvalheim
Hi Adam,

Sorry, for (very)late response. Got tied up with some other tasks and forgot
all about it...

It's not like I'm in love with Spring.
In fact at this point the main reason(s) I have for still using it is for
it's transaction management.
And as our apps run in a servlet container(tomcat) I've not really
considered ejb's as an alternative.

Your comment about ejb's got me interested and I started doing some
research.
Turns out JEE 6 Web Profile looks pretty interesting (with glassfish).

We mostly use spring for dependency injection and transaction management.
As an experiment I replaced all spring annotations with 'jee' ones.
* @Autowired-@Inject
* @Component-@Named
* @Transactional-@TransactionAttribute

Spring happily uses the annotations as long as the're on the classpath.

Then I refactored our spring java configuration to a separate module and did
all wiring from there. This is now a drop in module.
In a jee 6 server I would exclude the spring module and everything will be
wired up by CDI.

For me this is quite interesting and means I now have zero dependencies on
spring in our app modules.
All business code uses standard jee/jsr's, but spring is still used under
the hood.


I could stop here, but what if I wanted to take the final step and move to a
jee 6 compliant server.
How would I make that play with Tapestry?
*=Server=*
* Use a JEE 6 Web Profile compliant server (like Glassfish).
* Does anyone have experience with development? Does Tapestry live reload
work?

*=Injecting beans from CDI=*
Following this path my beans and ejb's are now managed by CDI(Weld).
How would I get access to these beans in Tapestry?

I've seen long discussions on the list about tapestry and jsr 299 and 330.
Believe Igor has committed something for 330. Don't know if there are any
plans for jsr 299 though (as portable extension?).


Sorry - this turned out quite lengthy, but to summarize:
How do you use tapestry in a jee server with cdi? (Or even just cdi)

cheers
Magnus

On Sat, Apr 2, 2011 at 3:44 PM, Adam Zimowski zimowsk...@gmail.com wrote:

  I need spring [...] for things like jpa support and transactions and
 other things ...

 I guess you're not an EJB fan :-) You don't need spring. In fact, our
 Ecom app runs on pure Tapestry+TapIOC (plus Apache commons lang) with
 EJB3 in the middle tier doing all the heavy lifting you're talking
 about (Transactions, Hibernate/JPA, Endeca, PeopleSoft, and much more)

 We used to heavily rely on Spring in the previous Struts-based version
 of our app, but since we've moved to Tapestry, we kissed Spring good
 bye and nobody misses it here :)

 Adam

 On Fri, Apr 1, 2011 at 5:35 PM, Magnus Kvalheim mag...@kvalheim.dk
 wrote:
  Hi thanks for your reply,
 
  Looking back on my original mail I now realize I've been unclear...
 
  To clarify: What I do want to achieve is to
  + Not rely on xml for configuration
  + Inject spring beans into tapestry
  (+) Injecting tapestry services into spring is desired
 
  Your suggestion would probably work, but it's not what I want as I's like
 to
  use the @Inject for spring beans.
  Sorry for the confusion...
 
 
  On another note...
 
  Tapestry IOC is much more desirable than spring in many ways.
  I need spring (at least I believe I do) for things like jpa support and
  transactions and other things, but the bootstrapping in tapestry of
 modules,
  contributions, decoration.++ is something I would like to get into 'core'
  and not just 'web'.
 
  Why is it that the tapestry module is only for web - can't it
  be re-factored/reconfigured so that it can be more closely integrated
 with
  spring applications...
 
  I'd love to fully embrace tapestry IOC for my core infrastructure, but
 cant
  see how I'd get the same functionality - especially in terms of
 transaction
  management (I'd like to hear from those who have made the transition, and
  how they did it).
  Is it's possible(I believe it is) to make an enhanced tapestry-spring
 module
  which is not only for web, but can integrate tighter with spring - I
 think
  it would be a great win.
  (Probably there is way to implement tapestry ioc contributions, advisors
  etc.. for spring beans as well...)
 
  I'd like to hear some feedback to check if I'm completely off base here -
 or
  if it's indeed a good idea...
  I know I'd rather configure spring from tapestry ioc if I could...
 
  Thoughts?
 
  cheers
  Magnus
 
 
  On Fri, Apr 1, 2011 at 5:13 PM, 3kkkdang cvcv2...@hotmail.com wrote:
 
  I will do this:
  extends TapestrFilter,  in its constructor use
 WebApplicationContextUtils
  to
  get spring context and set this context as ASO static property.  finally
 in
  tapestry page class, get spring context through ASO.
 
  never got chance to try this, it might work.  any comments?
 
  --
  View this message in context:
 
 http://tapestry.1045711.n5.nabble.com/Java-based-spring-configuration-tp3394086p4275778.html
  Sent from the Tapestry - User mailing list archive at Nabble.com

Re: Java based spring configuration

2011-04-01 Thread Magnus Kvalheim
Hi thanks for your reply,

Looking back on my original mail I now realize I've been unclear...

To clarify: What I do want to achieve is to
+ Not rely on xml for configuration
+ Inject spring beans into tapestry
(+) Injecting tapestry services into spring is desired

Your suggestion would probably work, but it's not what I want as I's like to
use the @Inject for spring beans.
Sorry for the confusion...


On another note...

Tapestry IOC is much more desirable than spring in many ways.
I need spring (at least I believe I do) for things like jpa support and
transactions and other things, but the bootstrapping in tapestry of modules,
contributions, decoration.++ is something I would like to get into 'core'
and not just 'web'.

Why is it that the tapestry module is only for web - can't it
be re-factored/reconfigured so that it can be more closely integrated with
spring applications...

I'd love to fully embrace tapestry IOC for my core infrastructure, but cant
see how I'd get the same functionality - especially in terms of transaction
management (I'd like to hear from those who have made the transition, and
how they did it).
Is it's possible(I believe it is) to make an enhanced tapestry-spring module
which is not only for web, but can integrate tighter with spring - I think
it would be a great win.
(Probably there is way to implement tapestry ioc contributions, advisors
etc.. for spring beans as well...)

I'd like to hear some feedback to check if I'm completely off base here - or
if it's indeed a good idea...
I know I'd rather configure spring from tapestry ioc if I could...

Thoughts?

cheers
Magnus


On Fri, Apr 1, 2011 at 5:13 PM, 3kkkdang cvcv2...@hotmail.com wrote:

 I will do this:
 extends TapestrFilter,  in its constructor use WebApplicationContextUtils
 to
 get spring context and set this context as ASO static property.  finally in
 tapestry page class, get spring context through ASO.

 never got chance to try this, it might work.  any comments?

 --
 View this message in context:
 http://tapestry.1045711.n5.nabble.com/Java-based-spring-configuration-tp3394086p4275778.html
 Sent from the Tapestry - User mailing list archive at Nabble.com.

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




Re: Integrating tynamo tapestry-security (apache shiro)

2011-03-07 Thread Magnus Kvalheim
Hi Kalle - thanks for reply,

I've created an issue for #1

http://jira.codehaus.org/browse/TYNAMO-87

http://jira.codehaus.org/browse/TYNAMO-87--magnus

On Fri, Mar 4, 2011 at 6:23 PM, Kalle Korhonen
kalle.o.korho...@gmail.comwrote:

 On Fri, Mar 4, 2011 at 1:49 AM, Magnus Kvalheim mag...@kvalheim.dk
 wrote:
  This post is mostly related to tapestry-security, but I hope it's ok to
 post
  here in tapestry mailing list (now that Kalle is a committer and all.. :)
 )
  So I finally decided to implement tapestry-security. Had a few bumps in
 the
  road, as I will come back to, but all in all I must say it's been a
  pleasure.

 Thanks for the extensive usage report Magnus! I've used
 tapestry-security in so many projects now that I now it works well but
 that said, I do want it to cover *all* security use cases.

  1. Make tapestry-security localization aware
  When specifying urls for AccessControlFilters, either in shiro.ini or
 while
  setting applicationDefaults tapestry-security does not seem to honor
  localization.
  So if I'm in accessing though /en paths - then I'm redirected to a /  and
  loose the localization info.
  I have not been able to solve this yet.

 Please open a (Tynamo) issue for it and I get to it.

  2. shiro.ini or module configuration - I'm confused
  The tapestry-security documentation say you can configure shiro in either
  shiro.ini or in module.
  I might be wrong here, but it seems that from module you can only
 configure
  redirect urls, and FilterChainDefinitions
  through contributeSecurityRequestFilter.

 You are right, currently shiro.ini is needed for configuring that. I
 had made a separate jsecurity integration myself and the functionality
 is available in tapestry-security 0.1.0, but that part is yet to
 merged into current tapestry-security codebase (which is the result of
 work from multiple contributors). I think I had even an issue opened
 for it.. yes this is related:
 http://jira.codehaus.org/browse/TYNAMO-76 (there's more, but I spare
 you from the details).

  3. Problems doing logout from tapestry
  (I've just found a different post regarding this with subject: Error
 after
  logout)
  I found that when shiro is doing logout it invalidates the session in the
  end.

 You can log out alright, but you just get the ugly stack traces if
 Tapestry doesn't know about it before hand. Howard by the way fixed
 that already in T5.3. What you ended up doing is exactly how I've done
 it in numerous samples we have for tapestry-security. As always, the
 documentation could be improved...

 Kalle

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




Integrating tynamo tapestry-security (apache shiro)

2011-03-04 Thread Magnus Kvalheim
 = request.getSession(false);*
* if(session!=null  !session.isInvalidated())*
* session.invalidate(); *
* } catch (IllegalStateException e) {*
* // could happen here if session was already invalidated outside of
tapestry *
* } *
* return Index.class;*
*}*
*
*
Thank you so much for making the tapestry-security module. For our use cases
and applications I think it's a perfect match.
From my experience it seems to be very stable and reliable.

Thanks in advance
Magnus Kvalheim


Java based spring configuration

2011-02-21 Thread Bård Magnus Kvalheim
Hi all,

Versions
Tapestry: 5.2.4
Spring: 3.1.0.M1

We're using java based container configuration with spring - so no xml files
are used for configuring beanfactories.

With tapestry-spring this is currently unsupported as
TapestryApplicationContext extends from XmlWebApplicationContext.

As a workaround I've tried setting the tapestry.use-external-spring-context
(Compatibility mode). I then get runtime exceptions due to service naming
conflicts.
Service id 'environment' has already been defined... Believe this is an
internal spring bean introduced in 3.1.0.M1.
Anyways - I don't really need the compatibility mode where spring beans are
exposed as services.

I know it's possible to have an applicationcontext.xml that defines a single
bean entry - which is annotated with @Configuration. But the mission was to
get rid of all xml configurations to begin with.

Any plans for tapestry-spring to
support AnnotationConfigWebApplicationContext?
Or perhaps - use the Compatibility mode with the (new) option of turning off
exposure of spring beans as tapestry services.

Any suggestions?

thanks
Magnus


Re: T5 : Zone / Tapestry.windowUnloaded / Download link

2011-02-17 Thread Magnus Kvalheim
Yes, we've experienced same problem and resorted to use target=_blank as
we didn't have the time to come up with something more creative.

A better solution would be welcomed though :)

On Thu, Feb 17, 2011 at 3:05 PM, Richard Kolísek
richard.koli...@gmail.comwrote:


 same problem here
 --
 View this message in context:
 http://tapestry.1045711.n5.nabble.com/T5-Zone-Tapestry-windowUnloaded-Download-link-tp2436863p3389487.html
 Sent from the Tapestry - User mailing list archive at Nabble.com.

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




Re: tapestry 5.2

2010-07-22 Thread Magnus Kvalheim
I'm using 5.1.0.5 with Spring 3 (in production).

The key thing is the TapestyBeanFactory which was incompatible with spring
3.

If I remember correctly - the steps I did was:
1. copy 5.2 version of beanfactory:
http://svn.apache.org/viewvc/tapestry/tapestry5/trunk/tapestry-spring/src/main/java/org/apache/tapestry5/internal/spring/TapestryBeanFactory.java?view=log

2. Rename to TapestyBeanFactory(misspelled in 5.1.0.5,
http://svn.apache.org/viewvc/tapestry/tapestry5/tags/releases/5.1.0.5/tapestry-spring/src/main/java/org/apache/tapestry5/internal/spring/TapestyBeanFactory.java?view=log
)

3. put in own project - remember to keep in package
org.apache.tapestry5.internal.spring

And that should be it!

I've been running this in production since *3.0.0.RELEASE *of spring.

best
Magnus

2010/7/22 Sha Aith shashank.aith...@nuware.com


 Thanks for the update. I'm using tapestry 5.0.18 and experiencing a lot of
 performance issues. I thought of upgrading to 5.1.0.5 but dont want to do
 it
 now because there are some bugs in 5.1.0.5. We also have plans to move to
 Spring 3.0. I saw that 5.1 is not compatible with Spring 3. So, I'm eagerly
 waiting for the Tapestry 5.2. I'm hoping to see a stable version of 5.2
 sometime in mid August




 Igor Drobiazko wrote:
 
  The aim is to release 5.2 before JavaOne which is in September.
 
  On Wed, Jul 21, 2010 at 9:19 AM, Sha Aith
  shashank.aith...@nuware.comwrote:
 
 
  When will a stable version of Tapestry 5.2 be released?
  --
  View this message in context:
  http://old.nabble.com/tapestry-5.2-tp29222616p29222616.html
  Sent from the Tapestry - User mailing list archive at Nabble.com.
 
 
  -
  To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org
  For additional commands, e-mail: users-h...@tapestry.apache.org
 
 
 
 
  --
  Best regards,
 
  Igor Drobiazko
  http://tapestry5.de
 
 

 --
 View this message in context:
 http://old.nabble.com/tapestry-5.2-tp29222616p29233759.html
 Sent from the Tapestry - User mailing list archive at Nabble.com.


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




Re: tapestry 5.2

2010-07-22 Thread Magnus Kvalheim
No, tested in tomcat and jetty 6.
Plain old war packaged webapp...

2010/7/22 Sha Aith shashank.aith...@nuware.com


 Thanks for the update. But I'm using Spring DM server in an OSGi
 environment.
 Are you using the same?


 Magnus Kvalheim-3 wrote:
 
  I'm using 5.1.0.5 with Spring 3 (in production).
 
  The key thing is the TapestyBeanFactory which was incompatible with
 spring
  3.
 
  If I remember correctly - the steps I did was:
  1. copy 5.2 version of beanfactory:
 
 http://svn.apache.org/viewvc/tapestry/tapestry5/trunk/tapestry-spring/src/main/java/org/apache/tapestry5/internal/spring/TapestryBeanFactory.java?view=log
 
  2. Rename to TapestyBeanFactory(misspelled in 5.1.0.5,
 
 http://svn.apache.org/viewvc/tapestry/tapestry5/tags/releases/5.1.0.5/tapestry-spring/src/main/java/org/apache/tapestry5/internal/spring/TapestyBeanFactory.java?view=log
  )
 
  3. put in own project - remember to keep in package
  org.apache.tapestry5.internal.spring
 
  And that should be it!
 
  I've been running this in production since *3.0.0.RELEASE *of spring.
 
  best
  Magnus
 
  2010/7/22 Sha Aith shashank.aith...@nuware.com
 
 
  Thanks for the update. I'm using tapestry 5.0.18 and experiencing a lot
  of
  performance issues. I thought of upgrading to 5.1.0.5 but dont want to
 do
  it
  now because there are some bugs in 5.1.0.5. We also have plans to move
 to
  Spring 3.0. I saw that 5.1 is not compatible with Spring 3. So, I'm
  eagerly
  waiting for the Tapestry 5.2. I'm hoping to see a stable version of 5.2
  sometime in mid August
 
 
 
 
  Igor Drobiazko wrote:
  
   The aim is to release 5.2 before JavaOne which is in September.
  
   On Wed, Jul 21, 2010 at 9:19 AM, Sha Aith
   shashank.aith...@nuware.comwrote:
  
  
   When will a stable version of Tapestry 5.2 be released?
   --
   View this message in context:
   http://old.nabble.com/tapestry-5.2-tp29222616p29222616.html
   Sent from the Tapestry - User mailing list archive at Nabble.com.
  
  
   -
   To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org
   For additional commands, e-mail: users-h...@tapestry.apache.org
  
  
  
  
   --
   Best regards,
  
   Igor Drobiazko
   http://tapestry5.de
  
  
 
  --
  View this message in context:
  http://old.nabble.com/tapestry-5.2-tp29222616p29233759.html
  Sent from the Tapestry - User mailing list archive at Nabble.com.
 
 
  -
  To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org
  For additional commands, e-mail: users-h...@tapestry.apache.org
 
 
 
 

 --
 View this message in context:
 http://old.nabble.com/tapestry-5.2-tp29222616p29234362.html
 Sent from the Tapestry - User mailing list archive at Nabble.com.


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




Re: Layout Component

2010-06-30 Thread Magnus Kvalheim
Ok, guess this would work in Gerry's case - although it feels like a bit of
a hack.

In my case this wont work as I have a single application and would like to
do the layout/branding in runtime - switching based on domain names.


2010/6/28 Pierce Wetter pie...@paceap.com


 On Jun 25, 2010, at 1:31 PM, Magnus Kvalheim wrote:

  Hi,
  I have a similar requirement for our project where we plan to 'white
 label'
  an application and brand it in different ways.
  Have been thinking about a way of reusing pages by changing the layout
  dynamically - for example triggered by domain names, but we haven't
 started
  attempting to implement anything yet.
 
  Howard posted some exiting news about 'Tapx Dynamic' which might be of
 help
  in this area.
 
 http://tapestryjava.blogspot.com/2010/05/tapestry-happenings-52-beta-soon-new.html
 
  Other than that I'm very interested to hear if anyone else have
 interesting
  input to your problem...

   I'm essentially doing this, see the thread about Complex Question about
 Templates and Inheritance.

  There's a Layout.tml in the library, but then each app ends up
 overriding it with its own class, and the ComponentClassResolver knows to
 look first locally, then in the library for pace/Layout.

  Works great, and its basically inheritance. So you can white label your
 app into a library, then use an app project for branding.

  Pierce


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




Re: Layout Component

2010-06-25 Thread Magnus Kvalheim
Hi,
I have a similar requirement for our project where we plan to 'white label'
an application and brand it in different ways.
Have been thinking about a way of reusing pages by changing the layout
dynamically - for example triggered by domain names, but we haven't started
attempting to implement anything yet.

Howard posted some exiting news about 'Tapx Dynamic' which might be of help
in this area.
http://tapestryjava.blogspot.com/2010/05/tapestry-happenings-52-beta-soon-new.html

Other than that I'm very interested to hear if anyone else have interesting
input to your problem...

magnus

2010/6/24 tux4ever geri-gla...@gmx.net


 Dear listeners!

 I have a module with pages and components which is used by some other
 applications. Every application has its own style, defined in a layout
 component. Is there a possibility that this module can use the layout
 component of every other application at runtime?

 For better understanding see the example below:
 In the module I have following page definition:
 Module.tml
 div t:id=layout
 xmlns:t=http://tapestry.apache.org/schema/tapestry_5_1_0.xsd;
   Body Content/
 /div

 Module.java
 public class Module{
  @Component
  private Layout layout;
  ...
 }

 Layout.tml
 html xmlns=http://www.w3.org/1999/xhtml;
 xmlns:t=http://tapestry.apache.org/schema/tapestry_5_1_0.xsd;
div header.../div
body
t:body /
/body
 /html

 Now this module is used by different applications.
 Application 1 defines its own layout component and application 2 defines
 another layout component.

 Is there a way to override the LayoutComponent of the Module at runtime
 (delegate comes in my mind...), allthough the Module has no dependency on
 the other applications, but the other applications include the Module as a
 maven dependency.

 Best regards,
 Gerry
 --
 View this message in context:
 http://old.nabble.com/Layout-Component-tp28983922p28983922.html
 Sent from the Tapestry - User mailing list archive at Nabble.com.


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




Re: What websites are using Tapestry 5?

2010-02-17 Thread Bård Magnus Kvalheim
Hi,
We're recently soft-launced Movellas - http://movellas.com

Movellas is a place for young authors to write, publish and read mobile
novels(movellas).

Components
We have mainly built composite components, but some of our own;
* Image component to generate src for db images
* String related for template like: nl2br, capitalize,abbreviate ...
* url assets

Development enviroment
Eclipse, maven, jetty

Spring, JPA, hibernate. Pretty easy integration although we are currently
using programmatic transactions and facades for 'db' operations in tapestry.
Will probably test tynamo tapestry-jpa module soon.

Javascript libraries
We're using a few and have written 'adapter components' for them. Not too
difficult I would say.

The learning curve was a bit steep in the beginning. I still find the
configuration, filters, dispatchers etc. a bit hard to grasp, some more
introductionary documentation and examples could go a long way.

During development I never felt I had to make compromises. I could usually
find help in documentation or forum (did a fair bit of google searching as
well).

All in all I found it to a really productive framework once I got the hang
of it - and the class reloading is a timesaver for development.

Best
Magnus

2010/2/17 Robin Komiwes odiss...@gmail.com

 By the way, this could also helps you:
 http://wiki.apache.org/tapestry/PoweredByTapestry

 On Wed, Feb 17, 2010 at 8:39 AM, martijn.list martijn.l...@gmail.com
 wrote:

  Michael Martineau wrote:
 
  I'm trying to find a list of websites that use Tapestry 5.  I would like
  to take a look at them and see what sort of things they are able to do
 using
  Tapestry.  If any of you have a public website that is built on Tapestry
 5,
  please send me a link.
 
 
  I known Lithium uses T5 for their forum software
 
  http://www.lithium.com/
 
  Lithium is used by large companies like:
 
  RIM:
 http://supportforums.blackberry.com/t5/Java-Development/bd-p/java_dev
  )
 
  Lenovo: http://forums.lenovo.com/t5/
 
  HP: http://h30434.www3.hp.com/t5/Welcome-to-the-Forum/ct-p/about
 
 
  Martijn
 
 
 
  -
  To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org
  For additional commands, e-mail: users-h...@tapestry.apache.org
 
 



Re: Render block for Ajax component

2009-12-10 Thread Magnus Kvalheim
Ok, this is what I have so far:
1. Component that generates eventlink and adds javascript for ajax request.
2. Once ajax is invoked it will call the event method on parent
component(page)
3. Event method returns block and the result is shown in modal/tooltip

What's shown in the client is the json response.
{content:h1Hello world\/h1}

The javascript library is obfuscated so I can't easily modify it :(

How can I return only the partial markup to client?

Any ideas?

2009/12/10 Magnus Kvalheim mag...@kvalheim.dk

 Hi all,

 I'm trying to integrate thirdparty ajax libraries with Tapestry (5.1.0.5).
 These libraries uses Ajax.Request for getting content.
 Instead of getting a (whole) page, I'm trying to call an actionlink and
 return a block defined in the template.

 Many ajax libraries for showing a modal or tooltip uses the notation:
 new Tip(element, {
 ajax: {
   url: '/page.htm'
 }
 });

 My question is: Is it possible to 'render' the block in the onAction method
 and return that? Perhaps as StreamResponse instead of returning block
 itself(JSON hash)?


 Thanks
 Magnus



Re: Date Field Component - Disable

2009-11-20 Thread Bård Magnus Kvalheim
A simple solution with javascript.

So if having the component:
t:datefield t:id=date/

you could make it readonly

 script type=text/javascript
$('date').readOnly=true;
 /script

 With tapx ---

The standard datefield component don't seem to work when disabled, but the
tapx one does (FF 3.5  Opera 10).

namespace
(xmlns:x=tapestry-library:tapx)

x:datefield t:id=date/

you could make it disabled

 script type=text/javascript
$('date').disabled=true;
 /script

Regards
Magnus

2009/11/19 sandeepraj singh sandeepraj.si...@atosorigin.com


 Hi,
 A weird requirement may be,

 I want to use Date Field Component and the ability to disable the text
 field
 associated with it only. The intention is to match the existing date
 component in one of older technologies we worked on. While migrating to
 Tapestry5 we want that by clicking the Calender icon a date is selected but
 after that no one should be allowed to tinker with it and hence we want to
 disable the text box associated with it.

 Do you think that for such a requirement, creating my own component is a
 better bet?

 Thanks
 Sandeep
 --
 View this message in context:
 http://old.nabble.com/Date-Field-Component---Disable-tp26421251p26421251.html
 Sent from the Tapestry - User mailing list archive at Nabble.com.


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