Re: [Announce] Tapestry5 jQuery integration and Tapestry5-ClientResources

2010-06-07 Thread Robin Komiwes
Hi!

In validation.js [1] , line 31 ;)

The goal of this function is to translate a tapestry validation rule
in a jQuery Validation plugin rule.

For example, tapestry uses the validator numericformat which is
translated to number for jQuery Validation plugin.

Please check the links below for tapestry5 validators [2] and jquery
validators [3] list.

If you find any bug or if you do any improvement, don't hesitate to
fork the repository on Github, make your contribution and then do a
pull request

Regards,

Robin


[1] 
http://github.com/got5/tapestry5-jquery/blob/master/src/main/resources/org/got5/tapestry5/jquery/validation.js
[2] http://tapestry.apache.org/tapestry5.1/guide/validation.html
[3] 
http://docs.jquery.com/Plugins/Validation#List_of_built-in_Validation_methods




On Mon, Jun 7, 2010 at 3:00 AM, Greg Pagendam-Turner
g...@liftyourgame.com wrote:
 Robin,

 I want to customize the jquery validation in a grid. I've been looking
 through the tapestry-jquery code. In validation.js there is reference to a
 function called toJSRule. Where is this function defined please?

 Regards,

 Greg.


 On 3/06/2010 2:23 PM, Greg Pagendam-Turner wrote:

 Robin,

 I tend to agree about the popups. Do you have any examples please of how
 you've used validation please? Are you using it in a grid at all? Do you
 completely steer clear of the existing Tapestry required validations and
 just code using the jQuery validator direct in your page?

 Regards,

 Greg.


 On 1/06/2010 5:48 PM, Robin Komiwes wrote:

 Validation change is a design choice.
 Most of the designers of my company (and also myself) have found that
 ErrorPopups may be too intrusives.
 You may be interested by this article:
 http://www.alistapart.com/articles/inline-validation-in-web-forms/

 Be reassured, the jQuery plugin used for validation is very, very
 customizable. Have a look to the demos at the end of the plugin
 documentation page : http://docs.jquery.com/Plugins/Validation

 The only cons ATM is that the jQuery Validation plugin does not have a
 built in validator for regular expressions.

 Regards,

 Robin



 On Tue, Jun 1, 2010 at 9:20 AM, Greg Pagendam-Turner
 g...@liftyourgame.comwrote:

 Robin,

 Thanks. Looks like the issue with my Dialog is that I still had some
 prototype code that was confusing things. The dialogs now come up.

 I've raised an issue for the datefield in AjaxFormLoop.

 How is the validation handled in tapestry jquery? Unlike with prototype
 the
 error just seems to be inserted inline (without any special formatting)
 rather than being shown as a popup when using the prototype
 implementation.

 Regards,

 Greg.



 On 1/06/2010 5:10 PM, Robin Komiwes wrote:

 Hi!

 Concerning the Dialog component, default is to not show the dialog.
 See autoOpen value in the Dialog component:


 http://github.com/got5/tapestry5-jquery/blob/master/src/main/java/org/got5/tapestry5/jquery/components/Dialog.java

 Concerning the datefield, I'll have a look and try to make a test case.

 Please post an issue on Github for both items and we will try to find
 out
 what is not working.

 Regards,

 Robin


 On Tue, Jun 1, 2010 at 4:36 AM, liftyourgameg...@liftyourgame.com
  wrote:



 Robin,

 I've tried to use the JQueryDialog as documented in the sample.

 I was expecting the dialog to be hidden until the j.querydialoglink
 was
 clicked but the dialog comes up as rendered.

 Am I using the component the right way? Is there a documentation page
 yet?

 I've noticed also that the jquery.datetime component does not popup
 for
 datetime fields in an AjaxFormLoop when specified  by:

 tr t:type=AjaxFormLoop t:source=entityHolders
 t:value=entityHolder
 t:encoder=encoder

 t:unless t:test=entityHolder.deleted

 t:submitnotifier

 tdt:textfield t:id=stepName class=stepName
 validate=required value=entityHolder.entity.actionName//td

 tdt:jquery.datefield t:id=stepTargetDate
 class=targetDate
 validate=required size=12
 value=entityHolder.entity.targetDate//td

 tdt:jquery.datefield t:id=stepActualDate
 class=actualDate
 size=12 value=entityHolder.entity.actualDate//td

 tdt:removerowlinkremove/t:removerowlink/td

 /t:submitnotifier

 /t:unless

 t:parameter name=addRow

 td colspan=* style=text-align: right

 t:addrowlinkAdd a row/t:addrowlink

 /td

 /t:parameter
 /tr


 Regards,

 Greg.



 Robin K. wrote:


 Hi! Just saw your email.

 Dialog component is still under development and will be released with
 1.1.0.
 Anyway, there is a test application bundled with this project. Each
 component is tested in a custom page which could also be used a
 sample.
 You may be interested by:




 http://github.com/got5/tapestry5-jquery/blob/master/src/test/java/org/got5/tapestry5/jquery/test/pages/JQueryDialog.java




 http://github.com/got5/tapestry5-jquery/blob/master/src/test/resources/org/got5/tapestry5/jquery/test/pages/JQueryDialog.tml


 If you have any suggestion to improve this component please post an
 issue
 here : 

Render phase return type equivalent to void

2010-06-07 Thread Joost Schouten (ml)

Hi,

I have build a RestrictedVisibility Mixin which shows or hides an entire 
component by returning true or false in the @SetupRender method [1]. 
This works well but I just realized there is one drawback. When I return 
true, setup render skips to the next step (@BeginRender) where I would 
like it to continue down the line so @SetupRender of the component it is 
mixed in is also executed.


I have partially solved this by annotating the mixing with @MixinAfter, 
but now I execute the setup render methods of components that are never 
shown which not ideal.


Is there another return type or another way to achieve this? Or are 
there better ways to achieve my visibility restriction.


Thanks,
Joost

[1] (simplified)
@SetupRender
private Object setup() {
   if(showComponent) {
   return true;
   }
   return false;
}

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



Re: Problem with context

2010-06-07 Thread Khalid EL BOUKHARI
Thanks for your response. Sorry my question wasn't clair. What I want to ask
for is :
This redirection is done with a return class in my java file. The
correspondig tml file is empty (just html/html ).
In my Junit test file I create a Document who gets my page but it return
an application exception:
Document myIndexPage = pageTester.renderPage(Index).

index.tml is the redirection page.


multiple layout components

2010-06-07 Thread Paul Stanton

Hi list,

I have an application that needs multiple levels of common layout markup.

I'm sure this is possible but can't figure out how to get it to work via 
tap5.1


For example (very much simplified), I need BaseLayout.tml like so:

html  xmlns=http://www.w3.org/1999/xhtml; 
xmlns:t=http://tapestry.apache.org/schema/tapestry_5_1_0.xsd; 
xmlns:p=tapestry:parameter

body
center
t:body /
/center
/body
/html

and GroupLayout.tml like so:

html  type=baselayout xmlns=http://www.w3.org/1999/xhtml; 
xmlns:t=http://tapestry.apache.org/schema/tapestry_5_1_0.xsd; 
xmlns:p=tapestry:parameter

b
t:body /
/b
/html

then a page that uses the GroupLayout:

html  type=grouplayout xmlns=http://www.w3.org/1999/xhtml; 
xmlns:t=http://tapestry.apache.org/schema/tapestry_5_1_0.xsd; 
xmlns:p=tapestry:parameter

hello world
/html

and the result should be (minus extra html)

htmlbodycenterbhello world/b/center/body/html

