Re: Configuring pages to be "invisible"

2013-04-01 Thread Borut Bolčina
Alejandro,

I have just tried this approach with factory chains, but the solution still
eludes me. I've tried "every" variation of creating the right chain for
ruling out the index page and all other subfolders - besides one folder.

This configuration is the closest of what I think should do the job:

configuration.add(factory.createChain("/index").add(factory.notfound()).build());
configuration.add(factory.createChain("/hidden1/**").add(factory.notfound()).build());
configuration.add(factory.createChain("/hidden2/**").add(factory.notfound()).build());

but accessing http://localhost (or http://localhost/index) still renders
the index page and the hidden pages.

If I remove the first line (with /index), then I get 404 as expected for
the hidden folders, but the index page is visible.

I am running the app locally with Jetty
(jetty-maven-plugin:8.1.9.v20130131).

-borut










2013/3/29 Alejandro Scandroli 

> Hi Borut
>
> Using tapestry-security you have a couple of options.
>
> If you have all the protected/hidden pages in the same folder you
> could do something like this:
>
>
> configuration.add(factory.createChain("/yourfolder/**").add(factory.notfound()).build());
>
> If they are not in the same folder you can create one rule per folder
> or in the worst case one rule per page.
>
> The reversed logic would be, block access to the root "/" and then
> give anon access to your visible pages.
>
>
> configuration.add(factory.createChain("/assets/**").add(factory.anon()).build());
>
> configuration.add(factory.createChain("/signin").add(factory.anon()).build());
>
> configuration.add(factory.createChain("/visibleFolder/**").add(factory.anon()).build());
>
> configuration.add(factory.createChain("/visiblePage1").add(factory.anon()).build());
>
> configuration.add(factory.createChain("/visiblePage2").add(factory.anon()).build());
>
> configuration.add(factory.createChain("/").add(factory.anon()).build());
>
> configuration.add(factory.createChain("/**").add(factory.notfound()).build());
>
> Please, be careful with this, eventlinks and forms in the visible
> pages may need their own rules.
>
> Finally, my preferred way to handle this is with a role. You could use
> something like @RequireRole("beta").
>
> Good luck with the launch.
> Alejandro.
>
>
>
> On Fri, Mar 29, 2013 at 2:54 PM, Thiago H de Paula Figueiredo
>  wrote:
> > On Fri, 29 Mar 2013 09:05:04 -0300, Borut Bolčina <
> borut.bolc...@gmail.com>
> > wrote:
> >
> >> Hello,
> >
> >
> > Hi!
> >
> >
> >> What is the least obtrusive way to mark pages "hidden" in production
> mode
> >> or with some other configuration setting.
> >
> >
> > I'd try adding a RequestFilter and have some logic there to define
> whether
> > the request is for a hidden page. If yes, return a 404 error.
> >
> > --
> > Thiago H. de Paula Figueiredo
> >
> > -
> > 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: AssetsModule.ResourceMinimizer Exception yui compressor

2013-04-01 Thread Rural Hunter

Hi,

The URL is not available any more. Can somebody send me Luck's package 
kindly? Thanks in advance.


于 2012/4/23 19:37, Luke Wilson 写道:

On 23 Apr 2012, at 11:25, netdawg wrote:


Thanks, Luke.  Yes, please...

I've uploaded the repackaged version here: 
http://viscri.co.uk/labs/tapestry/yuicompressor-rhino-bugfix-5.0.jar


net.dawg  at yahoo

Did I have to install into maven repository (would appreciate version etc)?
And/Or do I use it to compress?

 yuicompressorbugfix
 yuicompressor-rhino-bugfix
 5.0

If you don't run your own version of nexus, you'll have to install it on the 
machine that you want to build on. This is the command you need I think: 
http://maven.apache.org/guides/mini/guide-3rd-party-jars-local.html

You'll also need to exclude the yuicompressor version that tapestry pulls in:


 org.apache.tapestry
 tapestry-yuicompressor
 5.3.2
 
 
   com.yahoo.platform.yui
   yuicompressor
 
 
 

This should work,

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



Service Advisors recursive problem

2013-04-01 Thread Michael Prescott
I'm having trouble applying service advisor according to the instructions
here:

My TapestryModule contains only this, as per the example on
http://tapestry.apache.org/service-advisors.html :


@Match("*")
  public static void adviseLogging(LoggingAdvisor loggingAdvisor,
Logger logger, MethodAdviceReceiver receiver)
  {
loggingAdvisor.addLoggingAdvice(logger, receiver);
  }

This leads to a recursive IoC exeption:

2013-04-01 14:35:01,252 [main] ERROR org.apache.tapestry5.ioc.Registry
- Construction of service 'AssetObjectProvider' h

as failed due to recursion: the service depends on itself in some way.
Please check org.apache.tapestry5.internal.servic

es.AssetObjectProvider(AssetSource, TypeCoercer, SymbolSource) (at
AssetObjectProvider.java:45) via org.apache.tapestry5

.services.TapestryModule.bind(ServiceBinder) (at
TapestryModule.java:308) for references to another service that is
itse

lf dependent on service 'AssetObjectProvider'.

2013-04-01 14:35:01,253 [main] ERROR org.apache.tapestry5.ioc.Registry
- Operations trace:

2013-04-01 14:35:01,254 [main] ERROR org.apache.tapestry5.ioc.Registry
- [ 1] Realizing service ServletApplicationInitia

lizer

2013-04-01 14:35:01,255 [main] ERROR org.apache.tapestry5.ioc.Registry
- [ 2] Instantiating service ServletApplicationIn

itializer implementation via
org.apache.tapestry5.services.TapestryModule.buildServletApplicationInitializer(Logger,
Lis

t, ApplicationInitializer) (at TapestryModule.java:1396)

2013-04-01 14:35:01,256 [main] ERROR org.apache.tapestry5.ioc.Registry
- [ 3] Constructing module class org.apache.tapes

try5.services.TapestryModule

2013-04-01 14:35:01,257 [main] ERROR org.apache.tapestry5.ioc.Registry
- [ 4] Determining injection value for parameter

#1 (org.apache.tapestry5.ioc.services.PipelineBuilder)

2013-04-01 14:35:01,258 [main] ERROR org.apache.tapestry5.ioc.Registry
- [ 5] Resolving object of type org.apache.tapest

ry5.ioc.services.PipelineBuilder using MasterObjectProvider

2013-04-01 14:35:01,259 [main] ERROR org.apache.tapestry5.ioc.Registry
- [ 6] Realizing service AssetObjectProvider

2013-04-01 14:35:01,259 [main] ERROR org.apache.tapestry5.ioc.Registry
- [ 7] Invoking com.tsg.fss.web.services.Tapestry

Module.adviseLogging(LoggingAdvisor, Logger, MethodAdviceReceiver) (at
TapestryModule.java:107)

2013-04-01 14:35:01,261 [main] ERROR org.apache.tapestry5.ioc.Registry
- [ 8] Creating plan to invoke public static void

 
com.tsg.fss.web.services.TapestryModule.adviseLogging(org.apache.tapestry5.ioc.services.LoggingAdvisor,org.slf4j.Logger

,org.apache.tapestry5.ioc.MethodAdviceReceiver)

2013-04-01 14:35:01,261 [main] ERROR org.apache.tapestry5.ioc.Registry
- [ 9] Determining injection value for parameter

#1 (org.apache.tapestry5.ioc.services.LoggingAdvisor)

2013-04-01 14:35:01,262 [main] ERROR org.apache.tapestry5.ioc.Registry
- [10] Resolving object of type org.apache.tapest

ry5.ioc.services.LoggingAdvisor using MasterObjectProvider

2013-04-01 14:35:01,263 [main] ERROR org.apache.tapestry5.ioc.Registry
- [11] Realizing service AssetObjectProvider

2013-04-01 14:35:01,268 [main] ERROR
org.apache.tapestry5.services.TapestryModule.AssetObjectProvider -
Construction of

service AssetObjectProvider failed: Exception constructing service
'AssetObjectProvider': Construction of service 'Asset

ObjectProvider' has failed due to recursion: the service depends on
itself in some way. Please check org.apache.tapestry

5.internal.services.AssetObjectProvider(AssetSource, TypeCoercer,
SymbolSource) (at AssetObjectProvider.java:45) via org

