Re: [T4] PageRedirectException in pageValidate after AjaxDirectLink

2008-03-27 Thread Steve Shucker
I'm using 4.1.5 and I think I wrote that code against 4.1.3.  I agree 
that you shouldn't move your auth code into a filter - I only mentioned 
that to explain why I wasn't handing you the whole filter code.  You may 
have to tweak the generated code a bit for 4.0.2.  I just used firebug 
to grab a dojo response and looked for some JS that I knew was 
executing.  Once you know to look for a custom header, the rest is easy.


-Steve

Kelly Merrell wrote:
Thanks for the example Steve. My only issue is that I don't seem to be 
getting a "dojo-ajax-request" header in the request. There is a 
"dojoRequest" parameter, which seems like I can use it for the same 
purpose. Are you using a version of Tapestry greater than 4.02?


I'm going to try  to adopt your method, but without moving my 
authentication code into the servlet filter.


Thanks again!

Steve Shucker wrote:
I already had a servlet filter doing some custom authentication and 
handling redirects to a separate login service for expired sessions, 
so I added a little extra code in there.  First off, you can identify 
ajax requests by the presence of an HttpServletRequest header called 
"dojo-ajax-request" with a value of "true".  If I see that header, I 
write my own custom response instead of going down the filter chain.  
Here's the method I use to build the response:


   private void sendAjaxRedirect(HttpServletResponse httpResponse) 
throws IOException {

   PrintWriter writer = httpResponse.getWriter();
   writer.write("");
   writer.write("Transitional//EN\" 
\"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd\"; 
[\n\n]>\n");

   writer.write("");
   writer.write("type=\"script\">\n//<![CDATA[\n");
</tt><tt>   writer.write("window.location.href = '" + 
</tt><tt>params.getOriginalUrl() + "';\n");
</tt><pre style="margin: 0em;">
   writer.write("//]]>\n");
   writer.write("");
   }

replace "params.getOriginalUrl()" with the entry URL for your app.

This code generates a response that the tapestry/dojo wiring will 
interpret by parsing the window.location.href javascript.


-Steve

Kelly Merrell wrote:
I'm having a problem with my authentication redirect when using Ajax 
to update page components. I use PageRedirectException on each page 
to redirect to a login page if the user is not logged in when the 
page validates. This works as expected when hitting the page 
normally, but if I am using an AjaxDirectLink after the login has 
expired, the response is returned as the HTML of the login page and 
not "handled" by AjaxDirectService so that it is wrapped in the xml 
tags and have the "window.location.href" javascript redirect added. 
As the response is not xml, it breaks on the client side and the 
page does not redirect.


I have seen a few other people bring up this issue, but I can't find 
any evidence of a solution or work around. I would have thought that 
this would be a common problem, but maybe I am just overlooking a 
simple fix. Any help here would be greatly appreciated!


My pageValidate method is simply:

public void pageValidate(PageEvent event) {
   if (!isLoggedIn()) {
   Login loginPage = getRedirectPage();
   throw new PageRedirectException(loginPage);
   }
}





-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]




-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: [T4] PageRedirectException in pageValidate after AjaxDirectLink

2008-03-26 Thread Steve Shucker
I already had a servlet filter doing some custom authentication and 
handling redirects to a separate login service for expired sessions, so 
I added a little extra code in there.  First off, you can identify ajax 
requests by the presence of an HttpServletRequest header called 
"dojo-ajax-request" with a value of "true".  If I see that header, I 
write my own custom response instead of going down the filter chain.  
Here's the method I use to build the response:


   private void sendAjaxRedirect(HttpServletResponse httpResponse) 
throws IOException {

   PrintWriter writer = httpResponse.getWriter();
   writer.write("");
   writer.write("Transitional//EN\" 
\"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd\"; [\nnbsp ' '>\n]>\n");

   writer.write("");
   writer.write("type=\"script\">\n//   writer.write("window.location.href = '" + 
params.getOriginalUrl() + "';\n");
   writer.write("//]]>\n");
   writer.write("");
   }

replace "params.getOriginalUrl()" with the entry URL for your app.

This code generates a response that the tapestry/dojo wiring will 
interpret by parsing the window.location.href javascript.


-Steve

Kelly Merrell wrote:
I'm having a problem with my authentication redirect when using Ajax 
to update page components. I use PageRedirectException on each page to 
redirect to a login page if the user is not logged in when the page 
validates. This works as expected when hitting the page normally, but 
if I am using an AjaxDirectLink after the login has expired, the 
response is returned as the HTML of the login page and not "handled" 
by AjaxDirectService so that it is wrapped in the xml tags and have 
the "window.location.href" javascript redirect added. As the response 
is not xml, it breaks on the client side and the page does not redirect.


I have seen a few other people bring up this issue, but I can't find 
any evidence of a solution or work around. I would have thought that 
this would be a common problem, but maybe I am just overlooking a 
simple fix. Any help here would be greatly appreciated!


My pageValidate method is simply:

public void pageValidate(PageEvent event) {
   if (!isLoggedIn()) {
   Login loginPage = getRedirectPage();
   throw new PageRedirectException(loginPage);
   }
}

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]




-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: Please help me in migration of Tapestry 4.0.2 to 4.1.5

2008-03-21 Thread Steve Shucker
I suspect you have an accessor hardcoded to get/set a 
java.util.ArrayList.  java.util.Arrays$ArrayList implements List but 
does not extend java.util.ArrayList.  Check to see if you're explicitly 
using the implementation class (ArrayList) when your method should 
really only get/set something that implements the List interface.  If 
necessary,  you can change the method signature and downcast later.  
Generally, you don't want to refer to the implementation classes 
explicitly except during construction.


-Steve

Rohan Kalyan wrote:

Hi all,

we are  working on migration of tapestry4.0.2 to 4.1.5

we've changed
1. Ajax directlink to directlink
2. AjaxForm to Form
3. added a method in IpropertySelectionModel (
isDisabled() )
4. changed tacos dialog to dojo dialog




-

Error converting value for {'Unscheduled'}: Unable to convert from type
java.util.Arrays$ArrayList to java.util.ArrayList. No type converter for
java.util.Arrays$ArrayList is available.

 [ +/- ] Exception: Error converting value for {'Unscheduled'}: Unable to
convert from type java.util.Arrays$ArrayList to java.util.ArrayList. No type
converter for java.util.Arrays$ArrayList is
available.
org.apache.tapestry.BindingException  binding: ExpressionBinding[Home
{'Unscheduled'}]  component: [EMAIL PROTECTED]  location: context:/Home.html,
line 44










44 45
 46   47   48 49   [ +/- ]
Exception: Unable to convert from type java.util.Arrays$ArrayList to
java.util.ArrayList. No type converter for java.util.Arrays$ArrayList is
available. 
org.apache.hivemind.ApplicationRuntimeException  Stack Trace:

   - org.apache.tapestry.coerce.ValueConverterImpl.coerceValue(
   ValueConverterImpl.java:105)
   - $ValueConverter_118caa27475.coerceValue($ValueConverter_118caa27475.java)

   - org.apache.tapestry.binding.AbstractBinding.getObject(
   AbstractBinding.java:88)
   - $AppointmentList_17.getStatusList($AppointmentList_17.java)
   - com.dentaprise.component.AppointmentList.pageBeginRender(
   AppointmentList.java:133)
   - org.apache.tapestry.AbstractPage.firePageBeginRender(
   AbstractPage.java:409)
   - org.apache.tapestry.AbstractPage.renderPage(AbstractPage.java:244)
   - org.apache.tapestry.engine.RequestCycle.renderPage(RequestCycle.java:400)

   -
   org.apache.tapestry.services.impl.DefaultResponseBuilder.renderResponse
   (DefaultResponseBuilder.java:159)
   -
   org.apache.tapestry.services.impl.ResponseRendererImpl.renderResponse(
   ResponseRendererImpl.java:33)
   - 
$ResponseRenderer_118caa274a7.renderResponse($ResponseRenderer_118caa274a7.java)

   - org.apache.tapestry.engine.HomeService.service(HomeService.java:68)
   - $IEngineService_118caa27516.service($IEngineService_118caa27516.java)

   - org.apache.tapestry.services.impl.EngineServiceOuterProxy.service(
   EngineServiceOuterProxy.java:72)
   - org.apache.tapestry.engine.AbstractEngine.service(
   AbstractEngine.java:241)
   - org.apache.tapestry.services.impl.InvokeEngineTerminator.service(
   InvokeEngineTerminator.java:54)
   - 
$WebRequestServicer_118caa274f1.service($WebRequestServicer_118caa274f1.java)

   - 
$WebRequestServicer_118caa274ed.service($WebRequestServicer_118caa274ed.java)

   -
   org.apache.tapestry.services.impl.WebRequestServicerPipelineBridge.service
   (WebRequestServicerPipelineBridge.java:61)
   - 
$ServletRequestServicer_118caa274d3.service($ServletRequestServicer_118caa274d3.java)

   - org.apache.tapestry.request.DecodedRequestInjector.service(
   DecodedRequestInjector.java:55)
   - 
$ServletRequestServicerFilter_118caa274cf.service($ServletRequestServicerFilter_118caa274cf.java)

   - 
$ServletRequestServicer_118caa274d5.service($ServletRequestServicer_118caa274d5.java)

   - org.apache.tapestry.multipart.MultipartDecoderFilter.service(
   MultipartDecoderFilter.java:52)
   - 
$ServletRequestServicerFilter_118caa274cd.service($ServletRequestServicerFilter_118caa274cd.java)

   - 
$ServletRequestServicer_118caa274d5.service($ServletRequestServicer_118caa274d5.java)

   - org.apache.tapestry.services.impl.SetupRequestEncoding.service(
   SetupRequestEncoding.java:53)
   - 
$ServletRequestServicerFilter_118caa274d1.service($ServletRequestServicerFilter_118caa274d1.java)

   - 
$ServletRequestServicer_118caa274d5.service($ServletRequestServicer_118caa274d5.java)

   - 
$ServletRequestServicer_118caa274c7.service($ServletRequestServicer_118caa274c7.java)

   - org.apache.tapestry.ApplicationServlet.doService(
   ApplicationServlet.java:126)
   - org.apache.tapestry.ApplicationServlet.doGet(ApplicationServlet.java:103)

   - javax.servlet.http.HttpServlet.service(HttpServlet.java:689)
 

Re: Conditional validation in T4?

2007-12-21 Thread Steve Shucker

http://tapestry.apache.org/tapestry4.1/usersguide/validation.html
http://tapestry.apache.org/tapestry4.1/apidocs/org/apache/tapestry/form/validator/Identity.html

Look at the match/differ validators.  The cover the basic concept of a 
validator that acts on two components.  You can probably write a variant 
of the Identity class that will throw a ValidatorException is the 
referent is non-null and the validated control is null.


Another approach would be to encapsulate the interrelated controls in a 
component to be validated as a group.  I think there's an example of 
this in Kent Tong's book.


-Steve

Drew McAuliffe wrote:

I'm running into a problem with validators in T4. I have a situation where I
sometimes need to validate a field on a form, but only if another field on
the same form has a certain set of values. For example, a "ship quantity"
field on an order form is only required if the order delivery method is
"shipment" and not "download" (you don't have a ship quantity for an order
that doesn't ship). Again, both fields are on the same form.
Maybe I'm missing something but I don't know how to make the use of a
validator conditional. I don't want to do manual validation in the submit
method. I've tried setting the "validators" of the text field to a method on
the page class that checks the field values, but it seems that the
validation does not have access to the runtime selection made by the user.
In other words, at the time my method tries to check if a validator is
necessary, it is looking at old data and doesn't have access to the value
the user was trying to submit. Something related to when in the page cycle
validation is checked, I'm sure.

Any ideas? This is for server-side validation, though of course client-side
validation would be really nice too! (I imagine that would have to be using
some sort of async callback method).

  


-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: T4: replacing script asset in AbstractSubmit

2007-12-11 Thread Steve Shucker
A few more days, a few more bugs discovered.  Specifically, I wasn't 
uncovering controls if client side validation failed.  Here's a patch to 
my earlier code that takes care of this (inspired by AjaxStatus)


in the script files:
   
   
   dojo.require("dojo.event.common");
   dojo.require("tapestry.form");
   dojo.require("tapestry.form.validation");
   dojo.event.connectOnce(tapestry.form.validation, 
"summarizeErrors", clearOverlays);

   
   

modified js file contents:
var coverings = []
function clearOverlays() {
   for (var index in coverings) {
   var covering = coverings[index]
   covering.parentNode.removeChild(covering)
   }
   coverings = []
}

function cover(componentId, imgPath) {
   var component = document.getElementById(componentId)
   var covering = document.createElement("div")
   covering.style.width = component.clientWidth + "px"
   covering.style.height = component.clientHeight + "px"
   covering.style.zIndex = 1200
   covering.style.position = "absolute"
   covering.style.backgroundColor = "white"
   covering.style.opacity = "0.8"
   covering.style.filter = "alpha(opacity=80)"
   covering.style.overflow = "hidden"
   var img = document.createElement('img')
   img.src = imgPath
   img.style.width = "16px"
   img.style.height = "16px"
   img.style.margin = "8px"
   covering.appendChild(img)
   component.insertBefore(covering,component.firstChild)
   coverings.push(covering)
}

I also ripped out the offsetLeft hack because that didn't really fix my 
IE problems.  I think it just didn't like being applied in a float=right 
div there.


Steve Shucker wrote:
I'm a bit nutty about writing clean code, and I didn't want to clutter 
things up with binding events left and right or extra script tags for 
each handled async submit.  I ended up just subclassing Submit and 
LinkSubmit to include my own tweaks.  This code injects a  as the 
first element of each of the updateComponents.  It's an 80% opaque 
block with a small animated loading icon.  When the ajax call is 
complete, the whole component gets overwritten so my progress  
vanishes.  The  also prevents clicking on anything underneath 
it.  The ugly bit to figure out how to set the "left" css attribute of 
the  can probably be omitted - it fixes a weird layout issue 
that's probably unique to one of my pages and IE6.  It works 95% of 
the time without setting "left"


But you asked for code, so I'll give you code:

SubmitBindings.script:
extra include:


in the submit handling function:
   
   cover('${component}', '${submit.loadingImageUrl}')
   

util.js contains the following script:
function cover(componentId, imgPath) {
   var component = document.getElementById(componentId)
   var covering = document.createElement("div")
   covering.style.width = component.clientWidth + "px"
   covering.style.height = component.clientHeight + "px"
   covering.style.zIndex = 1200
   covering.style.position = "absolute"
   covering.style.backgroundColor = "white"
   covering.style.opacity = "0.8"
   covering.style.filter = "alpha(opacity=80)"
   covering.style.overflow = "hidden"
   // RF: workaround for IE lying about offsetLeft and bad positioning
   var nextParent = component
   var left = component.offsetLeft
   while (nextParent = nextParent.parentNode) {
   if (nextParent.offsetLeft && 
nextParent.getAttribute("suppressOffset") != "true") {

   left += nextParent.offsetLeft
   }
   }
   covering.style.left = left
   var img = document.createElement('img')
   img.src = imgPath
   img.style.width = "16px"
   img.style.height = "16px"
   img.style.margin = "8px"
   covering.appendChild(img)
   component.insertBefore(covering,component.firstChild)
}

My subclass of LinkSubmit:
@ComponentClass(allowBody = true, allowInformalParameters = true, 
reservedParameters = "name,href")

public abstract class ShadyLinkSubmit extends AnnotatedLinkSubmit {
   @InjectScript("ShadyLinkSubmitBindings.script")
   public abstract IScript getSubmitScript();

   @Asset("classpath:/com/vms/infrastructure/images/loading.gif")
   public abstract IAsset getLoadingImage();
 public String getLoadingImageUrl() {
   return getLoadingImage().buildURL();
   }

   @SuppressWarnings("unchecked")
   protected void renderFormComponent(IMarkupWriter writer, 
IRequestCycle cycle) {

   boolean disabled = isDisabled();

   IForm form = getForm();
   String type = getSubmitType();

   Defense.notNull(type, "submitTy

Re: T4: replacing script asset in AbstractSubmit

2007-12-07 Thread Steve Shucker
RenderSupport(cycle, this);

   getSubmitScript().execute(this, cycle, prs, Collections.EMPTY_MAP);
   }
}

the script there just has the include line for my util.js

Here's my Submit subclass:
@ComponentClass(allowBody = false, allowInformalParameters = true, 
reservedParameters = "name,type,defer")

public abstract class ShadySubmit extends AnnotatedSubmit {
   @InjectScript("ShadySubmitBindings.script")
   public abstract IScript getSubmitScript();
  
   @Asset("classpath:/com/vms/infrastructure/images/loading.gif")

   public abstract IAsset getLoadingImage();
  
   public String getLoadingImageUrl() {

   return getLoadingImage().buildURL();
   }
}

The Annotated(Link)Submit classes that I'm subclassing are trivial 
subclasses that inject the binding via annotations instead of *.jwc files.


Thanks for pointing out that AjaxStatus component - I'd never seen it 
before.


-Steve

Andreas Andreou wrote:

Hi,
so, SubmitBindings.script actually calls tapestry.form.submit
and/or tapestry.form.refresh, tapestry.form.cancel
so, why not just connect around those and do whetever you want?

You can completely bypass them, or just have your code run before or
after those...

BTW, I remember someone doing something similar some time ago using
http://tapestry.apache.org/tapestry4.1/tapestry-contrib/componentreference/ajaxstatus.html
and overlaying on top of everything... i would be interested in
finding out more about
your implementation, esp. some code :)

On Dec 3, 2007 11:30 PM, Steve Shucker <[EMAIL PROTECTED]> wrote:
  

Is it possible to globally replace the SubmitBindings.script file used
by all the AbstractSubmit subclasses to wire up ajax events with my own
version?  I've got a script that imposes an overlay on top of the
components being updated and prevents double-clicks.  Right now, I can
wire it up to each individual button with a @Script, but it would be
cleaner if I could just replace the asset where the submit script is
wired.  That way it would be automatically applied to all ajax submits.
I'd like to do this without hacking up my tapestry jar.

It might be nice to disable or unwire non-ajax submit buttons when
they're clicked as well, but I haven't tried implementing that yet.

-Steve

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]







  


-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



T4: replacing script asset in AbstractSubmit

2007-12-03 Thread Steve Shucker
Is it possible to globally replace the SubmitBindings.script file used 
by all the AbstractSubmit subclasses to wire up ajax events with my own 
version?  I've got a script that imposes an overlay on top of the 
components being updated and prevents double-clicks.  Right now, I can 
wire it up to each individual button with a @Script, but it would be 
cleaner if I could just replace the asset where the submit script is 
wired.  That way it would be automatically applied to all ajax submits.  
I'd like to do this without hacking up my tapestry jar.


It might be nice to disable or unwire non-ajax submit buttons when 
they're clicked as well, but I haven't tried implementing that yet.


