T5: Disable JavaScript usage

2009-10-09 Thread Klaus Kopruch

Hello *

I've to create a WebApp which may use plain html only! Is it possible/does
it make sense to use Tapestry for that?

I would like to use Tapestry for that app because i made some good
experience with it, but is Tapestry able to avoid JavaScript at all?

Thanks for help
Klaus
-- 
View this message in context: 
http://www.nabble.com/T5%3A-Disable-JavaScript-usage-tp25817796p25817796.html
Sent from the Tapestry - User mailing list archive at Nabble.com.


T5, tapestry-spring-security, slf4j MDC

2009-10-09 Thread Borut Bolčina
Hello,

has anybody implemented logging with MDC %X{username}?

I would like to track users in my logs by their username and/or IP address.
Before I dive in, I just wanna ask if someone has already done it?

Thanks, Borut


Re: T5: Disable JavaScript usage

2009-10-09 Thread Peter Stavrinides
 I've to create a WebApp which may use plain html only! Is it possible/does
 it make sense to use Tapestry for that?
Yes of course,


 I would like to use Tapestry for that app because i made some good
 experience with it, but is Tapestry able to avoid JavaScript at all?
You are not forced to use JavaScript, Tapestry does include a minimum of 
JavaScript, but you don't have to use it.

cheers,
Peter



- Original Message -
From: Klaus Kopruch klaus.kopr...@materna.de
To: users@tapestry.apache.org
Sent: Friday, 9 October, 2009 12:00:16 GMT +02:00 Athens, Beirut, Bucharest, 
Istanbul
Subject: T5: Disable JavaScript usage


Hello *

I've to create a WebApp which may use plain html only! Is it possible/does
it make sense to use Tapestry for that?

I would like to use Tapestry for that app because i made some good
experience with it, but is Tapestry able to avoid JavaScript at all?

Thanks for help
Klaus
-- 
View this message in context: 
http://www.nabble.com/T5%3A-Disable-JavaScript-usage-tp25817796p25817796.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: Accessing the T5 IoC Registry

2009-10-09 Thread Javier Molina
You might want to contribute to the registry startup and initialize 
things there:


http://tapestry.apache.org/tapestry5/tapestry-ioc/startup.html


Benny Law escribió:

Thanks Ben, this looks reasonably clean to me. Unless somebody else offers a
better idea, I will probably go with this approach.

Benny

On Wed, Oct 7, 2009 at 10:08 AM, Ben Dotte ben.do...@gmail.com wrote:


Here's a trick we use for this. We extend TapestryFilter and override
init(Registry registry). Since this gets passed the created registry,
we then store that in a static variable on our filter and provide a
static getRegistry() method to retrieve it. This gets around the
problem that TapestryFilter stores the registry in a private instance
variable. To use your filter, just specify it in web.xml instead:

filter
   filter-namet5/filter-name
   filter-classcom.whatever.MyFilter/filter-class
/filter

This still requires that the registry has been created at the point
that it is requested, but at least you don't have to have access to
the servlet context.

Ben

On Wed, Oct 7, 2009 at 6:58 AM, Benny Law benny.mk@gmail.com wrote:

Thank you all for your help. This is why I need to do this:

I have an immutable class called ProjectType, and it has a few predefined
instances held in public static final fields (ProjectType.GD,
ProjectType.TF, etc.) These instances need to be initialized with data

from

the database, so my approach was to do that inside the static

initializer.

However, I need to access the service that provides the database

operations,

and the service is registered in the IoC container.

If anyone has a better idea, I will be glad to learn. I believe there are
rare occasions when the registry is needed outside of normal injection,

so

having a convenient way to get to it in Tapestry would be nice, although

it

may open up opportunities for abuse.

Benny Law

On Wed, Oct 7, 2009 at 4:58 AM, Ben Gidley b...@gidley.co.uk wrote:


You can get it from the servlet context - it adds it to a context

variable.

 Registry registry = (Registry)
getServletContext().getAttribute(TapestryFilter.REGISTRY_CONTEXT_NAME);

This shouldn't really be used inside another service as it is a bit
confusing. You may also have to make sure it doesn't get called until
tapestry-ioc has initialised via the servlet filter otherwise the

attribute

won't be there yet.

Ben Gidley

www.gidley.co.uk
b...@gidley.co.uk


On Wed, Oct 7, 2009 at 9:37 AM, Alfie Kirkpatrick 
alfie.kirkpatr...@ioko.com wrote:


You can inject ObjectLocator into a service but it doesn't sound like
this would work for you as it's still essentially injection in the
normal way.

For webapps TapestryFilter doesn't put the registry in a static

anywhere

so there is no way to get the registry from 'outside' the dependency
injection framework AFAIK. You could of course copy TapestryFilter,
write your own, and put it into a static/threadlocal.

Maybe you can explain why you have a static initialiser that needs the
registry? It sounds very 'un-tapestry' ;-)

Alfie.

-Original Message-
From: Benny Law [mailto:benny.mk@gmail.com]
Sent: 07 October 2009 01:34
To: Tapestry Users
Subject: Accessing the T5 IoC Registry

Hello,

