Re: Contributing a Symbol Provider

2015-07-29 Thread Richard Kirby
Hi Daniel,

No, your method is fine. I needed my method as I needed some properties
accessible before I could start up the Registry, so this killed two birds
with one stone.

If you don't need the properties until after building the Registry, then
you will be fine with the documented method.

Richard

On 28 July 2015 at 19:19, Poggenpohl, Daniel 
daniel.poggenp...@isst.fraunhofer.de wrote:

 Hi,

 I've implemented a working solution using the method on this page:

 http://wiki.apache.org/tapestry/Tapestry5HowToReadSymbolsFromPropertiesFile
 I implemented a SymbolProvider, a buildFileSymbolProvider method and a
 contributeSymbolSource method.

 How is your method different from that one? Should I prefer your method?
 What will happen when I use my method?

 Regards,
 Daniel P.

 -Ursprüngliche Nachricht-
 Von: Thiago H de Paula Figueiredo [mailto:thiag...@gmail.com]
 Gesendet: Dienstag, 28. Juli 2015 16:56
 An: Tapestry users
 Betreff: Re: Contributing a Symbol Provider

 On Tue, 28 Jul 2015 10:31:55 -0300, Poggenpohl, Daniel 
 daniel.poggenp...@isst.fraunhofer.de wrote:

  Hello,

 Hi!

  I want to provide additional configuration on startup to my Tapestry
  application. I want to store the additional configuration in a file
  containing lines key=value.
  I know I can contribute a symbol provider to load a file and access
  the symbols this way.
 
  But I can't find the documentation for
  - How to write a Symbol Provider

 Implement the SymbolProvider interface. It has a single method, String
 valueForSymbol(String symbolName). It should return a String if that
 implementation provides a value for that symbol name and null if not.

  - what method to write in the AppModule to contribute the Symbol
  Provider

 public static void
 contributeSymbolProvider(OrderedConfigurationSymbolProvider
 configuration) {
 configuration.add(MyProvider, new
 YourSymbolProviderImplementation(),
 before:*);
 }

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




-- 

Richard Kirby, Technical Director

CAPDM Limited

Direct phone: 0131 477 8629

Email: r...@capdm.com  Website: www.capdm.com

Registered in Scotland: SC168970   VAT: 682 846 983

Registered address: 22 Forth Street, Edinburgh, EH1 3LH, UK


AW: YUICompressor tries to compress minified resources

2015-07-29 Thread Poggenpohl, Daniel
Hello,

would I be able to decorate the YUICompressor with my own implementation which 
checks if the file is already minified?
Or could I configure the YUICompressor to exclude files?

Regards,
Daniel P.

-Ursprüngliche Nachricht-
Von: Howard Lewis Ship [mailto:hls...@gmail.com] 
Gesendet: Mittwoch, 29. Juli 2015 00:15
An: Tapestry users
Betreff: Re: YUICompressor tries to compress minified resources

Tapestry is not quite smart enough to know that .min.css means a minimized CSS 
file.

You should have access to the non-minimized CSS file, so change it from 
context:bootstrap/bootstrap.min.css to context:bootstrap/bootstrap.css
(or equivalent).

The whole concept of Tapestry doing the minimization is to simplify the 
developer; it's always the same file, but in production mode it gets all the 
desirable extras (minimization, etc.).