-Steve

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: Blank value for PropertySelection

2007-11-28 Thread Steve Shucker

Look at the LabeledPropertySelectionModel.  From the javadoc:

Decorates an underlying [EMAIL PROTECTED] IPropertySelectionModel}adding an initial 
property. The label, option, and value of the initial property are 
configurable.


Joshua Jackson wrote:

Dear all,

I have a combo box defined as follow:


Now I wanted to add a default message for this combo box that would
look like this:

  Choose...


But I can not nest that blank option tag inside a PropertySelection
component. Does anyone has a solution for this?


Thanks in advance,

  


-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: Change value property in @Option

2007-11-28 Thread Steve Shucker
You should look at the @PropertySelection component to render a select 
dropdown complete with options.  It takes a "model" attribute (interface 
IPropertySelectionModel) which essentially wraps a collection/array of 
options.  For your case, you probably want the 
BeanPropertySelectionModel or StringConvertedPropertySelectionModel.  If 
those don't suit your needs, you can easily write a custom model.


-Steve

neo anderson wrote:

I have similar problem. Is anyone know how to solve it?

Thanks in advice.



Blackwings wrote:
  

Hi,

I'm looking for the way to change the how the value property of the
@Option
can be change. By default, it put an index from 0 to n. But I don't want
that. I would like to be able to do something like :


  

selected="ognl:currentRequester" value="ognl:currentRequester.code"/>
  



In this code, when the form is submit, the field
searchCriteria.requestershould be fill-in with
currentRequester.code. Tapestry 4 doesn't allow to have an explicit
"value"
property defined.

Is it possible to create a component from the @Option component, rewrite
the
"render" method and use the setValue(myValues) ?

Thanks

BW





  


-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: page size

2007-10-24 Thread Steve Shucker
You can probably set the ajaxDelegate attribute of @Shell to null (or 
your own renderer).  The dojo initialization code looks like it comes 
from there.


-Steve

michael wrote:

hi

we are evaluating tapestry for a web application for mobile phones. we 
have to keep the size of the pages low ( < 10kb ).
so the question is if it is possible to have tapestry not loading 
dojo, because its size is bigger the 50kb.


Thanks in advance.

michael

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: OGNL Null Problem

2007-09-26 Thread Steve Shucker
With the newer ognl I automatically try the #this prefix to see if it 
works.  Try


ognl:{null, '999', #this.checkIn == null ? null : checkIn.time, #this.checkOut 
== null ? null : checkOut.time, adultsPerRoom}

or

ognl:{null, '999', #this.checkIn == null ? null : #this.checkIn.time, 
#this.checkOut == null ? null : #this.checkOut.time, adultsPerRoom}


More likely the first one.

-Steve

Andreas Andreou wrote:

- Go with T4.1.3 - uses latest OGNL which brings several perf. enhancements.

- Try ognl:{null, '999', checkIn == null ? null : checkIn.time, checkOut
== null ? null : checkOut.time, adultsPerRoom}

- If that fails, report the problem at
http://jira.opensymphony.com/browse/OGNL and try
ognl:{null, '999', checkInValue, checkOutValue, adultsPerRoom}

while adding a getCheckInValue() and a getCheckOutValue()

- Have fun


Nikolaos Konstantinou wrote:
  

Hi all,

this is my first email at this list but I'll get right to the point:

My task is to upgrade a web application from Tapestry 3.0 to Tapestry 4.1.2.
The problem I encounter is that the OGNL expression :



...was validated OK in Tapestry 3.0 but 4.1.2 throws a

org.apache.tapestry.BindingException: Unable to parse OGNL expression ...

After some searching I realize that OGNL version 2.6.9 needs special
handling for null values.

I need to keep the null values in OGNL because the urls produced are
filtered by apache mod_rewrite rules so a tweak like passing 'null' as a
literal wouldn't help.

I also tried ognl:{} but I still get exceptions. Any ideas?

I would sincerely appreciate any help/suggestion

  



  


-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: Pages Library

2007-07-19 Thread Steve Shucker
Use whatever prefix your library is mapped with.  It's the "id" 
attribute in your *.application file.


BTW, I've found that you NEED to include a *.page file for pages in 
libraries.  Maybe it was fixed in the  4.1.2 release, but specless pages 
in libraries never worked for me.


-Steve

Paulo Ramos wrote:

Thanks

How do i call the pages??
What prefix??

Paulo Ramos - Portugal

Renat Zubairov escreveu:

That's quite a fancy feature of Tapestry, I didn't expected to find it
but it's actually there and woking

See

http://bookie.googlecode.com/svn/trunk/bookie-framework/src/main/java/org/bookie/framework/BookieMail.library 



You can put pages in the library declaration. Reference to the page
should be done with prefix

Renat

On 19/07/07, Paulo Ramos <[EMAIL PROTECTED]> wrote:

Hi all,

I have a group of Tapestry pages that are equal in 3 different 
projects.
I have created a Library with some shared components, but there is a 
way

to do the same with the pages?

Thank's for your time.

Paulo Ramos - Portugal



-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]









-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: T4 Pre-Initialization?

2007-07-12 Thread Steve Shucker
The registry is initialized in tapestry's ApplicationServlet.init().  In 
web.xml, you need to specify 1 for 
the servlet configuration.  This will force ApplicationServlet.init() to 
run when the application is deployed instead of the first time a 
tapestry page is hit.


-Steve

Norman Franke wrote:
I've been integrating Tapestry 4.0.x into my existing web application 
based on JSP and servlets. It's all been going quite well so far.


I've been using Hibernate for database access in Tapestry, but was 
using JDBC in the old servlet code. (Since it was developed 
pre-hibernate.) Anyway, I want to start using Hibernate (via HiveMind) 
in my servlet code. The question is, how do I get a reference to it?


I can do this via:

RegistryInfrastructure reg = (RegistryInfrastructure) 
ServiceSerializationHelper.getServiceSerializationSupport();


And then call getService(MyDesiredDAO.class, null). That seems to 
work. When Tomcat starts up, Tapestry doesn't initialize and 
getService throws exception stating that HiveMind has not been 
configured.


The question is, how can I force HiveMind to initialize or initialize 
it myself and not mess up Tapestry?


Norman Franke




-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: No OPTION Tags rendered for PropertySelection after updateComponents

2007-07-05 Thread Steve Shucker

I see two things off the top:
- DirectLink won't rewind the form.  You should really be using 
LinkSubmit if you want to capture the selected value.
- The updateComponents property of the DirectLink might work, but it's 
not guaranteed if you have multiple instances of this component or a 
name collision.  The good way to pass a component to this list is with 
"components.selection.clientId" rather than hardcoding the name.


I don't think either of these problems should be causing the breakage 
you're seeing.  One thing to try would be to wrap "selection" in a jwcid="[EMAIL PROTECTED]"> and pass the span 
for update.  No idea if it'll help, but just something to try.


-Steve

Schips Markus wrote:
Hy there... 


its my first post on this list and I haven't found anything regarding my
actual Tapestry 4.1.2 Problem.

See the example below.

HTML-Template:





change






Page:


















Java:
public abstract class Test extends BasePage {

public abstract String[] getTestArray();
public abstract void setTestArray(String[] testArray);

public IPropertySelectionModel getModel() {
return new StringPropertySelectionModel(getTestArray());
}

public void onChange() {
setTestArray(new String[]{"1","2","3","4"});
}
}

The test consists of a DirectLink Component and a PropertySelection.
The PropertySelection is initialized with a StringPropertySelectionModel
and should change its options when the DirectLink is clicked.

The first call of the Page shows that the PropertySelection is working:
...

A
B
C

...

But after the DirectLink is triggered, something went wrong:
...
1234
...

No OPTION Tags were rendered.

--
This email and any files transmitted with it are confidential and intended 
solely for the use of the individual or entity to whom they are addressed. If 
you have received this email in error please notify our systems manager at 
[EMAIL PROTECTED]

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

  


-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: Conditional validation

2007-06-22 Thread Steve Shucker
Http only submits one set of form data.  If I have two forms, only the 
data from the form I submit is transmitted back to the server.  Tapestry 
wouldn't receive the other information I want to persist.  An async 
submit would get around this by not re-rendering the page to avoid 
losing the other state.


-Steve

Michael Sims wrote:

Steve Shucker wrote:
  

I need everything in one form
because the checkbox states should be persisted even when the popup
dialog is submitted.


[...]
  

My options as I see them:


[...]
  

- use a separate form with an async submit for the popup (may work,
but then I'd have to return some javascript to submit the main page
and redirect)



Why not use a separate form, and mark the properties used by your forms with the
@Persist annotation (either client or session)?


-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

  


-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Conditional validation

2007-06-22 Thread Steve Shucker
Is there any way to configure validation so that a validator only runs 
for a specific submit method?


My situation is that I have a page with a few checkboxes and some 
linksubmits on it.  There's also a popup dialog box with some other form 
controls and a submit button.  I need everything in one form because the 
checkbox states should be persisted even when the popup dialog is 
submitted.  However, the validation for the controls in the dialog 
should only be performed when the submit button in the dialog is clicked.


My options as I see them:
- find a way to tie a control's validation to a specific submit method 
(what I'd prefer)
- validate manually in the listener method (loses client-side 
validation, requires more code)
- use a separate form with an async submit for the popup (may work, but 
then I'd have to return some javascript to submit the main page and 
redirect)
- change the submitType to refresh on the LinkSubmits in the main page 
so that only the the popup dialog's submit triggers validation.  I'm not 
sure if this would work at all, and I don't like it because it's a 
yes/no solution rather than letting me choose a set of controls to validate.


-Steve

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: Help with handling exceptions while using Hibernate's open-session-in-view pattern in Tapestry

2007-06-20 Thread Steve Shucker
You're right and now I feel stupid.  I'm actually using tapestry 4.1.1, 
but I fired up the debugger to  double check.  Sure enough, it was 
applying my filter to asset requests.  I could swear this worked at one 
point.  Anyway, I had the code lying around to decode manually (needed 
it in a regular servlet filter once), so here's a version that works:


   private ServiceEncoder[] serviceEncoders;
  
   public void service(WebRequest request, WebResponse response, 
WebRequestServicer servicer)

   throws IOException {
   // don't filter asset requests
   ServiceEncodingImpl encoding = new 
ServiceEncodingImpl(request.getActivationPath(),request.getPathInfo(),extractParameters(request));

   for(ServiceEncoder serviceEncoder: serviceEncoders){
   serviceEncoder.decode(encoding);
   if(encoding.isModified()){
   break;
   }
   }
   if 
(Tapestry.ASSET_SERVICE.equals(encoding.getParameterValue(ServiceConstants.SERVICE))) 
{

   servicer.service(request, response);
   } else {
   filterRequest(request, response, servicer);
   }
   }
  
   // copied from somewhere in tapestry

   private QueryParameterMap extractParameters(WebRequest request) {
   QueryParameterMap result = new QueryParameterMap();
   Iterator i = request.getParameterNames().iterator();
   while (i.hasNext()) {
   String name = (String) i.next();
   String[] values = request.getParameterValues(name);
   if (values.length == 1) {
   result.setParameterValue(name, values[0]);
   } else {
   result.setParameterValues(name, values);
   }
   }
   return result;
   }

Here's the hivemind config to inject the encoders:

  class="com.vms.infrastructure.websession.TapestrySessionTxFilter">
  value="service-property:tapestry.url.LinkFactory:serviceEncoders"/>

   

Thanks for catching my bug!

-Steve


Michael Sims wrote:

Steve Shucker wrote:
  

Unless I'm really screwing up, my check works with friendly URLs.  I'm
using them.  They way I understand the pipeline is that service
encoders take the original http request and do some preprocessing
before you end up with a WebRequest.  Look at RequestCycleFactoryImpl
and AssetEncoder to see where this happens.  The short version is
that the WebRequest should have a parameter set that identifies the
tapestry service being called.



What version of Tapestry?  In 4.0.2, the pipeline calls the
WebRequestServicerFilter's before the RequestCycleFactory and the encoders have 
done
their work.  With friendly URLs, a typical path for an asset is something like:

/assets/031a6b16419c47ad157a817021baa2d6/class/path/file

This is still the form it is in when it hits the filter.  getParameterNames()
returns an empty list, getParameterValue(ServiceConstants.SERVICE) returns null.
I'm currently using the following to recognize an asset request:

"/assets".equals(request.getActivationPath())

You can verify this in the debugger by setting a breakpoint in both the filter 
and
line 81 of RequestCycleFactoryImpl (where decodeParameters() is called), and 
then
issuing a request for an asset.  The filter will be reached first.

The problem with this too, is that it's not immediately obvious that something 
is
wrong.  The filter will still do its job, namely synchronizing the requests, 
but it
will do it unnecessarily in the case of the asset requests.

If you're on a different version where things have changed, please disregard.


-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

  


-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: Help with handling exceptions while using Hibernate's open-session-in-view pattern in Tapestry

2007-06-20 Thread Steve Shucker
Unless I'm really screwing up, my check works with friendly URLs.  I'm 
using them.  They way I understand the pipeline is that service encoders 
take the original http request and do some preprocessing before you end 
up with a WebRequest.  Look at RequestCycleFactoryImpl and AssetEncoder 
to see where this happens.  The short version is that the WebRequest 
should have a parameter set that identifies the tapestry service being 
called.


Thanks for the link.

-Steve

Michael Sims wrote:

Steve Shucker wrote:
  

I'm really fishing for a hivemind guru to tell me how to inject some
code in the tail end of the WebRequestServicer.service() method.



Looks like something similar was discussed here:

http://www.mail-archive.com/[EMAIL PROTECTED]/msg00316.html

Howard mentioned a possible feature addition to support this, and the original
poster said that he would add a JIRA issue, but I wasn't able to locate it if 
it was
ever added.

This would come in handy for something unrelated... I'm implementing your
WebRequestServicerFilter that handles synchronization for non-asset requests, 
but
your code doesn't detect asset requests if friendly URLs (AssetEncoder) are 
enabled.
I tried my best to find a way to leverage Tapestry's existing code to determine
which service was scheduled for a particular request, but the only thing that 
can
determine that is the IRequestCycle, and this isn't available in a
WebRequestServicerFilter.  I had to resort to code similar to yours that 
handles the
scheme AssetEncoder uses, but this code is fragile; if a new encoding method is
employed the filter will not be able to detect asset requests.  Oh well, for 
now the
kludge will have to do, I suppose.

  

I'd consider a
dedicated session in pageBeginRender of my error page (with some
extra error handling) to set up the state for your error page.



Thanks, but that won't work for two reasons: (1) I don't have an error page as 
such,
many pages may need to handle these types of constraint violations, and 
sometimes
only when certain listeners are called, and (2) that would require me to 
basically
have two copies of all my persistent objects, one copy for each session.  I'd 
rather
manually eager fetch everything that my template is going to need before 
attempting
the commit than to do that...


-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

  


-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: Help with handling exceptions while using Hibernate's open-session-in-view pattern in Tapestry

2007-06-20 Thread Steve Shucker
I'm really fishing for a hivemind guru to tell me how to inject some 
code in the tail end of the WebRequestServicer.service() method.  That 
would allow me to implement a general solution of flushing before the 
response is committed and forcing the exception to occur at a point 
where I can still notify the user.  I want things to be automatic rather 
than having to explicitly call Session.flush() in every listener 
method.  (If I was going to do that, I'd use an aspect.)


I know this doesn't quite solve your problem because you want to use 
another session to render your error response.  I'd consider a dedicated 
session in pageBeginRender of my error page (with some extra error 
handling) to set up the state for your error page.


-Steve

Michael Sims wrote:

Steve Shucker wrote:
  

Keep in mind the difference between a flush and a commit in hibernate.
A flush executes all the queued sql against the database without
committing the transaction.  Hibernate does this whenever it has
changes that needed to be sent to the database before a query is run.
Otherwise, it defers the flush until just before the commit.  Unless
you're using deferred constraints in oracle, constraint violations and
other db-related exceptions will be raised during the flush, not the
commit.

What I'd really like to do is configure something in hivemind that
would run just before tapestry commits the response.  Then I could
call session.flush() there to force the exception before the response
is committed.  I just don't know how I can accomplish this.



Ah, ok.  Sorry about that, I guess I need to learn to be a bit more precise in 
my
interpretation of the terms.  Still, a "session manager" service would allow 
you to
expose a method to flush() in a listener, yes?  Or you want to make this more
transparent/automatic so you can just redirect to a static error page on any
exception without having to explicitly flush()?

That still doesn't help for my particular use case though... I need to catch the
error and still render a response that might need to access lazily-initialized
properties of Hibernate persisted objects...


-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

  


-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: Help with handling exceptions while using Hibernate's open-session-in-view pattern in Tapestry

2007-06-20 Thread Steve Shucker
Keep in mind the difference between a flush and a commit in hibernate.  
A flush executes all the queued sql against the database without 
committing the transaction.  Hibernate does this whenever it has changes 
that needed to be sent to the database before a query is run.  
Otherwise, it defers the flush until just before the commit.  Unless 
you're using deferred constraints in oracle, constraint violations and 
other db-related exceptions will be raised during the flush, not the commit.


What I'd really like to do is configure something in hivemind that would 
run just before tapestry commits the response.  Then I could call 
session.flush() there to force the exception before the response is 
committed.  I just don't know how I can accomplish this.


-Steve

Michael Sims wrote:

Steve Shucker wrote:
  

I just realized I had a bug relating to this yesterday and I could
use a little help solving it.  I think the solution is to force the
hibernate session to flush before the response is committed, but I'm
not sure how/where to inject that call into tapestry.  If I knew
where to make tapestry call my code, getting hibernate to flush is
easy.



If I need to commit or rollback the transaction in a listener method (or 
elsewhere),
I inject a thread-bound transaction manager service into my pages.  The 
transaction
manager has the request-wide session injected into it, and I call methods on the
manager to commit, rollback, etc.  I got this idea from Tapestry 5's
tapestry-hibernate project:

http://tinyurl.com/3b3dok

In my implementation, I have split out the ThreadCleanupListener 
responsibilities
into another object, but the rest is pretty much the same.

Does this help at all?

  

In general, I think we should either use an open session in view or
DAO approach, not a hybrid.  The point of open session in view is that
developers don't have to worry about transactional contexts,
reenlistment and stuff like that.  If you're throwing those gains away
with separate request/response or listener/other transactions, you're
better off letting DAOs manage transactions and getting the benefits
of their narrower scope and cleaner definition of where transactions
start
and stop.



The issue with that, in my case anyway, is that I'm using a SqueezeAdaptor to
transparently squeeze a Hibernate persisted object into class + id, and then
unsqueeze to the full entity on the next request.  I do this for client 
persistence
and direct link parameters, etc., to keep my objects from being serialized into 
the
query string.  My SqueezeAdaptor has to have an active session and transaction, 
and
this occurs before any listener methods are called.  I could have the
SqueezeAdaptor, or anything else that needs to use Hibernate, start and finish 
their
own transactions via DAO calls, but this would result in a high number of
transactions per request, so I don't think that would be worth anything.

Worse still, if any of those transactions results in an error, you are supposed 
to
close the Session, which detaches all persistent objects and makes it 
impossible to
access lazily-initialized properties.

  

Even if spring says it's ok to start a new transaction in a session
where the previous transaction was rolled back, I think it's a bad
idea.  I use open session in view, which is one transaction per
session
in its entire lifetime.



Yes, but what about my scenario with the CRUD application?  An administrator 
tries
to persist a new user, and there is a primary key violation, but using open 
session
in view, you don't know this until the response has already been rendered, and 
by
then it's too late to present an error.  So, how do you handle this without
comitting the transaction early, before the response has been rendered?


-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

  


-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: Help with handling exceptions while using Hibernate's open-session-in-view pattern in Tapestry

2007-06-20 Thread Steve Shucker
I just realized I had a bug relating to this yesterday and I could use a 
little help solving it.  I think the solution is to force the hibernate 
session to flush before the response is committed, but I'm not sure 
how/where to inject that call into tapestry.  If I knew where to make 
tapestry call my code, getting hibernate to flush is easy.


I just spent a few minutes this morning trying to explicitly call 
response.sendError, but once the WebRequestServicer has called its 
service method, the response is committed so I get an IllegalStateException.


In general, I think we should either use an open session in view or DAO 
approach, not a hybrid.  The point of open session in view is that 
developers don't have to worry about transactional contexts, 
reenlistment and stuff like that.  If you're throwing those gains away 
with separate request/response or listener/other transactions, you're 
better off letting DAOs manage transactions and getting the benefits of 
their narrower scope and cleaner definition of where transactions start 
and stop.


Even if spring says it's ok to start a new transaction in a session 
where the previous transaction was rolled back, I think it's a bad 
idea.  I use open session in view, which is one transaction per session 
in its entire lifetime.  For daemon processes, a session will go through 
multiple transactions, but the moment something goes wrong, I start with 
a new session.


-Steve

Michael Sims wrote:

Sorry again for the not 100% Tapestry related question, but I got such helpful
responses from my last question, and it's clear that there are a lot of people 
on
this list that have already solved these issues that I'm running into (and I'm
getting jack from the Hibernate forums ;) )...

