5.4-alpha-9 preview release

2013-06-21 Thread Howard Lewis Ship
Available from Maven Repo:
https://repository.apache.org/content/repositories/orgapachetapestry-055/

Improvements:
- Better CSS for built-in components such as Tree and Grid
- JavaDoc formatting improvements & fixes
- Used Node to compile CoffeeScript, if available
- Update dependencies, remove unwanted dependencies
- Use correct Cache-Control headers for assets and modules
- Significant improvements to the Palette component
  - Streamlined markup
  - Triggers events before and after changing the selection
  - Event listeners can cancel or even defer the selection change


There's been a few other changes:

Underscore is now exposed a module "underscore", not "_".
t5/core/dom:body is now an ElementWrapper and not a function that returns
an ElementWrapper.
t5/core/dom:escapeHTML has been removed, use _.escape()


-- 
Howard M. Lewis Ship

Creator of Apache Tapestry

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

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


Re: Tapestry portal project

2013-06-21 Thread Lenny Primak
I would just go with JEE. It's super easy to use and nothing to be afraid of. 
It's also fully integrated with tapestry via the FlowLogix module. 

You just have to be careful not to stumble into the old documentation and 
idioms from the old
And bad EJB 2.1 days while looking for documentation. 

On Jun 21, 2013, at 4:39 AM, "John"  wrote:

> Hi,
> 
> I'm building a portal project. It provides a login page and some links to 
> some static content.
> 
> I'll be reusing quite a bit of the DAO and JPA gubbins from an existing base 
> application, just giving it a different and cut down front end.
> 
> Is there any way of the portal web app to bind up with the Tapestry services 
> already running in the base application so I can reuse the DAO and other 
> backend goodies that's already registered? A bit like a shared registry? At 
> the moment it looks like I really need to move over to a JEE container just 
> to implement a few shared services. That's quite a big step and I'm averse to 
> JEE and all tat comes with it.
> 
> Or perhaps the portal should just be a subdirectory in the base application, 
> but then it really needs to appear with its own seperate context path as it's 
> served using a different hostname?
> 
> regards,
> John

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



Re: best way of incorporating static pages?

2013-06-21 Thread John
I created a Static.java page class like this...

public StreamResponse onActivate(String filename) {

File file = new 
File("C://Temp//jetty-6.1.16//webapps/portal//static//help//"+filename);

return new PageStreamResponse(file);

}


It serves the html content but for some of the static files there is a blank in 
the filename which seems to cause this problem...

[ERROR] TapestryModule.RequestExceptionHandler Processing of request failed 
with uncaught exception: Input string 'Customise Your Presence.bmp' is not 
valid; the character ' ' at position 10 is not valid.
java.lang.IllegalArgumentException: Input string 'Customise Your Presence.bmp' 
is not valid; the character ' ' at position 10 is not valid.
 at 
org.apache.tapestry5.internal.services.URLEncoderImpl.decode(URLEncoderImpl.java:144)
 at $URLEncoder_275016f422cdb7.decode(Unknown Source)

I also don't see a foolproof way to set the content type in th response header, 
but it would be better if my static page could pass these non html resource 
requests back to the container for serving somehow anyway?

John

Re: best way of incorporating static pages?

2013-06-21 Thread John
I'm not sure how that would work.

If the static content has been placed in a directory under the tapestry webapp 
directory then it is servable directly by the container and potentially not 
secure. It will also potentially invoke the tapestry filter and conflict.

If the content is placed outside the container then how will the URL below work?

John
  - Original Message - 
  From: Barry Books 
  To: Tapestry users 
  Sent: Wednesday, June 12, 2013 2:05 PM
  Subject: Re: best way of incorporating static pages?


  I would use  new URL("http://localhost/static"; + path).openStream() to
  fetch the data instead of File(). Leave the security up to Tomcat.


  On Wed, Jun 12, 2013 at 7:01 AM, Thiago H de Paula Figueiredo <
  thiag...@gmail.com> wrote:

  > On Wed, 12 Jun 2013 07:08:10 -0300, John  wrote:
  >
  >  Hi,
  >>
  >
  > Hi!
  >
  >
  >  I have a need to link to some static HTML generated by a CMS app.
  >> Assuming this content is in a directory outside my Tapestry app, what would
  >> be the best way of linking/serving it via Tapestry?
  >>
  >
  > I'd create a page that receives the file name or path in the activation
  > context and returns a StreamResponse wrapping the file (which is probably
  > in a fixed folder or its subfolders). Pay attention to security, refusing
  > file names or paths with '..' (without the quotes) on it so no file outside
  > the HTML folder is ever returned.
  >
  > --
  > Thiago H. de Paula Figueiredo
  >
  >
  > --**--**-
  > To unsubscribe, e-mail: 