On Tue, Jul 28, 2015 at 11:14 AM, Poggenpohl, Daniel  
daniel.poggenp...@isst.fraunhofer.de wrote:

 Hello,

 we enabled production mode in our application.
 The Tapestry YUICompressor doesn't seem to recognize already minified 
 JS or CSS files and tries to compress them.
 This results in Exceptions like this one:
 ERROR] AssetsModule.ResourceMinimizer JavaScript compression problems 
 for resource context:bootstrap/js/bootstrap.min.js:
 [ERROR] AssetsModule.ResourceMinimizer String index out of range: 
 40264
 java.lang.StringIndexOutOfBoundsException: String index out of range: 40264
 at java.lang.String.substring(String.java:1951)
 at
 com.yahoo.platform.yui.compressor.JavaScriptCompressor.printSourceString(JavaScriptCompressor.java:267)
 at
 com.yahoo.platform.yui.compressor.JavaScriptCompressor.parse(JavaScriptCompressor.java:330)
 at
 com.yahoo.platform.yui.compressor.JavaScriptCompressor.init(JavaScriptCompressor.java:533)
 at
 org.apache.tapestry5.internal.yuicompressor.JavaScriptResourceMinimizer.doMinimize(JavaScriptResourceMinimizer.java:148)
 at
 org.apache.tapestry5.internal.yuicompressor.AbstractMinimizer$1.perform(AbstractMinimizer.java:67)
at
 org.apache.tapestry5.internal.TapestryInternalUtils$5.run(TapestryInternalUtils.java:582)
 at
 org.apache.tapestry5.ioc.internal.OperationTrackerImpl$1.invoke(OperationTrackerImpl.java:51)
 at
 org.apache.tapestry5.ioc.internal.OperationTrackerImpl$1.invoke(OperationTrackerImpl.java:49)
 at
 org.apache.tapestry5.ioc.internal.OperationTrackerImpl.invoke(Operatio
 nTrackerImpl.java:74)

 Can we set some options for the Compressor? How do we prevent this error?

 Regards,
 Daniel P.




--
Howard M. Lewis Ship

Looking for Clojure engagements: coding, archiecture, mentoring  more!

Creator of Apache Tapestry

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


Re: Send Redirect after Login

2015-07-29 Thread Geoff Callender
These will help:

T5.4: 
http://jumpstart.doublenegative.com.au/jumpstart7/examples/infrastructure/protectingpages
 
http://jumpstart.doublenegative.com.au/jumpstart7/examples/infrastructure/protectingpages
T5.3: 
http://jumpstart.doublenegative.com.au/jumpstart/examples/infrastructure/protectingpages
 
http://jumpstart.doublenegative.com.au/jumpstart/examples/infrastructure/protectingpages

Geoff

 On 29 Jul 2015, at 9:23 pm, Poggenpohl, Daniel 
 daniel.poggenp...@isst.fraunhofer.de wrote:
 
 Hello,
 
 I'm using the Layout component for authentication purposes. The general auth 
 process is happening outside of the application via SSO, but all my pages 
 have the Layout component.
 Every time I request a page, The Layout component looks if a session user has 
 been created, and if not, creates the user using a service and stores him in 
 the session.
 Now, at the end of the creation process, back in the Layout component, I want 
 to redirect based on the roles a user has.
 So I decide which page to redirect to based on the role, and do the following:
 
 response and pageRenderLinkSource are both injected in the component.
 
 response.sendRedirect(pageRenderLinkSource.createPageRenderLink(getPageForRole()));
 
 But when redirecting, my Tomcat logs an exception:
 
 java.lang.NullPointerException
at 
 org.apache.tapestry5.internal.services.assets.CompressionAnalyzerImpl.isCompressable(CompressionAnalyzerImpl.java:34)
at $CompressionAnalyzer_aae9007a21a5.isCompressable(Unknown 
 Source)
at 
 org.apache.tapestry5.internal.services.ResponseCompressionAnalyzerImpl.isCompressable(ResponseCompressionAnalyzerImpl.java:78)
at 
 $ResponseCompressionAnalyzer_aae9007a219d.isCompressable(Unknown Source)
at 
 org.apache.tapestry5.internal.gzip.BufferedGZipOutputStream.openResponseOutputStream(BufferedGZipOutputStream.java:77)
at 
 org.apache.tapestry5.internal.gzip.BufferedGZipOutputStream.checkForCutover(BufferedGZipOutputStream.java:70)