I've implemented the "open session in view" pattern in my Tapestry application 
in
the fairly conventional way. I inject a threaded Session via Hivemind using a
service factory, and the service factory activates a transaction and creates a
ThreadCleanupListener to commit() the transaction and close the session when the
thread is done processing the user's request.  So far so good.

What I'm not sure how to do is handle situations where I may need to inform the 
user
that their transaction failed.  For example, let's say I have a typical CRUD
application to create new users for my system, and I want to be able to 
correctly
handle the scenario where an administrator attempts to create a new user with a 
name
that is already in use (a primary or unique key violation). I can't simply let 
the
ThreadCleanupListener handle the commit() in this case; if I do this, and an
exception is thrown, it is too late to inform the user since the request has 
already
been rendered.

The "Open Session in View" page on the Hibernate web site [1] states that a good
approach is to use two transactions in one Session.  If I took this approach, I
would attempt to commit the transaction in my listener method, and catch the
exception thrown from the database, and convert this into a validation error 
which
states that the username is already taken.

The problem with this is that the Hibernate documentation is quite clear that 
if any
exception occurs, the transaction should be rolled back, and the Session should 
be
closed and discarded.  Rolling back is not a problem, but if I close and 
discard the
Session, I'm no longer using "open session in view".  I'll have to go to the 
trouble
to initialize any lazy collections or proxies that the view might need before I
attempt the commit, otherwise I'll get a LazyInitializationException.

But I've read one of the Spring guys saying [2] that it's ok to begin a new
transaction on the same Session that has been rolled back, if you're only using 
it
to initialize lazy collections.  This would be nice if it were actually true; it
would simplify things for me quite a bit.  But I hestitate to rely on that, 
since
the Hibernate documentation says otherwise.

Can someone with a bit more experience with give me some advice on how to 
approach
this?  Thanks in advance...

[1] http://www.hibernate.org/43.html
[2] http://forum.springframework.org/showpost.php?p=29579&postcount=6


-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

  


-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: Using Hibernate detached objects in Tapestry (thread-safety question)

2007-06-18 Thread Steve Shucker
I'm serializing the requests to prevent hibernate from trying to 
associate an entity with more than one session.  Most of the research 
that led to this approach was done in the hibernate2/tapestry3 days, so 
some of it may be outdated.  I believe the rest of my state is 
sufficiently thread-safe that I wouldn't need this if it weren't for 
hibernate.


Generally, it's not a performance problem, but my production code is 
only making light use of ajax.  That's going to change soon.  Some older 
code does use pre-ajax iframe swapping though, and that performs well.  
The only problem I've seen is if a user tries one of a few long 
operations and then changes their mind and clicks on something else.  My 
filter still waits for the long operation to complete or timeout 
(configured to 20 seconds) before beginning the user's new request.


I got hooked on spring before tap4, so I never gained mastery over 
hivemind.  I can't really tell you how to craft hivemind-based DAOs.  If 
you're using a DAO setup, you probably need to explicitly reattach in 
the DAO methods rather than using tapernate to do it automatically.  
Personally, I'm moving towards tapernate-style re-enlistment and away 
from a kludgy aspect.


-Steve


Michael Sims wrote:

Hi Steve,

Steve Shucker wrote:
  

I'm not sure if this will completely solve your problem, but I wrote
my own WebRequestServicerFilter that only applies the
session/transaction wrapping on non-asset requests.



Interesting!  Thanks for that.  There will still be some non-asset requests
in my application that won't hit the Hibernate stuff, but this will take
care of a good bit of unnecessary locking if I ultimately go that route.

  

I actually wrote a generic wrapper and then subclassed it into a
WebRequestSericerFilter for tapestry and a ServletFilter for the rare
occasions when I need a non-tapestry request wrapped.  The reason I
have both versions is specifically so I don't blindly apply the
wrapping to asset requests.  The filterRequest method in the
superclass serializes the requests.



So, just curious, are you serializing your requests for the same reason as I
(i.e. Hibernate detached objects)?  Or are you doing it just in general so
that you can place non-thread safe objects in your HttpSession?  Have you
noticed any performance impact from the serialization?

  

If you're really worried about high throughput and contention issues,
using DAOs for narrower transactions may be your best bet.  If I was
going down that road, I'd be looking at using spring to broker my DAOs
and seeing if I could subclass their base DAO class to build in the
mutex support.



I'm using Hivemind as my app-wide DI container, and it is injecting my DAOs
into the classes that need them.  The problem with locking within the DAO is
that I need to lock starting from the point that I reattach (via
Session#update(), merge(), or lock()), to the point that I detach (via
evict() or closing the Session), and this will span many calls to various
DAOs.

Thanks for taking the time to respond...


-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

  


-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: Using Hibernate detached objects in Tapestry (thread-safety question)

2007-06-18 Thread Steve Shucker
I'm not sure if this will completely solve your problem, but I wrote my 
own WebRequestServicerFilter that only applies the session/transaction 
wrapping on non-asset requests.


   public void service(WebRequest request, WebResponse response, 
WebRequestServicer servicer)

   throws IOException {
   // don't filter asset requests
   if 
(Tapestry.ASSET_SERVICE.equals(request.getParameterValue(ServiceConstants.SERVICE))) 
{

   servicer.service(request, response);
   } else {
   filterRequest(request, response, servicer);
   }
   }

I actually wrote a generic wrapper and then subclassed it into a 
WebRequestSericerFilter for tapestry and a ServletFilter for the rare 
occasions when I need a non-tapestry request wrapped.  The reason I have 
both versions is specifically so I don't blindly apply the wrapping to 
asset requests.  The filterRequest method in the superclass serializes 
the requests.


If you're really worried about high throughput and contention issues, 
using DAOs for narrower transactions may be your best bet.  If I was 
going down that road, I'd be looking at using spring to broker my DAOs 
and seeing if I could subclass their base DAO class to build in the 
mutex support.


-Steve


Michael Sims wrote:

I know this isn't strictly Tapestry related, but since there has been a lot of
discussion here over the years related to integrating Hibernate with Tapestry, 
I was
hoping I could draw on the community knowledge about this topic and get a little
advice.  My apologies if this has been discussed before, I did extensive 
searching
before posting but still might have missed something.

My specific dilemma at the moment is how to implement session-per-request with
detached objects in a thread-safe manner.  Chapter 8 of the _Hibernate in 
Action_
book discusses the issues of detached objects and thread safety.  It gives the
example of a user submitting a form twice, and I can think of several other
scenarios which would cause two or more threads to access the HttpSession
simultaneously.  The book suggests a few solutions to this problem: rejecting
additional requests if one is currently processing, serializing all requests 
from
the same user by synchronizing on the HttpSession in a servlet filter, and 
finally
maintaining a map of session information to separate windows in a multi-window
application.

None of these solutions seem to be workable in my situation.  We are making
extensive use of assets for all of our images and CSS files, so there really is 
no
static content in our application; every request is going to be serviced by the
servlet.  The first two solutions aren't practical as even loading my 
application's
login page will open at least 4 concurrent requests (two CSS files, several 
images,
the HTML document, etc.) and if these requests are serialized I am of the 
opinion
that this will noticeably impact perceived performance of the application and 
will
impact scalability in the long run.  The final solution (mapping between 
windows)
doesn't solve the issue of users opening multiple tabs or windows as each window
will have the same name/identifier.

So, I'm struggling to come up with a solution to this that doesn't require me to
abandon detached objects.  I have an idea for a solution, but it seems 
cumbersome
and I was hoping to get some suggestions or feedback on this.

My idea is to explicitly synchronize only the sections of the code in my request
action handlers that have to work with the potentially shared detached objects. 
 My
plan is to synchronize either on a mutex object, or one of the detached 
objects, and
within the synchronized block update() the detached object, perform my model
manipulations, commit the transaction, close the session, then end the lock.  It
would still be possible for more than one thread to share a given detached 
object,
but this would prevent my code from attempting to attach the object(s) to more 
than
one session simultaneously.

(As an aside, I looked at the Tapernate code, since it includes persistence
strategies that use Hibernate detached objects.  However, unless I'm missing
something, it doesn't seem to be taking thread safety of detached objects into
account at all, which I find curious.)

Can someone with a little more experience with this sort of thing give me some
advice on this?  Does my approach above sound workable, or is there something 
better
that some of you are already doing?  Should I just forget about detached 
objects and
squeeze/unsqueeze my entities down to identifers and retrieve them anew on each
request?  Any help or advice would be greatly appreciated...


-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

  


-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Re: State problems: contrib:Table in loop

2007-06-15 Thread Steve Shucker

You need to specify the "tableSessionStoreManager" property.

If the loop iterates over something that's stored in the session anyway, 
you can add a Serializable field to that object (or wrap it in another 
object containing this field) and implement the two methods of 
ITableSessionStoreManager to load and save the state there.  It's not 
always an appropriate solution, but it is the easiest.


-Steve

Alexei Orishchenko wrote:

The page contains loop that renders contrib:Table on each iteration (list of
users, orders for each user).
I have problems with pagers of these tables. For example, I go to the 2nd
page in the table for 2nd user but the page isn't changed. Seems, the
Tapestry stores 1 table state for these tables.

Any thoughts how to store separate state for each table / fix pager problem?
  


-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: Multiple component validation

2007-06-04 Thread Steve Shucker

I already tried it on both fields and it doesn't work either way.

-Steve

andyhot wrote:
From 
http://tapestry.apache.org/tapestry4.1/apidocs/org/apache/tapestry/form/validator/Identity.html 


" Apply this validator to the second field ... "

So, you need to do it the other way around, i.e. pass the name of the 
first field to your validator
and apply the validator to the second field - this is so that both 
fields have rewound



Steve Shucker wrote:
I'm trying to write a variant of the match/differ validators to check 
if two fields have the same null state.  I pass in the name of the 
second field to the validator and can access that field with


TextField referent = (TextField) 
field.getContainer().getComponent(_fieldName);


However, referent.getValue() always evaluates to null.  Is this 
something that I need to upgrade to tapestry 4.1.2-SNAPSHOT to make 
it work (I'm using 4.1.1)?  It's not an issue with validating one 
field before the other is set - I've tried moving the validator 
between the different controls.


-Steve
-

To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]





-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Multiple component validation

2007-06-04 Thread Steve Shucker
I'm trying to write a variant of the match/differ validators to check if 
two fields have the same null state.  I pass in the name of the second 
field to the validator and can access that field with


TextField referent = (TextField) 
field.getContainer().getComponent(_fieldName);


However, referent.getValue() always evaluates to null.  Is this 
something that I need to upgrade to tapestry 4.1.2-SNAPSHOT to make it 
work (I'm using 4.1.1)?  It's not an issue with validating one field 
before the other is set - I've tried moving the validator between the 
different controls.


-Steve  



-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: dojo dialog to populate portion of form and submit

2007-06-01 Thread Steve Shucker
The dojo dialog control moves the rendered dialog around in the DOM so 
it's just inside the closing  tag.  They do this so it's in a 
known place and they can make some assumptions about (lack of) nesting 
when it renders.  However, this effectively moves it outside any forms.  
Use firebug to inspect the DOM when you show the dialog and you'll see 
it at the very end instead of where you placed it.  To make things work, 
you have to place the dojo dialog outside any existing forms and it 
needs to include it's own @Form tag.  Alternately, I made a dirty hack 
to move the dialog just inside a closing form tag instead of a body 
tag.  It works for me because my  is just inside , but I 
don't know how well it'll work on other structures.


FormDialog.java:
package com.vms.infrastructure.tapestry.components;

import java.util.HashMap;
import java.util.Map;

import org.apache.tapestry.IForm;
import org.apache.tapestry.IMarkupWriter;
import org.apache.tapestry.IRequestCycle;
import org.apache.tapestry.IScript;
import org.apache.tapestry.TapestryUtils;
import org.apache.tapestry.annotations.ComponentClass;
import org.apache.tapestry.annotations.InjectScript;
import org.apache.tapestry.annotations.Parameter;
import org.apache.tapestry.dojo.html.Dialog;

@ComponentClass(allowBody=true, allowInformalParameters=true)
public abstract class FormDialog extends Dialog {
  
   @Parameter(defaultValue="ognl:true")

   public abstract boolean isHidden();
  
   @Parameter(defaultValue="literal:black")

   public abstract String getBackgroundColor();
  
   @Parameter(defaultValue="0.4")

   public abstract float getOpacity();
  
   @Parameter

   public abstract String getParent();
  
   @InjectScript("FormNest.script")

   public abstract IScript getMoveScript();

   @InjectScript("Dialog.script")
   public abstract IScript getScript();

   public void renderComponent(IMarkupWriter writer, IRequestCycle cycle) {
   super.renderComponent(writer, cycle);
   if (cycle.isRewinding()) {
   return;
   }
   // don't need this during rewind
   String resolvedParent = null;
   if (isParameterBound("parent")) {
   resolvedParent = getParent();
   } else {
   IForm form = (IForm) 
cycle.getAttribute(TapestryUtils.FORM_ATTRIBUTE);

   if (form != null) {
   resolvedParent = form.getClientId();
   }
   }
   if (resolvedParent != null) {
   Map symbols = new HashMap();
   symbols.put("dialogId", getClientId());
   symbols.put("parent", resolvedParent);
   getMoveScript().execute(this, cycle, 
TapestryUtils.getPageRenderSupport(cycle, this), symbols);

   }
   }
}

FormNest.script:

http://jakarta.apache.org/tapestry/dtd/Script_3_0.dtd";>



   
   
   dojo.byId('${parent}').appendChild(dojo.byId('${dialogId}'))
   



I also had to copy Dialog.script into my scripts folder.

-Steve

Paul Stanton wrote:
Fair enough, it was a pretty jumbled structure and as a result 
difficult to describe. Unfortunately I've moved on with my form 
separation method (as you describe how you use dialog forms) which 
works well enough.


Essentially I had


   
   
   
   
  
  

   


Now, when I used the dialog submit the dialog's form elements were 
submitting null/empty values. My theory was that when the dialog and 
child components were re-rendered when the dialog was updated in the 
async request, they were becoming detached form the original form.


Come to think of it, I wasn't specifying the component Id's (ie i was 
just doing jwcid="@TextField") maybe if I specified an Id it would work?


Thanks for the interest jesse. does any of this make sense?

Jesse Kuhnert wrote:
I can't really piece together what you are doing vs. what is not 
working as
expected but the Dialog component essentially does nothing other than 
wrap a

block of html.

Tapestry does maintain form state during ajax requests - so if that's 
not

happening then something is wrong.  It's possible that the client side
javascript code implementing the dialog moves the html nodes around 
in such
a way that if you don't have a form within the dialog itself that the 
nodes
will become separated from the original form and start to break 
things.  I
have always placed forms within my dialogs even when on pages with 
"one big

form" as the placement of the dialog outside of the big form makes no
difference as the html displayed is always centered anyways.

Maybe an example would help but I just am not getting it looking at the
paragraphs of text.



-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



-

Re: T4.1.1 - How to inject (dynamic) page into component?

2007-05-30 Thread Steve Shucker
I think you're going down the wrong path with page injection.  Try using 
@Parameter to declare/inject a parameter to pass the page.  You can 
either make your parameter a String and use cycle.getPage(pageName) like 
Andreas suggested or make it an IPage or ILoginPage to pass the page 
directly.  If you're just passing a String, you may need to @Inject some 
other bit of infrastructure to resolve it into a page.


-Steve

Jan Vissers wrote:
Ok - but one way or another I want to 'parameterize' my component with 
the
actual page, implementing the ILoginpage interface. So I'm guessing I 
still need

some kind of @Parameter annotation, right?

-J.

Andreas Andreou wrote:

Well, instead of injecting the page,
you can do a cycle.getPage(pageName)


On 5/30/07, Jan Vissers <[EMAIL PROTECTED]> wrote:


anyone?

> I have a component that 'should' operate on a page it gets injected.
>
> Currently I have:
>
> 
> import com.cumquatit.refapp.view.tapestry.pages.Loginpage;
> 
>
> public abstract class LoginLogoff extends BaseComponent {
> ...
> @InjectPage("pages/login/Loginpage")
> public abstract Loginpage getLoginpage();
> ...
> }
>
>
> This however ties my component to a specific class: Loginpage. I'd
rather
> have something like this:
>
>
> public abstract class LoginLogoff extends BaseComponent {
> ...
> // @InjectPage() or @Parameter()
> public abstract ILoginpage getLoginpage();
> ...
> }
>
> Where the getLoginPage now references an interface ILoginpage, for 
which

a
> concrete implementation is injected via the appropriate annotation.
>
> Does this make sense, and is this possible?
> If so - how?
>
> Thanks,
> -J.
>
>
> -
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
>
>



-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]