How can I obtain a service from the IoC registry inside a static
initializer? Injection doesn't seem to work with static members, so I
need
to access the registry directly, or is there a better way?

Thanks,

Benny Law

-
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







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



Re: T5: Disable JavaScript usage

2009-10-09 Thread Christian Riedel
i saw tapestry even include no javascript at all on pages without 
tapestry-form-components. just give it a try ;)


Peter Stavrinides schrieb:

I've to create a WebApp which may use plain html only! Is it possible/does
it make sense to use Tapestry for that?


Yes of course,


  

I would like to use Tapestry for that app because i made some good
experience with it, but is Tapestry able to avoid JavaScript at all?


You are not forced to use JavaScript, Tapestry does include a minimum of 
JavaScript, but you don't have to use it.

cheers,
Peter



- Original Message -
From: Klaus Kopruch klaus.kopr...@materna.de
To: users@tapestry.apache.org
Sent: Friday, 9 October, 2009 12:00:16 GMT +02:00 Athens, Beirut, Bucharest, 
Istanbul
Subject: T5: Disable JavaScript usage


Hello *

I've to create a WebApp which may use plain html only! Is it possible/does
it make sense to use Tapestry for that?

I would like to use Tapestry for that app because i made some good
experience with it, but is Tapestry able to avoid JavaScript at all?

Thanks for help
Klaus
  


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



Re: T5, tapestry-spring-security, slf4j MDC

2009-10-09 Thread Olle Hallin
We do something similar. We have implemented a RequestFilter that pushes the
HttpSession ID (if any) onto the Log4j Nested Diagnostics Context (NDC)
before the request, and pops it afterwards.
I guess that the same approach could be used for pushing usernames in the
SLF4J MDC, provided that you can get hold of them from a RequestFilter.

Good to know: Tapestry 5.1 stores @SessionStateObjects in the session under
the key sso: + MySessionStateObject.class.getName(). (aso: in 5.0.*)

HTH,
Olle

Senior Java Developer and Architect
olle.hal...@crisp.se
www.crisp.se




2009/10/9 Borut Bolčina borut.bolc...@gmail.com

 Hello,

 has anybody implemented logging with MDC %X{username}?

 I would like to track users in my logs by their username and/or IP address.
 Before I dive in, I just wanna ask if someone has already done it?

 Thanks, Borut



Re: T5: Disable JavaScript usage

2009-10-09 Thread Inge Solvoll
I think you just have to turn off client validation to remove javascript
from forms too.

I don't think Tapestry includes any javascript at all unless a component
requires it.

On Fri, Oct 9, 2009 at 11:36 AM, Christian Riedel
christian-rie...@gmx.netwrote:

 i saw tapestry even include no javascript at all on pages without
 tapestry-form-components. just give it a try ;)

 Peter Stavrinides schrieb:

 I've to create a WebApp which may use plain html only! Is it possible/does
 it make sense to use Tapestry for that?


 Yes of course,




 I would like to use Tapestry for that app because i made some good
 experience with it, but is Tapestry able to avoid JavaScript at all?


 You are not forced to use JavaScript, Tapestry does include a minimum of
 JavaScript, but you don't have to use it.

 cheers,
 Peter



 - Original Message -
 From: Klaus Kopruch klaus.kopr...@materna.de
 To: users@tapestry.apache.org
 Sent: Friday, 9 October, 2009 12:00:16 GMT +02:00 Athens, Beirut,
 Bucharest, Istanbul
 Subject: T5: Disable JavaScript usage


 Hello *

 I've to create a WebApp which may use plain html only! Is it possible/does
 it make sense to use Tapestry for that?

 I would like to use Tapestry for that app because i made some good
 experience with it, but is Tapestry able to avoid JavaScript at all?

 Thanks for help
 Klaus



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




Re: T5: Disable JavaScript usage

2009-10-09 Thread Niclas.Meier
Hello Klaus,

If you want prevent Tapestry to include the Default JS and CSS files you may 
override the ClientInfrastructure service. This service defines all the assets 
needed to Tapestry 5 client infrastructure including scriptaculous, prototype, 
blackbird, etc.

Regards
NIclas


On 09.10.09 11:00, Klaus Kopruch klaus.kopr...@materna.de wrote:



Hello *

I've to create a WebApp which may use plain html only! Is it possible/does
it make sense to use Tapestry for that?

I would like to use Tapestry for that app because i made some good
experience with it, but is Tapestry able to avoid JavaScript at all?

Thanks for help
Klaus
--
View this message in context: 
http://www.nabble.com/T5%3A-Disable-JavaScript-usage-tp25817796p25817796.html
Sent from the Tapestry - User mailing list archive at Nabble.com.


Re: T5: Disable JavaScript usage

2009-10-09 Thread Klaus Kopruch

Hallo Niclas,

thank you for this hint. I'll try!

Regards
Klaus