users-unsubscribe@tapestry.**apache.org
  > For additional commands, e-mail: users-h...@tapestry.apache.org
  >
  >


Re: ClassCastEx / LinkageError

2013-06-21 Thread Jens Breitenstein
Yes, Lance this did the trick. Stupid me, a closer look at the Zone 
class should have told me it's not an interface...


Thanks


Jens




Am 21.06.13 12:39, schrieb Lance Java:

You can't reference a transformed class (component /page / mixin classes)
directly from a service as the classloaders are not compatible.

Try referencing ClientBodyElement instead. The Zone component implements
this interface and the interface is not a transformed class.




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



Re: Tapestry portal project

2013-06-21 Thread Lance Java
Also, checkout TapestryFilter.provideExtraModuleDefs(ServletContext)

You may choose to extend TapestryFilter and override this method to lookup
from your other app.


Re: Tapestry portal project

2013-06-21 Thread Lance Java
You can lookup the registry from the servlet context once the tapestry
filter has been initialized

http://tapestry.apache.org/current/apidocs/org/apache/tapestry5/TapestryFilter.html#REGISTRY_CONTEXT_NAME


Re: ClassCastEx / LinkageError

2013-06-21 Thread Lance Java
You can't reference a transformed class (component /page / mixin classes)
directly from a service as the classloaders are not compatible.

Try referencing ClientBodyElement instead. The Zone component implements
this interface and the interface is not a transformed class.


Tapestry portal project

2013-06-21 Thread John
Hi,

I'm building a portal project. It provides a login page and some links to some 
static content.

I'll be reusing quite a bit of the DAO and JPA gubbins from an existing base 
application, just giving it a different and cut down front end.

Is there any way of the portal web app to bind up with the Tapestry services 
already running in the base application so I can reuse the DAO and other 
backend goodies that's already registered? A bit like a shared registry? At the 
moment it looks like I really need to move over to a JEE container just to 
implement a few shared services. That's quite a big step and I'm averse to JEE 
and all tat comes with it.

Or perhaps the portal should just be a subdirectory in the base application, 
but then it really needs to appear with its own seperate context path as it's 
served using a different hostname?

regards,
John

ClassCastEx / LinkageError

2013-06-21 Thread Jens Breitenstein

Hi All!

I have a strange problem with Zone and maybe you have an idea...

This works as expected in a page (injecting the required services and 
return a zone or body/block from an event handler):


@Inject private AjaxResponseRenderer _arr;
@Inject private Request _request;

@InjectComponent(value = "saveButtonZone") private Zone 
_zoneSaveButton;

@InjectComponent(value = "eventsZone") private Zone _zone;


1 (zone update):

...
return (_request.isXHR() ? _zoneSaveButton.getBody() : null);


2 (multiple zone update):

...
if (_request.isXHR()) {
_arr.addRender(_zone).addRender(_zoneSaveButton);
}
return null;



Next I wanted to further simply my page by removing _arr and _request 
and replaced the "if" by a service method. Therefore my module looks like:



@Scope(ScopeConstants.PERTHREAD)
public static IZoneService buildZoneService(final Request request, 
final AjaxResponseRenderer arr)

{
return new ZoneService(request, arr);
}


The service interface is defined as:


import org.apache.tapestry5.Block;
import org.apache.tapestry5.corelib.components.Zone;

public interface IZoneService
{
Object refresh(final Zone... zones);

Block refresh(final Zone zone);
}


The Service implementation is:


import org.apache.tapestry5.Block;
import org.apache.tapestry5.corelib.components.Zone;
import org.apache.tapestry5.services.Request;
import org.apache.tapestry5.services.ajax.AjaxResponseRenderer;


public class ZoneService implements IZoneService
{
private final Request _request;
private final AjaxResponseRenderer _arr;

public ZoneService(final Request request, final 
AjaxResponseRenderer arr)

{
_request = request;
_arr = arr;
}

@Override
public Object refresh(final Zone... zones)
{
if (_request.isXHR()) {
for (final Zone zone : zones) {
_arr.addRender(zone);
}
}

return null;
}

@Override
public Block refresh(final Zone zone)
{
return (_request.isXHR() ? zone.getBody() : null);
}
}