-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: starting point for ajax with dojo and tapestry 4.1?

2007-05-01 Thread Steve Shucker
I asked that same question about a month ago and found there wasn't a 
good answer.  Someone pointed me to Shing Hing Man's homepage 
(http://uk.geocities.com/matmsh/) where he posted some good information, 
but dojo's documentation wasn't nearly as helpful as it should have been.


The first huge gotcha is the "parseWidgets" attribute of the @Shell 
component.  Tapestry (smartly) says this should be turned off.  All 
dojo's docs assume it's on.  For pure dojo work, prototype your stuff on 
a page with this on before you worry about adding the scripts to 
register widgets manually.  Often, a good way to do this is with a 
manually created header outside a jwcid="$content$" area so you can 
toggle parseWidgets when testing your template.


Look at the tacos sources - they're much more informative than any 
documentation I found.  Don't be afraid to use something other than dojo 
either - my team wasted a lot of time mucking around with dojo's editor2 
before realizing FCKEditor was a better solution.  The tapestry/dojo 
integration is very well thought out, but dojo itself has a number of 
rough edges.


-Steve

Paul Stanton wrote:
Hi, does anyone know of any good tutorials/demos for ajax with dojo 
and tapestry 4.1?


thanks.



-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: Tapestry RTE Component

2007-04-18 Thread Steve Shucker
My company needs one too.  We wrapped the dojo Editor2 component.  I 
helped someone get a quick demo of this working a few weeks ago, but I 
don't know if it's 100%.  If you're using version 4.1.1, you're welcome 
to use this.


-Steve

DojoEditor.java:

import java.util.HashMap;
import java.util.Map;

import org.apache.tapestry.form.AbstractFormComponent;
import org.apache.tapestry.IMarkupWriter;
import org.apache.tapestry.IRequestCycle;
import org.apache.tapestry.IScript;
import org.apache.tapestry.PageRenderSupport;
import org.apache.tapestry.TapestryUtils;
import org.apache.tapestry.annotations.ComponentClass;
import org.apache.tapestry.annotations.InjectScript;
import org.apache.tapestry.annotations.Parameter;

@ComponentClass(allowBody=true)
public abstract class DojoEditor extends AbstractFormComponent {
  
   @Parameter(required=true)

   public abstract String getValue();
   public abstract void setValue(String value) ;
  
   @InjectScript("DojoEditor.script")

   public abstract IScript getScript();
  
   /**
* @see 
org.apache.tapestry.form.AbstractFormComponent#renderFormComponent(org.apache.tapestry.IMarkupWriter,

*  org.apache.tapestry.IRequestCycle)
*/
   protected void renderFormComponent(IMarkupWriter writer, 
IRequestCycle cycle) {
   PageRenderSupport pageRenderSupport = 
TapestryUtils.getPageRenderSupport(cycle, this);


   Map symbols = new HashMap();
   symbols.put("id", getClientId());
   symbols.put("formId", getForm().getClientId());
   getScript().execute(this, cycle, pageRenderSupport, symbols);

   renderDelegatePrefix(writer, cycle);

   writer.begin("textArea");
   writer.attribute("style","width:700px; height:200px");
   renderIdAttribute(writer, cycle);
   writer.attribute("name", getName());
   renderInformalParameters(writer, cycle);
   renderBody(writer, cycle);
   writer.printRaw(getValue());
   writer.end();
   renderDelegateSuffix(writer, cycle);
   }

   /**
* @see 
org.apache.tapestry.form.AbstractFormComponent#rewindFormComponent(org.apache.tapestry.IMarkupWriter,

*  org.apache.tapestry.IRequestCycle)
*/
   protected void rewindFormComponent(IMarkupWriter writer, 
IRequestCycle cycle) {

   setValue(cycle.getParameter(getName()));
   }

}

DojoEditor.script:



http://jakarta.apache.org/tapestry/dtd/Script_3_0.dtd";>


   
   
   
   
   dojo.require("dojo.widget.Editor2");
   dojo.require("dojo.widget.Editor2Plugin.DialogCommands");
   dojo.require("dojo.widget.Editor2Plugin.ColorPicker");
   
   
   
dojo.widget.createWidget("Editor2", {id: "${id}_widget"}, dojo.byId('${id}'));
   dojo.event.connect(dojo.byId('${formId}'), "onsubmit", function () {
dojo.byId('${id}').value = dojo.widget.getWidgetById("${id}_widget").getEditorContent()
   })
   




Nick Westgate wrote:

Hi James.

I haven't used it, but perhaps:
http://www.tapestrycomponents.org/Tassel/app?service=external/ViewComponent&sp=SHtmlArea 



There are also several for T4 on Tassel.

Cheers,
Nick.


James Sherwood wrote:

Hello,

I am looking for a Rich Text Editor component for tapestry that is 
compatable with (or maybe i could modify) Tapestry 3 and all large 
browsers.


If someone could point me in the right direction that would be great.

I have tried creating my own and have been successfull in everything 
except getting the information from the RTE to come out in the form 
submit, it is always null.


Any help would be greatly appreciated.

--James

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]






-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: Page Cleanup Tasks

2007-04-05 Thread Steve Shucker
The visit pattern certainly isn't deprecated, it just evolved.  Instead 
of having a single visit object to store everything, you define your own 
application state objects.  It's a vast improvement because you can 
separate each functional area of your application into its own ASO with 
whatever API it needs.  I often find myself creating an ASO called 
"visit" for some general purpose usage, but using other ASOs as well.


Anyway, I was assuming you were storing your state with each individual 
page using @Persist annotations rather than stashing it all in an ASO.  
If state is local to a certain page, it belongs in that page.  If it's 
shared between pages, then use the ASO.


If you're just looking for a way to simplify the check, I'd create a 
marker interface to denote stateful pages and have your check be for 
event.getRequestCycle().getPage() instanceof StatefulPage.  That way 
you're not hardcoding lists.  You should only need to do this on rewind 
OR render, depending on whether you're checking against the requesting 
or responding page.


-Steve

Gareth wrote:

Thanks Steve.

I'll investigate using that perhaps instead of storing it in the visit object.  
Incidentally, I haven't had any comments as to whether the visit pattern is no 
longer the best practice with version 4.1.1 upwards...  I'd be grateful to hear 
people's views.  I think the reason I'm not clear is because I don't know the 
reasoning behind the getVisit() method being deprecated - so I wrote my own 
that kind of does the same thing - getTheVisit().

Currently, my solution is to have my BasePage (which extends the Tapestry 
BasePage) implement PageBeginRender, it then checks the page being opened to 
see if it is one of my 2 for which I want state to be kept, and if it isn't, it 
clears the state out of my visit object - which is where i moved the state to 
since it is easier to get to there.

If anyone has a tidier solution - because I think that this method has to be 
about the most inefficient (forcing a check of the page 2x per requestCycle for 
every page in the application), I would be very grateful to hear it.

Thanks

Gareth

- Original Message 
From: Steve Shucker <[EMAIL PROTECTED]>
To: Tapestry users 
Sent: Wednesday, 4 April, 2007 9:54:52 PM
Subject: Re: Page Cleanup Tasks

I'm not sure where you'd call it from, but 
IRequestCycle.forgetPage(String) will cause it to dump any state 
connected to a given page.


-Steve

Gareth wrote:
  

hi,

I am storing a list of items in the session using @Persist("session") and that 
is working well, however I would like to remove that list from the session if that area 
of my application is left by the user.  Is it possible to establish via the 
PageDetachListener or some other method which page the user has decided to jump to from 
my menu, and dependant on that page, clear / keep my session variable?

Many thanks

Gareth






___ 
New Yahoo! Mail is the ultimate force in competitive emailing. Find out more at the Yahoo! Mail Championships. Plus: play games and win prizes. 
http://uk.rd.yahoo.com/evt=44106/*http://mail.yahoo.net/uk 


-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

  



-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]







___ 
Now you can scan emails quickly with a reading pane. Get the new Yahoo! Mail. http://uk.docs.yahoo.com/nowyoucan.html


-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

  


-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: Page Cleanup Tasks

2007-04-04 Thread Steve Shucker
I'm not sure where you'd call it from, but 
IRequestCycle.forgetPage(String) will cause it to dump any state 
connected to a given page.


-Steve

Gareth wrote:

hi,

I am storing a list of items in the session using @Persist("session") and that 
is working well, however I would like to remove that list from the session if that area 
of my application is left by the user.  Is it possible to establish via the 
PageDetachListener or some other method which page the user has decided to jump to from 
my menu, and dependant on that page, clear / keep my session variable?

Many thanks

Gareth






___ 
New Yahoo! Mail is the ultimate force in competitive emailing. Find out more at the Yahoo! Mail Championships. Plus: play games and win prizes. 
http://uk.rd.yahoo.com/evt=44106/*http://mail.yahoo.net/uk 


-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

  


-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: .jwc-file-free components for libraries (4.1.1)

2007-04-04 Thread Steve Shucker
My recent experience (with 4.1.1) is that injecting relative resources 
isn't working.  I have a few components in a library with associated 
*.script files.  Some have templates and use the @Script tag in the 
template.  Others don't have templates and use the @InjectScript 
annotation.  I tried to put all the script files in the same directory 
and found that the paths in the annotation couldn't be resolved.  I'd 
get an error message with the correct classpath, but it said the script 
file wasn't there.  If I put the *.script files in the same directory as 
the class, they'd work fine.  I don't know if the problem was because I 
was using parent paths or any directory would have broken it.


-Steve

Jesse Kuhnert wrote:

I do remember being annoyed by this lately, if you file a jira issue
for it I'll fix it quickly.

On 4/3/07, [EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote:

We are trying to move a little library of ours to Java-5 with full usage
of annotations, without jwc-files. While a component itself is
recognised this way. Asset-resolution relative to the (non-existing)
specification doesn't work.
Did I overlook anything? Or would that be an improvement-issue in Jira?

regards,
Marcus






-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: Clustering Tapestry

2007-03-28 Thread Steve Shucker
This may be the answer to the wrong question, but a long time ago I 
discovered that when weblogic was running out of memory, it would dump 
random sessions.  The solution was to configure the application server 
to persist sessions in the database.  This also allowed sessions to fail 
over to the other instance.  We carried this solution forward when we 
migrated to tomcat.  Here's a context.xml that turns this on.


   
debug="0" saveOnRestart="true" maxActiveSessions="-1" minIdleSwap="-1" 
maxIdleSwap="-1" maxIdleBackup="-1">
driverName="oracle.jdbc.OracleDriver"

connectionURL="${session.store.url}"
 sessionTable="tomcat_sessions"
 sessionIdCol="SESSION_ID"
 sessionDataCol="session_data"
 sessionValidCol="valid_session"
 sessionMaxInactiveCol="max_inactive"
 sessionLastAccessedCol="last_access"
 sessionAppCol="app_name"
 checkInterval="60"
 debug="99" />



${session.store.url} corresponds to a "-Dsession.store.url=xxx" in my 
setenv.sh file, but you could just as easily hardcode it here.  I like 
parameterizing it so my dev/test tomcat instances can point to different 
stores.


Here's the schema:

create table tomcat_sessions (
   session_id varchar2(100) not null,
   valid_session  char(1) not null,
   max_inactive   number(20) not null,
   last_accessnumber(20) not null,
   app_name   varchar2(255),
   session_data   blob,
   constraint pk_tomcat_sessions primary key (session_id, app_name)
);

For oracle, I dropped ojdbc14.jar in tomcat's common/lib folder.  Due to 
a bug (which may be fixed), I had to include the username/password as 
part of the connection URL rather than as separate attributes.


-Steve

Marcos Chicote wrote:

Hello.
I've developed an app using tapestry4 + spring + hibernate and I can't make 
work in a clustered enviroment using 2 tomcat instances.
The problem is that the StaleSession page appears really fast.
All my objects and classes implement Serializable, but I don't know if tapestry 
is storing in session stuff that isn't Serializable.

Does anybode have any experience clustering a tapestry app??

Thanks
Marcos



-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]


  


-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: BaseComponent begin render

2007-03-26 Thread Steve Shucker

Yes, it'll work just fine - with one caveat.

pageBeginRender/pageEndRender are called for all (rendered?) components 
on your page.  If you're using Block/RenderBlock to render a component 
from another page, that component won't have its 
pageBeginRender/pageEndRender methods called.  Unless you're using that 
weird hack, just implement the interfaces and you're good to go.


-Steve

wong wayne wrote:

Dear all

Is BaseComponent have something similar BasePage
PageBeginRenderListener? Since I have a BaseComponent
and wish to set some properties when rendering. Please
comment, thanks.

regards

wayne


 


Don't pick lemons.
See all the new 2007 cars at Yahoo! Autos.
http://autos.yahoo.com/new_cars.html 


-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

  


-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: Wrapping dojo components for tapestry

2007-03-19 Thread Steve Shucker

Thanks, I found some useful examples there.

-Steve

Yiannis Mavroukakis wrote:

I think lombok.demon.co.uk has what you need :)


On Mon, 2007-03-19 at 09:01 -0700, Steve Shucker wrote:
  
Creating the plain-vanilla web page and slowly moving it into the 
tapestry world is how I eventually figured things out.  I was really 
just hoping someone could point me to a good howto on using dojo with 
programmatically created widgets (vs. parseWidgets).  I'll try to look 
more at the tapestry core sources than the tacos sources.  Reading the 
dojo docs end-to-end instead of skimming would probably help me too.


-Steve

Jesse Kuhnert wrote:


Yeah, I don't know why the dojo documentation has parseWidgets = true
for everything. No one actually uses that setting for high profile web
sites. Then again, I've had many heated "disagreements" with some of
them so it's not surprising..(though there are equally good devs for
the minor annoyances run across here and there mainly the same
people responsible for TabContainer / Floating windows / etc...ie
anything that sucks )

Right...The destroyWidget property is managed so that unnecessary
destruction doesn't happen (or in situations where it can't happen) .
The easiest examples are those dojo widgets already wrapped in
Tapestry:

http://svn.apache.org/viewvc/tapestry/tapestry4/trunk/tapestry-framework/src/java/org/apache/tapestry/dojo/ 



I'm not as sure about the ContentPane and other things you are running
into. I wouldn't recommend using them personally as I think some
simple css rules can do the same thing without all the bloat. Of
course this doesn't help you in your current situation. If I were
having widget issues I might create a plain vanilla html page and
include dojo manually on it (ie no tapestry ) and do whatever I had to
do to understand how it works there first before moving it to java
managed code.

On 3/15/07, Steve Shucker <[EMAIL PROTECTED]> wrote:
  

Can someone point me to a good primer for wrapping dojo components to be
used with tapestry 4.1.  Yesterday I went through a lot of grief before
I realized that tapestry was setting parseWidgets=false.  Eventually I
concluded that:

1) Tapestry doesn't want dojo to automatically inspect the tree and turn
things into widgets
2) If we shouldn't be parsing the whole page, calling that same dojo
code to initialize a large fragment of the page probably isn't the
recommended solution either.
3) Therefore the preferred way of doing things is to render normal divs
and use initialization javascripts to widgetize them
4) Dojo's examples all assume parseWidgets=true and their documentation
on doing this programmatically sucks.

I was working on an accordion control with an additional parameter to
set the initial pane, so I got some inspiration from the tacos sources.
It seemed like this shouldn't involve nearly as much script as I saw
there.  The tacos 4.1 snapshot sources bothered me because ContentPane's
init script had a specific check to see if it was in a tab container -
that struck me as an improper interdependency.

-Steve

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



  

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



This e-mail has been scanned for all known viruses.



Note:__
This message is for the named person's use only. It may contain
confidential, proprietary or legally privileged information. No
confidentiality or privilege is waived or lost by any mistransmission.
If you receive this message in error, please immediately delete it and
all copies of it from your system, destroy any hard copies of it and
notify the sender. You must not, directly or indirectly, use, disclose,
distribute, print, or copy any part of this message if you are not the
intended recipient. Jaguar Freight Services and any of its subsidiaries
each reserve the right to monitor all e-mail communications through its
networks.
Any views expressed in this message are those of the individual sender,
except where the message states otherwise and the sender is authorized
to state them to be the views of any such entity.

This e-mail has been scanned for all known viruses.

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

  


-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: Wrapping dojo components for tapestry

2007-03-19 Thread Steve Shucker
Creating the plain-vanilla web page and slowly moving it into the 
tapestry world is how I eventually figured things out.  I was really 
just hoping someone could point me to a good howto on using dojo with 
programmatically created widgets (vs. parseWidgets).  I'll try to look 
more at the tapestry core sources than the tacos sources.  Reading the 
dojo docs end-to-end instead of skimming would probably help me too.


-Steve

Jesse Kuhnert wrote:

Yeah, I don't know why the dojo documentation has parseWidgets = true
for everything. No one actually uses that setting for high profile web
sites. Then again, I've had many heated "disagreements" with some of
them so it's not surprising..(though there are equally good devs for
the minor annoyances run across here and there mainly the same
people responsible for TabContainer / Floating windows / etc...ie
anything that sucks )

Right...The destroyWidget property is managed so that unnecessary
destruction doesn't happen (or in situations where it can't happen) .
The easiest examples are those dojo widgets already wrapped in
Tapestry:

http://svn.apache.org/viewvc/tapestry/tapestry4/trunk/tapestry-framework/src/java/org/apache/tapestry/dojo/ 



I'm not as sure about the ContentPane and other things you are running
into. I wouldn't recommend using them personally as I think some
simple css rules can do the same thing without all the bloat. Of
course this doesn't help you in your current situation. If I were
having widget issues I might create a plain vanilla html page and
include dojo manually on it (ie no tapestry ) and do whatever I had to
do to understand how it works there first before moving it to java
managed code.

On 3/15/07, Steve Shucker <[EMAIL PROTECTED]> wrote:

Can someone point me to a good primer for wrapping dojo components to be
used with tapestry 4.1.  Yesterday I went through a lot of grief before
I realized that tapestry was setting parseWidgets=false.  Eventually I
concluded that:

1) Tapestry doesn't want dojo to automatically inspect the tree and turn
things into widgets
2) If we shouldn't be parsing the whole page, calling that same dojo
code to initialize a large fragment of the page probably isn't the
recommended solution either.
3) Therefore the preferred way of doing things is to render normal divs
and use initialization javascripts to widgetize them
4) Dojo's examples all assume parseWidgets=true and their documentation
on doing this programmatically sucks.

I was working on an accordion control with an additional parameter to
set the initial pane, so I got some inspiration from the tacos sources.
It seemed like this shouldn't involve nearly as much script as I saw
there.  The tacos 4.1 snapshot sources bothered me because ContentPane's
init script had a specific check to see if it was in a tab container -
that struck me as an improper interdependency.

-Steve

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]







-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: Dynamic components with template (? extends BaseComponent)

