Re: Tapestry 5.2.5 Select component's multiple property

2012-08-24 Thread Taha Siddiqi
Hi

http://svn.codehaus.org/chenillekit/trunk/chenillekit-tapestry/src/main/java/org/chenillekit/tapestry/core/encoders/MultipleValueEncoder.java

regards
Taha

On Aug 23, 2012, at 9:06 AM, rmrajkumar77 wrote:

> Hi Taha,
> 
> I am new to tapestry and am trying to build multi select box and i believe
> your codes will help me.
> 
> Could you please also share the codes for MultipleValueEncoder class.
> Thanks.
> 
> Regards
> Raj
> 
> 
> 
> --
> View this message in context: 
> http://tapestry.1045711.n5.nabble.com/Tapestry-5-2-5-Select-component-s-multiple-property-tp4304338p5715740.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 tell which page is being requested?

2012-08-24 Thread Thiago H de Paula Figueiredo
On Fri, 24 Aug 2012 16:02:08 -0300, Michael Prescott  
 wrote:



Okay, it works correctly if I specify the following constraints:

after:Asset
after:ComponentEvent
before:PageRender

(The semantics of this mystify me, it seems redundant.  Given the order  
on the graphic Joakim sent, I'd have thought that after:ComponentEvent or
before:PageRender would be sufficient, but apparently not.  If anyone  
has a fuller understanding, I'd love to hear it.)


For any two contributions that don't have any sorting constraints related  
to each other, directly or indirectly, the ordering of their additions  
(including the processing of the module classes in which they are located,  
which isn't deterministic) can cause different orderings in the end.


If you add your contribution with after:ComponentEvent, it doesn't mean it  
will be place immediately after ComponentEvent, but that, in the end, your  
contribution will be guaranteed to be placed in some place after  
ComponentEvent. In other words, ComponentEvent will be invoked before your  
contribution.


Q. How do you tell whether the request corresponds to a vanilla request  
to render a page?


PageRenderRequestParameters decode =  
componentEventLinkEncoder.decodePageRenderRequest(request);


plus checking whether the matched page really exists using ComponentSource.


(or)
Q. How do you tell which page a component event corresponds to?


ComponentEventRequestParameters decoded =  
componentEventLinkEncoder.decodeComponentEventRequest(request);

String containingPageName = decoded.getActivePageName();

--
Thiago H. de Paula Figueiredo

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



Plastic: Test that 2 object references are equal

2012-08-24 Thread Thim Anneessens

Hello,

I am wondering how to achieve the following java code in plastic:

Object a,b;
if(a==b)
  // Do something
else
  // Do something else

Does anybody know how?

Best regards,
Thim.

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



Re: How to tell which page is being requested?

2012-08-24 Thread Thiago H de Paula Figueiredo
On Fri, 24 Aug 2012 15:45:39 -0300, Michael Prescott  
 wrote:



I don't know!  I thought ordered configurations formed a linear sequence,
so all I had to do was say which one I wanted it immediately before.
 Supplying multiple constraints seems redundant,


This isn't correct and your case is a counter-example. :P

--
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 tell which page is being requested?

2012-08-24 Thread Joakim Olsson
ComponentEvent is placed after Asset so it should be enough to just
use after:ComponentEvent and before:PageRender in that case.

You didn't do the same error that I did and put both constraints in
the same string (eg. "after:ComponentEvent,before:PageRender")? The
constraints-parameter is a String var-arg.

/Joakim


On Fri, Aug 24, 2012 at 9:02 PM, Michael Prescott
 wrote:
> Okay, it works correctly if I specify the following constraints:
>
> after:Asset
> after:ComponentEvent
> before:PageRender
>
> (The semantics of this mystify me, it seems redundant.  Given the order on
> the graphic Joakim sent, I'd have thought that after:ComponentEvent or
> before:PageRender would be sufficient, but apparently not.  If anyone has a
> fuller understanding, I'd love to hear it.)
>
> Q. How do you tell whether the request corresponds to a vanilla request to
> render a page?
>
> (or)
>
> Q. How do you tell which page a component event corresponds to?
>
> When my dispatcher came before either Asset or ComponentEvent, the code
>
> PageRenderRequestParameters decode =
> linkEncoder.decodePageRenderRequest(request);
>
> .. returns misleading results.
>
> Michael
>
> On 24 August 2012 14:52, Michael Prescott wrote:
>
>> Right. I don't want my dispatcher to interfere with asset requests, so
>> presumably I don't want my dispatcher before Asset, no?
>>
>>
>> On 24 August 2012 14:49, Joakim Olsson  wrote:
>>
>>> Asset is before PageRender. See the image at the bottom of
>>> http://tapestry.apache.org/request-processing.html
>>>
>>> /Joakim
>>>
>>>
>>> On Fri, Aug 24, 2012 at 8:45 PM, Michael Prescott
>>>  wrote:
>>> > I don't know!  I thought ordered configurations formed a linear
>>> sequence,
>>> > so all I had to do was say which one I wanted it immediately before.
>>> >  Supplying multiple constraints seems redundant, and possibly
>>> > contradictory.  (e.g. "before a, but after c").
>>> >
>>> > I'll give that a shot, anyways.
>>> >
>>> > Michael
>>> >
>>> > On 24 August 2012 14:39, Thiago H de Paula Figueiredo <
>>> thiag...@gmail.com>wrote:
>>> >
>>> >> On Fri, 24 Aug 2012 14:58:21 -0300, Michael Prescott <
>>> >> michael.r.presc...@gmail.com> wrote:
>>> >>
>>> >>  I'm configuring my dispatcher with this:
>>> >>>
>>> >>> configuration.add("PageAuth", pageAuth, "before:PageRender");
>>> >>> This tells Tapestry to put my pageAuth dispatcher.. *after* page
>>> render?
>>> >>>
>>> >>
>>> >> Oops, my bad. But your dispatcher should be added before the asset one
>>> >> too, shouldn't it?
>>> >>
>>> >> configuration.add("PageAuth", pageAuth, "before:PageRender",
>>> >> "before:Asset");
>>> >>
>>> >>
>>> >> --
>>> >> Thiago H. de Paula Figueiredo
>>> >>
>>> >>
>>> --**--**-
>>> >> To unsubscribe, e-mail: users-unsubscribe@tapestry.**apache.org<
>>> 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
>>>
>>>
>>

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



Re: How to tell which page is being requested?

2012-08-24 Thread Michael Prescott
Okay, it works correctly if I specify the following constraints:

after:Asset
after:ComponentEvent
before:PageRender

(The semantics of this mystify me, it seems redundant.  Given the order on
the graphic Joakim sent, I'd have thought that after:ComponentEvent or
before:PageRender would be sufficient, but apparently not.  If anyone has a
fuller understanding, I'd love to hear it.)

Q. How do you tell whether the request corresponds to a vanilla request to
render a page?

(or)

Q. How do you tell which page a component event corresponds to?

When my dispatcher came before either Asset or ComponentEvent, the code

PageRenderRequestParameters decode =
linkEncoder.decodePageRenderRequest(request);

.. returns misleading results.

Michael

On 24 August 2012 14:52, Michael Prescott wrote:

> Right. I don't want my dispatcher to interfere with asset requests, so
> presumably I don't want my dispatcher before Asset, no?
>
>
> On 24 August 2012 14:49, Joakim Olsson  wrote:
>
>> Asset is before PageRender. See the image at the bottom of
>> http://tapestry.apache.org/request-processing.html
>>
>> /Joakim
>>
>>
>> On Fri, Aug 24, 2012 at 8:45 PM, Michael Prescott
>>  wrote:
>> > I don't know!  I thought ordered configurations formed a linear
>> sequence,
>> > so all I had to do was say which one I wanted it immediately before.
>> >  Supplying multiple constraints seems redundant, and possibly
>> > contradictory.  (e.g. "before a, but after c").
>> >
>> > I'll give that a shot, anyways.
>> >
>> > Michael
>> >
>> > On 24 August 2012 14:39, Thiago H de Paula Figueiredo <
>> thiag...@gmail.com>wrote:
>> >
>> >> On Fri, 24 Aug 2012 14:58:21 -0300, Michael Prescott <
>> >> michael.r.presc...@gmail.com> wrote:
>> >>
>> >>  I'm configuring my dispatcher with this:
>> >>>
>> >>> configuration.add("PageAuth", pageAuth, "before:PageRender");
>> >>> This tells Tapestry to put my pageAuth dispatcher.. *after* page
>> render?
>> >>>
>> >>
>> >> Oops, my bad. But your dispatcher should be added before the asset one
>> >> too, shouldn't it?
>> >>
>> >> configuration.add("PageAuth", pageAuth, "before:PageRender",
>> >> "before:Asset");
>> >>
>> >>
>> >> --
>> >> Thiago H. de Paula Figueiredo
>> >>
>> >>
>> --**--**-
>> >> To unsubscribe, e-mail: users-unsubscribe@tapestry.**apache.org<
>> 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: How to tell which page is being requested?

2012-08-24 Thread Michael Prescott
Right. I don't want my dispatcher to interfere with asset requests, so
presumably I don't want my dispatcher before Asset, no?

On 24 August 2012 14:49, Joakim Olsson  wrote:

> Asset is before PageRender. See the image at the bottom of
> http://tapestry.apache.org/request-processing.html
>
> /Joakim
>
>
> On Fri, Aug 24, 2012 at 8:45 PM, Michael Prescott
>  wrote:
> > I don't know!  I thought ordered configurations formed a linear sequence,
> > so all I had to do was say which one I wanted it immediately before.
> >  Supplying multiple constraints seems redundant, and possibly
> > contradictory.  (e.g. "before a, but after c").
> >
> > I'll give that a shot, anyways.
> >
> > Michael
> >
> > On 24 August 2012 14:39, Thiago H de Paula Figueiredo <
> thiag...@gmail.com>wrote:
> >
> >> On Fri, 24 Aug 2012 14:58:21 -0300, Michael Prescott <
> >> michael.r.presc...@gmail.com> wrote:
> >>
> >>  I'm configuring my dispatcher with this:
> >>>
> >>> configuration.add("PageAuth", pageAuth, "before:PageRender");
> >>> This tells Tapestry to put my pageAuth dispatcher.. *after* page
> render?
> >>>
> >>
> >> Oops, my bad. But your dispatcher should be added before the asset one
> >> too, shouldn't it?
> >>
> >> configuration.add("PageAuth", pageAuth, "before:PageRender",
> >> "before:Asset");
> >>
> >>
> >> --
> >> Thiago H. de Paula Figueiredo
> >>
> >>
> --**--**-
> >> To unsubscribe, e-mail: users-unsubscribe@tapestry.**apache.org<
> 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: How to tell which page is being requested?

2012-08-24 Thread Joakim Olsson
Asset is before PageRender. See the image at the bottom of
http://tapestry.apache.org/request-processing.html

/Joakim


On Fri, Aug 24, 2012 at 8:45 PM, Michael Prescott
 wrote:
> I don't know!  I thought ordered configurations formed a linear sequence,
> so all I had to do was say which one I wanted it immediately before.
>  Supplying multiple constraints seems redundant, and possibly
> contradictory.  (e.g. "before a, but after c").
>
> I'll give that a shot, anyways.
>
> Michael
>
> On 24 August 2012 14:39, Thiago H de Paula Figueiredo 
> wrote:
>
>> On Fri, 24 Aug 2012 14:58:21 -0300, Michael Prescott <
>> michael.r.presc...@gmail.com> wrote:
>>
>>  I'm configuring my dispatcher with this:
>>>
>>> configuration.add("PageAuth", pageAuth, "before:PageRender");
>>> This tells Tapestry to put my pageAuth dispatcher.. *after* page render?
>>>
>>
>> Oops, my bad. But your dispatcher should be added before the asset one
>> too, shouldn't it?
>>
>> configuration.add("PageAuth", pageAuth, "before:PageRender",
>> "before:Asset");
>>
>>
>> --
>> Thiago H. de Paula Figueiredo
>>
>> --**--**-
>> To unsubscribe, e-mail: 
>> users-unsubscribe@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: How to tell which page is being requested?

2012-08-24 Thread Michael Prescott
I don't know!  I thought ordered configurations formed a linear sequence,
so all I had to do was say which one I wanted it immediately before.
 Supplying multiple constraints seems redundant, and possibly
contradictory.  (e.g. "before a, but after c").

I'll give that a shot, anyways.

Michael

On 24 August 2012 14:39, Thiago H de Paula Figueiredo wrote:

> On Fri, 24 Aug 2012 14:58:21 -0300, Michael Prescott <
> michael.r.presc...@gmail.com> wrote:
>
>  I'm configuring my dispatcher with this:
>>
>> configuration.add("PageAuth", pageAuth, "before:PageRender");
>> This tells Tapestry to put my pageAuth dispatcher.. *after* page render?
>>
>
> Oops, my bad. But your dispatcher should be added before the asset one
> too, shouldn't it?
>
> configuration.add("PageAuth", pageAuth, "before:PageRender",
> "before:Asset");
>
>
> --
> 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: How to tell which page is being requested?

2012-08-24 Thread Thiago H de Paula Figueiredo
On Fri, 24 Aug 2012 14:58:21 -0300, Michael Prescott  
 wrote:



I'm configuring my dispatcher with this:

configuration.add("PageAuth", pageAuth, "before:PageRender");
This tells Tapestry to put my pageAuth dispatcher.. *after* page render?


Oops, my bad. But your dispatcher should be added before the asset one  
too, shouldn't it?


configuration.add("PageAuth", pageAuth, "before:PageRender",  
"before:Asset");


--
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 tell which page is being requested?

2012-08-24 Thread Michael Prescott
I'm configuring my dispatcher with this:

configuration.add("PageAuth", pageAuth, "before:PageRender");

This tells Tapestry to put my pageAuth dispatcher.. *after* page render?

On 24 August 2012 13:44, Thiago H de Paula Figueiredo wrote:

> On Fri, 24 Aug 2012 14:25:01 -0300, Michael Prescott <
> michael.r.presc...@gmail.com> wrote:
>
>  Thanks for the reply.
>>
>> I suspect you're right in that a filter is the right way to go. I've used
>> tapestry-security before and fond acegi to have a hilariously complicated
>> domain model for my needs.
>>
>
> I'm talking about Tapestry-Security (http://tynamo.org/tapestry-**
> security%20guide ), not the
> Tapestry-Spring-Security. I've never used tapestry-security (from Tynamo)
> myself, but it seems easier to use than Tapestry-Spring-Security, which
> I've used in the past then dropped it.
>
>
>  In any case, I do think something strange is happening within Tapestry
>> (bet you've never heard that before).
>>
>
> I don't think so. It's common to put request filters or dispatchers
> without all the needed ordering constraints, and I think that's your case.
>
>
>  1. I think I'm contributing my dispatcher after the asset dispatcher (see
>> below).
>>
>
> You're adding it after PageRender (it should be before) and didn't specify
> anything about the asset dispatcher one.
> You can only be sure the ordering is correct by putting a breakpoint in
> TapestryModule.**buildMasterDispatcher().
>
>
> --
> 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: How to tell which page is being requested?

2012-08-24 Thread Thiago H de Paula Figueiredo
On Fri, 24 Aug 2012 14:25:01 -0300, Michael Prescott  
 wrote:



Thanks for the reply.

I suspect you're right in that a filter is the right way to go. I've used
tapestry-security before and fond acegi to have a hilariously complicated
domain model for my needs.


I'm talking about Tapestry-Security  
(http://tynamo.org/tapestry-security%20guide), not the  
Tapestry-Spring-Security. I've never used tapestry-security (from Tynamo)  
myself, but it seems easier to use than Tapestry-Spring-Security, which  
I've used in the past then dropped it.


In any case, I do think something strange is happening within Tapestry  
(bet you've never heard that before).


I don't think so. It's common to put request filters or dispatchers  
without all the needed ordering constraints, and I think that's your case.



1. I think I'm contributing my dispatcher after the asset dispatcher (see
below).


You're adding it after PageRender (it should be before) and didn't specify  
anything about the asset dispatcher one.
You can only be sure the ordering is correct by putting a breakpoint in  
TapestryModule.buildMasterDispatcher().


--
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 tell which page is being requested?

2012-08-24 Thread Michael Prescott
Thanks for the reply.

I suspect you're right in that a filter is the right way to go. I've used
tapestry-security before and fond acegi to have a hilariously complicated
domain model for my needs.

In any case, I do think something strange is happening within Tapestry (bet
you've never heard that before).

1. I think I'm contributing my dispatcher after the asset dispatcher (see
below).
2. When the problem occurs, decodePageRenderRequest does returns a non-null
value for asset paths like /assets/.../whatever.css, with the logical name
of my index page.
3. The problem only manifests once any of the page classes are
auto-reloaded by Tapestry (e.g. if I edit a .tml file).

Here's how I'm contributing the dispatcher from my module:

public void contributeMasterDispatcher(
OrderedConfiguration configuration,
 @InjectService("PageAuth") Dispatcher pageAuth) {
configuration.add("PageAuth", pageAuth, "before:PageRender");
}

Michael

On 23 August 2012 21:26, Thiago H de Paula Figueiredo wrote:

> On Thu, 23 Aug 2012 17:29:13 -0300, Michael Prescott <
> michael.r.presc...@gmail.com> wrote:
>
>  Hey there,
>>
>
> Hi!
>
>
>  This approach clearly isn't correct, however, because for asset requests,
>> it returns my Index page.  (Though, not always!)
>>
>
> I think implementing RequestFilter or using Tapestry Security are better
> suited than a Dispatcher for that, but, anyway, your problem is that you're
> probably adding your Dispatcher before the Asset one. Make sure your
> Dispatcher.dispatch() method returns false when the request is not for a
> page (i.e. ComponentEventLinkEncoder.**decodePageRenderRequest(**request)
> returns null).
>
> --
> 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: Dynamicly assign fixed "symbolic" root folders to the URL (Tapestry Tapestry 5.3.3)

2012-08-24 Thread uklance
Take a look at the code here:
https://github.com/uklance/tapestry-sandbox/blob/master/src/main/java/com/github/uklance/mode/ModeComponentEventLinkEncoder.java

It looks for "special" prefixes and stores the prefix in a Mode
environmental before rewriting the URL without the prefix. You can then use
the environmental in pages and components (for filtering etc).

Also, take a look at this thread
http://tapestry.1045711.n5.nabble.com/Adding-a-dynamic-sub-directory-to-URL-td5714532.html
where Thiago suggests using a filter and a ComponentEventLinkEncoder to do
URL rewriting. He suggests that the filter changes the Request and the
ComponentEventLinkEncoder only changes the Links.

Either way will work with subtle differences.



--
View this message in context: 
http://tapestry.1045711.n5.nabble.com/Dynamicly-assign-fixed-symbolic-root-folders-to-the-URL-Tapestry-Tapestry-5-3-3-tp5715743p5715748.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: Tapestry 5.2.5 Select component's multiple property

2012-08-24 Thread rmrajkumar77
Hi Taha,

I am new to tapestry and am trying to build multi select box and i believe
your codes will help me.

Could you please also share the codes for MultipleValueEncoder class.
Thanks.

Regards
Raj



--
View this message in context: 
http://tapestry.1045711.n5.nabble.com/Tapestry-5-2-5-Select-component-s-multiple-property-tp4304338p5715740.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: Dynamicly assign fixed "symbolic" root folders to the URL (Tapestry Tapestry 5.3.3)

2012-08-24 Thread pantera9
Ah! Changing it.. thanks ;)



--
View this message in context: 
http://tapestry.1045711.n5.nabble.com/Dynamicly-assign-fixed-symbolic-root-folders-to-the-URL-Tapestry-Tapestry-5-3-3-tp5715743p5715790.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: Dynamicly assign fixed "symbolic" root folders to the URL (Tapestry Tapestry 5.3.3)

2012-08-24 Thread Lance Java
You don't need to @Inject the Environment into your pages or components.

You can use the following instead:

@Environmental(false) // false means it can be null
private Area area;



--
View this message in context: 
http://tapestry.1045711.n5.nabble.com/Dynamicly-assign-fixed-symbolic-root-folders-to-the-URL-Tapestry-Tapestry-5-3-3-tp5715743p5715789.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: Dynamicly assign fixed "symbolic" root folders to the URL (Tapestry Tapestry 5.3.3)

2012-08-24 Thread pantera9
All right! I've managed to make it work with our app. Brilliant code Lance!
:)

Area is an equivalent to your Mode object.

I had to make a few rough changes:
if (!matcher.matches()) {
String newPath = "/"+ area.getArea() + "/";
transformed = link.copyWithBasePath(newPath);
//throw new RuntimeException("Illegal path " + 
link.getBasePath());
} else {
String newPath = String.format("/%s/%s/%s", area.getArea(),
matcher.group(1), matcher.group(2));
transformed = link.copyWithBasePath(newPath);
}

Remove the exception throwing and transform with area only if the link is:
"/"
It's our index link that does this:

  ...


I also added an else statement and moved the area position in the
formatting.

Thanks again!

-
For anyone else in the same situation, Lance's solution is here:
https://github.com/uklance/tapestry-sandbox/blob/master/src/main/java/com/github/uklance/mode/ModeComponentEventLinkEncoder.java

You'll need these files:
com.github.uklance.web.DelegateRequest;
com.github.uklance.mode.ModeComponentEventLinkEncoder.java
com.github.uklance.mode.Mode.java
com.github.uklance.mode.ModeImpl.java

And put this method in your AppModule.java:
https://github.com/uklance/tapestry-sandbox/blob/master/src/main/java/com/github/uklance/services/AppModule.java#L133

You can then type http://domain//some/otherLink
and the links on the page will be transformed to something like this:
http://domain/someModeITyped/some/otherLink

If you like us need to know what the URL got prefixed with, you can inject
the environment variable to any page like this:

@Inject
private Environment environment;

And access the prefix like this (ours is Area instead of Mode):

String getArea() {
Area area = environment.peek(Area.class);
return (area != null) ? area.getArea() : null;
}




--
View this message in context: 
http://tapestry.1045711.n5.nabble.com/Dynamicly-assign-fixed-symbolic-root-folders-to-the-URL-Tapestry-Tapestry-5-3-3-tp5715743p5715788.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: Dynamicly assign fixed "symbolic" root folders to the URL (Tapestry Tapestry 5.3.3)

2012-08-24 Thread pantera9
All right! I've managed to make it work with our app. Brilliant code Lance!
:)

