Re: Access a T5 app through both http (Tomcat) and https (Apache httpd + AJP + Tomcat)

2015-02-11 Thread Martin Nagl
Setting tapestry.secure-enabled to "false" and removing @Secure annotations
solved my problem.
Internal users can acces Tomcat directly via HTTP.
External users can access Apache httpd via HTTPS, which handles SSL and
forwards the request to Tomcat (via AJP).

Works nicely now when Tapestry does not redirect between http and https .

Thans for your advice.
Regards
Martin


Re: Access a T5 app through both http (Tomcat) and https (Apache httpd + AJP + Tomcat)

2015-02-11 Thread Martin Nagl
On Thu, Feb 5, 2015 at 5:01 PM, Martin Nagl  wrote:

> Aha, sorry for the "hardcoded" part, I can see that the number 80 is only
> used to determine whether to include port in URL or not :) Will try to
> provide HOSTPORT instead.
>
> M.
>
> On Thu, Feb 5, 2015 at 4:53 PM, Martin Nagl  wrote:
>
>> I am using Tapestry 5.3.6.
>>
>> I have not overridden BaseURLSource or anything simmilar.
>> I have not provided HOSTPORT or HOSTPORT_SECURE.
>>
>> Looking at the code in BaseURLSourceImpl, maybe my problem is that http
>> communication goes on port 8080, not 80 as expected (hardcoded in
>> BaseURLSourceImpl). I will try to experiment more with the settings above
>> and figure out how to test it on my local machine.
>>
>> Regards
>> Martin
>>
>
>


Re: Access a T5 app through both http (Tomcat) and https (Apache httpd + AJP + Tomcat)

2015-02-05 Thread Martin Nagl
Aha, sorry for the "hardcoded" part, I can see that the number 80 is only
used to determine whether to include port in URL or not :) Will try to
provide HOSTPORT instead.

M.

On Thu, Feb 5, 2015 at 4:53 PM, Martin Nagl  wrote:

> I am using Tapestry 5.3.6.
>
> I have not overridden BaseURLSource or anything simmilar.
> I have not provided HOSTPORT or HOSTPORT_SECURE.
>
> Looking at the code in BaseURLSourceImpl, maybe my problem is that http
> communication goes on port 8080, not 80 as expected (hardcoded in
> BaseURLSourceImpl). I will try to experiment more with the settings above
> and figure out how to test it on my local machine.
>
> Regards
> Martin
>


Re: Access a T5 app through both http (Tomcat) and https (Apache httpd + AJP + Tomcat)

2015-02-05 Thread Martin Nagl
I am using Tapestry 5.3.6.

I have not overridden BaseURLSource or anything simmilar.
I have not provided HOSTPORT or HOSTPORT_SECURE.

Looking at the code in BaseURLSourceImpl, maybe my problem is that http
communication goes on port 8080, not 80 as expected (hardcoded in
BaseURLSourceImpl). I will try to experiment more with the settings above
and figure out how to test it on my local machine.

Regards
Martin


Access a T5 app through both http (Tomcat) and https (Apache httpd + AJP + Tomcat)

2015-02-05 Thread Martin Nagl
Hi all,

we have a Tapesty5 application deployed on Tomcat + Apache httpd. In
production environment at our customer, the application should be deployed
/ accessed like this:
  - Tomcat is running on a server in internal network on port 8080.
  - There is an Apache HTTP server with reverse proxy to Tomcat (AJP)
accessible from the internet on port 80.
  - Internal users should access the application on Tomcat directly without
https on http://servername.intranet.customer.sk:8080/appname/login
  - External users should access the application through Apache httpd, with
https, on https://apps.customer.sk/appname/login

1. Initiallly, I had no @Secure annotations on my pages. The application
worked correctly from internal network, but not from internet. From
internet, I could access the login page through https, but after submit, I
get somehow redirected to http which ends with server error: Your browser
sent a request that this server could not understand.
Reason: You're speaking plain HTTP to an SSL-enabled server port.
Instead use the HTTPS scheme to access this URL, please.