at 
 org.apache.tapestry5.internal.gzip.BufferedGZipOutputStream.write(BufferedGZipOutputStream.java:116)
at sun.nio.cs.StreamEncoder.writeBytes(Unknown Source)
at sun.nio.cs.StreamEncoder.implClose(Unknown Source)
at sun.nio.cs.StreamEncoder.close(Unknown Source)
at java.io.OutputStreamWriter.close(Unknown Source)
at java.io.BufferedWriter.close(Unknown Source)
at java.io.PrintWriter.close(Unknown Source)
at 
 org.apache.tapestry5.internal.services.PageResponseRendererImpl.renderPageResponse(PageResponseRendererImpl.java:85)
at 
 $PageResponseRenderer_aae9007a2226.renderPageResponse(Unknown Source)
at 
 org.apache.tapestry5.internal.services.DefaultRequestExceptionHandler.handleRequestException(DefaultRequestExceptionHandler.java:85)
at 
 $RequestExceptionHandler_aae9007a21a9.handleRequestException(Unknown Source)
at 
 org.apache.tapestry5.internal.services.RequestErrorFilter.service(RequestErrorFilter.java:42)
at $RequestHandler_aae9007a21ac.service(Unknown Source)
at 
 org.apache.tapestry5.services.TapestryModule$3.service(TapestryModule.java:902)
at $RequestHandler_aae9007a21ac.service(Unknown Source)
at 
 org.apache.tapestry5.services.TapestryModule$2.service(TapestryModule.java:892)
at $RequestHandler_aae9007a21ac.service(Unknown Source)
at 
 org.apache.tapestry5.internal.services.StaticFilesFilter.service(StaticFilesFilter.java:90)
at $RequestHandler_aae9007a21ac.service(Unknown Source)
at $RequestHandler_aae9007a21a0.service(Unknown Source)
at 
 org.apache.tapestry5.services.TapestryModule$HttpServletRequestHandlerTerminator.service(TapestryModule.java:253)
at 
 org.apache.tapestry5.upload.internal.services.MultipartServletRequestFilter.service(MultipartServletRequestFilter.java:44)
at $HttpServletRequestHandler_aae9007a21a2.service(Unknown 
 Source)
at 
 org.got5.tapestry5.jquery.services.AjaxUploadServletRequestFilter.service(AjaxUploadServletRequestFilter.java:27)
at $HttpServletRequestHandler_aae9007a21a2.service(Unknown 
 Source)
at 
 org.apache.tapestry5.internal.gzip.GZipFilter.service(GZipFilter.java:53)
at $HttpServletRequestHandler_aae9007a21a2.service(Unknown 
 Source)
at 
 org.apache.tapestry5.internal.services.IgnoredPathsFilter.service(IgnoredPathsFilter.java:62)
at $HttpServletRequestFilter_aae9007a219c.service(Unknown 
 Source)
at $HttpServletRequestHandler_aae9007a21a2.service(Unknown 
 Source)
at 
 

Send Redirect after Login

2015-07-29 Thread Poggenpohl, Daniel
Hello,

I'm using the Layout component for authentication purposes. The general auth 
process is happening outside of the application via SSO, but all my pages have 
the Layout component.
Every time I request a page, The Layout component looks if a session user has 
been created, and if not, creates the user using a service and stores him in 
the session.
Now, at the end of the creation process, back in the Layout component, I want 
to redirect based on the roles a user has.
So I decide which page to redirect to based on the role, and do the following:

response and pageRenderLinkSource are both injected in the component.

response.sendRedirect(pageRenderLinkSource.createPageRenderLink(getPageForRole()));

But when redirecting, my Tomcat logs an exception:

java.lang.NullPointerException
at 
org.apache.tapestry5.internal.services.assets.CompressionAnalyzerImpl.isCompressable(CompressionAnalyzerImpl.java:34)
at $CompressionAnalyzer_aae9007a21a5.isCompressable(Unknown 
Source)
at 
org.apache.tapestry5.internal.services.ResponseCompressionAnalyzerImpl.isCompressable(ResponseCompressionAnalyzerImpl.java:78)
at 
$ResponseCompressionAnalyzer_aae9007a219d.isCompressable(Unknown Source)
at 
org.apache.tapestry5.internal.gzip.BufferedGZipOutputStream.openResponseOutputStream(BufferedGZipOutputStream.java:77)
at 
org.apache.tapestry5.internal.gzip.BufferedGZipOutputStream.checkForCutover(BufferedGZipOutputStream.java:70)
at 
org.apache.tapestry5.internal.gzip.BufferedGZipOutputStream.write(BufferedGZipOutputStream.java:116)
at sun.nio.cs.StreamEncoder.writeBytes(Unknown Source)
at sun.nio.cs.StreamEncoder.implClose(Unknown Source)
at sun.nio.cs.StreamEncoder.close(Unknown Source)
at java.io.OutputStreamWriter.close(Unknown Source)
at java.io.BufferedWriter.close(Unknown Source)
at java.io.PrintWriter.close(Unknown Source)
at 
org.apache.tapestry5.internal.services.PageResponseRendererImpl.renderPageResponse(PageResponseRendererImpl.java:85)
at 
$PageResponseRenderer_aae9007a2226.renderPageResponse(Unknown Source)
at 
org.apache.tapestry5.internal.services.DefaultRequestExceptionHandler.handleRequestException(DefaultRequestExceptionHandler.java:85)
at 
$RequestExceptionHandler_aae9007a21a9.handleRequestException(Unknown Source)
at 
org.apache.tapestry5.internal.services.RequestErrorFilter.service(RequestErrorFilter.java:42)
at $RequestHandler_aae9007a21ac.service(Unknown Source)
at 
org.apache.tapestry5.services.TapestryModule$3.service(TapestryModule.java:902)
at $RequestHandler_aae9007a21ac.service(Unknown Source)
at 
org.apache.tapestry5.services.TapestryModule$2.service(TapestryModule.java:892)
at $RequestHandler_aae9007a21ac.service(Unknown Source)
at 
org.apache.tapestry5.internal.services.StaticFilesFilter.service(StaticFilesFilter.java:90)
at $RequestHandler_aae9007a21ac.service(Unknown Source)
at $RequestHandler_aae9007a21a0.service(Unknown Source)
at 
org.apache.tapestry5.services.TapestryModule$HttpServletRequestHandlerTerminator.service(TapestryModule.java:253)
at 
org.apache.tapestry5.upload.internal.services.MultipartServletRequestFilter.service(MultipartServletRequestFilter.java:44)
at $HttpServletRequestHandler_aae9007a21a2.service(Unknown 
Source)
at 
org.got5.tapestry5.jquery.services.AjaxUploadServletRequestFilter.service(AjaxUploadServletRequestFilter.java:27)
at $HttpServletRequestHandler_aae9007a21a2.service(Unknown 
Source)
at 
org.apache.tapestry5.internal.gzip.GZipFilter.service(GZipFilter.java:53)
at $HttpServletRequestHandler_aae9007a21a2.service(Unknown 
Source)
at 
org.apache.tapestry5.internal.services.IgnoredPathsFilter.service(IgnoredPathsFilter.java:62)
at $HttpServletRequestFilter_aae9007a219c.service(Unknown 
Source)
at $HttpServletRequestHandler_aae9007a21a2.service(Unknown 
Source)
at 
org.apache.tapestry5.services.TapestryModule$1.service(TapestryModule.java:852)
at $HttpServletRequestHandler_aae9007a21a2.service(Unknown 
Source)
at $HttpServletRequestHandler_aae9007a219b.service(Unknown 
Source)
at 
org.apache.tapestry5.TapestryFilter.doFilter(TapestryFilter.java:171)
at 
org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:243)
at 
org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:210)
at