Re: Two fundamental questions.

2015-01-20 Thread Cheng Zhang
Hi Thiago,

I just wanted to practice, so there is no specific scenario with my
requirement. Let me try to use the components you mentioned. Many
thanks.

Charles

On Tue, Jan 20, 2015 at 2:44 PM, Thiago H de Paula Figueiredo
 wrote:
> On Tue, 20 Jan 2015 19:27:15 -0200, Cheng Zhang
>  wrote:
>
>> Hi all,
>
>
> Hi!
>
>> I am new to Tapestry. I have two questions.
>
>
> Welcome!
>
>> 1. What is the best solution for Tapestry-Cayenne integration?
>> I found the only project is as below but it looks like no longer
>> developed for over 4 years. And there are no many supporting
>> documents.
>> https://code.google.com/p/tapestry5-cayenne/
>
>
> Never used it myself, but I believe tapestry5-cayenne should still work even
> with the latest Tapestry 5.4 beta.
>
>> 2. I'd like to implement basic CRUD function with a group of data, eg
>> show a list of Person(name, phone, address), update person
>> information, add new person, delete a person from the list.
>> I found there are several components might be used, like Editable
>> Grid, Beaneditform, Editable loop. What is the best/widely used way to
>> do CRUD? (just the java part, do not need to persist to DB).
>
>
> I'm sorry, but the question is too vague. The best option for something will
> always depend on the specific scenario.
> I usually build CRUDs using two pages: one for edition and creation (C and
> U), probably using BeanEditForm or Form and BeanEditor, plus another for the
> R and D parts using Grid.
>
> --
> 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
>

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



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

2015-01-20 Thread George Christman
Thanks Thiago, but I think I'm even more confused now lol It looks
like I confused HOSTPORT_SECURE with SECURE_ENABLED. Anyhow should I
not be using PageRenderLinkSouce? You said to take a look at
ComponentEventLinkEncoder, are you suggesting to take a look at it to
build my own link building method or is there a public interface that
uses ComponentEventLinkEncoder I should be using? If those
configurations are set properly in the appmodule, are you saying it
PageRenderLink source, or ComponentEventLinkENcoder won't use the
Request?

Thanks.

On Tue, Jan 20, 2015 at 4:24 PM, Thiago H de Paula Figueiredo
 wrote:
> On Tue, 20 Jan 2015 19:13:30 -0200, Thiago H de Paula Figueiredo
>  wrote:
>
>> On Tue, 20 Jan 2015 19:03:30 -0200, George Christman
>>  wrote:
>>
>>> So I just took a look at the tapestry code and I'm not seeing anyway
>>> to work around it unless I want to build my own links which I'd rather
>>> not do because of my use of the url rewriter.
>>>
>>> Tap code line 113
>>>
>>>
>>> https://github.com/apache/tapestry-5/blob/5.4-beta-26/tapestry-core/src/main/java/org/apache/tapestry5/internal/services/LinkSourceImpl.java
>>
>>
>> You should take a look at ComponentEventLinkEncoder.createPageRenderLink,
>> which the Link itself is created.
>
>
> Which actually uses the BaseURLSource service (default implementation source
> at
> https://github.com/apache/tapestry-5/blob/5.4-beta-26/tapestry-core/src/main/java/org/apache/tapestry5/internal/services/BaseURLSourceImpl.java).
> If you correctly set the SymbolConstants.HOSTNAME, SymbolConstants.HOSTPORT
> and SymbolConstants.HOSTPORT_SECURE symbols, it won't use the Request, so
> it'll work.
>
>>> On Tue, Jan 20, 2015 at 11:14 AM, George Christman
>>>  wrote:


 configuration.add(SymbolConstants.HOSTNAME, "localhost");
 configuration.add(SymbolConstants.HOSTPORT, "8080");
 configuration.add(SymbolConstants.HOSTPORT_SECURE, "false");
>
>
> SymbolConstants.HOSTPORT_SECURE receives the HTTPS port number, not whether
> you're using HTTPS or not. I don't think you've actually run your webapp or
> your tests with the configuration above applied, because Tapestry-IoC
> wouldn't be able to coerce "false" into an int.
>
>
> --
> Thiago H. de Paula Figueiredo
> Tapestry, Java and Hibernate consultant and developer
> http://machina.com.br
>
> -
> To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org
> For additional commands, e-mail: users-h...@tapestry.apache.org
>



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

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



Re: Two fundamental questions.

2015-01-20 Thread Thiago H de Paula Figueiredo
On Tue, 20 Jan 2015 19:27:15 -0200, Cheng Zhang  
 wrote:



Hi all,


Hi!


I am new to Tapestry. I have two questions.


Welcome!


1. What is the best solution for Tapestry-Cayenne integration?
I found the only project is as below but it looks like no longer
developed for over 4 years. And there are no many supporting
documents.
https://code.google.com/p/tapestry5-cayenne/


Never used it myself, but I believe tapestry5-cayenne should still work  
even with the latest Tapestry 5.4 beta.



2. I'd like to implement basic CRUD function with a group of data, eg
show a list of Person(name, phone, address), update person
information, add new person, delete a person from the list.
I found there are several components might be used, like Editable
Grid, Beaneditform, Editable loop. What is the best/widely used way to
do CRUD? (just the java part, do not need to persist to DB).


I'm sorry, but the question is too vague. The best option for something  
will always depend on the specific scenario.
I usually build CRUDs using two pages: one for edition and creation (C and  
U), probably using BeanEditForm or Form and BeanEditor, plus another for  
the R and D parts using Grid.


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



Two fundamental questions.

2015-01-20 Thread Cheng Zhang
Hi all,

I am new to Tapestry. I have two questions.

1. What is the best solution for Tapestry-Cayenne integration?
I found the only project is as below but it looks like no longer
developed for over 4 years. And there are no many supporting
documents.
https://code.google.com/p/tapestry5-cayenne/

2. I'd like to implement basic CRUD function with a group of data, eg
show a list of Person(name, phone, address), update person
information, add new person, delete a person from the list.
I found there are several components might be used, like Editable
Grid, Beaneditform, Editable loop. What is the best/widely used way to
do CRUD? (just the java part, do not need to persist to DB).

Many thanks.

Charles

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



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

2015-01-20 Thread Thiago H de Paula Figueiredo
On Tue, 20 Jan 2015 19:13:30 -0200, Thiago H de Paula Figueiredo  
 wrote:


On Tue, 20 Jan 2015 19:03:30 -0200, George Christman  
 wrote:



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

Tap code line 113

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


You should take a look at  
ComponentEventLinkEncoder.createPageRenderLink, which the Link itself is  
created.


Which actually uses the BaseURLSource service (default implementation  
source at  
https://github.com/apache/tapestry-5/blob/5.4-beta-26/tapestry-core/src/main/java/org/apache/tapestry5/internal/services/BaseURLSourceImpl.java).  
If you correctly set the SymbolConstants.HOSTNAME,  
SymbolConstants.HOSTPORT and SymbolConstants.HOSTPORT_SECURE symbols, it  
won't use the Request, so it'll work.



On Tue, Jan 20, 2015 at 11:14 AM, George Christman
 wrote:


configuration.add(SymbolConstants.HOSTNAME, "localhost");
configuration.add(SymbolConstants.HOSTPORT, "8080");
configuration.add(SymbolConstants.HOSTPORT_SECURE, "false");


SymbolConstants.HOSTPORT_SECURE receives the HTTPS port number, not  
whether you're using HTTPS or not. I don't think you've actually run your  
webapp or your tests with the configuration above applied, because  
Tapestry-IoC wouldn't be able to coerce "false" into an int.


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

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



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

2015-01-20 Thread Thiago H de Paula Figueiredo
On Tue, 20 Jan 2015 19:03:30 -0200, George Christman  
 wrote:



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

Tap code line 113

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


You should take a look at ComponentEventLinkEncoder.createPageRenderLink,  
which the Link itself is created.




How do you work around this?

On Tue, Jan 20, 2015 at 11:14 AM, George Christman
 wrote:
 Still no success in getting this to work. I've contributed the  
Hostname etc.


configuration.add(SymbolConstants.HOSTNAME, "localhost");
configuration.add(SymbolConstants.HOSTPORT, "8080");
configuration.add(SymbolConstants.HOSTPORT_SECURE, "false");

And a simple test which fails with the same error.

private void testTask() {
periodicExecutor.addJob(new IntervalSchedule(3000),
"Data Validation1", new Runnable() {
@Override
public void run() {
System.out.println("test");
try {

System.out.println(linkSource.createPageRenderLink(Index.class));
} catch (Exception ex) {
System.out.println("ex " + ex);
}
}
});
}

On Tue, Jan 20, 2015 at 7:41 AM, George Christman
 wrote:

So toAbsolute is the code calling the request and the cause of this
exception? I'm assuming your referring to me contributing those values  
to my
appmodule. Once I contribute those values, would toAbsolute use those  
values
instead of the request? Just trying to understand the issue a little  
bit

better. Thanks Kalle.

On Jan 20, 2015 4:44 AM, "Kalle Korhonen" 
wrote:


On Tue, Jan 20, 2015 at 1:23 AM, George Christman

wrote:

> I'm using T5 beta-25 and I have the following code and I'm noticing
> when the scheduler fires off my service, my PageRenderLinkSource  
does

> not work. If I manually fire it off through the admin with an
> actionlink, it works without issue.
> I'm seeing the following exception
> java.lang.NullPointerException: Unable to delegate method invocation
> to property 'request' of > RequestGlobals(org.apache.tapestry5.services.RequestGlobals)>,  
because

> the property is null.
> Any idea why this isn't working?
>

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

and
HOSTPORT_SECURE and you can generate absolute urls without resorting  
to

reading the values from the request.

Kalle



>
>  
-

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




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







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

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



Re: HibernateEntityValueEncoder NullPointerException - Composite/Compund Primary Key Issue

2015-01-20 Thread Thiago H de Paula Figueiredo
On Tue, 20 Jan 2015 17:43:35 -0200, Witt, Aaron  
 wrote:



Hi Tapestry Users,


Hi!

I'm using a CRUD framework called Tynamo, which in turn relies on Apache  
Tapestry and Hibernate. This all works fine, except for when I try to  
use it for CRUD on a table with a composite/compound primary key.


The tapestry-hibernate's provided ValueEncoder for entities doesn't  
support composite primary keys.


Unless you're dealing with legacy databases, in my  
humble opinion, a composite primary key is always a very bad  
choice.


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

You can see my class below:

package com.company.crud.entities;



import java.io.Serializable;



import javax.persistence.Column;

import javax.persistence.Entity;

import javax.persistence.Id;

import javax.persistence.IdClass;



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



@Entity(name = "Transfer_Extensions")

@IdClass(TransferExtensionPK.class)

public class TransferExtension implements Serializable {

private static final long serialVersionUID = 1L;



@Id

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

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

@Column(name = "Division", nullable = false)

private String scriptCode;



@Id

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

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

@Column(name = "Transfer_Type", nullable = false)

private String transferType;



@Column(name = "Extension", nullable = true)

private String englishExtension;



@Column(name = "Span_Extension", nullable = true)

private String spanishExtension;



@Column(name = "Call_Type", nullable = true)

private String callType;



@Column(name = "Call_Center", nullable = true)

private String callCenter;



public TransferExtension() {

}



public TransferExtension(String scriptCode, String transferType,

String englishExtension, String spanishExtension, String  
callType,


String callCenter) {



this.callCenter = callCenter;

this.callType = callType;

this.englishExtension = englishExtension;

this.scriptCode = scriptCode;

this.spanishExtension = spanishExtension;

this.transferType = transferType;

}



public String getScriptCode() {

return this.scriptCode;

}



public void setScriptCode(String scriptCode) {

this.scriptCode = scriptCode;

}



public String getTransferType() {

return this.transferType;

}



public void setTransferType(String transferType) {

this.transferType = transferType;

}



public String getEnglishExtension() {

return this.englishExtension;

}



public void setEnglishExtension(String englishExtension) {

this.englishExtension = englishExtension;

}



public String getSpanishExtension() {

return this.spanishExtension;

}



public void setSpanishExtension(String spanishExtension) {

this.spanishExtension = spanishExtension;

}



public String getCallType() {

return this.callType;

}



public void setCallType(String callType) {

this.callType = callType;

}



public String getCallCenter() {

return this.callCenter;

}



public void setCallCenter(String callCenter) {

this.callCenter = callCenter;

}



@Override

public String toString() {

StringBuilder builder = new StringBuilder();

builder.append("TransferExtension [scriptCode=")

.append(this.scriptCode).append(", transferType=")

.append(this.transferType).append(", englishExtension=")

.append(this.englishExtension).append(",  
spanishExtension=")


.append(this.spanishExtension).append(", callType=")

.append(this.callType).append(", callCenter=")

.append(this.callCenter).append("]");

return builder.toString();

}



public static class TransferExtensionPK impl

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

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

Tap code line 113

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

How do you work around this?

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



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

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



HibernateEntityValueEncoder NullPointerException - Composite/Compund Primary Key Issue

2015-01-20 Thread Witt, Aaron
Hi Tapestry Users,

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

package com.company.crud.entities;



import java.io.Serializable;



import javax.persistence.Column;

import javax.persistence.Entity;

import javax.persistence.Id;

import javax.persistence.IdClass;



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



@Entity(name = "Transfer_Extensions")

@IdClass(TransferExtensionPK.class)

public class TransferExtension implements Serializable {

private static final long serialVersionUID = 1L;



@Id

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

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

@Column(name = "Division", nullable = false)

private String scriptCode;



@Id

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

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

@Column(name = "Transfer_Type", nullable = false)

private String transferType;



@Column(name = "Extension", nullable = true)

private String englishExtension;



@Column(name = "Span_Extension", nullable = true)

private String spanishExtension;



@Column(name = "Call_Type", nullable = true)

private String callType;



@Column(name = "Call_Center", nullable = true)

private String callCenter;



public TransferExtension() {

}



public TransferExtension(String scriptCode, String transferType,

String englishExtension, String spanishExtension, String callType,

String callCenter) {



this.callCenter = callCenter;

this.callType = callType;

this.englishExtension = englishExtension;

this.scriptCode = scriptCode;

this.spanishExtension = spanishExtension;

this.transferType = transferType;

}



public String getScriptCode() {

return this.scriptCode;

}



public void setScriptCode(String scriptCode) {

this.scriptCode = scriptCode;

}



public String getTransferType() {

return this.transferType;

}



public void setTransferType(String transferType) {

this.transferType = transferType;

}



public String getEnglishExtension() {

return this.englishExtension;

}



public void setEnglishExtension(String englishExtension) {

this.englishExtension = englishExtension;

}



public String getSpanishExtension() {

return this.spanishExtension;

}



public void setSpanishExtension(String spanishExtension) {

this.spanishExtension = spanishExtension;

}



public String getCallType() {

return this.callType;

}



public void setCallType(String callType) {

this.callType = callType;

}



public String getCallCenter() {

return this.callCenter;

}



public void setCallCenter(String callCenter) {

this.callCenter = callCenter;

}



@Override

public String toString() {

StringBuilder builder = new StringBuilder();

builder.append("TransferExtension [scriptCode=")

.append(this.scriptCode).append(", transferType=")

.append(this.transferType).append(", englishExtension=")

.append(this.englishExtension).append(", spanishExtension=")

.append(this.spanishExtension).append(", callType=")

.append(this.callType).append(", callCenter=")

.append(this.callCenter).append("]");

return builder.toString();

}



public static class TransferExtensionPK implements Serializable {

private static final long serialVersionUID = 4L;



private String scriptCode;

private String transferType;



public TransferExtensionPK() {

}



public TransferExtensionPK(String scriptCode, String transferType) {



this.scriptCode = sc

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

2015-01-20 Thread George Christman
 Still no success in getting this to work. I've contributed the Hostname etc.

configuration.add(SymbolConstants.HOSTNAME, "localhost");
configuration.add(SymbolConstants.HOSTPORT, "8080");
configuration.add(SymbolConstants.HOSTPORT_SECURE, "false");

And a simple test which fails with the same error.

private void testTask() {
periodicExecutor.addJob(new IntervalSchedule(3000),
"Data Validation1", new Runnable() {
@Override
public void run() {
System.out.println("test");
try {

System.out.println(linkSource.createPageRenderLink(Index.class));
} catch (Exception ex) {
System.out.println("ex " + ex);
}
}
});
}

On Tue, Jan 20, 2015 at 7:41 AM, George Christman
 wrote:
> So toAbsolute is the code calling the request and the cause of this
> exception? I'm assuming your referring to me contributing those values to my
> appmodule. Once I contribute those values, would toAbsolute use those values
> instead of the request? Just trying to understand the issue a little bit
> better. Thanks Kalle.
>
> On Jan 20, 2015 4:44 AM, "Kalle Korhonen" 
> wrote:
>>
>> On Tue, Jan 20, 2015 at 1:23 AM, George Christman
>> 
>> wrote:
>>
>> > I'm using T5 beta-25 and I have the following code and I'm noticing
>> > when the scheduler fires off my service, my PageRenderLinkSource does
>> > not work. If I manually fire it off through the admin with an
>> > actionlink, it works without issue.
>> > I'm seeing the following exception
>> > java.lang.NullPointerException: Unable to delegate method invocation
>> > to property 'request' of > > RequestGlobals(org.apache.tapestry5.services.RequestGlobals)>, because
>> > the property is null.
>> > Any idea why this isn't working?
>> >
>>
>> Naturally, you don't have a request to work with when you are executing
>> from a cron job. But if you just want to generate links, you don't need to
>> and you shouldn't use the request values. Contribute HOSTNAME, HOSTPORT
>> and
>> HOSTPORT_SECURE and you can generate absolute urls without resorting to
>> reading the values from the request.
>>
>> Kalle
>>
>>
>>
>> >
>> > -
>> > To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org
>> > For additional commands, e-mail: users-h...@tapestry.apache.org
>> >
>> >



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

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



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

2015-01-20 Thread George Christman
So toAbsolute is the code calling the request and the cause of this
exception? I'm assuming your referring to me contributing those values to
my appmodule. Once I contribute those values, would toAbsolute use those
values instead of the request? Just trying to understand the issue a little
bit better. Thanks Kalle.
On Jan 20, 2015 4:44 AM, "Kalle Korhonen" 
wrote:

> On Tue, Jan 20, 2015 at 1:23 AM, George Christman  >
> wrote:
>
> > I'm using T5 beta-25 and I have the following code and I'm noticing
> > when the scheduler fires off my service, my PageRenderLinkSource does
> > not work. If I manually fire it off through the admin with an
> > actionlink, it works without issue.
> > I'm seeing the following exception
> > java.lang.NullPointerException: Unable to delegate method invocation
> > to property 'request' of  > RequestGlobals(org.apache.tapestry5.services.RequestGlobals)>, because
> > the property is null.
> > Any idea why this isn't working?
> >
>
> Naturally, you don't have a request to work with when you are executing
> from a cron job. But if you just want to generate links, you don't need to
> and you shouldn't use the request values. Contribute HOSTNAME, HOSTPORT and
> HOSTPORT_SECURE and you can generate absolute urls without resorting to
> reading the values from the request.
>
> Kalle
>
>
>
> >
> > -
> > To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org
> > For additional commands, e-mail: users-h...@tapestry.apache.org
> >
> >
>


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

2015-01-20 Thread Kalle Korhonen
On Tue, Jan 20, 2015 at 1:23 AM, George Christman 
wrote:

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

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

Kalle



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


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

2015-01-20 Thread George Christman
I'm using T5 beta-25 and I have the following code and I'm noticing
when the scheduler fires off my service, my PageRenderLinkSource does
not work. If I manually fire it off through the admin with an
actionlink, it works without issue.

AppModule.class

@Startup
public static void initApplication(SchedulerService scheduler) {
scheduler.init();
}

SchedulerService.class

executor.addJob(new CronSchedule("0 09 4 * * ?"),
"Cleanup Listings", () -> {
try {
System.out.println("sitemap");
sitemap.buildSitemap();
} catch (JAXBException | IOException ex) {

Logger.getLogger(SchedulerServiceImpl.class.getName()).log(Level.SEVERE,
null, ex);
}
});


SitemapService.class

   private final PageRenderLinkSource linkSource;

public SitemapImpl(PageRenderLinkSource linkSource) {
this.linkSource = linkSource;
}

private void setSitemapXML(Class clazz, UrlSet urlset, Object[] object) {
SitemapXML siteMapXML = new SitemapXML();
System.out.println("link");

Link link = linkSource.createPageRenderLinkWithContext(clazz, object);
System.out.println(link.toAbsoluteURI());

link.setSecurity(LinkSecurity.SECURE);
siteMapXML.setChangefreq(ChangeFreq.ALWAYS.toString());
siteMapXML.setLoc(link.toAbsoluteURI());
siteMapXML.setPriority(0.5);
urlset.getSitemaps().add(siteMapXML);
}

I'm seeing the following exception
java.lang.NullPointerException: Unable to delegate method invocation
to property 'request' of , because
the property is null.

Any idea why this isn't working?

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