Niclas.Meier wrote:
 
 Hello Klaus,
 
 If you want prevent Tapestry to include the Default JS and CSS files you
 may override the ClientInfrastructure service. This service defines all
 the assets needed to Tapestry 5 client infrastructure including
 scriptaculous, prototype, blackbird, etc.
 
 Regards
 NIclas
 
 
 On 09.10.09 11:00, Klaus Kopruch klaus.kopr...@materna.de wrote:
 
 
 
 Hello *
 
 I've to create a WebApp which may use plain html only! Is it possible/does
 it make sense to use Tapestry for that?
 
 I would like to use Tapestry for that app because i made some good
 experience with it, but is Tapestry able to avoid JavaScript at all?
 
 Thanks for help
 Klaus
 --
 View this message in context:
 http://www.nabble.com/T5%3A-Disable-JavaScript-usage-tp25817796p25817796.html
 Sent from the Tapestry - User mailing list archive at Nabble.com.
 
 

-- 
View this message in context: 
http://www.nabble.com/T5%3A-Disable-JavaScript-usage-tp25817796p25819598.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: T5: Disable JavaScript usage

2009-10-09 Thread Klaus Kopruch

Thanks!

I'll use Tapestry ...
-- 
View this message in context: 
http://www.nabble.com/T5%3A-Disable-JavaScript-usage-tp25817796p25819605.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: T5, tapestry-spring-security, slf4j MDC

2009-10-09 Thread Borut Bolčina
Olle thanks,

this is what I did:

public class RequestLoggingFilter implements HttpServletRequestFilter {
public final RequestGlobals requestGlobals;

public RequestLoggingFilter(final RequestGlobals requestGlobalss) {
this.requestGlobals = requestGlobalss;
}

@Override
public boolean service(HttpServletRequest request, HttpServletResponse
response, HttpServletRequestHandler handler)
throws IOException {
MDC.put(remoteIP,
this.requestGlobals.getHTTPServletRequest().getRemoteAddr());

String s =
this.requestGlobals.getHTTPServletRequest().getRequestedSessionId();
if (s == null) {
s = ;
}
MDC.put(sessionID, s);
return handler.service(request, response);
}
}

and in my AppModule.java

public RequestLoggingFilter buildRequestLoggingFilter(final
RequestGlobals requestGlobals) {
return new RequestLoggingFilter(requestGlobals);
}

public static void contributeHttpServletRequestHandler(
OrderedConfigurationHttpServletRequestFilter configuration,
@InjectService(RequestLoggingFilter) HttpServletRequestFilter
myfilter) {
configuration.add(myfilter, myfilter, before:*);
}


but I feel I am missing something. Where do I put the code:
MDC.remove(remoteIP);
MDC.remove(sessionID);


Thanks,
Borut

2009/10/9 Olle Hallin olle.hal...@hit.se

 We do something similar. We have implemented a RequestFilter that pushes
 the
 HttpSession ID (if any) onto the Log4j Nested Diagnostics Context (NDC)
 before the request, and pops it afterwards.
 I guess that the same approach could be used for pushing usernames in the
 SLF4J MDC, provided that you can get hold of them from a RequestFilter.

 Good to know: Tapestry 5.1 stores @SessionStateObjects in the session under
 the key sso: + MySessionStateObject.class.getName(). (aso: in 5.0.*)

 HTH,
 Olle

 Senior Java Developer and Architect
 olle.hal...@crisp.se
 www.crisp.se




 2009/10/9 Borut Bolčina borut.bolc...@gmail.com

  Hello,
 
  has anybody implemented logging with MDC %X{username}?
 
  I would like to track users in my logs by their username and/or IP
 address.
  Before I dive in, I just wanna ask if someone has already done it?
 
  Thanks, Borut
 



Re: T5 - Post Form To SSL

2009-10-09 Thread Daniel Jones

Thanks Olle,

I hope this is fixed soon, I would have thought that this is a common
use-case.

Cheers,
Daniel


Olle Hallin-2 wrote:
 
 Created https://issues.apache.org/jira/browse/TAP5-874 .
 
 Olle
 
 2009/10/2 Thiago H. de Paula Figueiredo thiag...@gmail.com
 
 Em Thu, 01 Oct 2009 20:11:08 -0300, Daniel Jones d...@murieston.com
 escreveu:

  Hi There,


 Hi!

  Is there any way to tell a form to post using https.  What I was ideally
 looking for was an extra parameter on the Form component, for example:

 t:form t:id=form1 t:secure=true
  ...
 /t:form


 Please post a JIRA about it unless some comes with an answer. ;)

 --
 Thiago H. de Paula Figueiredo
 Independent Java consultant, developer, and instructor
 http://www.arsmachina.com.br/thiago


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


 
 

-- 
View this message in context: 
http://www.nabble.com/T5---Post-Form-To-SSL-tp25708078p25820830.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



Antwort: Re: T5, tapestry-spring-security, slf4j MDC

2009-10-09 Thread dirk . lattermann
Hi!