Hopefully from the example (which doesn't work in that the b tags are 
missing) you can see what i'm trying to achieve. Does anyone know how to 
accomplish this?


sorry for the cryptic post.

p.

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



Re: multiple layout components

2010-06-07 Thread Christophe Cordenier
Hi

Your exemple should work, does your GroupLayout.java extends the base one ?

A concrete exemple is available at
http://github.com/robink/wooki/tree/master/src/main/java/com/wooki/components
with
BookLayout and Layout components.

2010/6/7 Paul Stanton p...@mapshed.com.au

 Hi list,

 I have an application that needs multiple levels of common layout markup.

 I'm sure this is possible but can't figure out how to get it to work via
 tap5.1

 For example (very much simplified), I need BaseLayout.tml like so:

 html  xmlns=http://www.w3.org/1999/xhtml; xmlns:t=
 http://tapestry.apache.org/schema/tapestry_5_1_0.xsd;
 xmlns:p=tapestry:parameter
 body
 center
 t:body /
 /center
 /body
 /html

 and GroupLayout.tml like so:

 html  type=baselayout xmlns=http://www.w3.org/1999/xhtml; xmlns:t=
 http://tapestry.apache.org/schema/tapestry_5_1_0.xsd;
 xmlns:p=tapestry:parameter
 b
 t:body /
 /b
 /html

 then a page that uses the GroupLayout:

 html  type=grouplayout xmlns=http://www.w3.org/1999/xhtml; xmlns:t=
 http://tapestry.apache.org/schema/tapestry_5_1_0.xsd;
 xmlns:p=tapestry:parameter
 hello world
 /html

 and the result should be (minus extra html)

 htmlbodycenterbhello world/b/center/body/html

 Hopefully from the example (which doesn't work in that the b tags are
 missing) you can see what i'm trying to achieve. Does anyone know how to
 accomplish this?

 sorry for the cryptic post.

 p.

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




-- 
Regards,
Christophe Cordenier.

Developer of wooki @wookicentral.com


Re: Problem with context

2010-06-07 Thread Christophe Cordenier
Hi

To develop unit test of pages that requires context parameters values, i use
to create an input page that contains pagelinks with context
parameter values set to the values i want to test. Then i use pagetester to
render the input page, and call the click method to trigger the different
links.



2010/6/7 Khalid EL BOUKHARI elboukh...@gmail.com

 Thanks for your response. Sorry my question wasn't clair. What I want to
 ask
 for is :
 This redirection is done with a return class in my java file. The
 correspondig tml file is empty (just html/html ).
 In my Junit test file I create a Document who gets my page but it return
 an application exception:
 Document myIndexPage = pageTester.renderPage(Index).

 index.tml is the redirection page.




-- 
Regards,
Christophe Cordenier.

Developer of wooki @wookicentral.com


Re: multiple layout components

2010-06-07 Thread Paul Stanton

Hi Chris,

Sorry I had made a mistake .. you are right, my simplified example 
should have worked.


Regards, p.

Christophe Cordenier wrote:

Hi

Your exemple should work, does your GroupLayout.java extends the base one ?

A concrete exemple is available at
http://github.com/robink/wooki/tree/master/src/main/java/com/wooki/components
with
BookLayout and Layout components.

2010/6/7 Paul Stanton p...@mapshed.com.au

  

Hi list,

I have an application that needs multiple levels of common layout markup.

I'm sure this is possible but can't figure out how to get it to work via
tap5.1

For example (very much simplified), I need BaseLayout.tml like so:

html  xmlns=http://www.w3.org/1999/xhtml; xmlns:t=
http://tapestry.apache.org/schema/tapestry_5_1_0.xsd;
xmlns:p=tapestry:parameter
body
center
t:body /
/center
/body
/html

and GroupLayout.tml like so:

html  type=baselayout xmlns=http://www.w3.org/1999/xhtml; xmlns:t=
http://tapestry.apache.org/schema/tapestry_5_1_0.xsd;
xmlns:p=tapestry:parameter
b
t:body /
/b
/html

then a page that uses the GroupLayout:

html  type=grouplayout xmlns=http://www.w3.org/1999/xhtml; xmlns:t=
http://tapestry.apache.org/schema/tapestry_5_1_0.xsd;
xmlns:p=tapestry:parameter
hello world
/html

and the result should be (minus extra html)

htmlbodycenterbhello world/b/center/body/html

Hopefully from the example (which doesn't work in that the b tags are
missing) you can see what i'm trying to achieve. Does anyone know how to
accomplish this?

sorry for the cryptic post.

p.

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






  


Re: Render phase return type equivalent to void

2010-06-07 Thread Thiago H. de Paula Figueiredo
On Mon, 07 Jun 2010 04:36:08 -0300, Joost Schouten (ml)  
joost...@jsportal.com wrote:



Hi,


Hi!

Render phase return type equivalent to void: null.

--
Thiago H. de Paula Figueiredo
Independent Java, Apache Tapestry 5 and Hibernate consultant, developer,  
and instructor

Owner, Ars Machina Tecnologia da Informação Ltda.
http://www.arsmachina.com.br

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



Re: Render phase return type equivalent to void

2010-06-07 Thread Joost Schouten (ml)

So simple, I could have guessed that ;-)

Thanks,
Joost

Thiago H. de Paula Figueiredo wrote:
On Mon, 07 Jun 2010 04:36:08 -0300, Joost Schouten (ml) 
joost...@jsportal.com wrote:



Hi,


Hi!

Render phase return type equivalent to void: null.




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



Re: Why is TapestryFilter.doFilter final?

2010-06-07 Thread Dmitry Gusev
Alex,

if you mean exception handling, I've just decorated RequestExceptionHandling
like this:

public RequestExceptionHandler decorateRequestExceptionHandler(
final Logger logger,
final Response response,
@Symbol(SymbolConstants.PRODUCTION_MODE)
boolean productionMode)
{
if (!productionMode) return null;

return new RequestExceptionHandler()
{
public void handleRequestException(Throwable exception) throws
IOException
{
logger.error(Unexpected runtime exception:  +
exception.getMessage(), exception);


response.sendError(HttpServletResponse.SC_INTERNAL_SERVER_ERROR, null);
}
};
}

Then in web.xml I added 500 error page:

...
error-page
error-code500/error-code
location/500.html/location
/error-page
 /web-app

