Mercurial > dive4elements > gnv-client
changeset 34:25fdec8b4c69
Added Global Errorhandling to the GNV-Client
gnv/trunk@170 c6561f87-3c4e-4783-a992-168aeb5c3f6f
author | Tim Englich <tim.englich@intevation.de> |
---|---|
date | Fri, 02 Oct 2009 08:38:57 +0000 |
parents | 32ffff3f67aa |
children | 4405f31bbc30 |
files | gnv/Changelog gnv/src/main/java/de/intevation/gnv/action/ArtifactDatabaseActionBase.java gnv/src/main/java/de/intevation/gnv/action/ChangeOptionsAction.java gnv/src/main/java/de/intevation/gnv/action/CommunicationKeys.java gnv/src/main/java/de/intevation/gnv/action/DoExportAction.java gnv/src/main/java/de/intevation/gnv/action/DoOutputAction.java gnv/src/main/java/de/intevation/gnv/action/FetchArtifactFactoriesAction.java gnv/src/main/java/de/intevation/gnv/action/NextArtifactStepAction.java gnv/src/main/java/de/intevation/gnv/action/SelectArtifactFactoryAction.java gnv/src/main/java/de/intevation/gnv/artifactdatabase/client/DefaultArtifactDatabaseClient.java gnv/src/main/webapp/WEB-INF/jsp/header.jsp |
diffstat | 11 files changed, 251 insertions(+), 182 deletions(-) [+] |
line wrap: on
line diff
--- a/gnv/Changelog Mon Sep 28 10:36:08 2009 +0000 +++ b/gnv/Changelog Fri Oct 02 08:38:57 2009 +0000 @@ -1,3 +1,17 @@ +2009-10-02 Tim Englich <tim.englich@intevation.de> + + * src/main/java/de/intevation/gnv/action/SelectArtifactFactoryAction.java (execute) Edited, + * src/main/java/de/intevation/gnv/action/NextArtifactStepAction.java (execute) Edited, + * src/main/java/de/intevation/gnv/action/FetchArtifactFactoriesAction.java (execute) Edited, + * src/main/java/de/intevation/gnv/action/DoOutputAction.java (execute) Edited, + * src/main/java/de/intevation/gnv/action/DoExportAction.java (execute) Edited, + * src/main/java/de/intevation/gnv/action/ChangeOptionsAction.java (execute) edited: + Added ExceptionHandling to this Actions + * src/main/java/de/intevation/gnv/action/ArtifactDatabaseActionBase.java (getExceptionForward) Edited: + Added Method for Resolving the ExceptionForward from the Mapping. + * src/main/webapp/WEB-INF/jsp/header.jsp Edited: + Read ExceptionMessage from RequestAttributes + 2009-09-28 Tim Englich <tim.englich@intevation.de> * src/main/resources/applicationMessages.properties Edited:
--- a/gnv/src/main/java/de/intevation/gnv/action/ArtifactDatabaseActionBase.java Mon Sep 28 10:36:08 2009 +0000 +++ b/gnv/src/main/java/de/intevation/gnv/action/ArtifactDatabaseActionBase.java Fri Oct 02 08:38:57 2009 +0000 @@ -19,6 +19,8 @@ public class ArtifactDatabaseActionBase extends Action { protected final static String SUCCSESS_FORWARD_ID = "success"; + protected final static String EXCEPTION_FORWARD_ID = "success"; + /** * the logger, used to log exceptions and additonaly information */ @@ -39,7 +41,18 @@ HttpServletRequest request, HttpServletResponse response) throws Exception { log.debug("ArtifactDatabaseActionBase.execute"); - ActionForward lForward = mapping.findForward(SUCCSESS_FORWARD_ID); + ActionForward forward = mapping.findForward(SUCCSESS_FORWARD_ID); + return forward; + } + + /** + * Returns the ExceptionForward for the ArtifactDatabaseActions + * @param mapping + * @return + */ + protected ActionForward getExceptionForward (ActionMapping mapping){ + log.debug("ArtifactDatabaseActionBase.getExceptionForward"); + ActionForward lForward = mapping.findForward(EXCEPTION_FORWARD_ID); return lForward; } }
--- a/gnv/src/main/java/de/intevation/gnv/action/ChangeOptionsAction.java Mon Sep 28 10:36:08 2009 +0000 +++ b/gnv/src/main/java/de/intevation/gnv/action/ChangeOptionsAction.java Fri Oct 02 08:38:57 2009 +0000 @@ -47,44 +47,50 @@ HttpServletRequest request, HttpServletResponse response) throws Exception { log.debug("NextArtifactStepAction.execute"); - SessionModel sm = SessionModelFactory.getInstance().getSessionModel(request); - - String target = request.getParameter("target"); - OutputMode outputMode = sm.getOutputMode(target); - if (outputMode != null){ + try { + SessionModel sm = SessionModelFactory.getInstance().getSessionModel(request); - Collection<OutputParameter> op = outputMode.getOutputParameters(); - if (op != null){ - Iterator<OutputParameter> it = op.iterator(); - DiagrammOptions diagrammOptions = new DiagrammOptions(); - while (it.hasNext()){ - OutputParameter parameter = it.next(); - diagrammOptions.setValue(parameter.getName(), request.getParameter(parameter.getName())); - + String target = request.getParameter("target"); + OutputMode outputMode = sm.getOutputMode(target); + if (outputMode != null){ + + Collection<OutputParameter> op = outputMode.getOutputParameters(); + if (op != null){ + Iterator<OutputParameter> it = op.iterator(); + DiagrammOptions diagrammOptions = new DiagrammOptions(); + while (it.hasNext()){ + OutputParameter parameter = it.next(); + diagrammOptions.setValue(parameter.getName(), request.getParameter(parameter.getName())); + + } + sm.setDiagrammOptions(diagrammOptions); } - sm.setDiagrammOptions(diagrammOptions); } + + ArtifactDescription ad = sm.getArtifactDescription(); + ArtifactDatabaseClient adc = ArtifactDatabaseClientFactory.getInstance().getArtifactDatabaseClient(); + ArtifactDescription artifactDescription = adc.getCurrentStepDescription(sm.getSelectedArtifactFactory(), sm.getCurrentArtifact()); + + Node currentUI = artifactDescription.getCurrentUI(); + XSLTransformer transformer = new XSLTransformer(); + String ui = transformer.transform(new XMLUtils().getNodeXPath(currentUI, "dynamic"), "UTF-8", request.getRealPath("WEB-INF/config/templates/describe-ui.xsl")); + + request.setAttribute("ui", ui); + + String staticUI = transformer.transform(new XMLUtils().getNodeXPath(currentUI, "static"), "UTF-8", request.getRealPath("WEB-INF/config/templates/describe-ui-static.xsl")); + request.setAttribute("staticui", staticUI); + request.setAttribute("furthertargets", (ad.getReachableStates() != null && !ad.getReachableStates().isEmpty())); + + if (ad.getReachableStates() != null && !ad.getReachableStates().isEmpty()){ + }else{ + request.setAttribute("diagramm", true); + } + return super.execute(mapping, form, request, response); + } catch (Exception e) { + log.error(e,e); + request.setAttribute(CommunicationKeys.REQUEST_EXCEPTION_MESSAGE_ID, e.getMessage()); + return super.getExceptionForward(mapping); } - - ArtifactDescription ad = sm.getArtifactDescription(); - ArtifactDatabaseClient adc = ArtifactDatabaseClientFactory.getInstance().getArtifactDatabaseClient(); - ArtifactDescription artifactDescription = adc.getCurrentStepDescription(sm.getSelectedArtifactFactory(), sm.getCurrentArtifact()); - - Node currentUI = artifactDescription.getCurrentUI(); - XSLTransformer transformer = new XSLTransformer(); - String ui = transformer.transform(new XMLUtils().getNodeXPath(currentUI, "dynamic"), "UTF-8", request.getRealPath("WEB-INF/config/templates/describe-ui.xsl")); - - request.setAttribute("ui", ui); - - String staticUI = transformer.transform(new XMLUtils().getNodeXPath(currentUI, "static"), "UTF-8", request.getRealPath("WEB-INF/config/templates/describe-ui-static.xsl")); - request.setAttribute("staticui", staticUI); - request.setAttribute("furthertargets", (ad.getReachableStates() != null && !ad.getReachableStates().isEmpty())); - - if (ad.getReachableStates() != null && !ad.getReachableStates().isEmpty()){ - }else{ - request.setAttribute("diagramm", true); - } - return super.execute(mapping, form, request, response); }
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/gnv/src/main/java/de/intevation/gnv/action/CommunicationKeys.java Fri Oct 02 08:38:57 2009 +0000 @@ -0,0 +1,12 @@ +package de.intevation.gnv.action; +/** + * + * @author Tim Englich <tim.englich@intevation.de> + * + */ +public class CommunicationKeys { + /** + * The Key which should be used for accessing ExceptionMessages + */ + public final static String REQUEST_EXCEPTION_MESSAGE_ID = "request_exception_message"; +}
--- a/gnv/src/main/java/de/intevation/gnv/action/DoExportAction.java Mon Sep 28 10:36:08 2009 +0000 +++ b/gnv/src/main/java/de/intevation/gnv/action/DoExportAction.java Fri Oct 02 08:38:57 2009 +0000 @@ -30,18 +30,22 @@ protected void setHeaders(String target, String mimeType, HttpServletResponse response, HttpServletRequest request) { log.debug("DoExportAction.setHeaders"); - super.setHeaders(target, mimeType, response, request); - String fileName = "GNVEXPORT_"+System.currentTimeMillis()+"."; - - if (target.equalsIgnoreCase("chart")){ - fileName = fileName + mimeType.substring(mimeType.indexOf("/")+1); - }else if (target.equalsIgnoreCase("CSV")){ - fileName = fileName +"csv"; - }else{ - fileName = fileName +"txt"; + try { + super.setHeaders(target, mimeType, response, request); + String fileName = "GNVEXPORT_"+System.currentTimeMillis()+"."; + + if (target.equalsIgnoreCase("chart")){ + fileName = fileName + mimeType.substring(mimeType.indexOf("/")+1); + }else if (target.equalsIgnoreCase("CSV")){ + fileName = fileName +"csv"; + }else{ + fileName = fileName +"txt"; + } + log.debug("FileName for Export: "+fileName); + response.setHeader("Content-Disposition","attachment;filename="+fileName); + } catch (Exception e) { + log.error(e,e); } - log.debug("FileName for Export: "+fileName); - response.setHeader("Content-Disposition","attachment;filename="+fileName); }
--- a/gnv/src/main/java/de/intevation/gnv/action/DoOutputAction.java Mon Sep 28 10:36:08 2009 +0000 +++ b/gnv/src/main/java/de/intevation/gnv/action/DoOutputAction.java Fri Oct 02 08:38:57 2009 +0000 @@ -52,48 +52,54 @@ HttpServletRequest request, HttpServletResponse response) throws Exception { log.debug("DoOutputAction.execute"); - String target = request.getParameter("target"); - String mimeType = request.getParameter("mimetype"); - - log.debug("Target: "+target); - log.debug("MimeType: "+mimeType); - - // TODO Check if is propper; - - SessionModel sm = SessionModelFactory.getInstance().getSessionModel(request); - OutputMode outputMode = sm.getOutputMode(target); - if (outputMode != null && outputMode.getMimeType().equals(mimeType)){ - Collection<OutputParameter> inputParameter =outputMode.getOutputParameters(); - Collection<InputParameter> ips = null; - if (inputParameter != null){ - ips = new ArrayList<InputParameter>(inputParameter.size()); - Iterator<OutputParameter> it = inputParameter.iterator(); - while (it.hasNext()){ - String name = it.next().getName(); - String[] values = request.getParameterValues(name); - InputParameter ip = new DefaultInputParameter(name, values); - ips.add(ip); + try { + String target = request.getParameter("target"); + String mimeType = request.getParameter("mimetype"); + + log.debug("Target: "+target); + log.debug("MimeType: "+mimeType); + + // TODO Check if is propper; + + SessionModel sm = SessionModelFactory.getInstance().getSessionModel(request); + OutputMode outputMode = sm.getOutputMode(target); + if (outputMode != null && outputMode.getMimeType().equals(mimeType)){ + Collection<OutputParameter> inputParameter =outputMode.getOutputParameters(); + Collection<InputParameter> ips = null; + if (inputParameter != null){ + ips = new ArrayList<InputParameter>(inputParameter.size()); + Iterator<OutputParameter> it = inputParameter.iterator(); + while (it.hasNext()){ + String name = it.next().getName(); + String[] values = request.getParameterValues(name); + InputParameter ip = new DefaultInputParameter(name, values); + ips.add(ip); + } } + + ArtifactDatabaseClient adc = ArtifactDatabaseClientFactory.getInstance().getArtifactDatabaseClient(); + + this.setHeaders(target, mimeType, response, request); + + OutputStream outputStream = response.getOutputStream(); + adc.doOutput(sm.getSelectedArtifactFactory(), sm.getCurrentArtifact(), outputStream, target, mimeType, ips); + + outputStream.flush(); + outputStream.close(); + }else{ + if (outputMode == null){ + log.error("Outputmode wird nicht unterstützt."); + }else if (!outputMode.getMimeType().equals(mimeType)){ + log.error("MimeType "+mimeType+" wird nicht unterstützt."); + } + // TODO FIXME: Fehlerbehandlung } - - ArtifactDatabaseClient adc = ArtifactDatabaseClientFactory.getInstance().getArtifactDatabaseClient(); - - this.setHeaders(target, mimeType, response, request); - - OutputStream outputStream = response.getOutputStream(); - adc.doOutput(sm.getSelectedArtifactFactory(), sm.getCurrentArtifact(), outputStream, target, mimeType, ips); - - outputStream.flush(); - outputStream.close(); - }else{ - if (outputMode == null){ - log.error("Outputmode wird nicht unterstützt."); - }else if (!outputMode.getMimeType().equals(mimeType)){ - log.error("MimeType "+mimeType+" wird nicht unterstützt."); - } - // TODO FIXME: Fehlerbehandlung + return super.execute(mapping, form, request, response); + } catch (Exception e) { + log.error(e,e); + request.setAttribute(CommunicationKeys.REQUEST_EXCEPTION_MESSAGE_ID, e.getMessage()); + return super.getExceptionForward(mapping); } - return super.execute(mapping, form, request, response); } protected void setHeaders(String target, String mimeType, HttpServletResponse response, HttpServletRequest request){
--- a/gnv/src/main/java/de/intevation/gnv/action/FetchArtifactFactoriesAction.java Mon Sep 28 10:36:08 2009 +0000 +++ b/gnv/src/main/java/de/intevation/gnv/action/FetchArtifactFactoriesAction.java Fri Oct 02 08:38:57 2009 +0000 @@ -40,14 +40,15 @@ HttpServletRequest request, HttpServletResponse response) throws Exception { log.debug("ArtifactDatabaseActionBase.execute"); - - Collection<ArtifactObject> artifactFactories = ArtifactDatabaseClientFactory.getInstance().getArtifactDatabaseClient().getArtifactFactories(); - SessionModel sm = SessionModelFactory.getInstance().getSessionModel(request); - sm.setArtifacteFactories(artifactFactories); - - - ActionForward lForward = mapping.findForward(SUCCSESS_FORWARD_ID); - return lForward; + try { + Collection<ArtifactObject> artifactFactories = ArtifactDatabaseClientFactory.getInstance().getArtifactDatabaseClient().getArtifactFactories(); + SessionModel sm = SessionModelFactory.getInstance().getSessionModel(request); + sm.setArtifacteFactories(artifactFactories); + return super.execute(mapping, form, request, response); + } catch (Exception e) { + log.error(e,e); + request.setAttribute(CommunicationKeys.REQUEST_EXCEPTION_MESSAGE_ID, e.getMessage()); + return super.getExceptionForward(mapping); + } } - }
--- a/gnv/src/main/java/de/intevation/gnv/action/NextArtifactStepAction.java Mon Sep 28 10:36:08 2009 +0000 +++ b/gnv/src/main/java/de/intevation/gnv/action/NextArtifactStepAction.java Fri Oct 02 08:38:57 2009 +0000 @@ -51,70 +51,75 @@ public ActionForward execute(ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response) throws Exception { - log.debug("NextArtifactStepAction.execute"); - SessionModel sm = SessionModelFactory.getInstance().getSessionModel(request); - ArtifactDescription ad = sm.getArtifactDescription(); - Collection<String> inputParameter = ad.getInputParameter(); - Collection<InputParameter> ips = null; - if (inputParameter != null){ - ips = new ArrayList<InputParameter>(inputParameter.size()); - Iterator<String> it = inputParameter.iterator(); - while (it.hasNext()){ - String name = it.next(); - String[] values = request.getParameterValues(name); - InputParameter ip = new DefaultInputParameter(name, values); - ips.add(ip); - } - } - ArtifactDatabaseClient adc = ArtifactDatabaseClientFactory.getInstance().getArtifactDatabaseClient(); - if (ad.getReachableStates() != null && !ad.getReachableStates().isEmpty()){ - // TODO: Woher kommt der zu erreichende Status; - String target = null; - if (ad.getReachableStates().size() > 1){ - target = request.getParameter("product"); // TODO HACK for Propducts every other Step has currently only one reachable state. - }else{ - target = ad.getReachableStates().iterator().next(); + try { + log.debug("NextArtifactStepAction.execute"); + SessionModel sm = SessionModelFactory.getInstance().getSessionModel(request); + ArtifactDescription ad = sm.getArtifactDescription(); + Collection<String> inputParameter = ad.getInputParameter(); + Collection<InputParameter> ips = null; + if (inputParameter != null){ + ips = new ArrayList<InputParameter>(inputParameter.size()); + Iterator<String> it = inputParameter.iterator(); + while (it.hasNext()){ + String name = it.next(); + String[] values = request.getParameterValues(name); + InputParameter ip = new DefaultInputParameter(name, values); + ips.add(ip); + } } - - ArtifactDescription artifactDescription = adc.doNextStep(sm.getSelectedArtifactFactory(), sm.getCurrentArtifact(), target, ips); - - Node currentUI = artifactDescription.getCurrentUI(); - XSLTransformer transformer = new XSLTransformer(); - String ui = transformer.transform(new XMLUtils().getNodeXPath(currentUI, "dynamic"), "UTF-8", request.getRealPath("WEB-INF/config/templates/describe-ui.xsl")); - - request.setAttribute("ui", ui); - - String staticUI = transformer.transform(new XMLUtils().getNodeXPath(currentUI, "static"), "UTF-8", request.getRealPath("WEB-INF/config/templates/describe-ui-static.xsl")); - request.setAttribute("staticui", staticUI); - - request.setAttribute("furthertargets", (ad.getReachableStates() != null && !ad.getReachableStates().isEmpty())); - - }else{ - - adc.doFeed(sm.getSelectedArtifactFactory(), sm.getCurrentArtifact(), ips); - - request.setAttribute("diagramm", true); - - // statistic abholen und in das sessionmodell schreiben. - - Collection<ArtifactStatisticValue> statistics = adc.calculateStatistics(sm.getSelectedArtifactFactory(), sm.getCurrentArtifact()); - sm.setStatistics(statistics); - - ArtifactDescription artifactDescription = adc.getCurrentStepDescription(sm.getSelectedArtifactFactory(), sm.getCurrentArtifact()); - - Node currentUI = artifactDescription.getCurrentUI(); - XSLTransformer transformer = new XSLTransformer(); - String ui = transformer.transform(new XMLUtils().getNodeXPath(currentUI, "dynamic"), "UTF-8", request.getRealPath("WEB-INF/config/templates/describe-ui.xsl")); + ArtifactDatabaseClient adc = ArtifactDatabaseClientFactory.getInstance().getArtifactDatabaseClient(); + if (ad.getReachableStates() != null && !ad.getReachableStates().isEmpty()){ + // TODO: Woher kommt der zu erreichende Status; + String target = null; + if (ad.getReachableStates().size() > 1){ + target = request.getParameter("product"); // TODO HACK for Propducts every other Step has currently only one reachable state. + }else{ + target = ad.getReachableStates().iterator().next(); + } - request.setAttribute("ui", ui); - - String staticUI = transformer.transform(new XMLUtils().getNodeXPath(currentUI, "static"), "UTF-8", request.getRealPath("WEB-INF/config/templates/describe-ui-static.xsl")); - request.setAttribute("staticui", staticUI); - - request.setAttribute("furthertargets",false); + ArtifactDescription artifactDescription = adc.doNextStep(sm.getSelectedArtifactFactory(), sm.getCurrentArtifact(), target, ips); + + Node currentUI = artifactDescription.getCurrentUI(); + XSLTransformer transformer = new XSLTransformer(); + String ui = transformer.transform(new XMLUtils().getNodeXPath(currentUI, "dynamic"), "UTF-8", request.getRealPath("WEB-INF/config/templates/describe-ui.xsl")); + + request.setAttribute("ui", ui); + + String staticUI = transformer.transform(new XMLUtils().getNodeXPath(currentUI, "static"), "UTF-8", request.getRealPath("WEB-INF/config/templates/describe-ui-static.xsl")); + request.setAttribute("staticui", staticUI); + + request.setAttribute("furthertargets", (ad.getReachableStates() != null && !ad.getReachableStates().isEmpty())); + + }else{ + + adc.doFeed(sm.getSelectedArtifactFactory(), sm.getCurrentArtifact(), ips); + + request.setAttribute("diagramm", true); + + // statistic abholen und in das sessionmodell schreiben. + + Collection<ArtifactStatisticValue> statistics = adc.calculateStatistics(sm.getSelectedArtifactFactory(), sm.getCurrentArtifact()); + sm.setStatistics(statistics); + + ArtifactDescription artifactDescription = adc.getCurrentStepDescription(sm.getSelectedArtifactFactory(), sm.getCurrentArtifact()); + + Node currentUI = artifactDescription.getCurrentUI(); + XSLTransformer transformer = new XSLTransformer(); + String ui = transformer.transform(new XMLUtils().getNodeXPath(currentUI, "dynamic"), "UTF-8", request.getRealPath("WEB-INF/config/templates/describe-ui.xsl")); + + request.setAttribute("ui", ui); + + String staticUI = transformer.transform(new XMLUtils().getNodeXPath(currentUI, "static"), "UTF-8", request.getRealPath("WEB-INF/config/templates/describe-ui-static.xsl")); + request.setAttribute("staticui", staticUI); + + request.setAttribute("furthertargets",false); + } + return super.execute(mapping, form, request, response); + } catch (Exception e) { + log.error(e,e); + request.setAttribute(CommunicationKeys.REQUEST_EXCEPTION_MESSAGE_ID, e.getMessage()); + return super.getExceptionForward(mapping); } - - return super.execute(mapping, form, request, response); }
--- a/gnv/src/main/java/de/intevation/gnv/action/SelectArtifactFactoryAction.java Mon Sep 28 10:36:08 2009 +0000 +++ b/gnv/src/main/java/de/intevation/gnv/action/SelectArtifactFactoryAction.java Fri Oct 02 08:38:57 2009 +0000 @@ -43,31 +43,36 @@ String selectedArtifactFactoryID = request.getParameter("artifactFactory"); log.debug("Selected ArtifactFactory ==> "+selectedArtifactFactoryID); - SessionModel sm = SessionModelFactory.getInstance().getSessionModel(request); - Collection<ArtifactObject> artifactFactories = sm.getArtifactFactories(); - // Löscht die Artifactspezifischen Attribute am Sessionmodel - sm.resetModel(); - if (artifactFactories == null || artifactFactories.isEmpty()){ - new FetchArtifactFactoriesAction().execute(mapping, form, request, response); - + try { + SessionModel sm = SessionModelFactory.getInstance().getSessionModel(request); + Collection<ArtifactObject> artifactFactories = sm.getArtifactFactories(); + // Löscht die Artifactspezifischen Attribute am Sessionmodel + sm.resetModel(); + if (artifactFactories == null || artifactFactories.isEmpty()){ + new FetchArtifactFactoriesAction().execute(mapping, form, request, response); + + } + + sm.selectArtifactFactory(selectedArtifactFactoryID); + ArtifactObject af = sm.getSelectedArtifactFactory();; + ArtifactDatabaseClient adc = ArtifactDatabaseClientFactory.getInstance().getArtifactDatabaseClient(); + ArtifactObject artifact = adc.createNewArtifact(af); + sm.setCurrentArtifact(artifact); + + ArtifactDescription artifactdescription = adc.getCurrentStepDescription(af, artifact); + + XSLTransformer transformer = new XSLTransformer(); + String ui = transformer.transform(artifactdescription.getCurrentUI(), "UTF-8", request.getRealPath("WEB-INF/config/templates/describe-ui.xsl")); + + request.setAttribute("ui", ui); + + // return succsess + return super.execute(mapping, form, request, response); + } catch (Exception e) { + log.error(e,e); + request.setAttribute(CommunicationKeys.REQUEST_EXCEPTION_MESSAGE_ID, e.getMessage()); + return super.getExceptionForward(mapping); } - - - sm.selectArtifactFactory(selectedArtifactFactoryID); - ArtifactObject af = sm.getSelectedArtifactFactory();; - ArtifactDatabaseClient adc = ArtifactDatabaseClientFactory.getInstance().getArtifactDatabaseClient(); - ArtifactObject artifact = adc.createNewArtifact(af); - sm.setCurrentArtifact(artifact); - - ArtifactDescription artifactdescription = adc.getCurrentStepDescription(af, artifact); - - XSLTransformer transformer = new XSLTransformer(); - String ui = transformer.transform(artifactdescription.getCurrentUI(), "UTF-8", request.getRealPath("WEB-INF/config/templates/describe-ui.xsl")); - - request.setAttribute("ui", ui); - - // return succsess - return super.execute(mapping, form, request, response); } /**
--- a/gnv/src/main/java/de/intevation/gnv/artifactdatabase/client/DefaultArtifactDatabaseClient.java Mon Sep 28 10:36:08 2009 +0000 +++ b/gnv/src/main/java/de/intevation/gnv/artifactdatabase/client/DefaultArtifactDatabaseClient.java Fri Oct 02 08:38:57 2009 +0000 @@ -163,6 +163,9 @@ * @throws IOException */ private InputStream doPostRequest(String requestUrl, Document requestBody) throws IOException { + log.debug("##################################################"); + log.debug(new XMLUtils().writeDocument2String(requestBody)); + log.debug("##################################################"); Client client = new Client(Protocol.HTTP); Request request = new Request(Method.POST, requestUrl); String documentBody = new XMLUtils().writeDocument2String(requestBody); @@ -462,7 +465,6 @@ try { XMLUtils xmlUtils = new XMLUtils(); Document requestBody = this.createOutRequestBody(currentArtifact, targetName, mimeType, inputParameter); - log.debug(xmlUtils.writeDocument2String(requestBody)); String requestUrl = this.getArtifactUrl(artifactFactory, currentArtifact)+"/"+targetName; InputStream is = this.doPostRequest( requestUrl, requestBody);
--- a/gnv/src/main/webapp/WEB-INF/jsp/header.jsp Mon Sep 28 10:36:08 2009 +0000 +++ b/gnv/src/main/webapp/WEB-INF/jsp/header.jsp Fri Oct 02 08:38:57 2009 +0000 @@ -4,7 +4,8 @@ <%@ taglib uri="http://jakarta.apache.org/struts/tags-bean" prefix="bean"%> <%@ taglib uri="http://java.sun.com/jstl/core" prefix="c"%> <%@ taglib uri="http://jakarta.apache.org/struts/tags-tiles" prefix="tiles"%> -<html:xhtml /> +<% Object exceptionMessage = request.getAttribute(CommunicationKeys.REQUEST_EXCEPTION_MESSAGE_ID);%> +<%@page import="de.intevation.gnv.action.CommunicationKeys"%><html:xhtml /> <!-- Kopfleiste--> <div id="head" title="GDI BSH genericViewer"> <div id="logo"> @@ -29,7 +30,7 @@ </div> <br/> <div class="errormsg" id="load_error"> - <html:errors property="fileload"/> + <%=exceptionMessage != null ? exceptionMessage.toString():"" %> </div> </div> </div>