Borut Bolčina borut.bolc...@gmail.com schrieb am 09.10.2009 14:55:32:

 this is what I did:
 
 public class RequestLoggingFilter implements HttpServletRequestFilter {
 public final RequestGlobals requestGlobals;
 
 public RequestLoggingFilter(final RequestGlobals requestGlobalss) {
 this.requestGlobals = requestGlobalss;
 }
 
 @Override
 public boolean service(HttpServletRequest request, 
HttpServletResponse
 response, HttpServletRequestHandler handler)
 throws IOException {
 MDC.put(remoteIP,
 this.requestGlobals.getHTTPServletRequest().getRemoteAddr());
 
 String s =
 this.requestGlobals.getHTTPServletRequest().getRequestedSessionId();
 if (s == null) {
 s = ;
 }
 MDC.put(sessionID, s);
 return handler.service(request, response);
 }
 }

 
 but I feel I am missing something. Where do I put the code:
 MDC.remove(remoteIP);
 MDC.remove(sessionID);
 

In a similar situation, I used something like

@Override
public boolean service(HttpServletRequest request, HttpServletResponse
response, HttpServletRequestHandler handler)
throws IOException {
MDC.put(remoteIP,
this.requestGlobals.getHTTPServletRequest().getRemoteAddr());

String s =
this.requestGlobals.getHTTPServletRequest().getRequestedSessionId();
if (s == null) {
s = ;
}
MDC.put(sessionID, s);
boolean result = handler.service(request, response);

MDC.remove(remoteIP);
MDC.remove(sessionID);

return result;
}
}


but I'm not sure if it does the right thing in all situations.

Dirk



BGS Beratungsgesellschaft 
Software Systemplanung AG 
  
  
  
  
Niederlassung Köln/Bonn 
Grantham-Allee 2-8 
53757 Sankt Augustin 
Fon: +49 (0) 2241 / 166-500 
Fax: +49 (0) 2241 / 166-680 
www.bgs-ag.de 
Geschäftssitz Mainz 
Registergericht 
Amtsgericht Mainz 
HRB 62 50 
  
Aufsichtsratsvorsitzender 
Klaus Hellwig 
Vorstand 
Hermann Kiefer 
Nils Manegold 
Thomas Reitz 

  

Reusable YesNoRadio component

2009-10-09 Thread ross.efi

I'm trying to make a little reusable component to remove a bunch of cut and
paste.  It uses a radio group for Yes and No and uses a boolean for the
value.  I want to use it like this:

tr
tht:label for=someAttribute//th
tdt:yesnoradio t:id=someAttribute
value=myObject.isYesNo//td
/tr

Here's what I have:

YesNoRadio.tml:

t:container xmlns:t=http://tapestry.apache.org/schema/tapestry_5_1_0.xsd;
t:radiogroup t:id=id value=stringValue encoder=stringEncoder
t:radio t:id=idForY value=literal:true label=Yes/t:label
for=idForY/
t:radio t:id=idForN value=literal:false label=No/t:label
for=idForN/
/t:radiogroup
/t:container

YesNoRadio.java

public class YesNoRadio {

@Parameter
private String _id;

@Parameter
private boolean _value;

@Property
private String _stringValue;

@Property
private StringValueEncoder _stringEncoder = new StringValueEncoder();

void onSuccess() {
_value = Boolean.valueOf( _stringValue );
}

void onPrepare() {
_stringValue = String.valueOf( _value );
}
}

I can't seem to get the id to work correctly - I just want to pass it down
to the underlying radiogroup.  This component will appear more than once on
a page, so I want each use to have an id that each label can use.

Will the component get notified by the form using onPrepare and onSuccess? 
I need to convert the value boolean into a string for the radios to work
with.

Am I on the right track?

Ross
-- 
View this message in context: 
http://www.nabble.com/Reusable-YesNoRadio-component-tp25821019p25821019.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: Reusable YesNoRadio component

2009-10-09 Thread Thiago H. de Paula Figueiredo
Take a look at how the Tapestry-provided field components are implemented  
and use one of them as your starting point. Don't forget to subclass  
AbstractField, as it already implements the hard parts of implementing a  
field component.


--
Thiago H. de Paula Figueiredo
Independent Java consultant, developer, and instructor
http://www.arsmachina.com.br/thiago

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



Re: Accessing the T5 IoC Registry

2009-10-09 Thread Benny Law
Thanks Javier. This is actually what I ended up doing after doing more
research. It seems to be the best approach.

Regards,

Benny

