Author Login
Post Reply
user Digest 18 Feb 2010 07:42:17 -0000 Issue 9007
Topics (messages 205037 through 205054):
Re: [Q] Enable Freemarker template caching
205037 by: Oscar
205040 by: Hoying, Ken
OpenId login open source project
205038 by: Saeed Iqbal
Re: javassist problem -- 2.2.0 maven plugin?
205039 by: Lukasz Lenart
Mixing the convention plugin and struts.xml
205041 by: Anthony So
205043 by: Lukasz Lenart
205045 by: Anthony So
How to handle global Errors with AJAX Validation
205042 by: Johannes Geppert
[Q] Configuration Parameter: struts.configuration
205044 by: Hoying, Ken
205046 by: Hoying, Ken
[S2] Custom Type Converter - to String[] not converted??
205047 by: Burton Rhodes
Google Apps Login Integration
205048 by: Saeed Iqbal
Re: [Q] JavaTemplate Plugin
205049 by: Hoying, Ken
205050 by: Lukasz Lenart
205051 by: Hoying, Ken
How to prevent JSP files from being publicly directly accessible?
205052 by: Wong Chin Shin
205053 by: Cimballi
205054 by: Lukasz Lenart
Administrivia:
---------------------------------------------------------------------
To post to the list, e-mail: user@(protected)
To unsubscribe, e-mail: user-digest-unsubscribe@(protected)
For additional commands, e-mail: user-digest-help@(protected)
----------------------------------------------------------------------

Attachment:
user_205037.ezm (zipped)Hi to all, i have a doubt about struts 2. Is possible to write ognl
expressions on struts.xml . Let's say, something like wildcards but instead
wildcards build the value of result with some attribute from request or a
value of session, that's possible?
THanks in regard
--
Oscar

Attachment:
user_205040.ezm (zipped)Not exactly sure what you are attempting, but you can utilize OGNL in struts.xml and in particular within results. Take a look at the following and see if it is any help:
http://struts.apache.org/2.1.8.1/docs/parameters-in-configuration-results.html
-----Original Message-----
From: Oscar [mailto:oscar.kalderon@(protected)]
Sent: Monday, February 15, 2010 11:53 PM
To: Struts Users Mailing List
Subject: Re: [Q] Enable Freemarker template caching
Hi to all, i have a doubt about struts 2. Is possible to write ognl
expressions on struts.xml . Let's say, something like wildcards but instead
wildcards build the value of result with some attribute from request or a
value of session, that's possible?
THanks in regard
--
Oscar
-----------------------------------------
***Note:The information contained in this message may be privileged
and confidential and protected from disclosure. If the reader of
this message is not the intended recipient, or an employee or agent
responsible for delivering this message to the intended recipient,
you are hereby notified that any dissemination, distribution or
copying of this communication is strictly prohibited. If you have
received this communication in error, please notify the Sender
immediately by replying to the message and deleting it from your
computer. Thank you. Premier Inc.

Attachment:
user_205038.ezm (zipped)Good Morning again Guys
I have worked on OpenId and Facebook Connect
The first project of mine on openid is now out and its open source on
http://code.google.com/p/remove-registration/
Feel free to comment please.
Thanks,
-saeed
--
Saeed Iqbal
Independant Consultant
J2EE - Application Architect / Developer
http://iqbalconsulting.com

Attachment:
user_205039.ezm (zipped)2010/2/15 Jan T. Kim <j.kim@(protected)>:
> I've run into the problem that the javassist package contained in
> xwork-2.1.6.jar clashes with the javassist package contained in jboss.
> According to https://issues.apache.org/jira/browse/WW-3308 this
> problem is fixed in struts 2.2.0. Are there any maven plugins around
> that take advantage of this fix already?
>
> If they're not yet available I'd also be interested in a workaround.
> I've tried excluding xwork-core but to no avail (possibly due to lack
> of maven competence -- RTFAQs etc. welcome).
Check out xwork source and build it on your own
http://svn.opensymphony.com/svn/xwork/trunk/core/
Regards
--
Łukasz
http://www.lenart.org.pl/
Kapituła Javarsovia 2010
http://javarsovia.pl