I also ended with writing custom filter wrapping T5 to not load tapestry for
non-tapestry related requests wich may affect T5 by /* filter url pattern.

Not sure if I have some really generic code for tapestry5-gae.
However there are some tips  tricks I may share about tapestry5 for gae/j.
Probably I will write blogpost (or page in T5 wiki) on this later this/next
month.


On Mon, Jun 7, 2010 at 08:17, Alex Kotchnev akoch...@gmail.com wrote:

 Dmitry,
   could you possibly share what you come up with - this seems like
 something generically useful when running in GAE . Is there any possiblity
 for tapestry5-gae module ?

 Regards,

 Alex K

 On Wed, Jun 2, 2010 at 2:38 PM, Dmitry Gusev dmitry.gu...@gmail.com
 wrote:

  I'm thinking how to handle
  com.google.apphosting.api.DeadlineExceededException.
  This exception thrown in GAE if request processed more than 30 seconds
 and
  I
  have only ~400 ms to handle this error untill
  com.google.apphosting.runtime.HardDeadlineExceededError thrown.
 
  I was thinking to override filter and wrap doFilter with try/catch. But
 now
  I see that there is RequestExceptionHandler for these purposes.
  Looks like DefaultRequestExceptionHandler can't handle exception in 400
 ms.
  I think I will override this handler and just send response redirect to
  some
  static 500.html page.
 
  On Wed, Jun 2, 2010 at 21:25, Howard Lewis Ship hls...@gmail.com
 wrote:
 
   What are you trying to accomplish?  Tapestry already has great
   mechanisms for extending the request processing behavior, including
   dealing with thrown exceptions. That's why such methods are final, to
   encourage you to look in the correct place.
  
   On Wed, Jun 2, 2010 at 10:14 AM, Dmitry Gusev dmitry.gu...@gmail.com
   wrote:
I need to override this method to wrap it with try/catch but can't do
  it
right now.
   
Is there any reason why this method was declared final?
   
--
Dmitry Gusev
   
AnjLab Team
http://anjlab.com
   
  
  
  
   --
   Howard M. Lewis Ship
  
   Creator of Apache Tapestry
  
   The source for Tapestry training, mentoring and support. Contact me to
   learn how I can get you up and productive in Tapestry fast!
  
   (971) 678-5210
   http://howardlewisship.com
  
   -
   To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org
   For additional commands, e-mail: users-h...@tapestry.apache.org
  
  
 
 
  --
  Dmitry Gusev
 
  AnjLab Team
  http://anjlab.com
 




-- 
Dmitry Gusev

AnjLab Team
http://anjlab.com


Re: Why is TapestryFilter.doFilter final?

2010-06-07 Thread Thiago H. de Paula Figueiredo
On Mon, 07 Jun 2010 09:31:01 -0300, Dmitry Gusev dmitry.gu...@gmail.com  
wrote:


I also ended with writing custom filter wrapping T5 to not load tapestry  
for non-tapestry related requests wich may affect T5 by /* filter url  
pattern.


Servlet filters are loaded just once. I guess you meant Tapestry not  
handling some requests.
Tapestry already doesn't handles requests that aren't made to paths  
handled by Tapestry. You can configure it adding this method to your  
AppModule:


public static void contributeIgnoredPathsFilter(ConfigurationString  
configuration) {

configuration.add(/dwr/.*);
}

This examples tells Tapestry to not touch requests to the dwr folder.

--
Thiago H. de Paula Figueiredo
Independent Java, Apache Tapestry 5 and Hibernate consultant, developer,  
and instructor

Owner, Ars Machina Tecnologia da Informação Ltda.
http://www.arsmachina.com.br

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



Re: Why is TapestryFilter.doFilter final?

2010-06-07 Thread Dmitry Gusev

 Servlet filters are loaded just once.


This is exactly what I mean, I don't want tapestry to load even once for
some requests. GAE shutdown/startup instances very often (one new instance
per ~3 minues) and this consumes additional resources.

I have around 12K requests per day ATM and every request billed by cpu
usage.
So I decided to refuse from tapestry for some requests and use pure filter
API.

Btw I use gnoredPathsFilters for GAE dev server admin console and appstats:

public static void contributeIgnoredPathsFilter(ConfigurationString
configuration) {
//GAE filters
configuration.add(/_ah/.*);
//  GAE Appstats
configuration.add(/appstats/.*);
}

On Mon, Jun 7, 2010 at 17:22, Thiago H. de Paula Figueiredo 
thiag...@gmail.com wrote:

 On Mon, 07 Jun 2010 09:31:01 -0300, Dmitry Gusev dmitry.gu...@gmail.com
 wrote:

  I also ended with writing custom filter wrapping T5 to not load tapestry
 for non-tapestry related requests wich may affect T5 by /* filter url
 pattern.


 Servlet filters are loaded just once. I guess you meant Tapestry not
 handling some requests.
 Tapestry already doesn't handles requests that aren't made to paths handled
 by Tapestry. You can configure it adding this method to your AppModule:

 public static void contributeIgnoredPathsFilter(ConfigurationString
 configuration) {
configuration.add(/dwr/.*);
 }

 This examples tells Tapestry to not touch requests to the dwr folder.

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

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




-- 
Dmitry Gusev

AnjLab Team
http://anjlab.com


Re: Why is TapestryFilter.doFilter final?

2010-06-07 Thread Thiago H. de Paula Figueiredo
On Mon, 07 Jun 2010 10:42:52 -0300, Dmitry Gusev dmitry.gu...@gmail.com  
wrote:



This is exactly what I mean, I don't want tapestry to load even once for
some requests. GAE shutdown/startup instances very often (one new  
instance per ~3 minues) and this consumes additional resources.


Oops, I forgot this GAE characteristic and what you said makes sense now.  
:)


--
Thiago H. de Paula Figueiredo
Independent Java, Apache Tapestry 5 and Hibernate consultant, developer,  
and instructor

Owner, Ars Machina Tecnologia da Informação Ltda.
http://www.arsmachina.com.br

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



Tapestry in GAE

2010-06-07 Thread Howard Lewis Ship
That's interesting, that GAE shuts down your instances.  There's a bit of
Tapestry based on the idea that the application is long running, so it's OK
if it takes a moment to start up initially. Under GAE that's not the case
... perhaps Tapestry under GAE should be even a bit lazier about loading and
instantiating.

When GAE shuts down the instance, is it undeploying the WAR?  All told, I
think the most significant amount of time spent starting up a T5 app is the
initial load of all those classes. I can see these during the Selenium
integration tests, where the second test app to start up (all within the
same JVM) is much faster because all the framework classes have already been
loaded.


On Mon, Jun 7, 2010 at 7:01 AM, Thiago H. de Paula Figueiredo 
thiag...@gmail.com wrote:

 On Mon, 07 Jun 2010 10:42:52 -0300, Dmitry Gusev dmitry.gu...@gmail.com
 wrote:

  This is exactly what I mean, I don't want tapestry to load even once for
 some requests. GAE shutdown/startup instances very often (one new instance
 per ~3 minues) and this consumes additional resources.


 Oops, I forgot this GAE characteristic and what you said makes sense now.
 :)

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

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




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


Not Found Directed to Index

2010-06-07 Thread Todd Orr
I've setup a custom 404 page according to
http://wiki.apache.org/tapestry/Tapestry5HowToUseTapestryForCustomErrorPages.
However, whenever I navigate to a URL that does not exist Tapestry simply
renders the index page for that directory or a directory above if none
exists in that directory. How do you force Tapestry to use a custom 404?


Re: Not Found Directed to Index

2010-06-07 Thread Kalle Korhonen
Use a Start page instead of an Index page - the index page treats
everything as the context for the Index page if the string doesn't map
to any other page.

Kalle


On Mon, Jun 7, 2010 at 9:43 AM, Todd Orr torr0...@gmail.com wrote:
 I've setup a custom 404 page according to
 http://wiki.apache.org/tapestry/Tapestry5HowToUseTapestryForCustomErrorPages.
 However, whenever I navigate to a URL that does not exist Tapestry simply
 renders the index page for that directory or a directory above if none
 exists in that directory. How do you force Tapestry to use a custom 404?


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



Re: Not Found Directed to Index

2010-06-07 Thread Todd Orr
Thanks Kalle,

This works. However, it is awkward as now I need to specifically refer to my
start page rather than the directory, somedir/start vs somedir/. I hope this
is resolved in future releases.

On Mon, Jun 7, 2010 at 12:50 PM, Kalle Korhonen
kalle.o.korho...@gmail.comwrote:

 Use a Start page instead of an Index page - the index page treats
 everything as the context for the Index page if the string doesn't map
 to any other page.

 Kalle


 On Mon, Jun 7, 2010 at 9:43 AM, Todd Orr torr0...@gmail.com wrote:
  I've setup a custom 404 page according to
 
 http://wiki.apache.org/tapestry/Tapestry5HowToUseTapestryForCustomErrorPages
 .
  However, whenever I navigate to a URL that does not exist Tapestry simply
  renders the index page for that directory or a directory above if none
  exists in that directory. How do you force Tapestry to use a custom 404?
 

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




Re: Not Found Directed to Index

2010-06-07 Thread Kalle Korhonen
On Mon, Jun 7, 2010 at 10:31 AM, Todd Orr torr0...@gmail.com wrote:
 This works. However, it is awkward as now I need to specifically refer to my
 start page rather than the directory, somedir/start vs somedir/. I hope this
 is resolved in future releases.

What I do is that I use a Start page at the root level (which is
rendered if user requests just the root context) and Index pages in
sub-directories - if users get at least the directory right in the
latter case I can then handle showing 404s manually in onActivate() if
I need to). But yes, the built-in logic is perhaps a bit immature but
I'm not sure what would be the ideal approach. On one hand, you want
to handle custom context and not show unnecessary errors, but on the
other hand you do want 404 on urls that really don't exist in your
application.

Kalle


 On Mon, Jun 7, 2010 at 12:50 PM, Kalle Korhonen
 kalle.o.korho...@gmail.comwrote:

 Use a Start page instead of an Index page - the index page treats
 everything as the context for the Index page if the string doesn't map
 to any other page.

 Kalle


 On Mon, Jun 7, 2010 at 9:43 AM, Todd Orr torr0...@gmail.com wrote:
  I've setup a custom 404 page according to
 
 http://wiki.apache.org/tapestry/Tapestry5HowToUseTapestryForCustomErrorPages
 .
  However, whenever I navigate to a URL that does not exist Tapestry simply
  renders the index page for that directory or a directory above if none
  exists in that directory. How do you force Tapestry to use a custom 404?
 

 -
 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: Not Found Directed to Index

2010-06-07 Thread Josh Canfield
If you're index page is supposed to render something and the
parameters are all wrong then you can return a 404 from there. The
strategy that I'm using is to gather up all my parameters in specific
onActivate methods and then the empty param onActivate checks the
context and returns 404 if it's not valid.

Object onActivate() {
if ( !isValidContext() ) {
return new ErrorCode(404, The requested page was not found);
}
return null;
}

The code for implementing ErrorCode can be found in the archives of this list.

Josh

On Mon, Jun 7, 2010 at 10:52 AM, Kalle Korhonen
kalle.o.korho...@gmail.com wrote:
 On Mon, Jun 7, 2010 at 10:31 AM, Todd Orr torr0...@gmail.com wrote:
 This works. However, it is awkward as now I need to specifically refer to my
 start page rather than the directory, somedir/start vs somedir/. I hope this
 is resolved in future releases.

 What I do is that I use a Start page at the root level (which is
 rendered if user requests just the root context) and Index pages in
 sub-directories - if users get at least the directory right in the
 latter case I can then handle showing 404s manually in onActivate() if
 I need to). But yes, the built-in logic is perhaps a bit immature but
 I'm not sure what would be the ideal approach. On one hand, you want
 to handle custom context and not show unnecessary errors, but on the
 other hand you do want 404 on urls that really don't exist in your
 application.

 Kalle


 On Mon, Jun 7, 2010 at 12:50 PM, Kalle Korhonen
 kalle.o.korho...@gmail.comwrote:

 Use a Start page instead of an Index page - the index page treats
 everything as the context for the Index page if the string doesn't map
 to any other page.

 Kalle


 On Mon, Jun 7, 2010 at 9:43 AM, Todd Orr torr0...@gmail.com wrote:
  I've setup a custom 404 page according to
 
 http://wiki.apache.org/tapestry/Tapestry5HowToUseTapestryForCustomErrorPages
 .
  However, whenever I navigate to a URL that does not exist Tapestry simply
  renders the index page for that directory or a directory above if none
  exists in that directory. How do you force Tapestry to use a custom 404?
 

 -
 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





-- 
--
http://www.bodylabgym.com - a private, by appointment only, one-on-one
health and fitness facility.
--
http://www.ectransition.com - Quality Electronic Cigarettes at a
reasonable price!
--
TheDailyTube.com. Sign up and get the best new videos on the internet
delivered fresh to your inbox.

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



Re: Tapestry in GAE

2010-06-07 Thread Andreas Andreou
http://www.answercow.com/2010/03/google-app-engine-cold-start-guide-for.html is
an interesting read on how much startup time is spent on several java
libraries at
GAE

On Mon, Jun 7, 2010 at 19:38, Howard Lewis Ship hls...@gmail.com wrote:
 That's interesting, that GAE shuts down your instances.  There's a bit of
 Tapestry based on the idea that the application is long running, so it's OK
 if it takes a moment to start up initially. Under GAE that's not the case
 ... perhaps Tapestry under GAE should be even a bit lazier about loading and
 instantiating.

 When GAE shuts down the instance, is it undeploying the WAR?  All told, I
 think the most significant amount of time spent starting up a T5 app is the
 initial load of all those classes. I can see these during the Selenium
 integration tests, where the second test app to start up (all within the
 same JVM) is much faster because all the framework classes have already been
 loaded.


 On Mon, Jun 7, 2010 at 7:01 AM, Thiago H. de Paula Figueiredo 
 thiag...@gmail.com wrote:

 On Mon, 07 Jun 2010 10:42:52 -0300, Dmitry Gusev dmitry.gu...@gmail.com
 wrote:

  This is exactly what I mean, I don't want tapestry to load even once for
 some requests. GAE shutdown/startup instances very often (one new instance
 per ~3 minues) and this consumes additional resources.


 Oops, I forgot this GAE characteristic and what you said makes sense now.
 :)

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

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




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




-- 
Andreas Andreou - andy...@apache.org - http://blog.andyhot.gr
Tapestry PMC / Tacos developer
Open Source / JEE Consulting

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



Re: Tapestry in GAE

2010-06-07 Thread Alex Kotchnev
Indeed, if you let the app go cold, you will quickly spend a large amount of
your GAE free quota on starting up the app (in addition to having a really
slow load of the first page).

I have a cron task on a separate box that wget-s the whole site every 3
seconds. This ends up eating up about 20% of my free quota every day;
however, it keeps GAE from swapping it out and having to cold start the app
(which, would have still easily eaten 20% of my free CPU quota anyway). Not
to mention, that when the app is not swapped out, there's no real penalty
on first load.

Not the perfect solution but it works.

Regards,

Alex K

On Mon, Jun 7, 2010 at 2:40 PM, Andreas Andreou andy...@di.uoa.gr wrote:


 http://www.answercow.com/2010/03/google-app-engine-cold-start-guide-for.htmlis
 an interesting read on how much startup time is spent on several java
 libraries at
 GAE

 On Mon, Jun 7, 2010 at 19:38, Howard Lewis Ship hls...@gmail.com wrote:
  That's interesting, that GAE shuts down your instances.  There's a bit of
  Tapestry based on the idea that the application is long running, so it's
 OK
  if it takes a moment to start up initially. Under GAE that's not the case
  ... perhaps Tapestry under GAE should be even a bit lazier about loading
 and
  instantiating.
 
  When GAE shuts down the instance, is it undeploying the WAR?  All told, I
  think the most significant amount of time spent starting up a T5 app is
 the
  initial load of all those classes. I can see these during the Selenium
  integration tests, where the second test app to start up (all within the
  same JVM) is much faster because all the framework classes have already
 been
  loaded.
 
 
  On Mon, Jun 7, 2010 at 7:01 AM, Thiago H. de Paula Figueiredo 
  thiag...@gmail.com wrote:
 
  On Mon, 07 Jun 2010 10:42:52 -0300, Dmitry Gusev 
 dmitry.gu...@gmail.com
  wrote:
 
   This is exactly what I mean, I don't want tapestry to load even once
 for
  some requests. GAE shutdown/startup instances very often (one new
 instance
  per ~3 minues) and this consumes additional resources.
 
 
  Oops, I forgot this GAE characteristic and what you said makes sense
 now.
  :)
 
  --
  Thiago H. de Paula Figueiredo
  Independent Java, Apache Tapestry 5 and Hibernate consultant, developer,
  and instructor
  Owner, Ars Machina Tecnologia da Informação Ltda.
  http://www.arsmachina.com.br
 
  -
  To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org
  For additional commands, e-mail: users-h...@tapestry.apache.org
 
 
 
 
  --
  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
 



 --
 Andreas Andreou - andy...@apache.org - http://blog.andyhot.gr
 Tapestry PMC / Tacos developer
 Open Source / JEE Consulting

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




NPE in afterRender method in Tomcat

2010-06-07 Thread Radek Terber

Hi

I have such problem: I have quite simple T5 application - (T5 + 
hibernate), currently compiled under T 5.1.0.5. When I run it under 
Jetty (ver. 8.0.0), it runs fine.
But when I try it to start under Tomcat, I get NullPointerException that 
(probably) indicates the underline request is null.
I tested it under Tomcat 6.0.18, 6.0.20 and 6.0.26. Tomcats was pure 
installations - with no aditional libraries.

It runs under Java 6.18 on Win7, the same problem in on Linux and Java 6.16.
I could post application's war somewhere, but it is quite big (cca 28M 
including libraries), ant it requires our application server running 
anywhere in LAN to run.


Here it the eception:
---
[ERROR] TapestryModule.RequestExceptionHandler Processing of request 
failed with uncaught exception: Render queue error in AfterRender[Index

:layout.loginform]: org.apache.tapestry5.ioc.internal.util.TapestryException
org.apache.tapestry5.internal.services.RenderQueueException: Render 
queue error in AfterRender[Index:layout.loginform]: org.apache.tapestry5
.ioc.internal.util.TapestryException [at 
classpath:cz/gapo/weby/jmenovky/components/layout/Layout.tml, line 25]
at 
org.apache.tapestry5.internal.services.RenderQueueImpl.run(RenderQueueImpl.java:86)
at 
org.apache.tapestry5.internal.services.PageRenderQueueImpl.render(PageRenderQueueImpl.java:121)

... (I deleted it) ...
at java.lang.Thread.run(Thread.java:619)
Caused by: org.apache.tapestry5.ioc.internal.util.TapestryException [at 
classpath:cz/gapo/weby/jmenovky/components/layout/Layout.tml, line 25]
at 
org.apache.tapestry5.internal.structure.ComponentPageElementImpl.invoke(ComponentPageElementImpl.java:948)
at 
org.apache.tapestry5.internal.structure.ComponentPageElementImpl.access$400(ComponentPageElementImpl.java:49)
at 
org.apache.tapestry5.internal.structure.ComponentPageElementImpl$AbstractPhase.callback(ComponentPageElementImpl.java:159)
at 
org.apache.tapestry5.internal.structure.ComponentPageElementImpl$AfterRenderPhase.render(ComponentPageElementImpl.java:374)
at 
org.apache.tapestry5.internal.services.RenderQueueImpl.run(RenderQueueImpl.java:74)

... 68 more
Caused by: java.lang.NullPointerException
at 
org.apache.catalina.connector.Request.getAttribute(Request.java:877)
at 
org.apache.catalina.connector.RequestFacade.getAttribute(RequestFacade.java:263)
at 
cz.gapo.webapps.common.t5.components.LoginForm.afterRender(LoginForm.java:127)
at 
cz.gapo.webapps.common.t5.components.LoginForm.afterRender(LoginForm.java)
at 
org.apache.tapestry5.internal.structure.ComponentPageElementImpl$AfterRenderPhase.invokeComponent(ComponentPageElementImpl.java:369)
at 
org.apache.tapestry5.internal.structure.ComponentPageElementImpl$AbstractPhase.run(ComponentPageElementImpl.java:164)
at 
org.apache.tapestry5.internal.structure.ComponentPageElementImpl.invoke(ComponentPageElementImpl.java:933)

... 72 more


The code fragment cause it:
---
@Inject
private RenderSupport rsup;

@Inject
private Request request;

@AfterRender
public void afterRender(MarkupWriter wr) {
 boolean requireLogin = 
request.getAttribute(Constants.REQUIRED_LOGIN_RQATR) != null;// 
here the NPE is thrown, but the request is not null

if (requireLogin) {
rsup.addScript($j(function() {);
rsup.addScript($j(\#loginFormDialog\).dialog(\option\, 
\modal\, false););

rsup.addScript($j(\#loginFormDialog\).dialog(\open\););
rsup.addScript(}););
}
}

---

Thanks for any ideas.
Radek



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



Re: NPE in afterRender method in Tomcat

2010-06-07 Thread Howard Lewis Ship
Caused by: java.lang.NullPointerException
   at
org.apache.catalina.connector.Request.getAttribute(Request.java:877)
   at
org.apache.catalina.connector.RequestFacade.getAttribute(RequestFacade.java:263)

That's really showing that it's gone beyond the Tapestry code and back into
the Tomcat (catalina) code. Are you doing something tricky with threads,
like trying to do part of the render is a background thread?

You'll probably need to single-step down ingo the catalina code to see
what's exactly going on.  Not enough information here to diagnose.

On Mon, Jun 7, 2010 at 1:13 PM, Radek Terber lst@post.cz wrote:

 Hi

 I have such problem: I have quite simple T5 application - (T5 + hibernate),
 currently compiled under T 5.1.0.5. When I run it under Jetty (ver. 8.0.0),
 it runs fine.
 But when I try it to start under Tomcat, I get NullPointerException that
 (probably) indicates the underline request is null.
 I tested it under Tomcat 6.0.18, 6.0.20 and 6.0.26. Tomcats was pure
 installations - with no aditional libraries.
 It runs under Java 6.18 on Win7, the same problem in on Linux and Java
 6.16.
 I could post application's war somewhere, but it is quite big (cca 28M
 including libraries), ant it requires our application server running
 anywhere in LAN to run.

 Here it the eception:
 ---
 [ERROR] TapestryModule.RequestExceptionHandler Processing of request failed
 with uncaught exception: Render queue error in AfterRender[Index
 :layout.loginform]:
 org.apache.tapestry5.ioc.internal.util.TapestryException
 org.apache.tapestry5.internal.services.RenderQueueException: Render queue
 error in AfterRender[Index:layout.loginform]: org.apache.tapestry5
 .ioc.internal.util.TapestryException [at
 classpath:cz/gapo/weby/jmenovky/components/layout/Layout.tml, line 25]
at
 org.apache.tapestry5.internal.services.RenderQueueImpl.run(RenderQueueImpl.java:86)
at
 org.apache.tapestry5.internal.services.PageRenderQueueImpl.render(PageRenderQueueImpl.java:121)
 ... (I deleted it) ...
at java.lang.Thread.run(Thread.java:619)
 Caused by: org.apache.tapestry5.ioc.internal.util.TapestryException [at
 classpath:cz/gapo/weby/jmenovky/components/layout/Layout.tml, line 25]
at
 org.apache.tapestry5.internal.structure.ComponentPageElementImpl.invoke(ComponentPageElementImpl.java:948)
at
 org.apache.tapestry5.internal.structure.ComponentPageElementImpl.access$400(ComponentPageElementImpl.java:49)
at
 org.apache.tapestry5.internal.structure.ComponentPageElementImpl$AbstractPhase.callback(ComponentPageElementImpl.java:159)
at
 org.apache.tapestry5.internal.structure.ComponentPageElementImpl$AfterRenderPhase.render(ComponentPageElementImpl.java:374)
at
 org.apache.tapestry5.internal.services.RenderQueueImpl.run(RenderQueueImpl.java:74)
... 68 more
 Caused by: java.lang.NullPointerException
at
 org.apache.catalina.connector.Request.getAttribute(Request.java:877)
at
 org.apache.catalina.connector.RequestFacade.getAttribute(RequestFacade.java:263)
at
 cz.gapo.webapps.common.t5.components.LoginForm.afterRender(LoginForm.java:127)
at
 cz.gapo.webapps.common.t5.components.LoginForm.afterRender(LoginForm.java)
at
 org.apache.tapestry5.internal.structure.ComponentPageElementImpl$AfterRenderPhase.invokeComponent(ComponentPageElementImpl.java:369)
at
 org.apache.tapestry5.internal.structure.ComponentPageElementImpl$AbstractPhase.run(ComponentPageElementImpl.java:164)
at
 org.apache.tapestry5.internal.structure.ComponentPageElementImpl.invoke(ComponentPageElementImpl.java:933)
... 72 more


 The code fragment cause it:
 ---
@Inject
private RenderSupport rsup;

@Inject
private Request request;

@AfterRender
public void afterRender(MarkupWriter wr) {
 boolean requireLogin =
 request.getAttribute(Constants.REQUIRED_LOGIN_RQATR) != null;// here
 the NPE is thrown, but the request is not null
if (requireLogin) {
rsup.addScript($j(function() {);
rsup.addScript($j(\#loginFormDialog\).dialog(\option\,
 \modal\, false););
rsup.addScript($j(\#loginFormDialog\).dialog(\open\););
rsup.addScript(}););
}
}

 ---

 Thanks for any ideas.
 Radek



 -
 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


Dumb Question about Project Layout

2010-06-07 Thread Pierce Wetter

 Ok, so I have 327 pages and 393 components in my application. (It's a crud 
tool so 20 things times 20 objects = 400 pages get automatically built)

 It's time to organize. 

 So right now, I have:

  appname.pages
  appname.components

  There are hints here and there in the docs that if I add a package called:

   appname.pages.edit

  That I can move all pages with Edit at the beginning/end of their name into 
that package. 

  I'm gathering that that's all I have to do, that Tapestry will then find 
things. But if I want, I can remove Edit from the name, because edit/foo and 
EditFoo are considered equivalent. edit/EditFoo will even work. 

  Down the road, I can change references to edit/Foo if I feel like it. 

  Is all that true?

  Are the rules the same for pages and components?

  (Using 5.2 trunk, btw, according to the Wiki there are some old bugs, but I 
don't really care about those)

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



Re: Dumb Question about Project Layout

2010-06-07 Thread Howard Lewis Ship
Yes, the basic rule for pages is that the name, beneath the root pages
package, is the logical page name.  The logical page name appears in URLs.

So class appname.pages.EditUsers will have a logical name of EditUsers.

You can also create a subpackage (or sub-sub-package), for example:

appname.pages.users.EditUsers -- users/EditUsers
appname.pages.edit.EditUsers -- edit/EditUsers

I tend to prefer the former, to group related pages by the data object
(User) that they operate upon.

Tapestry will do a little processing on the logical name to create aliases
for the name.  As you noted, it sees the redundancy in the name, so

appname.pages.users.EditUsers -- users/EditUsers -- users/Edit
appname.pages.edit.EditUsers -- edit/EditUsers  -- edit/Users

Tapestry looks for a suffix or a prefix that matches the containing package
name.

For page names (rather than component or mixin types) there's an extra step.
 A trailing /Index will be stripped off, if present.

appname.pages.users.UsersIndex -- users/UsersIndex -- users/Index --
users

Tapestry users the shortest of these when constructing the URL.

Generally, I only care about these rules when I'm trying to follow on
externally dictated URL scheme. Before I bring out the big guns (URLRewriter
in 5.1, LinkTransformer in 5.2) I'll reverse-engineer my desired URLs into
classes in the correct package. So if my client wants the URL to be
/edit/user I might create class appname.pages.edit.EditUser.

On Mon, Jun 7, 2010 at 2:44 PM, Pierce Wetter pie...@paceap.com wrote:


  Ok, so I have 327 pages and 393 components in my application. (It's a crud
 tool so 20 things times 20 objects = 400 pages get automatically built)

  It's time to organize.

  So right now, I have:

  appname.pages
  appname.components

  There are hints here and there in the docs that if I add a package called:

   appname.pages.edit

  That I can move all pages with Edit at the beginning/end of their name
 into that package.

  I'm gathering that that's all I have to do, that Tapestry will then find
 things. But if I want, I can remove Edit from the name, because edit/foo
 and EditFoo are considered equivalent. edit/EditFoo will even work.

  Down the road, I can change references to edit/Foo if I feel like it.

  Is all that true?

  Are the rules the same for pages and components?

  (Using 5.2 trunk, btw, according to the Wiki there are some old bugs, but
 I don't really care about those)

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




-- 
Howard M. Lewis Ship

Creator of Apache Tapestry

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

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


Re: Dumb Question about Project Layout

2010-06-07 Thread Pierce Wetter

On Jun 7, 2010, at 3:00 PM, Howard Lewis Ship wrote:

 Yes, the basic rule for pages is that the name, beneath the root pages
 package, is the logical page name.  The logical page name appears in URLs.

What is the rule for components? 

 
 So class appname.pages.EditUsers will have a logical name of EditUsers.
 
 You can also create a subpackage (or sub-sub-package), for example:
 
 appname.pages.users.EditUsers -- users/EditUsers
 appname.pages.edit.EditUsers -- edit/EditUsers
 
 I tend to prefer the former, to group related pages by the data object
 (User) that they operate upon.

 Splitting by verb is working better for me. To each his own. :-) For my 
components, splitting by data object might be more logical, but I'm working 
that out. 

 
 Tapestry will do a little processing on the logical name to create aliases
 for the name.  As you noted, it sees the redundancy in the name, so
 
 appname.pages.users.EditUsers -- users/EditUsers -- users/Edit
 appname.pages.edit.EditUsers -- edit/EditUsers  -- edit/Users
 
 Tapestry looks for a suffix or a prefix that matches the containing package
 name.

  Ok, so two conclusions. 


  #1: if I move things down a package, that means that I'm changing the logical 
page name to include the new package name; that implies that references to the 
old name in .tml files will need newpackage/ prepended to any references. 

   That is with pages.EditUser.java - pages.edit.EditUser.java:

 t:pagelink page=EditUser /

   Must be changed to one of the following:

 t:pagelink page=edit/User /
 t:pagelink page=edit/EditUser /

 That's not such a bad thing after all, that's similar to what happens if I 
pushed all the edit pages into a component library. 

  #2: Tapestry will process the package name against the class name to reduce 
redundancy, so after the split I can leave the new package name in the class 
name so that I don't end up with multiple files named User.java for 
edit/User.java, list/User.java, but rather I can keep with EditUser.java, 
ListUser.java, and then it is more clear which is which. 


  Are the rules similar for components?

Pierce



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



Re: Dumb Question about Project Layout

2010-06-07 Thread Howard Lewis Ship
On Mon, Jun 7, 2010 at 4:15 PM, Pierce Wetter pie...@paceap.com wrote:


 On Jun 7, 2010, at 3:00 PM, Howard Lewis Ship wrote:

  Yes, the basic rule for pages is that the name, beneath the root pages
  package, is the logical page name.  The logical page name appears in
 URLs.

 What is the rule for components?


The exact same rules, except for the /Index part.



 
  So class appname.pages.EditUsers will have a logical name of EditUsers.
 
  You can also create a subpackage (or sub-sub-package), for example:
 
  appname.pages.users.EditUsers -- users/EditUsers
  appname.pages.edit.EditUsers -- edit/EditUsers
 
  I tend to prefer the former, to group related pages by the data object
  (User) that they operate upon.

  Splitting by verb is working better for me. To each his own. :-) For my
 components, splitting by data object might be more logical, but I'm working
 that out.

 
  Tapestry will do a little processing on the logical name to create
 aliases
  for the name.  As you noted, it sees the redundancy in the name, so
 
  appname.pages.users.EditUsers -- users/EditUsers -- users/Edit
  appname.pages.edit.EditUsers -- edit/EditUsers  -- edit/Users
 
  Tapestry looks for a suffix or a prefix that matches the containing
 package
  name.

   Ok, so two conclusions.


  #1: if I move things down a package, that means that I'm changing the
 logical page name to include the new package name; that implies that
 references to the old name in .tml files will need newpackage/ prepended
 to any references.

   That is with pages.EditUser.java - pages.edit.EditUser.java:

 t:pagelink page=EditUser /

   Must be changed to one of the following:

 t:pagelink page=edit/User /
 t:pagelink page=edit/EditUser /

  That's not such a bad thing after all, that's similar to what happens if I
 pushed all the edit pages into a component library.

  #2: Tapestry will process the package name against the class name to
 reduce redundancy, so after the split I can leave the new package name in
 the class name so that I don't end up with multiple files named User.java
 for edit/User.java, list/User.java, but rather I can keep with
 EditUser.java, ListUser.java, and then it is more clear which is which.


 And that's the intent; although Java support having the exact same class
name in multiple packages, it's something to be avoided. The naming
transformations allow you to use reasonable class names AND have reasonable
URLs.


  Are the rules similar for components?

 Pierce



 -
 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


(for service 'BeanModelSource'): No service implements the interface long.

2010-06-07 Thread faye alaska

could someone shed some light on what I was doing wrong? The examples I read
that shows me that Bean Edit Form can definitely handle integer and long,
but I get the No Service implements the interface long...

I have a very simple data source as
public class Asset {
private long assetNumber;
private String altInfo1;
private String altInfo2;

...
}

the *.tml file is 

h1Adding New Asset/h1
t:beaneditform t:id=asset/

Thanks very much!
Faye

-- 
View this message in context: 
http://old.nabble.com/%28for-service-%27BeanModelSource%27%29%3A-No-service-implements-the-interface-long.-tp28812439p28812439.html
Sent from the Tapestry - User mailing list archive at Nabble.com.


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



Re: (for service 'BeanModelSource'): No service implements the interface long.

2010-06-07 Thread Thiago H. de Paula Figueiredo
On Mon, 07 Jun 2010 21:10:35 -0300, faye alaska haifeizh...@gmail.com  
wrote:


could someone shed some light on what I was doing wrong? The examples I  
read that shows me that Bean Edit Form can definitely handle integer and  
long,

but I get the No Service implements the interface long...


Hi!

Try adding this method to your page class:

onPrepare() {
this.asset = new Asset();
}

--
Thiago H. de Paula Figueiredo
Independent Java, Apache Tapestry 5 and Hibernate consultant, developer,  
and instructor

Owner, Ars Machina Tecnologia da Informação Ltda.
http://www.arsmachina.com.br

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



Re: (for service 'BeanModelSource'): No service implements the interface long.

2010-06-07 Thread faye alaska

Thanks a bunch! Makes Perfect sense! 
Thanks again!
Best regards,
Faye



Thiago H. de Paula Figueiredo wrote:
 
 On Mon, 07 Jun 2010 21:10:35 -0300, faye alaska haifeizh...@gmail.com  
 wrote:
 
 could someone shed some light on what I was doing wrong? The examples I  
 read that shows me that Bean Edit Form can definitely handle integer and  
 long,
 but I get the No Service implements the interface long...
 
 Hi!
 
 Try adding this method to your page class:
 
 onPrepare() {
   this.asset = new Asset();
 }
 
 -- 
 Thiago H. de Paula Figueiredo
 Independent Java, Apache Tapestry 5 and Hibernate consultant, developer,  
 and instructor
 Owner, Ars Machina Tecnologia da Informação Ltda.
 http://www.arsmachina.com.br
 
 -
 To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org
 For additional commands, e-mail: users-h...@tapestry.apache.org
 
 
 

-- 
View this message in context: 
http://old.nabble.com/%28for-service-%27BeanModelSource%27%29%3A-No-service-implements-the-interface-long.-tp28812439p28812869.html
Sent from the Tapestry - User mailing list archive at Nabble.com.


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



Undeclared general entity

2010-06-07 Thread Paul Stanton
in a previous post Thiago correctly explained the error 'Undeclared 
general entity nbsp' resulting from a missing html xmlns declaration.


however I'm still having this problem when I declare an xhtml entity 
within a page that uses a component to handle the layout, even if both 
the layout component and the page tml's declare the xhtml xmlns.:


MyPage.tml:

html t:type=baselayout xmlns=http://www.w3.org/1999/xhtml; 
xmlns:t=http://tapestry.apache.org/schema/tapestry_5_1_0.xsd;

   nbsp;
/html

BaseLayout.tml:

!DOCTYPE html PUBLIC -//W3C//DTD XHTML 1.0 Strict//EN 
http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd;
html xmlns=http://www.w3.org/1999/xhtml; 
xmlns:t=http://tapestry.apache.org/schema/tapestry_5_1_0.xsd; 
xmlns:p=tapestry:parameter

   t:body /
/html

Also, another problem - if the nbsp; is in BaseLayout.tml and not 
MyPage.tml it renders without exception, however if I view source of the 
rendered page, there is no nbsp; instead the character it represents. I 
would expect the browser to do this conversion, not the web application.


can someone fill me in?

Regards, p.

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



LinkSubmit doesn't work

2010-06-07 Thread Paul Stanton

Hi,

I'm guessing I'm doing something wrong but it's hardly obvious. I have a 
Form, with a LinkSubmit and a Submit:


   t:form t:id=myForm
   t:linksubmit t:id=myLinklink/t:linksubmit
   t:submit t:id=mySubmit /
   /t:form

   public void onSuccessFromMyForm()
   {
   LOG.debug(onSuccessFromMyForm);
   }

   public void onSelectedFromMyLink()
   {
   LOG.debug(onSelectedFromMyLink);
   }

   public void onSelectedFromMySubmit()
   {
   LOG.debug(onSelectedFromMySubmit);
   }


The form is submitted and the listener(s) are called when I click the 
submit, however nothing all all happens when I click the link.


p.

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



Re: LinkSubmit doesn't work

2010-06-07 Thread Paul Stanton
After stepping through the javascript, I believe it's because the 
onsubmit event handler for the form is 
javascript:Tapestry.waitForPage(event); who's first line is if 
(Tapestry.pageLoaded) return;.


This is the equivalent of if (Tapestry.pageLoaded) return false; when 
evaluated to a boolean as it is in the LinkSubmit onClick handler:


if (onsubmit == undefined || onsubmit.call(window.document, event))
{
   this.createHidden();
   this.form.submit();
}

.. and therefore this.form.submit(); is never called.

Obviously this is a bug, I'm pretty sure the resolution would be to 
change Tapestry.waitForPage so that it returns true if the page is 
loaded and false otherwise, ie:


waitForPage : function(event)
{
   if (Tapestry.pageLoaded) return true;
   ...
   return false;
}

This will allow 'waitForPage' to be evaluated to a boolean as it is in 
LinkSubmit.onClick.


p.

Paul Stanton wrote:

Hi,

I'm guessing I'm doing something wrong but it's hardly obvious. I have 
a Form, with a LinkSubmit and a Submit:


   t:form t:id=myForm
   t:linksubmit t:id=myLinklink/t:linksubmit
   t:submit t:id=mySubmit /
   /t:form

   public void onSuccessFromMyForm()
   {
   LOG.debug(onSuccessFromMyForm);
   }

   public void onSelectedFromMyLink()
   {
   LOG.debug(onSelectedFromMyLink);
   }

   public void onSelectedFromMySubmit()
   {
   LOG.debug(onSelectedFromMySubmit);
   }


The form is submitted and the listener(s) are called when I click the 
submit, however nothing all all happens when I click the link.


p.

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




Re: LinkSubmit doesn't work

2010-06-07 Thread Paul Stanton

https://issues.apache.org/jira/browse/TAP5-1180

Paul Stanton wrote:
After stepping through the javascript, I believe it's because the 
onsubmit event handler for the form is 
javascript:Tapestry.waitForPage(event); who's first line is if 
(Tapestry.pageLoaded) return;.


This is the equivalent of if (Tapestry.pageLoaded) return false; 
when evaluated to a boolean as it is in the LinkSubmit onClick handler:


if (onsubmit == undefined || onsubmit.call(window.document, event))
{
   this.createHidden();
   this.form.submit();
}

.. and therefore this.form.submit(); is never called.

Obviously this is a bug, I'm pretty sure the resolution would be to 
change Tapestry.waitForPage so that it returns true if the page is 
loaded and false otherwise, ie:


waitForPage : function(event)
{
   if (Tapestry.pageLoaded) return true;
   ...
   return false;
}

This will allow 'waitForPage' to be evaluated to a boolean as it is in 
LinkSubmit.onClick.


p.

Paul Stanton wrote:

Hi,

I'm guessing I'm doing something wrong but it's hardly obvious. I 
have a Form, with a LinkSubmit and a Submit:


   t:form t:id=myForm
   t:linksubmit t:id=myLinklink/t:linksubmit
   t:submit t:id=mySubmit /
   /t:form

   public void onSuccessFromMyForm()
   {
   LOG.debug(onSuccessFromMyForm);
   }

   public void onSelectedFromMyLink()
   {
   LOG.debug(onSelectedFromMyLink);
   }

   public void onSelectedFromMySubmit()
   {
   LOG.debug(onSelectedFromMySubmit);
   }


The form is submitted and the listener(s) are called when I click the 
submit, however nothing all all happens when I click the link.


p.

-
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: NPE in afterRender method in Tomcat

2010-06-07 Thread Radek Terber

No, the app is single thread, quite clear, no experiments...
Here is the self contained variant of war (with no dependencies to 
oour app server):

http://www.gapo.cz/downloads/genusinum.war

I guess to some library which the application is depend on (in 
combination with Tomcat libraries ??), but I have no tools and 
experiences to deterrmine it.


Dne 7.6.2010 22:58, Howard Lewis Ship napsal(a):

Caused by: java.lang.NullPointerException
at
org.apache.catalina.connector.Request.getAttribute(Request.java:877)
at
org.apache.catalina.connector.RequestFacade.getAttribute(RequestFacade.java:263)

That's really showing that it's gone beyond the Tapestry code and back into
the Tomcat (catalina) code. Are you doing something tricky with threads,
like trying to do part of the render is a background thread?

You'll probably need to single-step down ingo the catalina code to see
what's exactly going on.  Not enough information here to diagnose.

On Mon, Jun 7, 2010 at 1:13 PM, Radek Terberlst@post.cz  wrote:

   

Hi

I have such problem: I have quite simple T5 application - (T5 + hibernate),
currently compiled under T 5.1.0.5. When I run it under Jetty (ver. 8.0.0),
it runs fine.
But when I try it to start under Tomcat, I get NullPointerException that
(probably) indicates the underline request is null.
I tested it under Tomcat 6.0.18, 6.0.20 and 6.0.26. Tomcats was pure
installations - with no aditional libraries.
It runs under Java 6.18 on Win7, the same problem in on Linux and Java
6.16.
I could post application's war somewhere, but it is quite big (cca 28M
including libraries), ant it requires our application server running
anywhere in LAN to run.

Here it the eception:
---
[ERROR] TapestryModule.RequestExceptionHandler Processing of request failed
with uncaught exception: Render queue error in AfterRender[Index
:layout.loginform]:
org.apache.tapestry5.ioc.internal.util.TapestryException
org.apache.tapestry5.internal.services.RenderQueueException: Render queue
error in AfterRender[Index:layout.loginform]: org.apache.tapestry5
.ioc.internal.util.TapestryException [at
classpath:cz/gapo/weby/jmenovky/components/layout/Layout.tml, line 25]
at
org.apache.tapestry5.internal.services.RenderQueueImpl.run(RenderQueueImpl.java:86)
at
org.apache.tapestry5.internal.services.PageRenderQueueImpl.render(PageRenderQueueImpl.java:121)
... (I deleted it) ...
at java.lang.Thread.run(Thread.java:619)
Caused by: org.apache.tapestry5.ioc.internal.util.TapestryException [at
classpath:cz/gapo/weby/jmenovky/components/layout/Layout.tml, line 25]
at
org.apache.tapestry5.internal.structure.ComponentPageElementImpl.invoke(ComponentPageElementImpl.java:948)
at
org.apache.tapestry5.internal.structure.ComponentPageElementImpl.access$400(ComponentPageElementImpl.java:49)
at
org.apache.tapestry5.internal.structure.ComponentPageElementImpl$AbstractPhase.callback(ComponentPageElementImpl.java:159)
at
org.apache.tapestry5.internal.structure.ComponentPageElementImpl$AfterRenderPhase.render(ComponentPageElementImpl.java:374)
at
org.apache.tapestry5.internal.services.RenderQueueImpl.run(RenderQueueImpl.java:74)
... 68 more
Caused by: java.lang.NullPointerException
at
org.apache.catalina.connector.Request.getAttribute(Request.java:877)
at
org.apache.catalina.connector.RequestFacade.getAttribute(RequestFacade.java:263)
at
cz.gapo.webapps.common.t5.components.LoginForm.afterRender(LoginForm.java:127)
at
cz.gapo.webapps.common.t5.components.LoginForm.afterRender(LoginForm.java)
at
org.apache.tapestry5.internal.structure.ComponentPageElementImpl$AfterRenderPhase.invokeComponent(ComponentPageElementImpl.java:369)
at
org.apache.tapestry5.internal.structure.ComponentPageElementImpl$AbstractPhase.run(ComponentPageElementImpl.java:164)
at
org.apache.tapestry5.internal.structure.ComponentPageElementImpl.invoke(ComponentPageElementImpl.java:933)
... 72 more


The code fragment cause it:
---
@Inject
private RenderSupport rsup;

@Inject
private Request request;

@AfterRender
public void afterRender(MarkupWriter wr) {
 boolean requireLogin =
request.getAttribute(Constants.REQUIRED_LOGIN_RQATR) != null;// here
the NPE is thrown, but the request is not null
if (requireLogin) {
rsup.addScript($j(function() {);
rsup.addScript($j(\#loginFormDialog\).dialog(\option\,
\modal\, false););
rsup.addScript($j(\#loginFormDialog\).dialog(\open\););
rsup.addScript(}););
}
}

---

Thanks for any ideas.
Radek



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