2007-03-19 Thread Steve Shucker
If you've got the components you want somewhere else on a template, you 
can always use Block/RenderBlock.  That involves setting up @Block areas 
for each possible content and putting a @RenderBlock in the target 
area.  Then you just need a method to wire up the RenderBlock's "block" 
attribute.  Your target blocks can even be on another page.


I think the version of DynamicBlock you're pointing to is for tap3.  
I've got a bookmark to the t4 version, but the download links appear 
broken.  I'm not sure the author supports it any more.  I'm using it on 
tapestry 4.1.1 (with unrelated hacks to its source).

http://www.behindthesite.com/blog/C1931765677/E20060309215538/index.html

-Steve


Portuendo Vestado wrote:

Darn you're right, I've never even thought of that. finishLoad(), which I'm
overriding to add the new implicit component, is called only once before the
page gets cached. So basically, my dynamic component is only dynamic the
first time template loads.

The reason I chose this method is that if you do it (that is, attach a
component via addComponent()) at render time, say in pageBeginRender(), it
hits AbstractComponent.checkActiveLock() sentinel and throws a "Component
Home is active and its configuration state may not be changed", which is
quite reasonable.

I guess I'm still on the lookout for an option to delegate rendering to a
component with a template. There must be a way of instantiating those just
as simple as pages (i.e. with IRequestCycle.getPage(...)).

Btw, DynamicBlock you mentioned, is this it:
http://www.behindthesite.com/blog/C1931765677/E1630021481/? Does it work for
4.1 - seems a little old, September 2, 2004.


Thanks,
-P

--

I don't know enough about tapestry internals to say if this is a good 
idea, but I've played around with DynamicBlock and your solution looks a 
lot simpler.  At a guess, it looks like your approach is setting up your 
dynamic component when tapestry is loading the page template.  If it's 
part of tapestry template cache, that means it would only pick the 
dynamic content the first time the page is loaded and reuse the same 
component on every subsequent call to the page - unless you're running 
in dev mode with page caching disabled.  But as I said, that's a guess.


If I'm wrong, I want to know how well does it handle things like 
RenderBody and passing parameters to your component?  If it handles 
those concerns well, I'm tempted to wrap it up into a generic 
DynamicComponent.


If I'm right, it probably jives with Howard's vision of static 
structure/dynamic behavior, but may not function in the way you intended.


-Steve






___ 
Yahoo! Mail - Sempre a melhor opção para você! 
Experimente já e veja as novidades. 
http://br.yahoo.com/mailbeta/tudonovo/


-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]


  


-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: Dynamic components with template (? extends BaseComponent)

2007-03-16 Thread Steve Shucker
I don't know enough about tapestry internals to say if this is a good 
idea, but I've played around with DynamicBlock and your solution looks a 
lot simpler.  At a guess, it looks like your approach is setting up your 
dynamic component when tapestry is loading the page template.  If it's 
part of tapestry template cache, that means it would only pick the 
dynamic content the first time the page is loaded and reuse the same 
component on every subsequent call to the page - unless you're running 
in dev mode with page caching disabled.  But as I said, that's a guess.


If I'm wrong, I want to know how well does it handle things like 
RenderBody and passing parameters to your component?  If it handles 
those concerns well, I'm tempted to wrap it up into a generic 
DynamicComponent.


If I'm right, it probably jives with Howard's vision of static 
structure/dynamic behavior, but may not function in the way you intended.


-Steve

Portuendo Vestado wrote:

Hi all,

I'm trying to find a way to have the Delegator component use some other
component with a template (chosen at runtime) to render output, and the
closest I found was using PageLoader's createImplicitComponent() function.
Is this correct for my intent? Are there more proper means of achieving the
same effect?

Technically I'm not trying to attach an implicit component to the page
dynamically - I simply want to be able to instantiate a regular component
with a template, and delegate rendering to it (or to one of several regular
components, chosen at runtime based on some criteria). 


Here's the code:

Home.java
[...]
@InjectObject("service:tapestry.page.PageLoader")
public abstract IPageLoader getPageLoader();

public IRender getDynamicComponent() {
return getComponent("whatever");
}

public void finishLoad(IRequestCycle cycle, IPageLoader loader,
IComponentSpecification specification) {
super.finishLoad(cycle, loader, specification);

IComponent iComponent =
getPageLoader().createImplicitComponent(getRequestCycle(), this, "whatever",
"layout/Test", getLocation());
this.addComponent(iComponent);
}
[...]


Home.html
[...]

[...]

This does delegate and produces output of whatever's in "layout/Test"
component's template.

Is there any downside to this approach (seems kinda hacky)? Or would a more
proper way be to actually implement my own IRender which reads from a
template somehow?


Thanks,
-p



___ 
Yahoo! Mail - Sempre a melhor opção para você! 
Experimente já e veja as novidades. 
http://br.yahoo.com/mailbeta/tudonovo/
 



-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]


  


-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Wrapping dojo components for tapestry

2007-03-15 Thread Steve Shucker
Can someone point me to a good primer for wrapping dojo components to be 
used with tapestry 4.1.  Yesterday I went through a lot of grief before 
I realized that tapestry was setting parseWidgets=false.  Eventually I 
concluded that:


1) Tapestry doesn't want dojo to automatically inspect the tree and turn 
things into widgets
2) If we shouldn't be parsing the whole page, calling that same dojo 
code to initialize a large fragment of the page probably isn't the 
recommended solution either.
3) Therefore the preferred way of doing things is to render normal divs 
and use initialization javascripts to widgetize them
4) Dojo's examples all assume parseWidgets=true and their documentation 
on doing this programmatically sucks.


I was working on an accordion control with an additional parameter to 
set the initial pane, so I got some inspiration from the tacos sources.  
It seemed like this shouldn't involve nearly as much script as I saw 
there.  The tacos 4.1 snapshot sources bothered me because ContentPane's 
init script had a specific check to see if it was in a tab container - 
that struck me as an improper interdependency.


-Steve

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: public abstract Boolean isQuery()

2007-03-13 Thread Steve Shucker

big-B Boolean uses get/set
little-b boolean uses is/set

you need one of
public abstract Boolean getQuery()
public abstract Boolean getIsQuery()
public abstract boolean isQuery()

-Steve

Murray Collingwood wrote:

Hi all

Just trying to clarify my understanding.  I had some code that looked like the
following:

@Persist
public abstract Boolean isQuery();

The above code gives me an error, 'no implementation in class', and it took me a
while but I finally figured the problem that the enhanced class was not
identifying the Boolean.  It took a while longer for me to realise it was
because I didn't have a valid 'getter'.  I had to change the above to:

@Persist
public abstract Boolean getQuery();

Suddenly everything started working!  


So, why doesn't the enhanced class identify these boolean style function names.
 I thought this was some standard that ALL property functions were fetched using
get* and ALL boolean values fetched using is*.

Question:

1. Should I code all of my booleans using get* in future?

2. How does OGNL now deal with a boolean value returned via a get*?  Do I need
to modify my OGNL conditions?

Cheers
mc



-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

  


-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: plugins for a tapestry app?

2007-03-02 Thread Steve Shucker

anonymous/anon

Dan Adams wrote:

Is there an anonymous login for this?

On Fri, 2007-03-02 at 09:41 -0500, James Carman wrote:
  

There's a HiveMind module for that, actually.  Check out:

http://svn.javaforge.com/svn/hivemind/hivemind-hibernate3/trunk/src/main/resources/META-INF/hivemodule.xml

That's my hivemodule.xml file and it basically just sets up a
configuration point that allows any HiveMind module to contribute to
the Hibernate configuration.  It works great in our application,
allowing us to just drop in new parts of the "domain" model and they
just get added into the mix automatically.


On 3/2/07, Dan Adams <[EMAIL PROTECTED]> wrote:


hmm. specifically for hibernate, how do you have it contribute new
entities?

On Thu, 2007-03-01 at 23:49 -0500, James Carman wrote:
  

Since HiveMind is already integrated with T4, I'd say use it.  It has
the ability to dynamically discover new modules like you're wanting.
I came up with a similar architecture to allow multiple modules to
contribute to my Hibernate configuration dynamically.  All you had to
do is drop in the jar, and the entities were automatically picked up
by the hibernate configuration.

On 3/1/07, Dan Adams <[EMAIL PROTECTED]> wrote:


So I have a T4 app and I'm trying to get a sense for how hard it would
be to allow the user of plugins. What I mean is that I would like to be
able to write a plugin, put the jar in the WEB-INF/lib, and then have my
application load it. The plugins could be either interface contributions
or strictly something behind the scenes. Does anyone have any experience
with doing something like this? Would hivemind be the best bet or is
something like Java Plugin Framework better? I'm looking for any and all
thoughts/suggestions. Thanks.

- dan


-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]


  

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



--
Dan Adams
Senior Software Engineer
Interactive Factory
617.235.5857


-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]


  

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]




-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: plugins for a tapestry app?

2007-03-02 Thread Steve Shucker
Could one of the gurus please post some example hivemind config showing 
how I can include a hivemodule.xml with my component library project so 
that the library automagically registers itself with whatever 
application is running?  I've thought for a while that the *.application 
file was something of a leftover and I'd rather do as much of my config 
as possible in hivemind instead.


-Steve

Dan Adams wrote:

hmm. specifically for hibernate, how do you have it contribute new
entities?

On Thu, 2007-03-01 at 23:49 -0500, James Carman wrote:
  

Since HiveMind is already integrated with T4, I'd say use it.  It has
the ability to dynamically discover new modules like you're wanting.
I came up with a similar architecture to allow multiple modules to
contribute to my Hibernate configuration dynamically.  All you had to
do is drop in the jar, and the entities were automatically picked up
by the hibernate configuration.

On 3/1/07, Dan Adams <[EMAIL PROTECTED]> wrote:


So I have a T4 app and I'm trying to get a sense for how hard it would
be to allow the user of plugins. What I mean is that I would like to be
able to write a plugin, put the jar in the WEB-INF/lib, and then have my
application load it. The plugins could be either interface contributions
or strictly something behind the scenes. Does anyone have any experience
with doing something like this? Would hivemind be the best bet or is
something like Java Plugin Framework better? I'm looking for any and all
thoughts/suggestions. Thanks.

- dan


-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]


  

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]




-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: Tapestry 4 dynamically changing the template

2007-03-02 Thread Steve Shucker

You've got two separate problems here:
1) choosing which component to render at runtime without a fixed list of 
possibilities

2) pulling the template from the database

The first problem is addressed by Michael Henderson's DynamicBlock:
http://www.behindthesite.com/blog/C1931765677/E1630021481/
http://www.behindthesite.com/blog/C1931765677/E20060309215538/index.html

I posted something on the second problem a while ago:

http://www.mail-archive.com/users@tapestry.apache.org/msg06927.html

You should be aware that (as far as I know) tapestry cannot remove 
individual pages from its page cache so you can't modify a template and 
see the changes immediately unless you either have page caching turned 
off or you use the reset service to wipe the whole cache.  Neither of 
those are acceptable for a production environment.  The solution I came 
up with versions the templates and calls them by ID.  I have another 
class lying around that keeps track of the most recent component ID for 
a given name.


The really fun stuff was integrating this with the DynamicBlock 
component and our user preference system to produce a component that 
took a user attribute name, looked up that attribute for the current 
user and displayed the correct component.


-Steve

Moore, Andrew wrote:

Hi,
I'm planning on writing a content management system in Tapestry.
The plan is that the users should be able to write and design their own html
pages, and then with a simple tapestry reference (with all the properties
set in a page specification) get all the dynamic content entered into their
html pages.

If there was only one template that everybody used this would be simple, but
as I want each user to be able to design their own template, I'm not sure if
this is possible.

As far as I am aware (and I'm a complete newbie to Tapestry) as the .html
files live inside the WEB-INF directory with the .page files there probably
isn't an easy way to do this.

Is there any way at run time of dynamically choosing the template (.html)
file that is used to generate the page?  - pulling a template name from a
database?

Cheers
Andrew



**

Across the UK, mobile phone chargers left plugged in waste over £60 million and 
are responsible for a quarter of a million tonnes of CO2 every year.

Source:  Energy Saving Trust (2007)

**

This e-mail is provided for general information purposes only and does not 
constitute investment or transactional advice. For  the avoidance of doubt the 
contents of this email are subject to contract and will not constitute a 
legally binding contract.

The information contained in this e-mail is confidential and intended only for 
the use of the addressee. If the reader of this message is not the addressee, 
you are hereby notified that you have received this e-mail in error and you 
must not copy, disseminate, distribute, use or take any action as a result of 
the information contained in it.

If you have received this e-mail in error, please notify [EMAIL PROTECTED] (UK 01384 275454) and delete it immediately from your system.

Neither Npower nor any of the other companies in the RWE Npower group from whom this e-mail originates accept any responsibility for losses or damage as a result of any viruses and it is your responsibility to check attachments (if any) for viruses.

RWE Npower plc. Registered Office: Windmill Hill Business Park, Whitehill Way, 
Swindon SN5 6PB. Registered in England and Wales: number 3892782. This e-mail 
may be sent on behalf of a member of the RWE Npower group of companies.

**


-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]


  


-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: HiveMind problem while deploying on WebLogic

2007-01-25 Thread Steve Shucker
Good point about xml parsers.  I've had problems with weblogic8.1 
(jdk1.4.2) and xml parsing.  This wasn't with tapestry, but my problems 
were solved by putting xalan2.6.0, xercesImpl2.6.2 and xml-apis in the 
jre/endorsed folder of the JVM weblogic was using.


-Steve

Howard Lewis Ship wrote:

Possible things to check:

Conflicting copies of hivemind-framework.jar

Difference in JDKs or available XML parsers.

On 1/25/07, Rodrigo Barberá <[EMAIL PROTECTED]> wrote:

Hello everyone

My application was developed using Tapestry 4.0.2.  It works perfectly
when deploying to Jetty, Tomcat and our local WebLogic server.  When
trying to have it deployed to our client's WebLogic cluster, which runs
our application only, the following exception is being thrown when the
servlet is trying to start:

org.apache.hivemind.ApplicationRuntimeException: Error: null
at
org.apache.hivemind.impl.StrictErrorHandler.error(StrictErrorHandler.java:39) 


at
org.apache.hivemind.impl.XmlModuleDescriptorProvider.processResource(XmlModuleDescriptorProvider.java:182) 


at
org.apache.hivemind.impl.XmlModuleDescriptorProvider.getModuleDescriptors(XmlModuleDescriptorProvider.java:158) 


at
org.apache.hivemind.impl.RegistryBuilder.processModuleDescriptorProvider(RegistryBuilder.java:161) 


at
org.apache.hivemind.impl.RegistryBuilder.constructRegistry(RegistryBuilder.java:143) 


at
org.apache.tapestry.ApplicationServlet.constructRegistry(ApplicationServlet.java:253) 


at
org.apache.tapestry.ApplicationServlet.init(ApplicationServlet.java:194)
at infopae.web.InfopaeServlet.init(InfopaeServlet.java:61)
at
weblogic.servlet.internal.StubSecurityHelper$ServletInitAction.run(StubSecurityHelper.java:276) 


at
weblogic.security.acl.internal.AuthenticatedSubject.doAs(AuthenticatedSubject.java:321) 


at
weblogic.security.service.SecurityManager.runAs(SecurityManager.java:121) 


at
weblogic.servlet.internal.StubSecurityHelper.createServlet(StubSecurityHelper.java:68) 


at
weblogic.servlet.internal.StubLifecycleHelper.createOneInstance(StubLifecycleHelper.java:58) 


at
weblogic.servlet.internal.StubLifecycleHelper.(StubLifecycleHelper.java:48) 


at
weblogic.servlet.internal.ServletStubImpl.prepareServlet(ServletStubImpl.java:504) 


at
weblogic.servlet.internal.WebAppServletContext.preloadServlet(WebAppServletContext.java:1698) 


at
weblogic.servlet.internal.WebAppServletContext.loadServletsOnStartup(WebAppServletContext.java:1675) 


at
weblogic.servlet.internal.WebAppServletContext.preloadResources(WebAppServletContext.java:1595) 


at
weblogic.servlet.internal.WebAppServletContext.start(WebAppServletContext.java:2734) 


at
weblogic.servlet.internal.WebAppModule.startContexts(WebAppModule.java:892) 

at 
weblogic.servlet.internal.WebAppModule.start(WebAppModule.java:336)

at
weblogic.application.internal.flow.ModuleStateDriver$3.next(ModuleStateDriver.java:204) 


at
weblogic.application.utils.StateMachineDriver.nextState(StateMachineDriver.java:26) 


at
weblogic.application.internal.flow.ModuleStateDriver.start(ModuleStateDriver.java:60) 


at
weblogic.application.internal.flow.ScopedModuleDriver.start(ScopedModuleDriver.java:200) 


at
weblogic.application.internal.flow.ModuleListenerInvoker.start(ModuleListenerInvoker.java:117) 


at
weblogic.application.internal.flow.ModuleStateDriver$3.next(ModuleStateDriver.java:204) 


at
weblogic.application.utils.StateMachineDriver.nextState(StateMachineDriver.java:26) 


at
weblogic.application.internal.flow.ModuleStateDriver.start(ModuleStateDriver.java:60) 


at
weblogic.application.internal.flow.StartModulesFlow.activate(StartModulesFlow.java:26) 


at
weblogic.application.internal.BaseDeployment$2.next(BaseDeployment.java:641) 


at
weblogic.application.utils.StateMachineDriver.nextState(StateMachineDriver.java:26) 


at
weblogic.application.internal.BaseDeployment.activate(BaseDeployment.java:229) 


at
weblogic.application.internal.DeploymentStateChecker.activate(DeploymentStateChecker.java:154) 


at
weblogic.deploy.internal.targetserver.AppContainerInvoker.activate(AppContainerInvoker.java:80) 


at
weblogic.deploy.internal.targetserver.operations.AbstractOperation.activate(AbstractOperation.java:565) 


at
weblogic.deploy.internal.targetserver.operations.ActivateOperation.activateDeployment(ActivateOperation.java:136) 


at
weblogic.deploy.internal.targetserver.operations.ActivateOperation.doCommit(ActivateOperation.java:104) 


at
weblogic.deploy.internal.targetserver.operations.StartOperation.doCommit(StartOperation.java:128) 


at
weblogic.deploy.internal.targetserver.operations.AbstractOperation.commit(AbstractOperation.java:320) 


at
weblogic.deploy.internal.targetserver.DeploymentManager.handleDeploymentCommit(DeploymentManager.java:815) 


at
weblogic.deploy.internal.targetserver.DeploymentManager.activateDep

Re: Friendly URL's and service encoders

2007-01-22 Thread Steve Shucker
I'm not sure if it's legal to map the "html" extension to two different 
encoders.  Try using a different extension for the external pages.


-Steve

Peter Stavrinides wrote:

Does anyone have any ideas?

Peter Stavrinides wrote:

Hi everyone