2. I have annotated all my pages with @Secure. The aplication now works
correctly from internet, but not from internal network. From internal
network, I can access
http://servername.intranet.customer.sk:8080/appname/login but I get
redirected to https at
https://servername.intranet.customer.sk:8080/appname/login. - This is not
desired, I would like the application to continue in http mode.

Is this setup possible with a Tapestry5 application (a single deployed
instance)?
Is there some way to tell Tapestry "If you're accessed through https, then
serve all pages through https, else if you're accessed through http, then
serve all pages through http"?

Thanks
Regards
Martin


Re: T5.4 - spinner zone overlay

2014-03-21 Thread Martin Nagl
I found the solution. The event I was looking for is "events.zone.refresh".
See where it is triggered in module "t5/core/zone".

@Lenny Primak
Thanx for pointing out the T5.4 branch of Flowlogix library, I didn't
notice it at first. Your mixin "ZoneLoadingSpinner" is exactly what I need,
but there is one bug you may want to fix: in file spinner-zone-overlay.js
on line 35 you need to change "events.zone.willUpdate" to
"events.zone.refresh".
With this fix, the mixin adds a spinner overlay for all of these cases:
- Zone update triggered by actionLink / eventLink
- Zone update triggered by form submit
- Grid inplace update after click on paging link
- Grid inplace update after click on sorting link
- (I didn't test other cases)

Thanx for sharing your code :)
Martin











On Thu, Mar 20, 2014 at 1:28 PM, Martin Nagl  wrote:

> In T5.4, the event "t5:zone:did-update" fires only after zone has been
> updated, which is too late to add overlay to the zone.
>
> I need to add the zone overlay just after user clicks on a ajax-enabled
> EventLink / ActionLink (including paging and sorting links in Grid), or
> just after user submits an ajax-enabled Form - before server starts
> processing the request (which may take a few seconds).
>
> In T5.3, one could attach to Tapestry.TRIGGER_ZONE_UPDATE_EVENT, which was
> being fired before request was sent to server, so it was suitable for this
> case. In T5.4, looking at module "t5/core/events" I found no event which
> would fire before an ajax request for zone update is sent to server.
>
> Maybe a different approach is needed?
>
>
>
>


Re: T5.4 - spinner zone overlay

2014-03-20 Thread Martin Nagl
In T5.4, the event "t5:zone:did-update" fires only after zone has been
updated, which is too late to add overlay to the zone.

I need to add the zone overlay just after user clicks on a ajax-enabled
EventLink / ActionLink (including paging and sorting links in Grid), or
just after user submits an ajax-enabled Form - before server starts
processing the request (which may take a few seconds).

In T5.3, one could attach to Tapestry.TRIGGER_ZONE_UPDATE_EVENT, which was
being fired before request was sent to server, so it was suitable for this
case. In T5.4, looking at module "t5/core/events" I found no event which
would fire before an ajax request for zone update is sent to server.

Maybe a different approach is needed?


T5.4 - spinner zone overlay

2014-03-20 Thread Martin Nagl
Hi all,

I am trying to implement a "loading" indicator for zone updates in Tapestry
5.4. Something like this, but for T5.4:
http://code.google.com/p/flowlogix/source/browse/tapestry-services/src/main/resources/com/flowlogix/web/mixins/spinner-zone-overlay.js

In T5.3 you can use:
$(document.body).on(Tapestry.TRIGGER_ZONE_UPDATE_EVENT, addZoneOverlay)

Is there a corresponding event in T5.4? I only found "events.zone.update",
which is triggered when zone is being updated.

Has anybody tried to implement this in T5.4?

Thanks
Martin


Re: using tapx-templating with T5.4

2013-12-06 Thread Martin Nagl
Thanx for the guidance. I tried out tapestry-offline and it works very
nicely for me, I think I will stick with this one.

I had one configuration problem with tapestry-offline (maybe a bug?):

I was getting exception when GZIP compression was turned on (full stack
trace below).
When I turned off gzip compression in my AppModule, the exception
disappeared: configuration.add(SymbolConstants.GZIP_COMPRESSION_ENABLED,
false);

