I'm back!

2020-04-26 Thread Kalle Korhonen
Hi all,

just wanted to say hello as I'm back working on Tapestry & Tynamo, at least
for a fleeting moment! It all started when I was brought to steward an
unruly, JSP-based(!) codebase that used Spring ACL as its security
framework. With a few tens of thousand of data rows and a complex security
rules, the ACL join tables were starting to push several millions of rows,
all handled post data query and it was starting to show. So, I figured I'll
dig up some old code (http://www.tynamo.org/tapestry-security-jpa+guide/)
to show how this could be rewritten properly, and the next thing I know,
I've been writing a whole next generation proof-of-concept application in
Tapestry :)

While we are still in Java land, there's a lot to like about Tapestry,
obviously with it's code auto reloading and the sane approach to dependency
injection, but also pseudo nested transactions (the whole transaction
handling is so much more sensible than in Spring) and simple JAX-RS
integration. On that note, one of the new modules I published was a swagger
integration for tapestry-resteasy. Overall, this weekend saw releases of no
less than seven Tynamo modules, all updated to work with Tapestry 5.5:
tapestry-conversations 0.3.0
tapestry-jpa-seedentity 0.2.0
tapestry-security 0.8.0
tapestry-security-jpa 0.2.0
tapestry-resteasy 0.6.0
tapestry-resteasy-swagger 0.0.2
tynamo-test 0.2.1

You may check out the updated documentation at http://www.tynamo.org/ as
always. I'll post a few announcements as time allows.

Kalle


Re: Single Page Application