I am having some trouble with friendly URL's.  Getting them to work 
is not the problem, but getting two page service encoders to work 
together seems unlikely. Maybe there is a better way to do this... I 
don't know. I basically want an encoder that will generate friendly 
URL's for html pages that use either the external or page services 
(PageLink of ExternalLink components).


This is what my encoders look like, both work ok but when used in 
tandem, they fight.



   service="external"/>

   


Any ideas?

Peter







-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: Tacos:Tree - Node opens after submit only

2007-01-17 Thread Steve Shucker

Are you using the tree in a form?  If so, it's bugged.
http://tacoscomponents.jot.com/BugReporter/Bug32

I posted a workaround a while ago, but it assumes that you don't have 
any form controls in your tree nodes.

http://mail-archives.apache.org/mod_mbox/tapestry-users/200606.mbox/[EMAIL 
PROTECTED]

If you're not in a form, ignore me.

-Steve


Manuel Thurn wrote:

Hello everybody,

I tried to implement a tree using the sources of the Tacos demo (I use Tacos
4.0.0 with Tapestry 4.0.2) as a guide but the nodes won't open in Ajax style
(without page reload). When I click on a node the font gets bold and the
plus sign switches to minus but the node shows its content only after a
submit.

HTML snippet:







Excerpt of my page specification: 


   
  
  
  

  

   
   
   

  
  
   

   
   
   
   
   
 
   
   
   
   
   
   
   

I would be very thankfully for any advice.

Greetings,
Manuel




-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

  


-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



hibernate session-per-request and re-enlistment

2007-01-10 Thread Steve Shucker
I'm revisiting a solution to hibernate entity re-enlistment with a 
session-per-request model.  Back in November, I saw a post from James 
that he was working on a new solution for tapernate.  Is there any 
progress on this that can be shared (either code or notions)?  I'd be 
curious if anyone else has come up with a really robust strategy.


-Steve

The lazy loading problem can't really be solved in a generalized way.
But, Tapernate does a lot of work for you.  I wouldn't suggest using
the property persistence strategies from Tapernate right now.  I'm
working on a new version that will hopefully be more robust.  The main
problem that I face is knowing exactly *how* to reattach the detached
object to the session when a request comes in.  There are a few
different scenarios and the problem is knowing which one you're in!
Also, if you use merge or update, then your object's state will be
persisted at the end of the request (assuming that you leave
transaction-per-request on).  What if you don't really want the state
persisted during that request (you're in the middle of a "wizard"
perhaps)?  I think the way to go is to use the
session-per-conversation pattern, but I'm trying to come up with a
good way to specify conversation boundaries.  Also, should we support
more than one conversation at a time (what if the user clicks to go to
another part of your webapp from within your wizard)?  If so, how do
the potentially orphaned conversations get cleaned up?This is what
causes me to loose sleep at night (yes, I need a life). :-)

  


-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: How to move tapestry project to the web root

2006-12-29 Thread Steve Shucker
When I install tomcat, I usually remove or rename webapps/ROOT to 
something else.  If I want to deploy an app to the root context, I just 
name the war file ROOT.war and let tomcat autodeploy it.  For maven's 
tomcat plugin, I provide a context.xml file that specifies the root 
context.  Tomcat's autodeployer doesn't honor that paths in context.xml, 
though.


To get a default page without needing the /app in your URL, add the 
following to your web.xml


 
 app
 