On Fri, Oct 9, 2009 at 5:28 AM, Javier Molina jav...@comunicamultimedia.com
 wrote:

 You might want to contribute to the registry startup and initialize things
 there:

 http://tapestry.apache.org/tapestry5/tapestry-ioc/startup.html


 Benny Law escribió:

  Thanks Ben, this looks reasonably clean to me. Unless somebody else offers
 a
 better idea, I will probably go with this approach.

 Benny

 On Wed, Oct 7, 2009 at 10:08 AM, Ben Dotte ben.do...@gmail.com wrote:

  Here's a trick we use for this. We extend TapestryFilter and override
 init(Registry registry). Since this gets passed the created registry,
 we then store that in a static variable on our filter and provide a
 static getRegistry() method to retrieve it. This gets around the
 problem that TapestryFilter stores the registry in a private instance
 variable. To use your filter, just specify it in web.xml instead:

 filter
   filter-namet5/filter-name
   filter-classcom.whatever.MyFilter/filter-class
 /filter

 This still requires that the registry has been created at the point
 that it is requested, but at least you don't have to have access to
 the servlet context.

 Ben

 On Wed, Oct 7, 2009 at 6:58 AM, Benny Law benny.mk@gmail.com
 wrote:

 Thank you all for your help. This is why I need to do this:

 I have an immutable class called ProjectType, and it has a few
 predefined
 instances held in public static final fields (ProjectType.GD,
 ProjectType.TF, etc.) These instances need to be initialized with data

 from

 the database, so my approach was to do that inside the static

 initializer.

 However, I need to access the service that provides the database

 operations,

 and the service is registered in the IoC container.

 If anyone has a better idea, I will be glad to learn. I believe there
 are
 rare occasions when the registry is needed outside of normal injection,

 so

 having a convenient way to get to it in Tapestry would be nice, although

 it

 may open up opportunities for abuse.

 Benny Law

 On Wed, Oct 7, 2009 at 4:58 AM, Ben Gidley b...@gidley.co.uk wrote:

  You can get it from the servlet context - it adds it to a context

 variable.

  Registry registry = (Registry)
 getServletContext().getAttribute(TapestryFilter.REGISTRY_CONTEXT_NAME);

 This shouldn't really be used inside another service as it is a bit
 confusing. You may also have to make sure it doesn't get called until
 tapestry-ioc has initialised via the servlet filter otherwise the

 attribute

 won't be there yet.

 Ben Gidley

 www.gidley.co.uk
 b...@gidley.co.uk


 On Wed, Oct 7, 2009 at 9:37 AM, Alfie Kirkpatrick 
 alfie.kirkpatr...@ioko.com wrote:

  You can inject ObjectLocator into a service but it doesn't sound like
 this would work for you as it's still essentially injection in the
 normal way.

 For webapps TapestryFilter doesn't put the registry in a static

 anywhere

 so there is no way to get the registry from 'outside' the dependency
 injection framework AFAIK. You could of course copy TapestryFilter,
 write your own, and put it into a static/threadlocal.

 Maybe you can explain why you have a static initialiser that needs the
 registry? It sounds very 'un-tapestry' ;-)

 Alfie.

 -Original Message-
 From: Benny Law [mailto:benny.mk@gmail.com]
 Sent: 07 October 2009 01:34
 To: Tapestry Users
 Subject: Accessing the T5 IoC Registry

 Hello,

 How can I obtain a service from the IoC registry inside a static
 initializer? Injection doesn't seem to work with static members, so I
 need
 to access the registry directly, or is there a better way?

 Thanks,

 Benny Law

 -
 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





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




T5: Autocompleter - use for multiple selections in 1 single textfield

2009-10-09 Thread Fermin Da Costa Gomez
Hi,

I am trying to use the autocompleter in a text inputfield to not select
multiple values.
It concerns a searchline (like google) where the 1st selection works
perfectly.
Then after the field is selected (like *fieldname:* ) one can continue by
supplying the value.
This also works, i get to see the values available to the particular field.

Problem: when i select a certain value in the autocompletion list all the
other info gets replaced by the value that was selected last.
So instead of *fieldname:value* i get just *value*
Obviously i'm looking for the value to be appended to the fieldname not for
the value to remove the fieldname.

I'v tried t:tokens=':' and t:tokens=' ' but that does not do the trick.

I'm sure i'm overlooking something but i haven't found it yet.

Any suggestion(s) would be appreciated.

Tia,

Fermin DCG


Re: T5: Autocompleter - use for multiple selections in 1 single textfield

2009-10-09 Thread Thiago H. de Paula Figueiredo
Em Fri, 09 Oct 2009 11:58:11 -0300, Fermin Da Costa Gomez  
dacostago...@gmail.com escreveu:
I'v tried t:tokens=':' and t:tokens=' ' but that does not do the  
trick.


Try t:tokens=:. You're using Java literal character syntax in something  
that receives a literal String.


--
Thiago H. de Paula Figueiredo
Independent Java consultant, developer, and instructor
http://www.arsmachina.com.br/thiago

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



Re: Re: T5, tapestry-spring-security, slf4j MDC

2009-10-09 Thread Olle Hallin
Do like this:
MDC.put(xxx, ...);
MDC.put(yyy, ...);

try {
   return handler.service(request, response);
} finally {
  MDC.remove(xxx)
  MDC.remove(yyy)
}

or else you will have problems when your request throws an exception

Olle Hallin
Senior Java Developer and Architect
olle.hal...@crisp.se
www.crisp.se




2009/10/9 dirk.latterm...@bgs-ag.de

 Hi!

 Borut Bolčina borut.bolc...@gmail.com schrieb am 09.10.2009 14:55:32:

  this is what I did:
 
  public class RequestLoggingFilter implements HttpServletRequestFilter {
  public final RequestGlobals requestGlobals;
 
  public RequestLoggingFilter(final RequestGlobals requestGlobalss) {
  this.requestGlobals = requestGlobalss;
  }
 
  @Override
  public boolean service(HttpServletRequest request,
 HttpServletResponse
  response, HttpServletRequestHandler handler)
  throws IOException {
  MDC.put(remoteIP,
  this.requestGlobals.getHTTPServletRequest().getRemoteAddr());
 
  String s =
  this.requestGlobals.getHTTPServletRequest().getRequestedSessionId();
  if (s == null) {
  s = ;
  }
  MDC.put(sessionID, s);
  return handler.service(request, response);
  }
  }

 
  but I feel I am missing something. Where do I put the code:
  MDC.remove(remoteIP);
  MDC.remove(sessionID);
 

 In a similar situation, I used something like
 
 @Override