Full stack trace:
Caused by: java.lang.NullPointerException: Unable to delegate method
invocation to property 'HTTPServletRequest' of , because the
property is null.
at $HttpServletRequest_5af77769928a.readProperty(Unknown Source)
at $HttpServletRequest_5af77769928a.getProtocol(Unknown Source)
at $HttpServletRequest_5af777699289.getProtocol(Unknown Source)
at
org.apache.tapestry5.internal.services.ResponseCompressionAnalyzerImpl.isGZipSupported(ResponseCompressionAnalyzerImpl.java:50)
at
org.apache.tapestry5.internal.services.ResponseCompressionAnalyzerImpl.isGZipEnabled(ResponseCompressionAnalyzerImpl.java:75)
at $ResponseCompressionAnalyzer_5af777699283.isGZipEnabled(Unknown
Source)
at
org.apache.tapestry5.internal.services.AbstractAssetFactory.isCompressable(AbstractAssetFactory.java:58)
at
org.apache.tapestry5.internal.services.AbstractAssetFactory$1.toClientURL(AbstractAssetFactory.java:89)
at
org.apache.tapestry5.internal.services.javascript.JavaScriptStackPathConstructorImpl$1.map(JavaScriptStackPathConstructorImpl.java:54)
at
org.apache.tapestry5.internal.services.javascript.JavaScriptStackPathConstructorImpl$1.map(JavaScriptStackPathConstructorImpl.java:51)
at
org.apache.tapestry5.func.LazyMappedValue.get(LazyMappedValue.java:31)
at org.apache.tapestry5.func.LazyFlow.first(LazyFlow.java:52)
at org.apache.tapestry5.func.AbstractFlow$1.next(AbstractFlow.java:62)
at
org.apache.tapestry5.func.AbstractFlow.toMutableList(AbstractFlow.java:41)
at
org.apache.tapestry5.func.AbstractFlow.toMutableList(AbstractFlow.java:34)
at org.apache.tapestry5.func.AbstractFlow.toList(AbstractFlow.java:199)
at
org.apache.tapestry5.internal.services.javascript.JavaScriptStackPathConstructorImpl.toPaths(JavaScriptStackPathConstructorImpl.java:98)
at
org.apache.tapestry5.internal.services.javascript.JavaScriptStackPathConstructorImpl.constructPathsForJavaScriptStack(JavaScriptStackPathConstructorImpl.java:91)
at
$JavaScriptStackPathConstructor_5af77769930e.constructPathsForJavaScriptStack(Unknown
Source)
at
org.apache.tapestry5.internal.services.ajax.JavaScriptSupportImpl.addAssetsFromStack(JavaScriptSupportImpl.java:361)
at
org.apache.tapestry5.internal.services.ajax.JavaScriptSupportImpl.importStack(JavaScriptSupportImpl.java:414)
at
org.apache.tapestry5.modules.TapestryModule$29.renderMarkup(TapestryModule.java:1797)
at $MarkupRenderer_5af77769930f.renderMarkup(Unknown Source)
at
org.apache.tapestry5.modules.TapestryModule$28.renderMarkup(TapestryModule.java:1785)
at $MarkupRenderer_5af77769930f.renderMarkup(Unknown Source)
at
org.apache.tapestry5.modules.TapestryModule$27.renderMarkup(TapestryModule.java:1769)
at $MarkupRenderer_5af77769930f.renderMarkup(Unknown Source)
at
org.apache.tapestry5.modules.TapestryModule$26.renderMarkup(TapestryModule.java:1753)
at $MarkupRenderer_5af77769930f.renderMarkup(Unknown Source)
at
org.apache.tapestry5.modules.JavaScriptModule$1.renderMarkup(JavaScriptModule.java:237)
at $MarkupRenderer_5af77769930f.renderMarkup(Unknown Source)
at
org.apache.tapestry5.modules.TapestryModule$25.renderMarkup(TapestryModule.java:1736)
at $MarkupRenderer_5af77769930f.renderMarkup(Unknown Source)
at $MarkupRenderer_5af77769930a.renderMarkup(Unknown Source)
at
org.apache.tapestry5.internal.services.PageMarkupRendererImpl.renderPageMarkup(PageMarkupRendererImpl.java:47)
at $PageMarkupRenderer_5af777699308.renderPageMarkup(Unknown Source)
at
org.apache.tapestry5.internal.services.PageResponseRendererImpl.renderPageResponse(PageResponseRendererImpl.java:64)
at $PageResponseRenderer_5af7776992c9.renderPageResponse(Unknown Source)
at
org.apache.tapestry5.internal.services.PageRenderRequestHandlerImpl.handle(PageRenderRequestHandlerImpl.java:72)
at
org.apache.tapestry5.modules.TapestryModule$34.handle(TapestryModule.java:1962)
at $PageRenderRequestHandler_5af7776992cb.handle(Unknown Source)
at $PageRenderRequestHandler_5af7776992c5.handle(Unknown Source)
at
org.apache.tapestry5.internal.services.ComponentRequestHandlerTerminator.handlePageRender(ComponentRequestHandlerTerminator.java:48)
at
org.apache.tapestry5.services.InitializeActivePageName.handlePageRender(InitializeActivePageName.java:47)
at $ComponentRequestHandler_5af7776992c6.handlePageRender(Unknown
Source)
at
org.apache.tapestry5.internal.services.RequestOperationTracker$2.run(RequestOperationTracker.java:73)
at
org.apache.tapestry5.ioc.internal

