RE: JAAS struts 2 Tutorial?

2007-09-24 Thread Fowler, Perryn

Better a late replay than none at all :)

 Is JAAS the best way to go, or there are better alternates?  

'JAAS' encompasses a lot of stuff, so it depends what you are trying to
do...

Let me assume for the minute that you are talking about
login/authentication...

In this case, it depends whether you need your user to be authenticated
to your J2EE container or not. (If for example you want to control
authorisation to any EJBs that you call via their deployment descriptor,
then you will need to be authenticated to the container )

JAAS will give you this, but unfortunately will require you to write a
server specific LoginModule for every server you need to support.


If, however, you don't need this, then something like Acegi
(http://www.acegisecurity.org/) will give you
a more portable solution

cheers
Perryn
-Original Message-
From: news [mailto:[EMAIL PROTECTED] On Behalf Of Muhammad Momin
Rashid
Sent: Wednesday, 12 September 2007 7:32 PM
To: user@struts.apache.org
Subject: JAAS struts 2 Tutorial?

Hello Everyone,

I am looking for a tutorial for integrating JAAS into my Struts 2 + 
Hibernate Application.  Can anyone point me to the right resources?

Is JAAS the best way to go, or there are better alternates?  If anyone 
thinks there are better alternates, can you provide me with the links to

relevant tutorials?

Regards,
Muhammad Momin Rashid.


-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]




This e-mail and any attachments to it (the Communication) is, unless 
otherwise stated, confidential,  may contain copyright material and is for the 
use only of the intended recipient. If you receive the Communication in error, 
please notify the sender immediately by return e-mail, delete the Communication 
and the return e-mail, and do not read, copy, retransmit or otherwise deal with 
it. Any views expressed in the Communication are those of the individual sender 
only, unless expressly stated to be those of Australia and New Zealand Banking 
Group Limited ABN 11 005 357 522, or any of its related entities including ANZ 
National Bank Limited (together ANZ). ANZ does not accept liability in 
connection with the integrity of or errors in the Communication, computer 
virus, data corruption, interference or delay arising from or in respect of the 
Communication.

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



RE: Struts and arabic encoding

2007-08-12 Thread Fowler, Perryn



You seem to be trying all the right things, my advice is to try to
isolate where things are going wrong.. for example

1) Check what encoding your browser thinks the page is in ( usually
somewhere under the view menu )

2) Check whether you are managing to read the request parameter in the
correct encoding. 

This can be difficult because in order to check the value of a
parameter, you need to write it out somewhere, and this means
re-encoding it again.

For example, if you are writing out the parameter value to a windows XP
command prompt be aware that the encoding the prompt uses is different
to
The encoding windows uses for everything else, so you might find that
you are reading the parameter in just fine, but *writing it out* using
the wrong encoding.

To be sure, use the chcp command do determine the encoding your prompt
uses and then use an OutputStreamWriter to wrap System.out and set the
encoding to the same.

If all else fails, write out the raw bytes and see what they are in
Java's internal encoding (UTF-16)

2a) If you seem to be reading the parameter OK, then the problem might
be that you need to somehow specify the encoding to use when writing to
your database.

2b) If the parameter is being read in as garbage, check that something
else isn't reading from the request before your filter. If that happens,
the encoding used will have already been set and your filter will be
unable to change it.

Good Luck!
Perryn



This e-mail and any attachments to it (the Communication) is, unless 
otherwise stated, confidential,  may contain copyright material and is for the 
use only of the intended recipient. If you receive the Communication in error, 
please notify the sender immediately by return e-mail, delete the Communication 
and the return e-mail, and do not read, copy, retransmit or otherwise deal with 
it. Any views expressed in the Communication are those of the individual sender 
only, unless expressly stated to be those of Australia and New Zealand Banking 
Group Limited ABN 11 005 357 522, or any of its related entities including ANZ 
National Bank Limited (together ANZ). ANZ does not accept liability in 
connection with the integrity of or errors in the Communication, computer 
virus, data corruption, interference or delay arising from or in respect of the 
Communication.

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



RE: Problem deploying an application

2007-08-03 Thread Fowler, Perryn
We are having similar problems ...try reading this
http://www.redbooks.ibm.com/redpapers/pdfs/redp4307.pdf. 