public boolean service(HttpServletRequest request, HttpServletResponse
 response, HttpServletRequestHandler handler)
throws IOException {
MDC.put(remoteIP,
 this.requestGlobals.getHTTPServletRequest().getRemoteAddr());

String s =
 this.requestGlobals.getHTTPServletRequest().getRequestedSessionId();
if (s == null) {
s = ;
}
MDC.put(sessionID, s);
 boolean result = handler.service(request, response);

MDC.remove(remoteIP);
MDC.remove(sessionID);

 return result;
}
 }
 

 but I'm not sure if it does the right thing in all situations.

 Dirk



 BGS Beratungsgesellschaft
 Software Systemplanung AG




 Niederlassung Köln/Bonn
 Grantham-Allee 2-8
 53757 Sankt Augustin
 Fon: +49 (0) 2241 / 166-500
 Fax: +49 (0) 2241 / 166-680
 www.bgs-ag.de
 Geschäftssitz Mainz
 Registergericht
 Amtsgericht Mainz
 HRB 62 50

 Aufsichtsratsvorsitzender
 Klaus Hellwig
 Vorstand
 Hermann Kiefer
 Nils Manegold
 Thomas Reitz




Re: T5: Autocompleter - use for multiple selections in 1 single textfield

2009-10-09 Thread Fermin Da Costa Gomez

 Em Fri, 09 Oct 2009 11:58:11 -0300, Fermin Da Costa Gomez 
 dacostago...@gmail.com escreveu:

 I'v tried t:tokens=':' and t:tokens=' ' but that does not do the
 trick.


 Try t:tokens=:. You're using Java literal character syntax in something
 that receives a literal String.

I can indeed see a different behaviour and the fact that i omitted 1 small
but significant fact.
Space would also be a separator for normal terms or k:v pairs. And for some
reason i can't see t:tokens= : work, or does it?




 --
 Thiago H. de Paula Figueiredo
 Independent Java consultant, developer, and instructor
 http://www.arsmachina.com.br/thiago

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




-- 
“The reasonable man adapts himself to the world; the unreasonable one
persists in trying to adapt the world to himself. Therefore all progress
depends on the unreasonable man.”
- George Bernard Shaw (1856 - 1950)


Javascript not included on Ajax.Request

2009-10-09 Thread Inge Solvoll
Hi!

I use prototype Ajax.Request to load a tapestry page url into a non-tapestry
page. The response content is appended to the document with javascript.

My problem is that javascript that is included in the tapestry page seems to
not be included/interpreted in the browser when the content is received via
XmlHttpRequest. It all works if I do a normal page render.

Is this supposed to work, or do I have to find some other approach?


How to write a Testify test for an onActivate() that returns a URL?

2009-10-09 Thread Olle Hallin
Hi,

I'm struggling with writing a test for a page that just redirects to an
external page.

The page basically looks like this:

public class Redirecter {

  @Inject
  private UrlManager urlManager;

  public Object onActivate() {
java.net.URL url = new URL(urlManager.getExternalUrlFor(some-string));
return url;
  }
}

I have managed to mock urlManager.getExternalUrlFor(), but then Testify
throws

java.lang.RuntimeException: TestableResponse: Method sendRedirect() not yet
implemented.

Any ideas?

Olle Hallin
Senior Java Developer and Architect
olle.hal...@crisp.se
www.crisp.se


Re: T5: Autocompleter - use for multiple selections in 1 single textfield

2009-10-09 Thread Thiago H. de Paula Figueiredo
Em Fri, 09 Oct 2009 12:16:05 -0300, Fermin Da Costa Gomez  
dacostago...@dcgconsultancy.nl escreveu:


I can indeed see a different behaviour and the fact that i omitted 1  
small but significant fact.
Space would also be a separator for normal terms or k:v pairs. And for  
some reason i can't see t:tokens= : work, or does it?


I don't know. Try putting a breakpoing in the Autocomplete sources to see  
what's the value of the tokens field.


--
Thiago H. de Paula Figueiredo
Independent Java consultant, developer, and instructor
http://www.arsmachina.com.br/thiago

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



Re: Javascript not included on Ajax.Request

2009-10-09 Thread Andreas Andreou
That's normal - you need to look at the prototype docs to see if there's a
helper function that will run the scripts of an ajax response... or if there's
a helper that appends html to the current document AND executes the included
(in that html) scripts.

I know dojo has something similar, perhaps prototype has that too

On Fri, Oct 9, 2009 at 6:18 PM, Inge Solvoll inge.tapes...@gmail.com wrote:
 Hi!

 I use prototype Ajax.Request to load a tapestry page url into a non-tapestry
 page. The response content is appended to the document with javascript.

 My problem is that javascript that is included in the tapestry page seems to
 not be included/interpreted in the browser when the content is received via
 XmlHttpRequest. It all works if I do a normal page render.

 Is this supposed to work, or do I have to find some other approach?