Attachment:
user_205041.ezm (zipped)I have been utilizing the Convention plugin within Struts 2.1.8.1
While I can get the exceptions mappings to work on a class level, I
was wondering if there were a way to get a global exception handler
to work on the package level as traditionally defined within the
package node of struts.xml
Below are the annotations I use within one of my classes.
@Results({
@Result(name="error",location="/home"),
@Result(name="exception", location="/jsp/error.jsp")
})
@ExceptionMappings({
@ExceptionMapping(exception="
java.lang.Exception",result="exception")
})
All this said, I am unclear as to how I would go about defining a
package node in struts.xml that would extend the convention-default
(which extends struts-default), and then define global-exceptions and
global-mappings nodes that apply to all of my classes within that
package.
Thanks,
-anthony

Attachment:
user_205043.ezm (zipped)2010/2/16 Anthony So <anthonyjso@(protected)>:
> All this said, I am unclear as to how I would go about defining a
> package node in struts.xml that would extend the convention-default
> (which extends struts-default), and then define global-exceptions and
> global-mappings nodes that apply to all of my classes within that
> package.
Define new package in struts.xml with global exception mappings and
setup constant as below
<constant name="struts.convention.default.parent.package"
value="myDefaultPackage"/>
Regards
--
Łukasz
http://www.lenart.org.pl/
Kapituła Javarsovia 2010
http://javarsovia.pl

Attachment:
user_205045.ezm (zipped)Lukasz Lenart <lukasz.lenart <at> googlemail.com> writes:
>
> 2010/2/16 Anthony So <anthonyjso <at> gmail.com>:
> > All this said, I am unclear as to how I would go about defining a
> > package node in struts.xml that would extend the convention-default
> > (which extends struts-default), and then define global-exceptions and
> > global-mappings nodes that apply to all of my classes within that
> > package.
>
> Define new package in struts.xml with global exception mappings and
> setup constant as below
>
> <constant name="struts.convention.default.parent.package"
> value="myDefaultPackage"/>
>
> Regards
Thanks. I will give it a try.
It should also be noted that I tried to use the annotations I initially posted
in package-info.java and they did not take hold.
-anthony

Attachment:
user_205042.ezm (zipped)
I try out the AJAX Validation for xhtml theme similar
like in the docs.
http://struts.apache.org/2.1.8.1/docs/ajax-validation.html
This works fine for fieldErrors but when i have an ExpressionValidator
I get an global error and not an fieldError.
But this Error was not showing with
StrutsUtils.showValidationErrors(form, errorsObject);
I try to add this tags inside and outside the form
<s:actionerror />
<s:actionmessage/>
<s:fielderror/>
But the errors was not displayed.
Is there an separate method to display global errors with AJAX Validation?
Best Regards
Johannes Geppert
-----
---
web: http://www.jgeppert.com
twitter: http://twitter.com/jogep
--
Sent from the Struts - User mailing list archive at Nabble.com.

Attachment:
user_205044.ezm (zipped)
Attachment:
user_205046.ezm (zipped)It appears that the strust.configuration setting in struts.properties was not what I was really looking for.
I needed to make the config change to the web.xml and the Struts filter:
http://struts.apache.org/2.1.8.1/docs/webxml.html
Thanks,
Ken
-----Original Message-----
From: Hoying, Ken [mailto:Ken_Hoying@(protected)]
Sent: Tuesday, February 16, 2010 3:10 PM
To: Struts Users Mailing List
Subject: [Q] Configuration Parameter: struts.configuration
I have a need to override a bean that is present in the struts default configuration. Specifically:
org.apache.struts2.components.template.TemplateEngineManagerHowever, it appears that the default configuration loader does not allow for this to be overwritten. As a result, I get the following error during deployment:
Caused by: Unable to load bean: type:
org.apache.struts2.components.template.TemplateEngineManager class:com.premierinc.sca.actions.util.ScaTemplateEngineManager - bean - vfsfile:/C:/jboss5/server/sca-app/deploy/scaEar.ear/webapp.war/WEB-INF/classes/struts.xml:40:71
at
com.opensymphony.xwork2.config.providers.XmlConfigurationProvider.register (
XmlConfigurationProvider.java:221)
at
org.apache.struts2.config.StrutsXmlConfigurationProvider.register (
StrutsXmlConfigurationProvider.java:101)
at
com.opensymphony.xwork2.config.impl.DefaultConfiguration.reloadContainer (
DefaultConfiguration.java:169)
at
com.opensymphony.xwork2.config.ConfigurationManager.getConfiguration (
ConfigurationManager.java:55)
I would like to be able to specify my own configuration loader (specifically override the class:
org.apache.struts2.config.StrutsXmlConfigurationProvider).
I thought that this would just be a matter of utilizing the struts.properties setting (http://struts.apache.org/2.1.8.1/docs/strutsproperties.html):
### Specifies the Configuration used to configure Struts
### one could extend org.apache.struts2.config.Configuration
### to build one's customize way of getting the configurations parameters into Struts
# struts.configuration=org.apache.struts2.config.DefaultConfiguration
However, it does not appear to be working as I thought. Now I am not sure what this setting does at all. The class specified in the help (org.apache.struts2.config.Configuration) does not even exist.
Can someone please point me in the right direction?
Thanks in advance,
Ken
-----------------------------------------
***Note:The information contained in this message may be privileged
and confidential and protected from disclosure. If the reader of
this message is not the intended recipient, or an employee or agent
responsible for delivering this message to the intended recipient,
you are hereby notified that any dissemination, distribution or
copying of this communication is strictly prohibited. If you have
received this communication in error, please notify the Sender
immediately by replying to the message and deleting it from your
computer. Thank you. Premier Inc.

Attachment:
user_205047.ezm (zipped)For some reason when I try to convert a html textfield value to a
String[], the "MyClass-conversion.properties" file ignores the
conversion. In this specific example, I am trying to convert a
textfield that may have comma seperated values into a String[] of
these values. For testing I changed the variable in question to a
String type (no []) and the conversion ran. Am I missing something?
Does Struts conversion ignore it if the resulting type is a String[]?
Code snippits:
[HTML: form field tha may contain commas to seperate]
<s:textfield name="searchCriteria.test1" />
[SearchAction-conversion.properties: this conversion is to seperate
the comma seperated values into a new String[] variable]
searchCriteria.test1=com.afs.web.converter.MyCommaListConverter
searchCriteria.listPriceFrom=com.afs.web.converter.MyCurrencyConverter
** MyCommaListConverter runs when test1 is of type String. It does
not when test1 is of type String[]. MyCurrencyConverter always works
as listPriceFrom is of type Integer.

Attachment:
user_205048.ezm (zipped)Please see my integration of Google Apps Login here
http://code.google.com/p/remove-registration
--
Saeed Iqbal
Independant Consultant
J2EE - Application Architect / Developer
http://iqbalconsulting.com

Attachment:
user_205049.ezm (zipped)This ended up being a little tougher to accomplish than I had expected.
I tried to override the TemplateEngineManager by specifying the bean in my struts.xml file. However, struts did not like that there was one already loaded from the struts-default.xml.
So I created a copy of the struts-default.xml and placed it in my class path with a different name. In this new default xml I replaced the configuration for the TemplateEngineManager with one that specified my class. I then updated the filter configuration in my web.xml to load my default xml file instead of the struts default xml.
<filter>
<filter-name>struts2</filter-name>
<filter-class>
org.apache.struts2.dispatcher.ng.filter.StrutsPrepareAndExecuteFilter </filter-class>
<!-- Override so that we can replace struts-default.xml with struts-sca-default.xml -->
<init-param>
<param-name>config </param-name>
<param-value>struts-sca-default.xml,struts-plugin.xml,struts.xml</param-value>
</init-param>
</filter>
In my custom TemplateEngineManager, I extended the existing TemplateEngineManager and overrode the getTemplateEngine() as such:
public TemplateEngine getTemplateEngine(Template template, String templateTypeOverride)
{
TemplateEngine engSelected = super.getTemplateEngine(template, templateTypeOverride);
if(engSelected instanceof JavaTemplateEngine)
{
if("simple".equalsIgnoreCase(template.getTheme()))
{
return engSelected;
} // end if
else
{
// JavaTemplateEngine currently only supports the "simple" theme, so need to override
return super.getTemplateEngine(template, DEFAULT_TEMPLATE_TYPE);
} // end else
} // end if
else
{
return engSelected;
} // end else
} // end getTemplateEngine
Thanks,
Ken
-----Original Message-----
From: Hoying, Ken [mailto:Ken_Hoying@(protected)]
Sent: Monday, February 15, 2010 12:35 PM
To: Struts Users Mailing List
Subject: [Q] JavaTemplate Plugin
I would like to make use of the JavaTemplate Plugin in order to improve my applications performance. However, I do have "ajax" themed tags, as well as, some of my own theme tags. I perfectly realize that the any non "simple" theme tags would not be able to take advantage of the performance improvement. However, I cannot seem to get my application to work at all. Does this mean that in order to use this plugin, I can only use the "simple" theme and no other?
Cannot render tag [head] because theme [ajax] was not found. - [unknown location]
at
org.apache.struts2.views.java.JavaTemplateEngine.renderTemplate (
JavaTemplateEngine.java:58)
at
org.apache.struts2.components.UIBean.mergeTemplate (
UIBean.java:559)
at
org.apache.struts2.components.UIBean.end (
UIBean.java:513)
-----------------------------------------
***Note:The information contained in this message may be privileged
and confidential and protected from disclosure. If the reader of
this message is not the intended recipient, or an employee or agent
responsible for delivering this message to the intended recipient,
you are hereby notified that any dissemination, distribution or
copying of this communication is strictly prohibited. If you have
received this communication in error, please notify the Sender
immediately by replying to the message and deleting it from your
computer. Thank you. Premier Inc.
---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@(protected)
For additional commands, e-mail: user-help@(protected)

Attachment:
user_205050.ezm (zipped)2010/2/17 Hoying, Ken <Ken_Hoying@(protected)>:
> This ended up being a little tougher to accomplish than I had expected.
>
> I tried to override the TemplateEngineManager by specifying the bean in my struts.xml file. However, struts did not like that there was one already loaded from the struts-default.xml.
>
> So I created a copy of the struts-default.xml and placed it in my class path with a different name. In this new default xml I replaced the configuration for the TemplateEngineManager with one that specified my class. I then updated the filter configuration in my web.xml to load my default xml file instead of the struts default xml.
>
> <filter>
> <filter-name>struts2</filter-name>
> <filter-class>
>
org.apache.struts2.dispatcher.ng.filter.StrutsPrepareAndExecuteFilter> </filter-class>
>
> <!-- Override so that we can replace struts-default.xml with struts-sca-default.xml -->
> <init-param>
> <param-name>config </param-name>
> <param-value>struts-sca-default.xml,struts-plugin.xml,struts.xml</param-value>
> </init-param>
> </filter>
>
> In my custom TemplateEngineManager, I extended the existing TemplateEngineManager and overrode the getTemplateEngine() as such:
>
> public TemplateEngine getTemplateEngine(Template template, String templateTypeOverride)
> {
> TemplateEngine engSelected = super.getTemplateEngine(template, templateTypeOverride);
>
> if(engSelected instanceof JavaTemplateEngine)
> {
> if("simple".equalsIgnoreCase(template.getTheme()))
> {
> return engSelected;
> } // end if
> else
> {
> // JavaTemplateEngine currently only supports the "simple" theme, so need to override
> return super.getTemplateEngine(template, DEFAULT_TEMPLATE_TYPE);
> } // end else
> } // end if
> else
> {
> return engSelected;
> } // end else
> } // end getTemplateEngine
>
>
> Thanks,
> Ken
Could you register this as a new issue?
https://issues.apache.org/jira/browse/
Pozdrawiam
--
Łukasz
http://www.lenart.org.pl/
Kapituła Javarsovia 2010
http://javarsovia.pl

Attachment:
user_205051.ezm (zipped)Issue registered: https://issues.apache.org/jira/browse/WW-3386
-----Original Message-----
From: Lukasz Lenart [mailto:lukasz.lenart@(protected)]
Sent: Wednesday, February 17, 2010 11:44 AM
To: Struts Users Mailing List
Subject: Re: [Q] JavaTemplate Plugin
2010/2/17 Hoying, Ken <Ken_Hoying@(protected)>:
> This ended up being a little tougher to accomplish than I had expected.
>
> I tried to override the TemplateEngineManager by specifying the bean in my struts.xml file. However, struts did not like that there was one already loaded from the struts-default.xml.
>
> So I created a copy of the struts-default.xml and placed it in my class path with a different name. In this new default xml I replaced the configuration for the TemplateEngineManager with one that specified my class. I then updated the filter configuration in my web.xml to load my default xml file instead of the struts default xml.
>
> <filter>
> <filter-name>struts2</filter-name>
> <filter-class>
>
org.apache.struts2.dispatcher.ng.filter.StrutsPrepareAndExecuteFilter> </filter-class>
>
> <!-- Override so that we can replace struts-default.xml with struts-sca-default.xml -->
> <init-param>
> <param-name>config </param-name>
> <param-value>struts-sca-default.xml,struts-plugin.xml,struts.xml</param-value>
> </init-param>
> </filter>
>
> In my custom TemplateEngineManager, I extended the existing TemplateEngineManager and overrode the getTemplateEngine() as such:
>
> public TemplateEngine getTemplateEngine(Template template, String templateTypeOverride)
> {
> TemplateEngine engSelected = super.getTemplateEngine(template, templateTypeOverride);
>
> if(engSelected instanceof JavaTemplateEngine)
> {
> if("simple".equalsIgnoreCase(template.getTheme()))
> {
> return engSelected;
> } // end if
> else
> {
> // JavaTemplateEngine currently only supports the "simple" theme, so need to override
> return super.getTemplateEngine(template, DEFAULT_TEMPLATE_TYPE);
> } // end else
> } // end if
> else
> {
> return engSelected;
> } // end else
> } // end getTemplateEngine
>
>
> Thanks,
> Ken
Could you register this as a new issue?
https://issues.apache.org/jira/browse/
Pozdrawiam
--
Łukasz
http://www.lenart.org.pl/
Kapituła Javarsovia 2010
http://javarsovia.pl
---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@(protected)
For additional commands, e-mail: user-help@(protected)
-----------------------------------------
***Note:The information contained in this message may be privileged
and confidential and protected from disclosure. If the reader of
this message is not the intended recipient, or an employee or agent
responsible for delivering this message to the intended recipient,
you are hereby notified that any dissemination, distribution or
copying of this communication is strictly prohibited. If you have
received this communication in error, please notify the Sender
immediately by replying to the message and deleting it from your
computer. Thank you. Premier Inc.

Attachment:
user_205052.ezm (zipped)Hi,
I've had a pen test finding where our JSP files, which are in the public
directories of our web app can be opened directly as long as the user knows
the name of the JSP file. This is a site where a login is mandatory to
access any content. Struts actions are already protected where the action
itself will detect for sessions and enforce security but direct access to
JSP doesn't seem to be protected in the same way and apparently, this is a
security risk. The auditor's opinion is that no content whatsoever should be
viewable by anyone without a valid session.
May I know what can be done to accomplish this? Both our Struts 1 and 2
applications are affected by this finding.
Thanks,
Wong

Attachment:
user_205053.ezm (zipped)The default pattern is to put all JSPs under WEB-INF and so you force
the call to an action to access them.
Cimballi
On Wed, Feb 17, 2010 at 7:46 PM, Wong Chin Shin <lilwong@(protected):
> Hi,
>
> I've had a pen test finding where our JSP files, which are in the public
> directories of our web app can be opened directly as long as the user knows
> the name of the JSP file. This is a site where a login is mandatory to
> access any content. Struts actions are already protected where the action
> itself will detect for sessions and enforce security but direct access to
> JSP doesn't seem to be protected in the same way and apparently, this is a
> security risk. The auditor's opinion is that no content whatsoever should be
> viewable by anyone without a valid session.
>
> May I know what can be done to accomplish this? Both our Struts 1 and 2
> applications are affected by this finding.
>
> Thanks,
> Wong
>

Attachment:
user_205054.ezm (zipped)2010/2/18 Cimballi <cimballi.cimballi@(protected)>:
> The default pattern is to put all JSPs under WEB-INF and so you force
> the call to an action to access them.
As I know, it works only under Tomcat - it isn't standard. Better
solution is to use security constraint section in web.xml
<security-constraint>
<display-name>Access to JSP files</display-name>
<web-resource-name>JSP</web-resource-name>
<web-resource-collection>
<url-pattern>*.jsp</url-pattern>
</web-resource-collection>
<auth-constraint/>
</security-constraint>
Regards
--
Łukasz
http://www.lenart.org.pl/
Kapituła Javarsovia 2010
http://javarsovia.pl