You can put either your application path (app) or a friendly url to a 
page (Home.page if you've got a  for *.page)


-Steve

Mahmut Izci wrote:

Huang Gehua schrieb:
Always our project is run under the path with a context path ,For 
example:

http://someHost:8080/prjectName/app

If i want use url like this [http://someHost:8080/app] to visit my app
,How to do?
Tomcat always defines a default context named "ROOT" under webapps 
folder. Normally you can find the tomcat documentation in it.

You can override this default context.




i have try to build a Virtual host in my tomcat like this
 

  
  
i can visit my app use ugly url like this
http://someHost:8080/app?service=page&page=somePage
But i cant visit page use friendly url
How to resolve the problem???

Did you try "http://someHost:8080/somePage.html"; ?


-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]






-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



specless pages in libraries

2006-12-29 Thread Steve Shucker
I'm writing specless pages/components in my current projects, but I 
can't get specless pages working in libraries.  My pages work fine if I 
just create an empty spec and specless components work flawlessly.  I've 
looked at the PageSpecificationResolverImpl and 
ComponentSpecificationResolverImpl and it looks like only the component 
resolver will attempt to resolve things that aren't in the application 
namespace by classname (ComponentSpecificationResolverImpl:215)  The 
PageSpecificationResolverImpl only calls setupImplicitPage() in the 
application namespace lookup code.


Is this intentional, an oversight, or am I misreading the source code?  
I know I can write an ISpecificationResolverDelegate to change this 
behavior, but it struck me as something that should happen by default.


-Steve

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: getting .page and .html from a database

2006-12-11 Thread Steve Shucker
There's some info about that at 
http://tapestry.apache.org/tapestry4.1/usersguide/configuration.html.  
It's a config property called org.apache.tapestry.enable-reset-service.  
It'll enable a special URL to flush your cache.  However, it only 
flushes the whole thing at once, so it's not something I'd be calling 
regularly from a production app.  If you did, you'd probably start 
getting PermGen errors.  That's a side benefit of the versioned 
templates approach I used - saving a new version means a new URL and a 
new entry in the page cache.  No flushing required.


-Steve

Benjamin S wrote:

I love you Steve.  This is a much  more solid approach to what I have
been doing (templates stored in a filesystem, then the path saved in
the db, didn't know you could get a hivemind resource from a string.)

Sorry, I am about to thread jack this, but how do you handle page
cache clearing?  Is there a programatic way of telling tapestry to
discard a page when you update the template?  If it is in the docs
please reply rtfm, with a link to the page :)



On 12/11/06, Tapestry User List <[EMAIL PROTECTED]> wrote:

Thank you Steve. That is exactly what I were looking for.

D.

2006/12/2, Steve Shucker <[EMAIL PROTECTED]>:
>
> I've got this working for pages and components, but it's probably a 
bit

> different than what you want.  I have a template table in my database
> and I'm looking up content by a numeric PK rather than a name 
because I

> have a requirement to let users version some templates.  I'm also
> leaving out my db access because it's somewhat domain-specific.  This
> assumes that all pages/components are specless and lets you specify a
> backing class to associate with each template.  You should be able 
hack

> the page/jwc lookups using this as a model, though.
>
> Credit goes to the tapestry wiki for how to write a delegate and
> DynamicBlock for the trick with URL handlers to turn a string into a
> hivemind resource.
>
> -Steve
>
> @Entity
> @Table(name = "tapestry_components")
> @SequenceGenerator(name = "SEQ", sequenceName = 
"tapestry_components_SEQ")

> public class TapestryComponent {
> private Integer id;
> private String name;
> private String template;
> private Date creationDate = new Date();
> private String backingClass;
>
> @Column(name="backingClass")
> public String getBackingClass() {
> return backingClass;
> }
>
> public void setBackingClass(String backingClass) {
> this.backingClass = backingClass;
> }
>
> public TapestryComponent() {}
>
> public TapestryComponent(String name) {
> setName(name);
> }
>
> @Id
> @Column(name = "id")
> @GeneratedValue(strategy = GenerationType.SEQUENCE, generator = 
"SEQ")

> public Integer getId() {
> return id;
> }
>
> @Column(name = "name")
> public String getName() {
> return name;
> }
>
> public void setId(Integer id) {
> this.id = id;
> }
>
> public void setName(String name) {
> this.name = name;
> }
>
> @Lob
> @Column(name="template")
> public String getTemplate() {
> return template;
> }
>
> public void setTemplate(String template) {
> this.template = template;
> }
>
> @Column(name="creation_date")
> public Date getCreationDate() {
> return creationDate;
> }
>
> public void setCreationDate(Date creationDate) {
> this.creationDate = creationDate;
> }
> }
>
> public class DatabasePageResolver implements
> ISpecificationResolverDelegate {
>
> public DatabasePageResolver() {}
>
> public IComponentSpecification
> findComponentSpecification(IRequestCycle cycle,
> INamespace namespace, String name) {
> return findSpecification(cycle, namespace, name, false);
> }
>
> public IComponentSpecification findPageSpecification(IRequestCycle
> cycle, INamespace namespace, String name) {
> return findSpecification(cycle, namespace, name, true);
> }
>
> private IComponentSpecification findSpecification(IRequestCycle
> cycle, INamespace namespace, String name, boolean isPage) {
> try {
> Integer.valueOf(name);
> } catch (NumberFormatException e) {
> return null; // not a valid format
> }
> DatabasePageResource resource = new DatabasePageResource(name,
> cycle.getEngine().getLocale());
> if (!resource.exists()) {
> ret

Re: getting .page and .html from a database

2006-12-02 Thread Steve Shucker
I've got this working for pages and components, but it's probably a bit 
different than what you want.  I have a template table in my database 
and I'm looking up content by a numeric PK rather than a name because I 
have a requirement to let users version some templates.  I'm also 
leaving out my db access because it's somewhat domain-specific.  This 
assumes that all pages/components are specless and lets you specify a 
backing class to associate with each template.  You should be able hack 
the page/jwc lookups using this as a model, though.


Credit goes to the tapestry wiki for how to write a delegate and 
DynamicBlock for the trick with URL handlers to turn a string into a 
hivemind resource.


-Steve

@Entity
@Table(name = "tapestry_components")
@SequenceGenerator(name = "SEQ", sequenceName = "tapestry_components_SEQ")
public class TapestryComponent {
   private Integer id;
   private String name;
   private String template;
   private Date creationDate = new Date();
   private String backingClass;

   @Column(name="backingClass")
   public String getBackingClass() {
   return backingClass;
   }

   public void setBackingClass(String backingClass) {
   this.backingClass = backingClass;
   }

   public TapestryComponent() {}

   public TapestryComponent(String name) {
   setName(name);
   }

   @Id
   @Column(name = "id")
   @GeneratedValue(strategy = GenerationType.SEQUENCE, generator = "SEQ")
   public Integer getId() {
   return id;
   }

   @Column(name = "name")
   public String getName() {
   return name;
   }

   public void setId(Integer id) {
   this.id = id;
   }

   public void setName(String name) {
   this.name = name;
   }

   @Lob
   @Column(name="template")
   public String getTemplate() {
   return template;
   }

   public void setTemplate(String template) {
   this.template = template;
   }

   @Column(name="creation_date")
   public Date getCreationDate() {
   return creationDate;
   }

   public void setCreationDate(Date creationDate) {
   this.creationDate = creationDate;
   }
}

public class DatabasePageResolver implements 
ISpecificationResolverDelegate {


   public DatabasePageResolver() {}

   public IComponentSpecification 
findComponentSpecification(IRequestCycle cycle,

   INamespace namespace, String name) {
   return findSpecification(cycle, namespace, name, false);
   }

   public IComponentSpecification findPageSpecification(IRequestCycle 
cycle, INamespace namespace, String name) {

   return findSpecification(cycle, namespace, name, true);
   }
  
   private IComponentSpecification findSpecification(IRequestCycle 
cycle, INamespace namespace, String name, boolean isPage) {

   try {
   Integer.valueOf(name);
   } catch (NumberFormatException e) {
   return null; // not a valid format
   }
   DatabasePageResource resource = new DatabasePageResource(name, 
cycle.getEngine().getLocale());

   if (!resource.exists()) {
   return null;
   }
   Resource specResource = resource.getRelativeResource(name + 
(isPage ? ".page" : ".jwc"));
   IComponentSpecification specification = new 
ComponentSpecification();

   specification.setPageSpecification(isPage);
   specification.setSpecificationLocation(specResource);
   specification.setLocation(new LocationImpl(resource));
   if (resource.getBackingClass() != null) {
   specification.setComponentClassName(resource.getBackingClass());
   }
   return specification;
   }

}

public class DatabasePageResource implements Resource {

   private Locale locale;
   private String componentName;
   private TapestryComponent component;

   public DatabasePageResource(String componentName, Locale locale) {
   this.componentName = componentName;
   this.locale = locale;
   load();
   }
  
   public String getBackingClass() {

   return component.getBackingClass();
   }

   private void load() {
   try {
   Integer componentId = Integer.valueOf(componentName);
   component = // code omitted - use your own infrastructure to 
read TapestryComponent object from the database here

   } catch (NumberFormatException e) {
   throw new IllegalArgumentException(componentName + " is 
non-numeric and therefore not a valid component ID");

   }
   }
   public Locale getLocale() {
   return locale;
   }

   public Resource getLocalization(Locale arg0) {
   return this;
   }

   public String getName() {
   return componentName;
   }

   public String getPath() {
   return componentName;
   }

   public Resource getRelativeResource(String resourceName) {
   return new DatabasePageResource(componentName, locale);
   }
  
   public boolean exists() {

   return component != null;
   }

   public URL getResourceURL() {
   try {
   return new URL(null, "database:///" + componentName, new 
DatabaseURLStreamHandler(component.getTempl

Re: Tapestry-Hibernate

2006-11-06 Thread Steve Shucker
I've used AspectJ to do this.  It works, but it's not the most efficient 
solution out there.  We have all our entities implement an interface 
"Persistent", so the pointcut looks like:


   pointcut persistentUse(Persistent persistent):
   call(java.util.Set+ Persistent+.get*()) && target(persistent) // 
call to persistent setter

   && within(com.vms..*) // in our code
   && !cflow(call(Persistent+.new(..)) && within(com.vms..*)); // 
ignore our constructors


   Object around(Persistent persistent) :persistentUse(persistent){
   persistent.associateWithCurrentSession();
   Set result = (Set)proceed(persistent);
   for (Iterator iter = result.iterator(); iter.hasNext();) {
   Persistent collectionElement = (Persistent) iter.next();
   if (collectionElement != null) {
   collectionElement.associateWithCurrentSession();
   }
   }
   return result;
   }

associateWithCurrentSession() is a method on the Persistent interface 
(multiple inheritance with AspectJ!) that detects if we have a current 
session.  If we have one, it does a lock().


Good:
- We don't have to think about this 95% of the time and it just works

Bad:
- It's inefficient to call this on every collection getter
- Every so often, we get bit on the rare case where we call a setter 
method and forget to re-enlist.  We could easily add setters to the 
pointcut, but that gets even more inefficient.

- Not tested on hibernate3 (works on hibernate2)

I'm really looking for a better way to do this and watching to see what 
James comes up with in the next version of tapernate.


-Steve

Daniel Tabuenca wrote:

So do you have some way of locking all objects to the new session on
the subsequent request? Is this automated in some way? My problem with
the session-per-request-with-detached-objects is that there needs to
be some way to easily identify and re-attach the set of objects that
will be used. I've found it easiest to just keep the session and
reconnect it to the database on the new request. The one problem with
this is if you conversation is long your session might grow too big
since things are not cleaned out of the session even if you
application does not hold any additional references. Maybe ideally it
would be to use some form of AOP to automatically lock objects to the
new session on demand. This seems like it'd be awfully useful, though
I'm not sure how feasible it is to implement.

On 11/4/06, Bill Holloway <[EMAIL PROTECTED]> wrote:

For the lazy loading, what about writing a custom servlet filter as
recommended in the hibernate docs, one that handles the session for
you?  Let it sit out there in front of Tapestry and manage the
sessions.  I'm leaning toward
session-per-request-with-detached-objects and letting optimistic
locking handle the concurrency issues.  I'm not so concerned about
that issue.

My real issue is with the lazy-loading.  We'll have objects with some
pretty hefty fields -- text and maybe blob types -- that I REALLY
don't want to have loaded if I don't have to.

Cheers,
Bill

On 11/4/06, James Carman <[EMAIL PROTECTED]> wrote:
> Bill,
>
> The lazy loading problem can't really be solved in a generalized way.
> But, Tapernate does a lot of work for you.  I wouldn't suggest using
> the property persistence strategies from Tapernate right now.  I'm
> working on a new version that will hopefully be more robust.  The main
> problem that I face is knowing exactly *how* to reattach the detached
> object to the session when a request comes in.  There are a few
> different scenarios and the problem is knowing which one you're in!
> Also, if you use merge or update, then your object's state will be
> persisted at the end of the request (assuming that you leave
> transaction-per-request on).  What if you don't really want the state
> persisted during that request (you're in the middle of a "wizard"
> perhaps)?  I think the way to go is to use the
> session-per-conversation pattern, but I'm trying to come up with a
> good way to specify conversation boundaries.  Also, should we support
> more than one conversation at a time (what if the user clicks to go to
> another part of your webapp from within your wizard)?  If so, how do
> the potentially orphaned conversations get cleaned up?This is what
> causes me to loose sleep at night (yes, I need a life). :-)
>
>
>
> On 11/3/06, Bill Holloway <[EMAIL PROTECTED]> wrote:
> > I've seen recently some criticism of Tapestry in terms of using
> > Hibernate.  Problems with lazy loading.  I know Tapernate is out
> > there, but the docs are pretty thin.  I'm using the threadLocal
> > version of the much-documented HibernateUtil in a DAO layer.  Going
> > well.  What will Tapernate actually do for me?  Does it really solve
> > the lazy-loading problem?  Are there decent docs?
> >
> > I would HATE to have to abandon tapestry to work around performance
> > problems falling out of non-lazy-loading.
> >
> > Thanks,
> > Bill
> >
> 

Re: DatePicker not working after upgrading from 4.0.2 to 4.1

2006-11-06 Thread Steve Shucker
I had this problem too - in firefox1.5.  I didn't test it in IE, but I 
suspect it works there.  Firefox wasn't liking the document.formId.  It 
wants document.getElementById('formId') instead.  It's a small change on 
two lines of DatePicker.script.  I'm not sure why this used to work, though.


-Steve

Gabriel Lozano wrote:

Hi

Sorry, but i finally dont know what is the answer to the issue of 
upgrading
tapestry and the datepicker not working. Why is this happening? or 
should we
instead use the dropdownTimePicker? When I click on the date icon ( 
for the

daypicker component ) on IE, the js error says ('
document.formId.dateComponentId null or not an object')

By the way, how can be the effects for the dropdownDatePicker be 
achieved ?

( fade ...)

Thanks in advance

Gabriel Lozano M.

On 10/17/06, Jesse Kuhnert <[EMAIL PROTECTED]> wrote:


The DatePicker placement issues should be fixed & deployed.

On 10/17/06, Josh Long <[EMAIL PROTECTED]> wrote:
>
> I'm not too sure about DropdownDatePicker ( I guess I haven't notied
> much there) but...
>
> the following code on mozilla yeilds a @DatePicker that, when clicked,
> shows up at the bottom of the 100px border (not at the bottom of th
> etext field).  (scroll down for sample code..)
>
> In fact, if you check the workbench example on opencomponentry.com and
> click on the 'Dates' tab the problem is visible right there: the drop
> down date pickers show up under the submit button (not the text
> fields).
> /
> import org.apache.tapestry.html.BasePage;
> import java.util.Date;
> abstract public class Test extends BasePage {
> abstract public Date getDateValue() ;
> abstract public void setDateValue(Date dateValue) ;
>
> }
> 
>
>
>
> 
>
> 
> 
>
> 
> 
>  jwcid="@DatePicker"  value="ognl:dateValue"/>
> 
> 
> 
>
> Peace,
> Josh
>
> On 10/16/06, mraible <[EMAIL PROTECTED]> wrote:
> >
> > Strangely enough - it works fine when I use "mvn", but not when I 
use

my
> Ant
> > build file that reads from pom.xml.  Oh well, chaulk the compile
problem
> up
> > to a Maven issue - obviously not something you should worry about.
> >
> > As far as @DatePicker and @DropdownDatePicker in 4.1.1-SNAPSHOT, I'm
> > experiencing the same behavior I did in 4.1.  I disabled 
SiteMesh, but

> that
> > didn't help either.  From looking at the output, it looks like 
there's

> calls
> > to Dojo, but Dojo JavaScript files are never referenced.
> >
> > http://rifers.org/paste/show/1993
> >
> > I wouldn't worry about this too much, I'm more than happy to revert
back
> to
> > 4.0.2 - less work for me. ;-)
> >
> > Matt
> >
> >
> > Jessek wrote:
> > >
> > > Is this something I can attempt on my own as well (like in an svn
repo
> > > somwhere)? What I mean to say is I'm willing to invest a little 
time

> to
> > > figure out wtf is happening if you think it'll help by trying the
same
> on
> > > my
> > > own comp.
> > >
> > > On 10/17/06, mraible <[EMAIL PROTECTED]> wrote:
> > >>
> > >>
> > >>
> > >>
> > >> Jessek wrote:
> > >> >
> > >> > Ah. I guess I was expecting you to use the 4.1.1 version, it is
> > >> available
> > >> > in
> > >> > the apache snapshot repos only (the main repos are reserved for
> > >> official
> > >> > releases) :
> > >> >
> > >> > http://people.apache.org/repo/m2-snapshot-repository/
> > >> >
> > >> > The 4.1 version is hopelessly behind what is in 4.1.1. (At 
least

it
> > >> seems
> > >> > that way to me personally, maybe the differences aren't that
> large.)
> > >> >
> > >> > Is equinox on a "snapshot" version as well or are you only
allowing
> > >> fully
> > >> > stable final releases into it?
> > >> >
> > >> > All known major issues that I know of (besides my umm..hickup
> brought
> > >> up
> > >> > with portlets today ) are resolved and stable right now. I make
> > >> releases
> > >> > every few days or so.
> > >> >
> > >>
> > >> I'm not against using Snapshots for releases, but I'd prefer not
> to.  I
> > >> tried 4.1.1-SNAPSHOT and adding the Apache Snapshots
repository.  Now
> I'm
> > >> getting compile errors.  I'm assuming not a whole lot changed b/w
4.1and
> > >> 4.1.1 - maybe the JARs are corrupted?
> > >>
> > >> Here's the output I'm getting:
> > >>
> > >> test:
> > >> [artifact:dependencies] [INFO] snapshot
> > >> org.apache.tapestry:tapestry-framework:4.1.1-SNAPSHOT: check
> > >> ing for updates from [EMAIL PROTECTED]
> > >> [artifact:dependencies] [INFO] snapshot
> > >> org.apache.tapestry:tapestry-framework:4.1.1-SNAPSHOT: check
> > >> ing for updates from apache.snapshots
> > >> [artifact:dependencies] Downloading:
> > >> org/apache/tapestry/tapestry-framework/4.1.1-SNAPSHOT/tapestry-
> > >> framework-4.1.1-20061017.060957-35.pom
> > >> [artifact:dependencies] Transferring 7K
> > >> [artifact:dependencies] [INFO] snapshot
> > >> org.apache.tapestry:tapestry-project:4.1.1-SNAPSHOT: checkin
> > >> g for updates from [EMAIL PROTECTED]
> > >> [artifact:dependencies] [INFO] snapshot

Re: Changing template locations

2006-11-03 Thread Steve Shucker
That's exactly what I'm doing, but I've added a few test pages and the 
web.xml to the component library project so I can fire it up in jetty 
and test the components without needing a separate war project to use 
them.  This is a question about how to configure a library project for 
interactive or selenium testing, not rearranging files in a webapp.


-Steve

Mark Stang wrote:

Package them as Tapestry Libraries.

Mark J. Stang
Senior Engineer/Architect
office: +1 303.468.2900
mobile: +1 303.507.2833
Ping Identity



-Original Message-----
From: Steve Shucker [mailto:[EMAIL PROTECTED]
Sent: Thu 11/2/2006 4:59 PM
To: Tapestry users
Subject: Changing template locations
 
Is there a way to change the location where tapestry looks for html 
templates?  I've got a component library project with a standard maven2 
file structure.  I'm writing specless components.  I've created a 
/src/main/webapp directory containing a basic *.application and web.xml 
file and I use the maven jetty plugin to test.  However, running this 
project as a webapp requires me to move my *.html files into 
/src/main/webapp/WEB-INF.  I'd much rather configure hivemind to look 
for these files under the classpath where the *.java files are located 
and packaged for the component library.  A SpecificationResolverDelegate 
doesn't appear to address this issue - the fact that my component 
backing classes are in the classpath is causing tapestry to assume the 
*.html files are in WEB-INF.


I'd prefer to add an additional search location, but I'd settle for 
putting another hivemodule.xml in my test WEB-INF folder to search the 
classpath instead of WEB-INF.


-Steve

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



  


-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Changing template locations

2006-11-02 Thread Steve Shucker
Is there a way to change the location where tapestry looks for html 
templates?  I've got a component library project with a standard maven2 
file structure.  I'm writing specless components.  I've created a 
/src/main/webapp directory containing a basic *.application and web.xml 
file and I use the maven jetty plugin to test.  However, running this 
project as a webapp requires me to move my *.html files into 
/src/main/webapp/WEB-INF.  I'd much rather configure hivemind to look 
for these files under the classpath where the *.java files are located 
and packaged for the component library.  A SpecificationResolverDelegate 
doesn't appear to address this issue - the fact that my component 
backing classes are in the classpath is causing tapestry to assume the 
*.html files are in WEB-INF.


I'd prefer to add an additional search location, but I'd settle for 
putting another hivemodule.xml in my test WEB-INF folder to search the 
classpath instead of WEB-INF.


-Steve

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: Newbie question about ApplicationServlet

2006-10-05 Thread Steve Shucker
First of all, if you want a single manager object, tapestry provides 
Application State Objects to do this.  See 
http://tapestry.apache.org/tapestry4/UsersGuide/state.html#state.aso for 
more info.  For a single instance of an ASO across an entire 
application, you set the scope to "application" instead of "session".  
This is tapestry's preferred way of doing things, but the problem is 
that (I think) it's lazily initialized.


JMS: Check out spring (http://www.springframework.org).  They've had JMS 
send capabilities for a while now and I've (lightly) used them 
successfully.  Spring 2.0 was released earlier this week and now has 
Message Driven POJOs (MDPs) - the receiver side of JMS.  It sets up a 
pool of asynchronous receivers for you 
(http://static.springframework.org/spring/docs/2.0.x/reference/jms.html).  
A coworker of mine is starting to play with these and we're optimistic 
that it'll eliminate our last reason to use an EJB container.  If you're 
using Spring, they provide a servlet filter that you can configure in 
your web.xml to load the spring context when the app initializes.  I 
know I'm contradicting my first paragraph, but a spring context is also 
a great place to construct your manager object and JMS config - no 
worries about lazy initialization here.


Threads are messy and really hard to get right.  This isn't specific to 
servlets, just in general.  That's why many people try to avoid them.  
Personally, I'm more comfortable with a well-tested library to manage 
threads for me.


Tapestry does a lot of things right, but it sounds like a good chunk of 
your project is better covered by Spring's problem domain.  Fortunately, 
they play nice together.


-Steve

Dave Rathnow wrote:

Hi Dennis,

The application we're writing is "bridging" topics across multiple JMS 
servers.  The
initialization involves creating and initializing all the necessary 
JMS objects.   Pretty
simple, really, which is why we decided to make this our first 
Tapestry project.


There is a single "manager" object that manages the bridge, which is 
being managed by
the UI.  The manger object has to be created at application startup 
time so I can't
rely on any UI events to do this process for me.  Right now, I've 
created my own
ApplicationServlet subclass to handle this process.  I'm using async 
message delivery
so all the thread creation is being handle by the JMS implementation, 
except for some

threads I create to handle connection loss events.

I'm curious about handling threads inside a servlet.  I know this is a 
bit off topic
but, are there any problems with simply creating your own threads 
inside a servlet
container or is there some magic that has to be done to ensure you 
don't mess
things up?  I've heard from a couple of people that there could be 
problems with

managing your own threads.  Is there any truth to this?

Thanks,
Dave.

- Original Message - From: "Dennis Sinelnikov" 
<[EMAIL PROTECTED]>

To: 
Sent: Wednesday, October 04, 2006 9:14 PM
Subject: Re: Newbie question about ApplicationServlet



Hello Dave,

There is 1 instance of ApplicationServlet, with newer releases of 
tapestry there is less and less things I can think of doing in the 
ApplicationServlet.  You can extend from 
org.apache.tapestry.ApplicationServlet and create your own (perfectly 
ok to do).  In ApplicationServlet, usually you would do some global 
configuration settings, resource allocation, fork threads, etc..


Without knowing too much about the application you're trying to 
develop, you could fork threads in your ApplicationServlet that would 
do your background processing and just clean them up in destroy().  I 
would not recommend getting your ApplicationServlet instance, but 
perhaps develop separate logic that would get triggered via a UI.  
This logic would do monitoring/control and return response to the 
user via a UI.  If you need some global object or perhaps one of the 
threads that got forked upon ApplicationServlet startup, consider 
having a pool of threads that have the same purpose that you can just 
grab at any point...


Hope this helps,
Dennis

Dave Rathnow wrote:
I'm new to Tapestry and have just started working with it.  My 
background is WebObjects so

most of my question will come from that perspective.

The application I'm developing will be doing some background 
processing with the UI providing
monitoring and control functions.  In WebObjects, we would use an 
single Application instance that is created when the web application 
is first started. We would store the objects required to access and 
control the back ground processing.  This Application instance is 
then available in
in each request-response loop through a Session object, or through a 
global static method.


Is this same model provided by the ApplicationServlet class in 
Tapestry? Is there a single instance
of this object and if so, how can I get it?  Is it common practice 
to subclass this class and

then do all your o

Re: Button values dont print

2006-09-28 Thread Steve Shucker
I don't know if this will work, but you can try adding another 
stylesheet just for printing that will override the button's style.


type="text/css" />


Then set the color or other attributes for buttonSpecial to be something 
different.  It could be something as simple as the printer thinking it 
should ignore white.


-Steve

andyhot wrote:

so, it's not a tapestry issue, is it?

Peter Dawn wrote:
  

the html is  and in my css
I have,
.buttonSpecial {
  font: #FF;
  and the rest
}

any ideas.

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]






  


-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: Custom exception page

2006-09-27 Thread Steve Shucker

Exactly.  Then in your *.application file, put something like

and make sure that page has the API that tapestry's internal exception 
page has.  To save you the trouble, here's tapestry's exception page class:


public abstract class Exception extends BasePage implements 
PageDetachListener {

   /** Transient property */
   public abstract void setExceptions(ExceptionDescription[] exceptions);

   public void setException(Throwable value) {
   ExceptionAnalyzer analyzer = new ExceptionAnalyzer();
   ExceptionDescription[] exceptions = analyzer.analyze(value);
   setExceptions(exceptions);
   }
}

I should mention that there are other gurus on this list who can 
probably tell you how to make all this stuff log by properly configuring 
hivemind.  But if you want to play with the message, my code should suit 
you.


-Steve

[EMAIL PROTECTED] wrote:

Thanks Steve.

So in Exception.html I could just have a



?

Thanks,
Greg

-Original Message-----
From: Steve Shucker [mailto:[EMAIL PROTECTED]
Sent: Wednesday, September 27, 2006 11:04 AM
To: Tapestry users
Subject: Re: Custom exception page


Look at tapestry's ExceptionDisplay component source.  It uses something 
called an ExceptionAnalyzer and also displays the contents of the 
ExceptionDescription.getProperties().


I've got a custom exception page that writes to log4j.  Here's what I 
use to get the text:


public void logException(Throwable value) {
ExceptionAnalyzer analyzer = new ExceptionAnalyzer();
ExceptionDescription[] exceptions = analyzer.analyze(value);
setExceptions(exceptions);
StringBuffer text = new StringBuffer();
for (ExceptionDescription exception : exceptions) {
text.append("Class: " + exception.getExceptionClassName() + 
"\n");

text.append("Message: " + exception.getMessage() + "\n");
for (ExceptionProperty property : exception.getProperties()) {
text.append("Property: " + property.getName() + " = " + 
property.getValue() + "\n");

}
}
String[] stack = exceptions[exceptions.length-1].getStackTrace();
for (String stackItem : stack) {
text.append(stackItem + "\n");
}
log.error(text.toString());
}

-Steve

[EMAIL PROTECTED] wrote:
  

Can anyone help me out with a snippet of code? On my Exception.html/.page I 
have a simple @Insert with getError(). Here's my code, but it doesn't provide a 
nice traceback :(


public String getError()
  {
ExceptionDescription[] Errors = getExceptions();
String err = "";

for (int i = 0; i < Errors.length; i++)

  err += Errors[i].getMessage() + "";

  return err;
}

Any ideas?

Thanks,
Greg

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]


  



-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]


-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]


  


-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: Custom exception page

2006-09-27 Thread Steve Shucker
Look at tapestry's ExceptionDisplay component source.  It uses something 
called an ExceptionAnalyzer and also displays the contents of the 
ExceptionDescription.getProperties().


I've got a custom exception page that writes to log4j.  Here's what I 
use to get the text:


   public void logException(Throwable value) {
   ExceptionAnalyzer analyzer = new ExceptionAnalyzer();
   ExceptionDescription[] exceptions = analyzer.analyze(value);
   setExceptions(exceptions);
   StringBuffer text = new StringBuffer();
   for (ExceptionDescription exception : exceptions) {
   text.append("Class: " + exception.getExceptionClassName() + 
"\n");

   text.append("Message: " + exception.getMessage() + "\n");
   for (ExceptionProperty property : exception.getProperties()) {
   text.append("Property: " + property.getName() + " = " + 
property.getValue() + "\n");

   }
   }
   String[] stack = exceptions[exceptions.length-1].getStackTrace();
   for (String stackItem : stack) {
   text.append(stackItem + "\n");
   }
   log.error(text.toString());
   }

-Steve

[EMAIL PROTECTED] wrote:

Can anyone help me out with a snippet of code? On my Exception.html/.page I 
have a simple @Insert with getError(). Here's my code, but it doesn't provide a 
nice traceback :(


public String getError()
  {
ExceptionDescription[] Errors = getExceptions();
String err = "";

for (int i = 0; i < Errors.length; i++)

  err += Errors[i].getMessage() + "";

  return err;
}

Any ideas?

Thanks,
Greg

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]


  


-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: Dynamic columns

2006-09-20 Thread Steve Shucker
Just use an ognl expression for the "columns" attribute of the table. 




Never underestimate the coolness of the terniary operator.

-Steve

[EMAIL PROTECTED] wrote:

Anybody know a simple way to dynamically add a column to a table (using Contrib:Table)? I 
want a table to have a new column with a "Delete" link if the user is an admin. 
I have it working if I by always including the Delete column and the Delete links only 
appear for admins, but I want the column itself to only appear for admins.Any help 
appreciated.
_
Express yourself with gadgets on Windows Live Spaces
http://discoverspaces.live.com?source=hmtag1&loc=us
  


-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: WG: Question: Can not get access to object fields (Null Pointer Exception) pls pls help!

2006-09-12 Thread Steve Shucker
As a general rule, it's safer to put the literal first in statements 
like this:


"admin".equals(user.getState())

If anyone wants to say that it looks/reads a bit funny, I'll agree.  
It's an odd syntax, but it protects you from NPEs.


-Steve

Martin Strand wrote:

Well, if you get a NPE on this line:
  

user.getState().equals("admin")
  

then either "user" or "getState()" is null, right?
And, since "user" is definitely not null, your private String "state" is 
obviously null.

Perhaps you should add something like this:
  

private String state = "initial state";
  



Martin

On Tue, 12 Sep 2006 15:52:25 +0200, Michael Wölm <[EMAIL PROTECTED]> wrote:

  

Hi,

Sadly, nobody have helped me with my problem. I dont know why. Am I too noob
or is my question incomprehensible? I would be pleased, if anybody could
give me an advice for my problem.

Greettings from Germany,
Michael Wölm

Original message is under this.

-Ursprüngliche Nachricht-
Von: m-woelm [mailto:[EMAIL PROTECTED]
Gesendet: Sonntag, 10. September 2006 16:13
An: 'Tapestry users'
Betreff: Question: Can not get access to object fields (Null Pointer
Exception)

Hi,

I hope anybody could explain me why I get a Null Pointer Exception, if I
want to get access to a field of an object. My method is similar to the
eshop-project of the book “Enjoying web dev with Tapestry”.

I tried to change the Listener-method onLogin as follows:

public void onLogin(IRequestCycle cycle) {

try {

  User user = Users.getKnownUsers().getUser(email,password);

  getUser().copyFrom(user);

  if (user.getState().equals("admin"))
cycle.activate("Admin_Konsole");

  else cycle.activate("User_Konsole");

} catch (AuthenticationException e) {

  ValidationDelegate delegate = getDelegate();

  delegate.setFormComponent(null);

  delegate.record("Login failed", null);

}

  }


Now I get an exception at point (user.getState().equals(“admin”)).

But why? user was set to the login-user two lines before? Why I can’t get
the field: private String state which I have set in User.class:


  private String state;

  public String getState() {

return this.state;

  }


Thx ahead!

Michael Wölm


  [EMAIL PROTECTED]

Public Key:  
href="http://gsg.ath.cx/~phoenix/downloads/MyPublicKey.asc





-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]







-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]


  


-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



RE: listener desired on "For" component

2006-08-17 Thread Steve Shucker
Try putting an @InvokeListener component in your @For loop.

-Steve

-Original Message-
From: Patrick Moore [mailto:[EMAIL PROTECTED] 
Sent: Thursday, August 17, 2006 1:13 AM
To: Tapestry users
Subject: listener desired on "For" component 

Hi there --

I have a situation where I am displaying (using a For component) a list of
editable items. When the form is submitted I would like to have a listener
defined by the component containing the For component called for each
iteration
through  For's body after all the components within that loop iteration have
been rewound. 

There doesn't to be any to do this gracefully. I am settling on making one
compound component as the body for the For component. This compound
component
has the listener method, which is being called manually within the
component's
cleanupAfterRender(cycle). It seems like there should be a better way and I
was
wondering if anyone had any suggestions? 

Should I modify the For component so that a listener method could be
defined?

Thanks for any ideas.

-Pat

What I would like:









-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]


-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



RE: How to pass a parameter to an ASO constructor?

2006-08-01 Thread Steve Shucker
I think this is what you're trying to do, but I haven't tested it.  The key
bit is the  references a factory class instead of what
the factory should generate.  If this works, the general solution is to make
the factory take a "className" and "constructorArgument" property and use
reflection in the createStateObject method.  At least that serves a broad
enough purpose to disguise the fact that it's an ugly kludge.

-Steve









public class BooleanFactory implements StateObjectFactory {
private booleanState;

public Boolean getBooleanState() {
return booleanState;
}
public void setBooleanState(boolean booleanState) {
This.booleanState = booleanState;
}
public Object createStateObject() {
return new Boolean(booleanState);
}
}
-Original Message-
From: Danny Mandel [mailto:[EMAIL PROTECTED] 
Sent: Tuesday, August 01, 2006 2:52 PM
To: Tapestry users
Subject: Re: How to pass a parameter to an ASO constructor?

Ping? Short story is that I'm attempting to pass a constructor argument 
(in this case, the boolean false) when creating my ASO.

I've continued searching for this and am still stuck.  The closest thing 
I found on the wiki and attempted to adapt to my needs was this:










false




Which results in the following error when attempting to access the ASO 
for the first time:

-
Unable to construct service org.tolweb.tapestry.BooleanFactory: Instance 
factory for service org.tolweb.tapestry.BooleanFactory returned false 
which does not implement the 
org.apache.tapestry.engine.state.StateObjectFactory interface declared 
by the extension point.
-

I'll happily write up a howto on the wiki if anyone can provide insight 
to help this work.

Thanks,
Danny
> Hi all,
>
> I'm trying to figure out how to pass a constructor argument when 
> constructing an ASO.  I have a java.lang.Boolean, and it *needs* to 
> have a parameter passed in the constructor (no empty-arg constructor 
> exists).  I know this ought to be simple, but I don't see any 
> documentation explaining the proper way to do this.  This current way 
> doesn't work:
>
>
>
>
>false
>
>
>
>
> Any hints would be greatly appreciated.
>
> Thanks,
> Danny
>
> -
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]


-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]


-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



RE: contrib:Table paging in @For loop

2006-07-21 Thread Steve Shucker
Thank you!  That was a trivially simple solution that solved 90% of my
issues.  I'd spent several hours digging into the table's internals before I
saw your email and fixed the paging in 10 minutes.  It was no problem to
make the objects I was iterating over implement ITableSessionStoreManager.
Is there someplace where this is documented?

One small note: even with your fix, the page counts on my (customized) pager
were displaying wrong.  I think this happened because TableFormPages caches
some of the page information in local private variables that are lazily
populated from the superclass.  I added a



tag just before the table and implemented a custom listener to call
pageBeginRender on the pager.  It really should have been an initialize()
call, but that's a private method and pageBeginRender doesn't do anything
besides call initialize().

-Steve

-Original Message-
From: Mind Bridge [mailto:[EMAIL PROTECTED] 
Sent: Friday, July 21, 2006 9:10 AM
To: users@tapestry.apache.org
Subject: Re: contrib:Table paging in @For loop


Hi,

The reason this happens is that Table stores its state in a persistent
property by default, which happens to be the same property when Table is
placed in a For loop.  

Please implement ITableSessionStoreManager and provide the
'tableSessionStoreManager' parameter to Table. That will allow you to
control where the table state is stored (i.e. a List where the index is the
iteration of the For).

Best regards,
-mb
-- 
View this message in context:
http://www.nabble.com/contrib%3ATable-paging-in-%40For-loop-tf1976651.html#a
5436353
Sent from the Tapestry - User forum at Nabble.com.


-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]


-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



contrib:Table paging in @For loop

2006-07-20 Thread Steve Shucker
I'm having a problem with the contrib:Table component nested inside a @For
loop.  Essentially I'm rendering several lists of objects.  The initial
display is correct, but paging fails.  What I think is happening is that a
single @contrib:Table component is being reused with each iteration of the
loop and the paging listeners are firing against that single component
without regard to where I am in the @For loop.  My evidence is the hidden
form fields associated with paging state are being created for each
iteration of the loop, but always contain the same values.  Has anyone seen
behavior like this before or know of a workaround?

 

-Steve



RE: Re: heap analysis and tapestry caches

2006-07-11 Thread Steve Shucker
Sam - 

I think you're referring to the tomcat PermGen OutOfMemory errors, which
doesn't sound like what Henri is describing.  But since you've brought it
up, a good workaround for the PermGen errors you get when you redeploy is
the following flag:

-XX:MaxPermSize=128m

It's not a solution, but it enlarges the bit of memory that's running out
and gives you several more happy deployments.

-Steve

-Original Message-
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Sam
Gendler
Sent: Tuesday, July 11, 2006 7:47 PM
To: Tapestry users
Subject: Re: Re: heap analysis and tapestry caches

I certainly don't have any insight into the problem, but even with a
fairly simple application, I see Heap Memory errors on a fairly
frequent basis.  I can redploy the app no more than 2 or sometimes 3
times before I will run out of heap space, and if I use the  app for a
while, it will just spontaneously combust, even if it is the first
deployment.  To be honest, the problem makes me VERY nervous, although
not yet enough to do any serious invesitgation.

--sam


On 7/11/06, Jesse Kuhnert <[EMAIL PROTECTED]> wrote:
> Don't have an answer for you right now (at least not one that isn't one of
> 20 different possibilities), but I'll try and take a peak at the ognl
cache
> service tonight and make sure I don't see anything that might be holding
on
> to references when it shouldn't.
>
> On 7/11/06, Henri Dupre <[EMAIL PROTECTED]> wrote:
> >
> > Our website based on tapestry 4 seems to be out of memory and is
crashing
> > every few days no matter what -Xmx I set. It is actually not that bad,
> > with
> > some scripts we get the website restarted within minutes in case of
crash.
> > I've been investigating the source of this issue lately using the new
Jhat
> > and Jmap tools of the JDK 1.6.
> > Most of the memory seems to be HashMap$Entry objects which I believe are
> > keys to most caches in the app (especially ehcache).
> > But what was surprising is the number of instances of tapestry
components.
> > About 11000 pagelinks and roughly the same amount for IfBean and other
> > components after less than 1 day of execution. With jhat I've been able
to
> > trace the origins of these components and they originate from
> > ExpressionBinding (72000 instances).
> > I'm not that familiar with the lifecycle of tapestry components but I'm
> > curious to understand why has tapestry created so many instances?
> > And given the numbers of instances, I'm wondering if Tapestry shouldn't
> > have
> > limits on its caches?
> > Would it improve the memory usage if I use cycle.forgetPage(...) for
every
> > page?
> >
> > --
> > Thanks,
> >
> > Henri.
> >
> >
>
>
> --
> Jesse Kuhnert
> Tacos/Tapestry, team member/developer
>
> Open source based consulting work centered around
> dojo/tapestry/tacos/hivemind.
>
>

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]


-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



RE: Tree w/Checkbox on each node--Way to Fix Indent?

2006-06-30 Thread Steve Shucker
Sorry, I mis-filed it.  I saw this as a variation of bug 32 and added a
comment on there (dated 5/3/2006).  I just looked at the bug tracker and
realized that bug had been long-closed.  Do you want to reopen 32 or should
I re-file?

-Steve

-Original Message-
From: Jesse Kuhnert [mailto:[EMAIL PROTECTED] 
Sent: Friday, June 30, 2006 10:48 AM
To: Tapestry users
Subject: Re: Tree w/Checkbox on each node--Way to Fix Indent?

Is there an open issue for this in tacos? Seems like a big enough deal thing
that I should fix it. http://tacoscomponents.jot.com/BugReporter

On 6/30/06, Steve Shucker <[EMAIL PROTECTED]> wrote:
>
> I had this problem a while ago and traced it to a PartialFor component
> within the tree that was persisting the contents incorrectly in the form.
> It's using an iterator that doesn't track depth.  As a workaround, you can
> create your own html/jwc files for the Tree control (use taco's backing
> class) and add a volatile=true property to the PartialFor component.  It's
> not ideal, but it's working great for me.
>
> -Steve
>
> -Original Message-
> From: Tyrone Hed [mailto:[EMAIL PROTECTED]
> Sent: Thursday, June 29, 2006 9:57 PM
> To: users@tapestry.apache.org
> Subject: Tree w/Checkbox on each node--Way to Fix Indent?
>
>
>
>Folks,
>  I have developed a Tapestry app (4.0.1) that uses the Tree in
> four
> places. It works great in three of those places but not in the one that
> includes a checkbox on each node of the tree. The problem is that it loses
> track of the indent and gives all nodes of the tree the same indent as the
> right-most node. So, as the user opens each node, the tree marches from
> left
> to right. In short, it looks like hell. I've looked at the generated
> source
> but it just piles on divs and spans to get the indent. The margin indent,
> in
> short, is broken when you have to enclose a tree in a FORM. Any
> suggestions?
> Here is my code.
>   Thank you,
>
>
Ty
>
>
> Files included:
>
> userEnterprises.page
> userEnterprises.html
> UserEnterprises.java
>
> ---
> userEnterprises.page
> ---
>
>  class="com.tyco.web.pages.authorization.UserEnterprises">
>
> Tree
>   
> 
>
> 
>   
>   
>/>
>   
>name="state"value="enterpriseTreeState"/>
> 
>
>   
> 
> 
>   
>
>   
> 
> 
>   
>
> 
>
>
> ---
> userEnterprises.html
> ---
>
>   
> 
>   
>jwcid="tree"
>   id="tree"
>   keyProvider="ognl:keyProvider"
>   contentProvider="ognl:contentProvider"
>
>   style="overflow: auto; width: auto; height: auto;">
>conditionValue="true">
>  value="ognl:item.checked" />
>   
>conditionValue="ognl:true">
>  value="ognl:item.name"/>
>   
>   
>  value="ognl:item.name"/>
>   
> 
>   
> 
>   
>
>
> ---
> UserEnterprises.java
>
>  (I doubt this class will we useful in solving this problem
>  but just in case I am doing so for completeness.)
> ---
>
> /*
> * Created on Jan 17, 2006
> *
> * Copyright 2005 Ingenix, Inc. All rights reserved.
> * This file contains CONFIDENTIAL and PROPRIETARY information
> * and should not be distributed without prior written permission.
> */
> package com.ingenix.freya.web.pages.authorization;
>
> import java.util.ArrayList;
> import java.util.HashSet;
> import java.util.Iterator;
> import java.util.List;
> import java.util.Set;
>
> import org.apache.commons.logging.Log;
> import org.apache.commons.logging.LogFactory;
> import org.apache.tapestry.IRequestCycle;
> import org.apache.tapestr

RE: How to set cookie ftom T4 application for different host

2006-06-30 Thread Steve Shucker
The cookie domain must be a domain, not a host.  For a cookie at
"tapestry.apache.org", the domain is "apache.org" and will be valid for
"tomcat.apache.org" as well.  If you don't have at least one period in the
hostname, the cookie just isn't set.  Personally, I have a small bit of
logic to detect if my app is running on localhost (development) and not set
the cookie domain.  Otherwise, it gets set to my company's domain.

-Steve

-Original Message-
From: Audrius Peseckis [mailto:[EMAIL PROTECTED] 
Sent: Friday, June 30, 2006 6:06 AM
To: Tapestry users
Subject: How to set cookie ftom T4 application for different host

Hello,

we have a problem when setting cookie value for a different host. When using
standard T4 CookieSource we can set a cookie for our application on
application's host. But we need to set a cookie for a different host. I
suppose it's done with injection of tapestry.globals.HttpServletResponse.

There's a piece of our code that is not working:

Cookie c1 = new Cookie("cookieName", "cookieValue");
  
c1.setDomain("hostname");
c1.setPath("/session_test");
c1.setMaxAge(99);
  
this.getB().addCookie(c1); // B is declared as 

We are trying to set cookie in pageBeginRender method.

Any help is appreciated.

Audrius


-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



RE: Tree w/Checkbox on each node--Way to Fix Indent?

2006-06-30 Thread Steve Shucker
I had this problem a while ago and traced it to a PartialFor component
within the tree that was persisting the contents incorrectly in the form.
It's using an iterator that doesn't track depth.  As a workaround, you can
create your own html/jwc files for the Tree control (use taco's backing
class) and add a volatile=true property to the PartialFor component.  It's
not ideal, but it's working great for me.

-Steve

-Original Message-
From: Tyrone Hed [mailto:[EMAIL PROTECTED] 
Sent: Thursday, June 29, 2006 9:57 PM
To: users@tapestry.apache.org
Subject: Tree w/Checkbox on each node--Way to Fix Indent?



   Folks,
 I have developed a Tapestry app (4.0.1) that uses the Tree in four
places. It works great in three of those places but not in the one that
includes a checkbox on each node of the tree. The problem is that it loses
track of the indent and gives all nodes of the tree the same indent as the
right-most node. So, as the user opens each node, the tree marches from left
to right. In short, it looks like hell. I've looked at the generated source
but it just piles on divs and spans to get the indent. The margin indent, in
short, is broken when you have to enclose a tree in a FORM. Any suggestions?
Here is my code. 
  Thank you,
  Ty


Files included:

userEnterprises.page
userEnterprises.html
UserEnterprises.java

---
userEnterprises.page
---


  
Tree
  



  
  
  
 
  


  


  
  
  


  




---
userEnterprises.html
---



  

  

  
  

  
  

  

  

  


---
UserEnterprises.java

 (I doubt this class will we useful in solving this problem
 but just in case I am doing so for completeness.)
---

/*
 * Created on Jan 17, 2006
 *
 * Copyright 2005 Ingenix, Inc. All rights reserved.
 * This file contains CONFIDENTIAL and PROPRIETARY information
 * and should not be distributed without prior written permission.
 */
package com.ingenix.freya.web.pages.authorization;

import java.util.ArrayList;
import java.util.HashSet;
import java.util.Iterator;
import java.util.List;
import java.util.Set;

import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.apache.tapestry.IRequestCycle;
import org.apache.tapestry.annotations.InjectState;
import org.apache.tapestry.event.PageBeginRenderListener;
import org.apache.tapestry.event.PageEvent;

import com.tyco.api.authorization.AuthorizationFactory;
import com.tyco.api.authorization.User;
import com.tyco.api.enterprise.Enterprise;
import
com.tyco.web.components.authorization.AuthenticationListComponentBase;
import com.tyco.web.components.enterprise.EnterpriseTreeContentProvider;
import com.tyco.web.components.enterprise.Folder;
import com.tyco.web.components.enterprise.Item;

public abstract class UserEnterprises extends UserControllerPage implements
PageBeginRenderListener
{
  private List mPermissions;
  private Enterprise mEnterprise;  

  @InjectState( "contentProvider" )
  public abstract EnterpriseTreeContentProvider getContentProvider();
  public abstract void setContentProvider( EnterpriseTreeContentProvider
pEnterpriseTreeContentProvider );

  @InjectState( "enterpriseTreeState" )
  public abstract Set getEnterpriseTreeState();
  public abstract void setEnterpriseTreeState( Set pEnterpriseTreeState );
  
  @InjectState("newUser")
  public abstract User getNewUser();
  public abstract void setNewUser(User val);
  
  public abstract Long getID();
  
  protected Log mLog = LogFactory.getLog(this.getClass().getName());
  
  public void pageBeginRender(PageEvent pEvent)
  {
detectCheckedEnterprises( getNewUser() );
  }
  
  public void activate(IRequestCycle pCycle) 
  { 
   Object[] parameters = pCycle.getListenerParameters();

   if (parameters.length >= 2)
  {  
  Long userID = (Long) parameters[1];
  User user = getAuthorizationService().getUserByID(userID);
  setNewUser(user);
  List permissionList = getUserPermissions(user);
  setPermissions(permissio

RE: Logging error page into log4j

2006-06-21 Thread Steve Shucker
My team did something like this recently.  We put a line in our
*.application file:



Then we copied/modified the code from tapestry's error page so we could pipe
tapestry's stacktrace generation to log4j.  The actual html/page file was
just our friendly message and layout with the original tapestry
implementation sitting in a hidden div to make life easy for developers.
Here's our code:

public abstract class ErrorPage extends BasePage {

@InjectObject("service:tapestry.globals.HttpServletResponse")
public abstract HttpServletResponse getResponse();

private static final Logger log =
Logger.getLogger("com.vms.adsite.pages.ErrorPage"); 

public abstract void setExceptions(ExceptionDescription[] exceptions);

public void setException(Throwable value) {
ExceptionAnalyzer analyzer = new ExceptionAnalyzer();
ExceptionDescription[] exceptions = analyzer.analyze(value);
setExceptions(exceptions);
String text = "";
for (ExceptionDescription exception : exceptions) {
text += "Class: " + exception.getExceptionClassName() +
"\n";
text += "Message: " + exception.getMessage() + "\n";
for (ExceptionProperty property : exception.getProperties())
{
text += "Property: " + property.getName() + " = " +
property.getValue() + "\n";
}
}
String[] stack = exceptions[exceptions.length-1].getStackTrace();
for (String stackItem : stack) {
text += stackItem + "\n";
}
log.error(text);
}
}   


-Original Message-
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] 
Sent: Wednesday, June 21, 2006 6:43 AM
To: tapestry-user@jakarta.apache.org
Subject: Logging error page into log4j

Hi all,

How do get the default error page to log into log4j? 

I really dont need to overide the default error page (this is an internal
application) but I do need the errors logged. Any help is appreciated!

Thanks,
Amir



-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]


-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



RE: strange problem losing session variables

2006-06-06 Thread Steve Shucker
I've seen something like this once before involving an app designed for a
small number of large sessions.  My problem was that I was persisting my
sessions in-memory.  When there was no more memory available, my app server
(weblogic 8.1) conveniently started discarding sessions.  Turning on JDBC
session persistence and making a bunch of classes implement Serializable
fixed the problem.  I expect disk-based persistence would also have worked
fine.  I'm not sure if this problem is specific to weblogic or applies to
other app servers, though.

-Steve

-Original Message-
From: John Menke [mailto:[EMAIL PROTECTED] 
Sent: Monday, June 05, 2006 10:04 AM
To: Tapestry User
Subject: strange problem losing session variables

Is anyone experiencing any problems with "lost" session variables?  We have
an application that stores some state in the session and we are getting
strange errors caused by objects that were
previously being in the session being "lost".  When our code tries to access
these variables it gives nullpointer errors.

What is strange is that the session is not being lost itself - if this was
the case the StaleSession page would appear via tapestry...

-jm


-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]