-- 
Andreas Andreou - andy...@apache.org - http://blog.andyhot.gr
Tapestry / Tacos developer
Open Source / JEE Consulting

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



Re: Javascript not included on Ajax.Request

2009-10-09 Thread cordenier christophe
Hi

If you only append content i don't think it will work. Have a look at how
Tapestry achieve JS loading in loadScriptsInReply method of 'tapestry.js'
file.

christophe.

2009/10/9 Inge Solvoll inge.tapes...@gmail.com

 Hi!

 I use prototype Ajax.Request to load a tapestry page url into a
 non-tapestry
 page. The response content is appended to the document with javascript.

 My problem is that javascript that is included in the tapestry page seems
 to
 not be included/interpreted in the browser when the content is received via
 XmlHttpRequest. It all works if I do a normal page render.

 Is this supposed to work, or do I have to find some other approach?



Re: T5: Autocompleter - use for multiple selections in 1 single textfield

2009-10-09 Thread Fermin Da Costa Gomez

 Em Fri, 09 Oct 2009 12:16:05 -0300, Fermin Da Costa Gomez 
 dacostago...@dcgconsultancy.nl escreveu:

  I can indeed see a different behaviour and the fact that i omitted 1 small
 but significant fact.
 Space would also be a separator for normal terms or k:v pairs. And for
 some reason i can't see t:tokens= : work, or does it?


 I don't know. Try putting a breakpoing in the Autocomplete sources to see
 what's the value of the tokens field.

I think i'll have to because using the :' makes me lose the fieldname
before the :. Which is probably according to the spec but not for me ..

I have to use a space and that throws back an empty error at me without the
' '. And, using the ' ' brings me back to the original issue again.
Will 'report back'.




 --
 Thiago H. de Paula Figueiredo
 Independent Java consultant, developer, and instructor
 http://www.arsmachina.com.br/thiago

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




-- 
“The reasonable man adapts himself to the world; the unreasonable one
persists in trying to adapt the world to himself. Therefore all progress
depends on the unreasonable man.”
- George Bernard Shaw (1856 - 1950)


Re: Reusable YesNoRadio component

2009-10-09 Thread cordenier christophe
Hi

You should also use the clientId instead :

Inherit previx can be used to inherit a specific parameter from the outer
component.

 t:radiogroup t:id=id t:clientId=inherit:clientId value=stringValue
encoder=stringEncoder

And your YesNoRadio

@Parameter
private String clientId;

Regards,
Christophe

2009/10/9 ross.efi ross@att.net


 I'm trying to make a little reusable component to remove a bunch of cut and
 paste.  It uses a radio group for Yes and No and uses a boolean for the
 value.  I want to use it like this:

tr
tht:label for=someAttribute//th
tdt:yesnoradio t:id=someAttribute
 value=myObject.isYesNo//td
/tr

 Here's what I have:

 YesNoRadio.tml:

 t:container xmlns:t=http://tapestry.apache.org/schema/tapestry_5_1_0.xsd
 
t:radiogroup t:id=id value=stringValue encoder=stringEncoder
t:radio t:id=idForY value=literal:true label=Yes/t:label
 for=idForY/
t:radio t:id=idForN value=literal:false label=No/t:label
 for=idForN/
/t:radiogroup
 /t:container

 YesNoRadio.java

 public class YesNoRadio {

@Parameter
private String _id;

@Parameter
private boolean _value;

@Property
private String _stringValue;

@Property
private StringValueEncoder _stringEncoder = new StringValueEncoder();

void onSuccess() {
_value = Boolean.valueOf( _stringValue );
}

void onPrepare() {
_stringValue = String.valueOf( _value );
}
 }

 I can't seem to get the id to work correctly - I just want to pass it down
 to the underlying radiogroup.  This component will appear more than once on
 a page, so I want each use to have an id that each label can use.

 Will the component get notified by the form using onPrepare and onSuccess?
 I need to convert the value boolean into a string for the radios to work
 with.

 Am I on the right track?

 Ross
 --
 View this message in context:
 http://www.nabble.com/Reusable-YesNoRadio-component-tp25821019p25821019.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: Tapestry5 IoC and Request problem

2009-10-09 Thread cuartz

Thanks Thiago, let me see if i understand, so in my tapestry 4 page i use the
storeServletRequestResponse method to store them and then i call my service?
i guess im missing something here



Thiago H. de Paula Figueiredo wrote:
 
 Em Thu, 08 Oct 2009 20:55:04 -0300, cuartz carlos.pc...@gmail.com  
 escreveu:
 
 Hello everybody,
 
 Hi!
 
 i had a problem trying to use the tapestr5 IoC from tapestry 4 pages,  
 its a big system whit tpaestry5 and tapestry 4 pages, when i call a  
 service that handles the request (org.apache.tapestry5.services.Request)
 from tapestry5 pages everything is ok, but when i call this service from  
 a tapestry4 page i get a java.lang.RuntimeException, everithing is ok  
 but when the service call some method from the request i get this error.
 
 I guess this happens because Request is a shadow service: actually, when  
 you use an injected instance of it, you're calling  
 RequestGlobals.getRequest(). This method returns a Request instance set  
 during Tapestry 5 request processing. Whan a request is handled by  
 Tapestry 4, RequestGlobal, which is a perthread service, doesn't have the  
 Request set, then you have your exception. One possible solution is to  
 invoke RequestGlobals.storeRequestResponse(Request request, Response  
 response) yourself before Request is used.
 
 -- 
 Thiago H. de Paula Figueiredo
 Independent Java consultant, developer, and instructor
 http://www.arsmachina.com.br/thiago
 
 -
 To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org
 For additional commands, e-mail: users-h...@tapestry.apache.org
 
 
 