Area is an equivalent to your Mode object.

I had to make a few rough changes:
if (!matcher.matches()) {
String newPath = "/"+ area.getArea() + "/";
transformed = link.copyWithBasePath(newPath);
//throw new RuntimeException("Illegal path " + 
link.getBasePath());
} else {
String newPath = String.format("/%s/%s/%s", area.getArea(),
matcher.group(1), matcher.group(2));
transformed = link.copyWithBasePath(newPath);
}

Remove the exception throwing and transform with area only if the link is:
"/"
It's our index link that does this:

  ...


I also added an else statement and moved the area position in the
formatting.

Thanks again!

-
For anyone else in the same situation, Lance's solution is here:
https://github.com/uklance/tapestry-sandbox/blob/master/src/main/java/com/github/uklance/mode/ModeComponentEventLinkEncoder.java

You'll need these files:
com.github.uklance.web.DelegateRequest;
com.github.uklance.mode.ModeComponentEventLinkEncoder.java
com.github.uklance.mode.Mode.java
com.github.uklance.mode.ModeImpl.java

And put this method in your AppModule.java:
https://github.com/uklance/tapestry-sandbox/blob/master/src/main/java/com/github/uklance/services/AppModule.java#L133

You can then type http://domain//some/otherLink
and the links on the page will be transformed to something like this:
http://domain/someModeITyped/some/otherLink

