Re: Tapestry onActivate messes up after submitting a form

2014-09-08 Thread Thiago H de Paula Figueiredo
On Mon, 08 Sep 2014 18:21:42 -0300, Boris Horvat  
 wrote:



Hi all,


Hi!

I have an onActivate(MyObject) method, when I go to the page for the  
first time and context is present everything is triggered properly. The  
url is

something like

localhost:8080/mypage/1

However when I submit my form, and process it, page reloads and my id is
now treated as a String that fails to be converted into object. Is this
behaviour expected? Do I need to add something special into the form to
keep context properly passed?


Have you contributed a ValueEncoder for MyObject? What's the page's  
onPassivate() method? Or are you using @PageActivationContext?


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

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



Tapestry onActivate messes up after submitting a form

2014-09-08 Thread Boris Horvat
Hi all,

I have an onActivate(MyObject) method, when I go to the page for the first
time and context is present everything is triggered properly. The url is
something like

localhost:8080/mypage/1

However when I submit my form, and process it, page reloads and my id is
now treated as a String that fails to be converted into object. Is this
behaviour expected? Do I need to add something special into the form to
keep context properly passed?

Thanks

-- 
Sincerely
*Boris Horvat*


Re: Forms require that the request method be POST and that the t:formdata query parameter have values

2014-09-08 Thread Lance Java
Most likely a bot crawling your site. You may choose to suppress this
logging for crawlers. This can be done by maintaining a list of crawler
user agents and checking the user agent request header before logging.


Re: dynamic upload buttons

2014-09-08 Thread Lance Java
There's two concepts here:
1. The object being iterated by the AjaxFormLoop
2. The UploadedFile property binding

1 can't be null, 2 can be null (in onAdd).

I'd probably create a wrapper bean for the iteration and use a custom
ValueEncoder. eg:
http://tinyurl.com/nx895tw
 On 8 Sep 2014 09:14, "squallmat ."  wrote:

> Hi Lance, Thanks for your answer.
> I tried to use a null value, but when trying to "onAdd" I got :
>
> Event handler for event 'addRow' from NouvelApplicatif:docfiles should have
> returned a non-null value.
>
>
> So it seems you can't use a null value. I need to do a list of dynamic
> (add/remove) upload files and if I can't instantiate them in the controller
> code I don't see how I can do it. Any suggestion ?
>
> 2014-09-07 12:22 GMT+02:00 Lance Java :
>
> > The UploadedFile is instantiated by tapestry when the form is posted so
> it
> > should be OK to bind to a null property for "onAdd".
> >  On 7 Sep 2014 02:50, "squallmat ."  wrote:
> >
> > > Hi,
> > >
> > > I'm trying to put dynamic multiple upload buttons in Tapestry with an
> > > AjaxFormLoop component.
> > >
> > > But in the "onAdd" event where you have to create a new UploadedFile
> > Object
> > > and return it, it doesn't seems to have any method to do that, because
> > > UploadedFile can't be instantiated by a new.
> > > Is there a way to instantiate dynamically, in the java class of my
> .tml,
> > a
> > > new UploadedFile ?
> > >
> > > Or is there another way to achieve what I want ?
> > >
> >
>


Re: [tapestry5-jquery] jquery.palette bug in production mode

2014-09-08 Thread TNO

Hi,

I found the problem !
When I start using tapestry5-jquery, I replace all my

|@Import(library = {"classpath:org/.../jquery.js"})
|

with

|@Import(library = {"${jquery.core.path}"})
|

No problem in dev mode, but in production mode, problem with palette 
(and may be others...)


So I remove all ${jquery.core.path} and it works !

Thnaks, Thomas



Le 01/09/2014 17:10, françois facon a écrit :

Hi
I tried to reproduce the problem without success on the 3.4.1-snapshot.
Have you tested this version?
please post you comments to
https://github.com/got5/tapestry5-jquery/issues/335

François


2014-08-30 21:25 GMT+02:00 TNO :


Hi,

I'm using

  * tapestry 5.3.7
  * tapestry5-jquery 3.3.7
  * a simple form (login, password and list of role), a jquery.palette
is used to choose the roles.

It works when PRODUCTION_MODE is set to false, but my role list is always
null when PRODUCTION_MODE = true.

Using Firebug, I saw

  * When PRODUCTION_MODE=true and I select an item, the value of hidden
pallette-value doesn't fill with it

|
|

  * So in Pallette java, parameterValue is always null