.apache.tapestry5.services.TapestryModule.bind(ServiceBinder) (at
TapestryModule.java:308) for references to another ser

vice that is itself dependent on service 'AssetObjectProvider'.


Caused by: java.lang.IllegalStateException: Construction of service
'AssetObjectProvider' has failed due to recursion: the service depends
on itself in some way. Please check
org.apache.tapestry5.internal.services.AssetObjectProvider(AssetSource,
TypeCoercer, SymbolSource) (at AssetObjectProvider.java:45) via
org.apache.tapestry5.services.TapestryModule.bind(ServiceBinder) (at
TapestryModule.java:308) for references to another service that is
itself dependent on service 'AssetObjectProvider'.


Re: Tapestry-Hibernate outside of web requests

2013-04-01 Thread Michael Prescott
Okay, I assume this is because of how the CommitAfter advise is applied -
when I write my own advice, I have no trouble finding methods that only
declare the annotation on the service method implementation.  This method,
for example, will successfully advise service implementations even when
there's no annotation on the interface method:

@Advise
@Match("*")
public static void supportCommitAfterOutsideRequests(
 /* CommitAfterAdvisor advisor, */MethodAdviceReceiver receiver) {
// advisor.advise(receiver);

 MethodAdvice commit = new MethodAdvice() {
public void advise(MethodInvocation invocation) {

 System.err.println("=TX BEGIN");

invocation.proceed();

 System.err.println("=TX COMMIT");
}
};

for (Method m : receiver.getInterface().getMethods()) {

if (receiver.getMethodAnnotation(m, CommitAfter.class) != null) {
 System.err.println("ADVISING "
+ receiver.getInterface().getSimpleName() + "."
 + m.getName() + "()");
receiver.adviseMethod(m, commit);
} else
 System.err.println("NOT advising "
+ receiver.getInterface().getSimpleName() + "."
 + m.getName() + "()");

}
}

Having said that, despite the fact that I have put @CommitAfter on the
service method AND on the service interface method, the transactions aren't
being committed.

Q: Is there any way to tell what advisors or decorators are in place around
a service method?



On 1 April 2013 13:15, Thiago H de Paula Figueiredo wrote:

> On Mon, 01 Apr 2013 13:36:39 -0300, Michael Prescott <
> michael.r.presc...@gmail.com> wrote:
>
>  How do I make @CommitAfter work outside of a normal web request?
>>
>
>  public class PeerMessageProcessorImpl implements PeerMessageProcessor {
>>  @Inject
>> private Session session;
>>
>> @CommitAfter
>>  public void receive(Message message) {
>> Object payload = message.getObject();
>> session.save(payload);
>>  }
>>
>
> Due to a limitation in the Tapestry-IoC service proxy creation, you need
> to put the @CommitAfter annotation in interface method, not in the class
> method.
>
> --
> 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: Tapestry-Hibernate outside of web requests

2013-04-01 Thread Thiago H de Paula Figueiredo
On Mon, 01 Apr 2013 13:36:39 -0300, Michael Prescott  
 wrote:



How do I make @CommitAfter work outside of a normal web request?



public class PeerMessageProcessorImpl implements PeerMessageProcessor {
 @Inject
private Session session;

@CommitAfter
 public void receive(Message message) {
Object payload = message.getObject();
session.save(payload);
 }


Due to a limitation in the Tapestry-IoC service proxy creation, you need  
to put the @CommitAfter annotation in interface method, not in the class  
method.


--
Thiago H. de Paula Figueiredo

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



Tapestry-Hibernate outside of web requests

2013-04-01 Thread Michael Prescott
How do I make @CommitAfter work outside of a normal web request?

(By way of background, I have a web app that also receives messages that
require database work via JGroups.  These aren't web requests, but I want
to use the same hibernate configuration and infrastructure if at all
possible.)

Right now the basic code looks like this:

// The service that listens to incoming JGroups messages
public class MyReceiverServiceImpl extends /*JGroups*/ReceiverAdapter {

@Inject
private PerthreadManager threadManager;

@Inject
 private PeerMessageProcessor messageProcessor;

@Override
public void receive(final Message message) {
 threadManager.run(new Runnable() {
@Override
public void run() {
 messageProcessor.receive(message);
}
});
 }

// The service that tries to save the serialized entities via
tapestry-hibernate

public class PeerMessageProcessorImpl implements PeerMessageProcessor {
 @Inject
private Session session;

@CommitAfter
 public void receive(Message message) {
Object payload = message.getObject();
session.save(payload);
 }

Unfortunately, the transaction is never committed.

As far as I know:

1. The CommitAfter advisor does advise my service methods (but I'm not sure
how to verify this).

2. My methods are properly invoked (which I've verified)

It feels like this should be straight forward!

Gratefully,

Michael


Re: How to change HTML form action? Or is there any better option?

2013-04-01 Thread Thiago H de Paula Figueiredo
On Mon, 01 Apr 2013 08:37:21 -0300, Dmitry Gusev   
wrote:



I may be misunderstanding this, but isn't t:form has its own context
property for that purpose? EventLink also has this property.


The context of a page and the context of an event are separate. You can  
have both at the same time and that's absolutely common.



If I understand this right, onPassivate() is used only for
request-after-redirect so that browser will get correct URL after  
handling of event.


That's not correct. It's used when any link, action or request, is  
generated inside a given page.


--
Thiago H. de Paula Figueiredo

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



Re: How to change HTML form action? Or is there any better option?

2013-04-01 Thread Dmitry Gusev
On Mon, Apr 1, 2013 at 3:19 PM, Thiago H de Paula Figueiredo <
thiag...@gmail.com> wrote:

> On Sat, 30 Mar 2013 05:29:47 -0300, Dmitry Gusev 
> wrote:
>
>  So, the onPassivate() didn't worked, there's no context in the form's
>> action... looking for another options.
>>
>
> Did you put the onPassivate() method in the page, not in the component?


Yes, I put it in the page.


> Have you checked it actually returned the correct activation context
> value? In event links (and form submission is one of them), the page
> activation context is usually put at the t:ac query parameter.


I checked, I actually returned some constant value from onPassivate() to
see if it appeared in the action URL, and it wasn't there.

I may be misunderstanding this, but isn't t:form has its own context
property for that purpose? EventLink also has this property.

If I understand this right, onPassivate() is used only for
request-after-redirect so that browser will get correct URL after handling
of event.


>
> --
> Thiago H. de Paula Figueiredo
>
> --**--**-
> To unsubscribe, e-mail: 
> users-unsubscribe@tapestry.**apache.org
> For additional commands, e-mail: users-h...@tapestry.apache.org
>
>


-- 
Dmitry Gusev

AnjLab Team
http://anjlab.com


Re: Query Mobile & Tapestry

2013-04-01 Thread Thiago H de Paula Figueiredo
On Sat, 30 Mar 2013 20:07:18 -0300, Alexander Sommer  
 wrote:



Hi!


Hi!


I was reading in the forum (eg
http://mail-archives.apache.org/mod_mbox/tapestry-users/201201.mbox/%3ccd6ed1fa-1e5c-4cbb-a6e9-67eeb842e...@mail-nic-00.intern.albourne.com%3E),
that jquery is complicating (correct me if this is not true!!) things due
to prototype used in tapestry.


Have you tried tapestry-jquery with the suppress Prototype configuration  
turned on? This will make Tapestry work completely free of Prototype. This  
way, you don't need to throw the baby together with the bath water. ;)



if I want to use this service, I run into the crossDomain problem with
javascript, because my mobile webapp for example is (for testing  
purposes) hosted here: http://www.learnclip.com/airwritingweb/ (so not on

airwriting.com)


Now this is something which is a pure JavaScript security issue, not  
related to Tapestry.


--
Thiago H. de Paula Figueiredo

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



Re: How to change HTML form action? Or is there any better option?

2013-04-01 Thread Thiago H de Paula Figueiredo
On Sat, 30 Mar 2013 05:29:47 -0300, Dmitry Gusev   
wrote:



So, the onPassivate() didn't worked, there's no context in the form's
action... looking for another options.


Did you put the onPassivate() method in the page, not in the component?  
Have you checked it actually returned the correct activation context  
value? In event links (and form submission is one of them), the page  
activation context is usually put at the t:ac query parameter.


--
Thiago H. de Paula Figueiredo

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