# HG changeset patch # User Ingo Weinzierl # Date 1269852381 0 # Node ID d3062dc8626af19895a13b7b54b36f67d97ece28 # Parent 15ac78a91d1b9d8c760359a7f0534257a6b82ca8 Application is now sensitive to changes of the preferred browser language in the current session (issue30). gnv/trunk@853 c6561f87-3c4e-4783-a992-168aeb5c3f6f diff -r 15ac78a91d1b -r d3062dc8626a gnv/ChangeLog --- a/gnv/ChangeLog Mon Mar 29 08:04:15 2010 +0000 +++ b/gnv/ChangeLog Mon Mar 29 08:46:21 2010 +0000 @@ -1,3 +1,23 @@ +2010-03-29 Ingo Weinzierl + + Issue30 + + * src/main/java/de/intevation/gnv/action/DescribeUIAction.java: Use the + correct locale for i18n supported by HttpServletRequest object. The + application language is switched after the next server round-trip if the + user changes the preferred browser language. + Hint: Struts' Action class has a method getLocale(HttpServletRequest) + which should return the currently selected locale. This method seems to be + buggy - returns session's initial locale. + + * src/main/java/de/intevation/gnv/action/SelectArtifactFactoryAction.java: + Inherit from DescribeUIAction. The rendering stuff is now done by + DescribeUIAction. + + * src/main/webapp/WEB-INF/config/struts-config.xml: Added missing forward + used for stepping back to a previous state in SelectArtifactFactory + action. + 2010-03-29 Sascha L. Teichmann * src/main/java/de/intevation/gnv/**/*.java: diff -r 15ac78a91d1b -r d3062dc8626a gnv/src/main/java/de/intevation/gnv/action/DescribeUIAction.java --- a/gnv/src/main/java/de/intevation/gnv/action/DescribeUIAction.java Mon Mar 29 08:04:15 2010 +0000 +++ b/gnv/src/main/java/de/intevation/gnv/action/DescribeUIAction.java Mon Mar 29 08:46:21 2010 +0000 @@ -19,6 +19,7 @@ import org.apache.log4j.Logger; +import org.apache.struts.Globals; import org.apache.struts.action.ActionForm; import org.apache.struts.action.ActionForward; import org.apache.struts.action.ActionMapping; @@ -62,7 +63,8 @@ request); ArtifactDatabaseClient adc = ArtifactDatabaseClientFactory - .getInstance().getArtifactDatabaseClient(getLocale(request)); + .getInstance().getArtifactDatabaseClient(request.getLocale()); + request.getSession().setAttribute(Globals.LOCALE_KEY, request.getLocale()); ArtifactDescription artifactDescription = adc.getCurrentStepDescription( diff -r 15ac78a91d1b -r d3062dc8626a gnv/src/main/java/de/intevation/gnv/action/SelectArtifactFactoryAction.java --- a/gnv/src/main/java/de/intevation/gnv/action/SelectArtifactFactoryAction.java Mon Mar 29 08:04:15 2010 +0000 +++ b/gnv/src/main/java/de/intevation/gnv/action/SelectArtifactFactoryAction.java Mon Mar 29 08:46:21 2010 +0000 @@ -28,7 +28,7 @@ * @author Tim Englich * */ -public class SelectArtifactFactoryAction extends ArtifactDatabaseActionBase { +public class SelectArtifactFactoryAction extends DescribeUIAction { /** * the logger, used to log exceptions and additonaly information */ @@ -72,41 +72,6 @@ ArtifactObject artifact = adc.createNewArtifact(af); sm.setCurrentArtifact(artifact); - ArtifactDescription artifactdescription = adc - .getCurrentStepDescription(af, artifact,true); - - String fisUrl = response.encodeURL( - mapping.findForward("selectfis").getPath()); - - XSLTransformer transformer = new XSLTransformer(); - transformer.addParameter("selectfis", fisUrl); - - Node dynamicUINode = new XMLUtils().getNodeXPath( - artifactdescription.getCurrentUI(), "art:dynamic" - ); - - if (dynamicUINode != null){ - String ui = transformer.transform( - dynamicUINode, - "UTF-8", - request.getRealPath("WEB-INF/config/templates/describe-ui.xsl")); - - request.setAttribute("ui", ui); - } - - Node staticUINode = new XMLUtils().getNodeXPath( - artifactdescription.getCurrentUI(), "art:static" - ); - - if (staticUINode != null) { - String staticUI = transformer.transform( - staticUINode, - "UTF-8", - request.getRealPath("WEB-INF/config/templates/describe-ui-static.xsl")); - request.setAttribute("staticui", staticUI); - } - - // return succsess return super.execute(mapping, form, request, response); } catch (Exception e) { log.error(e, e); diff -r 15ac78a91d1b -r d3062dc8626a gnv/src/main/webapp/WEB-INF/config/struts-config.xml --- a/gnv/src/main/webapp/WEB-INF/config/struts-config.xml Mon Mar 29 08:04:15 2010 +0000 +++ b/gnv/src/main/webapp/WEB-INF/config/struts-config.xml Mon Mar 29 08:46:21 2010 +0000 @@ -76,6 +76,9 @@ +