| @Override
 protected void processSubmission(String controlName)
 {
 String parameterValue = request.getParameter(controlName +
"-values");
|

But when PRODUCTION_MODE=false, it's OK

Another problem in production mode, when I click on plus arrow, a submit
is launched...


thanks for any help, Thomas






Re: Forms require that the request method be POST and that the t:formdata query parameter have values

2014-09-08 Thread Dmitry Gusev
Hi,

That could be an autocomplete feature of browser's address bar -- which
autocompletes form's submission URL.

Or it could be that user submits a form and it takes too long to process
it, and during that time user clicks to browser's address bar and hits
Enter (which issues HTTP GET request).


On Mon, Sep 8, 2014 at 1:17 PM, Marcel Huber  wrote:

> Hi,
>
> We use Tapestry 5.2.6 and we have this Exception quite often in our logs:
> [2014-09-07 21:18:27,951][ERROR] AppModuleBase.FFRequestExceptionHandler
> [qe-shop] Processing of request failed with uncaught exception: Forms
> require that the request method be POST and that the t:formdata query
> parameter have values.
> org.apache.tapestry5.ioc.internal.OperationException: Forms require that
> the request method be POST and that the t:formdata query parameter have
> values. [at
> classpath:ch/fashionfriends/client/http/pages/checkout/CheckoutBasket.tml,
> line 11]
> at
>
> org.apache.tapestry5.ioc.internal.OperationTrackerImpl.logAndRethrow(OperationTrackerImpl.java:102)…
> …
> [2014-09-07 21:18:27,955][ERROR] layout.ExceptionReportHandler [qe-shop]
> ffReportException: [org.apache.tapestry5.ioc.internal.OperationException:
> Forms require that the request method be POST and that the t:formdata query
> parameter have values. [at
> classpath:ch/fashionfriends/client/http/pages/checkout/CheckoutBasket.tml,
> line 11]] caused by uri [/de/checkout/basket.basketform] [MUser [@7ada6333]
>  artificialId=2efaf248-1f54-4b2e-afe5-dbcdcc3c1609,
> instanceId=ClientID[748], lastInstanceUpdate=1410116735467>, firstName=,
> middleName=, lastName=, roles=null, loggedIn=false>] User-Agent
> [Mozilla/5.0 (Linux; U; Android 4.1.2; de-de; GT-I8190N Build/JZO54K)
> AppleWebKit/534.30 (KHTML, like Gecko) Version/4.0 Mobile Safari/534.30]
> Referer [null]
>
> We can't explain, where this exception is comming from and how to fix it.
> All we know is, there are mostly Safari user and it happens on all forms
> and it's not bot problem.
>
> Does anybody have a idee what that is and what we can do to fix it?
>
> thx
>
> --
> Marcel
> owns his style.
>
> Application Engineer
>



-- 
Dmitry Gusev

AnjLab Team
http://anjlab.com


Forms require that the request method be POST and that the t:formdata query parameter have values

2014-09-08 Thread Marcel Huber
Hi,

We use Tapestry 5.2.6 and we have this Exception quite often in our logs:
[2014-09-07 21:18:27,951][ERROR] AppModuleBase.FFRequestExceptionHandler
[qe-shop] Processing of request failed with uncaught exception: Forms
require that the request method be POST and that the t:formdata query
parameter have values.
org.apache.tapestry5.ioc.internal.OperationException: Forms require that
the request method be POST and that the t:formdata query parameter have
values. [at
classpath:ch/fashionfriends/client/http/pages/checkout/CheckoutBasket.tml,
line 11]
at
org.apache.tapestry5.ioc.internal.OperationTrackerImpl.logAndRethrow(OperationTrackerImpl.java:102)…
…
[2014-09-07 21:18:27,955][ERROR] layout.ExceptionReportHandler [qe-shop]
ffReportException: [org.apache.tapestry5.ioc.internal.OperationException:
Forms require that the request method be POST and that the t:formdata query
parameter have values. [at
classpath:ch/fashionfriends/client/http/pages/checkout/CheckoutBasket.tml,
line 11]] caused by uri [/de/checkout/basket.basketform] [MUser [@7ada6333]
, firstName=,
middleName=, lastName=, roles=null, loggedIn=false>] User-Agent
[Mozilla/5.0 (Linux; U; Android 4.1.2; de-de; GT-I8190N Build/JZO54K)
AppleWebKit/534.30 (KHTML, like Gecko) Version/4.0 Mobile Safari/534.30]
Referer [null]

We can't explain, where this exception is comming from and how to fix it.
All we know is, there are mostly Safari user and it happens on all forms
and it's not bot problem.

Does anybody have a idee what that is and what we can do to fix it?

thx

-- 
Marcel
owns his style.

Application Engineer


FW: dynamic component example / question

2014-09-08 Thread Макаров Роман

I thought I may use date as an indicator, so the cached parsed template will 
reset if this date changes (the code is below). It looks like I mistaken, and 
the “toUrl” method should return null, right?
But this is not solving my problem. StringResource implementation is very 
simply, I do not see where the issue can persist.
Regarding ClasspathResource, is this the same as using ordinary tapestry 
mechanism? If yes, then it works.



/**
* The class is for use with DynamicTemplateParser
*
* Created with IntelliJ IDEA.
* User: r.makarov
* Date: 05.09.14
* Time: 17:40
*/
public class StringResource implements Resource {

private String tml;
private URL cacheKey;

/**
 * @param tml - template to be rendered
 * @param lastModificationTime - parameter to watch, to reset cache it 
changes
 */
public StringResource(String tml, Date lastModificationTime) {
this.tml = tml;
try {
this.cacheKey = new URL("http://dynamic/"; + 
lastModificationTime.getTime());
} catch (MalformedURLException e) {
this.cacheKey = null;
}
}

@Override
public boolean exists() {
return false;
}

@Override
public InputStream openStream() throws IOException {
return new ByteArrayInputStream(tml.getBytes("UTF-8"));
}

@Override
public URL toURL() {
return cacheKey;
}

@Override
public Resource forLocale(Locale locale) {
return null;
}

@Override
public Resource forFile(String relativePath) {
return null;
}

@Override
public Resource withExtension(String extension) {
return null;
}

@Override
public String getFolder() {
return null;
}

@Override
public String getFile() {
return null;
}

@Override
public String getPath() {
return null;
}
}

From: Lance Java [mailto:lance.j...@googlemail.com]
Sent: Monday, September 08, 2014 12:13 PM
To: Макаров Роман
Subject: Re: dynamic component example / question


Try getting it working first with ClasspathResource and a file on the 
classpath. If that works, it's probably an issue with your StringResource.

What's the date for?
On 8 Sep 2014 07:40, "Макаров Роман" 
mailto:roman.maka...@kupivip.ru>> wrote:
Hello all!

The dynamic component almost works for me. But in the output it is erroneously 
giving me “container” tag. How can I get rid of it?


The output:

http://tapestry.apache.org/schema/tapestry_5_3.xsd";>


The code:

package ru.kupivip.ecommerce.components;

import org.apache.tapestry5.annotations.Property;
import org.apache.tapestry5.ioc.annotations.InjectService;
import org.apache.tapestry5.services.dynamic.DynamicTemplate;
import org.apache.tapestry5.services.dynamic.DynamicTemplateParser;
import ru.kupivip.utils.StringResource;

import java.util.Date;

/**
* Created with IntelliJ IDEA.
* User: r.makarov
* Date: 04.09.14
* Time: 15:03
*/
public class TrackerDynamic extends Tracker {


@Property
private DynamicTemplate dynamicTemplate;

public String getTestString() {
return "";
}

@InjectService("DynamicTemplateParser")
DynamicTemplateParser dynamicTemplateParser;

private String getTemplateString() {
StringBuilder sb = new StringBuilder(
"http://tapestry.apache.org/schema/tapestry_5_3.xsd\"
 xmlns:p=\"tapestry:parameter\">");
sb.append("${getTestString()}");
sb.append("");
return sb.toString();
}

@Override
void beginRender() {
super.beginRender();

dynamicTemplate = dynamicTemplateParser.parseTemplate(
new StringResource(getTemplateString(), new Date())
);

}
}





Re: dynamic upload buttons

2014-09-08 Thread squallmat .
Hi Lance, Thanks for your answer.
I tried to use a null value, but when trying to "onAdd" I got :

Event handler for event 'addRow' from NouvelApplicatif:docfiles should have
returned a non-null value.


So it seems you can't use a null value. I need to do a list of dynamic
(add/remove) upload files and if I can't instantiate them in the controller
code I don't see how I can do it. Any suggestion ?

2014-09-07 12:22 GMT+02:00 Lance Java :

> The UploadedFile is instantiated by tapestry when the form is posted so it
> should be OK to bind to a null property for "onAdd".
>  On 7 Sep 2014 02:50, "squallmat ."  wrote:
>
> > Hi,
> >
> > I'm trying to put dynamic multiple upload buttons in Tapestry with an
> > AjaxFormLoop component.
> >
> > But in the "onAdd" event where you have to create a new UploadedFile
> Object
> > and return it, it doesn't seems to have any method to do that, because
> > UploadedFile can't be instantiated by a new.
> > Is there a way to instantiate dynamically, in the java class of my .tml,
> a
> > new UploadedFile ?
> >
> > Or is there another way to achieve what I want ?
> >
>