My Page class changed to:

@Inject private IZoneService _zoneService;
...
return _zoneService.refresh(_zoneSaveButton);
...


But triggering the event now fails with:


java.lang.LinkageError: loader constraint violation: when resolving 
interface method 
"de.xyz.client.services.util.IZoneService.refresh(Lorg/apache/tapestry5/corelib/components/Zone;)Lorg/apache/tapestry5/Block;" 
the class loader (instance of 
org/apache/tapestry5/internal/plastic/PlasticClassLoader) of the current 
class, de/xyz/client/pages/Homework, and the class loader (instance of 
org/eclipse/jetty/webapp/WebAppClassLoader) for resolved class, 
de/xyz/client/services/util/IZoneService, have different Class objects 
for the type org/apache/tapestry5/corelib/components/Zone used in the 
signature
at 
de.xyz.client.pages.Homework.advised$onDeleteCheckboxChanged_1309a058b1d86bfa(Homework.java:299)
at 
de.xyz.client.pages.Homework$Invocation_onDeleteCheckboxChanged_1309a058b1d86bf9.proceedToAdvisedMethod(Unknown 
Source)
at 
org.apache.tapestry5.internal.plastic.AbstractMethodInvocation.proceed(AbstractMethodInvocation.java:84)
at 
org.apache.tapestry5.internal.transform.BridgeClassTransformation$WrapMethodAdviceAsComponentMethodAdvice$1.proceed(BridgeClassTransformation.java:339)
at 
org.tynamo.security.ShiroAnnotationWorker$1.advise(ShiroAnnotationWorker.java:71)
at 
org.apache.tapestry5.internal.transform.BridgeClassTransformation$WrapMethodAdviceAsComponentMethodAdvice.advise(BridgeClassTransformation.java:325)




I also tried a static util class passing all required argument to the 
static refresh methods instead of a per thread service, but the effect 
is the same. Any idea, what's going on here and how to avoid it?



Jens



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



Re: Form with Upload loses context on FileUploadException

2013-06-21 Thread Massimo Lusetti
I think I've seen this before but currently I don't remember precisely.
Please check if there's already a jira issue or fire a new if not.


On Mon, Jun 10, 2013 at 3:59 PM, Christian Köberl <
tapestry.christian.koeb...@gmail.com> wrote:

> I encountered a Problem with the "Upload" component since switching to
> Tapestry 5.3 - the page activation context is lost, when the file size
> exceeds UploadSymbols.FILESIZE_MAX.
>
> The setup is quite simple -  a page with a @PageActivationContext
> property and a form with an Upload component in it.
>
> The page is opened with a context. When you upload a file with a size
> greater than the symbol "upload.filesize-max" then the UploadException
> event is triggered - this is caught in the page and the page itself is
> returned. After that the context is lost.
>
> I also tried to return a PageLink with context from the
> UploadException event handler with the same result.
>
> Is this a bug or am I doing something wrong here?
>
> Full code under:
> https://github.com/derkoe/tapestry-upload-test
>
> Relevant snippets here:
> TML:
> 
>Upload File  value="uploadedFile">
>   
> 
>
> Java:
> public class UploadTest
> {
> @PageActivationContext
> @Property
> private String contextValue;
>
> @Property
> private UploadedFile uploadedFile;
>
> @OnEvent("UploadException")
> UploadTest handleException(FileUploadException ex)
> {
> return this;
> }
> }
>
> -
> To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org
> For additional commands, e-mail: users-h...@tapestry.apache.org
>
>


-- 
Massimo Lusetti


How to use checkbox with jquery/datatable

2013-06-21 Thread newbie newbie
Hi,
I am currently using checkbox with grid in Tapestry. With grid, the
t:row="rowData" parameter can be accessed during setCheckbox. But it seems
that t:row="rowData" parameter is null with jquery/datatable. Anyone knows
how to use checkbox with jquery/datatable?


Re: How to pass an Object using t:context

2013-06-21 Thread Lance Java
eventlink does not accept an "encoder" parameter.

You will need to configure this globally by contributing a
ValueEncoderFactory to the ValueEncoderSource service in your AppModule.