using tapx-templating with T5.4

2013-12-05 Thread Martin Nagl
Hi all,

I need to generate nice HTML formatted emails from my future tapestry app.
It would be cool if I could use tapestry templating capabilities for that.
I know there is tapx-templating project, but I found it incompatible with
5.4.

Are there any plans to make tapx-templating compatible with Tapestry 5.4?
Or is there any alternative approach for generating HTML from my .tml files
offline?

BTW thanks for the work on 5.4. Finally I can have Bootstrap & JQuery in my
T5 app by default.

Regards
Martin Nagl


<http://apache-tapestry-mailing-list-archives.1045711.n5.nabble.com/users-tapestry-apache-org-Mailing-List-Archives-f2375125.html>


Re: Glassfish 3.1 - and tapestry live class reload

2012-12-17 Thread Martin Nagl
Hi,

I wonder, is there any update on this? Did you get live class reloading to
work on Glassfish?

I am considering dev environment using Eclipse + Maven + Glassfish.

Thanks
Martin









--
View this message in context: 
http://tapestry.1045711.n5.nabble.com/Glassfish-3-1-and-tapestry-live-class-reload-tp4471981p5718775.html
Sent from the Tapestry - User mailing list archive at Nabble.com.

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



Re: Sharing the Registry instance between web applications (deployed in the same container)

2012-12-14 Thread Martin Nagl
Putting tapestry jars in shared folder to have them loaded by common class
loader seems not quite right to me. Its a hack :) My high level feeling is:

1. Tapestry can provide IOC and JPA support in scope of 1 web application. 
2. If I need IOC and JPA (and EJB) support in scope of multiple web
applications, I need to delegate this to full application server (e.g.
Glassfish, TomEE, etc). 

Looks like I can not avoid EJB if I want multiple WARs to share services.



--
View this message in context: 
http://tapestry.1045711.n5.nabble.com/Sharing-the-Registry-instance-between-web-applications-deployed-in-the-same-container-tp5718686p5718720.html
Sent from the Tapestry - User mailing list archive at Nabble.com.

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



Sharing the Registry instance between web applications (deployed in the same container)

2012-12-13 Thread Martin Nagl
Hi all, 

I am considering my options for building a combo of T5 web application +
Jersey REST interface for this application. I am thinking about:

Step 1: Implementing a T5 application with my business logic (DB access,
computations) placed in Tapestry IOC services, because I like how the IOC
and JPA support plays together out-of-the-box.   
Step 2: Implementing a Jersey web aplication which will reuse my Tapestry
IOC services and expose the REST interface

I tried 2 approaches. Approach 1 works, approach 2 fails (I think I am
missing somethig basic here). 

Approach 1: Everything in one WAR, share Registry via ServletContext:   
 - /myapp/web/
 - /myapp/rest/ 
 - Make Tapestry 5 application run in folder "web", by providing