If you like us need to know what the URL got prefixed with, you can inject
the environment variable to any page like this:

@Inject
private Environment environment;

And access the prefix like this (ours is Area instead of Mode):

String getArea() {
Area area = environment.peek(Area.class);
return (area != null) ? area.getArea() : null;
}




--
View this message in context: 
http://tapestry.1045711.n5.nabble.com/Dynamicly-assign-fixed-symbolic-root-folders-to-the-URL-Tapestry-Tapestry-5-3-3-tp5715743p5715785.html
Sent from the Tapestry - User mailing list archive at Nabble.com.

Re: Dynamicly assign fixed "symbolic" root folders to the URL (Tapestry Tapestry 5.3.3)

2012-08-24 Thread pantera9
Thanks for answerring :)

I've come to the conclusion that the best and easiest solution for this is
Lance's "Mode"-code
I'm implementing it now, but I've run into a few snags I'm trying to iron
out. I'll get back to you!



--
View this message in context: 
http://tapestry.1045711.n5.nabble.com/Dynamicly-assign-fixed-symbolic-root-folders-to-the-URL-Tapestry-Tapestry-5-3-3-tp5715743p5715784.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: Named translators

2012-08-24 Thread Lance Java
Sorry, I was wrong... you can do it!!

AppModule.java
---
public void contributeTranslatorAlternatesSource(MappedConfiguration config) {
   configuration.add("fileSize", new FileSizeTranslator()); 
}



--
View this message in context: 
http://tapestry.1045711.n5.nabble.com/Named-translators-tp5715756p5715783.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: StreamResponse for small cacheable images

2012-08-24 Thread Lance Java
Use a separate page to generate the images and generate Links to the page.
For the page, onActivate(String image) returns the StreamResponse.



--
View this message in context: 
http://tapestry.1045711.n5.nabble.com/StreamResponse-for-small-cacheable-images-tp5715755p5715782.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: Named translators

2012-08-24 Thread Lance Java
I realise that it's a hack but unfortunately tapestry is using
MappedConfiguration so that there can only be one
translator mapped per class.

Perhaps this is another argument to consider adding a
MultiMappedConfiguration
http://tapestry.1045711.n5.nabble.com/MultiMapConfiguration-td5714003.html



--
View this message in context: 
http://tapestry.1045711.n5.nabble.com/Named-translators-tp5715756p5715781.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