2018-07-02 Thread Kalle Korhonen
I've done SPAs with Tapestry but more recently, I've gone over the "dark
side" to develop SPAs with Clojure. I re-implemented one Tapestry+Ember
project as a functionally equivalent Clojure app, and I just posted
lines-of-code comparison plus other notes about it (
http://www.tynamo.org/2018/07/02/arbitrarily-complex-uis/). In short, while
you can implement SPAs with Tapestry, there are more productive options
just for that purpose.

Kalle

On Tue, Jun 5, 2018 at 10:27 AM, Juan  wrote:

> Gracias Carlos.
>
>
>
> El mar., 5 jun. 2018 18:47, Carlos Montero Canabal <
> carlosmonterocana...@gmail.com> escribió:
>
> > Hi Tapestry users,
> >
> > I have just upload a very simple example (but it works perfectly) of a
> SPA:
> > http://tapestry5.dev-util.com/specialpages/spa where we have a Route
> Page
> > (Index) and separate pages, each one with his internal code/tml.
> >
> > I'm thinking on upload the source code of my personal website but I think
> > it worse... I only upload the code necessary to start and understand the
> > way to do it.
> >
> > I hope my example helps you
> >
> > Regards
> >
> > Carlos Montero Canabal
> >
> > 2018-06-05 1:12 GMT+02:00 Bob Harner :
> >
> > > Carlos, it'll be great to see that SPA example on your dev-util site.
> > > Looking forward to it!
> > >
> > > On Mon, Jun 4, 2018, 5:05 AM Carlos Montero Canabal <
> > > carlosmonterocana...@gmail.com> wrote:
> > >
> > > > Some years ago I develop mi personal website (
> > > http://dev.carlosmontero.es
> > > > ) as a SPA with tapestry using the
> zones
> > > > system (you can try navigate and check on Network dev tools the
> > requests
> > > > and responses). I have to say that for a small project, It´s not so
> > > > difficult to implement, but for medium-big projects, I think that
> > > tapestry
> > > > isn´t the best approach for it. If I have some free time this week I
> > hope
> > > > to upload a simple example to http://tapestry5.dev-util.com/ <
> > > > http://tapestry5.dev-util.com/>
> > > >
> > > > Regards
> > > >
> > > > Carlos Montero
> > > >
> > > >
> > > > > El 3/6/2018, a las 9:07, peter.sk...@ooom.at escribió:
> > > > >
> > > > > Hi Juan,
> > > > >
> > > > > unfortunatelly I do not have a self-contained example of this
> > approach
> > > > that I could
> > > > > provide you now. Here:
> > > > >
> > > > >
> > > > http://apache-tapestry-mailing-list-archives.1045711.
> > > n5.nabble.com/In-which-direction-is-Tapestry-heading-
> > > td5733862.html#a5733882
> > > > >
> > > > > I posted some JS code which demonstrates, how you can use
> > > > tapestry-generated html zone
> > > > > content directly, without the dependency on html forms.
> > > > > At the same time, values, put in the JSON response object on the
> > server
> > > > side, are
> > > > > available in the client response object, which you can use further
> to
> > > > customize the
> > > > > behavior. As Thiago remarked, you can use as many zones, as you
> need.
> > > Yo
> > > > can use them
> > > > > as a kind of templating, most of them leaving invisible in the
> > > beginning
> > > > and switching
> > > > > them on, depending on the site context.
> > > > >
> > > > > The advantage is the power of the component composition of tapestry
> > an
> > > > its transparence.
> > > > > Otherwise you would need much more complex ecosystem to reach such
> a
> > > > expressiveness.
> > > > >
> > > > > If you decide to try to use the approach and remain stuck with some
> > > > problem, just let
> > > > > me know, I shall support you, as far as possible.
> > > > >
> > > > > With regards, Peter
> > > > >
> > > > >> Hi Peter,
> > > > >>
> > > > >> do you have any open source example? or maybe if you cannot show
> any
> > > > code,
> > > > >> a link to an explanation, or guidelines, or descrption of how you
> do
> > > it?
> > > > >>
> > > > >> Thank you.
> > > > >>
> > > > >> El mié., 30 may. 2018 18:58,  escribió:
> > > > >>
> > > > >>> Hi,
> > > > >>>
> > > > >>> I have been experimenting with the combination tapestry + angular
> > > (1.x)
> > > > >>> few years ago,
> > > > >>> then used angular in two commercial projects.
> > > > >>> After this experience I believe, that it is, at least from my
> point
> > > of
> > > > >>> view, more
> > > > >>> efficient to use AMD (requireJS) and tapestry components in a way
> > > that
> > > > I
> > > > >>> have shortly
> > > > >>> described in February this year in an reaction to a question in
> > this
> > > > >>> mailink list.
> > > > >>> Nicely structured apps can be built in this way, which are very
> > > dynamic
> > > > >>> and responsive
> > > > >>> as well.
> > > > >>>
> > > > >>> regards, Peter
> > > > >>>
> > > >  Hi Jay,
> > > > 
> > > >  Which easier ways are you envisioning?
> > > > 
> > > >  Thanks,
> > > > 
> > > >  mrg
> > > > 
> > > > 
> > > >  On Tue, May 29, 2018 at 8:56 PM Jay Ginete <
> > > killer.tila...@gmail.com>
> > > > >>> wrote:
> > > > 
> > > > 

tapestry-security 0.7.1 and tapestry-resteasy 0.5.0 released!

2018-07-02 Thread Kalle Korhonen
It's that time of the year again. Actually, the community has been asking
these to be released for a while. Thanks to @homburgs, you can now
contribute chains with RegExPatternMatcher to tapestry-security (
https://github.com/tynamo/tapestry-security/pull/50). Also, 0.7.1 is now
using the latest version of Tapestry and I cleaned up a few annoying
default configuration errors that used to pop up in the logs(
https://github.com/tynamo/tapestry-security/issues/49). See docs for
tapestry-security for more (http://www.tynamo.org/tapestry-security+guide/).

Tapestry-resteasy 0.5.0 now comes with the latest version of Tapestry and
resteasy (3.1.4.Final) as well. Thanks to @jochenberger for tirelessly
keeping the versions in sync. See docs for tapestry-resteasy for more (
http://www.tynamo.org/tapestry-resteasy+guide/).

As a side-note, while our Maven & OSS (
https://www.sonatype.com/nexus-repository-oss) based release process has
worked well for the community for years, it does feel clunky and almost
pointless for those of us who've ever used Bintray's Github-based release
"process"(
https://blog.bintray.com/2013/06/05/bintray-github-synergistic-love-story/).
Using Bintray also nicely solves the problem of building snapshots since
you can use git(hub) hash as a version in case you need access to some
unreleased features. I don't know if I have appetite to make changes to
move over though, given that most of our libraries are pretty mature and
slow moving at this point. Anyhow, something to keep in mind in case we
come up with a brand new module.

Enjoy!


Re: Access request from tml / standard servlet api role support

2018-04-27 Thread Kalle Korhonen
Tapestry-security (http://www.tynamo.org/tapestry-security+guide/) supports
request.isuserInRole and provides components similar to the one suggested,
i.e.


SAVE DATA


Kalle




On Fri, Apr 27, 2018 at 3:41 PM, pico.dev  wrote:

> Hi,
>
> Maybe you can implement a new conditional component that checks the role
> and render or not its body. Something like this:
>
> 
> SAVE DATA
> 
>
> See https://tapestry.apache.org/component-rendering.html
>
> Regards,
>
> El sáb., 28 abr. 2018 a las 0:12, Luca Arzeni ()
> escribió:
>
> > Hi,
> > I'm using tapestry5.4 with java 8.
> >
> > I am using the standard servlet API to check if a user is in role or not,
> > to hide or show buttons, links, and so on.
> >
> > For example, I need to show a button to the user only if the user has
> been
> > granted a role.
> >
> > My usual way to to this is:
> >
> > 1) create a method in the page, for example:
> >
> > @Inject
> > RequestGlobals m_requestGlobals;
> >
> > public boolean isUserAdmin() {
> > if (m_requestGlobals == null) {
> > return false;
> > }
> > return m_requestGlobals.isUserInRole("ADMIN");
> > }
> >
> > 2) then, in the tml, check the method using a t:if component, for
> example:
> >
> > 
> > SAVE DATA
> > 
> >
> > This is not so good, since I must reimplement the same method in many
> > pages.
> >
> > Is there any way could I access the requestGlobals directly from tml?
> >
> > My goql would be to write, directly in the tml, something like:
> >
> >
> > 
> > SAVE DATA
> > 
> >
> >
> > Is it possible to do this with tapestry5?
> >
> > Thanks in advance,
> > larzeni
> >
> > -
> > To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org
> > For additional commands, e-mail: users-h...@tapestry.apache.org
> >
> >
>


Re: Override BeanEditForm Submit Button

2017-12-16 Thread Kalle Korhonen
You want to use the underlying BeanEditor component that does most of the
work and build your own form around it, could start by copying the
BeanEditForm source:
https://github.com/apache/tapestry-5/blob/master/tapestry-core/src/main/resources/org/apache/tapestry5/corelib/components/BeanEditForm.tml

Kalle

On Fri, Dec 15, 2017 at 3:31 PM, Christopher Dodunski <
chrisfromtapes...@christopher.net.nz> wrote:

> Hi,
>
> I would simply like to override Tapestry's BeanEditForm default submit
> button.  I've searched the internet but not found example code to achieve
> this.  Below is my template code, which is for a BeanEditForm component
> with two added fields.  The submit tag is not having the desired effect.
> Of course, in addition to having my button appear, the default submit
> button must not appear (I don't want two buttons).
>
> Your help would be much appreciated.
>
> Regards,
>
> Chris.
>
> [CODE]
>  include="userName,firstName,lastName,phone,email,status"
> add="passwordField,profileImage"
> reorder="profileImage,userName,passwordField,firstName,lastName,phone,
> email,status"
> t:submitLabel="message:title.updateUser">
> 
> Password
>  placeholder="***"/>
> 
> 
> 
>  t:value="profileImage" placeholder="select profile image"/>
> 
> 
>  class="button-user buttonGreen" />
> 
> 
> [/CODE]
>
>
> -
> To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org
> For additional commands, e-mail: users-h...@tapestry.apache.org
>
>


Re: "Detached entity passed to persist"

2017-11-28 Thread Kalle Korhonen
Surprisingly, this (re-attaching a detached entity) is not a simple
problem. First of all, you need to be very careful about holding onto
entities in your session. It's too easy with JPA/Hibernate to accidentally
keep the whole query resultset in memory when you think you are holding
onto a single object (check with your jvisualvm). Second, since you are
using Hibernate, you can re-attach an entity with (the now deprecated
operation) session.lock(entity, LockMode.NONE), not absolutely sure how the
latest versions behave. I've written about it at
http://www.tynamo.org/tapestry-conversations+guide/, referencing this
stackoverflow issue about it:
https://stackoverflow.com/questions/912659/what-is-the-proper-way-to-re-attach-detached-objects-in-hibernate,
make sure you read all of it. Your best bet is to only store the company id
in the session and do a find() before setting the company (I know, it
defeats some of the perceived user benefits of using Hibernate/JPA).

Kalle


On Tue, Nov 28, 2017 at 7:55 PM, Christopher Dodunski <
chrisfromtapes...@christopher.net.nz> wrote:

> Hi team,
>
> I suspect you'll be able to answer this right off the top of your head, as
> this error occurs in response to what I imagine is a very routine code
> assignment: set a newly created user's company to be the same company as
> that of the user doing the creating.
>
>
> Code snippet from 'pages/user/CreateUser.java'...
>
> User user = new User(firstName, lastName, userName, email,
> authenticator.encryptPassword(password));
>
> //Set the new user's company to the same as the creator's company
> user.setCompany(authenticator.getLoggedUser().getCompany());
>
> crudServiceDAO.create(user);
>
>
> The User>>Company relationship, as defined in the User entity class...
>
> @ManyToOne(cascade=CascadeType.ALL)
> @JoinColumn(name="COMPANY_ID")
> private Company company;
>
>
> The Company>>User relationship, as defined in the Company entity class...
>
> @OneToMany(mappedBy="company", cascade=CascadeType.ALL)
> private Collection users = new ArrayList();
>
>
> The USER table has a COMPANY_ID field, so I'd be expecting Hibernate to
> create a new user with the same company ID as the user I have logged in
> as.  Instead, Tapestry gives the following error...
>
> org.apache.tapestry5.runtime.ComponentEventException
>
> detached entity passed to persist: com.example.harbour.entities.
> Company
>
>
> Why is this?  Appreciate your help.
>
> Thanks,
>
> Chris.
>
>
> -
> To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org
> For additional commands, e-mail: users-h...@tapestry.apache.org
>
>


Re: Authorisation in Tapestry Applications

2017-11-26 Thread Kalle Korhonen
Attachments don't come through to the mailing list but so you have a table
that describes permissions for all of the entities? Obviously, visually
showing or hiding buttons on the client doesn't really enforce security but
you are right, Tynamo doesn't really offer anything for this case out of
the box. It'd relatively easy to write custom security annotations for your
case though, for example following the source code in tapesty-security-jpa
(see http://www.tynamo.org/tapestry-security-jpa+guide/). On the other
hand, if you used the same CRUD pages for all your entities (similar to
http://www.tynamo.org/tapestry-model+guide/), you'd only need to implement
the security checks in one place, making annotations quite useless. It all
depends on how complex your data is and how customizable you need your
pages to be. If you have a lot of entities but it editing the data is
mainly form-based, I'd almost encourage you to take a look at
tapestry-model and how well that would work for you. There's a fair bit to
learn there if you need to customize the pages heavily but it could give
you a lot for free, including having the security checks all in on page
(both visually and at the data level).

Kalle

On Sun, Nov 26, 2017 at 3:09 PM, Christopher Dodunski <
chrisfromtapes...@christopher.net.nz> wrote:

> Hi Basile,
>
> Thanks for replying.  Yes, I'd discovered Tynamo, but wondered whether it
> might be overkill given that I'd already inherited authentication code
> from the Tapestry Hotel demo app.
>
> It wasn't clear on the Tynamo site how Tynamo acquires permissions from my
> (attached) 'role' table.  And if I have to write code to do this, then why
> I need Tynamo rather than just creating a method in my user entity class
> along the lines of...
>
>   if(currentUser.isPermitted("company:create")){
>
> //Show create company button
>
>   }
>   else{
>
> //Grey out or hide create company button
>
>   }
>
> Regards,
>
> Chris.
>
>
> > http://www.tynamo.org/tapestry-security+guide/
> >
> > https://tapestry.apache.org/security.html
> >
> > Le 26/11/2017 à 05:16, Christopher Dodunski a écrit :
> >> Hi All,
> >>
> >> The Tapestry Hotel demo app has proven a good lesson in implementing
> >> AUTHENTICATION.  Having developed a multi-user Tapestry app, I now need
> >> to
> >> implement AUTHORISATION, but the Hotel demo app is aimed at just one
> >> user
> >> type: visitors.
> >>
> >> I created a role table in my Tapestry application (screenshot attached).
> >> Permissions are specified in terms of CRUD actions, meaning there are
> >> four
> >> columns for each domain (Hibernate) entity: e.g. CAN_CREATE_USER,
> >> CAN_READ_USER, CAN_UPDATE_USER, CAN_DELETE_USER, etc.
> >>
> >> The Hotel demo app enforces authentication by including or excluding the
> >> @AnonymousAccess annotation on page classes.  I imagine enforcing page
> >> authorisation could be done similarly, using a single annotation.  This
> >> could prevent users lacking the necessary privilege from accessing
> >> certain
> >> pages, for instance 'pages/DeleteUser.java'.  Ideally, though, it would
> >> be
> >> desirable to also prevent users from navigating to such pages in the
> >> first
> >> place.  Either the PageLink icon is greyed out, or there is no link.
> >>
> >> I am seeking some direction - perhaps even some example code - in how to
> >> have my Tapestry application enforce the privileges specified in my role
> >> table.
> >>
> >> Thanks & regards,
> >>
> >> Chris.
> >>
> >>
> >> -
> >> 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
>


tapestry-security 0.7.0 released!

2017-09-14 Thread Kalle Korhonen
After an extended hiatus, I figured it’s time to do some releases. First up
is the old workhorse, tapestry-security. The 0.7.0 release represents a
true community effort, my job was mainly to merge pull requests from
multiple authors. Thank you @jochenberger, @fkretzer, @pedrocborges2,
@ascandroli, @bobharner! We are all updated to use the latest Shiro and
Tapestry 5.4, with a host of important fixes and even a few new features.
To highlight one of them, see #40 add facility to remove/add/update
security chains at runtime
, from
@jochenberger. Note that there was one breaking change made as part of this
issue - The contribution to SecurityConfiguration was changed to
OrderedConfiguration, so you need to name all your contributions. See
examples in the  documentation (
http://www.tynamo.org/tapestry-security+guide/). Thanks to all and enjoy!

Kalle


Re: Tapestry-security CacheManager

2016-12-23 Thread Kalle Korhonen
Typically, you'd set the desired cachemanager in the realm itself, e.g.:

public class UserRealm extends AuthorizingRealm {
public UserRealm(...) {
super(new MemoryConstrainedCacheManager());


Kalle

On Wed, Dec 21, 2016 at 12:47 AM, Charlouze  wrote:

> Hello tapestry users,
>
> I wanted to get rid of the log message that says "*No cache or cacheManager
> properties have been set. Authorization cache cannot be obtained.*".
>
> I read that shiro offers an implementation of their CacheManager using
> EhCache so I tried to set it up.
>
> In order to set the CacheManager I had to override
> TapestryRealmSecurityManager with one of my own (see below) using a
> ServiceOverride contribution. I don't really like using ServiceOverride as
> it feels i'm hacking something. Is there a better way to achieve what I
> want tot do ?
>
> Regards,
> Charles
>
> import org.apache.shiro.cache.CacheManager;
> import org.apache.shiro.mgt.RememberMeManager;
> import org.apache.shiro.mgt.SubjectFactory;
> import org.apache.shiro.realm.Realm;
> import org.tynamo.security.Authenticator;
> import org.tynamo.security.services.TapestryRealmSecurityManager;
>
> import java.util.Collection;
>
> public class MySecurityManager extends TapestryRealmSecurityManager {
> public MySecurityManager(final Authenticator authenticator, final
> SubjectFactory subjectFactory,
> final RememberMeManager
> rememberMeManager, final Collection realms,
> final CacheManager cacheManager) {
> super(authenticator, subjectFactory, rememberMeManager, realms);
> setCacheManager(cacheManager);
> }
> }
>


Re: Tynamo Security Login Page

2016-11-10 Thread Kalle Korhonen
On Thu, Nov 10, 2016 at 2:51 AM, Adam X <vbgnm3c...@gmail.com> wrote:

> 1)
> How do I customize the login page?
> a) I'd like to edit error messages: "You must provide a value for Tynamo
> Login."
> b) I'd like to style it differently, add company logo and maybe even edit
> html
>

(You could override but) don't try to customize it, instead just create
your own custom login page, you could copy the login page source and modify
from there.

2)
> I'd like to hook up a processing interceptor after successful login.
> In essence, after shiro accepts credentials, instead of letting it go
> to my Tapestry page, I'd like to display my own page which asks for
> more information (say two factor authentication).
>

As Dusko said, use the symbols.

Kalle



> On Wed, Nov 9, 2016 at 6:54 PM, Kalle Korhonen
> <kalle.o.korho...@gmail.com> wrote:
> > Need to specify the library since it's not your own component - loginPage
> > is just a local attribute name. Use  or
> > just replace the whole block with <:tsecurity.loginlink>.
> >
> > Kalle
> >
> > On Wed, Nov 9, 2016 at 9:03 AM, Adam X <vbgnm3c...@gmail.com> wrote:
> >
> >> I have tapestry-security integrated and working in my project. Page
> >> classes annotated with shiro such as @RequiresAuthentication get
> >> intercepted with the login page.
> >>
> >> What is the best way to create a link on my page that redirects to tap
> >> security login page?
> >>
> >> In my Laout.java I tried this:
> >>
> >> @Property
> >> @Inject
> >> private SecurityService securityService;
> >>
> >> @Property
> >> @InjectPage
> >> private org.tynamo.security.pages.Login loginPage;
> >>
> >> then in my Layout.tml I have this:
> >>
> >> 
> >>   ${securityService.subject.principal}
> >>   
> >> Guest (Sign In)
> >>   
> >> 
> >>
> >> But Tapestry is unable to find this Tynamo page, even though it is
> >> clearly there:
> >>
> >> Caused by: org.apache.tapestry5.ioc.util.UnknownValueException: Unable
> >> to resolve 'loginPage' to a known page name
> >>
> >> What is the accepted (or recommended) way to bring up the login page
> >> in such a setup?
> >>
> >> -
> >> 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: Tynamo Security Login Page

2016-11-09 Thread Kalle Korhonen
Need to specify the library since it's not your own component - loginPage
is just a local attribute name. Use  or
just replace the whole block with <:tsecurity.loginlink>.

Kalle

On Wed, Nov 9, 2016 at 9:03 AM, Adam X  wrote:

> I have tapestry-security integrated and working in my project. Page
> classes annotated with shiro such as @RequiresAuthentication get
> intercepted with the login page.
>
> What is the best way to create a link on my page that redirects to tap
> security login page?
>
> In my Laout.java I tried this:
>
> @Property
> @Inject
> private SecurityService securityService;
>
> @Property
> @InjectPage
> private org.tynamo.security.pages.Login loginPage;
>
> then in my Layout.tml I have this:
>
> 
>   ${securityService.subject.principal}
>   
> Guest (Sign In)
>   
> 
>
> But Tapestry is unable to find this Tynamo page, even though it is
> clearly there:
>
> Caused by: org.apache.tapestry5.ioc.util.UnknownValueException: Unable
> to resolve 'loginPage' to a known page name
>
> What is the accepted (or recommended) way to bring up the login page
> in such a setup?
>
> -
> To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org
> For additional commands, e-mail: users-h...@tapestry.apache.org
>
>


Re: Tynamo Security w/ custom Realm

2016-11-08 Thread Kalle Korhonen
Looks fine at a quick glance. As I recall, an AuthenticatingRealm uses
SimpleCredentialsMatcher by so it should match plain text passwords. Are
you sure it's not authenticating, or is doGetAuthenticationInfo invoked at
all? Do you have any other realms configured? Get the simple, single realm
use case working first and work from there.

Kalle

On Tue, Nov 8, 2016 at 10:16 AM, Adam X  wrote:

> Howdy !
>
> I followed tynamo setup guide
> (http://www.tynamo.org/tapestry-security+guide/) combined with
> federated accounts example
> (https://github.com/tynamo/tynamo-federatedaccounts). I believe I have
> the setup hooked up correctly as my annotated page with
> @RequiresRoles("administrator") is not intercepted by tynamo and a
> login page appears. The problem I'm having is that when I enter valid
> credentials tynamo is not authenticating. Below is my custom realm.
> UserManagementDao is just an interface, but the implementation I'm
> injecting is a simple in-memory hash map impl with a unit test
> verifyinig it's correctness (in reality we're authenticating against
> AWS IAM but I'm usinig mock to get things working initially). However,
> I'm not sure if I'm constructing SimpleAuthenticationInfo correctly.
> Another thing is that my passwords (for now) are clear text and I'm
> not sure if by default Tynamo uses clear text comparison of if it
> hashes the passwords.
>
> Any help would be highly appreciated!
>
> public class MyCustomRealm extends AuthorizingRealm {
>
> private UserManagementDao dao;
>
>
> public XappmCoreRealm(UserManagementDao dao) {
>
> super(new MemoryConstrainedCacheManager());
> setName("awsiamaccounts");
> setAuthenticationTokenClass(UsernamePasswordToken.class);
> //setCredentialsMatcher(new
> HashedCredentialsMatcher(Sha1Hash.ALGORITHM_NAME));
>
> this.dao = dao;
> }
>
> @Override
> protected AuthorizationInfo
> doGetAuthorizationInfo(PrincipalCollection principals) {
>
> if(principals == null) throw new
> AuthorizationException(String.format("null %s! (should not happen)",
> PrincipalCollection.class.getSimpleName()));
> if(principals.isEmpty()) return null;
> if(principals.fromRealm(getName()).size() <= 0) return null;
>
> String username = (String)
> principals.fromRealm(getName()).iterator().next();
> if(username == null) return null;
>
> List groups = dao.getUserGroups(username);
> Set roles = new HashSet<>();
>
> for(XapGroup group : groups) {
> roles.add(group.getId());
> }
>
> return new SimpleAuthorizationInfo(roles);
> }
>
> @Override
> protected AuthenticationInfo
> doGetAuthenticationInfo(AuthenticationToken token) throws
> AuthenticationException {
>
> UsernamePasswordToken upToken = (UsernamePasswordToken) token;
> String userName = upToken.getUsername();
>
> if(userName == null) throw new AccountException("Null
> usernames are not allowed by this realm.");
>
> XapUser user = dao.getUser(userName);
> if(user == null) return null;
>
> //if (user.isAccountLocked()) { throw new
> LockedAccountException("Account [" + username + "] is locked."); }
> //if (user.isCredentialsExpired()) {
> //String msg = "The credentials for account [" + username
> + "] are expired";
> //throw new ExpiredCredentialsException(msg);
> //}
>
> String password = dao.getUserPassword(userName);
>
> return new SimpleAuthenticationInfo(userName, password,
> getName());
> }
> }
>
> Adam
>
> -
> To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org
> For additional commands, e-mail: users-h...@tapestry.apache.org
>
>


Re: WebSocket enpoint as a tapestry service

2016-10-26 Thread Kalle Korhonen
It's relatively simple like Cezary says. The only potential issue is with
authenticating JSR 356 websockets, which may require a bit of gymnastics
depending on your needs. If you are using sessions, you can fetch
underlying (servlet) session from the handshake request (see
http://stackoverflow.com/questions/21888425/accessing-servletcontext-and-httpsession-in-onmessage-of-a-jsr-356-serverendpo/27057359).
If you are using sessionless authentication (w/ JWT), you can pass the
bearer token around in the sub-protocol header,
namely Sec-WebSocket-Protocol (see
http://stackoverflow.com/questions/22383089/is-it-possible-to-use-bearer-authentication-for-websocket-upgrade-requests/35108078
).

Kalle

On Wed, Oct 26, 2016 at 2:27 PM, Lance Java 
wrote:

> There's a chat demo in both tapestry-atmosphere and tapestry-cometd
>
> Atmosphere
> Demo: http://t5atmosphere-lazan.rhcloud.com/
> Source:
> https://github.com/uklance/tapestry-atmosphere/tree/
> master/tapestry-atmosphere-demo
>
> Cometd
> Demo: http://t5cometd-lazan.rhcloud.com/chat
> Source:
> https://github.com/uklance/tapestry-cometd/tree/master/
> tapestry-cometd-demo
>
> On 26 Oct 2016 7:16 p.m., "Qbyte Consulting" 
> wrote:
>
> > I want to develop a tapestry chat component that uses a WebSocket to
> handle
> > real time text messages. I need to integrate so that users can see who is
> > logged in to the Tapestry app.
> >
> > How would I make a class in a Tapestry app a WS endoint that can also
> > access my apps Tapestry services as well as handle the WS client?
> >
> > John
> >
>


Re: Tapestry 5.4.1, MessageFormatter gone?

2016-09-23 Thread Kalle Korhonen
Just the packaging has changed, add dependency to commons:

  org.apache.tapestry
  commons
  5.4.1

Kalle

On Fri, Sep 23, 2016 at 3:13 PM, Charles Roth  wrote:

> Apologies in advance if I'm posting this incorrectly (in which case I
> welcome a link to any Tapestry-specific etiquette guide) -- my first post
> to this list.
>
> We are experimenting with upgrading from Tapestry 5.3.6 to 5.4.1, as part
> of our move from Java 7 to Java 8.
>
> The interface org.apache.tapestry5.ioc.MessageFormatter seems to have
> disappeared.  Yet it is still listed, e.g. at
> https://ci.apache.org/projects/tapestry/current/apidocs/org/
> apache/tapestry5/ioc/MessageFormatter.html
>
> When I look at the ivy dependency details (org.apache.tapestry,
> tapestry-ioc, rev 5.4.1), I see the jar tapestry-ioc-5.4.1.jar, but package
> org.apache.tapestry5.ioc does not contain MessageFormatter.   If I download
> the jar directly from http://mvnrepository.com/artif
> act/org.apache.tapestry/tapestry-ioc/5.4.1, and look at it manually with
> "jar tvf", there's no MessageFormatter.
>
> Has that interface been removed and replaced with something else? If so,
> why would it still show up in the doc (1st link I referenced?)  Or am I
> simply doing something stupid? :-)
>
> TIA.
>
> -
> To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org
> For additional commands, e-mail: users-h...@tapestry.apache.org
>
>


Re: tapestry-hibernate + tapestry-cdi

2016-09-23 Thread Kalle Korhonen
AFAIK, tapestry-hibernate simply doesn't support it. However, is switching
to JPA an option? You could still be using Hibernate as the provider.
tapestry-jpa merrily supports multi tenancy (and more). If JPA is not an
option, I'd look into implementing your own custom @Session - may not be
too bad - there isn't that much code in tapestry-hibernate. That would
resolve the version mismatch - since Hibernate is pretty finicky about it,
you could just build against the version of your choice.

Kalle

On Fri, Sep 23, 2016 at 1:05 AM, Adam X  wrote:

> Hi,
>
> I have what seems like a major collision problem and don't know how to
> solve this. My current architecture is as following:
>
> foo
> weld
> tapestry-cdi
> tapestry-core
>
> I'd like to have:
>
> foo
> weld
> tapestry-cdi
> tapestry-hibernate
>
> foo (jar) is a major depenency of my project. It is an internal
> company framework which contains all the business logic, services,
> daos, etc etc. It it's only dependency is JSR-330 (cdi) as all
> services are CDI managed beans. It allows me to easily operate on AWS
> cloud (we're using DynamoDB, SNS, S3, IAM) as well as internal
> relational db (backed by hibernate). After integrating tapestry-cdi
> things work beautifully, as in my page classes I can do things like:
>
> @Inject
> private TxDynamoDao dao;
>
> or even
>
> @Inject
> private Session session;
>
> without tapestry-hibernate at all. In otherwords, my foo dependency
> bootstraps hibernate and makes session available to my tapestry app.
>
> But now, I want to introduce a separate relational db specific to my
> project. Since I thought a lot about on my way to work in recent days,
> I expected some sort of collision. Sure enough, merely changing
> tapestry-core to tapestry-hibernate in my pom.xml, broke my app as my
> foo dependency could no longer bootstrap ITS hibernate. But I think in
> the grand schema of things it's a problem I could manage to get fixed
> as in the stack trace I noticed things like class not found, so
> tapestry-hibernate probably brought in some unwanted dependencies (our
> foo uses hibernate 5.0.7 and tapestry-hibernate wants to bring 4.x).
>
> But let's assume that we could get past this initial problem. How do I
> proceed then? How do I tell Tapestry that:
>
> @Inject
> private Session session;
>
> is a no-no, because it belongs to foo, and rather I'd like to do something
> like:
>
> @Inject @Named("tapestry-hibernate-session")
> private Session session;
>
> Adam
>
> -
> To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org
> For additional commands, e-mail: users-h...@tapestry.apache.org
>
>


Re: tapestry5.4 + hibernate + postgres + postgis

2016-08-12 Thread Kalle Korhonen
Might be enough to downgrade your JRE to 1.7, or, need to use the exact
version of Hibernate that is compatible with tapestry-hibernate. If you
need to use a newer Hibernate with Java 8, compile and deploy the
tapestry-hibernate version from T5.5 master yourself.

Kalle

On Fri, Aug 12, 2016 at 7:19 AM, Qbyte Consulting  wrote:

> Hi,
>
> I'm changing my project to use postgres and hibernate, should be straight
> forwards, right?
>
> Tapestry starts to load up but then the below happens.
>
> Any ideas? At least with JPA and eclipselink I could get the server to
> start! Hibernate seems to be causing upset. :(
>
> John
>
> [main] ERROR org.apache.tapestry5.ioc.Registry - Duplicate method
> name in class file $Session_16d373532082
> [main] ERROR org.apache.tapestry5.ioc.Registry - Operations trace:
> [main] ERROR org.apache.tapestry5.ioc.Registry - [ 1] Realizing service
> ServletApplicationInitializer
> [main] ERROR org.apache.tapestry5.ioc.Registry - [ 2] Instantiating
> service
> ServletApplicationInitializer implementation via
> org.apache.tapestry5.modules.TapestryModule.buildServletApplicationInitial
> izer(Logger,
> List, ApplicationInitializer) (at TapestryModule.java:1294)
> [main] ERROR org.apache.tapestry5.ioc.Registry - [ 3] Constructing module
> class org.apache.tapestry5.modules.TapestryModule
> [main] ERROR org.apache.tapestry5.ioc.Registry - [ 4] Determining
> injection
> value for parameter #1 (org.apache.tapestry5.ioc.services.PipelineBuilder)
> [main] ERROR org.apache.tapestry5.ioc.Registry - [ 5] Resolving object of
> type org.apache.tapestry5.ioc.services.PipelineBuilder using
> MasterObjectProvider
> [main] ERROR org.apache.tapestry5.ioc.Registry - [ 6] Realizing service
> ServiceOverride
> [main] ERROR org.apache.tapestry5.ioc.Registry - [ 7] Instantiating
> service
> ServiceOverride implementation via
> org.apache.tapestry5.ioc.internal.services.ServiceOverrideImpl(Map) (at
> ServiceOverrideImpl.java:31) via
> org.apache.tapestry5.ioc.modules.TapestryIOCModule.bind(ServiceBinder) (at
> TapestryIOCModule.java:52)
> [main] ERROR org.apache.tapestry5.ioc.Registry - [ 8] Creating plan to
> instantiate org.apache.tapestry5.ioc.internal.services.ServiceOverrideImpl
> via public
> org.apache.tapestry5.ioc.internal.services.ServiceOverrideImpl(java.util.
> Map)
> [main] ERROR org.apache.tapestry5.ioc.Registry - [ 9] Determining
> injection
> value for parameter #1 (java.util.Map)
> [main] ERROR org.apache.tapestry5.ioc.Registry - [10] Collecting mapped
> configuration for service ServiceOverride
> [main] ERROR org.apache.tapestry5.ioc.Registry - [11] Invoking
> org.apache.tapestry5.hibernate.modules.HibernateModule.
> provideInjectableSessionObject(MappedConfiguration,
> Session) (at HibernateModule.java:75)
> [main] ERROR org.apache.tapestry5.ioc.Registry - [12] Determining
> injection
> value for parameter #2 (org.hibernate.Session)
> [main] ERROR org.apache.tapestry5.ioc.Registry - [13] Creating proxy for
> service Session
> 2016-08-12 15:11:08.061::WARN:  failed app
> java.lang.ClassFormatError: Duplicate method name in class file
> $Session_16d373532082
> at java.lang.ClassLoader.defineClass1(Native Method)
> at java.lang.ClassLoader.defineClass(ClassLoader.java:760)
> at java.lang.ClassLoader.defineClass(ClassLoader.java:642)
> at
> org.apache.tapestry5.internal.plastic.PlasticClassLoader.
> defineClassWithBytecode(PlasticClassLoader.java:52)
> at
> org.apache.tapestry5.internal.plastic.PlasticClassPool.
> realize(PlasticClassPool.java:160)
> at
> org.apache.tapestry5.internal.plastic.PlasticClassPool.
> realizeTransformedClass(PlasticClassPool.java:139)
> at
> org.apache.tapestry5.internal.plastic.PlasticClassImpl.createInstantiator(
> PlasticClassImpl.java:648)
> at
> org.apache.tapestry5.plastic.PlasticManager.createProxy(
> PlasticManager.java:253)
> at
> org.apache.tapestry5.ioc.internal.services.PlasticProxyFactoryImpl.
> createProxy(PlasticProxyFactoryImpl.java:68)
> at
> org.apache.tapestry5.ioc.internal.ModuleImpl.createProxyInstance(
> ModuleImpl.java:484)
> at
> org.apache.tapestry5.ioc.internal.ModuleImpl.createProxy(ModuleImpl.java:
> 478)
> at
> org.apache.tapestry5.ioc.internal.ModuleImpl.access$
> 900(ModuleImpl.java:40)
> at
> org.apache.tapestry5.ioc.internal.ModuleImpl$4.invoke(ModuleImpl.java:322)
> at
> org.apache.tapestry5.ioc.internal.OperationTrackerImpl.
> invoke(OperationTrackerImpl.java:82)
> at
> org.apache.tapestry5.ioc.internal.PerThreadOperationTracker.invoke(
> PerThreadOperationTracker.java:72)
> at
> org.apache.tapestry5.ioc.internal.RegistryImpl.invoke(
> RegistryImpl.java:1260)
> at org.apache.tapestry5.ioc.internal.ModuleImpl.create(
> ModuleImpl.java:344)
> at
> org.apache.tapestry5.ioc.internal.ModuleImpl.access$
> 100(ModuleImpl.java:40)
> at
> org.apache.tapestry5.ioc.internal.ModuleImpl$1.invoke(ModuleImpl.java:198)
> at
> org.apache.tapestry5.ioc.internal.util.ConcurrentBarrier.withWrite(
> 

Re: Tapestry launch a JEE 7 webservice?

2016-08-01 Thread Kalle Korhonen
Yes, use tapestry-resteasy (http://www.tynamo.org/tapestry-resteasy+guide/).
You wouldn't need an explicit subclass of Application, but you'd configure
your resources with:

@Contribute(javax.ws.rs.core.Application.class)
public static void configureRestResources(Configuration
singletons,
YourRestResource yourRestResource, ... ) {
singletons.add(yourRestResource);
// optionally... CorsFeature implements javax.ws.rs.core.Feature
etc.
singletons.add(new corsFeature());
singletons.add(new JacksonConfig());
singletons.add(new JsonExceptionMapper());
}

Kalle


On Mon, Aug 1, 2016 at 3:27 AM, Qbyte Consulting 
wrote:

> I am attempting to combine a JPA layer built on Tapestry 5.3.6 with a
> RESTful webservice built for JEE 7.
>
> The web service is configured in code:
> public class ApplicationConfig extends Application
>
> However Tapestry JPA is configured with the servlet filter in web.xml:
> org.apache.tapestry5.TapestryFilter
>
> I'm actually wanting to deploy on Jetty and not use a JEE container. How
> can I combine these 2 approaches?
>
> Is there are way to get my AppModule to get Tapestry to serve the web
> services?
>
> thanks,
> John
>


Re: confused about countrycode in data-locale attribute

2016-06-27 Thread Kalle Korhonen
As a workaround, perhaps the simplest thing to do is to set your JVM
language to match the webapp default (i.e. -Duser.language=de)?

Kalle

On Mon, Jun 27, 2016 at 8:45 AM, Carlos Montero Canabal <
carlosmonterocana...@gmail.com> wrote:

> I write a jira issue about this problem
> https://issues.apache.org/jira/browse/TAP5-2551 <
> https://issues.apache.org/jira/browse/TAP5-2551> some weeks ago.
>
> For my experience, the locale de_DE is the locale of your JVM. As I wrote,
> "so the main bug is in the default locale who returns ThreadLocaleImpl
> meanwhile LocalizationSetter is not called.”
>
> I have to set ThreadLocale manually (threadLocale.setLocale(new
> Locale("es"));) as a fast fix because my webapps were down in some pages
> (for the loading-mask). I have to put this code on my
> PageRenderLinkTransformer (I use it for SEO):
>
> public PageRenderRequestParameters decodePageRenderRequest(final
> Request request){
>
> ...
> threadLocale.setLocale(new Locale("es"));
> ...
> }
>
> I hope the Tapestry Team fix the problem in a near future :)
>
> > El 27/6/2016, a las 16:35, D.R.  escribió:
> >
> > Hi,
> >
> > i want my app in german, so in my appmodule i put
> > configuration.add(SymbolConstants.SUPPORTED_LOCALES, "de");
> >
> > 1.
> > On my index page the html tag is rendered as:
> > http://www.w3.org/1999/xhtml;>
> > or with productionmode==true:
> > http://www.w3.org/1999/xhtml;>
> > everything is fine here, just want to mention, that a
> > src="/modules.gz/t5/core/messages/de.js" is referenced...
> >
> > 2.
> > But on some pages the locale includes also the country code, even if my
> browser locale is english:
> > http://www.w3.org/1999/xhtml;>
> > or with productionmode==true:
> > http://www.w3.org/1999/xhtml;>
> > here i see an error in the browser console, that this file can not be
> retrieved:
> > require.js:1910 GET
> http://localhost:8080/modules.gz/t5/core/messages/de_DE.js
> > or with productionmode==true:
> > core.js:1912 GET
> http://localhost:8080/modules.gz/t5/core/messages/de_DE.js
> > If the ENABLE_PAGELOADING_MASK is set to true, i will never see the page
> completely loaded, only the pageloader overlay :-(
> >
> > I feel like the data-locale attribute is involved and causes the request
> for the .js file.
> > goolge around i found only that:
> > http://tapestry.apache.org/current/coffeescript/messages.html
> >
> > I tried to reproduce in a blank t5.4.1 skeleton project, but i am not
> able to produce a page with data-locale="de_DE"
> >
> > Is my assumption right, that this data-locale causes the request for the
> .js file?
> >
> > The data-locale is set here:
> >
> org.apache.tapestry5.internal.services.javascript.ConfigureHTMLElementFilter.renderMarkup(MarkupWriter,
> MarkupRenderer)
> > by threadLocale.getLocale()
> >
> > What causes the threadlocale to be sometimes only "de" and sometimes
> "de_DE" with a resulting de_DE.js request error?
> >
> > How can i deal with that problem? Any hints are very welcome.
> >
> >
> > Kind regards
> > David
> >
> > -
> > To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org
> > For additional commands, e-mail: users-h...@tapestry.apache.org
> >
>
>


Re: Null pointer on sort with 5.3.8 that didn't occur with 5.3.7

2016-06-27 Thread Kalle Korhonen
I suspect the culprit is the Java upgrade rather than Tapestry. There are
some internal changes in the sorting algorithm (for example, see
https://bugs.openjdk.java.net/browse/JDK-8062797 although it doesn't
directly match your case). But basically, you have to make sure your grid
data source doesn't contain null values, or you feed a comparator to it
that can handle nulls.

Kalle

On Mon, Jun 27, 2016 at 7:43 AM, Davide Vecchi  wrote:

> Hi everybody
>
> For now I cannot post code to reproduce this problem because it only
> occurs with one columns of a specific grid from a big application and so
> far I wasn't able to extract the code to reproduce the error into a
> runnable example. But after posting this I will keep trying and if I manage
> I will post that.
>
> We migrated this web application from Java 1.7 + Tapestry 5.3.7 to Java
> 1.8 with Tapestry 5.3.8 .
>
> Clicking on the column header of this column - which contains String
> values - causes the exception below.
>
> While I'm investigating this error I was wondering if someone is aware of
> differences in the grid sorting of Tapestry 5.3.8 that might cause it to
> throw a null-pointer where Tapestry 5.3.7 wouldn't (and maybe should; it's
> likely that there is a mistake of mine that was somehow being "forgiven" by
> 5.3.7).
>
> Stacktrace:
>
> java.lang.NullPointerException
> ?
> org.apache.tapestry5.internal.grid.CollectionGridDataSource$2.compare(CollectionGridDataSource.java:78)
> ?
> org.apache.tapestry5.internal.grid.CollectionGridDataSource$3.compare(CollectionGridDataSource.java:91)
> ?  java.util.TimSort.countRunAndMakeAscending(TimSort.java:355)
> ?  java.util.TimSort.sort(TimSort.java:234)
> ?  java.util.Arrays.sort(Arrays.java:1512)
> ?  java.util.ArrayList.sort(ArrayList.java:1454)
> ?  java.util.Collections.sort(Collections.java:175)
> ?
> org.apache.tapestry5.internal.grid.CollectionGridDataSource.prepare(CollectionGridDataSource.java:97)
> ?
> my.package.gui.tapestry.components.AMCGridEmbedded$CachingDataSource.prepare(AMCGridEmbedded.java:853)
> ?
> my.package.gui.tapestry.components.AMCGridEmbedded.setupDataSource(AMCGridEmbedded.java:1174)
> ?
> my.package.gui.tapestry.components.AMCGridEmbedded.setupRender(AMCGridEmbedded.java:655)
> ?
> my.package.gui.tapestry.components.AMCGridEmbedded.advised$setupRender_1a14d3f8fd924(AMCGridEmbedded.java)
> ?
> my.package.gui.tapestry.components.AMCGridEmbedded$Invocation_setupRender_1a14d3f8fd923.proceedToAdvisedMethod(Unknown
> Source)
> ?
> org.apache.tapestry5.internal.plastic.AbstractMethodInvocation.proceed(AbstractMethodInvocation.java:84)
> ?  
> ?  
>
>


Re: http redirection to https port 443

2016-06-02 Thread Kalle Korhonen
No need to override BaseURLSource. You can just configure
SymbolConstants.HOSTPORT_SECURE to 443. The default is 0, which means use
request.serverPort. I'd say you are missing something from Jetty
configuration, since you are getting that port from the request, but add a
breakpoint to BaseURLSourceImpl.portExtension(..) and see how it behaves.

Kalle

On Thu, Jun 2, 2016 at 3:20 PM, Thiago H de Paula Figueiredo <
thiag...@gmail.com> wrote:

> On Thu, 02 Jun 2016 11:12:11 -0300, Qbyte Consulting <
> qbyteconsult...@gmail.com> wrote:
>
> Hi,
>>
>
> Hello!
>
> Try overriding or decorating the BaseURLSource service.
>
>
>
>> I've been trying to configure Jetty 9.2 to redirect http requests to https
>> port 443. No luck so far.
>>
>> The app has confured web.xml to secure it.
>>
>> I seem to recall that Tapestry (using 3.6) might have some kind of module
>> configuration for identifying ports to use?
>>
>> As it stands http requests get converted to https requests but port 80
>> gets
>> inserted into the URL which of course does not work. The port needs to be
>> dropped or replaced with 443.
>>
>> Any ideas if I am right and how to provide that secure port number
>> correctly or just drop the port number?
>>
>> John
>>
>
>
> --
> 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
>
>


tapestry-security 0.6.4 release addresses a serious vulnerability

2016-05-31 Thread Kalle Korhonen
While the Apache Shiro team (me included) are still mulling over how to
best fix a serious security vulnerability with Shiro's default rememberMe
cookies and object deserialization [SHIRO-550](
https://issues.apache.org/jira/browse/SHIRO-550), I went ahead and
implemented a fix for the vulnerability in [tapestry-security](
http://www.tynamo.org/tapestry-security+guide/), following a similar
approach I had proposed for Shiro as well. In essence, an attacker can
potentially gain access to the server using a deserialization vulnerability
(see more at
https://www.contrastsecurity.com/security-influencers/java-serialization-vulnerability-threatens-millions-of-applications
). It's a bit more convoluted for Shiro in general, but once again, service
contributions make this a simple matter to handle in Tapestry. In 0.6.4 of
tapestry-security, only known principal types can be deserialized. *Long*,
*Integer* and *String* (which likely cover 99% of the use cases) are
sanctioned by default and users can easily contribute additional principal
types to the org.apache.shiro.io.Serializer service, for example:

```
@Contribute(Serializer.class)
public static void addSafePrincipalTypes(Configuration
configuration) {
configuration.add(UID.class);
}
```

You are advised to update immediately. Currently the fix is only available
for Tapestry 5.4 but I'll make other releases available as requested. You
can also easily copy the relevant classes from the [source tree](
https://github.com/tynamo/tapestry-security/blob/master/src/main/java/org/tynamo/security/shiro/SimplePrincipalSerializer.java)
and override services as needed in your application.

**Release notes**

- Upgrade Shiro to 1.2.5 [#26](
https://github.com/tynamo/tapestry-security/issues/26)
- Safely deserialize principals from rememberMe cookie  [#27](
https://github.com/tynamo/tapestry-security/issues/27)
- Update to Tapestry 5.4.1 [#28](
https://github.com/tynamo/tapestry-security/issues/28)


Re: Overriding and translating JSR-303 validation messages

2016-05-18 Thread Kalle Korhonen
You should be able to override them by adding a
ValidationMessages.properties file at the root of your classpath. See
https://github.com/apache/tapestry-5/blob/master/tapestry-beanvalidator/src/test/resources/ValidationMessages_en.properties
for examples.

Kalle

On Wed, May 18, 2016 at 4:34 AM, Casey Link  wrote:

> G'day,
>
> In tapestry < 5.4 the validation messages for JSR-303 lived at
>
> org / apache / tapestry5 / internal / ValidationMessages.properties
>
> In tapestry 5.4 however, I cannot find the properties file that contains
> these messages.
>
> Could someone kindly point me in the right direction? I'd like to
> localize them as well as override a few in english ("may not be null"
> isn't very user friendly).
>
> Best,
>
> --
> Casey Link
>
> Outskirts Labs { https://outskirtslabs.com }
> Technology for Changemakers
>
>


Re: how to define a new asset domain

2016-05-11 Thread Kalle Korhonen
In Tomcat, you'd just drop in a new context.xml and specify a docBase
attribute in it (see
http://stackoverflow.com/questions/1812244/simplest-way-to-serve-static-data-from-outside-the-application-server-in-a-java).
Jetty had something similar, see their docs.

Kalle

On Tue, May 10, 2016 at 10:47 PM, D.R. <d.re...@googlemail.com> wrote:

> Hi Kalle,
>
> sounds nice, how do i setup a new context and use it?
>
> Kind regards
> David
>
>
> On 11.05.2016 07:38, Kalle Korhonen wrote:
>
>> If you are serving static files but want to keep the deployment simple,
>> it's very straight forwarded to set up a new context, such as /images/ to
>> purely serve static resources. I've done it in a few occasions and the
>> nice
>> thing about it is that you don't really need more than one liner in an xml
>> file and you can configure the resource "webapplication" with very
>> aggressive caching settings (at least Tomcat allows caching and serving
>> everything from memory).
>>
>> Kalle
>>
>> On Tue, May 10, 2016 at 10:29 PM, D.R. <d.re...@googlemail.com> wrote:
>>
>> Hi Jens,
>>>
>>> thanks for answer. No, not really what i want.
>>>
>>> I would like to write in my .tml
>>> 
>>>
>>> which renders something like:
>>> 
>>> and take a file from the filesystem by a defined path.
>>>
>>> I think for that the ExternalUrlAssetFactory is not doing what i want and
>>> i have to deal with my own impl of AssetFactory and Resource.
>>>
>>> In the meantime i found a solution from Lance which do similar what i
>>> want:
>>>
>>>
>>> http://stackoverflow.com/questions/30478306/tapestry-load-image-asset-from-filesystem
>>>
>>> But i think more and more it is better to use an image server for that
>>> issue.
>>>
>>>
>>> Kind regards (also to Bobby)
>>> David
>>>
>>>
>>> On 10.05.2016 12:16, Jens Breitenstein wrote:
>>>
>>> Hi David!
>>>>
>>>> If I look at the classes implementing AssetFactory there is
>>>> ExternalUrlAssetFactory, maybe this is what you want
>>>> (file:///your-dir/your-asset.png)?
>>>> AssetModule.java configures all context asset factories so you have to
>>>> contribute
>>>>
>>>>  configuration.add("file", new ExternalAssetFactory("file"))
>>>>
>>>> in your module, too. I have to admit, I did not test it, just browsing
>>>> the T5.4 sources.
>>>>
>>>>
>>>> Jens
>>>>
>>>>
>>>> Am 10/05/16 um 08:53 schrieb D.R.:
>>>>
>>>> Hi @all,
>>>>>
>>>>> i need a new asset domain to have access to the filesystem.
>>>>>
>>>>> In the doc http://tapestry.apache.org/assets.html
>>>>> they say you "may define a new AssetFactory and contribute it to the
>>>>> AssetSource service configuration"
>>>>>
>>>>> I have no idea how to deal with the two methods. Please help. What i
>>>>> have to do in Order to get access to files on my filesystem?
>>>>>
>>>>> public AssetFactory buildAssetFactory()
>>>>>  {
>>>>>  return new AssetFactory(){
>>>>>
>>>>>  @Override
>>>>>  public Asset createAsset(Resource arg0)
>>>>>  {
>>>>>  return null;
>>>>>  }
>>>>>
>>>>>  @Override
>>>>>  public Resource getRootResource() {
>>>>>  return null;
>>>>>  }
>>>>>
>>>>>  };
>>>>>  }
>>>>>
>>>>> Kind regards
>>>>> David
>>>>>
>>>>>
>>>>> -
>>>> 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
>>>
>>>
>>>
>
> -
> To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org
> For additional commands, e-mail: users-h...@tapestry.apache.org
>
>


Re: how to define a new asset domain

2016-05-10 Thread Kalle Korhonen
If you are serving static files but want to keep the deployment simple,
it's very straight forwarded to set up a new context, such as /images/ to
purely serve static resources. I've done it in a few occasions and the nice
thing about it is that you don't really need more than one liner in an xml
file and you can configure the resource "webapplication" with very
aggressive caching settings (at least Tomcat allows caching and serving
everything from memory).

Kalle

On Tue, May 10, 2016 at 10:29 PM, D.R.  wrote:

> Hi Jens,
>
> thanks for answer. No, not really what i want.
>
> I would like to write in my .tml
> 
>
> which renders something like:
> 
> and take a file from the filesystem by a defined path.
>
> I think for that the ExternalUrlAssetFactory is not doing what i want and
> i have to deal with my own impl of AssetFactory and Resource.
>
> In the meantime i found a solution from Lance which do similar what i want:
>
> http://stackoverflow.com/questions/30478306/tapestry-load-image-asset-from-filesystem
>
> But i think more and more it is better to use an image server for that
> issue.
>
>
> Kind regards (also to Bobby)
> David
>
>
> On 10.05.2016 12:16, Jens Breitenstein wrote:
>
>> Hi David!
>>
>> If I look at the classes implementing AssetFactory there is
>> ExternalUrlAssetFactory, maybe this is what you want
>> (file:///your-dir/your-asset.png)?
>> AssetModule.java configures all context asset factories so you have to
>> contribute
>>
>> configuration.add("file", new ExternalAssetFactory("file"))
>>
>> in your module, too. I have to admit, I did not test it, just browsing
>> the T5.4 sources.
>>
>>
>> Jens
>>
>>
>> Am 10/05/16 um 08:53 schrieb D.R.:
>>
>>> Hi @all,
>>>
>>> i need a new asset domain to have access to the filesystem.
>>>
>>> In the doc http://tapestry.apache.org/assets.html
>>> they say you "may define a new AssetFactory and contribute it to the
>>> AssetSource service configuration"
>>>
>>> I have no idea how to deal with the two methods. Please help. What i
>>> have to do in Order to get access to files on my filesystem?
>>>
>>> public AssetFactory buildAssetFactory()
>>> {
>>> return new AssetFactory(){
>>>
>>> @Override
>>> public Asset createAsset(Resource arg0)
>>> {
>>> return null;
>>> }
>>>
>>> @Override
>>> public Resource getRootResource() {
>>> return null;
>>> }
>>>
>>> };
>>> }
>>>
>>> Kind regards
>>> David
>>>
>>>
>>
>> -
>> 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 4.1.6 and pergmen question

2016-04-07 Thread Kalle Korhonen
On Thu, Apr 7, 2016 at 12:33 AM, Ivano Luberti <lube...@archicoop.it> wrote:

> Kalle, Chris, thanks for your answers.
> Unfortunately the problem is not related to webapp reloading even
> restarting the Tomcat service leads to out of PermGen in a few days,
> PermGen itself is quite large and I already use UseConcMarkSweepGC. Down
> The cause of the space consumption seems to be the presence of a lot of
> classes of this type
> org.apache.tapestry.enhance.ClassFactoryClassLoader
>

That's a symptom, not a cause.


> It seems that the more request the application serves the more PermGen
> increases and that's led me to think that the page pool is never cleaned up
> or at least not well cleanedup.
>

Most likely, you have a permgen memory leak. Are you using streams and/or
threads on your pages and are they properly closed, even in case of
exceptions? I can't tell you how many memory leaks I've plugged over the
years in thread and stream handling. Invariably, the errors are in your own
code. See https://plumbr.eu/blog/memory-leaks/what-is-a-permgen-leak for
possible causes for a permgen memory leak. Also, you are in luck because
Tomcat 6 added some useful tools for detecting memory leaks (see
http://wiki.apache.org/tomcat/MemoryLeakProtection, and Tomcat 7 and up is
even able to recover from some of them). Take a heap dump of the stressed
out system and load it in your VisualVM.

Kalle



> Il 06/04/2016 23:24, Kalle Korhonen ha scritto:
> > If you run out of permgen space very quickly, then it's indicative that
> the
> > allocated permgen space is simply too small. Perhaps the new version of
> > Tomcat requires more of it for itself, leaving less for your application.
> > Is the webapp restarted at times? If so, that can easily cause permgen
> > space to fill up because of the way OGNL works. And even if you are not
> > restarting the app, you need to exercise all parts of your web
> application
> > to find out the true permgen space consumption of it.
> >
> > Kalle
> >
> > On Wed, Apr 6, 2016 at 1:49 PM, Ivano Luberti <lube...@archicoop.it>
> wrote:
> >
> >> Hey Tony, if you don't mind, can you send me all the configuration
> >> options of Java and Tomcat you are using? So tomcat6.conf and server.xml
> >> files?
> >>
> >> No one else on the list can share its thoughts?
> >>
> >> Il 05/04/2016 23:03, Ivano Luberti ha scritto:
> >>> Hi Tony thanks for the quick answer:
> >>>
> >>> Il 05/04/2016 21:50, Tony Nelson ha scritto:
> >>>> I still have a Tapestry 4 app running with Tomcat 6.0.41, and it runs
> >> well enough with:
> >>>> -XX:MaxPermSize=1024m
> >>> with that setting it fails but...
> >>>> I also have
> >>>>
> >>>> -Xmx12g -Xms4g -XX:+UsseConcMarkSweepGC -XX:+UseParNewGC
> >>> I have only  -Xmx2g
> >>>
> >>> I use
> >>>
> >>> -XX:+UseConcMarkSweepGC
> >>>
> >>> but not
> >>>
> >>> -XX:+UseParNewGC
> >>>
> >>>
> >>> but this last one doesn't seem to have an influence on PermGen, does
> it?
> >>>
> >>>
> >> --
> >> ==
> >> dott. Ivano Mario Luberti
> >> Archimede Informatica societa' cooperativa a r. l.
> >> Sede Operativa
> >> Via Gereschi 36 - 56126- Pisa
> >> tel.: +39-050- 580959
> >> tel/fax: +39-050-8932061
> >> web: www.archicoop.it
> >> ==
> >>
> >>
> >> -
> >> To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org
> >> For additional commands, e-mail: users-h...@tapestry.apache.org
> >>
> >>
>
> --
> ==
> dott. Ivano Mario Luberti
> Archimede Informatica societa' cooperativa a r. l.
> Sede Operativa
> Via Gereschi 36 - 56126- Pisa
> tel.: +39-050- 580959
> tel/fax: +39-050-8932061
> web: www.archicoop.it
> ==
>
>
>
> -
> To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org
> For additional commands, e-mail: users-h...@tapestry.apache.org
>
>


Re: tapestry 4.1.6 and pergmen question

2016-04-06 Thread Kalle Korhonen
If you run out of permgen space very quickly, then it's indicative that the
allocated permgen space is simply too small. Perhaps the new version of
Tomcat requires more of it for itself, leaving less for your application.
Is the webapp restarted at times? If so, that can easily cause permgen
space to fill up because of the way OGNL works. And even if you are not
restarting the app, you need to exercise all parts of your web application
to find out the true permgen space consumption of it.

Kalle

On Wed, Apr 6, 2016 at 1:49 PM, Ivano Luberti  wrote:

> Hey Tony, if you don't mind, can you send me all the configuration
> options of Java and Tomcat you are using? So tomcat6.conf and server.xml
> files?
>
> No one else on the list can share its thoughts?
>
> Il 05/04/2016 23:03, Ivano Luberti ha scritto:
> > Hi Tony thanks for the quick answer:
> >
> > Il 05/04/2016 21:50, Tony Nelson ha scritto:
> >> I still have a Tapestry 4 app running with Tomcat 6.0.41, and it runs
> well enough with:
> >>
> >> -XX:MaxPermSize=1024m
> > with that setting it fails but...
> >> I also have
> >>
> >> -Xmx12g -Xms4g -XX:+UsseConcMarkSweepGC -XX:+UseParNewGC
> > I have only  -Xmx2g
> >
> > I use
> >
> > -XX:+UseConcMarkSweepGC
> >
> > but not
> >
> > -XX:+UseParNewGC
> >
> >
> > but this last one doesn't seem to have an influence on PermGen, does it?
> >
> >
>
> --
> ==
> dott. Ivano Mario Luberti
> Archimede Informatica societa' cooperativa a r. l.
> Sede Operativa
> Via Gereschi 36 - 56126- Pisa
> tel.: +39-050- 580959
> tel/fax: +39-050-8932061
> web: www.archicoop.it
> ==
>
>
> -
> To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org
> For additional commands, e-mail: users-h...@tapestry.apache.org
>
>


Re: Unable to add SecurityAssert after moving from 5.3 to 5.4

2016-04-01 Thread Kalle Korhonen
SecurityAssert is your own code right? What are you injecting into it and
what does it do? Why don't you just break the circular dependency?

Kalle

On Fri, Apr 1, 2016 at 10:20 AM, Pavel Chernyak 
wrote:

> Yea, i know. But there no any more info.
> It's simple starts, loading pages, than shows this warning.
>
>
> On 1 April 2016 at 18:06, Thiago H de Paula Figueiredo  >
> wrote:
>
> > On Fri, 01 Apr 2016 04:21:31 -0300, Pavel Chernyak  >
> > wrote:
> >
> > Hello. Well, nothing more except this stack trace.
> >>
> >> Unable to add 'SecurityAssert' as a dependency of
> >> 'ComponentRequestHandler', as that forms a dependency cycle
> >> ('ComponentRequestHandler' depends on itself via 'SecurityAssert'). The
> >> dependency has been ignored.
> >> Unable to load class $ComponentRequestHandler_13c917a7b1c as the
> >> implementation of service java.lang.Object
> >>
> >
> > I'm sorry, this is an error message, not a stack trace.
> >
> >
> > --
> > 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: Tapestry 5.3.7 with Tanuki service wrapper

2016-03-30 Thread Kalle Korhonen
I've used Tanuki to wrap various versions of Tapestry webapps and I've also
done plenty of embedded Jetty/Tomcat installations. Never had any major
issues with Tanuki. Any problems are almost always related to classloader
issues, not directly caused by Tanuki.

Kalle

On Wed, Mar 30, 2016 at 12:41 PM, David Taylor <
david.tay...@extensiatech.com> wrote:

> We use JSW (last non-GPL version) + Jetty 9.3/Tomcat 8 + Tapestry 5.4 in
> production on various flavors of Windows without issue. The only unusual
> thing I have seen is a problem with HikariCP having problems locating the
> jTDS driver at system startup. Very weird since the problem does not occur
> if the server is manually restarted. The fix was to tell HikariCP the fully
> qualified class name of the driver.
>
> David
>
>
> emailsig On 3/29/2016 3:42 AM, Qbyte Consulting wrote:
>
>> Hi,
>>
>> Has anyone had success running ioc via the Tanuki Service Wrapper product?
>>
>> I'm having problems with Tapestry instantiating a DAO service that is
>> injected with EntityManager references.
>>
>> Suspect a class loader problem, I'm getting inconsistent results. All
>> works
>> fine from the command line launch?
>>
>> Probably means this isn't a Tapestry issue, but just interested to know
>> anyone who's had a good result with Tanuki starting Tapestry?
>>
>> John
>>
>>
>
>
> -
> To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org
> For additional commands, e-mail: users-h...@tapestry.apache.org
>
>


Re: Hibernate call returns wrong day

2016-03-29 Thread Kalle Korhonen
The same thread really reads the same value from the database every few
seconds and it may come out different? I don't buy it, there must be
something else going on at the same time. Are you sure it's the same value?
Is there something else writing to it at the same time? Can the system
default timezone change (perhaps also print out TimeZone.getDefault(), Date
initialized to the default timezone). I'd still suspect some type of
timezone issue.

Kalle

On Tue, Mar 29, 2016 at 3:39 PM, g kuczera  wrote:

> Hi guys,
> First of all, thanks for the answer and the effort you put into writing
> them.
>
> I checked few things and read couple of articles about similar problems and
> here is my little summary:
>
>- my PostgreSQL birthDate column's type is 'birthDate TIMESTAMP WITHOUT
>TIME ZONE'
>- the values contained by the column do not have the time part, the
>year-month-day is used, eg. 1982-03-28
>- then the user Entity has the birth date field with annotations
>
>   @Column(name = "birthDate ")
>
>   @Temporal(TemporalType.DATE)
>
>   private java.util.Date birthDate;
>
>
>- the call calendar.getTimeZone().getDisplayName() returns
>
> The Calendar instance is created in this way:
>
> Calendar calendar = Calendar.getInstance();
> calendar.setTime(user.getBirthDate());
>
>
> So the TIMESTAMP value from the database is interpreted as the
> java.util.Date, what is achieved by putting the Temporal annotation. Then,
> when I call the getter (getBirthDate method) the "truncated" TIMESTAMP is
> returned.
>
> But still, after fetching  the birthDate for 4 times, the fifth one becomes
> corrupted:
>
> 30-03-16 00:25:36:746 - {INFO} profil.ProfilEdition Thread
> [qtp1357767732-54];  birth date equals (setupRender - getting from raw
> query): 1982-03-28 00:00:00.0, 1982-03-28 00:00:00.0
> 30-03-16 00:25:44:497 - {INFO} profil.ProfilEdition Thread
> [qtp1357767732-65];  birth date equals (setupRender - getting from raw
> query): 1982-03-28 00:00:00.0, 1982-03-28 00:00:00.0
> 30-03-16 00:25:46:037 - {INFO} profil.ProfilEdition Thread
> [qtp1357767732-60];  birth date equals (setupRender - getting from raw
> query): 1982-03-28 00:00:00.0, 1982-03-28 00:00:00.0
> 30-03-16 00:25:46:884 - {INFO} profil.ProfilEdition Thread
> [qtp1357767732-62];  birth date equals (setupRender - getting from raw
> query): 1982-03-28 00:00:00.0, 1982-03-28 00:00:00.0
> 30-03-16 00:25:48:843 - {INFO} profil.ProfilEdition Thread
> [qtp1357767732-63];  birth date equals (setupRender - getting from raw
> query): 1982-03-27 23:00:00.0, 1982-03-27 23:00:00.0
>
> The log comes from casting the raw query result to java.sql.Timestamp. The
> value after comma is the same one, but casted to java.util.Date (these are
> results of toString method)..
>
> I will continue to investigate the thing tomorrow.
>
> 2016-03-24 15:47 GMT+01:00 Cezary Biernacki :
>
> > Hi,
> > I doubt it is a Tapestry related problem. I have seen similar issues, and
> > they are generally caused by time zone translations. My guess is that
> your
> > database stores date birth as a timestamp (i.e. including specific hours
> > and minutes) in some specific time zone, and your Java code retrieving
> > timestamps translates it to a different time zone. To diagnose, you
> should
> > check what is actually stored in the database, what kind of data type is
> > used to store date of birth (database engines often have many options to
> > store dates and timestamps including or not time zones), what Java type
> is
> > returned by user.getBirthDate() and what is the actual returned value
> > (exact content, not result of toString()), and what assumptions about
> using
> > time zones your JDBC driver is making. Typically problems arise when some
> > parts of the systems treat time stamps as set in UTC and others apply
> user
> > (client) default time zone. To fix this, one should have methodically
> > ensure that all parts are using consistent time zone policy, and any time
> > zone translations occur only when necessary.
> >
> > Best regards,
> > Cezary
> >
> >
> > On Tue, Mar 22, 2016 at 8:55 PM, g kuczera  wrote:
> >
> > > Hi guys,
> > > I do not really know if it is connected with tapestry or only the
> > > Hibernate, but maybe that is the case. So there is a embedded calendar
> on
> > > the site, the one from tapestry-jquery library:
> > > http://tapestry5-jquery.com/mixins/docscustomdatepicker
> > >
> > > If the user chose - during registration - the 28/03/1982 date, the
> value
> > > will be correctly save to the database. But if you want to change this
> > date
> > > and the calendar is going to be prepared, the date retrieved by the
> > UserDao
> > > (the birthDate field) equals to 27/03/1982.
> > >
> > > I use the DAOs layer, which uses the Hibernate session. It is
> > automatically
> > > passed as an argument during the binding process (in the AppModule
> > class):
> > >
> > > 

Re: OAuth2 Server tapestry implementation

2016-03-23 Thread Kalle Korhonen
I don't see a reason to do a plain servlet implementation if it's not for
educational reasons only. JAX-RS or even a Tapestry API would serve you
much better as an Oauth endpoint.

Kalle

On Wed, Mar 23, 2016 at 1:13 AM, abangkis <abang...@gmail.com> wrote:

> Thanks Kalle. Yes, I've been following that. Turning the Jax-RS sample to a
> servlet one, before try to migrate it to tapestry. I Guess my knowledge on
> OAuth2, JAX-RS & Servlet isn't deep enough to quickly do it for now. I'll
> set aside a few weekends to learn more about it in the future :)
>
>
> On Wed, Mar 23, 2016 at 12:36 PM, Kalle Korhonen <
> kalle.o.korho...@gmail.com
> > wrote:
>
> > Adapting the code from Oltu's integration tests (e.g. see
> >
> >
> https://github.com/apache/oltu/blob/trunk/oauth-2.0/integration-tests/src/test/java/org/apache/oltu/oauth2/integration/endpoints/AuthzEndpoint.java
> > ),
> > it should be relatively simple to implement Oauth authorization &
> resource
> > servers as JAX-RS endpoints with Tynamo's tapestry-resteasy (
> > http://www.tynamo.org/tapestry-resteasy+guide/).
> Tynamo-federatedaccounts
> > can certainly be used as a a client to your own server with some
> > customization. It's not too difficult, but previous knowledge on basic
> > Oauth workflow and JAX-RS is required. I'd love to make this much simpler
> > really but there are lots and lots of options how you want things to
> behave
> > so one size doesn't fit all.
> >
> > One of the more interesting things in authorization space I've been
> working
> > on lately is invoking an Oauth request with a third-party authorization
> > server from an Ember client, then validating the access token through my
> > own service, federating it with a local account and finally returning
> JWTs
> > for sessionless *and* using the same tokens for authorizing websocket
> > connections. Phew. I may try to spin some parts of it off to an open
> source
> > library but not quite sure yet what exactly would make a good reusable
> > module.
> >
> > Kalle
> >
> > On Tue, Mar 22, 2016 at 6:39 PM, abangkis <abang...@gmail.com> wrote:
> >
> > > Hi all, thanks for the response. Yes, it's the server Implementation :)
> > >
> > > I don't think i would integrate spring social, since I don't use
> spring.
> > > Been tinkering with the servlet implementation of OAuth2, turn out the
> > > effort is greater than I previously think (probably because I don't
> > > understand OAuth2 that well). So i think I'm going to lower the
> priority
> > of
> > > using OAuth2 for now.
> > >
> > > Thanks everyone :)
> > >
> > > On Tue, Mar 22, 2016 at 10:46 PM, Prakash Manjeshwar <
> > > pvmanjesh...@gmail.com
> > > > wrote:
> > >
> > > > My OAuth know-how is very limited. Nevertheless, following links
> might
> > > > help...
> > > >
> > > >
> > > >
> > > >
> > > >
> > >
> >
> https://gist.github.com/sody/1324553/f4a12ce37f65b96b98c98921ab9caff7d6d5d037
> > > >
> > > >
> > > >
> > >
> >
> http://docs.spring.io/spring-social/docs/1.0.x/reference/html/implementing.html
> > > >
> > > >
> > > >
> > >
> >
> http://docs.spring.io/spring-social/docs/1.0.x/reference/html/overview.html#table-spring-social-modules
> > > >
> > > >
> > > >
> > > > ---
> > > > Regards,
> > > > Prakash
> > > >
> > > >
> > > > On 22 March 2016 at 21:06, Thiago H de Paula Figueiredo <
> > > > thiag...@gmail.com>
> > > > wrote:
> > > >
> > > > > On Tue, 22 Mar 2016 12:27:59 -0300, Prakash Manjeshwar <
> > > > > pvmanjesh...@gmail.com> wrote:
> > > > >
> > > > > I think, original question was about an OAuth *server
> implementation
> > > *as
> > > > >> there was reference to Apache Oltu.
> > > > >>
> > > > >
> > > > > Oh, I'm sorry. I read the message too quickly and I didn't notice
> the
> > > > > "server" part. (facepalm).
> > > > >
> > > > > Thanks for the shout out to Oltu. I didn't know about it and it
> seems
> > > > > pretty interesting. It shouldn't be hard to integrate it into a
> > > Tapestry
> > > > > application.
> > > > >
> > > > > Is Tynamo not a client only solution ?
> > > > >>
> > > > >
> > > > > Yes.
> > > > >
> > > > >
> > > > > --
> > > > > 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
> > > > >
> > > > >
> > > >
> > >
> > >
> > >
> > > --
> > > http://www.mreunionlabs.net/ <http://www.mreunion-labs.net/>
> > > twitter : @mreunionlabs @abangkis
> > > page : https://plus.google.com/104168782385184990771
> > >
> >
>
>
>
> --
> http://www.mreunionlabs.net/ <http://www.mreunion-labs.net/>
> twitter : @mreunionlabs @abangkis
> page : https://plus.google.com/104168782385184990771
>


Re: OAuth2 Server tapestry implementation

2016-03-22 Thread Kalle Korhonen
Adapting the code from Oltu's integration tests (e.g. see
https://github.com/apache/oltu/blob/trunk/oauth-2.0/integration-tests/src/test/java/org/apache/oltu/oauth2/integration/endpoints/AuthzEndpoint.java),
it should be relatively simple to implement Oauth authorization & resource
servers as JAX-RS endpoints with Tynamo's tapestry-resteasy (
http://www.tynamo.org/tapestry-resteasy+guide/). Tynamo-federatedaccounts
can certainly be used as a a client to your own server with some
customization. It's not too difficult, but previous knowledge on basic
Oauth workflow and JAX-RS is required. I'd love to make this much simpler
really but there are lots and lots of options how you want things to behave
so one size doesn't fit all.

One of the more interesting things in authorization space I've been working
on lately is invoking an Oauth request with a third-party authorization
server from an Ember client, then validating the access token through my
own service, federating it with a local account and finally returning JWTs
for sessionless *and* using the same tokens for authorizing websocket
connections. Phew. I may try to spin some parts of it off to an open source
library but not quite sure yet what exactly would make a good reusable
module.

Kalle

On Tue, Mar 22, 2016 at 6:39 PM, abangkis  wrote:

> Hi all, thanks for the response. Yes, it's the server Implementation :)
>
> I don't think i would integrate spring social, since I don't use spring.
> Been tinkering with the servlet implementation of OAuth2, turn out the
> effort is greater than I previously think (probably because I don't
> understand OAuth2 that well). So i think I'm going to lower the priority of
> using OAuth2 for now.
>
> Thanks everyone :)
>
> On Tue, Mar 22, 2016 at 10:46 PM, Prakash Manjeshwar <
> pvmanjesh...@gmail.com
> > wrote:
>
> > My OAuth know-how is very limited. Nevertheless, following links might
> > help...
> >
> >
> >
> >
> >
> https://gist.github.com/sody/1324553/f4a12ce37f65b96b98c98921ab9caff7d6d5d037
> >
> >
> >
> http://docs.spring.io/spring-social/docs/1.0.x/reference/html/implementing.html
> >
> >
> >
> http://docs.spring.io/spring-social/docs/1.0.x/reference/html/overview.html#table-spring-social-modules
> >
> >
> >
> > ---
> > Regards,
> > Prakash
> >
> >
> > On 22 March 2016 at 21:06, Thiago H de Paula Figueiredo <
> > thiag...@gmail.com>
> > wrote:
> >
> > > On Tue, 22 Mar 2016 12:27:59 -0300, Prakash Manjeshwar <
> > > pvmanjesh...@gmail.com> wrote:
> > >
> > > I think, original question was about an OAuth *server implementation
> *as
> > >> there was reference to Apache Oltu.
> > >>
> > >
> > > Oh, I'm sorry. I read the message too quickly and I didn't notice the
> > > "server" part. (facepalm).
> > >
> > > Thanks for the shout out to Oltu. I didn't know about it and it seems
> > > pretty interesting. It shouldn't be hard to integrate it into a
> Tapestry
> > > application.
> > >
> > > Is Tynamo not a client only solution ?
> > >>
> > >
> > > Yes.
> > >
> > >
> > > --
> > > 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
> > >
> > >
> >
>
>
>
> --
> http://www.mreunionlabs.net/ 
> twitter : @mreunionlabs @abangkis
> page : https://plus.google.com/104168782385184990771
>


Re: exception during bind

2016-03-20 Thread Kalle Korhonen
You have the wrong version of plastic and/or JRE. (And for the love of god,
please learn to post a proper question and include at least some context,
like versions of libraries you are using.)

Kalle



On Wed, Mar 16, 2016 at 9:19 PM, Qbyte Consulting  wrote:

> I added a missing dependency, still IOC problems?
>
> --- exec-maven-plugin:1.2.1:exec (default-cli) @ ComplianceReports ---
> ioc.RegistryBuilder Adding module definition for class
> org.apache.tapestry5.ioc.services.TapestryIOCModule
> ioc.RegistryBuilder Adding module definition for class
> compliancereports.services.ComplianceReportsModule
> ioc.Registry Error building service proxy for service 'RegistryStartup' (at
> org.apache.tapestry5.ioc.internal.services.RegistryStartup(Logger, List)
> (at RegistryStartup.java:36) via
> org.apache.tapestry5.ioc.services.TapestryIOCModule.bind(ServiceBinder) (at
> TapestryIOCModule.java:49)): java.lang.IllegalArgumentException
> ioc.Registry Operations trace:
> ioc.Registry [ 1] Creating proxy for service RegistryStartup
> Exception in thread "main"
> org.apache.tapestry5.ioc.internal.OperationException: Error building
> service proxy for service 'RegistryStartup' (at
> org.apache.tapestry5.ioc.internal.services.RegistryStartup(Logger, List)
> (at RegistryStartup.java:36) via
> org.apache.tapestry5.ioc.services.TapestryIOCModule.bind(ServiceBinder) (at
> TapestryIOCModule.java:49)): java.lang.IllegalArgumentException
> at
>
> org.apache.tapestry5.ioc.internal.OperationTrackerImpl.logAndRethrow(OperationTrackerImpl.java:121)
> at
>
> org.apache.tapestry5.ioc.internal.OperationTrackerImpl.invoke(OperationTrackerImpl.java:88)
> at
>
> org.apache.tapestry5.ioc.internal.PerThreadOperationTracker.invoke(PerThreadOperationTracker.java:87)
> at
>
> org.apache.tapestry5.ioc.internal.RegistryImpl.invoke(RegistryImpl.java:1124)
> at org.apache.tapestry5.ioc.internal.ModuleImpl.create(ModuleImpl.java:332)
> at
> org.apache.tapestry5.ioc.internal.ModuleImpl.access$100(ModuleImpl.java:39)
> at
> org.apache.tapestry5.ioc.internal.ModuleImpl$1.invoke(ModuleImpl.java:191)
> at
>
> org.apache.tapestry5.ioc.internal.util.ConcurrentBarrier.withWrite(ConcurrentBarrier.java:140)
> at
> org.apache.tapestry5.ioc.internal.ModuleImpl$2.invoke(ModuleImpl.java:207)
> at
>
> org.apache.tapestry5.ioc.internal.util.ConcurrentBarrier.withRead(ConcurrentBarrier.java:85)
> at
>
> org.apache.tapestry5.ioc.internal.ModuleImpl.findOrCreate(ModuleImpl.java:213)
> at
>
> org.apache.tapestry5.ioc.internal.ModuleImpl.getService(ModuleImpl.java:109)
> at
>
> org.apache.tapestry5.ioc.internal.RegistryImpl.getService(RegistryImpl.java:421)
> at
>
> org.apache.tapestry5.ioc.internal.RegistryImpl.performRegistryStartup(RegistryImpl.java:325)
> at
>
> org.apache.tapestry5.ioc.internal.RegistryWrapper.performRegistryStartup(RegistryWrapper.java:80)
> at
>
> org.apache.tapestry5.ioc.RegistryBuilder.buildAndStartupRegistry(RegistryBuilder.java:213)
> at
>
> org.apache.tapestry5.ioc.RegistryBuilder.buildAndStartupRegistry(RegistryBuilder.java:229)
> at
> compliancereports.ComplianceReportsMain.main(ComplianceReportsMain.java:26)
> Caused by: java.lang.RuntimeException: Error building service proxy for
> service 'RegistryStartup' (at
> org.apache.tapestry5.ioc.internal.services.RegistryStartup(Logger, List)
> (at RegistryStartup.java:36) via
> org.apache.tapestry5.ioc.services.TapestryIOCModule.bind(ServiceBinder) (at
> TapestryIOCModule.java:49)): java.lang.IllegalArgumentException
> at
> org.apache.tapestry5.ioc.internal.ModuleImpl$4.invoke(ModuleImpl.java:327)
> at
>
> org.apache.tapestry5.ioc.internal.OperationTrackerImpl.invoke(OperationTrackerImpl.java:74)
> ... 16 more
> Caused by: java.lang.IllegalArgumentException
> at
>
> org.apache.tapestry5.internal.plastic.asm.ClassReader.(ClassReader.java:167)
> at
>
> org.apache.tapestry5.internal.plastic.asm.ClassReader.(ClassReader.java:153)
> at
>
> org.apache.tapestry5.internal.plastic.PlasticInternalUtils.convertBytecodeToClassNode(PlasticInternalUtils.java:436)
> at
>
> org.apache.tapestry5.internal.plastic.PlasticClassPool.constructClassNodeFromBytecode(PlasticClassPool.java:481)
> at
>
> org.apache.tapestry5.internal.plastic.PlasticClassPool$1.convert(PlasticClassPool.java:62)
> at
>
> org.apache.tapestry5.internal.plastic.PlasticClassPool$1.convert(PlasticClassPool.java:59)
> at org.apache.tapestry5.internal.plastic.Cache.get(Cache.java:37)
> at
>
> org.apache.tapestry5.internal.plastic.PlasticClassPool.getTypeCategory(PlasticClassPool.java:562)
> at
>
> org.apache.tapestry5.internal.plastic.PlasticMethodImpl.invokeDelegateAndReturnResult(PlasticMethodImpl.java:363)
> at
>
> org.apache.tapestry5.internal.plastic.PlasticMethodImpl.access$000(PlasticMethodImpl.java:24)
> at
>
> org.apache.tapestry5.internal.plastic.PlasticMethodImpl$2.doBuild(PlasticMethodImpl.java:221)
> at
>
> 

Re: TAPESTRY-1908

2016-03-19 Thread Kalle Korhonen
I suspect you are talking about
https://issues.apache.org/jira/browse/TAPESTRY-1908 instead of
https://issues.apache.org/jira/browse/TAP5-1908? The actively worked T5
issues are in the TAP5 namespace. The former is a *nine years* old issue
with a sample code to get it to do what you want. Furthermore, the beanType
can by all means determined at runtime, that's exactly how Tynamo's
tapestry-model (http://www.tynamo.org/tapestry-model+guide/) works.
Object.getClass() works only for the simplest cases. Quite often you want
to specify an interface as the beanType for your model.

Kalle

On Wed, Mar 16, 2016 at 8:00 AM, WILBERT Romain-ext <
romain.wilbert-...@pole-emploi.fr> wrote:

> Hello,
>
> I disagree with the closing of this defect, because it could happen that
> the object type is defined at runtime:
>
> -  the Property type of object parameter can be an interface
> -  the object parameter can be instanciated on activation
> regarding activation context
>
> Why just not figure the beanType from object.getClass() ?
>
> Greets
>


Re: Calling method after CommitAfter call

2016-02-24 Thread Kalle Korhonen
On Wed, Feb 24, 2016 at 12:27 PM, g kuczera  wrote:

> Sorry for not editing the post properly, I accidentally sent it by pressing
> the space few times (first time using the fullscreen editing on gmail).
>
> So, the question is if the hibernate Interceptor is the way to go? Do you
> have any other idea how to be 100% sure that my method from observer will
> be called after committing the changes?
>

The obvious choice is to manually commit the transaction, then notify the
observers. @CommitAfter is fine for simple cases but if the transaction is
rolled back, it doesn't allow you to react to it. If you still prefer
annotation, you could try out
https://github.com/satago/tapestry-jpa-transactions that support pre/after
commit hooks.

Kalle



> 2016-02-24 21:23 GMT+01:00 g kuczera :
>
> > Hi guys,
> > I embedded the ApplicationSubmitForm (component) in my Page. If it is
> > successfully validated, the onSuccessFromNewApplicationForm method is
> > called:
> >
> > private Set observers;
> >
> >   @CommitAfter
> >   public void onSuccessFromNewApplicationForm() {
> >
> > Application application = new Application();
> > application.setStatus(/* some value */);
> > application.setRegistrationDate(new Date());
> >
> > notifyObservers(application, true);
> >   }
> >
> > One of the observers - there is a field *observers*, which is a set -
> > sends an event to the mailing server. In 99% cases it works fine, but
> > sometimes the second application (on the different server), while
> checking
> > if an application indicated by the given id exists, does not find the
> > record. There is nothing like that in the database yet.
> >
> > It looks that the above module is badly designed. It does not matter that
> > there is the CommitAfter annotation, if I call the methods which assume
> > that everything is commited from within the commiting method.
> >
> > Am I right?
> >
> >
> >
>


Re: Save File Dialog after response building

2016-02-12 Thread Kalle Korhonen
Yes, so if you respond to an ajax request with a page response, T5 will
send you a json snippet {"redirectURL" : "your.redirect.url"} and handles
redirecting to it from the client. In this case you are responding with a
StreamResponse so T5 gets confused. If you wanted to do an ajax update,
it's totally possible. You just need to move your StreamResponse to a new
page and return (a link to) this page from your event handler. The possible
advantage is that you can have testable download urls for your files, like
/downloadfile/somefile.tmp.

The DownloadFile page would simply contain something like this:

public class DownloadFile {
StreamResponse onActivate(String fileId) throws IOException {
return new StreamResponse() {...}
}
}

Your event handler should return a page object or an URL, check
http://tapestry.apache.org/page-navigation.html for more info.

Kalle



On Fri, Feb 12, 2016 at 1:46 PM, h3ph3st0s  wrote:

> Found the solution. I did have the zone part. So it was really ajax call.
> ( But this is as defined from the tutorial ).
> I removed that and now this works smoothly.
>
> As a case is closed from me. But what if I put back the zone in order to
> update in ajax way the form ?
>
> Best regards, happy to test a very simple framework such as this
>
> On 2016-02-12 16:50, h3ph3st0s wrote:
>
>> Hi,
>> The thing is that I see the tree of directories and files. That's awesome.
>> But to download file really, I need to right click and choose the "save
>> target as". Then file dialog  pops up and I can download really the
>> file to my client disk.
>> If I don't, the response is getting some how lost in the communication
>> since I have error like this:
>> *Communication with the server failed: TypeError: Unable to get property
>> 'redirectURL' of undefined or null *
>>
>> It seems for me that, the StreamResponse expects something as output,
>> which in the Jumpstart tutorial is there but I can not see it myself.
>> On the other hand I need to trigger somehow this file dialog in order to
>> allow user choose the folder to leave the file.
>>
>> Dimitris
>>
>> On 2016-02-12 16:32, Nathan Quirynen wrote:
>>
>>> You mean the file gets downloaded immediately to some download folder?
>>> I think this is a setting of the used browser where a default location
>>> has been set opposed to the setting where the browser will always ask for
>>> the location.
>>> So I'm afraid you don't really have control over this if I am correct.
>>>
>>> Nathan
>>>
>>> On 12/02/16 15:15, h3ph3st0s wrote:
>>>
 Hi,

 I am new to  Tapestry version 5. where I built a treemodel, which
 presents the files inside the catalog,

 />>> t:value="classificationNode">
 
 
 >>> t:event="leafSelected" t:context="classificationNode.name"
 t:zone="selectedZone" class="prop:leafClass"
 href="#">
 ${treeNode.label}
 
 
 
 ${treeNode.label}
 
 
 /

 and by clicking one of the files I build a StreamResponse ( I used the
 snippet from the jumpstart code ( page:
 http://jumpstart.doublenegative.com.au/jumpstart/examples/navigation/returntypes1
 )

 The function is :

 /public Object onLeafSelected(final String classificationId) {
 System.out.println(classificationId);
 System.out.println(regFile.get(classificationId));
 final File file = new File( regFile.get(classificationId) );
 return new StreamResponse() {
 InputStream inputStream;

 @Override
 public void prepareResponse(Response response) {
 ClassLoader classLoader =
 Thread.currentThread().getContextClassLoader();
 try {
 inputStream = new FileInputStream(file);
 try {
 response.setHeader("Content-Length", "" +
 inputStream.available());
 }
 catch (IOException e) {
 // Ignore the exception in this simple example.
 }
 } catch (FileNotFoundException e1) {
 // TODO Auto-generated catch block
 e1.printStackTrace();
 }//classLoader.getResourceAsStream(regFile.get(classificationId));

 // Set content length to prevent chunking - see
 //
 http://tapestry-users.832.n2.nabble.com/Disable-Transfer-Encoding-chunked-from-StreamResponse-td5269662.html#a5269662

 }


Re: Tapestry is a sinking Ship

2016-02-12 Thread Kalle Korhonen
For Eclipse, you want to install Dmitry Gusev's excellent Tapestry plugin
https://github.com/anjlab/eclipse-tapestry5-plugin.

By the way, I agree with your comments about javascript documentation. It's
great if you've been working with Javascript and AMD modules before, but
totally lost if you haven't.

Kalle

On Fri, Feb 12, 2016 at 2:28 PM, h3ph3st0s  wrote:

> Hi, I met your framework couple days ago. From Wednsday till this moment,
> I managed to compile a pet project in maven, loaded in eclipse, studied
> code, started to work in an agile but solo way and now I have:
> 4 screens under tabbed layout
> 1 page with grid and a form to submit a simple information
> 1 page with dynamic editable grid which has paging and IS NOT losing
> information during paging without using weird calls server-client
> 1 page that loads a whole directory as TreeBrowser. The user can access
> the nodes and can download each node when it is a file. AWESOME.
> 1 page that uploads files. Just that.
>
> And this is an application for a customer to present. I find the framework
> pretty good, fast if you have some proper solid guidance, such as jumpstart
> ( very nice ).
> And I believe that it has so tight connection to javascript is a must in
> comparison to proprietary adversaries with proprietary language tags.
>
> So all this I did it in 2 days. I have experience with other framework
> again in Java so some concepts are not new. Not even the model how to
> combine parts.
>
> I would like to share what I didn't like for reference.
>
>  * I didn't fully grasp how to handle Javascript. After all I want to
>incorporate a plain javascript so simple as alert hello in my page
>and I got lost with the explanations in various pages. Really that
>needs fix. To tell the truth I just wanted to make some
>event.stopPropagate commands over palette object!.sad story
>
>  * The eclipse does not have autocomplete for the tml files. But it is
>not so bad. ( I didn't look myself very hard to find it.probably
>didn't want it that much )
>
>  * Last I do not understand why someone built a palette object and not
>a simple Listbox for a start.
>
> I wish all the best for a very nice job you have done
> Cheers
> Dimitris
>
>
> On 2016-02-13 0:08, joe schacher wrote:
>
>> i still know what he/she is gonna do about it.
>>
>> On Fri, Feb 12, 2016 at 5:07 PM, Stephen Nutbrown 
>> wrote:
>>
>> The only reason you email the Tapestry users group is because Tapestry
>>> Users has many subscribers.
>>>
>>> The only reason Tapestery Users has many subscribers is because Tapestry
>>> is
>>> not dead.
>>>
>>>
>>>
>>> On 12 February 2016 at 22:00, David Taylor <
>>> david.tay...@extensiatech.com>
>>> wrote:
>>>
>>> If Tapestry is so terrible, why waste all the energy? Just to be

>>> obnoxious?
>>>
 We would abandon Tapestry tomorrow if it weren't so bloody fast and easy
 to extend.


 emailsig On 2/12/2016 3:53 PM, Thiago H de Paula Figueiredo wrote:

 On Fri, 12 Feb 2016 17:19:28 -0200, Emmanuel Sowah 
> wrote:
>
> Hi Tapestry sect,
>
> The state of Tapestry now is very bad, as Howard and all the other
>
>> commiters have abandoned it.
>>
>> This is not true. Just check Jira and the Git logs.
>
> Even Thiago has secretly abandoned Tapestry.
> I have not, and you're telling a lie.
>
> I'm just answering this troll because of the lies he keeps on
> spreading,
> which are bordering on defamation.
>
>
>
 -
 To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org
 For additional commands, e-mail: users-h...@tapestry.apache.org



>


Re: Commit After not working after migrating to IntelliJ

2016-02-04 Thread Kalle Korhonen
Yes Chris is right (see
https://github.com/apache/tapestry-5/blob/master/tapestry-hibernate/src/main/java/org/apache/tapestry5/internal/hibernate/CommitAfterWorker.java),
you need to depend on tapestry-hibernate. tapestry-hibernate-core is for
non-web projects (where you need the advisor to tell to ioc when to commit).

Kalle

On Thu, Feb 4, 2016 at 6:47 AM, Chris Poulsen 
wrote:

> I have not used the hibernate integration myself. But my guess is that you
> should depend on tapestry-hibernate instead of tapestry-hibernate-core
> As far as I can tell from the sources, the CommitAfterWorker class lives in
> that module.
>
> HTH.
>
> --
> Chris
>
> On Thu, Feb 4, 2016 at 2:39 PM, abangkis  wrote:
>
> > Hi Dmitry, thanks for the response. I understand that if you wan't to do
> a
> > commit from your DAO (for example if your DAO is invoke by a scheduler,
> or
> > other non user interaction) you need to add the transaction advice. But
> in
> > my understanding if the action is from a tapestry page, you just need to
> > add the commit after annotation on the page. I did this successfully in a
> > few project when I'm still using eclipse. So i was wondering if this an
> > intellij/jetty/gradle thing that a more experienced user of the IDE might
> > know.
> >
> > On another note, this is also the first time I''m using maven based
> > dependency, maybe there's something on there too :)
> >
> > On Thu, Feb 4, 2016 at 8:29 PM, Dmitry Gusev 
> > wrote:
> >
> > > Hi,
> > >
> > > I think you're missing the transaction advice, it's mentioned at the
> > bottom
> > > on this page:
> > > https://tapestry.apache.org/hibernate-user-guide.html
> > >
> > > Finally, you should use the HibernateTransactionAdvisor to add
> > transaction
> > > advice:
> > > @Match("*DAO")
> > > public static void adviseTransactions(HibernateTransactionAdvisor
> > advisor,
> > > MethodAdviceReceiver receiver)
> > > {
> > > advisor.addTransactionCommitAdvice(receiver);
> > > }
> > >
> > > This advice method is configured to match against any service whose id
> > ends
> > > with "DAO", such as "PersonDAO".
> > >
> > > The advisor scans the service interface and identifies any methods with
> > the
> > > @CommitAfter annotation.
> > >
> > > On Thu, Feb 4, 2016 at 4:03 PM, abangkis  wrote:
> > >
> > > > I managed to setup and import the simple project to github if anyone
> > have
> > > > the time to look at it. https://github.com/abangkis/CommitTest.
> First
> > > time
> > > > using git, let me know if something is missing.
> > > >
> > > > Thanks
> > > >
> > > > On Thu, Feb 4, 2016 at 5:53 AM, abangkis  wrote:
> > > >
> > > > > Hello, I've just recently migrated from Eclipse + Ant + Tomcat to
> > > > IntelliJ
> > > > > IDEA 15 CE + Gradle + Jetty. At first all of my development setup
> is
> > > > > working fine and then I realized that my @CommitAfter annotation is
> > not
> > > > > being honored, while other query runs fine. I'm using Tapestry
> 5.4.0
> > > from
> > > > > jcenter.
> > > > >
> > > > > To confirm my problem, I created a simple project with a single
> page
> > > with
> > > > > an add method:
> > > > >
> > > > > @CommitAfter
> > > > > public void onActionFromAdd(){
> > > > > logger.debug("trying add with commit after");
> > > > >
> > > > > User user = new User();
> > > > > user.setPassword("");
> > > > > user.setName("testing user 3");
> > > > >
> > > > > userManager.add(user);
> > > > > //try {
> > > > > //manager.commit();
> > > > > //} catch (Exception e) {
> > > > > //e.printStackTrace();
> > > > > //}
> > > > >
> > > > > }
> > > > >
> > > > >
> > > > > If i manually commit using Injected HibernateSessionManager in the
> > > page,
> > > > > it will work. But using @CommitAfter annotation isn't. Anybody know
> > why
> > > > is
> > > > > this happening?
> > > > >
> > > > > Thanks
> > > > >
> > > > > --
> > > > > http://www.mreunionlabs.net/ 
> > > > > twitter : @mreunionlabs @abangkis
> > > > > page : https://plus.google.com/104168782385184990771
> > > > >
> > > >
> > > >
> > > >
> > > > --
> > > > http://www.mreunionlabs.net/ 
> > > > twitter : @mreunionlabs @abangkis
> > > > page : https://plus.google.com/104168782385184990771
> > > >
> > >
> > >
> > >
> > > --
> > > Dmitry Gusev
> > >
> > > AnjLab Team
> > > http://anjlab.com
> > >
> >
> >
> >
> > --
> > http://www.mreunionlabs.net/ 
> > twitter : @mreunionlabs @abangkis
> > page : https://plus.google.com/104168782385184990771
> >
>


Tapestry-conversations 0.2.0 released!

2016-01-27 Thread Kalle Korhonen
We aim to serve. A user asked for a T5.4 compatible version of
conversations module and we delivered. Upgrading the module was pure joy
and it is a testament to the outstanding backwards compatibility record T5
has had throughout its existence. Note that I had written the original
version for Tapestry 5.0 while we were still called the Trails framework!
Checkout the http://www.tynamo.org/tapestry-conversations+guide/ for more
info.

**Release notes**

- Update to tapestry 5.4 [#1](
https://github.com/tynamo/tapestry-conversations/issues/1)


Re: registry startup issue

2016-01-26 Thread Kalle Korhonen
You are using a version of plastic that's incompatible with the version of
tapestry-core and/or JVM you are using. Check your classpath for multiple
version of these libs. It's always a good idea to state upfront the
versions you are using to save others from the guesswork.

Kalle

On Tue, Jan 26, 2016 at 7:56 PM, John Coleman 
wrote:

>  any ideas, some of these services won't construct?
>
>
> public EmailServiceImpl(AssetSource assetSource, Logger logger, Messages
> messages)
> throws IOException {
>
>
>
> [ERROR] ioc.Registry Operations trace:
> [ERROR] ioc.Registry [ 1] Creating proxy for service RegistryStartup
> [WARNING] Failed startup of context o.e.j.m.p.JettyWebAppContext@b00ad9
>
> {/audit,file:/C:/Temp/Audit%20Manager/src/main/webapp/,STARTING}{file:/C:/Temp/Audit%20Manager/src/main/webapp/}
> org.apache.tapestry5.ioc.internal.OperationException: Error building
> service proxy for service 'RegistryStartup' (at
> org.apache.tapestry5.ioc.internal.services.RegistryStartup(Logger, List)
> (at RegistryStartup.java:36) via
> org.apache.tapestry5.ioc.services.TapestryIOCModule.bind(ServiceBinder) (at
> TapestryIOCModule.java:49)): java.lang.IllegalArgumentException
> at
>
> org.apache.tapestry5.ioc.internal.OperationTrackerImpl.logAndRethrow(OperationTrackerImpl.java:121)
> at
>
> org.apache.tapestry5.ioc.internal.OperationTrackerImpl.invoke(OperationTrackerImpl.java:88)
> at
>
> org.apache.tapestry5.ioc.internal.PerThreadOperationTracker.invoke(PerThreadOperationTracker.java:87)
> at
>
> org.apache.tapestry5.ioc.internal.RegistryImpl.invoke(RegistryImpl.java:1124)
> at org.apache.tapestry5.ioc.internal.ModuleImpl.create(ModuleImpl.java:332)
> at
> org.apache.tapestry5.ioc.internal.ModuleImpl.access$100(ModuleImpl.java:39)
> at
> org.apache.tapestry5.ioc.internal.ModuleImpl$1.invoke(ModuleImpl.java:191)
> at
>
> org.apache.tapestry5.ioc.internal.util.ConcurrentBarrier.withWrite(ConcurrentBarrier.java:140)
> at
> org.apache.tapestry5.ioc.internal.ModuleImpl$2.invoke(ModuleImpl.java:207)
> at
>
> org.apache.tapestry5.ioc.internal.util.ConcurrentBarrier.withRead(ConcurrentBarrier.java:85)
> at
>
> org.apache.tapestry5.ioc.internal.ModuleImpl.findOrCreate(ModuleImpl.java:213)
> at
>
> org.apache.tapestry5.ioc.internal.ModuleImpl.getService(ModuleImpl.java:109)
> at
>
> org.apache.tapestry5.ioc.internal.RegistryImpl.getService(RegistryImpl.java:421)
> at
>
> org.apache.tapestry5.ioc.internal.RegistryImpl.performRegistryStartup(RegistryImpl.java:325)
> at
>
> org.apache.tapestry5.ioc.internal.RegistryWrapper.performRegistryStartup(RegistryWrapper.java:80)
> at org.apache.tapestry5.TapestryFilter.init(TapestryFilter.java:118)
> at org.eclipse.jetty.servlet.FilterHolder.initialize(FilterHolder.java:137)
> at
>
> org.eclipse.jetty.servlet.ServletHandler.initialize(ServletHandler.java:817)
> at
>
> org.eclipse.jetty.servlet.ServletContextHandler.startContext(ServletContextHandler.java:300)
> at
> org.eclipse.jetty.webapp.WebAppContext.startWebapp(WebAppContext.java:1359)
> at
>
> org.eclipse.jetty.webapp.WebAppContext.startContext(WebAppContext.java:1352)
> at
>
> org.eclipse.jetty.server.handler.ContextHandler.doStart(ContextHandler.java:744)
> at org.eclipse.jetty.webapp.WebAppContext.doStart(WebAppContext.java:497)
> at
>
> org.eclipse.jetty.maven.plugin.JettyWebAppContext.doStart(JettyWebAppContext.java:282)
> at
>
> org.eclipse.jetty.util.component.AbstractLifeCycle.start(AbstractLifeCycle.java:68)
> at
>
> org.eclipse.jetty.util.component.ContainerLifeCycle.start(ContainerLifeCycle.java:125)
> at
>
> org.eclipse.jetty.util.component.ContainerLifeCycle.doStart(ContainerLifeCycle.java:107)
> at
>
> org.eclipse.jetty.server.handler.AbstractHandler.doStart(AbstractHandler.java:60)
> at
>
> org.eclipse.jetty.server.handler.ContextHandlerCollection.doStart(ContextHandlerCollection.java:154)
> at
>
> org.eclipse.jetty.util.component.AbstractLifeCycle.start(AbstractLifeCycle.java:68)
> at
>
> org.eclipse.jetty.util.component.ContainerLifeCycle.start(ContainerLifeCycle.java:125)
> at
>
> org.eclipse.jetty.util.component.ContainerLifeCycle.doStart(ContainerLifeCycle.java:107)
> at
>
> org.eclipse.jetty.server.handler.AbstractHandler.doStart(AbstractHandler.java:60)
> at
>
> org.eclipse.jetty.util.component.AbstractLifeCycle.start(AbstractLifeCycle.java:68)
> at
>
> org.eclipse.jetty.util.component.ContainerLifeCycle.start(ContainerLifeCycle.java:125)
> at org.eclipse.jetty.server.Server.start(Server.java:358)
> at
>
> org.eclipse.jetty.util.component.ContainerLifeCycle.doStart(ContainerLifeCycle.java:107)
> at
>
> org.eclipse.jetty.server.handler.AbstractHandler.doStart(AbstractHandler.java:60)
> at org.eclipse.jetty.server.Server.doStart(Server.java:325)
> at org.eclipse.jetty.maven.plugin.JettyServer.doStart(JettyServer.java:68)
> at
>
> org.eclipse.jetty.util.component.AbstractLifeCycle.start(AbstractLifeCycle.java:68)
> at
>
> 

Re: maven build dependency problems

2016-01-20 Thread Kalle Korhonen
kaptcha 2.3 is still available from Sonatype's forge repo at
https://repository.sonatype.org/content/groups/forge/com/google/code/kaptcha/kaptcha/2.3/.


T5.3 needs to depend on that version because it is the last version still
built with jdk1.5.

However, T5.4 switched to https://github.com/axet/kaptcha and as I recall,
it was a drop-in replacement so it should work for T5.3 as well (that is if
you are not limited to Java 1.5 yourself).

Kalle

On Tue, Jan 19, 2016 at 11:45 PM, John Coleman <qbyteconsult...@gmail.com>
wrote:

> You are right Kalle, I ended up removing a bunch of repos from the build
> and it worked. I had to obtain google kaptcha 2.3 from an archive and
> install it on the local repository because this also has gone off-line.
>
> John
>
> On Wed, Jan 20, 2016 at 1:40 PM, Kalle Korhonen <
> kalle.o.korho...@gmail.com>
> wrote:
>
> > No, I think you should remove extra repository references. Codehaus went
> > bust more than 8 months ago. Track down where codehaus repo is being
> > referenced and remove it. If you need the org.got5.tapestr5-jquery
> library,
> > use the versions available at Maven central:
> > http://repo1.maven.org/maven2/org/got5/tapestry5-jquery/
> >
> > Kalle
> >
> > On Tue, Jan 19, 2016 at 9:54 PM, Prakash Manjeshwar <
> > pvmanjesh...@gmail.com>
> > wrote:
> >
> > > Looks like repository issue with codehous.
> > >
> > > Check the section "For Tapestry 5.3 users: " at:
> > > https://github.com/got5/tapestry5-jquery
> > >
> > > You may have to add repositories.
> > >
> > > ---
> > > Regards,
> > > Prakash
> > >
> > >
> > > On 20 January 2016 at 10:29, John Coleman <qbyteconsult...@gmail.com>
> > > wrote:
> > >
> > > > Can anyone shed light on this please?
> > > >
> > > >
> > > > [INFO] [ERROR] Failed to execute goal on project AuditManager: Could
> > not
> > > > resolve
> > > >  dependencies for project
> **.audit:AuditManager:war:3.1.5-SNAPSHOT:
> > > > Failed t
> > > > o collect dependencies for
> [org.apache.tapestry:tapestry-core:jar:5.3.6
> > > > (compile
> > > > ), org.apache.tapestry:tapestry-yuicompressor:jar:5.3.6 (compile),
> > > > org.testng:te
> > > > stng:jar:5.14.10 (test), org.easymock:easymock:jar:3.0 (test),
> > > > org.apache.tapest
> > > > ry:tapestry-test:jar:5.3.6 (test), javax.servlet:servlet-api:jar:2.5
> > > > (provided),
> > > >  org.apache.tapestry:tapestry-javadoc:jar:5.3.6 (provided),
> > > > se.unbound:tapestry-
> > > > breadcrumbs:jar:1.9 (compile), epulse.tapestry:tapx-datefield:jar:1.2
> > > > (compile),
> > > >  org.got5:tapestry5-jquery:jar:3.3.7 (compile),
> > > > org.apache.tapestry:tapestry-jpa
> > > > :jar:5.3.5 (compile), javax.mail:mail:jar:1.4.5 (compile),
> > > > org.eclipse.persisten
> > > > ce:eclipselink:jar:2.4.1 (compile),
> net.sourceforge.jtds:jtds:jar:1.2.7
> > > > (compile
> > > > ), postgresql:postgresql:jar:9.1-901.jdbc4 (compile),
> > > > javax.annotation:jsr250-ap
> > > > i:jar:1.0 (compile), org.apache.commons:commons-io:jar:1.3.2
> (compile),
> > > > eu.epuls
> > > > e.auditmanager:sentinelplus:jar:1.0.0 (compile),
> > > > org.apache.tapestry:tapestry-ka
> > > > ptcha:jar:5.3.5 (compile),
> > commons-beanutils:commons-beanutils:jar:1.8.3
> > > > (compil
> > > > e), org.apache.commons:commons-email:jar:1.3.2 (compile)]: Failed to
> > read
> > > > artifa
> > > > ct descriptor for org.got5:tapestry5-jquery:jar:3.3.7: Could not
> > transfer
> > > > artifa
> > > > ct org.got5:tapestry5-jquery:pom:3.3.7 from/to Codehaus repo (
> > > > http://nexus.codeh
> > > > aus.org/content/repositories/releases/org/codehaus/mojo): Error
> > > > transferring fil
> > > > e: nexus.codehaus.org: Unknown host nexus.codehaus.org -> [Help 1]
> > > >
> > >
> >
>


Re: maven build dependency problems

2016-01-19 Thread Kalle Korhonen
No, I think you should remove extra repository references. Codehaus went
bust more than 8 months ago. Track down where codehaus repo is being
referenced and remove it. If you need the org.got5.tapestr5-jquery library,
use the versions available at Maven central:
http://repo1.maven.org/maven2/org/got5/tapestry5-jquery/

Kalle

On Tue, Jan 19, 2016 at 9:54 PM, Prakash Manjeshwar 
wrote:

> Looks like repository issue with codehous.
>
> Check the section "For Tapestry 5.3 users: " at:
> https://github.com/got5/tapestry5-jquery
>
> You may have to add repositories.
>
> ---
> Regards,
> Prakash
>
>
> On 20 January 2016 at 10:29, John Coleman 
> wrote:
>
> > Can anyone shed light on this please?
> >
> >
> > [INFO] [ERROR] Failed to execute goal on project AuditManager: Could not
> > resolve
> >  dependencies for project **.audit:AuditManager:war:3.1.5-SNAPSHOT:
> > Failed t
> > o collect dependencies for [org.apache.tapestry:tapestry-core:jar:5.3.6
> > (compile
> > ), org.apache.tapestry:tapestry-yuicompressor:jar:5.3.6 (compile),
> > org.testng:te
> > stng:jar:5.14.10 (test), org.easymock:easymock:jar:3.0 (test),
> > org.apache.tapest
> > ry:tapestry-test:jar:5.3.6 (test), javax.servlet:servlet-api:jar:2.5
> > (provided),
> >  org.apache.tapestry:tapestry-javadoc:jar:5.3.6 (provided),
> > se.unbound:tapestry-
> > breadcrumbs:jar:1.9 (compile), epulse.tapestry:tapx-datefield:jar:1.2
> > (compile),
> >  org.got5:tapestry5-jquery:jar:3.3.7 (compile),
> > org.apache.tapestry:tapestry-jpa
> > :jar:5.3.5 (compile), javax.mail:mail:jar:1.4.5 (compile),
> > org.eclipse.persisten
> > ce:eclipselink:jar:2.4.1 (compile), net.sourceforge.jtds:jtds:jar:1.2.7
> > (compile
> > ), postgresql:postgresql:jar:9.1-901.jdbc4 (compile),
> > javax.annotation:jsr250-ap
> > i:jar:1.0 (compile), org.apache.commons:commons-io:jar:1.3.2 (compile),
> > eu.epuls
> > e.auditmanager:sentinelplus:jar:1.0.0 (compile),
> > org.apache.tapestry:tapestry-ka
> > ptcha:jar:5.3.5 (compile), commons-beanutils:commons-beanutils:jar:1.8.3
> > (compil
> > e), org.apache.commons:commons-email:jar:1.3.2 (compile)]: Failed to read
> > artifa
> > ct descriptor for org.got5:tapestry5-jquery:jar:3.3.7: Could not transfer
> > artifa
> > ct org.got5:tapestry5-jquery:pom:3.3.7 from/to Codehaus repo (
> > http://nexus.codeh
> > aus.org/content/repositories/releases/org/codehaus/mojo): Error
> > transferring fil
> > e: nexus.codehaus.org: Unknown host nexus.codehaus.org -> [Help 1]
> >
>


Re: T5.3.8 ClassNotFound error ONLY when running on a virtualized server?!

2016-01-18 Thread Kalle Korhonen
In my experience, the "weird errors" you see in virtualized production
environments where JVM is unrestricted (unlike Google App Engine or RedHat
OpenShift) are almost never caused by the environment itself but some
small, fairly simple differences between your dev/test and production
environments. "Unable to locate class" is almost certainly caused by
Plastic not being able to instantiate your custom exception report page.
Could be a small missing dependency or anything else but errors that happen
in the exception handling chain are not always clearly reported, and this
case "not able to locate" is probably a bit misleading when that class
likely threw an exception while being instantiated.

For the actual error at JobHistoryManager.java:429, why would you even post
this without sharing the code with us? I guarantee it's not just because
its "somehow not liking the virtualized server" but without seeing the
code, all we can do is guess.

Kalle

On Mon, Jan 18, 2016 at 4:49 PM, George Ludwig 
wrote:

> Andreas, yes, I am 100% certain that the specific directories are readable
> and writable by Tomcat. In fact, prior to this exception being thrown, a
> different file is successfully read and written.
>
> Still scratching my head.
>
> On Mon, Jan 18, 2016 at 12:04 PM, Andreas Fink 
> wrote:
>
> > Hi George.
> >
> > Are you sure the specific directory and its content is readable by
> Tomcat?
> > Maybe some File-specific exceptions get silently catched on the way and
> > substituted with 'null' instead of empty array.
> >
> > Just my 2c.
> >
> > Cheers,
> > Andi.
> >
> > On 18 Jan 2016, at 2:06 , George Ludwig  wrote:
> >
> > > At that
> > > time it's trying to convert a Set of files to a List of files, and I
> can
> > > see that the directory that is being listed clearly has files, so the
> NPE
> > > should never have been thrown.
> >
> >
> > -
> > To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org
> > For additional commands, e-mail: users-h...@tapestry.apache.org
> >
> >
>


Re: T5.4 and OLD Hibernate 3x

2016-01-11 Thread Kalle Korhonen
You could try backing out the tapestry-hibernate and
tapestry-hibernate-core libs to a T5.4 version before beta-17 (see
http://markmail.org/message/yeqlybz6hivwwcxk#query:+page:1+mid:ahfcfibfff2t6ueu+state:results).
They were not available via Maven central and the staging repos are not
available anymore so you'd have to build from the tag yourself. No
guarantee that it'd work but there were fairly few changes (I know because
I did the update originally).

The 4.x Hibernate update was committed to the main branch over three
years(!) ago, so if I were you, I'd just bite the bullet and update to
Hibernate 4.x. I know, it always sucks upgrade several libs at once.

Kalle

On Mon, Jan 11, 2016 at 4:47 PM, Jens Breitenstein 
wrote:

> Hi Thiago, thanks for your answer!
>
>
>
> After some "more" dependency exclusions, the following (hibernate related)
> libs are left:
>
>  * org.apache.tapestry:tapestry-hibernate:5.4.0
>  * org.apache.tapestry:tapestry-hibernate-core:5.4.0
>
> and
>
>  * org.hibernate.javax.persistence:hibernate-jpa-2.0-api:1.0.1.Final
>  * org.hibernate:hibernate-commons-annotations:3.2.0.Final
>  * org.hibernate:hibernate-core:3.6.10.Final
>  * org.hibernate:hibernate-validator:3.1.0.GA
>
> But the error still exists.
>
> org.apache.tapestry5.ioc.internal.OperationException: Error invoking
> method public static org.apache.tapestry5.hibernate.HibernateSessionManager
> org.apache.tapestry5.hibernate.modules.HibernateCoreModule.buildHibernateSessionManager(org.apache.tapestry5.hibernate.HibernateSessionSource,org.apache.tapestry5.ioc.services.PerthreadManager):
> org.hibernate.SessionFactory.openSession()Lorg/hibernate/Session;
> at
> org.apache.tapestry5.ioc.internal.OperationTrackerImpl.logAndRethrow(OperationTrackerImpl.java:186)
> at
> org.apache.tapestry5.ioc.internal.OperationTrackerImpl.invoke(OperationTrackerImpl.java:90)
> at
> org.apache.tapestry5.ioc.internal.PerThreadOperationTracker.invoke(PerThreadOperationTracker.java:72)
> at
> org.apache.tapestry5.ioc.internal.RegistryImpl.invoke(RegistryImpl.java:1260)
> at
> org.apache.tapestry5.ioc.internal.util.ConstructionPlan.createObject(ConstructionPlan.java:61)
> at
> org.apache.tapestry5.ioc.internal.ServiceBuilderMethodInvoker.createObject(ServiceBuilderMethodInvoker.java:61)
> at
> org.apache.tapestry5.ioc.internal.OperationTrackingObjectCreator$1.invoke(OperationTrackingObjectCreator.java:47)
> at
> org.apache.tapestry5.ioc.internal.OperationTrackerImpl.invoke(OperationTrackerImpl.java:82)
> at
> org.apache.tapestry5.ioc.internal.PerThreadOperationTracker.invoke(PerThreadOperationTracker.java:72)
> at
> org.apache.tapestry5.ioc.internal.RegistryImpl.invoke(RegistryImpl.java:1260)
> at
> org.apache.tapestry5.ioc.internal.OperationTrackingObjectCreator.createObject(OperationTrackingObjectCreator.java:51)
> at
> org.apache.tapestry5.ioc.internal.services.PerthreadManagerImpl$DefaultObjectCreator.createObject(PerthreadManagerImpl.java:275)
> at $HibernateSessionManager_142885567b0747b9.delegate(Unknown Source)
> at $HibernateSessionManager_142885567b0747b9.getSession(Unknown Source)
> at $HibernateSessionManager_142885567b0746e9.getSession(Unknown Source)
> at $Session_142885567b0747b8.readProperty(Unknown Source)
> at $Session_142885567b0747b8.createCriteria(Unknown Source)
> at $Session_142885567b074696.createCriteria(Unknown Source)
> 
> Caused by: java.lang.RuntimeException: Error invoking method public static
> org.apache.tapestry5.hibernate.HibernateSessionManager
> org.apache.tapestry5.hibernate.modules.HibernateCoreModule.buildHibernateSessionManager(org.apache.tapestry5.hibernate.HibernateSessionSource,org.apache.tapestry5.ioc.services.PerthreadManager):
> org.hibernate.SessionFactory.openSession()Lorg/hibernate/Session;
> at
> org.apache.tapestry5.ioc.internal.util.MethodInvoker.invoke(MethodInvoker.java:63)
> at
> org.apache.tapestry5.ioc.internal.util.LoggingInvokableWrapper.invoke(LoggingInvokableWrapper.java:43)
> at
> org.apache.tapestry5.ioc.internal.OperationTrackerImpl.invoke(OperationTrackerImpl.java:82)
> ... 116 more
> Caused by: java.lang.NoSuchMethodError:
> org.hibernate.SessionFactory.openSession()Lorg/hibernate/Session;
> at
> org.apache.tapestry5.internal.hibernate.HibernateSessionSourceImpl.create(HibernateSessionSourceImpl.java:71)
> at $HibernateSessionSource_142885567b0746b3.create(Unknown Source)
> at
> org.apache.tapestry5.internal.hibernate.HibernateSessionManagerImpl.(HibernateSessionManagerImpl.java:31)
> at
> org.apache.tapestry5.hibernate.modules.HibernateCoreModule.buildHibernateSessionManager(HibernateCoreModule.java:96)
> at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
> at
> sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
> at
> 

Re: Zone Update with POST

2016-01-08 Thread Kalle Korhonen
For handling POST, I'd utilize Tynamo's tapestry-resteasy (
http://www.tynamo.org/tapestry-resteasy+guide/). JS could be something like
this:

$.ajax({
   url: 'http://my.server.com/editor/save',
   data: data,
   error: function() {
   },
   dataType: 'json',
   success: function(data) {
   },
   type: 'POST'});

JAX-WS EditorResourceImpl.java:

@Path("/editor")
public class EditorResourceImpl implements EditorResource {
@Path("/save")
@POST
@Consumes(MediaType.APPLICATION_JSON)
@Produces(MediaType.APPLICATION_JSON)
@CommitAfter
public Map saveContents(EditorContents contents) {
...
}
}

Kalle


On Fri, Jan 8, 2016 at 4:25 AM, Torsten Weber 
wrote:

> Hello,
>
> I am using an editor written in javascript. When someone clicks on "save"
> data should be sent to Tapestry and a zone should be updated.
>
> Currently in javascript I call:
>
> zoneManager.deferredZoneUpdate(zoneId, zoneUrlWithContent).
>
> zoneUrlWithContent contains the content of the editor as parameter and I
> retrieve the content in  Tapestry with:
>
> Object onSave(@RequestParameter(allowBlank=true, value="content") final
> String content) { .. }
>
>
>
> Now I want to send the content by POST because the size of URLs is limited
> to 8192 characters.
>
>
> Can you give me an example (JS and Tapestry event handler in Tapestry 5.4)?
>
>
> Thanks in advance.
> T.W.
>


Re: Where does Tapestry fit today

2015-12-26 Thread Kalle Korhonen
On Fri, Dec 25, 2015 at 1:22 PM, Alex Kotchnev  wrote:

> These days, HTML5 + javascript single page apps are all the rage. The whole
> approach of having a rich javascript-based client (e.g. something based on
> Angular) that uses REST-ful services, although not incompatible w/
> Tapestry, certainly doesn't quite fit very well .
>

Is it Tapestry or Java that doesn't quite fit well? Having been using
JAX-RS (via tapestry-resteasy of course) paired with an Ember frontend now
for some months, JAX-RS always feels a bit cumbersome and never quite
fitting. Some of the fault is with Ember and it's modules though (but after
Ember's clear and predictable roadmap, ember-cli and friends, I'm not going
back to Angular). But even still, I can see why node.js is a popular choice
as the back-end for the single page apps.

For me personally, I'd love to use a different framework for building web
apps if it was better. The problem with most other contenders I've tried is
that they are nowhere near as comprehensive as Tapestry. They may shine in
some areas but often horribly lack in others.

Sometimes it's the language itself. I've always hated Java's syntax (coming
from Delphi, Smalltalk background) but I just don't get how people get by
without actual threads. Certainly there are many infoapps that merely
input/output data but as soon as you start doing some real number
crunching, it better run on the background and in parallel. I've seen so
many RoR and Python implementation that started out clean and small, then
somewhere along the way required one other service for this and another
service for that, deploying some C libraries, perhaps a few front-end
servers for scalability etc. etc. and before you know it, the time of all
of your engineers is spent on debugging some weird issues that nobody
really fully understands.

Even if it's not the complexity that causes dislike in me, it's the
performance. Nowadays, you can always "just spin up another instance" but
nobody ever thinks about the cost. In a fairly recent case (based on T5.3),
we were serving 17,000 requests/minute at peak times from a single node for
pennies on the dollar. I've seen a VC-backed startup serving 10,000
requests per day on a Heroku deployed RoR implementation and paying
$400/month for it. Compared to personnel and other costs, of course it's
peanuts but I just hate to imagine what something like that costs if it
ever became truly popular.

Anyhow, I guess you mainly wanted comments about the single page apps, not
about infrastructure. I return to the issue with deployment complexity.
Often the single page app still need supporting "static" pages, except
these pages are never quite static. They need common templates, perhaps a
little dynamic section here, up-to-date information there and so it goes...
Of course, you are always free to a totally different tool for these pages
but what I like in Tapestry is that you can do it all with it.

I'd love to know if there's another web framework that has built-in support
for common design patterns and makes it possible to easily implement
aspects like tapestry-security-jpa (
http://www.tynamo.org/tapestry-security-jpa+guide/). A lot in Tapestry is
just for dealing with Java's rigidity and certainly in languages like Ruby
or Javascript, you can always hack stuff together but too often, it quickly
becomes a huge, messy hairball when there's less structure.

Kalle


So, I would be curious to learn from everyone in the community where
> Tapestry still fits in the modern world. Is there a particular niche where
> a component-based server-side framework like Tapestry still fits very well
> ? Or does it need to focus on other usages to maybe work better w/ "modern"
> approaches for developing web apps ? Where do people in the community use
> Tapestry (and it works well) ?
>
> Cheers - Alex K
>


Re: [ANNOUNCE] Apache Tapestry 5.4

2015-12-25 Thread Kalle Korhonen
No, T5.4 was still firmly headed by Howard. He created the first T5.4
branch over three years (see for example
http://tapestryjava.blogspot.com/2012/10/zeroing-in-on-tapestry-54.html)
and you can see the results of his mastermind everywhere in the T5.4 code.
I guess you could say it was the first release not finished by Howard.

Kalle


On Thu, Dec 24, 2015 at 10:23 AM, Alex Kotchnev  wrote:

> Pretty epic, congrats to all who contributed and participated ! Most
> notably, this seems like the first Tapestry release that was not headed by
> Howard (of course, I don't have any stats to back that up).
>
> Cheers - Alex K
>
> On Tue, Dec 22, 2015 at 8:48 PM, Bob Harner  wrote:
>
> > The Apache Tapestry developers are proud to announce that Tapestry 5.4,
> > a long-awaited major release, is now available for immediate download:
> >
> > http://tapestry.apache.org/download
> >
> > Tapestry 5.4 represents a tremendous effort by a large number of
> > people, and includes almost 200 enhancements and over 300 bug fixes.
> > Full details are in the release notes, but here are a few highlights:
> >
> > * A JavaScript abstraction layer that removes Tapestry's dependence
> > on Prototype and lets you swap in jQuery (or potentially other
> > JavaScript framewords) instead.
> >
> > * JavaScript modules based on RequireJS
> >
> > * A new module, tapestry-webresources, which provides support for
> > automatically compiling CoffeeScript into JavaScript and Less into
> > CSS, and for minimizing CSS and JavaScript. And, best of all, this
> > processing takes place at runtime.
> >
> > * Greatly improved asset caching based on the checksums of file
> > contents, to intelligently cache assets like images and CSS only
> > until their content changes.
> >
> > * The adoption of Bootstrap 3 CSS styling by default, with built-in
> > glyphicon support.
> >
> > ... and many dozens of other significant changes.
> >
> > Despite all the changes, Tapestry 5.4 is still mostly a drop-in
> replacement
> > for
> > 5.3 users, with the caveat that the adoption of Bootstrap 3 CSS may
> require
> > some
> > CSS tweaks if you're not already using Bootstrap 3.
> >
> > Please see https://tapestry.apache.org/release-notes-54.html for a full
> > list of
> > changes and upgrade instructions.
> >
>


Tapestry-security 0.6.3 and tapestry-model 0.6.0 for T5.4 released!

2015-12-14 Thread Kalle Korhonen
Hey all,

at this time we have two T5.4 compatible release announcements to make.
First tapestry-security 0.6.3:

While working on securing an Ember frontend with Tapestry backend, I
noticed that tynamo-resteasy didn't want to play well with security. I'm
fairly surprised this issue surfaced only now because tapestry-security is
fairly well battle tested. Anyhow, if you've ever had a problem with T5.4
and tapestry-security not being able obtain assigned roles or user identity
from the request, it's time to upgrade.

**Release notes**

- Update to T5.4-rc-1 [#25](
https://github.com/tynamo/tapestry-security/issues/25)
- Store ShiroHttpServletRequest to RequestGlobals before processing [#24](
https://github.com/tynamo/tapestry-security/issues/24)

---
tapestry-model 0.6.0:

Finally, we have an officially compatible release tapestry-model for T5.4
available. We had one long running issue with the changes in tapestry core
and it wasn't until T5.4-rc1 before it was all sorted out. The official
release note is short but there's been lots of great functional changes to
the core.

**Release notes**

- Fix the test suite to use changed form element names [#4](
https://github.com/tynamo/tapestry-model/issues/4)
- 0.5.2 has a dependency on eclipselink [#2](
https://github.com/tynamo/tapestry-model/issues/2)

Happy holidays,
from your friendly Tynamo team


Re: Frontend Frameworks / Libraries

2015-09-15 Thread Kalle Korhonen
On Tue, Sep 15, 2015 at 9:34 AM, Harry Zhou <superha...@gmail.com> wrote:

> Would appreciate your advice on how to setup Ember for T5.4. I imagine the
> way would be defining an init module that requires via shim ember (also
> ember-data, etc.) and @import that module on the Tapestry page. But what is
> the most logical place to put custom ember code, and how best to link that
> custom code to the init module?
>

I've mentioned something about it earlier in this message thread and there
was a different thread on it as well where Andreas Andreou shared his
experiences. Because of the ember-cli, and all the pretty cool transpiling,
minifying etc. tools, I really wouldn't try to embed the Ember scripts into
a T5 app but make it a separate app and run them together. It's easy to
package an ember app into .war if you need to - basically just zip up the
contents of /dist. Then just deploy those two wars together. The only other
thing you need to take care of is that the two applications can talk to
each other by adding the right CORS+CSP headers (see
https://en.wikipedia.org/wiki/Cross-origin_resource_sharing for more). If
you really wanted embed the scripts into a T5 application, I'd just
contribute the two different js files, the .js and vendor.js that
Ember spits out at the end as Javascript modules but I'd say developing
them together is too clunky that way.

Kalle



> On Mon, Sep 14, 2015 at 6:31 PM, Thiago H de Paula Figueiredo <
> thiag...@gmail.com> wrote:
>
> > On Mon, 14 Sep 2015 14:21:46 -0300, Kalle Korhonen <
> > kalle.o.korho...@gmail.com> wrote:
> >
> > React and Ember Fastboot solve the SEO problem by rendering the first
> load
> >> on server, but Angular doesn't offer the same functionality natively.
> >> There's https://prerender.io/ though, but it's another component you
> need
> >> to deploy.
> >>
> >
> > I like the concept of isomorphic webapps: the same JavaScript used in the
> > client-side is used in the server-side for doing an initial rendering.
> >
> > The links above demonstrate it for Spring MVC, but I believe it could be
> > very easily done with Tapestry too:
> >
> http://winterbe.com/posts/2015/02/16/isomorphic-react-webapps-on-the-jvm/
> >
> >
> https://speakerdeck.com/sdeleuze/isomorphic-templating-with-spring-boot-nashorn-and-react
> >
> >
> >
> >> Kalle
> >>
> >> On Mon, Sep 14, 2015 at 6:20 AM, George Christman <
> >> gchrist...@cardaddy.com>
> >> wrote:
> >>
> >> Very nice Arve, do you have any experience making these angular pages
> SEO
> >>> friendly?
> >>>
> >>> On Sun, Sep 6, 2015 at 11:08 AM, Arve Klev <arvek...@gmail.com> wrote:
> >>>
> >>> >  Hello.
> >>> > Yes it is VERY easy to to use AngularJS (or eg.
> >>> Highchart/Raphael/JChart)
> >>> > with Tapestry 5.4.
> >>> > Use Tapestry as usual and let different pages do what you want (eg.
> one
> >>> > page as an AngularJS SPA).
> >>> > Every page use the same Layout component.
> >>> >
> >>> > 1. Place angular.js in src/main/resources/META-INF/modules/angular.js
> >>> > 2. Create a file
> >>> src/main/resources/META-INF/modules/angular-bootstrap.js
> >>> > that bootstrap angular and your own angular code
> >>> > 3. Create a file
> src/main/resources/META-INF/modules/my-angular-code.js
> >>> > 4. Create a file
> src/main/resources/META-INF/assets/my-angular-code.css
> >>> for
> >>> > decoration
> >>> > 5. Import angular-bootstrap.js and my-angular-code.css in your
> >>> class-file:
> >>> > @Import(module = { "angular-bootstrap" }, stylesheet = {
> >>> > "my-angular-code.css" })
> >>> >
> >>> > I have a running example here: http://tap54-arvek.rhcloud.com
> >>> > The code at GitHub:
> >>> > https://github.com/arvek-xx/tapestry54-javascript-examples
> >>> >
> >>> > In the "NgPhones"-page, I use a rest-service to retrieve data.
> >>> >
> >>> >
> >>> > Sincerely, Arve Klev
> >>> >
> >>> > 2015-08-10 19:59 GMT+02:00 Taha Siddiqi <tawus.tapes...@gmail.com>:
> >>> >
> >>> > > Well my way is to spend sometime on anything I find interesting...
> >>> > > (Usually  Saturday mornings)
> >>> > >
> >>> > > That is how I found tapestr

Re: Frontend Frameworks / Libraries

2015-09-14 Thread Kalle Korhonen
React and Ember Fastboot solve the SEO problem by rendering the first load
on server, but Angular doesn't offer the same functionality natively.
There's https://prerender.io/ though, but it's another component you need
to deploy.

Kalle

On Mon, Sep 14, 2015 at 6:20 AM, George Christman <gchrist...@cardaddy.com>
wrote:

> Very nice Arve, do you have any experience making these angular pages SEO
> friendly?
>
> On Sun, Sep 6, 2015 at 11:08 AM, Arve Klev <arvek...@gmail.com> wrote:
>
> >  Hello.
> > Yes it is VERY easy to to use AngularJS (or eg. Highchart/Raphael/JChart)
> > with Tapestry 5.4.
> > Use Tapestry as usual and let different pages do what you want (eg. one
> > page as an AngularJS SPA).
> > Every page use the same Layout component.
> >
> > 1. Place angular.js in src/main/resources/META-INF/modules/angular.js
> > 2. Create a file src/main/resources/META-INF/modules/angular-bootstrap.js
> > that bootstrap angular and your own angular code
> > 3. Create a file src/main/resources/META-INF/modules/my-angular-code.js
> > 4. Create a file src/main/resources/META-INF/assets/my-angular-code.css
> for
> > decoration
> > 5. Import angular-bootstrap.js and my-angular-code.css in your
> class-file:
> > @Import(module = { "angular-bootstrap" }, stylesheet = {
> > "my-angular-code.css" })
> >
> > I have a running example here: http://tap54-arvek.rhcloud.com
> > The code at GitHub:
> > https://github.com/arvek-xx/tapestry54-javascript-examples
> >
> > In the "NgPhones"-page, I use a rest-service to retrieve data.
> >
> >
> > Sincerely, Arve Klev
> >
> > 2015-08-10 19:59 GMT+02:00 Taha Siddiqi <tawus.tapes...@gmail.com>:
> >
> > > Well my way is to spend sometime on anything I find interesting...
> > > (Usually  Saturday mornings)
> > >
> > > That is how I found tapestry and now Clojure/clojusescript, mongo,
> Titan
> > > graphs etc... So exciting !!
> > >
> > > Sent from my iPhone
> > >
> > > > On Aug 10, 2015, at 9:01 PM, George Christman <
> gchrist...@cardaddy.com
> > >
> > > wrote:
> > > >
> > > > I think the choices these days are starting to become very
> > overwhelming,
> > > I
> > > > wish there was a magic bullet eliminating all these choices. I'd like
> > to
> > > > pick a new frontend framework, but with all the advise from the
> > different
> > > > sources, I don't think I know enough anymore to make an educated
> > > decision.
> > > >
> > > > On Sat, Aug 8, 2015 at 5:18 AM, Taha Siddiqi <
> tawus.tapes...@gmail.com
> > >
> > > > wrote:
> > > >
> > > >> For me it is om(or reactjs). I am currently in the process of
> > replacing
> > > >> JavaScript  in one of my JavaScript intense Tapestry project with
> > > >> om/ClojureScript.
> > > >>
> > > >> Sent from my iPhone
> > > >>
> > > >>>> On Aug 8, 2015, at 11:41 AM, Kalle Korhonen <
> > > kalle.o.korho...@gmail.com>
> > > >>> wrote:
> > > >>>
> > > >>>> On Fri, Aug 7, 2015 at 3:40 PM, françois facon <
> fra.fa...@gmail.com
> > >
> > > >> wrote:
> > > >>>>
> > > >>>> About Ember, I looking for an equivalent of
> > > >>>> https://docs.angularjs.org/tutorial.
> > > >>>
> > > >>> I haven't found anything quite as comprehensive for Ember. One
> issue
> > > with
> > > >>> Ember is that many of these tutorials are outdated because its
> > changed
> > > so
> > > >>> fast. The official documentation is often too simplistic when you
> are
> > > new
> > > >>> to it but trying to build something real. However, this one is
> fairly
> > > >>> up-to-date and helped me quite a bit when I started out:
> > > >>>
> http://www.fnaweso.me/ember-js-nested-routing-with-multiple-outlets/
> > > >>>
> > > >>> At least for me, working with AngularJS feels more like working
> with
> > T5
> > > >>> services and its IoC whereas working with Ember feels more like
> > writing
> > > >> T5
> > > >>> components and I felt right at home with all the Ember conventions.
> > And
> > > >>> while it's relatively easy to boots

Re: Redirect on exception

2015-09-10 Thread Kalle Korhonen
On Thu, Sep 10, 2015 at 7:56 AM, Nathan Quirynen <
nat...@pensionarchitects.be> wrote:

> How can I set a redirect when an exception has been thrown?
> But this seems to only work for non-XHR requests? Or did I forget
> something here?
>

If you are on T5.4, you can simply contribute an exception type -> error
page map to the DefaultRequestExceptionHandler. It handles XHR requests as
well. See
http://tapestry.apache.org/5.4/apidocs/org/apache/tapestry5/internal/services/DefaultRequestExceptionHandler.html
.

Kalle


Re: Redirect on exception

2015-09-10 Thread Kalle Korhonen
On Thu, Sep 10, 2015 at 8:47 AM, Nathan Quirynen <
nat...@pensionarchitects.be> wrote:

> I'm still on 5.3.7. Can't update to 5.4 yet sadly.
> Any options for 5.3.7?


You can get the same functionality as an external module:
http://www.tynamo.org/tapestry-exceptionpage+guide/

Kalle


>
>
> On 10/09/15 17:45, Kalle Korhonen wrote:
>
>> On Thu, Sep 10, 2015 at 7:56 AM, Nathan Quirynen <
>> nat...@pensionarchitects.be> wrote:
>>
>> How can I set a redirect when an exception has been thrown?
>>> But this seems to only work for non-XHR requests? Or did I forget
>>> something here?
>>>
>>> If you are on T5.4, you can simply contribute an exception type -> error
>> page map to the DefaultRequestExceptionHandler. It handles XHR requests as
>> well. See
>>
>> http://tapestry.apache.org/5.4/apidocs/org/apache/tapestry5/internal/services/DefaultRequestExceptionHandler.html
>> .
>>
>> Kalle
>>
>>
> -
> To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org
> For additional commands, e-mail: users-h...@tapestry.apache.org
>
>


Re: Redirect on exception

2015-09-10 Thread Kalle Korhonen
On Thu, Sep 10, 2015 at 9:41 AM, Nathan Quirynen <
nat...@pensionarchitects.be> wrote:

> Ok so I added the library by adding this in my pom.xml:
> | org.tynamo
> tapestry-exceptionpage 0.1.2
> |
> Then added following in my AppModule:
> public void contributeExceptionHandler(MappedConfiguration<Class,
> Class> configuration) {
> configuration.add(Exception.class, Error.class);
> }
> So I just added "throw new RuntimeException()" somewhere in a page to test
> it, but it is not going to the error page, still tapestry its default
> exception reporting.
> Anything else I have to configure?


No, that should be it. Are you sure the module is loaded ? You could use
@SubModule to make sure.

Kalle



> On 10/09/15 18:19, Kalle Korhonen wrote:
>
>> On Thu, Sep 10, 2015 at 8:47 AM, Nathan Quirynen <
>> nat...@pensionarchitects.be> wrote:
>>
>> I'm still on 5.3.7. Can't update to 5.4 yet sadly.
>>> Any options for 5.3.7?
>>>
>>
>> You can get the same functionality as an external module:
>> http://www.tynamo.org/tapestry-exceptionpage+guide/
>>
>> Kalle
>>
>>
>>
>>> On 10/09/15 17:45, Kalle Korhonen wrote:
>>>
>>> On Thu, Sep 10, 2015 at 7:56 AM, Nathan Quirynen <
>>>> nat...@pensionarchitects.be> wrote:
>>>>
>>>> How can I set a redirect when an exception has been thrown?
>>>>
>>>>> But this seems to only work for non-XHR requests? Or did I forget
>>>>> something here?
>>>>>
>>>>> If you are on T5.4, you can simply contribute an exception type ->
>>>>> error
>>>>>
>>>> page map to the DefaultRequestExceptionHandler. It handles XHR requests
>>>> as
>>>> well. See
>>>>
>>>>
>>>> http://tapestry.apache.org/5.4/apidocs/org/apache/tapestry5/internal/services/DefaultRequestExceptionHandler.html
>>>> .
>>>>
>>>> Kalle
>>>>
>>>>
>>>> -
>>> To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org
>>> For additional commands, e-mail: users-h...@tapestry.apache.org
>>>
>>>
>>>
>


Re: Frontend Frameworks / Libraries

2015-08-08 Thread Kalle Korhonen
On Fri, Aug 7, 2015 at 3:40 PM, françois facon fra.fa...@gmail.com wrote:

 About Ember, I looking for an equivalent of
 https://docs.angularjs.org/tutorial.


I haven't found anything quite as comprehensive for Ember. One issue with
Ember is that many of these tutorials are outdated because its changed so
fast. The official documentation is often too simplistic when you are new
to it but trying to build something real. However, this one is fairly
up-to-date and helped me quite a bit when I started out:
http://www.fnaweso.me/ember-js-nested-routing-with-multiple-outlets/

At least for me, working with AngularJS feels more like working with T5
services and its IoC whereas working with Ember feels more like writing T5
components and I felt right at home with all the Ember conventions. And
while it's relatively easy to bootstrap AngularJS to run as part of T5 app,
it really doesn't make sense with all the bits and pieces of Ember tooling,
the CLI etc (there was an earlier thread about that and I followed Andreas
Andreou's advice). Ember is more comprehensive than AngularJS and its
router is incredibly useful for mapping out a structure for larger spas.

Kalle



 2015-08-07 22:18 GMT+02:00 Kalle Korhonen kalle.o.korho...@gmail.com:

  It's pretty easy. Don't build component event requests but just send
  REST(-like) requests that are either processed by plain Tapestry pages
 and
  its EventContext. If you are building a more comprehensive spa then
  consider pairing the client with JAX-WS resource backend (i.e.
  http://www.tynamo.org/tapestry-resteasy+guide/ for T5). Incidentally,
 I've
  been working with spas lately as well, and moved from AngularJS to Ember.
 
  Kalle
 
  On Fri, Aug 7, 2015 at 12:46 PM, Bob Harner bobhar...@gmail.com wrote:
 
   Yes a page/event. As long as the URL looks like a tapestry event
 request,
   you can handle the request in an event handler method within the page's
   Java class, and return JSON.
  
   On Fri, Aug 7, 2015 at 2:40 PM, George Christman 
  gchrist...@cardaddy.com
   wrote:
  
Hi guys, I've been playing around with AngularJS and backbone
 recently
   and
I'm wondering if it's pretty easy to use with Tapestry? I'm more
   concerned
with ajax events etc. I know in grails you can just point your url
 to a
controller/action, would we do something similar in Tapestry, but
   obviously
not a controller, but a page / event?
   
  
 



Re: Frontend Frameworks / Libraries

2015-08-07 Thread Kalle Korhonen
It's pretty easy. Don't build component event requests but just send
REST(-like) requests that are either processed by plain Tapestry pages and
its EventContext. If you are building a more comprehensive spa then
consider pairing the client with JAX-WS resource backend (i.e.
http://www.tynamo.org/tapestry-resteasy+guide/ for T5). Incidentally, I've
been working with spas lately as well, and moved from AngularJS to Ember.

Kalle

On Fri, Aug 7, 2015 at 12:46 PM, Bob Harner bobhar...@gmail.com wrote:

 Yes a page/event. As long as the URL looks like a tapestry event request,
 you can handle the request in an event handler method within the page's
 Java class, and return JSON.

 On Fri, Aug 7, 2015 at 2:40 PM, George Christman gchrist...@cardaddy.com
 wrote:

  Hi guys, I've been playing around with AngularJS and backbone recently
 and
  I'm wondering if it's pretty easy to use with Tapestry? I'm more
 concerned
  with ajax events etc. I know in grails you can just point your url to a
  controller/action, would we do something similar in Tapestry, but
 obviously
  not a controller, but a page / event?
 



Re: Multiple domains, one webapp

2015-08-06 Thread Kalle Korhonen
On Wed, Aug 5, 2015 at 4:12 PM, Stephen Nutbrown steves...@gmail.com
wrote:

 Seems to be working for me too! Thanks.
 The only issue I am having is that my code for hibernate doesn't seem to
 work quite as expexted. Ideally, this should be picked up from the happylib
 public static void
 contributeHibernateEntityPackageManager(ConfigurationString
 configuration) {
 configuration.add(com.my.package.myentities);
 }
 However I am finding it only seems to work for me if it's in the main
 projects AppModule.java, perhaps I have configured something wrong, or
 perhaps this has to be in app module rather than in my shared jar?


I suspect the HappyModule configuration isn't read at all. That's because
you don't have a manifest when you are reading the classes directly from
the the target path rather than from a jar. Often, you need to explicitly
specify @SubModule(HappyModule.class) (or @ImportModule in T5.4) in your
AppModule when you are developing multiple libraries at the same time (or,
doing integration testing of your modules).

Kalle


 I've put the hibernate entities that are shared between the projects in
 there and so ideally the code should be in the shared library rather than
 duplicated in both webapps (although it works as it is... any ideas what
 may cause that?)

 Thanks,
 Steve
 On 5 Aug 2015 21:42, Svein-Erik Løken sv...@jacilla.no wrote:

  WOW! Multi-module in Tapestry with Live Class Reloading is fantastic!
  Thanks for pointing me in the right direction Thiago!
 
  To get live class reloading work for the common module in IntelliJ: Open
  Project Structure, Project Settings  Modules. Select the common module 
  Paths  Compiler output. Set Output path to the same path as the main
  project output path.
 
  I have created a multi-module maven demo project for test and
  documentation. A page in the main project includes a component-class from
  the common module. I have demo of using assets (img and js-modules) and
 IoC
  service. Everything works with Live Class Reloading.
 
  I am using a top-level pom (dependencyManagement, pluginManagement,
  properties), a modules pom (maven-root), the main project (war), and the
  common module (jar).
 
  The main project and common module is both created from mvn
  -DarchetypeArtifactId=quickstart ..., with necessary modification.
 
  I have documented all steps to make everything working in IntelliJ
 (plugin
  configuration etc).
 
 
  
   As long as the compiler target folder of the included
   library/module/subproject is included in the classpath of the main
   project, regardless of what tool you're using, live class reloading
 will
   work after a class in the library/module/subproject is recompiled.
 Maybe
   Eclipse makes it easier because it compiles automatically on save. I
  don't
   know how IDEA handles this.
  
  
   --
   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: [T5.4 build 22] Exception in ExceptionReport.tml

2015-07-24 Thread Kalle Korhonen
Noticed you had asked the same question on Stackoverflow (
http://stackoverflow.com/questions/31477722/tapestry-5-4-exception-in-exceptionreport-tml/31598497)
so I replied there. The problem is related to GAE's restrictions on
spawning new threads.

Kalle

On Sat, Jul 18, 2015 at 8:00 AM, Michał Więckowski 
michal.wieckows...@gmail.com wrote:

 This is not my excepton page - This is standard tapestry exception page.
 It appears when there is an error in application and shows where is
 problem.
 18 lip 2015 11:50 mailingl...@j-b-s.de mailingl...@j-b-s.de
 napisał(a):

  What exactly are you doing on your exception page? This error looks like
 a
  new thread is created which is not possible in GAE
 
  Jens
 
 
 
  Von meinem iPhone gesendet
 
   Am 18.07.2015 um 10:47 schrieb Michał Więckowski 
  michal.wieckows...@gmail.com:
  
   Hello everyone,
  
   I've got a question regarding tapestry 5.4. I try to integrate my
   application with tynamo tapestry security and Google App Engine.  After
   some development I started to get these exception when something in
   application is not working. I have written something because problem
   concerns ExceptionPage (as you can see on stacktrace attached below).
   Has anybody faced such a problem?
  
   Of course I can post some configuration files, but since I have no idea
   what can cause this exception of error page, I not posing any at the
   moment.
  
  
  HTTP ERROR 500
  
  Problem accessing /. Reason:
  
  org.apache.tapestry5.internal.services.RenderQueueException:
  Render
   queue error in SetupRender[core/ExceptionReport:loop_0]: Failure
 reading
   parameter 'source' of component core/ExceptionReport:loop_0: access
  denied
   (java.lang.RuntimePermission modifyThreadGroup) [at
   classpath:org/apache/tapestry5/corelib/pages/ExceptionReport.tml, line
  110]
  Caused by:
  
  org.apache.shiro.subject.ExecutionException:
   org.apache.tapestry5.internal.services.RenderQueueException: Render
 queue
   error in SetupRender[core/ExceptionReport:loop_0]: Failure reading
   parameter 'source' of component core/ExceptionReport:loop_0: access
  denied
   (java.lang.RuntimePermission modifyThreadGroup) [at
   classpath:org/apache/tapestry5/corelib/pages/ExceptionReport.tml, line
  110]
  at
  
 
 org.apache.shiro.subject.support.DelegatingSubject.execute(DelegatingSubject.java:385)
  at
  
 
 org.tynamo.security.services.impl.SecurityConfiguration.service(SecurityConfiguration.java:54)
  at $HttpServletRequestFilter_12a67d391b5c.service(Unknown Source)
  at $HttpServletRequestHandler_12a67d391b5f.service(Unknown Source)
  at
  
 org.apache.tapestry5.internal.gzip.GZipFilter.service(GZipFilter.java:59)
  at $HttpServletRequestHandler_12a67d391b5f.service(Unknown Source)
  at
  
 
 org.apache.tapestry5.internal.services.IgnoredPathsFilter.service(IgnoredPathsFilter.java:62)
  at $HttpServletRequestFilter_12a67d391b59.service(Unknown Source)
  at $HttpServletRequestHandler_12a67d391b5f.service(Unknown Source)
  at
  
 
 org.apache.tapestry5.modules.TapestryModule$1.service(TapestryModule.java:804)
  at $HttpServletRequestHandler_12a67d391b5f.service(Unknown Source)
  at $HttpServletRequestHandler_12a67d391b58.service(Unknown Source)
  at
  org.apache.tapestry5.TapestryFilter.doFilter(TapestryFilter.java:166)
  at
  
 
 org.mortbay.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1157)
  at
  
 
 com.google.appengine.api.socket.dev.DevSocketFilter.doFilter(DevSocketFilter.java:74)
  at
  
 
 org.mortbay.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1157)
  at
  
 
 com.google.appengine.tools.development.ResponseRewriterFilter.doFilter(ResponseRewriterFilter.java:127)
  at
  
 
 org.mortbay.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1157)
  at
  
 
 com.google.appengine.tools.development.HeaderVerificationFilter.doFilter(HeaderVerificationFilter.java:34)
  at
  
 
 org.mortbay.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1157)
  at
  
 
 com.google.appengine.api.blobstore.dev.ServeBlobFilter.doFilter(ServeBlobFilter.java:63)
  at
  
 
 org.mortbay.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1157)
  at
  
 
 com.google.apphosting.utils.servlet.TransactionCleanupFilter.doFilter(TransactionCleanupFilter.java:43)
  at
  
 
 org.mortbay.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1157)
  at
  
 
 com.google.appengine.tools.development.StaticFileFilter.doFilter(StaticFileFilter.java:125)
  at
  
 
 org.mortbay.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1157)
  at
  
 
 com.google.appengine.tools.development.DevAppServerModulesFilter.doDirectRequest(DevAppServerModulesFilter.java:366)
  at
  
 
 

Re: Advanced transaction support for tapestry JPA applications

2015-07-24 Thread Kalle Korhonen
Thanks Dmitry, looks excellent. Even so that I don't see any reason we
shouldn't merge this to tapestry's core JPA integration at some point. I
didn't read the code that carefully, but do the injectable JPA
entitylisteners also support (totally non-spec) constructor injection? Do
you know if the corresponding
org.hibernate.jpa.AvailableSettings.CDI_BEAN_MANAGER
is available in EclipseLink configuration and if so, what's the name of the
property?

Kalle

On Thu, Jul 23, 2015 at 2:03 PM, Dmitry Gusev dmitry.gu...@gmail.com
wrote:

 Hello Tapestry users!

 I would like to share with you a new small tapestry5 library that may be
 helpful for tapestry JPA applications:

 https://github.com/satago/tapestry-jpa-transactions

 1) It overrides @CommitAfter annotation with support for nested calls (only
 top-most method will actually commit transaction)
 2) Simple service for wrapping Runnable/Invokable objects with transactions
 when you need precise control over transactions
 3) Before/after commit callbacks
 4) Support @Injects in entity listeners when used with JPA 2.1

 Please see GitHub readme for details.

 It's built against tapestry 5.3.7, but should also work with latest 5.4
 versions (not tested).


 --
 Dmitry Gusev

 AnjLab Team
 http://anjlab.com



Re: [T5.4] 5.4-beta-32 on Maven Central / T5.4 Release Schedule

2015-07-14 Thread Kalle Korhonen
Not all of the preview versions were voted on and thus were not officially
released. Tags were created and the latest is available via the staging
repo (
https://repository.apache.org/content/repositories/orgapachetapestry-1057/).
However, we are just voting on switching to a 5.4 release candidate @dev so
rest assured, a release will happen in the next few weeks and a final
sometime in the Fall (by my guess).

Kalle

On Tue, Jul 14, 2015 at 3:28 AM, Thilo Tanner thilo.tan...@reprisk.com
wrote:

 Hi all,

 On the Github mirror, I’ve seen that 5.4-beta-32 was released a while ago,
 but the latest version isn’t available neither on Maven Central nor on
 Apache Releases. Is there anything I can contribute / help to make it
 happen?

 What are the release plans for Tapestry 5.4? We’re currently evaluating
 technologies to migrate a legacy application to Java (in a micro service
 manner). I really like Tapestry and if possible I would love to use it for
 the web layer, but we also need to mitigate risks by choosing widely-used
 and future-proof technologies, so we will be able to outsource parts of the
 work to third-party developers.

 Thanks and best,
 Thilo


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



[OT] Hosting

2015-06-10 Thread Kalle Korhonen
It's that time again. I need a cheap hosting for development  testing of a
low memory profile T5 app. Prices of VPS plans have been dropping in recent
years. I'm rather suspicious of ultra-low ($2-$5/month) shared Tomcat plans
but could try out one that's found to be reliable. I've used Tektonic's VPS
for different things for years but looks like there are cheaper
alternatives today, for example http://www.interserver.net/vps/. Can
anybody recommend anything else? AWS is not a good option for me as the
instance will be doing something all the time. Openshift is too
restrictive, I need more control on the container configuration. Jelastic
is my favorite by far in terms of flexibility but too expensive for this
type.

Kalle


Re: [OT] Hosting

2015-06-10 Thread Kalle Korhonen
Thanks Thiago. I'd be happy to give you a referral if it checks out. How do
they not describe on the features page if SSH access is included. But I
trust you. I hate comparing providers because they never tell you the same
information (best yet, don't tell how much memory is allocated...) SSD is
certainly valuable (another thing providers don't mention unless they offer
it). However, doesn't seem to beat interserver's pricing of $6/month (for
1024MB RAM). I'm fine with OpenVZ rather than KVM.

Kalle

On Wed, Jun 10, 2015 at 6:35 PM, Thiago H de Paula Figueiredo 
thiag...@gmail.com wrote:

 Hello, Kalle!

 I use Digital Ocean and I like it very much. Full Linux VPS with root
 access starting at 5 dollars per month for 512 MB of RAM, 20 GB of SSD
 storage and 1 TB of transfer.

 shamelessPlugHere's my referral URL:
 https://www.digitalocean.com/?refcode=112272022761/shamelessPlug :D


 On Wed, 10 Jun 2015 20:58:15 -0300, Kalle Korhonen 
 kalle.o.korho...@gmail.com wrote:

  It's that time again. I need a cheap hosting for development  testing of
 a
 low memory profile T5 app. Prices of VPS plans have been dropping in
 recent
 years. I'm rather suspicious of ultra-low ($2-$5/month) shared Tomcat
 plans
 but could try out one that's found to be reliable. I've used Tektonic's
 VPS
 for different things for years but looks like there are cheaper
 alternatives today, for example http://www.interserver.net/vps/. Can
 anybody recommend anything else? AWS is not a good option for me as the
 instance will be doing something all the time. Openshift is too
 restrictive, I need more control on the container configuration. Jelastic
 is my favorite by far in terms of flexibility but too expensive for this
 type.

 Kalle



 --
 Thiago H. de Paula Figueiredo
 Tapestry, Java and Hibernate consultant and developer
 http://machina.com.br



Re: T5.3.7 + Tynamo Security - User ASO creation after authc/authz

2015-04-29 Thread Kalle Korhonen
On Wed, Apr 29, 2015 at 12:41 PM, Daniel Jue teamp...@gmail.com wrote:

 Hi, I'm getting hung up on something that's probably really simple to fix.
 I have a Tomcat+LDAP configuration that is doing Authc and Authz for
 me--All I have to do is look in the request header to see the user
 principal and log the dude/dudette in.

 So I'm using the built in factory.authc filter on some of my paths that
 need protecting.

 Here's where I'm at:  In the legacy code I have now, the user would have a
 G_User.class ASO created on the Layout component (my own class to hold user
 stuff).  I'd like to move that ASO creation closer to the code where the
 user is deemed authenticated (i.e. outside of a particular component or
 page).   I feel like this is possible, I'm just missing something.

 There's some user class creation stuff going on inside of the
 FederatedAccounts test application UserRealm, but it's not setting an ASO.

 Should I be setting the ASO in a custom Realm or ??


The ASO and authentication are orthogonal concepts. Especially given that
you only have authenticated users in your T5 app, you want to create the
ASO after the user is authenticated.

For the login flow, your hunch is right about looking into
federatedaccounts. However, what you want is to invoke Subject.login by the
time the subject is created by overriding SubjectFactory. Take a look at
https://github.com/tynamo/tynamo-federatedaccounts/blob/master/tynamo-federatedaccounts-rollingtokens/src/main/java/org/tynamo/security/rollingtokens/RollingTokensModule.java
and the accompanying RollingTokenAutoLoginAdvice. That code is more
complicated than you need - you don't have to create an advice but you can
simply override the service (this particular module adds an advice so that
user code can still override the SubjectFactory if needed). Your realm then
handles normal authentication/authorization based on the LdapToken that
your SubjectFactory created (using the request header).

For the ASO, you quite possibly want something like this:

public RequestFilter buildCurrentUserFilter(final UserService
userService,
final ApplicationStateManager applicationStateManager, final
HttpServletRequest servletRequest) {
return new RequestFilter() {
public boolean service(Request request, Response response,
RequestHandler handler) throws IOException {
if (servletRequest.getRemoteUser() != null 
!applicationStateManager.exists(CurrentUser.class)) {
applicationStateManager.get(CurrentUser.class);
}
return handler.service(request, response);
}
};
}

@Contribute(RequestHandler.class)
public void addRequestFilters(OrderedConfigurationRequestFilter
configuration,
@InjectService(currentUserFilter) RequestFilter
currentUserFilter) {
configuration.add(currentUser, currentUserFilter,
after:StoreIntoGlobals);
}

@SuppressWarnings(rawtypes)
@Contribute(ApplicationStateManager.class)
public void addApplicationStateCreators(MappedConfigurationClass,
ApplicationStateContribution configuration,
final HttpServletRequest request, final UserService userService,
final CookieSource cookieSource) {

ApplicationStateCreatorCurrentUser currentUserCreator = new
ApplicationStateCreatorCurrentUser() {
public CurrentUser create() {
return new CurrentUserImpl(userService, cookieSource);
}
};

configuration.add(CurrentUser.class, new
ApplicationStateContribution(session, currentUserCreator));
}

Kalle


Re: SSL/TSL for the tapestry tynamo rest

2015-04-17 Thread Kalle Korhonen
I'm not sure what you mean by mapping the web.xml to the rest pattern but
the easiest scenario is if you want to make your application only TLS
accessible. If your TLS endpoint is application container (Tomcat, Jetty,
etc..) then you just need edit the server configuration files and point it
to your certificate (not the web.xml), for Tomcat see
http://tomcat.apache.org/tomcat-7.0-doc/ssl-howto.html#Configuration. If
you have a http proxy in front (such as Apache Httpd, Nginx) then you need
to do the same configuration there and also let your application container
know that you want to return https urls even if your container sees only
incoming http requests (for Tomcat, you edit the context configuration
files). Tapestry, tynamo-resteasy or tynamo-federatedaccounts barely enter
the picture here. @Secure is only needed if you have a mixed http/https
application (see https://tapestry.apache.org/https.html).

Kalle

On Fri, Apr 17, 2015 at 4:35 PM, Boris Horvat horvat.z.bo...@gmail.com
wrote:

 Does anyone have any idea where to start with this?

 I have enabled the rest using tynamo resteasy so now I am wondering do I
 need to do anything special in the application to make it SSL/TSL
 protected?

 Is it as simple as enabling the SSL/TSL on the host and mapping the web.xml
 to the rest pattern?

 Could tynamo-federatedaccounts help with this?

 Do I need to use tapestry @Secure annotation?

 (I do understand that those are pretty vague question but still hoping for
 answer before I just run my head against the wall and see what happens)

 Thanks
 Boris



Re: IoC Service, call a method after instantiation/realization

2015-04-12 Thread Kalle Korhonen
Also, if you are using Hibernate or JPA, you should definitely check out
http://tynamo.org/tapestry-hibernate-seedentity+guide for the entity
seeding needs.

Kalle

On Sun, Apr 12, 2015 at 3:26 AM, Charlouze m...@charlouze.com wrote:

 Hey!

 The tapestry @startup annotation is to be used in modules. The annotated
 method will be called upon application startup after the registry setup. If
 you need those methods to be called in a specific order, you should
 contribute to RegistryStartup.

 I hope it'll help you.

 Le dim 12 avr. 2015 06:30, Chris Mylonas ch...@opencsta.org a écrit :

  Hi Tapestry Users,
 
  Tapestry development is on the horizon again for me and I'm just making
  some tweaks to an app that I'm trying to load in another CMS's iframe!
 
 
  After service class instantiation, I'd like to call a method so it does
  something (e.g. create an admin user if none exist)
 
   //annotate with tapestry service initlised post runner
   @PostInjection or @Startup
   private void createAdminUser(){
   SubnetsUser u = new SubnetsUser();
   u.setRole(Role.ADMIN);
   u.setEmail(ch...@opencsta.org);
   u.setPassword(subnets);
   save(u);
   }
 
  Is this the way?  Doesn't seem to be working at the moment for me
 
  Thanks
  Chris
 
  -
  To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org
  For additional commands, e-mail: users-h...@tapestry.apache.org
 
 



Re: DefaultRequestExceptionHandler not redirect xhr request to a secure link

2015-04-10 Thread Kalle Korhonen
On Fri, Apr 10, 2015 at 5:56 AM, George Christman gchrist...@cardaddy.com
wrote:

 I'm using relative links throughout my application and allowing our reverse
 proxy to handle our secure port forwarding.

 I just discovered that DefaultRequestExceptionHandler on line 210 is
 creating an absolute link for all xhr request.


 https://github.com/apache/tapestry-5/blob/840533975a33d9094789bc09e40557a5c3ec7ba8/tapestry-core/src/main/java/org/apache/tapestry5/internal/services/DefaultRequestExceptionHandler.java

 The problem I face with this is we need to have secure links and it's
 creating an non secure absolute link. Is there a way to override this
 behavior so that I don't need to depend on our reverse proxy to forward the
 request?


Obviously the DefaultRequestExceptionHandler can be replaced like the name
implies. But yes, please open an issue and I'll fix it.

@Dimitris, yes your analysis is completely correct, should have gone
through it more carefully when I merged it in.

Kalle


Re: SoftReferences to PageImpl can cause performance problems

2015-04-01 Thread Kalle Korhonen
Actually Robert, I'd love it if you could patch/override T5 core just
enough to disable SoftReferences and re-run your test. The results may
surprise you. I could almost guarantee you'd see the same performance
pattern for any modern jpa 2.x application. At 1.2GB, it doesn't look like
your test setup is just a synthetic, lightweight t5 app with no back end,
is it?

Kalle
On Apr 1, 2015 3:44 PM, Kalle Korhonen kalle.o.korho...@gmail.com wrote:

 A configurable cache might be ok but what Robert is showing is a highly
 typical performance degradation pattern for any sufficiently large Java
 application. Tapestry's page cache is hardly the only place where soft
 references are used. When your memory budget is too small, most system
 engineers would argue that it's far better to slow down the application
 than OoM, but obviously that depends on the type of application and the
 traffic patterns you are facing. For the consumer facing application, it's
 not uncommon to see peak traffic 30-100 times over the averages at least
 with the applications I've been involved with and I would hate to to budget
 all resources based on peak consumption only. On the other hand, if the
 number of pages on the site is small and the site is evenly in use, then
 sure, it'd make sense to never purge.

 Kalle

 On Wed, Apr 1, 2015 at 3:01 PM, Howard Lewis Ship hls...@gmail.com
 wrote:

 I'm feeling that Robert is making a very good case here. I could imagine a
 page-level annotation to either enable or disable evication of a page
 instance after a period of time ... but that can come later. I do think
 that hard-caching of pages will leading to more predictable response
 performance.

 On Wed, Apr 1, 2015 at 7:31 AM, Robert Schmelzer rob...@schmelzer.cc
 wrote:

  Hi,
 
  I now found time to sum up a short report about that topic.
 
  I summarized my results in following pdf file:
  http://www.schmelzer.cc/Downloads/Files/Tapestry-Memory-Performance.pdf
 
  The main issue is, that you are able to bring a Tapestry based system
 into
  a situation where it gets slower and slower and finally event not
  responding any more, just be decreasing memory on the JVM and you DO NOT
  get any error message or OutOfMemory warning or GC overhead warning.
 And
  that only because the PageImpl instances are held in SoftReferences. My
  opinion is still, that this does not work as it is supposed to do and I
  keep with my example about other infrastructure. You would not expect
 e.g.
  Spring beans or a hibernate configuration to get thrown away under
 memory
  preasure - you would expect them to fail with OutOfMemory if they are
 not
  able to hold their necassary static information in memory.
 
  Regards
  Robert
 
 
 
 
  Am 19.03.2015 um 17:55 schrieb Kalle Korhonen:
 
  On Thu, Mar 19, 2015 at 12:24 AM, Robert Schmelzer rob...@schmelzer.cc
 
  wrote:
 
   Sorry, I was unprecise - my example should have referenced to the
  EntityManagerFactory (SessionFactoryImpl in Hibernate). You would not
  expect them, to throw away its cached configuration on memory
 preasure. I
  do not either expect that from Tapestry.
  I cannot make our results public because of regulatory issues. I will
 try
  to setup a show case for that and will offer a patch. This will take
 me a
  few days.
 
   I don't think we are going to simply do away with the SoftReferences
  without any replacements so I wouldn't even attempt at offering such a
  patch. I just don't agree that a memory cache should be permanent
  construct. If your object is not in a cache, you'll simply incur a
 cache
  miss and re-create the object on the fly. It is not typical that a
 cache
  will grow indefinitely. If you are adamant on this approach, you could
  probably convince us to add a symbol to control the cache behavior
 (i.e.
  to
  never purge objects from it). Guava has excellent, easily configurable
  cache implementations.
 
  Kalle
 
 
   Robert
 
  Am 18.03.2015 um 18:19 schrieb Kalle Korhonen:
 
On Wed, Mar 18, 2015 at 12:44 AM, Robert Schmelzer
 rob...@schmelzer.cc
  
 
  wrote:
 
I do not agree with you on that  point. Tapestry is designed to
 cache
  the
 
  page. When you do not have enough memory to hold your pages cached
  basically the system does not work as designed so you should fail
  early.
  Otherwise you possible defer the problem to production use. Fail
 early
  means you should try to see the problem in the early stages on dev,
  where
  you try out all your pages. As I mentioned in my other post - you
 would
  also not expect the EntityManager to work soft-refereences or spring
  application context to work soft referenced.
 
 
That's the definition of a memory cache - it trades memory for
 better
 
  performance. The primary use case for soft refences is for caching so
  seems
  to me it works exactly as designed. Your comparison to the
 EntityManager
  is
  flawed since it's created per request. An EntityManager is designed
 to
  be
  inexpensive

Re: The active page name has not been specified

2015-04-01 Thread Kalle Korhonen
 your form in a zone too? Sorry, I just want to
 be
   sure
 we
 are doing everything the same.

 On Tue, Mar 31, 2015 at 4:05 PM, Dimitris Zenios 
 dimitris.zen...@gmail.com
 wrote:

  Fedora 3.19.1-201.fc21.x86_64 #1 SMP Wed Mar 18 04:29:24 UTC
 2015
x86_64
  x86_64 x86_64 GNU/Linux
  Java 1.8.0_40
  Google chrome Version 41.0.2272.101 (64-bit)
  jetty-distribution-9.2.5.v20141112
  Tapestry 5.4-beta28
  dependency
  groupIdorg.tynamo/groupId
  artifactIdtapestry-security/artifactId
  version0.6.2/version
  exclusions
  exclusion
  groupIdorg.apache.tapestry/groupId
  artifactIdtapestry-core/artifactId
  /exclusion
  exclusion
  groupIdorg.apache.tapestry/groupId
  artifactIdtapestry-ioc/artifactId
  /exclusion
  /exclusions
  /dependency
 
  I am doing the same test as you do (Moving the clock forward).
 I
   also
 tried
  1.Removing the cookie
  2.Normal session time out by setting the time out to 1 minute
(Web.xml)
  3.Doing session invalidate.
 
  All of those tests had the same result.Once the form is
 submitted
   the
 user
  is redirected back to login page.
 
  On Tue, Mar 31, 2015 at 9:35 PM, Chris Poulsen 
mailingl...@nesluop.dk
  wrote:
 
   I think I've seen the error during debugging here and there
 in
 beta-22...
   We're not using tapestry security, I can't remember if it
  happens
when
  I'm
   too slow in the javascript debugger or it is during
 serverside
 debugging
  -
   I'll keep an eye out for it.
  
   We have a conversation moderator in play on some pages -
  similar
   to
 the
  one
   in tynamo conversations, so requests may arrive while things
  are
 locked
  up
   in either debugger - but I cannot remember if this has
  happened on
 pages
   supporting conversations.
  
   --
   Chris
  
   On Tue, Mar 31, 2015 at 7:52 PM, George Christman 
  gchrist...@cardaddy.com
   
   wrote:
  
Dimitris, I just tested in 5.4-beta-28 with the same
  exception.
What
version of tapestry-security are you using? I'm using
 0.6.2?
  Are
you
submitting with an ajax form? I can reproduce this very
  easily
   by
  forcing
my session to expire locally by advancing my computers time
  and
then
submitting an ajax form. It happens every single time.
   
On Tue, Mar 31, 2015 at 1:36 PM, George Christman 
   gchrist...@cardaddy.com

wrote:
   
 I'll test it in beta-28, but until that validation bug
 gets
 fixed, I
can't
 upgrade to it.

 On Tue, Mar 31, 2015 at 12:46 PM, Dimitris Zenios 
 dimitris.zen...@gmail.com wrote:

 FYI just tested with 5.4-beta28 and I don't have such
  problem

 On Tue, Mar 31, 2015 at 5:38 PM, George Christman 
 gchrist...@cardaddy.com
 wrote:

  Hey Kalle, just checking in with you to see if you
  happened
to
  have
 anymore
  info on this issue.
 
  On Wed, Mar 25, 2015 at 4:05 PM, George Christman 
 gchrist...@cardaddy.com
  
  wrote:
 
   Thanks Kalle,  were using 5.4-beta24
  
   On Wed, Mar 25, 2015 at 1:09 PM, Kalle Korhonen 
   kalle.o.korho...@gmail.com wrote:
  
   Sorry, I forgot to reply to your earlier post.
 Fundamentally,
  the
 issue
  is
   caused by tapestry-security operating as part of
 the
 httpservletrequest
   pipeline, before the active page is already set up.
  The
 library
   is
   internally setting up request globals etc. where
  needed
but
 you
   may
 be
   pushing around some shard edge there. It's also
  possible
 that
   some
  change
   in the core tapestry has caused the issue to
  surface. It
 may be
that
 the
   issue happens exactly when the security library is
   trying
to
  deal
 with
  the
   expired session. In your stack trace, you'll see
 that
   the
   exception
   happens
   way before the active page is being set. Just a
 note
   that
 you
cannot
   simply
   return a full page response to an ajax request (as
  you
   try
 to
  do
   in
 your
   example). What's your exact version of T5 you are
  using?
 I'll
  see
if
 we
   have a test for this case and try to reproduce.
  
   Kalle
  
   On Wed, Mar 25, 2015 at 6:07

Re: The active page name has not been specified

2015-04-01 Thread Kalle Korhonen
Github https://github.com/tynamo/tapestry-security, might just as well.

Kalle

On Wed, Apr 1, 2015 at 1:29 PM, George Christman gchrist...@cardaddy.com
wrote:

 Should I file a bug with tynamo jira?
 On Apr 1, 2015 3:40 PM, Kalle Korhonen kalle.o.korho...@gmail.com
 wrote:

  On Wed, Apr 1, 2015 at 9:22 AM, George Christman 
 gchrist...@cardaddy.com
  wrote:
 
   Kalle, when I switch from
  
  
 
 configuration.add(factory.createChain(/timesheet/**).add(factory.authc()).build());
   to
   @RequiresUser
   private class TimeSheet {
   The issue goes away. Am I do something wrong with my configuration?
  
 
  I was going to ask you to try out exactly that. So the reason it works
 with
  one and not the other is that the authorization is enforced at a
 different
  point in the request lifecycle. For page level annotations to work,
  naturally Tapestry must have already parsed the request and set the
 active
  page, whereas url-based authorization happens before. There's nothing
 wrong
  in your configuration and I do suspect this is an issue with the security
  library. And sorry, I have yet to check the existing test suite regarding
  this.
 
  Kalle
 
 
  
   Here's my complete config.
  
   public static void
   contributeSecurityConfiguration(ConfigurationSecurityFilterChain
   configuration,
   SecurityFilterChainFactory factory) {
   // /authc/** rule covers /authc , /authc?q=name /authc#anchor
  urls
   as well
  
  
 configuration.add(factory.createChain(/).add(factory.authc()).build());
  
  
  
 
 configuration.add(factory.createChain(/profile/**).add(factory.authc()).build());
   //
  
  
 
 configuration.add(factory.createChain(/timesheet/**).add(factory.authc()).build());
  
  
  
 
 configuration.add(factory.createChain(/timesheets/**).add(factory.authc()).build());
  
   configuration.add(factory.createChain(/admin/**).add(factory.roles(),
   appsupport).build());
  
  
  
 
 configuration.add(factory.createChain(/timerecords/**).add(factory.roles(),
   timerecords).build());
   }
  
  
   On Tue, Mar 31, 2015 at 5:11 PM, George Christman 
  gchrist...@cardaddy.com
   
   wrote:
  
Yes, still having the same issue, but only on the my Ajax form. My
 form
   is
very complicating, so I'll try breaking it down into something
 simpler
tomorrow and hopefully pin point the issue. My submit buttons are up
  top
and I think I'm using defer true, so I'm not sure if that has
 something
   to
do with it. I also have some logic in my onActivate method, but I
  figured
the redirection should have been happening before that method was
 ever
called.
On Mar 31, 2015 4:35 PM, Dimitris Zenios 
 dimitris.zen...@gmail.com
wrote:
   
Did you try the exclusion i told you about?
   
On Tue, Mar 31, 2015 at 11:32 PM, George Christman 
gchrist...@cardaddy.com
wrote:
   
 Thanks Dimitris, I'm guessing there is a bug in my code. I went to
another
 page in my app where I have an ajaxformloop and it appeared to
   redirect
 without issue. I'm going to have to dig deeper tomorrow to find
 the
cause
 of this issue.

 On Tue, Mar 31, 2015 at 4:25 PM, Dimitris Zenios 
 dimitris.zen...@gmail.com
 wrote:

  When you include a tynamo dependency do you exclude the
   tapestry-core
and
  tapestry-ioc like I did? If you don't then you end up having
 tapestry-core
  5.4-beta22 and tapestry-core 5.4-beta28 in your class path which
might be
  the source of your problem
 
  On Tue, Mar 31, 2015 at 11:24 PM, Dimitris Zenios 
  dimitris.zen...@gmail.com
   wrote:
 
   t:security.hasPermission permission=DEPARTMENTS
   t:modal t:id=AddDepartmentModal t:skipBody=true
  t:title=message:add-department-label
   t:zone t:id=departmentFormZone
  id=departmentFormZone
   t:form t:id=departmentForm t:zone=^
  t:validate=department
   div class=modal-body
   t:errors/
   t:textfield t:id=name t:value=
department.name
  t:mixins=formGroup/
   t:select t:id=parent
t:value=department.parent
  t:model=departmentsModelEncoder
  
   t:encoder=departmentsModelEncoder
  t:mixins=formGroup/
   t:select t:id=manager
  t:value=department.manager
t:model=viewDepartment.usersModelEncoder
  
   t:encoder=viewDepartment.usersModelEncoder
 t:mixins=formGroup
  t:blankoption=ALWAYS/
   t:select t:id=defaultSchedule
  t:value=department.defaultSchedule
  
   t:model=viewDepartment.schedulesModelEncoder
  t:encoder=viewDepartment.schedulesModelEncoder
 t:mixins=formGroup
  t:blankoption=ALWAYS t:validate=required/
   t:textarea t:id=notes
t:value=department.notes
  t:mixins=formGroup

Re: SoftReferences to PageImpl can cause performance problems

2015-04-01 Thread Kalle Korhonen
A configurable cache might be ok but what Robert is showing is a highly
typical performance degradation pattern for any sufficiently large Java
application. Tapestry's page cache is hardly the only place where soft
references are used. When your memory budget is too small, most system
engineers would argue that it's far better to slow down the application
than OoM, but obviously that depends on the type of application and the
traffic patterns you are facing. For the consumer facing application, it's
not uncommon to see peak traffic 30-100 times over the averages at least
with the applications I've been involved with and I would hate to to budget
all resources based on peak consumption only. On the other hand, if the
number of pages on the site is small and the site is evenly in use, then
sure, it'd make sense to never purge.

Kalle

On Wed, Apr 1, 2015 at 3:01 PM, Howard Lewis Ship hls...@gmail.com wrote:

 I'm feeling that Robert is making a very good case here. I could imagine a
 page-level annotation to either enable or disable evication of a page
 instance after a period of time ... but that can come later. I do think
 that hard-caching of pages will leading to more predictable response
 performance.

 On Wed, Apr 1, 2015 at 7:31 AM, Robert Schmelzer rob...@schmelzer.cc
 wrote:

  Hi,
 
  I now found time to sum up a short report about that topic.
 
  I summarized my results in following pdf file:
  http://www.schmelzer.cc/Downloads/Files/Tapestry-Memory-Performance.pdf
 
  The main issue is, that you are able to bring a Tapestry based system
 into
  a situation where it gets slower and slower and finally event not
  responding any more, just be decreasing memory on the JVM and you DO NOT
  get any error message or OutOfMemory warning or GC overhead warning.  And
  that only because the PageImpl instances are held in SoftReferences. My
  opinion is still, that this does not work as it is supposed to do and I
  keep with my example about other infrastructure. You would not expect
 e.g.
  Spring beans or a hibernate configuration to get thrown away under memory
  preasure - you would expect them to fail with OutOfMemory if they are not
  able to hold their necassary static information in memory.
 
  Regards
  Robert
 
 
 
 
  Am 19.03.2015 um 17:55 schrieb Kalle Korhonen:
 
  On Thu, Mar 19, 2015 at 12:24 AM, Robert Schmelzer rob...@schmelzer.cc
 
  wrote:
 
   Sorry, I was unprecise - my example should have referenced to the
  EntityManagerFactory (SessionFactoryImpl in Hibernate). You would not
  expect them, to throw away its cached configuration on memory
 preasure. I
  do not either expect that from Tapestry.
  I cannot make our results public because of regulatory issues. I will
 try
  to setup a show case for that and will offer a patch. This will take
 me a
  few days.
 
   I don't think we are going to simply do away with the SoftReferences
  without any replacements so I wouldn't even attempt at offering such a
  patch. I just don't agree that a memory cache should be permanent
  construct. If your object is not in a cache, you'll simply incur a cache
  miss and re-create the object on the fly. It is not typical that a cache
  will grow indefinitely. If you are adamant on this approach, you could
  probably convince us to add a symbol to control the cache behavior (i.e.
  to
  never purge objects from it). Guava has excellent, easily configurable
  cache implementations.
 
  Kalle
 
 
   Robert
 
  Am 18.03.2015 um 18:19 schrieb Kalle Korhonen:
 
On Wed, Mar 18, 2015 at 12:44 AM, Robert Schmelzer
 rob...@schmelzer.cc
  
 
  wrote:
 
I do not agree with you on that  point. Tapestry is designed to
 cache
  the
 
  page. When you do not have enough memory to hold your pages cached
  basically the system does not work as designed so you should fail
  early.
  Otherwise you possible defer the problem to production use. Fail
 early
  means you should try to see the problem in the early stages on dev,
  where
  you try out all your pages. As I mentioned in my other post - you
 would
  also not expect the EntityManager to work soft-refereences or spring
  application context to work soft referenced.
 
 
That's the definition of a memory cache - it trades memory for
 better
 
  performance. The primary use case for soft refences is for caching so
  seems
  to me it works exactly as designed. Your comparison to the
 EntityManager
  is
  flawed since it's created per request. An EntityManager is designed to
  be
  inexpensive to create. There are many areas that need improvements in
  Tapestry but this is not one in my opinion. However, you seem to
  strongly
  think otherwise, so you probably have some data to back this up. Do
 you
  have a memory dump and trending cpu/memory charts of a sufficiently
  large
  system you can share with us to demonstrate the problem? Jvisualvm
  snapshots should work fine. And furthermore - how would you like this
  changed? If it's just adding a Page

Re: Passing hibernate session from one page to the next in a wizard form

2015-03-27 Thread Kalle Korhonen
On Fri, Mar 27, 2015 at 11:50 AM, George Christman gchrist...@cardaddy.com
wrote:

 Hi guys, I'm trying to pass my object from one page to the next without
 actually saving it. I tried putting the object in a sessionstate, but I'm
 getting lazy loading exceptions on my second page, any idea how to do this?


It's generally not a good idea but it's possible. You need to watch for
memory consumption. Adding an already attached object to the session can
have adverse effects on memory consumption. Typically, you want to detach
the object from the first session and reattach the object to the second
session. I've written about the subject at
http://tynamo.org/tapestry-conversations+guide.

Kalle


Re: The active page name has not been specified

2015-03-25 Thread Kalle Korhonen
Sorry, I forgot to reply to your earlier post. Fundamentally, the issue is
caused by tapestry-security operating as part of the httpservletrequest
pipeline, before the active page is already set up. The library is
internally setting up request globals etc. where needed but you may be
pushing around some shard edge there. It's also possible that some change
in the core tapestry has caused the issue to surface. It may be that the
issue happens exactly when the security library is trying to deal with the
expired session. In your stack trace, you'll see that the exception happens
way before the active page is being set. Just a note that you cannot simply
return a full page response to an ajax request (as you try to do in your
example). What's your exact version of T5 you are using? I'll see if we
have a test for this case and try to reproduce.

Kalle

On Wed, Mar 25, 2015 at 6:07 AM, George Christman gchrist...@cardaddy.com
wrote:

 So I've been able to finally reproduce this bug. I have an ajax form and
 I'm using tapestry-security. When my session times out and an form action
 is clicked, I get the The active page name has not been specified
 exception. I found the code throwing the exception, I'm just not sure why
 this is happening to begin with.

 https://github.com/apache/tapestry-5/blob/5.4-beta-26/tapestry-core/src/main/java/org/apache/tapestry5/internal/services/AjaxPartialResponseRendererImpl.java
 line 86.

 Shouldn't the page automatically be redirected to the login page when the
 user session has timed out and an action has been performed.

 I even tried this without any success.

 Object onActivate() throws Exception {
 if (request.isRequestedSessionIdValid()) {
  //some code
 }
 return Login.class;
 }

 Any thoughts on how to repair this issue?

 On Thu, Mar 19, 2015 at 12:54 PM, George Christman 
 gchrist...@cardaddy.com
 wrote:

  Could someone help me to understand this exception? I'm using Tap 5.4 and
  I've been seeing this quite often, but can't seem to reproduce it.
 
  The active page name has not been
  specified.org.apache.tapestry5.ioc.internal.OperationException: The
 active
  page name has not been specified. at
 
 org.apache.tapestry5.ioc.internal.OperationTrackerImpl.logAndRethrow(OperationTrackerImpl.java:184)
  at
 
 org.apache.tapestry5.ioc.internal.OperationTrackerImpl.perform(OperationTrackerImpl.java:118)
  at
 
 org.apache.tapestry5.ioc.internal.PerThreadOperationTracker.perform(PerThreadOperationTracker.java:84)
  at
 
 org.apache.tapestry5.ioc.internal.RegistryImpl.perform(RegistryImpl.java:1264)
  at
 
 org.apache.tapestry5.internal.services.DeferredResponseRenderer.invokeQueuedRenderer(DeferredResponseRenderer.java:73)
  at
 
 org.apache.tapestry5.internal.services.DeferredResponseRenderer.handleComponentEvent(DeferredResponseRenderer.java:47)
  at $ComponentRequestHandler_18c715615aaee.handleComponentEvent(Unknown
  Source) at
 
 org.apache.tapestry5.services.InitializeActivePageName.handleComponentEvent(InitializeActivePageName.java:39)
  at $ComponentRequestHandler_18c715615aaee.handleComponentEvent(Unknown
  Source) at
 
 org.apache.tapestry5.internal.services.ProductionModeUnknownComponentFilter.handleComponentEvent(ProductionModeUnknownComponentFilter.java:50)
  at $ComponentRequestHandler_18c715615aaee.handleComponentEvent(Unknown
  Source) at
 
 org.apache.tapestry5.internal.services.RequestOperationTracker$1.perform(RequestOperationTracker.java:55)
  at
 
 org.apache.tapestry5.internal.services.RequestOperationTracker$1.perform(RequestOperationTracker.java:52)
  at
 
 org.apache.tapestry5.ioc.internal.OperationTrackerImpl.perform(OperationTrackerImpl.java:110)
  at
 
 org.apache.tapestry5.ioc.internal.PerThreadOperationTracker.perform(PerThreadOperationTracker.java:84)
  at
 
 org.apache.tapestry5.ioc.internal.RegistryImpl.perform(RegistryImpl.java:1264)
  at
 
 org.apache.tapestry5.internal.services.RequestOperationTracker.handleComponentEvent(RequestOperationTracker.java:47)
  at $ComponentRequestHandler_18c715615aaee.handleComponentEvent(Unknown
  Source) at
 
 org.tynamo.security.SecurityComponentRequestFilter.handleComponentEvent(SecurityComponentRequestFilter.java:41)
  at $ComponentRequestFilter_18c715615aaeb.handleComponentEvent(Unknown
  Source) at
  $ComponentRequestHandler_18c715615aaee.handleComponentEvent(Unknown
 Source)
  at $ComponentRequestHandler_18c715615aac8.handleComponentEvent(Unknown
  Source) at
 
 org.apache.tapestry5.internal.services.ComponentEventDispatcher.dispatch(ComponentEventDispatcher.java:48)
  at $Dispatcher_18c715615aac9.dispatch(Unknown Source) at
  $Dispatcher_18c715615aac2.dispatch(Unknown Source) at
 
 org.apache.tapestry5.modules.TapestryModule$RequestHandlerTerminator.service(TapestryModule.java:305)
  at
 org.healthresearch.etss.services.AppModule$1.service(AppModule.java:302)
  at $RequestFilter_18c715615aac1.service(Unknown Source) at
  $RequestHandler_18c715615aac3.service(Unknown 

Re: T5 and Ember

2015-03-24 Thread Kalle Korhonen
On Tue, Mar 24, 2015 at 7:24 AM, Andreas Andreou andre...@gmail.com wrote:

 After having worked for more almost 2 years on (mostly) ember,
 my advice would be to completely decouple (if possible) the projects.

 Move ember on its own, make use of the improving cli plugins for
 developing,
 building and deploying. I'm still on a yeoman created grunt setup, so that
 could
 also work for you.


Yes, that's certainly an option and that's how I've approached the
prototype, but this strategy doesn't work quite as well if you are
releasing to a customer as opposed to developing company's own site where
you typically already have an http server to deploy the Ember bits to. And
if you have to figure out packaging into a .war anyway, then might make
sense to use a similar setup for development as well. In any case, thanks
for the advice. I bet the framework has changed quite a bit in your two
years. I wonder if your experience has been a positive one and if there are
any I wish I had known this before we started tidbits you could share.

@Ivano - if popularity was a measure, we'd all be still using Struts
instead of Tapestry, wouldn't we? Convention over configuration is one
thing, but the article you linked to is a fairly well balanced in my
opinion. For me, the biggest things to like in Ember is it's router, clean
urls, cleaner/simpler concepts and performance.

Kalle




 On Tue, Mar 24, 2015 at 5:50 AM, Kalle Korhonen 
 kalle.o.korho...@gmail.com
 wrote:

  As an experiment, I'm trying to migrate an existing Angular app to Ember
  (with T5 back-end and serving multiple other thin pages). There's a lot
  to like in Ember vs Angular but I'm wondering if there are anybody else
  using Ember with T5 and if so, what's your setup? I'm mainly interested
 in
  knowing if you've managed to integrate wro4j's EmberJsProcessor or
 perhaps
  you have just overlaid an ember-cli setup over T5 folder structure? Also,
  I'd especially like to know how you handle third-party components if you
  are using any. Installing snippets using npm and ember-cli seems like a
  great idea but I find a lot of outdated and broken stuff. I'm using the
  very latest, the ember-cli 0.2.1 released today (I was battling issues
 with
  the previous 0.2.0 release over the weekend) and ember 1.10.0. Perhaps
 I'm
  pushing too far on the bleeding edge... if you've gone done this path,
 I'd
  appreciate some war stories for things to watch out for.
 
  Kalle
 



 --
 Andreas Andreou - andy...@apache.org - http://blog.andyhot.gr
 Apache Tapestry PMC / http://chesstu.be owner
 Open Source / JS Consulting



T5 and Ember

2015-03-23 Thread Kalle Korhonen
As an experiment, I'm trying to migrate an existing Angular app to Ember
(with T5 back-end and serving multiple other thin pages). There's a lot
to like in Ember vs Angular but I'm wondering if there are anybody else
using Ember with T5 and if so, what's your setup? I'm mainly interested in
knowing if you've managed to integrate wro4j's EmberJsProcessor or perhaps
you have just overlaid an ember-cli setup over T5 folder structure? Also,
I'd especially like to know how you handle third-party components if you
are using any. Installing snippets using npm and ember-cli seems like a
great idea but I find a lot of outdated and broken stuff. I'm using the
very latest, the ember-cli 0.2.1 released today (I was battling issues with
the previous 0.2.0 release over the weekend) and ember 1.10.0. Perhaps I'm
pushing too far on the bleeding edge... if you've gone done this path, I'd
appreciate some war stories for things to watch out for.

Kalle


Re: SoftReferences to PageImpl can cause performance problems

2015-03-19 Thread Kalle Korhonen
On Thu, Mar 19, 2015 at 12:24 AM, Robert Schmelzer rob...@schmelzer.cc
wrote:

 Sorry, I was unprecise - my example should have referenced to the
 EntityManagerFactory (SessionFactoryImpl in Hibernate). You would not
 expect them, to throw away its cached configuration on memory preasure. I
 do not either expect that from Tapestry.
 I cannot make our results public because of regulatory issues. I will try
 to setup a show case for that and will offer a patch. This will take me a
 few days.


I don't think we are going to simply do away with the SoftReferences
without any replacements so I wouldn't even attempt at offering such a
patch. I just don't agree that a memory cache should be permanent
construct. If your object is not in a cache, you'll simply incur a cache
miss and re-create the object on the fly. It is not typical that a cache
will grow indefinitely. If you are adamant on this approach, you could
probably convince us to add a symbol to control the cache behavior (i.e. to
never purge objects from it). Guava has excellent, easily configurable
cache implementations.

Kalle


 Robert

 Am 18.03.2015 um 18:19 schrieb Kalle Korhonen:

  On Wed, Mar 18, 2015 at 12:44 AM, Robert Schmelzer rob...@schmelzer.cc
 wrote:

  I do not agree with you on that  point. Tapestry is designed to cache the
 page. When you do not have enough memory to hold your pages cached
 basically the system does not work as designed so you should fail early.
 Otherwise you possible defer the problem to production use. Fail early
 means you should try to see the problem in the early stages on dev, where
 you try out all your pages. As I mentioned in my other post - you would
 also not expect the EntityManager to work soft-refereences or spring
 application context to work soft referenced.


  That's the definition of a memory cache - it trades memory for better
 performance. The primary use case for soft refences is for caching so
 seems
 to me it works exactly as designed. Your comparison to the EntityManager
 is
 flawed since it's created per request. An EntityManager is designed to be
 inexpensive to create. There are many areas that need improvements in
 Tapestry but this is not one in my opinion. However, you seem to strongly
 think otherwise, so you probably have some data to back this up. Do you
 have a memory dump and trending cpu/memory charts of a sufficiently large
 system you can share with us to demonstrate the problem? Jvisualvm
 snapshots should work fine. And furthermore - how would you like this
 changed? If it's just adding a Page as a threadlocal, perhaps you can just
 write a patch for it.

 Kalle


  Am 18.03.2015 um 04:23 schrieb Kalle Korhonen:

   In my opinion, soft referencing page objects is highly appropriate
 usage

 here. If there's pressure on the available memory, it makes sense to
 trade
 performance for memory instead of exiting with OoM. This is simple
 condition to detect and should be visible with any reasonable monitoring
 tool. If you are hitting memory limits, you'll need to allocate more
 memory
 for the application for optimal performance. Soft references are
 especially
 useful here because you can optimize its behavior with the
 -client/-server
 setting depending on your preferences.

 Kalle

 On Tue, Mar 17, 2015 at 4:26 PM, Howard Lewis Ship hls...@gmail.com
 wrote:

   Possibly we need something more advanced; our own reference type that
 can

 react to memory pressure by discarding pages that haven't been used in
 configurable amount of time.

 Or perhaps we could just assume that any page that has been used once
 need
 to be used in the future and get rid of the SoftReference entirely (or
 otherwise janitorize it in some way).

 On Tue, Mar 17, 2015 at 1:24 AM, Robert Schmelzer rob...@schmelzer.cc
 
 wrote:

   Hello,

 I recently came accross the implementation of PageSourceImpl where
 PageImpl instances are softly refereneced into the pageCache:

 private final MapCachedPageKey, SoftReferencePage pageCache =
 CollectionFactory.newConcurrentMap();

 This implementation caused troubles, when you bring your system into
 memory preassure. The JVM will start to throw away the PageImpl to
 free

  up

  memory - but during request processing he needs the PageImpl again and
 starts creating it again. So basically you end up loosing your
 pageCache

  at

  all and start creating the PageImpl instances on every request, which

  take

  way to much time and takes load onto the CPU. So basically you are

  hiding a

  memory problem by making the system slow and raise CPU load.

 I would suggest to use normal references for the PageCache or at
 least
 only do SoftReferences only when not in production mode. Otherwise we
 are
 going to cover memory problems for too long.

 What do you think about that?

 Robert

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

Re: HTTP/S Session Cookie

2015-03-19 Thread Kalle Korhonen
On Thu, Mar 19, 2015 at 9:41 AM, Martin Polívka martasdx@gmail.com
wrote:

 Hi, I am quite new to Tapestry, but last month I am upgrading our app from
 Tapestry 5.0.14 to 5.3.8. It's working now with one problem.
 We use Tomcat 7, servlet 3.0 (in the future Tomcat 8 and servlet 3.1) and
 Java 7. Tomcat listens on http (8080) and https(8443). If I use https,
 everything is OK.
 If I use http, I enter login page off app and SessionState object is
 created. I can see Session ID (equals X). It's done
 by contributeApplicationStateManager function in Module. Another contribute
 is for URL (contributeServiceOverride) where we use only https connection.
 That's because we want all ajax requests to go over https even if user is
 on http.
 So if user log in, session and cookie is created with atribute httpOnly and
 if I send ajax request to https, another session is created by Tapestry.
 Is it possible to access the http session in https request?


In general, no, it's not possible. This is a security issue and it's not
related to Tapestry. Container-specific configuration may allow
joining/sharing sessions on the servers (I recall having done something
similar in the past with Tomcat). I'd advise simply using https everywhere,
it'll make your life easier.

Kalle


Re: SoftReferences to PageImpl can cause performance problems

2015-03-18 Thread Kalle Korhonen
On Wed, Mar 18, 2015 at 12:44 AM, Robert Schmelzer rob...@schmelzer.cc
wrote:

 I do not agree with you on that  point. Tapestry is designed to cache the
 page. When you do not have enough memory to hold your pages cached
 basically the system does not work as designed so you should fail early.
 Otherwise you possible defer the problem to production use. Fail early
 means you should try to see the problem in the early stages on dev, where
 you try out all your pages. As I mentioned in my other post - you would
 also not expect the EntityManager to work soft-refereences or spring
 application context to work soft referenced.


That's the definition of a memory cache - it trades memory for better
performance. The primary use case for soft refences is for caching so seems
to me it works exactly as designed. Your comparison to the EntityManager is
flawed since it's created per request. An EntityManager is designed to be
inexpensive to create. There are many areas that need improvements in
Tapestry but this is not one in my opinion. However, you seem to strongly
think otherwise, so you probably have some data to back this up. Do you
have a memory dump and trending cpu/memory charts of a sufficiently large
system you can share with us to demonstrate the problem? Jvisualvm
snapshots should work fine. And furthermore - how would you like this
changed? If it's just adding a Page as a threadlocal, perhaps you can just
write a patch for it.

Kalle



 Am 18.03.2015 um 04:23 schrieb Kalle Korhonen:

  In my opinion, soft referencing page objects is highly appropriate usage
 here. If there's pressure on the available memory, it makes sense to trade
 performance for memory instead of exiting with OoM. This is simple
 condition to detect and should be visible with any reasonable monitoring
 tool. If you are hitting memory limits, you'll need to allocate more
 memory
 for the application for optimal performance. Soft references are
 especially
 useful here because you can optimize its behavior with the -client/-server
 setting depending on your preferences.

 Kalle

 On Tue, Mar 17, 2015 at 4:26 PM, Howard Lewis Ship hls...@gmail.com
 wrote:

  Possibly we need something more advanced; our own reference type that can
 react to memory pressure by discarding pages that haven't been used in
 configurable amount of time.

 Or perhaps we could just assume that any page that has been used once
 need
 to be used in the future and get rid of the SoftReference entirely (or
 otherwise janitorize it in some way).

 On Tue, Mar 17, 2015 at 1:24 AM, Robert Schmelzer rob...@schmelzer.cc
 wrote:

  Hello,

 I recently came accross the implementation of PageSourceImpl where
 PageImpl instances are softly refereneced into the pageCache:

 private final MapCachedPageKey, SoftReferencePage pageCache =
 CollectionFactory.newConcurrentMap();

 This implementation caused troubles, when you bring your system into
 memory preassure. The JVM will start to throw away the PageImpl to free

 up

 memory - but during request processing he needs the PageImpl again and
 starts creating it again. So basically you end up loosing your pageCache

 at

 all and start creating the PageImpl instances on every request, which

 take

 way to much time and takes load onto the CPU. So basically you are

 hiding a

 memory problem by making the system slow and raise CPU load.

 I would suggest to use normal references for the PageCache or at least
 only do SoftReferences only when not in production mode. Otherwise we
 are
 going to cover memory problems for too long.

 What do you think about that?

 Robert

 -
 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
 @hlship



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




Re: SoftReferences to PageImpl can cause performance problems

2015-03-17 Thread Kalle Korhonen
In my opinion, soft referencing page objects is highly appropriate usage
here. If there's pressure on the available memory, it makes sense to trade
performance for memory instead of exiting with OoM. This is simple
condition to detect and should be visible with any reasonable monitoring
tool. If you are hitting memory limits, you'll need to allocate more memory
for the application for optimal performance. Soft references are especially
useful here because you can optimize its behavior with the -client/-server
setting depending on your preferences.

Kalle

On Tue, Mar 17, 2015 at 4:26 PM, Howard Lewis Ship hls...@gmail.com wrote:

 Possibly we need something more advanced; our own reference type that can
 react to memory pressure by discarding pages that haven't been used in
 configurable amount of time.

 Or perhaps we could just assume that any page that has been used once need
 to be used in the future and get rid of the SoftReference entirely (or
 otherwise janitorize it in some way).

 On Tue, Mar 17, 2015 at 1:24 AM, Robert Schmelzer rob...@schmelzer.cc
 wrote:

  Hello,
 
  I recently came accross the implementation of PageSourceImpl where
  PageImpl instances are softly refereneced into the pageCache:
 
  private final MapCachedPageKey, SoftReferencePage pageCache =
  CollectionFactory.newConcurrentMap();
 
  This implementation caused troubles, when you bring your system into
  memory preassure. The JVM will start to throw away the PageImpl to free
 up
  memory - but during request processing he needs the PageImpl again and
  starts creating it again. So basically you end up loosing your pageCache
 at
  all and start creating the PageImpl instances on every request, which
 take
  way to much time and takes load onto the CPU. So basically you are
 hiding a
  memory problem by making the system slow and raise CPU load.
 
  I would suggest to use normal references for the PageCache or at least
  only do SoftReferences only when not in production mode. Otherwise we are
  going to cover memory problems for too long.
 
  What do you think about that?
 
  Robert
 
  -
  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
 @hlship



Re: org.apache.tapestry5.ioc.internal.OperationException

2015-03-13 Thread Kalle Korhonen
As log message shows, you need to find out where the
ArrayIndexOutOfBoundsException comes from, everything else is incidental.

Kalle

On Fri, Mar 13, 2015 at 9:31 AM, George Christman gchrist...@cardaddy.com
wrote:

 *Hi I'm using 5.3.7*

 *Tapestry-Security 0.4.1*

 We had an ldap server go down this morning and from there on out, all we
 have been getting is this exception on our application that connects to
 that server. I can not seem to figure out how to repair issue. Could
 someone help me to understand what is going on?


 Thanks in advance.


 *type* Exception report

 *message* *org.apache.tapestry5.ioc.internal.OperationException*

 *description* *The server encountered an internal error that prevented it
 from fulfilling this request.*

 *exception*

 org.apache.shiro.subject.ExecutionException:
 org.apache.tapestry5.ioc.internal.OperationException

 org.apache.shiro.subject.support.DelegatingSubject.execute(DelegatingSubject.java:382)

 org.tynamo.security.services.impl.SecurityConfiguration.service(SecurityConfiguration.java:104)
 $HttpServletRequestFilter_f1dbaa8739.service(Unknown Source)
 $HttpServletRequestHandler_f1dbaa873c.service(Unknown Source)

 org.apache.tapestry5.upload.internal.services.MultipartServletRequestFilter.service(MultipartServletRequestFilter.java:44)
 $HttpServletRequestHandler_f1dbaa873c.service(Unknown Source)

 org.got5.tapestry5.jquery.services.AjaxUploadServletRequestFilter.service(AjaxUploadServletRequestFilter.java:27)
 $HttpServletRequestHandler_f1dbaa873c.service(Unknown Source)

 org.apache.tapestry5.internal.services.IgnoredPathsFilter.service(IgnoredPathsFilter.java:62)
 $HttpServletRequestFilter_f1dbaa8736.service(Unknown Source)
 $HttpServletRequestHandler_f1dbaa873c.service(Unknown Source)

 org.apache.tapestry5.services.TapestryModule$1.service(TapestryModule.java:852)
 $HttpServletRequestHandler_f1dbaa873c.service(Unknown Source)
 $HttpServletRequestHandler_f1dbaa872e.service(Unknown Source)

 org.apache.tapestry5.TapestryFilter.doFilter(TapestryFilter.java:171)

 *root cause*

 org.apache.tapestry5.ioc.internal.OperationException

 org.apache.tapestry5.ioc.internal.OperationTrackerImpl.logAndRethrow(OperationTrackerImpl.java:121)

 org.apache.tapestry5.ioc.internal.OperationTrackerImpl.invoke(OperationTrackerImpl.java:88)

 org.apache.tapestry5.ioc.internal.PerThreadOperationTracker.invoke(PerThreadOperationTracker.java:87)

 org.apache.tapestry5.ioc.internal.RegistryImpl.invoke(RegistryImpl.java:1124)

 org.apache.tapestry5.internal.services.TemplateParserImpl.parseTemplate(TemplateParserImpl.java:57)
 $TemplateParser_f1dbaa87a0.parseTemplate(Unknown Source)

 org.apache.tapestry5.internal.services.ComponentTemplateSourceImpl.parseTemplate(ComponentTemplateSourceImpl.java:175)

 org.apache.tapestry5.internal.services.ComponentTemplateSourceImpl.getTemplate(ComponentTemplateSourceImpl.java:147)
 $ComponentTemplateSource_f1dbaa879f.getTemplate(Unknown Source)

 org.apache.tapestry5.internal.pageload.PageLoaderImpl$4.invoke(PageLoaderImpl.java:229)

 org.apache.tapestry5.internal.pageload.PageLoaderImpl$4.invoke(PageLoaderImpl.java:222)

 org.apache.tapestry5.ioc.internal.OperationTrackerImpl.invoke(OperationTrackerImpl.java:74)

 org.apache.tapestry5.ioc.internal.PerThreadOperationTracker.invoke(PerThreadOperationTracker.java:87)

 org.apache.tapestry5.ioc.internal.RegistryImpl.invoke(RegistryImpl.java:1124)

 org.apache.tapestry5.internal.pageload.PageLoaderImpl.createAssembler(PageLoaderImpl.java:221)

 org.apache.tapestry5.internal.pageload.PageLoaderImpl.getAssembler(PageLoaderImpl.java:211)

 org.apache.tapestry5.internal.pageload.PageLoaderImpl$3.invoke(PageLoaderImpl.java:183)

 org.apache.tapestry5.internal.pageload.PageLoaderImpl$3.invoke(PageLoaderImpl.java:178)

 org.apache.tapestry5.ioc.internal.OperationTrackerImpl.invoke(OperationTrackerImpl.java:74)

 org.apache.tapestry5.ioc.internal.PerThreadOperationTracker.invoke(PerThreadOperationTracker.java:87)

 org.apache.tapestry5.ioc.internal.RegistryImpl.invoke(RegistryImpl.java:1124)

 org.apache.tapestry5.internal.pageload.PageLoaderImpl.loadPage(PageLoaderImpl.java:177)
 $PageLoader_f1dbaa879d.loadPage(Unknown Source)

 org.apache.tapestry5.internal.services.PageSourceImpl.getPage(PageSourceImpl.java:104)
 $PageSource_f1dbaa879a.getPage(Unknown Source)

 org.apache.tapestry5.internal.services.NonPoolingRequestPageCacheImpl.get(NonPoolingRequestPageCacheImpl.java:82)
 $RequestPageCache_f1dbaa8799.get(Unknown Source)
 $RequestPageCache_f1dbaa877e.get(Unknown Source)

 org.apache.tapestry5.internal.services.DefaultRequestExceptionHandler.handleRequestException(DefaultRequestExceptionHandler.java:77)

 $RequestExceptionHandler_f1dbaa8781.advised$handleRequestException_f1dbaa8783(Unknown
 Source)

 

tapestry-routing 0.1.1 released!

2015-02-08 Thread Kalle Korhonen
Bada bing bada boom! New year, new releases - and just like that
tapestry-routing 0.1.1 is ready for consumption with the latest T5 beta.
There were some minor API adjustments made, otherwise it's the same,
trustworthy routing module. See the tapestry-routing guide (
http://tynamo.org/tapestry-routing+guide) for more info!

Release notes

Update routing to T5.4 beta-26 #3
https://github.com/tynamo/tapestry-routing/issues/3
Update routing to T5.4 beta-22 #2
https://github.com/tynamo/tapestry-routing/issues/2

Enjoy,

Tynamo team


Re: Override hibernate.cfg.xml with QaModule hibernate config

2015-02-05 Thread Kalle Korhonen
Use different execution modes for production and testing, then contribute a
custom HibernateConfigurer that supplies hibernate configuration file with
mode specific name, e.g. hibernate-production.cfg.xml or
hibernate-test.cfg.xml.

Kalle

On Thu, Feb 5, 2015 at 11:09 AM, George Christman gchrist...@cardaddy.com
wrote:

 Hi guys, I'm trying to setup an in memory database for selenium testing.
 I'm wondering if someone new how to override my hibernate.cfg.xml file with
 something like contributeHibernateEntityPackageManager without a conflict
 with the xml. Thanks in advance.



Re: PageRenderLinkSource failing in service when called by cron scheduler - Unable to delegate method invocation to property

2015-01-21 Thread Kalle Korhonen
On Tue, Jan 20, 2015 at 1:03 PM, George Christman gchrist...@cardaddy.com
wrote:

 So I just took a look at the tapestry code and I'm not seeing anyway
 to work around it unless I want to build my own links which I'd rather
 not do because of my use of the url rewriter.

 Tap code line 113

 https://github.com/apache/tapestry-5/blob/5.4-beta-26/tapestry-core/src/main/java/org/apache/tapestry5/internal/services/LinkSourceImpl.java
 How do you work around this?


You are right George. Ever since the loopback reset listeners was put it in
(for T5.3), the LinkSource.createPageRenderLink(...) doesn't anymore work
outside request context (e.g. in a scheduled job). You should instead use
the linkEncoder directly (as in the implementation for
createPageRenderLink):

PageRenderRequestParameters parameters = new
PageRenderRequestParameters(canonical, new ArrayEventContext(
typeCoercer, context), loopback);
Link link = linkEncoder.createPageRenderLink(parameters);

Set loopback to false, you don't need it.

Kalle



 On Tue, Jan 20, 2015 at 11:14 AM, George Christman
 gchrist...@cardaddy.com wrote:
   Still no success in getting this to work. I've contributed the Hostname
 etc.
 
  configuration.add(SymbolConstants.HOSTNAME, localhost);
  configuration.add(SymbolConstants.HOSTPORT, 8080);
  configuration.add(SymbolConstants.HOSTPORT_SECURE, false);
 
  And a simple test which fails with the same error.
 
  private void testTask() {
  periodicExecutor.addJob(new IntervalSchedule(3000),
  Data Validation1, new Runnable() {
  @Override
  public void run() {
  System.out.println(test);
  try {
 
  System.out.println(linkSource.createPageRenderLink(Index.class));
  } catch (Exception ex) {
  System.out.println(ex  + ex);
  }
  }
  });
  }
 
  On Tue, Jan 20, 2015 at 7:41 AM, George Christman
  gchrist...@cardaddy.com wrote:
  So toAbsolute is the code calling the request and the cause of this
  exception? I'm assuming your referring to me contributing those values
 to my
  appmodule. Once I contribute those values, would toAbsolute use those
 values
  instead of the request? Just trying to understand the issue a little bit
  better. Thanks Kalle.
 
  On Jan 20, 2015 4:44 AM, Kalle Korhonen kalle.o.korho...@gmail.com
  wrote:
 
  On Tue, Jan 20, 2015 at 1:23 AM, George Christman
  gchrist...@cardaddy.com
  wrote:
 
   I'm using T5 beta-25 and I have the following code and I'm noticing
   when the scheduler fires off my service, my PageRenderLinkSource does
   not work. If I manually fire it off through the admin with an
   actionlink, it works without issue.
   I'm seeing the following exception
   java.lang.NullPointerException: Unable to delegate method invocation
   to property 'request' of Proxy for
   RequestGlobals(org.apache.tapestry5.services.RequestGlobals),
 because
   the property is null.
   Any idea why this isn't working?
  
 
  Naturally, you don't have a request to work with when you are executing
  from a cron job. But if you just want to generate links, you don't
 need to
  and you shouldn't use the request values. Contribute HOSTNAME, HOSTPORT
  and
  HOSTPORT_SECURE and you can generate absolute urls without resorting to
  reading the values from the request.
 
  Kalle
 
 
 
  
   -
   To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org
   For additional commands, e-mail: users-h...@tapestry.apache.org
  
  
 
 
 
  --
  George Christman
  CEO
  www.CarDaddy.com
  P.O. Box 735
  Johnstown, New York



 --
 George Christman
 CEO
 www.CarDaddy.com
 P.O. Box 735
 Johnstown, New York

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




Re: PageRenderLinkSource failing in service when called by cron scheduler - Unable to delegate method invocation to property

2015-01-21 Thread Kalle Korhonen
On Wed, Jan 21, 2015 at 1:07 PM, George Christman gchrist...@cardaddy.com
wrote:

 On Wed, Jan 21, 2015 at 3:16 PM, Kalle Korhonen
 kalle.o.korho...@gmail.com wrote:
  On Tue, Jan 20, 2015 at 1:03 PM, George Christman 
 gchrist...@cardaddy.com
  wrote:
  So I just took a look at the tapestry code and I'm not seeing anyway
  to work around it unless I want to build my own links which I'd rather
  not do because of my use of the url rewriter.
  Tap code line 113
 
 https://github.com/apache/tapestry-5/blob/5.4-beta-26/tapestry-core/src/main/java/org/apache/tapestry5/internal/services/LinkSourceImpl.java
  How do you work around this?
  You are right George. Ever since the loopback reset listeners was put it
 in
  (for T5.3), the LinkSource.createPageRenderLink(...) doesn't anymore work
  outside request context (e.g. in a scheduled job). You should instead use
  the linkEncoder directly (as in the implementation for
  createPageRenderLink):
 
 Just seen this, is there any chance we could fix this issue so that we
 don't need to write the cumbersome code below every time? I'm actually
 surprised I'm the first to discover this. We send out a lot of
 reminder emails etc at work via a cron job which would require this
 and I also need it to work for my own project. Should I create a bug
 in jira?
 


Somebody's gotta be the first one. I guess many of the existing
installations are still not using the more recent versions of T5. But I
agree, it might be worth fixing so go ahead and open an issue.


  PageRenderRequestParameters parameters = new
  PageRenderRequestParameters(canonical, new ArrayEventContext(
  typeCoercer, context), loopback);
  Link link = linkEncoder.createPageRenderLink(parameters);

 One last thing before we move on from this issue, what is the
 canonical? Would that be the Page.class.getName() ? and I'm assuming
 context is just my url context values?


Take another look at the source you pointed to yourself, but: String
canonical = resolver.canonicalizePageName(pageName);

Kalle


 On Tue, Jan 20, 2015 at 11:14 AM, George Christman
  gchrist...@cardaddy.com wrote:
Still no success in getting this to work. I've contributed the
 Hostname
  etc.
  
   configuration.add(SymbolConstants.HOSTNAME, localhost);
   configuration.add(SymbolConstants.HOSTPORT, 8080);
   configuration.add(SymbolConstants.HOSTPORT_SECURE, false);
  
   And a simple test which fails with the same error.
  
   private void testTask() {
   periodicExecutor.addJob(new IntervalSchedule(3000),
   Data Validation1, new Runnable() {
   @Override
   public void run() {
   System.out.println(test);
   try {
  
   System.out.println(linkSource.createPageRenderLink(Index.class));
   } catch (Exception ex) {
   System.out.println(ex  + ex);
   }
   }
   });
   }
  
   On Tue, Jan 20, 2015 at 7:41 AM, George Christman
   gchrist...@cardaddy.com wrote:
   So toAbsolute is the code calling the request and the cause of this
   exception? I'm assuming your referring to me contributing those
 values
  to my
   appmodule. Once I contribute those values, would toAbsolute use those
  values
   instead of the request? Just trying to understand the issue a little
 bit
   better. Thanks Kalle.
  
   On Jan 20, 2015 4:44 AM, Kalle Korhonen 
 kalle.o.korho...@gmail.com
   wrote:
  
   On Tue, Jan 20, 2015 at 1:23 AM, George Christman
   gchrist...@cardaddy.com
   wrote:
  
I'm using T5 beta-25 and I have the following code and I'm
 noticing
when the scheduler fires off my service, my PageRenderLinkSource
 does
not work. If I manually fire it off through the admin with an
actionlink, it works without issue.
I'm seeing the following exception
java.lang.NullPointerException: Unable to delegate method
 invocation
to property 'request' of Proxy for
RequestGlobals(org.apache.tapestry5.services.RequestGlobals),
  because
the property is null.
Any idea why this isn't working?
   
  
   Naturally, you don't have a request to work with when you are
 executing
   from a cron job. But if you just want to generate links, you don't
  need to
   and you shouldn't use the request values. Contribute HOSTNAME,
 HOSTPORT
   and
   HOSTPORT_SECURE and you can generate absolute urls without
 resorting to
   reading the values from the request.
  
   Kalle
  
  
  
   
   
 -
To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org
For additional commands, e-mail: users-h...@tapestry.apache.org
   
   
  
  
  
   --
   George Christman
   CEO
   www.CarDaddy.com
   P.O. Box 735
   Johnstown, New York
 
 
 
  --
  George Christman
  CEO
  www.CarDaddy.com
  P.O. Box 735
  Johnstown, New York

Re: HibernateEntityValueEncoder NullPointerException - Composite/Compund Primary Key Issue

2015-01-21 Thread Kalle Korhonen
I see Lance already answered to your question on Stackoverflow. Follow his
advice and make sure you contribute the encoder. After that, you may hit
another issues with tynamo not recognizing @IdClass (see an old issue
https://jira.codehaus.org/browse/TYNAMO-168), whether it matters to you,
I'm not sure. I've used IdClasses before but not extensively, and don't
recall whether I've had them on tynamo-model or if I've simply ignored them
from it. As both Thiago and Lance mentioned, it's best to avoid composite
keys with Hibernate but I'm pretty sure you can get it to work if you need
to. I'm always happy to apply patches and please open an issue on github (
https://github.com/tynamo/tapestry-model) if you hit a specific issue with
tynamo-model (you may but you are not there yet :P ).

Kalle

On Tue, Jan 20, 2015 at 11:43 AM, Witt, Aaron aaron.w...@alliancedata.com
wrote:

 Hi Tapestry Users,

 I'm using a CRUD framework called Tynamo, which in turn relies on Apache
 Tapestry and Hibernate. This all works fine, except for when I try to use
 it for CRUD on a table with a composite/compound primary key.
 I've decided not to go the @EmbeddedId route, since it seems to not work
 at all with the framework. That being said, I have been using the @IdClass
 method, which is mostly working; I think I'm a line or two of code away
 from success.
 The issue is that when it starts using reflection to build the objects, it
 blows up and says,
 org.apache.tapestry5.ioc.internal.util.TapestryException, caused by
 java.lang.NullPointerException at
 org.apache.tapestry5.internal.hibernate.HibernateEntityValueEncoder.init(HibernateEntityValueEncoder.java:51).
 I honestly have no idea what's the deal here, but since I have normal
 table CRUD operation working for numerous other tables, I would assume this
 is somehow related to this table using a composite/compound primary key.
 One thing I did try was to move the static inner class to its own package
 and remove the staticclass modifier, but the exact same error occurred.
 You can see my class below:

 package com.company.crud.entities;



 import java.io.Serializable;



 import javax.persistence.Column;

 import javax.persistence.Entity;

 import javax.persistence.Id;

 import javax.persistence.IdClass;



 import com.company.crud.entities.TransferExtension.TransferExtensionPK;



 @Entity(name = Transfer_Extensions)

 @IdClass(TransferExtensionPK.class)

 public class TransferExtension implements Serializable {

 private static final long serialVersionUID = 1L;



 @Id

 // @NotNull(message = Please supply a Script Code)

 // @Length(min = 3, max = 4)

 @Column(name = Division, nullable = false)

 private String scriptCode;



 @Id

 // @NotNull(message = Please supply a Transfer Type)

 // @Length(min = 3, max = 6)

 @Column(name = Transfer_Type, nullable = false)

 private String transferType;



 @Column(name = Extension, nullable = true)

 private String englishExtension;



 @Column(name = Span_Extension, nullable = true)

 private String spanishExtension;



 @Column(name = Call_Type, nullable = true)

 private String callType;



 @Column(name = Call_Center, nullable = true)

 private String callCenter;



 public TransferExtension() {

 }



 public TransferExtension(String scriptCode, String transferType,

 String englishExtension, String spanishExtension, String
 callType,

 String callCenter) {



 this.callCenter = callCenter;

 this.callType = callType;

 this.englishExtension = englishExtension;

 this.scriptCode = scriptCode;

 this.spanishExtension = spanishExtension;

 this.transferType = transferType;

 }



 public String getScriptCode() {

 return this.scriptCode;

 }



 public void setScriptCode(String scriptCode) {

 this.scriptCode = scriptCode;

 }



 public String getTransferType() {

 return this.transferType;

 }



 public void setTransferType(String transferType) {

 this.transferType = transferType;

 }



 public String getEnglishExtension() {

 return this.englishExtension;

 }



 public void setEnglishExtension(String englishExtension) {

 this.englishExtension = englishExtension;

 }



 public String getSpanishExtension() {

 return this.spanishExtension;

 }



 public void setSpanishExtension(String spanishExtension) {

 this.spanishExtension = spanishExtension;

 }



 public String getCallType() {

 return this.callType;

 }



 public void setCallType(String callType) {

 this.callType = callType;

 }



 public String getCallCenter() {

 return this.callCenter;

 }



 public void setCallCenter(String callCenter) {

 this.callCenter = callCenter;

 }



 @Override

 public 

Re: Two fundamental questions.

2015-01-21 Thread Kalle Korhonen
Always worth mentioning tapestry-model (
http://tynamo.org/tapestry-model+guide) when talking about CRUD. The more
you generalize your T5 CRUD implementation, the more it will start looking
like tapestry-model.

Kalle

On Wed, Jan 21, 2015 at 5:40 AM, Geoff Callender 
geoff.callender.jumpst...@gmail.com wrote:

 For several approaches to CRUD:

 T5.4: http://jumpstart.doublenegative.com.au/jumpstart7
 T5.3: http://jumpstart.doublenegative.com.au/jumpstart

 HTH,

 Geoff

 On 21 Jan 2015, at 8:27 am, Cheng Zhang charlesdenverj...@gmail.com
 wrote:

  Hi all,
 
  I am new to Tapestry. I have two questions.
 
  1. What is the best solution for Tapestry-Cayenne integration?
  I found the only project is as below but it looks like no longer
  developed for over 4 years. And there are no many supporting
  documents.
  https://code.google.com/p/tapestry5-cayenne/
 
  2. I'd like to implement basic CRUD function with a group of data, eg
  show a list of Person(name, phone, address), update person
  information, add new person, delete a person from the list.
  I found there are several components might be used, like Editable
  Grid, Beaneditform, Editable loop. What is the best/widely used way to
  do CRUD? (just the java part, do not need to persist to DB).
 
  Many thanks.
 
  Charles
 
  -
  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: PageRenderLinkSource failing in service when called by cron scheduler - Unable to delegate method invocation to property

2015-01-20 Thread Kalle Korhonen
On Tue, Jan 20, 2015 at 1:23 AM, George Christman gchrist...@cardaddy.com
wrote:

 I'm using T5 beta-25 and I have the following code and I'm noticing
 when the scheduler fires off my service, my PageRenderLinkSource does
 not work. If I manually fire it off through the admin with an
 actionlink, it works without issue.
 I'm seeing the following exception
 java.lang.NullPointerException: Unable to delegate method invocation
 to property 'request' of Proxy for
 RequestGlobals(org.apache.tapestry5.services.RequestGlobals), because
 the property is null.
 Any idea why this isn't working?


Naturally, you don't have a request to work with when you are executing
from a cron job. But if you just want to generate links, you don't need to
and you shouldn't use the request values. Contribute HOSTNAME, HOSTPORT and
HOSTPORT_SECURE and you can generate absolute urls without resorting to
reading the values from the request.

Kalle




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




Re: How to build xml sitemap with cron job and make available publicly

2015-01-19 Thread Kalle Korhonen
On Mon, Jan 19, 2015 at 1:26 PM, Thiago H de Paula Figueiredo 
thiag...@gmail.com wrote:

 On Mon, 19 Jan 2015 19:05:49 -0200, George Christman 
 gchrist...@cardaddy.com wrote:

 Well that is what I'm currently doing, but the problem I'm facing is
 the app generates millions of pages and your only allowed to have 50k
 per sitemap.

  Not really a problem. See http://www.sitemaps.org/protocol.html, section
 Using Sitemap index files (to group multiple sitemap files).

 Is there a way to get around the permission issue and write the file
 to webapp or will I be required to have to figure out an alternate
 approach as you suggested?

  Just write to the right folder. You were trying to write to the
 filesystem root, which wouldn't even work to get the sitemap web-accessible
 even if there was no permission problem. Make your code write the file to
 your expanded WAR root folder in Tomcat or other servlet container. This
 link, http://www.avajava.com/tutorials/lessons/how-do-i-
 get-the-location-of-my-web-application-context-in-the-file-system.html,
 should help you find the right folder.


In general, that's a bad advice. Containers are not required to expand the
WAR file at all and your files would be destroyed every time you deploy
them. I think the general accepted best practice is to pass a writable
directory root as an argument to your web application and write the files
there, for example /var/myapp/data. With T5, I usually supply the path
using symbol, in development environments pointing to build root and
explicitly set to an absolute path in production mode.

Kalle




 --
 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: Prevent Tapestry from redirecting non existing pages to index.

2015-01-05 Thread Kalle Korhonen
Tapestry-routing (http://tynamo.org/tapestry-routing+guide) explicitly
doesn't allow Index pages but lets you specify context-less routes instead
and gives 404 for anything else. I've always thought that's the way it
should work by default.

Kalle

On Mon, Jan 5, 2015 at 12:27 PM, Chris Poulsen mailingl...@nesluop.dk
wrote:

 yeah, examine the eventcontext and return an error/error page or whatever,
 if it does not contain what you expect.

 On Mon, Jan 5, 2015 at 8:28 PM, George Christman gchrist...@cardaddy.com
 wrote:

  So are you saying throw an exception if the home page onActivate
  contains any type of activation context?
 
  On Mon, Jan 5, 2015 at 11:53 AM, Chris Poulsen mailingl...@nesluop.dk
  wrote:
   A strict onActivate in the index page can handle this
  
   On Mon, Jan 5, 2015 at 4:10 PM, George Christman 
  gchrist...@cardaddy.com
   wrote:
  
   Hi guys, I'm wondering if Tapestry has a configuration setting some
   where to prevent the framework from redirecting non existing pages to
   the Index. This creates an SEO nightmare when pages are removed from
   the app, but still exist in the search engines index. They end up
   seeing the index page as having two URL's with duplicate meta tags
   which crushes your page rank. A desired behavior would be to redirect
   them to a page not found. If anybody knows of an easy way to do to
   this, please let me know. Thanks.
  
   -
   To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org
   For additional commands, e-mail: users-h...@tapestry.apache.org
  
  
 
 
 
  --
  George Christman
  CEO
  www.CarDaddy.com
  P.O. Box 735
  Johnstown, New York
 
  -
  To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org
  For additional commands, e-mail: users-h...@tapestry.apache.org
 
 



Re: view http response

2014-12-22 Thread Kalle Korhonen
You could easily write a Tapestry or even a standard servlet filter to
buffer the response and print it out before sending. I think Tapestry
archetype still comes with a sample timer filter, instead you'd just print
out the content.

Kalle

On Mon, Dec 22, 2014 at 8:11 PM, D.R. d.re...@googlemail.com wrote:

 Hi,

 for debugging purposes. Sometimes they not want to believe me. Yes i know
 i can view it in the client, but it would be great to see it on the server
 too.


 Kind regards
 David


 Am 22.12.2014 um 20:12 schrieb Thiago H de Paula Figueiredo:

 On Mon, 22 Dec 2014 13:25:09 -0200, D.R. d.re...@googlemail.com wrote:

  Hi,


 Hi!

  i want to view the http response just before the server will send to the
 client.


 Why?



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




Re: Tynamo Tapestry-Security - Multiple Realms - How to Change Authentication Strategy

2014-12-21 Thread Kalle Korhonen
On Sun, Dec 21, 2014 at 8:55 AM, Charles Karow char...@karow.com wrote:

 I'm using Tynamo Tapestry-Security 0.6.0 with Tapestry 5.4, and finding it
 a very useful tool!!
 I am implementing two realms for two different classes of users that are
 stored in different tables in the database; both will use username/password
 authentication, and thus the same authentication token type. They are
 mutually exclusive - any given user will be found in one realm and not
 found in the other, so I will always have one realm that fails to
 authenticate.
 I see that in Tynamo the default authentication strategy has been replaced
 with a custom FirstExceptionStrategy, which improves the exception
 handling, but will only work if there is only one Realm per Token type.
 (See http://jira.codehaus.org/browse/TYNAMO-154) While I appreciate and
 value the ability to get the original exceptions, right now it seems more
 important to me to be able to have the two realms.
 So it seems to me that I should change the authentication strategy to one
 of Shiro's (e.g. First Successful or At Least One Successful), or
 eventually create my own custom strategy that would give me the best of
 both worlds, by passing on the correct exceptions, while allowing multiple
 realms using the same token type.


If you know the type of the user at login time (for example, your users
have different entry points or they pick a specific domain), it'd be far
easier to create separate tokens for each realm. The type of the token
tells the realm whether it should participate in the authentication of that
token, so if you use the same token for both realms, it'll always try and
fail one.


 I have tried to change the authentication strategy in my AppModule with
 the following code in addRealms():

 SecurityManager sm = SecurityUtils.getSecurityManager();
 DefaultWebSecurityManager wsm = (DefaultWebSecurityManager)sm;  //
  Class cast fails
 ModularRealmAuthenticator mra = (ModularRealmAuthenticator)
 wsm.getAuthenticator();
 mra.setAuthenticationStrategy(new FirstSuccessfulStrategy());

 It fails because the returned SecurityManager is actually the IOC
 ServiceProxy and not the SecurityManager object. I tried similar code in
 the Realm's constructor, with a similar failure.


Yeah, I've never liked that part of Shiro's native api myself (that in
multiple places you are required to downcast to specific types to reveal
more functionality). However, I've tried to publish enough of the security
api as services, so you don't have to navigate through Shiro's object tree
(native Shiro doesn't have such luxuries as an IoC container). In this case
as well, ModularRealmAuthenticator is a service, so you can just obtain it
directly and set a different authentication strategy. See the source for
SecurityModule to find out what exactly is published as a service (
https://github.com/tynamo/tapestry-security/blob/master/src/main/java/org/tynamo/security/services/SecurityModule.java
).

Kalle


Re: Custom error pages with actual messages

2014-12-20 Thread Kalle Korhonen
Right. Well, if it's 5.3.x, you could just as well use tynamo's
tapestry-exceptionpage as a dependency with everything else pretty much
equal.

Kalle

On Fri, Dec 19, 2014 at 5:50 PM, Bob Harner bobhar...@gmail.com wrote:

 No, sorry, it's 5.3.7. This particular project isn't ready to move to
 5.4 yet. I had forgotten about your exception page additions to 5.4,
 thanks for the reminder. That's one of several new things in 5.4 that
 aren't yet well explained anywhere.

 On Fri, Dec 19, 2014 at 7:39 PM, Kalle Korhonen
 kalle.o.korho...@gmail.com wrote:
  For 5.4? Use exceptions, not error codes and the new contributable
  DefaultExceptionHandler. 5.4 contains a built-in a version of
  tapestry-exceptionpage (see
 http://tynamo.org/tapestry-exceptionpage+guide,
  you can map exceptions to specific pages with context). I've written the
  javadocs for 5.4 but I have yet to revise the cwiki documentation (and
 you
  are welcome to help/take charge of that since its your specialty - and
  thanks for the 5.3.8 release notes btw).
 
  Kalle
 
  On Fri, Dec 19, 2014 at 1:54 PM, Bob Harner bobhar...@gmail.com wrote:
 
  Hi everybody,
 
  Whenever I follow the Error Page Recipe [1] to create custom a error
  response page, everything works fine except that, to my knowledge, the
  page can only have a fixed message. For example, my 403 error page
  always says Sorry, you can't have that. That's fine, but what if I
  want my error pages to display the more specific underlying message?
 
  For example, the Java class for one of my app's regular pages has the
  following within an onActivate() method:
 
  return new HttpError(500, The database just blew up);
 
  which generates the proper 500 response to the container. Now, if I
  have NOT configured a custom error response for status 500 in my
  web.xml then my servlet container (Jetty, currently) dutifully
  displays the specific message (the reason) that was given:
 
  HTTP ERROR 500
  Problem accessing /foo. Reason:
  The database just blew up
 
  But I would really like to make the text of that 3rd line (The
  database just blew up) visible within my (Tapestry) custom error
  page. Is there any way to get it? I tried injecting the Response
  object but it doesn't seem to contain anything I can use for this. I
  could copy the message to the session before calling return new
  HttpError() but -- yuk.
 
  Thanks!
 
  [1] http://tapestry.apache.org/error-page-recipe.html
 
  -
  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: Custom error pages with actual messages

2014-12-19 Thread Kalle Korhonen
For 5.4? Use exceptions, not error codes and the new contributable
DefaultExceptionHandler. 5.4 contains a built-in a version of
tapestry-exceptionpage (see http://tynamo.org/tapestry-exceptionpage+guide,
you can map exceptions to specific pages with context). I've written the
javadocs for 5.4 but I have yet to revise the cwiki documentation (and you
are welcome to help/take charge of that since its your specialty - and
thanks for the 5.3.8 release notes btw).

Kalle

On Fri, Dec 19, 2014 at 1:54 PM, Bob Harner bobhar...@gmail.com wrote:

 Hi everybody,

 Whenever I follow the Error Page Recipe [1] to create custom a error
 response page, everything works fine except that, to my knowledge, the
 page can only have a fixed message. For example, my 403 error page
 always says Sorry, you can't have that. That's fine, but what if I
 want my error pages to display the more specific underlying message?

 For example, the Java class for one of my app's regular pages has the
 following within an onActivate() method:

 return new HttpError(500, The database just blew up);

 which generates the proper 500 response to the container. Now, if I
 have NOT configured a custom error response for status 500 in my
 web.xml then my servlet container (Jetty, currently) dutifully
 displays the specific message (the reason) that was given:

 HTTP ERROR 500
 Problem accessing /foo. Reason:
 The database just blew up

 But I would really like to make the text of that 3rd line (The
 database just blew up) visible within my (Tapestry) custom error
 page. Is there any way to get it? I tried injecting the Response
 object but it doesn't seem to contain anything I can use for this. I
 could copy the message to the session before calling return new
 HttpError() but -- yuk.

 Thanks!

 [1] http://tapestry.apache.org/error-page-recipe.html

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




Re: CompressionAnalyzerImpl exception

2014-12-15 Thread Kalle Korhonen
On Mon, Dec 15, 2014 at 12:35 PM, Thiago H de Paula Figueiredo 
thiag...@gmail.com wrote:

 On Mon, 15 Dec 2014 12:05:52 -0200, George Christman 
 gchrist...@cardaddy.com wrote:

 Howard, you were correct. the MIME type was null. CompressionAnalyzerImpl
 was failing on line 32 do to contentType being null. As you stated, this
 NPE is a failure and should probably be checked and thrown with a proper
 message. I ended up having to override the service in order to resolve the
 issue.
 https://github.com/apache/tapestry-5/blob/90766995f59048cb7f7d4cf042a21a
 9d728583db/tapestry-core/src/main/java/org/apache/
 tapestry5/internal/services/assets/CompressionAnalyzerImpl.java


 That's a bug and I'll fix it. JIRA please? :)


While the root cause for the contentType being null is somewhere else,
CompressionAnalyzerImpl should probably just return false on null
contentType rather than throw an exception.

Kalle



 --
 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: Sticky Sessions

2014-12-04 Thread Kalle Korhonen
On Thu, Dec 4, 2014 at 5:54 AM, George Christman gchrist...@cardaddy.com
wrote:

 Hi guys, so I've had a slew of strange behaviors over the past few months
 with a few different Tapestry components such as Tapestry Grid, Tapestry
 Captcha, and writting/removing cookies. Last night I was finally able to
 fix them, but at the cost of a sticky session. My application sits behind a
 load balancer, so my question is why do I need to use a sticky session and
 how do I avoid the use of them? I'm concerned with the fact this is going
 to cause a scaling dilemma.


I'd almost say that sticky sessions are more the norm than the exception
for Java web applications. Unless you change your implementation, you have
a choice between sticky sessions or replicated/centeralized sessions.
Sessions in your cluster are probably not managed by memcached or some such
(which is another single point of failure), causing the strange behavior.
Furthermore, I see neither session usage nor sticky sessions as inherently
bad. Memory is cheap although in today's cloud managed solutions using
memory may end up costing extra to you. It depends on how your load
balancer works and whether the bottleneck in a typical usage pattern is cpu
or memory. Even if your load balancer does a simple random choice but
memory doesn't cost you, you are most likely fine with sticky sessions. If
additional servers cost you, but you can do dynamic horizontal scaling with
cpu/memory thresholds to spawn new instances, then sticky sessions are
actually desirable.

Kalle

PS. @Alex - yes, can configure default persistence strategy with
@Meta(tapestry.persistence-strategy=client) per page - but that only
works if the components don't require an explicit persistence strategy


Re: Sticky Sessions

2014-12-04 Thread Kalle Korhonen
On Thu, Dec 4, 2014 at 12:08 PM, George Christman gchrist...@cardaddy.com
wrote:

 I'd have to say 98% of my app is stateless, I only have a few admin pages
 that still use tapestry grid. Other than that Captcha and Tapestry Security
 redirect seem to be the only two items effected by this, so I don't think
 I'll have a memory issue.


Yeah, that's how it should be.


 Kalle, I still use AWS and thus far it's been very reasonable. I just worry
 instances being held active and running my bill up because of sticky
 sessions. I'll admit, I'm no expert in this, so perhaps my understanding
 isn't correct.
 Is there any recommendation for the timeout? I currently have it set at 0.


That's your issue then, you want to set it to a positive number to let them
expire. From the servlet spec: If the timeout is 0 or less, the container
ensures the default behavior of sessions is never to time out. Personally,
I'm advocating use of short session expiration (in the order of 1-5 mins),
then extending it via async calls (as described in
http://tynamo.org/tapestry-conversations+guide). At least tomcat has a
default expiration of 30 mins, I'm not sure if the spec ever said anything
about it.

Kalle



 On Thu, Dec 4, 2014 at 1:26 PM, Kalle Korhonen kalle.o.korho...@gmail.com
 
 wrote:

  On Thu, Dec 4, 2014 at 5:54 AM, George Christman 
 gchrist...@cardaddy.com
  wrote:
 
   Hi guys, so I've had a slew of strange behaviors over the past few
 months
   with a few different Tapestry components such as Tapestry Grid,
 Tapestry
   Captcha, and writting/removing cookies. Last night I was finally able
 to
   fix them, but at the cost of a sticky session. My application sits
  behind a
   load balancer, so my question is why do I need to use a sticky session
  and
   how do I avoid the use of them? I'm concerned with the fact this is
 going
   to cause a scaling dilemma.
  
 
  I'd almost say that sticky sessions are more the norm than the exception
  for Java web applications. Unless you change your implementation, you
 have
  a choice between sticky sessions or replicated/centeralized sessions.
  Sessions in your cluster are probably not managed by memcached or some
 such
  (which is another single point of failure), causing the strange behavior.
  Furthermore, I see neither session usage nor sticky sessions as
 inherently
  bad. Memory is cheap although in today's cloud managed solutions using
  memory may end up costing extra to you. It depends on how your load
  balancer works and whether the bottleneck in a typical usage pattern is
 cpu
  or memory. Even if your load balancer does a simple random choice but
  memory doesn't cost you, you are most likely fine with sticky sessions.
 If
  additional servers cost you, but you can do dynamic horizontal scaling
 with
  cpu/memory thresholds to spawn new instances, then sticky sessions are
  actually desirable.
 
  Kalle
 
  PS. @Alex - yes, can configure default persistence strategy with
  @Meta(tapestry.persistence-strategy=client) per page - but that only
  works if the components don't require an explicit persistence strategy
 



 --
 George Christman
 CEO
 www.CarDaddy.com
 P.O. Box 735
 Johnstown, New York



Re: Sticky Sessions

2014-12-04 Thread Kalle Korhonen
On Thu, Dec 4, 2014 at 4:43 PM, George Christman gchrist...@cardaddy.com
wrote:

 Well before I had it disabled with the load balancer which was causing the
 issues. It seemed to fix things when I activated it, but it had a default
 time of 0. I'll change it to 5mins for now and if I didn't etend it via
 async, what would happen?


You mean what happens when a server side session expires? Same as if it was
invalidated, i.e.  void *invalidate
https://docs.oracle.com/javaee/5/api/javax/servlet/http/HttpSession.html#invalidate%28%29*
()
  Invalidates this session then unbinds any objects bound to it.

Kalle



 On Thu, Dec 4, 2014 at 3:41 PM, Kalle Korhonen kalle.o.korho...@gmail.com
 
 wrote:

  On Thu, Dec 4, 2014 at 12:08 PM, George Christman 
 gchrist...@cardaddy.com
  
  wrote:
 
   I'd have to say 98% of my app is stateless, I only have a few admin
 pages
   that still use tapestry grid. Other than that Captcha and Tapestry
  Security
   redirect seem to be the only two items effected by this, so I don't
 think
   I'll have a memory issue.
  
 
  Yeah, that's how it should be.
 
 
   Kalle, I still use AWS and thus far it's been very reasonable. I just
  worry
   instances being held active and running my bill up because of sticky
   sessions. I'll admit, I'm no expert in this, so perhaps my
 understanding
   isn't correct.
   Is there any recommendation for the timeout? I currently have it set at
  0.
  
 
  That's your issue then, you want to set it to a positive number to let
 them
  expire. From the servlet spec: If the timeout is 0 or less, the
 container
  ensures the default behavior of sessions is never to time out.
 Personally,
  I'm advocating use of short session expiration (in the order of 1-5
 mins),
  then extending it via async calls (as described in
  http://tynamo.org/tapestry-conversations+guide). At least tomcat has a
  default expiration of 30 mins, I'm not sure if the spec ever said
 anything
  about it.
 
  Kalle
 
 
 
   On Thu, Dec 4, 2014 at 1:26 PM, Kalle Korhonen 
  kalle.o.korho...@gmail.com
   
   wrote:
  
On Thu, Dec 4, 2014 at 5:54 AM, George Christman 
   gchrist...@cardaddy.com
wrote:
   
 Hi guys, so I've had a slew of strange behaviors over the past few
   months
 with a few different Tapestry components such as Tapestry Grid,
   Tapestry
 Captcha, and writting/removing cookies. Last night I was finally
 able
   to
 fix them, but at the cost of a sticky session. My application sits
behind a
 load balancer, so my question is why do I need to use a sticky
  session
and
 how do I avoid the use of them? I'm concerned with the fact this is
   going
 to cause a scaling dilemma.

   
I'd almost say that sticky sessions are more the norm than the
  exception
for Java web applications. Unless you change your implementation, you
   have
a choice between sticky sessions or replicated/centeralized sessions.
Sessions in your cluster are probably not managed by memcached or
 some
   such
(which is another single point of failure), causing the strange
  behavior.
Furthermore, I see neither session usage nor sticky sessions as
   inherently
bad. Memory is cheap although in today's cloud managed solutions
 using
memory may end up costing extra to you. It depends on how your load
balancer works and whether the bottleneck in a typical usage pattern
 is
   cpu
or memory. Even if your load balancer does a simple random choice but
memory doesn't cost you, you are most likely fine with sticky
 sessions.
   If
additional servers cost you, but you can do dynamic horizontal
 scaling
   with
cpu/memory thresholds to spawn new instances, then sticky sessions
 are
actually desirable.
   
Kalle
   
PS. @Alex - yes, can configure default persistence strategy with
@Meta(tapestry.persistence-strategy=client) per page - but that
 only
works if the components don't require an explicit persistence
 strategy
   
  
  
  
   --
   George Christman
   CEO
   www.CarDaddy.com
   P.O. Box 735
   Johnstown, New York
  
 



 --
 George Christman
 CEO
 www.CarDaddy.com
 P.O. Box 735
 Johnstown, New York



Re: URL Rewriting to base

2014-11-17 Thread Kalle Korhonen
Hi George,

is there a convincing reason to use the same page for these two URLs? To
get the same end result with tapestry-routing (
http://tynamo.org/tapestry-routing+guide), I'd create two pages and
annotate them like so:

@At(/{0})
public class Profile {...}

@At(/{0}/{1})
public class AboutProfile {...}

Kalle

On Mon, Nov 17, 2014 at 6:08 AM, George Christman gchrist...@cardaddy.com
wrote:

 I ended up getting it working over the weekend, but boy does it seem like a
 hack. I used some of your work to help me get going such as SimpleLink,
 however I needed the parameters so I needed to complete the class.

 I'll look into a second level cache as that seems to be a better solution
 than what I came up with, for the time being if a page contained a package
 or existed in the root, I just ignored it and skipped the query.

 Where I found things to get very tricky was with the request parameters and
 additional pages. Example

 Original
 domain.com/profile/profiledomain?make=ford
 domain.com/profile/about-us/profiledomain

 profiledomain being the dynamic context

 Rewrite to
 domain/profiledomain?make=ford
 domain/profiledomain/about-us

 I ended up having to create some strange pagelinks where everything points
 back to profile.

 t:pagelink page=profile
 context=dealerProfile.profileDomainProfile/t:pagelink
 t:pagelink page=profile context=[dealerProfile.profileDomain,
 'about-us']About-Us/t:pagelink

 in the end it looks like this
 https://www.cardaddy.com/blue-marlin-motors
 https://www.cardaddy.com/blue-marlin-motors/about-us

 I'll post the rewrite rule later tonight, if you have a moment I'd like
 you take a look to be sure I don't end up shooting myself in the foot long
 term.

 Thiago as always, thank you very much.




 On Mon, Nov 17, 2014 at 6:04 AM, Thiago H de Paula Figueiredo 
 thiag...@gmail.com wrote:

  On Sat, 15 Nov 2014 00:56:58 -0200, George Christman 
  gchrist...@cardaddy.com wrote:
 
   Example domain.com/profile/profiledomain
  to
  domain.com/profile
 
 
  I do stuff very similar to this in Eloquentia (
  https://github.com/thiagohp/eloquentia). See
 https://github.com/thiagohp/
  eloquentia/tree/master/src/main/java/br/com/arsmachina/
  eloquentia/tapestry/urlrewriting. I'm using tapestry-url-rewriter 2.0.0
  for incoming URLs and PageRenderLinkTransformer for outgoing ones.
 
   Now I was able to get it to work with this code, but it's a really bad
  way of doing it do to the fact a query would take place on every single
  page in the app.
 
 
  It's not a bad way actually, specially if you use some kind of cache on
  the query results. You can configure Hibernate to use a second-level
 cache.
  In addition, Tapestry 5.4's tapestry-ioc-jcache + some JCache
  implementation can help you with that in T-IoC level.
 
   So other than ignoring every package and page, how else could I
  dynamically do this?
 
 
  I'm not sure how else you can do that.
 
  --
  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
 
 


 --
 George Christman
 CEO
 www.CarDaddy.com
 P.O. Box 735
 Johnstown, New York



Re: Minify JS / CSS in production

2014-11-14 Thread Kalle Korhonen
Update the version of the offending library, but perhaps not that easy.
Googling the exception gives you these potential matches:
http://stackoverflow.com/questions/25808115/google-contacts-java-lang-nosuchmethoderror-com-google-common-collect-immutab
http://stackoverflow.com/questions/16475015/nosuchmethoderror-google-common-immutableset-copyof

Kalle


On Fri, Nov 14, 2014 at 6:10 AM, Thiago H de Paula Figueiredo 
thiag...@gmail.com wrote:

 On Fri, 14 Nov 2014 11:26:54 -0200, George Christman 
 gchrist...@cardaddy.com wrote:

  So I tried this out last night and ended up with this beautiful exception.
 Any ideas?

 HTTP Status 500 - java.lang.NoSuchMethodError:
 com.google.common.collect.ImmutableSet.of(Ljava/lang/
 Object;Ljava/lang/Object;Ljava/lang/Object;Ljava/lang/
 Object;Ljava/lang/Object;Ljava/lang/Object;[Ljava/lang/
 Object;)Lcom/google/common/collect/ImmutableSet;


 This is a Guava dependency version mismatch, not directly related to
 Tapestry. If you're using Maven, use dependency:tree or the Eclipse pom.xml
 editor to know what's happening.


 --
 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: GAE 5.4-beta22 - access denied for modifyThreadGroup

2014-11-14 Thread Kalle Korhonen
GAE doesn't like user code calling ThreadGroup.getParent() (line 597 of
TapestryInternalUtils, in your stack trace) which seems an unnecessary
restriction given that access to Thread.currentThread().getThreadGroup() is
allowed. I wouldn't be surprised if there was a bug open against GAE on
that.

Anyway, you can certainly get it to work on GAE as well. The simple answer
is that you probably don't want to show the development exception page on
production anyway. Beyond that, you might need to override
ExceptionReport.getThreads() to return perhaps just the current thread. I
don't think the default behavior of Tapestry should change just for GAE.

Kalle

On Fri, Nov 14, 2014 at 3:15 PM, Alex Kotchnev akoch...@gmail.com wrote:

 Bummer, I just confirmed that the same error happens when deployed in
 AppEngine. At first glance this looked similar to an issue that was fixed a
 couple of years ago (https://issues.apache.org/jira/browse/TAP5-1616), but
 this is definitely different. I do recall that in general in production one
 might want to have a different exception page (than this default), yet I
 wonder if there is anything that can still be done about this before 5.4
 goes out (if it's considered important enough for a 5.4 release).

 Cheers - Alex K

 On Fri, Nov 14, 2014 at 6:08 PM, Alex Kotchnev akoch...@gmail.com wrote:

  I took 5.4-beta-22 out for a spin yesterday and I ran into the following
 exception when trying to run the AppEngine local dev server and there is an
 error on the page and Tapestry attempts to display the exception page. I'm
 not yet sure if this is going to work when deployed to AppEngine proper,
 but I was wondering if there is a way to override either whether the
 exception page attempts to do this.
 
 
  In the local environment, I can certainly start the local dev server
 with a jvmFlag-Denable_all_permissions=true/jvmFlag option that avoids
 the issue in my local setup, so it's not a massive deal. Yet, this was
 certainly not happening in 5.3.7 so I wonder what changed.
 
 
  Other than that, 5.4 just looks fantastic - I had been holding off on
 trying it out , but now I can't wait this release to go out !
 
  Any ideas ?
 
 
  Cheers -
 
  org.apache.tapestry5.internal.services.RenderQueueException: Render
 queue error in SetupRender[core/ExceptionReport:loop_0]: Failure reading
 parameter 'source' of component core/ExceptionReport:loop_0: access denied
 (java.lang.RuntimePermission modifyThreadGroup) [at
 classpath:org/apache/tapestry5/corelib/pages/ExceptionReport.tml, line 110]
at
 org.apache.tapestry5.internal.services.RenderQueueImpl.run(RenderQueueImpl.java:87)
at
 org.apache.tapestry5.internal.services.PageRenderQueueImpl.render(PageRenderQueueImpl.java:114)
at $PageRenderQueue_954065d89e49.render(Unknown Source)
at $PageRenderQueue_954065d89e48.render(Unknown Source)
at
 org.apache.tapestry5.internal.services.MarkupRendererTerminator.renderMarkup(MarkupRendererTerminator.java:37)
at
 org.apache.tapestry5.internal.services.PageNameMetaInjector.renderMarkup(PageNameMetaInjector.java:41)
at $MarkupRenderer_954065d89e4c.renderMarkup(Unknown Source)
at
 org.apache.tapestry5.modules.TapestryModule$29.renderMarkup(TapestryModule.java:1810)
at $MarkupRenderer_954065d89e4c.renderMarkup(Unknown Source)
at
 org.apache.tapestry5.modules.TapestryModule$28.renderMarkup(TapestryModule.java:1800)
at $MarkupRenderer_954065d89e4c.renderMarkup(Unknown Source)
at
 org.apache.tapestry5.modules.TapestryModule$27.renderMarkup(TapestryModule.java:1784)
at $MarkupRenderer_954065d89e4c.renderMarkup(Unknown Source)
at
 org.apache.tapestry5.modules.TapestryModule$26.renderMarkup(TapestryModule.java:1768)
at $MarkupRenderer_954065d89e4c.renderMarkup(Unknown Source)
at
 org.apache.tapestry5.internal.services.javascript.AddBrowserCompatibilityStyles.renderMarkup(AddBrowserCompatibilityStyles.java:45)
at $MarkupRenderer_954065d89e4c.renderMarkup(Unknown Source)
at
 org.apache.tapestry5.internal.services.javascript.ConfigureHTMLElementFilter.renderMarkup(ConfigureHTMLElementFilter.java:45)
at $MarkupRenderer_954065d89e4c.renderMarkup(Unknown Source)
at
 org.apache.tapestry5.modules.JavaScriptModule$1.renderMarkup(JavaScriptModule.java:259)
at $MarkupRenderer_954065d89e4c.renderMarkup(Unknown Source)
at
 org.apache.tapestry5.modules.TapestryModule$25.renderMarkup(TapestryModule.java:1751)
at $MarkupRenderer_954065d89e4c.renderMarkup(Unknown Source)
at $MarkupRenderer_954065d89e47.renderMarkup(Unknown Source)
at
 org.apache.tapestry5.internal.services.PageMarkupRendererImpl.renderPageMarkup(PageMarkupRendererImpl.java:47)
at $PageMarkupRenderer_954065d89e45.renderPageMarkup(Unknown
 Source)
at
 

Re: Minify JS / CSS in production

2014-11-13 Thread Kalle Korhonen
It's tapestry-webresources (
http://repo1.maven.org/maven2/org/apache/tapestry/tapestry-webresources/).

Kalle

On Thu, Nov 13, 2014 at 10:42 AM, George Christman gchrist...@cardaddy.com
wrote:

 Thanks Thiago.

 On Thu, Nov 13, 2014 at 1:37 PM, Thiago H de Paula Figueiredo 
 thiag...@gmail.com wrote:

  On Thu, 13 Nov 2014 16:28:01 -0200, George Christman 
  gchrist...@cardaddy.com wrote:
 
   How do I minify tapestry's JS and CSS? Google is complaining saying that
  62.3kib 50% could be saved with the core js alone. It also says
 something
  about optimizing css delivery and points to all the tapestry's css.
 
 
  Check the Minimizing Assets section at the bottom of
  http://tapestry.apache.org/assets.html. Basically, add the
  tapestry-web-resources dependency (Maven snippet below) and set the
  SymbolConstants.MINIFICATION_ENABLED symbol to true.
 
  dependency
  groupIdorg.apache.tapestry/groupId
  artifactIdtapestry-web-resources/artifactId
  version5.4/version
  /dependency
 
  @Contribute(SymbolProvider.class)
  @ApplicationDefaults
  public static void
 contributeApplicationDefaults(MappedConfigurationString,
  String configuration) {
  configuration.add(SymbolConstants.MINIFICATION_ENABLED, true);
  }
 
  --
  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
 
 


 --
 George Christman
 CEO
 www.CarDaddy.com
 P.O. Box 735
 Johnstown, New York



Re: [ANNOUNCEMENT] Project Arras

2014-11-12 Thread Kalle Korhonen
Looks nice, congrats!

Kalle

On Wed, Nov 12, 2014 at 9:27 AM, Felix Scheffer m...@felix-scheffer.de
wrote:

 Hi all,

 I'm pleased to announce the release of arras-components and arras-cms.

 https://github.com/fscheffer/arras/

 *Arras-components* is set of components for Tapestry 5.4 (based on beta
 22).
 Currently the following components are part of the project:
 TabGroup, Dropdown, Lightbox, DataTable, Icon (fontawesome), RemoteSubmit,
 MediumEditor and Player (video and audio).

 Hopefully this list will grow further in the future.

 *Arras-cms* provides simple functionality to change the content of your
 site without actually having to redeploy it. It's using a WYSIWYG approach
 to change the content and is using tapestry-jpa to read and write content
 from and to a database.

 The jar files for both, arras-components and arras-cms, are available on
 Maven Central.

 If there are any questions or suggestions or feedback, feel free to contact
 me.

 Felix Scheffer



tynamo-federatedaccounts 0.5.0 released!

2014-11-12 Thread Kalle Korhonen
Thanks to the enthusiastic, borderline pestering community :), yet another
tynamo module, this time tynamo-federatedaccounts 0.5.0, gets an upgrade to
T5.4! Use it before the code expires, see
http://tynamo.org/tynamo-federatedaccounts+guide and code at
https://github.com/tynamo/tynamo-federatedaccounts.

Release notes at
https://github.com/tynamo/tynamo-federatedaccounts/releases/tag/tynamo-federatedaccounts-parent-0.5.0

   - Upgrade to T5.4 #1
   https://github.com/tynamo/tynamo-federatedaccounts/issues/1
   - Rewrite the CollapsiblePanel component as a requirejs module #2
   https://github.com/tynamo/tynamo-federatedaccounts/issues/2

Enjoy,
The Tynamo Team


  1   2   3   4   5   6   7   8   9   10   >