configuration SymbolConstants.APPLICATION_FOLDER in AppModule
 - In web.xml: map the TapestryFilter to /web/*, 
 - In web.xml: add a Jersey Servlet and map it to /rest/*
 - In Jersey resource: access the Registry instance stored in ServletContext
and access my service like this:
   Registry registry =
(Registry)context.getAttribute(TapestryFilter.REGISTRY_CONTEXT_NAME);
   EmployeeService service = registry.getService(EmployeeService.class);

Approach 1 works, because TapestryFilter and JerseyServlet share the
ServletContext (are part of same webapp). However, I would like to have
separate WARs for the Jersey and for the T5 app. I may need this to
configure different auth-method in  in web.xml for Jersey app
than for T5 app.

Approach 2: Separate WARs, share Registry via JNDI.  
- /myapp-web/
- /myapp-rest/  
- In T5 app, after Registry startup, store the Registry instance in JNDI
somehow
InitialContext ic = new InitialContext();
ic.rebind("java:registry", registry);
- In Jersey app, access the Registry through JNDI and access my service:
  InitialContext ic = new InitialContext();
Object object = ic.lookup("java:registry");
Registry registry = (Registry)object; 
EmployeeService service = registry.getService(EmployeeService.class);

Approach 2 fails with ClassCastException in this line:
 Registry registry = (Registry)object;
 ClassCastException: org.apache.tapestry5.ioc.internal.RegistryWrapper
cannot be cast to org.apache.tapestry5.ioc.Registry. 

I am using Jetty. I debuged it and found that object from lookup() has a
class from a different classloader than class I cast it to, because they
come from different contexts (each context has a separate classloader). I
have little experience with storing objects in JNDI, I think I am missing
something basic here, maybe JNDI is not even meant to be used like this
Is it even feasible to share Registry through JNDI?

Please share your thoughts, is there any other way to share my the Tapestry
IOC Service from running T5 app to another web application, deployed in the
same container? Is this even a good idea? Or should I keep all in 1 WAR?

For the record, I also considered: business logic in a separate EJB layer,
shared by both apps, both apps deployed to Glassfish. This environment is
somewhat hard to configure for me, for example because tapestry-jpa
conflicts with AS-managed persistence context. I would like to keep the dev
environment simple and make use of live class reloading. I use Eclipse +
maven + jetty. 
Thanks for any ideas.



--
View this message in context: 
http://tapestry.1045711.n5.nabble.com/Sharing-the-Registry-instance-between-web-applications-deployed-in-the-same-container-tp5718686.html
Sent from the Tapestry - User mailing list archive at Nabble.com.

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



Re: How to sort Association column in Grid?

2012-12-13 Thread Martin Nagl
Have a look at class JPAGridDataSource from Tynamo:

http://svn.codehaus.org/tynamo/trunk/tapestry-jpa-module/tapestry-jpa/src/main/java/org/tynamo/jpa/internal/JPAGridDataSource.java

  

This implementation of GridDataSource handles "Tapestry-like" property
expressions with "." or "?." delimiters. You can create a BeanModel for
Employee and add a property "department?.departmentName". See how the
property is parsed in method buildPath(...).

Some funky consequences appear in other places:
1. If you want to override cell header or cell value, you provide block
parameters for Grid:

   Custom header


   Custom cell value

2. If you want to provide cell headers in .messages file, you need to use
key:
departmentDepartmentName-label

Last thing: class JPAGridDataSource has one problem: when sorting a property
from a associated object, in case the association can be NULL, these records
are eliminated from result list. A LEFT OUTER JOIN must be used in this
case. To solve this, I modified method buildPath() like this:

public Path buildPath(Root all, String path)
{
From start = all;

String[] words = path.split("\\.");

for (int i = 0; i < words.length - 1; i++)
{
String word = words[i];

if(word.endsWith("?")) 
{
start = start.join(word.replaceAll("\\?", ""), 
JoinType.LEFT);
}
else 
{
start = start.join(word);
}

}

return start.get(words[words.length - 1]);
}




--
View this message in context: 
http://tapestry.1045711.n5.nabble.com/How-to-sort-Association-column-in-Grid-tp5718569p5718674.html
Sent from the Tapestry - User mailing list archive at Nabble.com.

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