-Original Message-
From: John Mammen [mailto:[EMAIL PROTECTED] 
Sent: Friday, 3 August 2007 3:33 PM
To: 'Struts Users Mailing List'
Subject: Problem deploying an application


Hi,

I have 3 projects (web project, EJB and Java Client) which I have
deployed using a single EAR. The EJB and the client reference the web
project (will there be a problem with a reference in this direction?).
After successful deployment, the Client and the EJB are unable to find
the required classes in the web project.

Any help is appreciated.

Thanks and regards,
John.


 CAUTION - Disclaimer *
This e-mail contains PRIVILEGED AND CONFIDENTIAL INFORMATION intended
solely for the use of the addressee(s). If you are not the intended
recipient, please notify the sender by e-mail and delete the original
message. Further, you are not to copy, disclose, or distribute this
e-mail or its contents to any other person and any such actions are
unlawful. This e-mail may contain viruses. Infosys has taken every
reasonable precaution to minimize this risk, but is not liable for any
damage you may sustain as a result of any virus in this e-mail. You
should carry out your own virus checks before opening the e-mail or
attachment. Infosys reserves the right to monitor and review the content
of all messages sent to or from this e-mail address. Messages sent to or
from this e-mail address may be stored on the Infosys e-mail system.
***INFOSYS End of Disclaimer INFOSYS***


This e-mail and any attachments to it (the Communication) is, unless 
otherwise stated, confidential,  may contain copyright material and is for the 
use only of the intended recipient. If you receive the Communication in error, 
please notify the sender immediately by return e-mail, delete the Communication 
and the return e-mail, and do not read, copy, retransmit or otherwise deal with 
it. Any views expressed in the Communication are those of the individual sender 
only, unless expressly stated to be those of Australia and New Zealand Banking 
Group Limited ABN 11 005 357 522, or any of its related entities including ANZ 
National Bank Limited (together ANZ). ANZ does not accept liability in 
connection with the integrity of or errors in the Communication, computer 
virus, data corruption, interference or delay arising from or in respect of the 
Communication.

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



RE: Problem deploying an application

2007-08-03 Thread Fowler, Perryn
And this
http://publib.boulder.ibm.com/infocenter/wasinfo/v6r0/index.jsp?topic=/c
om.ibm.websphere.base.doc/info/aes/ae/crun_classload.html

-Original Message-
From: John Mammen [mailto:[EMAIL PROTECTED] 
Sent: Friday, 3 August 2007 3:33 PM
To: 'Struts Users Mailing List'
Subject: Problem deploying an application


Hi,

I have 3 projects (web project, EJB and Java Client) which I have
deployed using a single EAR. The EJB and the client reference the web
project (will there be a problem with a reference in this direction?).
After successful deployment, the Client and the EJB are unable to find
the required classes in the web project.

Any help is appreciated.

Thanks and regards,
John.


 CAUTION - Disclaimer *
This e-mail contains PRIVILEGED AND CONFIDENTIAL INFORMATION intended
solely for the use of the addressee(s). If you are not the intended
recipient, please notify the sender by e-mail and delete the original
message. Further, you are not to copy, disclose, or distribute this
e-mail or its contents to any other person and any such actions are
unlawful. This e-mail may contain viruses. Infosys has taken every
reasonable precaution to minimize this risk, but is not liable for any
damage you may sustain as a result of any virus in this e-mail. You
should carry out your own virus checks before opening the e-mail or
attachment. Infosys reserves the right to monitor and review the content
of all messages sent to or from this e-mail address. Messages sent to or
from this e-mail address may be stored on the Infosys e-mail system.
***INFOSYS End of Disclaimer INFOSYS***


This e-mail and any attachments to it (the Communication) is, unless 
otherwise stated, confidential,  may contain copyright material and is for the 
use only of the intended recipient. If you receive the Communication in error, 
please notify the sender immediately by return e-mail, delete the Communication 
and the return e-mail, and do not read, copy, retransmit or otherwise deal with 
it. Any views expressed in the Communication are those of the individual sender 
only, unless expressly stated to be those of Australia and New Zealand Banking 
Group Limited ABN 11 005 357 522, or any of its related entities including ANZ 
National Bank Limited (together ANZ). ANZ does not accept liability in 
connection with the integrity of or errors in the Communication, computer 
virus, data corruption, interference or delay arising from or in respect of the 
Communication.

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



[S2] accessing a JSP variable in a tag

2007-08-01 Thread Fowler, Perryn

I am probably being dense, but I have a normal old jsp variable in one
of my pages

Eg

% String foo = bar %

I want to write out the value of foo using the Struts property tag ( so
that I can make use of its handy escaping functionality)

I cant figure out how to do it though :(

Cheers
Perryn


This e-mail and any attachments to it (the Communication) is, unless 
otherwise stated, confidential,  may contain copyright material and is for the 
use only of the intended recipient. If you receive the Communication in error, 
please notify the sender immediately by return e-mail, delete the Communication 
and the return e-mail, and do not read, copy, retransmit or otherwise deal with 
it. Any views expressed in the Communication are those of the individual sender 
only, unless expressly stated to be those of Australia and New Zealand Banking 
Group Limited ABN 11 005 357 522, or any of its related entities including ANZ 
National Bank Limited (together ANZ). ANZ does not accept liability in 
connection with the integrity of or errors in the Communication, computer 
virus, data corruption, interference or delay arising from or in respect of the 
Communication.

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



RE: unit testing interceptors

2007-07-05 Thread Fowler, Perryn
This uses easyMock 
@Test  
public void should_log_before_and_after_action_execution() throws
Exception {

Logger mockLogger = createMock(Logger.class);

String actionName = mockAction;
String actionResult = Success;
ActionInvocation mockInvocation =
createMock(ActionInvocation.class);
ActionProxy mockProxy = createMock(ActionProxy.class);

expect(mockInvocation.getProxy()).andReturn(mockProxy);
expect(mockProxy.getActionName()).andReturn(actionName);

mockLogger.info(Start execution of  + actionName);

expect(mockInvocation.invoke()).andReturn(actionResult);
mockLogger.info(End execution of  + actionName +  with result
 + actionResult);

replay(mockLogger);
replay(mockInvocation);
replay(mockProxy);

LoggingInterceptor interceptor = new
LoggingInterceptor(mockLogger);
String result = interceptor.intercept(mockInvocation);

verify(mockLogger);
verify(mockInvocation);
verify(mockProxy);
assertEquals(Should return result from inner action,
actionResult, result);
}

-Original Message-
From: Session A Mwamufiya [mailto:[EMAIL PROTECTED] 
Sent: Thursday, 5 July 2007 6:23 PM
To: Struts Users Mailing List
Subject: unit testing interceptors

Hi,

Has anyone created unit tests (with JUnit) for interceptors?  I'd like
to have an easy example to follow in order to unit test mine.

Thanks,
Session


-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



This e-mail and any attachments to it (the Communication) is, unless 
otherwise stated, confidential,  may contain copyright material and is for the 
use only of the intended recipient. If you receive the Communication in error, 
please notify the sender immediately by return e-mail, delete the Communication 
and the return e-mail, and do not read, copy, retransmit or otherwise deal with 
it. Any views expressed in the Communication are those of the individual sender 
only, unless expressly stated to be those of Australia and New Zealand Banking 
Group Limited ABN 11 005 357 522, or any of its related entities including ANZ 
National Bank Limited (together ANZ). ANZ does not accept liability in 
connection with the integrity of or errors in the Communication, computer 
virus, data corruption, interference or delay arising from or in respect of the 
Communication.

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



[s2] OGNL and javascript

2007-05-31 Thread Fowler, Perryn

Hi People,

I usually like to access form elements using their names ( rather than ids) as 
I find it more readable.
So, if I had a field named 'street' on a form named 'addressForm'  I can access 
it using something like document.addressForm.street 

Now, I am using struts 2 and its OGNL support to inject parameters directly 
into objects contained exposed by my actions.

So, I might have a form with a field named 'address.street'.
When this form is submitted the fields value is set by the parameters 
interceptor using something like action.getAddress().setStreet()

Unfortunately, this means that my method of accessing form fields in javascript 
no longer works because the last period
in document.addressForm.address.street is not interpreted by javascript as part 
of the name, but as the javascript de-reference operator.


does anyone know of a solution to this? Can I escape that . in javascript 
somehow? Can I change what character OGNL uses?

I realize I could place ids on my fields and use getElementById, but as I said 
I would rather be able to use this syntax for readability's sake.

cheers
Perryn

This e-mail and any attachments to it (the Communication) is, unless 
otherwise stated, confidential,  may contain copyright material and is for the 
use only of the intended recipient. If you receive the Communication in error, 
please notify the sender immediately by return e-mail, delete the Communication 
and the return e-mail, and do not read, copy, retransmit or otherwise deal with 
it. Any views expressed in the Communication are those of the individual sender 
only, unless expressly stated to be those of Australia and New Zealand Banking 
Group Limited ABN 11 005 357 522, or any of its related entities including ANZ 
National Bank Limited (together ANZ). ANZ does not accept liability in 
connection with the integrity of or errors in the Communication, computer 
virus, data corruption, interference or delay arising from or in respect of the 
Communication.

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



RE: [S2] How to get an object from Spring inside an interceptor

2007-05-23 Thread Fowler, Perryn

If you use the Spring plugin, you should be able to have your actions and your 
interceptors created by Spring.

Then you can simply configure Spring to create your interceptor already wired 
up with a SessionFactory.

-Original Message-
From: Célio Cidral Junior [mailto:[EMAIL PROTECTED]
Sent: Thursday, 24 May 2007 4:58 AM
To: user@struts.apache.org
Subject: [S2] How to get an object from Spring inside an interceptor


Hi,

I want to implement an OpenInView pattern interceptor involving
Hibernate, but there's a problem. My SessionFactory is both created
and managed by Spring, and my interceptor should have access to that
SessionFactory, however I don't know how to do that. I have already
searched a lot the web and the docs but couldn't find an answer. Does
anybody know if that's possible (and how)?.

Regards,

Célio.

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]


This e-mail and any attachments to it (the Communication) is, unless 
otherwise stated, confidential,  may contain copyright material and is for the 
use only of the intended recipient. If you receive the Communication in error, 
please notify the sender immediately by return e-mail, delete the Communication 
and the return e-mail, and do not read, copy, retransmit or otherwise deal with 
it. Any views expressed in the Communication are those of the individual sender 
only, unless expressly stated to be those of Australia and New Zealand Banking 
Group Limited ABN 11 005 357 522, or any of its related entities including ANZ 
National Bank Limited (together ANZ). ANZ does not accept liability in 
connection with the integrity of or errors in the Communication, computer 
virus, data corruption, interference or delay arising from or in respect of the 
Communication.

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Struts 2 validation and Redirect After Post

2007-05-22 Thread Fowler, Perryn

Hi,

I want to use the redirect after post pattern in order to have a web app that 
is well behaved when the user hits back, refresh etc etc

I also want to use the Struts 2 validation framework.

At first glance though, the two seem incompatible:

If I have a form that I want to submit with a POST, I want the response to this 
to always be a REDIRECT to a GET.

I probably want this even in the case of validation failures that cause the 
form to be re-displayed, but the validation 
framework seems to assume that I would forward directly to the view in this 
case :

ie: it stores error information in the current action to be queried and 
displayed by tags in the view.
If I were to redirect to the view, this information would be lost.

Is there something I have missed that supports having a redirect  on validation 
failures?

cheers
Perryn



This e-mail and any attachments to it (the Communication) is, unless 
otherwise stated, confidential,  may contain copyright material and is for the 
use only of the intended recipient. If you receive the Communication in error, 
please notify the sender immediately by return e-mail, delete the Communication 
and the return e-mail, and do not read, copy, retransmit or otherwise deal with 
it. Any views expressed in the Communication are those of the individual sender 
only, unless expressly stated to be those of Australia and New Zealand Banking 
Group Limited ABN 11 005 357 522, or any of its related entities including ANZ 
National Bank Limited (together ANZ). ANZ does not accept liability in 
connection with the integrity of or errors in the Communication, computer 
virus, data corruption, interference or delay arising from or in respect of the 
Communication.

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Struts 2 validation and Redirect After Post

2007-05-22 Thread Fowler, Perryn



 Hi,
 
 I want to use the redirect after post pattern in order to have a web app that 
is well behaved when the user hits back, refresh etc etc
 
 I also want to use the Struts 2 validation framework.
 
 At first glance though, the two seem incompatible:
 
 If I have a form that I want to submit with a POST, I want the response to 
this to always be a REDIRECT to a GET.
 
 I probably want this even in the case of validation failures that cause the 
form to be re-displayed, but the validation 
 framework seems to assume that I would forward directly to the view in this 
case :
 
 ie: it stores error information in the current action to be queried and 
displayed by tags in the view.
 If I were to redirect to the view, this information would be lost.
 
 Is there something I have missed that supports having a redirect  on 
validation failures?
 
 cheers
 Perryn
 
 

This e-mail and any attachments to it (the Communication) is, unless 
otherwise stated, confidential,  may contain copyright material and is for the 
use only of the intended recipient. If you receive the Communication in error, 
please notify the sender immediately by return e-mail, delete the Communication 
and the return e-mail, and do not read, copy, retransmit or otherwise deal with 
it. Any views expressed in the Communication are those of the individual sender 
only, unless expressly stated to be those of Australia and New Zealand Banking 
Group Limited ABN 11 005 357 522, or any of its related entities including ANZ 
National Bank Limited (together ANZ). ANZ does not accept liability in 
connection with the integrity of or errors in the Communication, computer 
virus, data corruption, interference or delay arising from or in respect of the 
Communication.

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]