-- 
View this message in context: 
http://www.nabble.com/Tapestry5-IoC-and-Request-problem-tp25813570p25824956.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: T5: Autocompleter - use for multiple selections in 1 single textfield

2009-10-09 Thread Fermin Da Costa Gomez
Can someone tell me if it is indeed correct that the removal of already
available data in the input field is done on the client when an autocomplete
entry is selected?
If this is correct, would there be an elegant way to 'break into' the js
code to modify this behaviour?

If however, this is not the case where can i 'capture' the old value once
the selection in made so that i don't actually lose it on commit.

Tia

On Fri, Oct 9, 2009 at 5:44 PM, Fermin Da Costa Gomez 
dacostago...@dcgconsultancy.nl wrote:

 Em Fri, 09 Oct 2009 12:16:05 -0300, Fermin Da Costa Gomez 
 dacostago...@dcgconsultancy.nl escreveu:

  I can indeed see a different behaviour and the fact that i omitted 1
 small but significant fact.
 Space would also be a separator for normal terms or k:v pairs. And for
 some reason i can't see t:tokens= : work, or does it?


 I don't know. Try putting a breakpoing in the Autocomplete sources to see
 what's the value of the tokens field.

 I think i'll have to because using the :' makes me lose the fieldname
 before the :. Which is probably according to the spec but not for me ..

 I have to use a space and that throws back an empty error at me without the
 ' '. And, using the ' ' brings me back to the original issue again.
 Will 'report back'.




 --
 Thiago H. de Paula Figueiredo
 Independent Java consultant, developer, and instructor
 http://www.arsmachina.com.br/thiago

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




 --
 “The reasonable man adapts himself to the world; the unreasonable one
 persists in trying to adapt the world to himself. Therefore all progress
 depends on the unreasonable man.”
 - George Bernard Shaw (1856 - 1950)




-- 
“The reasonable man adapts himself to the world; the unreasonable one
persists in trying to adapt the world to himself. Therefore all progress
depends on the unreasonable man.”
- George Bernard Shaw (1856 - 1950)


Re: Tapestry5 IoC and Request problem

2009-10-09 Thread Thiago H. de Paula Figueiredo
Em Fri, 09 Oct 2009 14:24:28 -0300, cuartz carlos.pc...@gmail.com  
escreveu:


Thanks Thiago, let me see if i understand, so in my tapestry 4 page i  
use the storeServletRequestResponse method to store them and then i call  
my service?


I guess so.

--
Thiago H. de Paula Figueiredo
Independent Java consultant, developer, and instructor
http://www.arsmachina.com.br/thiago

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



Re: Tapestry5 IoC and Request problem

2009-10-09 Thread cuartz

Still i have the same issue, maybe i wasnt clear or im to frustrated to think
clear and understend what happends, for exampe i have this code:

t5page.java--

@InjectService
MyService myService

Object OnActivate(){
   myService.getData();
}

t4page.java---

void initialize(){
   MyService myservice = registry.getService(MyService.class);
   myService.getData();
}

myServiceImpl.java
private Request request;
public MyServiceImpl(Request request) {
this.request=request
   
System.out.println(+request.isRequestedSessionIdValid());//
--- the system breaks when execute this line from the t4page.java
 }
public void getData(){
. anything
}
}


the system is a little bit more complex than this, so maybe my mistake is on
appModule, tapestryfilter, Registry or somwhere else but supose everything
is ok, i want to know if this example should work, with Thiago's advice my
t4page look like this but still i have the same exception

t4page.java implements Thiago advice jej---

void preInitialize() {
RequestGlobals requestGlobals =
registry.getService(RequestGlobals.class);
requestGlobals.storeServletRequestResponse(getRequest(), getResponse());
}
void initialize() {
   MyService myservice = registry.getService(MyService.class);
   myService.getData();
}





-- 
View this message in context: 
http://www.nabble.com/Tapestry5-IoC-and-Request-problem-tp25813570p25826840.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



t5: logging in IOC only app

2009-10-09 Thread Angelo Chen

Hi,

Following the link at end of this post, i made a IOC only app, it works.
then I added a logging like this:
 
 @Inject
 private Logger logger;

import org.slf4j.Logger;

but I got:

No service implements the interface org.slf4j.Logger.

any idea how to register the logger manually?

Thanks,


http://wiki.apache.org/tapestry/Tapestry5HowToIocOnly
-- 
View this message in context: 
http://www.nabble.com/t5%3A-logging-in-IOC-only-app-tp25829986p25829986.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