You can subscribe to this list here.
2005 |
Jan
|
Feb
|
Mar
|
Apr
|
May
|
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
(6) |
---|---|---|---|---|---|---|---|---|---|---|---|---|
2006 |
Jan
(178) |
Feb
(169) |
Mar
(286) |
Apr
(117) |
May
(98) |
Jun
(68) |
Jul
(63) |
Aug
(121) |
Sep
(88) |
Oct
(124) |
Nov
(2) |
Dec
(111) |
2007 |
Jan
(224) |
Feb
(69) |
Mar
(10) |
Apr
(72) |
May
(7) |
Jun
(21) |
Jul
(33) |
Aug
(35) |
Sep
(12) |
Oct
(22) |
Nov
(5) |
Dec
(6) |
2008 |
Jan
(2) |
Feb
(10) |
Mar
(39) |
Apr
(58) |
May
(34) |
Jun
(9) |
Jul
(27) |
Aug
(10) |
Sep
(3) |
Oct
|
Nov
|
Dec
|
From: Chad B. <cwb...@us...> - 2008-05-28 20:26:27
|
User: cwbrandon Date: 08/05/28 13:26:35 Modified: andromda-jsf2/src/main/resources/templates/jsf2/flow ViewPopulator.java.vsl Log: add ability to reset view variables Revision Changes Path 1.9 +3 -0 cartridges/andromda-jsf2/src/main/resources/templates/jsf2/flow/ViewPopulator.java.vsl Index: ViewPopulator.java.vsl =================================================================== RCS file: /cvsroot/andromdaplugins/cartridges/andromda-jsf2/src/main/resources/templates/jsf2/flow/ViewPopulator.java.vsl,v retrieving revision 1.8 retrieving revision 1.9 diff -u -w -r1.8 -r1.9 --- ViewPopulator.java.vsl 15 May 2008 19:30:24 -0000 1.8 +++ ViewPopulator.java.vsl 28 May 2008 20:26:34 -0000 1.9 @@ -188,6 +188,9 @@ if ($readableVariable) { request.setAttribute("$variable.name", org.apache.commons.beanutils.PropertyUtils.getProperty(form, "$variable.name")); +#if ($variable.reset) + org.apache.commons.beanutils.PropertyUtils.setProperty(form, "$variable.name", $variable.type.javaNullString); +#end } #end #foreach ($variable in $view.backingValueVariables) |
From: Chad B. <cwb...@us...> - 2008-05-28 19:42:24
|
User: cwbrandon Date: 08/05/28 12:42:30 Modified: andromda-jsf2/src/main/resources/templates/jsf2/views/facelets/layout messages.xhtml.vsl andromda-jsf2/src/main/resources/templates/jsf2/views/jsp/includes messages.jspf.vsl Log: make regular jsp/facelets messages use the new settable messages title property Revision Changes Path 1.4 +1 -1 cartridges/andromda-jsf2/src/main/resources/templates/jsf2/views/facelets/layout/messages.xhtml.vsl Index: messages.xhtml.vsl =================================================================== RCS file: /cvsroot/andromdaplugins/cartridges/andromda-jsf2/src/main/resources/templates/jsf2/views/facelets/layout/messages.xhtml.vsl,v retrieving revision 1.3 retrieving revision 1.4 diff -u -w -r1.3 -r1.4 --- messages.xhtml.vsl 27 May 2008 16:15:09 -0000 1.3 +++ messages.xhtml.vsl 28 May 2008 19:42:29 -0000 1.4 @@ -3,6 +3,6 @@ xmlns:tr="http://myfaces.apache.org/trinidad" xmlns:h="http://java.sun.com/jsf/html"> <ui:composition> - <tr:messages globalOnly="true" text="#{messages['errors.header']}" rendered="#{!hideGlobalMessages}"/> + <tr:messages globalOnly="true" text="#{${formMessagesProperty}Title}" rendered="#{!hideGlobalMessages}"/> </ui:composition> </html> 1.3 +4 -1 cartridges/andromda-jsf2/src/main/resources/templates/jsf2/views/jsp/includes/messages.jspf.vsl Index: messages.jspf.vsl =================================================================== RCS file: /cvsroot/andromdaplugins/cartridges/andromda-jsf2/src/main/resources/templates/jsf2/views/jsp/includes/messages.jspf.vsl,v retrieving revision 1.2 retrieving revision 1.3 diff -u -w -r1.2 -r1.3 --- messages.jspf.vsl 27 May 2008 16:15:09 -0000 1.2 +++ messages.jspf.vsl 28 May 2008 19:42:30 -0000 1.3 @@ -1 +1,4 @@ -<h:messages errorClass="error" warnClass="warn" fatalClass="fatal" infoClass="info" globalOnly="true" rendered="#{!hideGlobalMessages}"/> +<h:panelGrid columns="1" cellpadding="2" cellspacing="2" rendered="#{!hideGlobalMessages and !empty facesContext.maximumSeverity}"> + <h:outputText value="#{${formMessagesProperty}Title}" escape="false" rendered="#{!empty ${formMessagesProperty}Title}"/> + <h:messages globalOnly="true" showDetail="false"/> +</h:panelGrid> |
From: Chad B. <cwb...@us...> - 2008-05-28 19:04:27
|
User: cwbrandon Date: 08/05/28 12:04:34 Modified: andromda-jsf2/src/main/resources/templates/jsf2/utils Messages.java.vsl MessagePhaseListener.java.vsl andromda-jsf2/src/main/resources/templates/jsf2/views/portlet messages.xhtml.vsl andromda-jsf2/src/main/resources/templates/jsf2/messages messages.properties.vsl andromda-jsf2/src/main/resources/templates/jsf2/forms FormImpl.java.vsl andromda-jsf2/src/main/resources/templates/jsf2/controllers Controller.java.vsl Log: Add default messages title (and ability to set in in a controller operation) Revision Changes Path 1.3 +11 -0 cartridges/andromda-jsf2/src/main/resources/templates/jsf2/utils/Messages.java.vsl Index: Messages.java.vsl =================================================================== RCS file: /cvsroot/andromdaplugins/cartridges/andromda-jsf2/src/main/resources/templates/jsf2/utils/Messages.java.vsl,v retrieving revision 1.2 retrieving revision 1.3 diff -u -w -r1.2 -r1.3 --- Messages.java.vsl 3 Apr 2008 22:21:20 -0000 1.2 +++ Messages.java.vsl 28 May 2008 19:04:29 -0000 1.3 @@ -58,4 +58,15 @@ } return resourceString; } + + /** + * Gets the message given the <code>key</code>. + * + * @param key the message key. + * @return the message (or key if the message isn't found). + */ + public static String get(String key) + { + return get(key, (Object[])null); + } } \ No newline at end of file 1.7 +23 -1 cartridges/andromda-jsf2/src/main/resources/templates/jsf2/utils/MessagePhaseListener.java.vsl Index: MessagePhaseListener.java.vsl =================================================================== RCS file: /cvsroot/andromdaplugins/cartridges/andromda-jsf2/src/main/resources/templates/jsf2/utils/MessagePhaseListener.java.vsl,v retrieving revision 1.6 retrieving revision 1.7 diff -u -w -r1.6 -r1.7 --- MessagePhaseListener.java.vsl 28 May 2008 17:23:26 -0000 1.6 +++ MessagePhaseListener.java.vsl 28 May 2008 19:04:29 -0000 1.7 @@ -69,7 +69,24 @@ { javax.faces.context.FacesContext.getCurrentInstance().addMessage(null, (javax.faces.application.FacesMessage)iterator.next()); } - form.getClass().getMethod("clearJsfMessages", (Class[])null).invoke(form, (Object[])null); + // - set the messages title to use (if we have a severity of error or higher) + final javax.faces.application.FacesMessage.Severity severity = context.getMaximumSeverity(); + if (severity != null && severity.getOrdinal() >= javax.faces.application.FacesMessage.SEVERITY_ERROR.getOrdinal()) + { + final java.lang.Object request = context.getExternalContext().getRequest(); + if (request instanceof $jsfUtils.requestClassName) + { + String messagesTitle = (String)form.getClass().getMethod("get${stringUtils.capitalize($formMessagesProperty)}Title", (Class[])null).invoke(form, (Object[])null); + if (messagesTitle == null || messagesTitle.trim().length() == 0) + { + messagesTitle = Messages.get("errors.header", null); + } + (($jsfUtils.requestClassName)request).setAttribute(MESSAGES_TITLE, messagesTitle); + } + } + form.getClass().getMethod("clear${stringUtils.capitalize($formMessagesProperty)}", (Class[])null).invoke(form, (Object[])null); + form.getClass().getMethod("set${stringUtils.capitalize($formMessagesProperty)}Title", + new Class[]{java.lang.String.class}).invoke(form, new Object[]{null}); } } catch (final Exception exception) @@ -79,6 +96,11 @@ } } + /** + * The name of the property storing the title to use for faces messages in the request scope + */ + protected static final String MESSAGES_TITLE = "${formMessagesProperty}Title"; + @Override protected void handleAfterPhase(javax.faces.event.PhaseEvent event) { 1.3 +4 -1 cartridges/andromda-jsf2/src/main/resources/templates/jsf2/views/portlet/messages.xhtml.vsl Index: messages.xhtml.vsl =================================================================== RCS file: /cvsroot/andromdaplugins/cartridges/andromda-jsf2/src/main/resources/templates/jsf2/views/portlet/messages.xhtml.vsl,v retrieving revision 1.2 retrieving revision 1.3 diff -u -w -r1.2 -r1.3 --- messages.xhtml.vsl 27 May 2008 16:14:19 -0000 1.2 +++ messages.xhtml.vsl 28 May 2008 19:04:31 -0000 1.3 @@ -2,6 +2,9 @@ xmlns:ui="http://java.sun.com/jsf/facelets" xmlns:h="http://java.sun.com/jsf/html"> <ui:composition> - <h:messages globalOnly="true" title="#{messages['errors.header']}" rendered="#{!hideGlobalMessages}"/> + <h:panelGrid columns="1" cellpadding="2" cellspacing="2" rendered="#{!hideGlobalMessages and !empty facesContext.maximumSeverity}"> + <h:outputText value="#{${formMessagesProperty}Title}" escape="false" rendered="#{!empty ${formMessagesProperty}Title}"/> + <h:messages globalOnly="true" showDetail="false"/> + </h:panelGrid> </ui:composition> </div> 1.12 +2 -2 cartridges/andromda-jsf2/src/main/resources/templates/jsf2/messages/messages.properties.vsl Index: messages.properties.vsl =================================================================== RCS file: /cvsroot/andromdaplugins/cartridges/andromda-jsf2/src/main/resources/templates/jsf2/messages/messages.properties.vsl,v retrieving revision 1.11 retrieving revision 1.12 diff -u -w -r1.11 -r1.12 --- messages.properties.vsl 23 May 2008 20:59:54 -0000 1.11 +++ messages.properties.vsl 28 May 2008 19:04:32 -0000 1.12 @@ -103,9 +103,9 @@ login.na=This feature is not available yet # -# Messages for the validator plugin +# Messages for validation # -errors.header=Errors +errors.header=You have one or more error(s) present: errors.required={0} is required. errors.minlength={0} can not be less than {1} characters. 1.7 +26 -0 cartridges/andromda-jsf2/src/main/resources/templates/jsf2/forms/FormImpl.java.vsl Index: FormImpl.java.vsl =================================================================== RCS file: /cvsroot/andromdaplugins/cartridges/andromda-jsf2/src/main/resources/templates/jsf2/forms/FormImpl.java.vsl,v retrieving revision 1.6 retrieving revision 1.7 diff -u -w -r1.6 -r1.7 --- FormImpl.java.vsl 28 May 2008 16:40:45 -0000 1.6 +++ FormImpl.java.vsl 28 May 2008 19:04:33 -0000 1.7 @@ -185,6 +185,32 @@ } /** + * The faces message title (used on a view). + */ + private String ${formMessagesProperty}Title; + + /** + * The optional faces message title to set (used on a view). If not set, the default title + * will be used. + * + * @param jsfMessagesTitle the title to use for the messages on the view. + */ + public void set${stringUtils.capitalize($formMessagesProperty)}Title(final String ${formMessagesProperty}Title) + { + this.${formMessagesProperty}Title = ${formMessagesProperty}Title; + } + + /** + * Gets the faces messages title to use. + * + * @return the faces messages title. + */ + public String get${stringUtils.capitalize($formMessagesProperty)}Title() + { + return this.${formMessagesProperty}Title; + } + + /** * Gets the maximum severity of the messages stored in this form. * * @return the maximum severity or null if no messages are present and/or severity isn't set. 1.17 +24 -0 cartridges/andromda-jsf2/src/main/resources/templates/jsf2/controllers/Controller.java.vsl Index: Controller.java.vsl =================================================================== RCS file: /cvsroot/andromdaplugins/cartridges/andromda-jsf2/src/main/resources/templates/jsf2/controllers/Controller.java.vsl,v retrieving revision 1.16 retrieving revision 1.17 diff -u -w -r1.16 -r1.17 --- Controller.java.vsl 28 May 2008 16:40:46 -0000 1.16 +++ Controller.java.vsl 28 May 2008 19:04:33 -0000 1.17 @@ -361,6 +361,30 @@ } /** + * Sets the messages title to use on the next view. + * + * @param messagesTitle the title to use. + */ + protected void setMessagesTitle(final String messagesTitle) + { + final Object form = this.resolveVariable("form"); + if (form != null) + { + try + { + final java.lang.reflect.Method method = form.getClass().getMethod( + "set${stringUtils.capitalize($formMessagesProperty)}Title", + new Class[]{java.lang.String.class}); + method.invoke(form, new Object[]{messagesTitle}); + } + catch (final Exception exception) + { + throw new RuntimeException(exception); + } + } + } + + /** * Gets the maximum severity of the messages stored in the current form. * * @return the maximum message severity. |
From: Chad B. <cwb...@us...> - 2008-05-28 17:23:24
|
User: cwbrandon Date: 08/05/28 10:23:31 Modified: andromda-jsf2/src/main/resources/templates/jsf2/utils MessagePhaseListener.java.vsl Log: cleanup some warnings Revision Changes Path 1.6 +1 -2 cartridges/andromda-jsf2/src/main/resources/templates/jsf2/utils/MessagePhaseListener.java.vsl Index: MessagePhaseListener.java.vsl =================================================================== RCS file: /cvsroot/andromdaplugins/cartridges/andromda-jsf2/src/main/resources/templates/jsf2/utils/MessagePhaseListener.java.vsl,v retrieving revision 1.5 retrieving revision 1.6 diff -u -w -r1.5 -r1.6 --- MessagePhaseListener.java.vsl 15 May 2008 14:19:34 -0000 1.5 +++ MessagePhaseListener.java.vsl 28 May 2008 17:23:26 -0000 1.6 @@ -69,8 +69,7 @@ { javax.faces.context.FacesContext.getCurrentInstance().addMessage(null, (javax.faces.application.FacesMessage)iterator.next()); } - final java.lang.reflect.Method method = form.getClass().getMethod("clearJsfMessages",null); - method.invoke(form,null); + form.getClass().getMethod("clearJsfMessages", (Class[])null).invoke(form, (Object[])null); } } catch (final Exception exception) |
From: Chad B. <cwb...@us...> - 2008-05-28 16:48:42
|
User: cwbrandon Date: 08/05/28 09:40:46 Modified: andromda-jsf2/src/main/resources/templates/jsf2/forms FormImpl.java.vsl andromda-jsf2/src/main/resources/templates/jsf2/controllers Controller.java.vm Controller.java.vsl Log: Add method for getting max severity of messages stored on the forms, and put a check before the addInfoMessage calls to Not add the info message if the severity is greater than warning Revision Changes Path 1.6 +22 -3 cartridges/andromda-jsf2/src/main/resources/templates/jsf2/forms/FormImpl.java.vsl Index: FormImpl.java.vsl =================================================================== RCS file: /cvsroot/andromdaplugins/cartridges/andromda-jsf2/src/main/resources/templates/jsf2/forms/FormImpl.java.vsl,v retrieving revision 1.5 retrieving revision 1.6 diff -u -w -r1.5 -r1.6 --- FormImpl.java.vsl 20 May 2008 02:54:29 -0000 1.5 +++ FormImpl.java.vsl 28 May 2008 16:40:45 -0000 1.6 @@ -151,7 +151,7 @@ * * @return the current Faces messages. */ - public java.util.Collection get${stringUtils.capitalize($formMessagesProperty)}() + public java.util.Collection<javax.faces.application.FacesMessage> get${stringUtils.capitalize($formMessagesProperty)}() { return this.${formMessagesProperty}.values(); } @@ -162,7 +162,7 @@ * * @param messages a collection of the current Faces messages. */ - public void set${stringUtils.capitalize($formMessagesProperty)}(final java.util.Collection messages) + public void set${stringUtils.capitalize($formMessagesProperty)}(final java.util.Collection<javax.faces.application.FacesMessage> messages) { if (messages != null) { @@ -179,12 +179,31 @@ * instances stored within this form. * */ - public void clearJsfMessages() + public void clear${stringUtils.capitalize($formMessagesProperty)}() { this.${formMessagesProperty}.clear(); } /** + * Gets the maximum severity of the messages stored in this form. + * + * @return the maximum severity or null if no messages are present and/or severity isn't set. + */ + public javax.faces.application.FacesMessage.Severity getMaximumMessageSeverity() + { + javax.faces.application.FacesMessage.Severity maxSeverity = null; + for (final javax.faces.application.FacesMessage message : this.get${stringUtils.capitalize($formMessagesProperty)}()) + { + final javax.faces.application.FacesMessage.Severity severity = message.getSeverity(); + if (maxSeverity == null || (severity != null && severity.getOrdinal() > maxSeverity.getOrdinal())) + { + maxSeverity = severity; + } + } + return maxSeverity; + } + + /** * The serial version UID of this class. Needed for serialization. */ private static final long serialVersionUID = ${action.formSerialVersionUID}L; 1.2 +6 -1 cartridges/andromda-jsf2/src/main/resources/templates/jsf2/controllers/Controller.java.vm Index: Controller.java.vm =================================================================== RCS file: /cvsroot/andromdaplugins/cartridges/andromda-jsf2/src/main/resources/templates/jsf2/controllers/Controller.java.vm,v retrieving revision 1.1 retrieving revision 1.2 diff -u -w -r1.1 -r1.2 --- Controller.java.vm 5 Dec 2006 19:39:27 -0000 1.1 +++ Controller.java.vm 28 May 2008 16:40:45 -0000 1.2 @@ -24,9 +24,14 @@ #set($messagesFullyQualifiedName = "${managedBeansPackage}.${messagesFullyQualifiedName}") #end #if ($transition.successMessagesPresent) +${indent}final javax.faces.application.FacesMessage.Severity messageSeverity = this.getMaximumMessageSeverity(); +${indent}// - only add info messages if we don't have any messages or warnings are the maximum severity +${indent}if (messageSeverity == null || messageSeverity.equals(javax.faces.application.FacesMessage.SEVERITY_WARN)) +${indent}{ #foreach ($message in $transition.successMessages.entrySet()) ${indent}this.addInfoMessage(${messagesFullyQualifiedName}.get("$message.key", (Object[])null)); #end +${indent}} #end #if ($transition.warningMessagesPresent) #foreach ($message in $transition.warningMessages.entrySet()) 1.16 +26 -0 cartridges/andromda-jsf2/src/main/resources/templates/jsf2/controllers/Controller.java.vsl Index: Controller.java.vsl =================================================================== RCS file: /cvsroot/andromdaplugins/cartridges/andromda-jsf2/src/main/resources/templates/jsf2/controllers/Controller.java.vsl,v retrieving revision 1.15 retrieving revision 1.16 diff -u -w -r1.15 -r1.16 --- Controller.java.vsl 28 May 2008 15:10:25 -0000 1.15 +++ Controller.java.vsl 28 May 2008 16:40:46 -0000 1.16 @@ -361,6 +361,32 @@ } /** + * Gets the maximum severity of the messages stored in the current form. + * + * @return the maximum message severity. + */ + protected javax.faces.application.FacesMessage.Severity getMaximumMessageSeverity() + { + javax.faces.application.FacesMessage.Severity maximumSeverity = null; + final Object form = this.resolveVariable("form"); + if (form != null) + { + try + { + final java.lang.reflect.Method method = form.getClass().getMethod( + "getMaximumMessageSeverity", + (Class[])null); + maximumSeverity = (javax.faces.application.FacesMessage.Severity)method.invoke(form, (Object[])null); + } + catch (final Exception exception) + { + throw new RuntimeException(exception); + } + } + return maximumSeverity; + } + + /** * Copies all matching properties from the <code>fromForm</code> to the given * <code>toForm</code> overridding any previously set values. */ |
From: Chad B. <cwb...@us...> - 2008-05-28 15:10:18
|
User: cwbrandon Date: 08/05/28 08:10:25 Modified: andromda-jsf2/src/main/resources/templates/jsf2/controllers Controller.java.vsl Log: Make controller operations throw Throwable (so we don't have to worry about rethrowing exceptions and having them handled in the controller impl code) Revision Changes Path 1.15 +7 -2 cartridges/andromda-jsf2/src/main/resources/templates/jsf2/controllers/Controller.java.vsl Index: Controller.java.vsl =================================================================== RCS file: /cvsroot/andromdaplugins/cartridges/andromda-jsf2/src/main/resources/templates/jsf2/controllers/Controller.java.vsl,v retrieving revision 1.14 retrieving revision 1.15 diff -u -w -r1.14 -r1.15 --- Controller.java.vsl 16 May 2008 20:27:18 -0000 1.14 +++ Controller.java.vsl 28 May 2008 15:10:25 -0000 1.15 @@ -8,13 +8,16 @@ public abstract class $controller.name implements java.io.Serializable { + private static final org.apache.commons.logging.Log logger = org.apache.commons.logging.LogFactory.getLog(${controller.name}.class); + static final String CONTROLLER_EXCEPTION = ${controller.name}.class.getName() + ".exception"; #foreach ($operation in $controller.operations) /** $operation.getDocumentation(" * ") */ - $operation.formSignature; + $operation.formSignature + throws java.lang.Throwable; #end @@ -90,8 +93,8 @@ this.setForm("$action.formKey", currentForm, false); this.addExceptionMessage(throwable); // - set the forward to null so that we stay on the current view - throwable.printStackTrace(); forward = null; + logger.error(throwable); } return forward; #end @@ -102,6 +105,7 @@ $actionState.getDocumentation(" * ") */ private java.lang.String ${actionState.actionMethodName}(#if (!$action.formFields.empty)final $action.fullyQualifiedFormImplementationName form#end) + throws java.lang.Throwable { java.lang.String forward = null; #if ($actionState.controllerCalls.empty) @@ -127,6 +131,7 @@ $decisionTransition.getDocumentation(" * ") */ private java.lang.String __${decisionTransition.operationCall.name}(#if (!$action.formFields.empty)final $action.fullyQualifiedFormImplementationName form#end) + throws java.lang.Throwable { final String value = java.lang.String.valueOf($decisionTransition.operationCall.formCall); #foreach ($outcome in $decisionTransition.target.outgoing) |
From: Chad B. <cwb...@us...> - 2008-05-27 16:15:04
|
User: cwbrandon Date: 08/05/27 09:15:09 Modified: andromda-jsf2/src/main/resources/templates/jsf2/views/facelets/layout messages.xhtml.vsl andromda-jsf2/src/main/resources/templates/jsf2/views/jsp/includes messages.jspf.vsl Log: add check that allows us to turn off global messages Revision Changes Path 1.3 +1 -1 cartridges/andromda-jsf2/src/main/resources/templates/jsf2/views/facelets/layout/messages.xhtml.vsl Index: messages.xhtml.vsl =================================================================== RCS file: /cvsroot/andromdaplugins/cartridges/andromda-jsf2/src/main/resources/templates/jsf2/views/facelets/layout/messages.xhtml.vsl,v retrieving revision 1.2 retrieving revision 1.3 diff -u -w -r1.2 -r1.3 --- messages.xhtml.vsl 11 Dec 2006 13:43:57 -0000 1.2 +++ messages.xhtml.vsl 27 May 2008 16:15:09 -0000 1.3 @@ -3,6 +3,6 @@ xmlns:tr="http://myfaces.apache.org/trinidad" xmlns:h="http://java.sun.com/jsf/html"> <ui:composition> - <tr:messages globalOnly="true" text="#{messages['errors.header']}"/> + <tr:messages globalOnly="true" text="#{messages['errors.header']}" rendered="#{!hideGlobalMessages}"/> </ui:composition> </html> 1.2 +1 -1 cartridges/andromda-jsf2/src/main/resources/templates/jsf2/views/jsp/includes/messages.jspf.vsl Index: messages.jspf.vsl =================================================================== RCS file: /cvsroot/andromdaplugins/cartridges/andromda-jsf2/src/main/resources/templates/jsf2/views/jsp/includes/messages.jspf.vsl,v retrieving revision 1.1 retrieving revision 1.2 diff -u -w -r1.1 -r1.2 --- messages.jspf.vsl 5 Dec 2006 19:39:16 -0000 1.1 +++ messages.jspf.vsl 27 May 2008 16:15:09 -0000 1.2 @@ -1 +1 @@ -<h:messages errorClass="error" warnClass="warn" fatalClass="fatal" infoClass="info" globalOnly="true"/> +<h:messages errorClass="error" warnClass="warn" fatalClass="fatal" infoClass="info" globalOnly="true" rendered="#{!hideGlobalMessages}"/> |
From: Chad B. <cwb...@us...> - 2008-05-27 16:14:14
|
User: cwbrandon Date: 08/05/27 09:14:19 Modified: andromda-jsf2/src/main/resources/templates/jsf2/views/portlet messages.xhtml.vsl Log: add check that allows us to turn off global messages Revision Changes Path 1.2 +1 -1 cartridges/andromda-jsf2/src/main/resources/templates/jsf2/views/portlet/messages.xhtml.vsl Index: messages.xhtml.vsl =================================================================== RCS file: /cvsroot/andromdaplugins/cartridges/andromda-jsf2/src/main/resources/templates/jsf2/views/portlet/messages.xhtml.vsl,v retrieving revision 1.1 retrieving revision 1.2 diff -u -w -r1.1 -r1.2 --- messages.xhtml.vsl 21 Mar 2008 16:07:11 -0000 1.1 +++ messages.xhtml.vsl 27 May 2008 16:14:19 -0000 1.2 @@ -2,6 +2,6 @@ xmlns:ui="http://java.sun.com/jsf/facelets" xmlns:h="http://java.sun.com/jsf/html"> <ui:composition> - <h:messages globalOnly="true" title="#{messages['errors.header']}"/> + <h:messages globalOnly="true" title="#{messages['errors.header']}" rendered="#{!hideGlobalMessages}"/> </ui:composition> </div> |
From: Chad B. <cwb...@us...> - 2008-05-23 20:59:48
|
User: cwbrandon Date: 08/05/23 13:59:54 Modified: andromda-jsf2/src/main/resources/templates/jsf2/messages messages.properties.vsl Log: get rid of pointless "Items" text in the search.result message Revision Changes Path 1.11 +1 -1 cartridges/andromda-jsf2/src/main/resources/templates/jsf2/messages/messages.properties.vsl Index: messages.properties.vsl =================================================================== RCS file: /cvsroot/andromdaplugins/cartridges/andromda-jsf2/src/main/resources/templates/jsf2/messages/messages.properties.vsl,v retrieving revision 1.10 retrieving revision 1.11 diff -u -w -r1.10 -r1.11 --- messages.properties.vsl 28 Mar 2008 23:25:44 -0000 1.10 +++ messages.properties.vsl 23 May 2008 20:59:54 -0000 1.11 @@ -148,7 +148,7 @@ return.link.uri=http://www.andromda.org return.link.text=Return to AndroMDA Home -table.results={0} Items found, displaying {1}, from {2} to {3}. Page {4} / {5} +table.results={0} found, displaying {1}, from {2} to {3}. Page {4} / {5} table.results.none.found=No Items Found #foreach ($message in $applicationUseCase.allMessages.entrySet()) |
From: Chad B. <cwb...@us...> - 2008-05-21 19:45:14
|
User: cwbrandon Date: 08/05/21 12:39:51 Modified: andromda-jsf2/src/main/resources/templates/jsf2/views/portlet layout.xhtml.vsl Added: andromda-jsf2/src/main/resources/resources/views/js shortlinks.js Log: Add js scripts to portlet layout Revision Changes Path 1.1 cartridges/andromda-jsf2/src/main/resources/resources/views/js/shortlinks.js Index: shortlinks.js =================================================================== /* Shortlinks constrains the length of links displayed to a defined length written by Chris Heilmann (http://icant.co.uk/) */ function shortlinks() { // defines where the link should be cut off, from the right or the middle var mode='right'; // the maximum length of the links var mustlength=60; // the string added to or in the middle of the link text after shortening var connector='...'; // the title added to the link, %url% will be replaced with the real link var titleadd=' (Full address: %url%)'; // the links to be shortened var contentlinks=document.getElementsByTagName('a'); // loop over all links for(var i=0;i<contentlinks.length;i++) { // check if the link has an href attribute and content if(!contentlinks[i].getAttribute('href') || !contentlinks[i].firstChild){continue;} // check if the link starts with http: and that it is longer than the allowed length var t=contentlinks[i].firstChild.nodeValue; if(/http:/.test(t) && t.length>mustlength) { // get the text of the link // shorten accordingly and add the separator string switch(mode){ case 'middle': var newt=t.substr(0,mustlength/2)+connector+t.substr(t.length-mustlength/2-connector.length,t.length); break; case 'right': var newt=t.substr(0,mustlength-connector.length)+connector; break; } // set the title, and replace the original link text contentlinks[i].title+=titleadd.replace(/%url%/,t); contentlinks[i].replaceChild(document.createTextNode(newt),contentlinks[i].firstChild); } } } // start shortlinks when the window is loaded. window.onload=shortlinks; 1.2 +6 -0 cartridges/andromda-jsf2/src/main/resources/templates/jsf2/views/portlet/layout.xhtml.vsl Index: layout.xhtml.vsl =================================================================== RCS file: /cvsroot/andromdaplugins/cartridges/andromda-jsf2/src/main/resources/templates/jsf2/views/portlet/layout.xhtml.vsl,v retrieving revision 1.1 retrieving revision 1.2 diff -u -w -r1.1 -r1.2 --- layout.xhtml.vsl 21 Mar 2008 16:07:11 -0000 1.1 +++ layout.xhtml.vsl 21 May 2008 19:39:51 -0000 1.2 @@ -2,6 +2,12 @@ xmlns:ui="http://java.sun.com/jsf/facelets" xmlns:f="http://java.sun.com/jsf/core"> <f:loadBundle basename="message-resources" var="messages"/> + <script type="text/javascript" language="Javascript1.1" src="${facesContext.externalContext.request.contextPath}/js/common.js"> + </script> + <script type="text/javascript" language="Javascript1.1" src="${facesContext.externalContext.request.contextPath}/js/key-events.js"> + </script> + <script type="text/javascript" language="Javascript1.1" src="${facesContext.externalContext.request.contextPath}/js/shortlinks.js"> + </script> <f:view> <ui:include src="messages.xhtml"/> <div> |
From: Chad B. <cwb...@us...> - 2008-05-21 14:30:47
|
User: cwbrandon Date: 08/05/21 07:30:54 Modified: andromda-ejb3/conf/test andromda.xml Log: only look at uml14 profiles Revision Changes Path 1.4 +2 -2 cartridges/andromda-ejb3/conf/test/andromda.xml Index: andromda.xml =================================================================== RCS file: /cvsroot/andromdaplugins/cartridges/andromda-ejb3/conf/test/andromda.xml,v retrieving revision 1.3 retrieving revision 1.4 diff -u -w -r1.3 -r1.4 --- andromda.xml 13 Feb 2007 02:41:40 -0000 1.3 +++ andromda.xml 21 May 2008 14:30:54 -0000 1.4 @@ -8,7 +8,7 @@ <model> <uri>${test.model.uri}</uri> <moduleSearchLocations> - <location patterns="**/*.xml.zip">${settings.localRepository}/org/andromda/profiles</location> + <location patterns="**/*.xml.zip">${settings.localRepository}/org/andromda/profiles/uml14</location> </moduleSearchLocations> <modelPackages> <modelPackage process="false">org::andromda::metafacades::uml</modelPackage> |
From: Chad B. <cwb...@us...> - 2008-05-20 16:21:46
|
User: cwbrandon Date: 08/05/20 09:21:46 Modified: andromda-jsf2/src/main/resources/templates/jsf2/utils JsfUtils.java.vsl Log: fix typo Revision Changes Path 1.6 +2 -4 cartridges/andromda-jsf2/src/main/resources/templates/jsf2/utils/JsfUtils.java.vsl Index: JsfUtils.java.vsl =================================================================== RCS file: /cvsroot/andromdaplugins/cartridges/andromda-jsf2/src/main/resources/templates/jsf2/utils/JsfUtils.java.vsl,v retrieving revision 1.5 retrieving revision 1.6 diff -u -w -r1.5 -r1.6 --- JsfUtils.java.vsl 16 May 2008 19:05:33 -0000 1.5 +++ JsfUtils.java.vsl 20 May 2008 16:21:46 -0000 1.6 @@ -209,7 +209,7 @@ try { final java.lang.reflect.Method method = object.getClass().getMethod("getAttribute", new Class[]{String.class}); - method.invoke(object, new Object[]{attributeName}); + attribute = method.invoke(object, new Object[]{attributeName}); } catch (NoSuchMethodException exception) { @@ -232,11 +232,10 @@ * @param attributeValue the value of the attribute to set. * @return the value of the attribute if one is present. */ - public static Object setAttribute(final Object object, final String attributeName, final Object attributeValue) + public static void setAttribute(final Object object, final String attributeName, final Object attributeValue) { try { - Object attribute = null; if (object != null) { try @@ -248,7 +247,6 @@ { } } - return attribute; } catch (Exception exception) { |
From: Chad B. <cwb...@us...> - 2008-05-20 02:54:28
|
User: cwbrandon Date: 08/05/19 19:54:29 Modified: andromda-jsf2/src/main/resources/templates/jsf2/forms FormImpl.java.vsl andromda-jsf2/src/main/resources/templates/jsf2/utils FormPopulator.java.vsl Log: add condition back (shouldn't have removed it). Just make sure we set complex objects "set" flags when they are created by default Revision Changes Path 1.5 +1 -0 cartridges/andromda-jsf2/src/main/resources/templates/jsf2/forms/FormImpl.java.vsl Index: FormImpl.java.vsl =================================================================== RCS file: /cvsroot/andromdaplugins/cartridges/andromda-jsf2/src/main/resources/templates/jsf2/forms/FormImpl.java.vsl,v retrieving revision 1.4 retrieving revision 1.5 diff -u -w -r1.4 -r1.5 --- FormImpl.java.vsl 17 Apr 2008 20:41:51 -0000 1.4 +++ FormImpl.java.vsl 20 May 2008 02:54:29 -0000 1.5 @@ -46,6 +46,7 @@ if (this.$field.name == null) { this.$field.name = new ${field.type.fullyQualifiedName}(); + this.${field.setterName}(this.$field.name); } #end return this.${field.name}; 1.7 +15 -12 cartridges/andromda-jsf2/src/main/resources/templates/jsf2/utils/FormPopulator.java.vsl Index: FormPopulator.java.vsl =================================================================== RCS file: /cvsroot/andromdaplugins/cartridges/andromda-jsf2/src/main/resources/templates/jsf2/utils/FormPopulator.java.vsl,v retrieving revision 1.6 retrieving revision 1.7 diff -u -w -r1.6 -r1.7 --- FormPopulator.java.vsl 20 May 2008 00:32:40 -0000 1.6 +++ FormPopulator.java.vsl 20 May 2008 02:54:29 -0000 1.7 @@ -63,6 +63,8 @@ isFromFormPropertySet = (java.lang.Boolean)org.apache.commons.beanutils.PropertyUtils.getProperty(fromForm, isSetPropertyName); } } + if (!override || (override && isFromFormPropertySet != null && isFromFormPropertySet.booleanValue())) + { if (override || (isToFormPropertySet == null || !isToFormPropertySet.booleanValue())) { final java.beans.PropertyDescriptor toDescriptor = @@ -86,6 +88,7 @@ } } } + } catch (final Throwable throwable) { throw new RuntimeException(throwable); |
From: Chad B. <cwb...@us...> - 2008-05-20 00:32:35
|
User: cwbrandon Date: 08/05/19 17:32:40 Modified: andromda-jsf2/src/main/resources/templates/jsf2/utils FormPopulator.java.vsl Log: remove bogus condition Revision Changes Path 1.6 +12 -15 cartridges/andromda-jsf2/src/main/resources/templates/jsf2/utils/FormPopulator.java.vsl Index: FormPopulator.java.vsl =================================================================== RCS file: /cvsroot/andromdaplugins/cartridges/andromda-jsf2/src/main/resources/templates/jsf2/utils/FormPopulator.java.vsl,v retrieving revision 1.5 retrieving revision 1.6 diff -u -w -r1.5 -r1.6 --- FormPopulator.java.vsl 15 May 2008 17:57:48 -0000 1.5 +++ FormPopulator.java.vsl 20 May 2008 00:32:40 -0000 1.6 @@ -63,8 +63,6 @@ isFromFormPropertySet = (java.lang.Boolean)org.apache.commons.beanutils.PropertyUtils.getProperty(fromForm, isSetPropertyName); } } - if (!override || (override && isFromFormPropertySet != null && isFromFormPropertySet.booleanValue())) - { if (override || (isToFormPropertySet == null || !isToFormPropertySet.booleanValue())) { final java.beans.PropertyDescriptor toDescriptor = @@ -88,7 +86,6 @@ } } } - } catch (final Throwable throwable) { throw new RuntimeException(throwable); |
From: Chad B. <cwb...@us...> - 2008-05-19 20:17:00
|
User: cwbrandon Date: 08/05/19 13:17:07 Modified: andromda-jsf2/src/main/resources/templates/jsf2/configuration faces-config.xml.vsl Log: controllers should be request scoped Revision Changes Path 1.17 +2 -2 cartridges/andromda-jsf2/src/main/resources/templates/jsf2/configuration/faces-config.xml.vsl Index: faces-config.xml.vsl =================================================================== RCS file: /cvsroot/andromdaplugins/cartridges/andromda-jsf2/src/main/resources/templates/jsf2/configuration/faces-config.xml.vsl,v retrieving revision 1.16 retrieving revision 1.17 diff -u -w -r1.16 -r1.17 --- faces-config.xml.vsl 29 Mar 2008 00:05:32 -0000 1.16 +++ faces-config.xml.vsl 19 May 2008 20:17:06 -0000 1.17 @@ -60,7 +60,7 @@ <managed-bean> <managed-bean-name>$controller.beanName</managed-bean-name> <managed-bean-class>$controller.fullyQualifiedImplementationName</managed-bean-class> - <managed-bean-scope>application</managed-bean-scope> + <managed-bean-scope>request</managed-bean-scope> </managed-bean> #end @@ -70,7 +70,7 @@ <managed-bean> <managed-bean-name>${manageable.controllerBeanName}</managed-bean-name> <managed-bean-class>${manageable.controllerType}Impl</managed-bean-class> - <managed-bean-scope>application</managed-bean-scope> + <managed-bean-scope>request</managed-bean-scope> </managed-bean> #end ##Helpers |
From: Chad B. <cwb...@us...> - 2008-05-16 22:45:21
|
User: cwbrandon Date: 08/05/16 15:45:27 Modified: andromda-jsf2/src/main/resources/templates/jsf2/utils/download FileDownloadServlet.java.vsl Log: remove download output when done rendering Revision Changes Path 1.2 +5 -0 cartridges/andromda-jsf2/src/main/resources/templates/jsf2/utils/download/FileDownloadServlet.java.vsl Index: FileDownloadServlet.java.vsl =================================================================== RCS file: /cvsroot/andromdaplugins/cartridges/andromda-jsf2/src/main/resources/templates/jsf2/utils/download/FileDownloadServlet.java.vsl,v retrieving revision 1.1 retrieving revision 1.2 diff -u -w -r1.1 -r1.2 --- FileDownloadServlet.java.vsl 16 May 2008 22:09:05 -0000 1.1 +++ FileDownloadServlet.java.vsl 16 May 2008 22:45:27 -0000 1.2 @@ -144,6 +144,11 @@ stream.flush(); } } + if (form != null) + { + // - remove the output now that we're done with it (in case its large) + org.apache.commons.beanutils.PropertyUtils.setProperty(form, outputProperty, null); + } } catch (Throwable throwable) { |
From: Chad B. <cwb...@us...> - 2008-05-16 22:18:46
|
User: cwbrandon Date: 08/05/16 13:27:18 Modified: andromda-jsf2/src/main/resources/templates/jsf2/controllers Controller.java.vsl Log: add some convience methods to getting and setting request/session attributes (to insulate us from portlet vs http requests and sessions). Revision Changes Path 1.14 +42 -7 cartridges/andromda-jsf2/src/main/resources/templates/jsf2/controllers/Controller.java.vsl Index: Controller.java.vsl =================================================================== RCS file: /cvsroot/andromdaplugins/cartridges/andromda-jsf2/src/main/resources/templates/jsf2/controllers/Controller.java.vsl,v retrieving revision 1.13 retrieving revision 1.14 diff -u -w -r1.13 -r1.14 --- Controller.java.vsl 15 May 2008 19:30:28 -0000 1.13 +++ Controller.java.vsl 16 May 2008 20:27:18 -0000 1.14 @@ -59,7 +59,7 @@ // IMPORTANT: it isn't possible to automatically populate any property named "id" since that // is a reserved name in JSF (the id of a component), therefore we have to unfortunately ignore any availble "id" attribute ${managedBeansPackage}.${formPopulatorName}.populateFormFromPropertyMap( - form, form.getDateTimeFormatters(), (java.util.Map)this.getRequest().getAttribute(ACTION_EVENT_ATTRIBUTES), new String[] {"id"}); + form, form.getDateTimeFormatters(), (java.util.Map)this.getRequestAttribute(ACTION_EVENT_ATTRIBUTES), new String[] {"id"}); // - populate the form with any request parameters that may match ${managedBeansPackage}.${formPopulatorName}.populateFormFromPropertyMap( form, form.getDateTimeFormatters(), this.getContext().getExternalContext().getRequestParameterMap()); @@ -77,7 +77,7 @@ } catch (final Throwable throwable) { - this.getRequest().setAttribute(CONTROLLER_EXCEPTION, throwable); + this.setRequestAttribute(CONTROLLER_EXCEPTION, throwable); this.setForm("$action.formKey", currentForm, false); final String messageKey = ${managedBeansPackage}.${patternMatchingExceptionHandler}.instance().handleException(throwable); if(!org.apache.commons.lang.StringUtils.isEmpty(messageKey)) @@ -86,7 +86,7 @@ } catch (final Throwable throwable) { - this.getRequest().setAttribute(CONTROLLER_EXCEPTION, throwable); + this.setRequestAttribute(CONTROLLER_EXCEPTION, throwable); this.setForm("$action.formKey", currentForm, false); this.addExceptionMessage(throwable); // - set the forward to null so that we stay on the current view @@ -253,15 +253,15 @@ contextWrapper.getCurrentInstance().getPageFlowScope().put(formKey, form); if (includeInSession) { - this.getSession(false).setAttribute(formKey, form); + this.setSessionAttribute(formKey, form); // - add this temporary ADF context to the session so that we can retrieve from a view populator if required this.getSession(false).setAttribute("$adfContextAttributeName", contextWrapper); } #else - this.getRequest().setAttribute(formKey, form); + this.setRequestAttribute(formKey, form); if (includeInSession) { - this.getSession(false).setAttribute(formKey, form); + this.setSessionAttribute(formKey, form); } #end } @@ -532,9 +532,30 @@ */ public void action(javax.faces.event.ActionEvent event) { - this.getRequest().setAttribute(ACTION_EVENT_ATTRIBUTES, event.getComponent(). + this.setRequestAttribute(ACTION_EVENT_ATTRIBUTES, event.getComponent(). getAttributes()); } + + protected void setRequestAttribute(final String name, final Object object) + { + ${managedBeansPackage}.JsfUtils.setAttribute(this.getContext().getExternalContext().getRequest(), name, object); + } + + protected Object getRequestAttribute(final String name) + { + return ${managedBeansPackage}.JsfUtils.getAttribute(this.getContext().getExternalContext().getRequest(), name); + } + + protected void setSessionAttribute(final String name, final Object object) + { + ${managedBeansPackage}.JsfUtils.setAttribute(this.getContext().getExternalContext().getSession(false), name, object); + } + + protected Object getSessionAttribute(final String name) + { + return ${managedBeansPackage}.JsfUtils.getAttribute(this.getContext().getExternalContext().getSession(false), name); + } + #if ($portlet) #if ($controller.useCase.preferences) @@ -548,6 +569,20 @@ #end /** + * Sets the given form into the {@link javax.portlet.PortletSession#APPLICATION_SCOPE}. + * + * @param form the form to set into the application scope (useful when you need to pass + * the form to another portlet or to the webapp outside of the portlet. + */ + protected void setFormInSessionApplicationScope(final Object form) + { + if (this.getContext().getExternalContext().getSession(false) instanceof javax.portlet.PortletSession) + { + this.getSession(false).setAttribute("$actionFormKey", form, javax.portlet.PortletSession.APPLICATION_SCOPE); + } + } + + /** * Gets the current action response. * * @return the current action response. |
From: Chad B. <cwb...@us...> - 2008-05-16 22:09:08
|
User: cwbrandon Date: 08/05/16 15:09:06 Modified: andromda-jsf2/src/main/resources/META-INF/andromda cartridge.xml andromda-jsf2/src/main/resources/templates/jsf2/flow/portlet PortletPhaseListener.java.vsl andromda-jsf2/src/main/resources/templates/jsf2/configuration web.xml.vsl Added: andromda-jsf2/src/main/resources/templates/jsf2/utils/download FileDownloadServlet.java.vsl contenttypes.properties.vsl Log: Add fileDownload servlet that works with both standalone and portlet apps Revision Changes Path 1.30 +12 -0 cartridges/andromda-jsf2/src/main/resources/META-INF/andromda/cartridge.xml Index: cartridge.xml =================================================================== RCS file: /cvsroot/andromdaplugins/cartridges/andromda-jsf2/src/main/resources/META-INF/andromda/cartridge.xml,v retrieving revision 1.29 retrieving revision 1.30 diff -u -w -r1.29 -r1.30 --- cartridge.xml 8 May 2008 23:03:06 -0000 1.29 +++ cartridge.xml 16 May 2008 22:09:04 -0000 1.30 @@ -527,6 +527,18 @@ outputCondition="standalone"/> <template + path="templates/jsf2/utils/download/FileDownloadServlet.java.vsl" + outputPattern="$stringUtils.replace($managedBeansPackage, '.', '/')/${className}.java" + outlet="managed-beans" + overwrite="true"/> + + <template + path="templates/jsf2/utils/download/contenttypes.properties.vsl" + outputPattern="$stringUtils.replace($managedBeansPackage, '.', '/')/${fileName}.properties" + outlet="managed-beans" + overwrite="true"/> + + <template path="templates/jsf2/utils/JsfUtils.java.vsl" outputPattern="$stringUtils.replace($managedBeansPackage, '.', '/')/${className}.java" outlet="managed-beans" 1.1 cartridges/andromda-jsf2/src/main/resources/templates/jsf2/utils/download/FileDownloadServlet.java.vsl Index: FileDownloadServlet.java.vsl =================================================================== #set ($className = "FileDownloadServlet") #if ($stringUtils.isNotEmpty($managedBeansPackage)) package $managedBeansPackage; #end import java.io.IOException; import java.io.InputStream; import java.io.OutputStream; import java.util.Properties; import javax.faces.context.FacesContext; import javax.faces.el.MethodBinding; import javax.servlet.ServletException; import javax.servlet.http.HttpServlet; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; import org.apache.commons.lang.ObjectUtils; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; /** * This servlet is used to download files. It can be used by * including it an output link, like the following: * * <h:outputLink value="/my-jsf-app-context/fileDownload?action=myControllerBean.myControllerOperation&prompt=true&fileName=exportResultFileName&outputName=exportResult"> * <h:outputText value="#{messages['export']}"/> * </h:outputLink> * * The following parameters may be specified: * <ul> * <li>fileName:</li> the name of the property on the the action form that has the name of your download file. * <li>outputName:</li> the name of the property on the action form that has the output to download. * <li>contentType:</li> any explicit content type to be used for the download (if not specified, it will be guessed * from the extension of the specified file). * <li>action:</li> the optional action to execute before downloading is attempted. */ public class FileDownloadServlet extends HttpServlet { private static final Log logger = LogFactory.getLog(FileDownloadServlet.class); private static final long serialVersionUID = 1L; /** * The name of an action on a controller to execute before attempt to render the download. */ private static final String ACTION = "action"; /** * Whether or not to prompt with a "save as" dialog, or just render the download in the browser. */ private static final String PROMPT = "prompt"; /** * The name of the property on the action form that has the name of the file to use when downloading. */ private static final String FILE_NAME = "fileName"; /** * The name of the property on the action form that will contain the output. */ private static final String OUTPUT = "outputName"; /** * The contentType parameter specifies what content type to render the download as */ private static final String CONTENT_TYPE = "contentType"; private static final int BUFFER_SIZE = 4096; @Override public void doGet(final HttpServletRequest request, final HttpServletResponse response) throws ServletException, IOException { try { final String action = request.getParameter(ACTION); final FacesContext context = FacesContextUtils.getFacesContext(request, response); if (action != null && action.trim().length() > 0) { final MethodBinding methodBinding = context.getApplication().createMethodBinding("#{" + action + "}", null); methodBinding.invoke(context, null); } final Object form = context.getApplication().getVariableResolver().resolveVariable(context, "$actionFormKey"); final boolean prompt = Boolean.valueOf(request.getParameter(PROMPT)); final String fileNameProperty = request.getParameter(FILE_NAME); final String outputProperty = request.getParameter(OUTPUT); if (form != null && outputProperty != null && fileNameProperty.trim().length() > 0) { final HttpServletResponse httpResponse = (HttpServletResponse)response; final OutputStream stream = httpResponse.getOutputStream(); // - reset the reponse to clear out any any headers (i.e. so // the user doesn't get "unable to open..." when using IE.) httpResponse.reset(); Object output = org.apache.commons.beanutils.PropertyUtils.getProperty(form, outputProperty); final String fileName = ObjectUtils.toString(org.apache.commons.beanutils.PropertyUtils.getProperty(form, fileNameProperty)); final String contentType = this.getContentType(context, request.getParameter(CONTENT_TYPE), fileName); if (prompt && fileName != null && fileName.trim().length() > 0) { httpResponse.addHeader( "Content-disposition", "attachment; filename=\"" + fileName + '"'); } // - for IE we need to set the content type, content length and buffer size and // then the flush the response right away because it seems as if there is any lag time // IE just displays a blank page. With mozilla based clients reports display correctly regardless. if (contentType != null && contentType.length() > 0) { httpResponse.setContentType(contentType); } if (output instanceof String) { output = ((String)output).getBytes(); } if (output instanceof byte[]) { byte[] file = (byte[])output; if (file != null) { httpResponse.setBufferSize(file.length); httpResponse.setContentLength(file.length); httpResponse.flushBuffer(); stream.write(file); } } else if (output instanceof InputStream) { final InputStream report = (InputStream)output; final byte[] buffer = new byte[BUFFER_SIZE]; httpResponse.setBufferSize(BUFFER_SIZE); httpResponse.flushBuffer(); for (int ctr = 0; (ctr = report.read(buffer)) > 0;) { stream.write(buffer, 0, ctr); } stream.flush(); } } } catch (Throwable throwable) { throw new ServletException(throwable); } } @Override public void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { doGet(request, response); } /** * The name of the attribute that stores the content type. */ public static final String CONTENT_TYPE_ATTRIBUTE = "contentType"; /** * Gets the explicity content type to render the file in. * * @return Returns the contentType. */ private String getContentType(final FacesContext context, final String contentType, final String fileName) { String foundContentType = contentType; // - if the content type is still null, lets guess if (contentType == null || contentType.length() == 0) { if (fileName != null && fileName.trim().length() > 0) { int lastDotIndex = fileName.lastIndexOf('.'); if (lastDotIndex != -1) { final String extension = fileName.substring( lastDotIndex, fileName.length()); foundContentType = CONTENT_TYPES.getProperty(extension); } } } return foundContentType; } /** * Stores the default content types. */ final static Properties CONTENT_TYPES = new Properties(); /** * Load up the default content types */ static { final String fileName = "contenttypes.properties"; final InputStream stream = ${className}.class.getResourceAsStream(fileName); if (stream == null) { logger.error("Could not load file from '" + fileName + "'"); } try { CONTENT_TYPES.load(stream); } catch (final Throwable throwable) { logger.error(throwable); } try { stream.close(); } catch (final Throwable throwable) { // - ignore } } } 1.1 cartridges/andromda-jsf2/src/main/resources/templates/jsf2/utils/download/contenttypes.properties.vsl Index: contenttypes.properties.vsl =================================================================== #set ($fileName = "contenttypes") .csv=application/vnd.ms-excel .3dm=x-world/x-3dmf .3dmf=x-world/x-3dmf .a=application/octet-stream .aab=application/x-authorware-bin .aam=application/x-authorware-map .aas=application/x-authorware-seg .abc=text/vnd.abc .acgi=text/html .afl=video/animaflex .ai=application/postscript .aif=audio/aiff .aif=audio/x-aiff .aifc=audio/aiff .aifc=audio/x-aiff .aiff=audio/aiff .aiff=audio/x-aiff .aim=application/x-aim .aip=text/x-audiosoft-intra .ani=application/x-navi-animation .aos=application/x-nokia-9000-communicator-add-on-software .aps=application/mime .arc=application/octet-stream .arj=application/arj .arj=application/octet-stream .art=image/x-jg .asf=video/x-ms-asf .asm=text/x-asm .asp=text/asp .asx=application/x-mplayer2 .asx=video/x-ms-asf .asx=video/x-ms-asf-plugin .au=audio/basic .au=audio/x-au .avi=application/x-troff-msvideo .avi=video/avi .avi=video/msvideo .avi=video/x-msvideo .avs=video/avs-video .bcpio=application/x-bcpio .bin=application/mac-binary .bin=application/macbinary .bin=application/octet-stream .bin=application/x-binary .bin=application/x-macbinary .bm=image/bmp .bmp=image/bmp .bmp=image/x-windows-bmp .boo=application/book .book=application/book .boz=application/x-bzip2 .bsh=application/x-bsh .bz=application/x-bzip .bz2=application/x-bzip2 .c=text/plain .c=text/x-c .c++=text/plain .cat=application/vnd.ms-pki.seccat .cc=text/plain .cc=text/x-c .ccad=application/clariscad .cco=application/x-cocoa .cdf=application/cdf .cdf=application/x-cdf .cdf=application/x-netcdf .cer=application/pkix-cert .cer=application/x-x509-ca-cert .cha=application/x-chat .chat=application/x-chat .class=application/java .class=application/java-byte-code .class=application/x-java-class .com=application/octet-stream .com=text/plain .conf=text/plain .cpio=application/x-cpio .cpp=text/x-c .cpt=application/mac-compactpro .cpt=application/x-compactpro .cpt=application/x-cpt .crl=application/pkcs-crl .crl=application/pkix-crl .crt=application/pkix-cert .crt=application/x-x509-ca-cert .crt=application/x-x509-user-cert .csh=application/x-csh .csh=text/x-script.csh .css=application/x-pointplus .css=text/css .cxx=text/plain .dcr=application/x-director .deepv=application/x-deepv .def=text/plain .der=application/x-x509-ca-cert .dif=video/x-dv .dir=application/x-director .dl=video/dl .dl=video/x-dl .doc=application/msword .dot=application/msword .dp=application/commonground .drw=application/drafting .dump=application/octet-stream .dv=video/x-dv .dvi=application/x-dvi .dwf=drawing/x-dwf (old) .dwf=model/vnd.dwf .dwg=application/acad .dwg=image/vnd.dwg .dwg=image/x-dwg .dxf=application/dxf .dxf=image/vnd.dwg .dxf=image/x-dwg .dxr=application/x-director .el=text/x-script.elisp .elc=application/x-bytecode.elisp (compiled elisp) .elc=application/x-elc .env=application/x-envoy .eps=application/postscript .es=application/x-esrehber .etx=text/x-setext .evy=application/envoy .evy=application/x-envoy .exe=application/octet-stream .f=text/plain .f=text/x-fortran .f77=text/x-fortran .f90=text/plain .f90=text/x-fortran .fdf=application/vnd.fdf .fif=application/fractals .fif=image/fif .fli=video/fli .fli=video/x-fli .flo=image/florian .flx=text/vnd.fmi.flexstor .fmf=video/x-atomic3d-feature .for=text/plain .for=text/x-fortran .fpx=image/vnd.fpx .fpx=image/vnd.net-fpx .frl=application/freeloader .funk=audio/make .g=text/plain .g3=image/g3fax .gif=image/gif .gl=video/gl .gl=video/x-gl .gsd=audio/x-gsm .gsm=audio/x-gsm .gsp=application/x-gsp .gss=application/x-gss .gtar=application/x-gtar .gz=application/x-compressed .gz=application/x-gzip .gzip=application/x-gzip .gzip=multipart/x-gzip .h=text/plain .h=text/x-h .hdf=application/x-hdf .help=application/x-helpfile .hgl=application/vnd.hp-hpgl .hh=text/plain .hh=text/x-h .hlb=text/x-script .hlp=application/hlp .hlp=application/x-helpfile .hlp=application/x-winhelp .hpg=application/vnd.hp-hpgl .hpgl=application/vnd.hp-hpgl .hqx=application/binhex .hqx=application/binhex4 .hqx=application/mac-binhex .hqx=application/mac-binhex40 .hqx=application/x-binhex40 .hqx=application/x-mac-binhex40 .hta=application/hta .htc=text/x-component .htm=text/html .html=text/html .htmls=text/html .htt=text/webviewhtml .htx=text/html .ice=x-conference/x-cooltalk .ico=image/x-icon .idc=text/plain .ief=image/ief .iefs=image/ief .iges=application/iges .iges=model/iges .igs=application/iges .igs=model/iges .ima=application/x-ima .imap=application/x-httpd-imap .inf=application/inf .ins=application/x-internett-signup .ip=application/x-ip2 .isu=video/x-isvideo .it=audio/it .iv=application/x-inventor .ivr=i-world/i-vrml .ivy=application/x-livescreen .jam=audio/x-jam .jav=text/plain .jav=text/x-java-source .java=text/plain .java=text/x-java-source .jcm=application/x-java-commerce .jfif=image/jpeg .jfif=image/pjpeg .jfif-tbnl=image/jpeg .jpe=image/jpeg .jpe=image/pjpeg .jpeg=image/jpeg .jpeg=image/pjpeg .jpg=image/jpeg .jpg=image/pjpeg .jps=image/x-jps .js=application/x-javascript .jut=image/jutvision .kar=audio/midi .kar=music/x-karaoke .ksh=application/x-ksh .ksh=text/x-script.ksh .la=audio/nspaudio .la=audio/x-nspaudio .lam=audio/x-liveaudio .latex=application/x-latex .lha=application/lha .lha=application/octet-stream .lha=application/x-lha .lhx=application/octet-stream .list=text/plain .lma=audio/nspaudio .lma=audio/x-nspaudio .log=text/plain .lsp=application/x-lisp .lsp=text/x-script.lisp .lst=text/plain .lsx=text/x-la-asf .ltx=application/x-latex .lzh=application/octet-stream .lzh=application/x-lzh .lzx=application/lzx .lzx=application/octet-stream .lzx=application/x-lzx .m=text/plain .m=text/x-m .m1v=video/mpeg .m2a=audio/mpeg .m2v=video/mpeg .m3u=audio/x-mpequrl .man=application/x-troff-man .map=application/x-navimap .mar=text/plain .mbd=application/mbedlet .mc$=application/x-magic-cap-package-1.0 .mcd=application/mcad .mcd=application/x-mathcad .mcf=image/vasa .mcf=text/mcf .mcp=application/netmc .me=application/x-troff-me .mht=message/rfc822 .mhtml=message/rfc822 .mid=application/x-midi .mid=audio/midi .mid=audio/x-mid .mid=audio/x-midi .mid=music/crescendo .mid=x-music/x-midi .midi=application/x-midi .midi=audio/midi .midi=audio/x-mid .midi=audio/x-midi .midi=music/crescendo .midi=x-music/x-midi .mif=application/x-frame .mif=application/x-mif .mime=message/rfc822 .mime=www/mime .mjf=audio/x-vnd.audioexplosion.mjuicemediafile .mjpg=video/x-motion-jpeg .mm=application/base64 .mm=application/x-meme .mme=application/base64 .mod=audio/mod .mod=audio/x-mod .moov=video/quicktime .mov=video/quicktime .movie=video/x-sgi-movie .mp2=audio/mpeg .mp2=audio/x-mpeg .mp2=video/mpeg .mp2=video/x-mpeg .mp2=video/x-mpeq2a .mp3=audio/mpeg3 .mp3=audio/x-mpeg-3 .mp3=video/mpeg .mp3=video/x-mpeg .mpa=audio/mpeg .mpa=video/mpeg .mpc=application/x-project .mpe=video/mpeg .mpeg=video/mpeg .mpg=audio/mpeg .mpg=video/mpeg .mpga=audio/mpeg .mpp=application/vnd.ms-project .mpt=application/x-project .mpv=application/x-project .mpx=application/x-project .mrc=application/marc .ms=application/x-troff-ms .mv=video/x-sgi-movie .my=audio/make .mzz=application/x-vnd.audioexplosion.mzz .nap=image/naplps .naplps=image/naplps .nc=application/x-netcdf .ncm=application/vnd.nokia.configuration-message .nif=image/x-niff .niff=image/x-niff .nix=application/x-mix-transfer .nsc=application/x-conference .nvd=application/x-navidoc .o=application/octet-stream .oda=application/oda .omc=application/x-omc .omcd=application/x-omcdatamaker .omcr=application/x-omcregerator .p=text/x-pascal .p10=application/pkcs10 .p10=application/x-pkcs10 .p12=application/pkcs-12 .p12=application/x-pkcs12 .p7a=application/x-pkcs7-signature .p7c=application/pkcs7-mime .p7c=application/x-pkcs7-mime .p7m=application/pkcs7-mime .p7m=application/x-pkcs7-mime .p7r=application/x-pkcs7-certreqresp .p7s=application/pkcs7-signature .part=application/pro_eng .pas=text/pascal .pbm=image/x-portable-bitmap .pcl=application/vnd.hp-pcl .pcl=application/x-pcl .pct=image/x-pict .pcx=image/x-pcx .pdb=chemical/x-pdb .pdf=application/pdf .pfunk=audio/make .pfunk=audio/make.my.funk .pgm=image/x-portable-graymap .pgm=image/x-portable-greymap .pic=image/pict .pict=image/pict .pkg=application/x-newton-compatible-pkg .pko=application/vnd.ms-pki.pko .pl=text/plain .pl=text/x-script.perl .plx=application/x-pixclscript .pm=image/x-xpixmap .pm=text/x-script.perl-module .pm4=application/x-pagemaker .pm5=application/x-pagemaker .png=image/png .pnm=application/x-portable-anymap .pnm=image/x-portable-anymap .pot=application/mspowerpoint .pot=application/vnd.ms-powerpoint .pov=model/x-pov .ppa=application/vnd.ms-powerpoint .ppm=image/x-portable-pixmap .pps=application/mspowerpoint .pps=application/vnd.ms-powerpoint .ppt=application/mspowerpoint .ppt=application/powerpoint .ppt=application/vnd.ms-powerpoint .ppt=application/x-mspowerpoint .ppz=application/mspowerpoint .pre=application/x-freelance .prt=application/pro_eng .ps=application/postscript .psd=application/octet-stream .pvu=paleovu/x-pv .pwz=application/vnd.ms-powerpoint .py=text/x-script.phyton .pyc=applicaiton/x-bytecode.python .qcp=audio/vnd.qcelp .qd3=x-world/x-3dmf .qd3d=x-world/x-3dmf .qif=image/x-quicktime .qt=video/quicktime .qtc=video/x-qtc .qti=image/x-quicktime .qtif=image/x-quicktime .ra=audio/x-pn-realaudio .ra=audio/x-pn-realaudio-plugin .ra=audio/x-realaudio .ram=audio/x-pn-realaudio .ras=application/x-cmu-raster .ras=image/cmu-raster .ras=image/x-cmu-raster .rast=image/cmu-raster .rexx=text/x-script.rexx .rf=image/vnd.rn-realflash .rgb=image/x-rgb .rm=application/vnd.rn-realmedia .rm=audio/x-pn-realaudio .rmi=audio/mid .rmm=audio/x-pn-realaudio .rmp=audio/x-pn-realaudio .rmp=audio/x-pn-realaudio-plugin .rng=application/ringing-tones .rng=application/vnd.nokia.ringing-tone .rnx=application/vnd.rn-realplayer .roff=application/x-troff .rp=image/vnd.rn-realpix .rpm=audio/x-pn-realaudio-plugin .rt=text/richtext .rt=text/vnd.rn-realtext .rtf=application/rtf .rtx=application/rtf .rv=video/vnd.rn-realvideo .s=text/x-asm .s3m=audio/s3m .saveme=application/octet-stream .sbk=application/x-tbook .scm=application/x-lotusscreencam .scm=text/x-script.guile .scm=text/x-script.scheme .scm=video/x-scm .sdml=text/plain .sdp=application/sdp .sdp=application/x-sdp .sdr=application/sounder .sea=application/sea .sea=application/x-sea .set=application/set .sgm=text/sgml .sgm=text/x-sgml .sgml=text/sgml .sgml=text/x-sgml .sh=application/x-bsh .sh=application/x-sh .sh=application/x-shar .sh=text/x-script.sh .shar=application/x-bsh .shar=application/x-shar .shtml=text/html .shtml=text/x-server-parsed-html .sid=audio/x-psid .sit=application/x-sit .sit=application/x-stuffit .skd=application/x-koan .skm=application/x-koan .skp=application/x-koan .skt=application/x-koan .sl=application/x-seelogo .smi=application/smil .smil=application/smil .snd=audio/basic .snd=audio/x-adpcm .sol=application/solids .spc=application/x-pkcs7-certificates .spc=text/x-speech .spl=application/futuresplash .spr=application/x-sprite .sprite=application/x-sprite .src=application/x-wais-source .ssi=text/x-server-parsed-html .ssm=application/streamingmedia .sst=application/vnd.ms-pki.certstore .step=application/step .stl=application/sla .stl=application/vnd.ms-pki.stl .stl=application/x-navistyle .stp=application/step .sv4cpio=application/x-sv4cpio .sv4crc=application/x-sv4crc .svf=image/vnd.dwg .svf=image/x-dwg .svr=application/x-world .svr=x-world/x-svr .swf=application/x-shockwave-flash .t=application/x-troff .talk=text/x-speech .tar=application/x-tar .tbk=application/toolbook .tbk=application/x-tbook .tcl=application/x-tcl .tcl=text/x-script.tcl .tcsh=text/x-script.tcsh .tex=application/x-tex .texi=application/x-texinfo .texinfo=application/x-texinfo .text=application/plain .text=text/plain .tgz=application/gnutar .tgz=application/x-compressed .tif=image/tiff .tif=image/x-tiff .tiff=image/tiff .tiff=image/x-tiff .tr=application/x-troff .tsi=audio/tsp-audio .tsp=application/dsptype .tsp=audio/tsplayer .tsv=text/tab-separated-values .turbot=image/florian .txt=text/plain .uil=text/x-uil .uni=text/uri-list .unis=text/uri-list .unv=application/i-deas .uri=text/uri-list .uris=text/uri-list .ustar=application/x-ustar .ustar=multipart/x-ustar .uu=application/octet-stream .uu=text/x-uuencode .uue=text/x-uuencode .vcd=application/x-cdlink .vcs=text/x-vcalendar .vda=application/vda .vdo=video/vdo .vew=application/groupwise .viv=video/vivo .viv=video/vnd.vivo .vivo=video/vivo .vivo=video/vnd.vivo .vmd=application/vocaltec-media-desc .vmf=application/vocaltec-media-file .voc=audio/voc .voc=audio/x-voc .vos=video/vosaic .vox=audio/voxware .vqe=audio/x-twinvq-plugin .vqf=audio/x-twinvq .vql=audio/x-twinvq-plugin .vrml=application/x-vrml .vrml=model/vrml .vrml=x-world/x-vrml .vrt=x-world/x-vrt .vsd=application/x-visio .vst=application/x-visio .vsw=application/x-visio .w60=application/wordperfect6.0 .w61=application/wordperfect6.1 .w6w=application/msword .wav=audio/wav .wav=audio/x-wav .wb1=application/x-qpro .wbmp=image/vnd.wap.wbmp .web=application/vnd.xara .wiz=application/msword .wk1=application/x-123 .wmf=windows/metafile .wml=text/vnd.wap.wml .wmlc=application/vnd.wap.wmlc .wmls=text/vnd.wap.wmlscript .wmlsc=application/vnd.wap.wmlscriptc .word=application/msword .wp=application/wordperfect .wp5=application/wordperfect .wp5=application/wordperfect6.0 .wp6=application/wordperfect .wpd=application/wordperfect .wpd=application/x-wpwin .wq1=application/x-lotus .wri=application/mswrite .wri=application/x-wri .wrl=application/x-world .wrl=model/vrml .wrl=x-world/x-vrml .wrz=model/vrml .wrz=x-world/x-vrml .wsc=text/scriplet .wsrc=application/x-wais-source .wtk=application/x-wintalk .xbm=image/x-xbitmap .xbm=image/x-xbm .xbm=image/xbm .xdr=video/x-amt-demorun .xgz=xgl/drawing .xif=image/vnd.xiff .xl=application/excel .xla=application/excel .xla=application/x-excel .xla=application/x-msexcel .xlb=application/excel .xlb=application/vnd.ms-excel .xlb=application/x-excel .xlc=application/excel .xlc=application/vnd.ms-excel .xlc=application/x-excel .xld=application/excel .xld=application/x-excel .xlk=application/excel .xlk=application/x-excel .xll=application/excel .xll=application/vnd.ms-excel .xll=application/x-excel .xlm=application/excel .xlm=application/vnd.ms-excel .xlm=application/x-excel .xls=application/excel .xls=application/vnd.ms-excel .xls=application/x-excel .xls=application/x-msexcel .xlt=application/excel .xlt=application/x-excel .xlv=application/excel .xlv=application/x-excel .xlw=application/excel .xlw=application/vnd.ms-excel .xlw=application/x-excel .xlw=application/x-msexcel .xm=audio/xm .xml=text/xml .xmz=xgl/movie .xpix=application/x-vnd.ls-xpix .xpm=image/x-xpixmap .xpm=image/xpm .x-png=image/png .xsr=video/x-amt-showrun .xwd=image/x-xwd .xwd=image/x-xwindowdump .xyz=chemical/x-pdb .z=application/x-compress .z=application/x-compressed .zip=application/x-compressed .zip=application/x-zip-compressed .zip=application/zip .zip=multipart/x-zip .zoo=application/octet-stream .zsh=text/x-script.zsh 1.12 +5 -0 cartridges/andromda-jsf2/src/main/resources/templates/jsf2/flow/portlet/PortletPhaseListener.java.vsl Index: PortletPhaseListener.java.vsl =================================================================== RCS file: /cvsroot/andromdaplugins/cartridges/andromda-jsf2/src/main/resources/templates/jsf2/flow/portlet/PortletPhaseListener.java.vsl,v retrieving revision 1.11 retrieving revision 1.12 diff -u -w -r1.11 -r1.12 --- PortletPhaseListener.java.vsl 8 May 2008 23:03:06 -0000 1.11 +++ PortletPhaseListener.java.vsl 16 May 2008 22:09:05 -0000 1.12 @@ -14,12 +14,17 @@ { private static final long serialVersionUID = 1L; + private static final String FACES_CONTEXT = "facesContext"; + @Override protected void handleBeforePhase(javax.faces.event.PhaseEvent event) { final String viewId = this.getViewId(event); if (viewId != null && event.getFacesContext() != null) { + // - make the faces context available to all views + ((javax.portlet.PortletRequest)event.getFacesContext().getExternalContext().getRequest()).setAttribute(FACES_CONTEXT, event.getFacesContext()); + #foreach ($role in $useCases.iterator().next().getAllRoles()) #set ($userIsInRoleName = "userIs${stringUtils.upperCamelCaseName($role.name.toLowerCase())}") #set ($specializedRoles = $role.generalizedByActors) 1.17 +9 -0 cartridges/andromda-jsf2/src/main/resources/templates/jsf2/configuration/web.xml.vsl Index: web.xml.vsl =================================================================== RCS file: /cvsroot/andromdaplugins/cartridges/andromda-jsf2/src/main/resources/templates/jsf2/configuration/web.xml.vsl,v retrieving revision 1.16 retrieving revision 1.17 diff -u -w -r1.16 -r1.17 --- web.xml.vsl 9 May 2008 11:29:57 -0000 1.16 +++ web.xml.vsl 16 May 2008 22:09:05 -0000 1.17 @@ -295,6 +295,11 @@ <servlet-class>javax.faces.webapp.FacesServlet</servlet-class> <load-on-startup>1</load-on-startup> </servlet> + <servlet> + <servlet-name>File Download Servlet</servlet-name> + <servlet-class>${managedBeansPackage}.FileDownloadServlet</servlet-class> + <load-on-startup>3</load-on-startup> + </servlet> #if ($standalone) <!-- resource loader servlet --> <servlet> @@ -330,6 +335,10 @@ <servlet-name>Faces Servlet</servlet-name> <url-pattern>*.${facesServletExtension}</url-pattern> </servlet-mapping> + <servlet-mapping> + <servlet-name>File Download Servlet</servlet-name> + <url-pattern>/fileDownload/*</url-pattern> + </servlet-mapping> #if ($standalone) <servlet-mapping> <servlet-name>Trinidad Resources Servlet</servlet-name> |
From: Chad B. <cwb...@us...> - 2008-05-16 22:08:52
|
User: cwbrandon Date: 08/05/16 15:08:58 cartridges/andromda-jsf2/src/main/resources/templates/jsf2/utils/download - New directory |
From: Chad B. <cwb...@us...> - 2008-05-16 19:05:45
|
User: cwbrandon Date: 08/05/16 12:05:33 Modified: andromda-jsf2/src/main/resources/templates/jsf2/utils JsfUtils.java.vsl Log: add methods for getting and setting attributes on any kind of request, session, etc Revision Changes Path 1.5 +65 -0 cartridges/andromda-jsf2/src/main/resources/templates/jsf2/utils/JsfUtils.java.vsl Index: JsfUtils.java.vsl =================================================================== RCS file: /cvsroot/andromdaplugins/cartridges/andromda-jsf2/src/main/resources/templates/jsf2/utils/JsfUtils.java.vsl,v retrieving revision 1.4 retrieving revision 1.5 diff -u -w -r1.4 -r1.5 --- JsfUtils.java.vsl 8 Apr 2008 16:29:07 -0000 1.4 +++ JsfUtils.java.vsl 16 May 2008 19:05:33 -0000 1.5 @@ -192,6 +192,71 @@ } /** + * Gets the attribute from the given object. The object can be either a context, request + * or resposne (HttpServletContext/PortletContext, HttpServletRequest/PortletRequest, etc). + * + * @param object the object from which to retrieve the attribute. + * @param attributeName the attribute name. + * @return the value of the attribute if one is present. + */ + public static Object getAttribute(final Object object, final String attributeName) + { + try + { + Object attribute = null; + if (object != null) + { + try + { + final java.lang.reflect.Method method = object.getClass().getMethod("getAttribute", new Class[]{String.class}); + method.invoke(object, new Object[]{attributeName}); + } + catch (NoSuchMethodException exception) + { + } + } + return attribute; + } + catch (Exception exception) + { + throw new RuntimeException(exception); + } + } + + /** + * Sets the attribute on the given object. The object can be either a context, request + * or resposne (HttpServletContext/PortletContext, HttpServletRequest/PortletRequest, etc). + * + * @param object the object on which to set the attribute. + * @param attributeName the attribute name. + * @param attributeValue the value of the attribute to set. + * @return the value of the attribute if one is present. + */ + public static Object setAttribute(final Object object, final String attributeName, final Object attributeValue) + { + try + { + Object attribute = null; + if (object != null) + { + try + { + final java.lang.reflect.Method method = object.getClass().getMethod("setAttribute", new Class[]{String.class, Object.class}); + method.invoke(object, new Object[]{attributeName, attributeValue}); + } + catch (NoSuchMethodException exception) + { + } + } + return attribute; + } + catch (Exception exception) + { + throw new RuntimeException(exception); + } + } + + /** * Uses the converter identified by converterId to convert the value to a String. * @value the value to be converted * @converterId the id of the converter to be used |
From: Chad B. <cwb...@us...> - 2008-05-15 19:30:24
|
User: cwbrandon Date: 08/05/15 12:30:28 Modified: andromda-jsf2/src/main/resources/templates/jsf2/flow ViewPopulator.java.vsl andromda-jsf2/src/main/resources/templates/jsf2/controllers Controller.java.vsl Log: improve exception handling a bit (make sure the form that was set before an exception occured is set back) Revision Changes Path 1.8 +2 -1 cartridges/andromda-jsf2/src/main/resources/templates/jsf2/flow/ViewPopulator.java.vsl Index: ViewPopulator.java.vsl =================================================================== RCS file: /cvsroot/andromdaplugins/cartridges/andromda-jsf2/src/main/resources/templates/jsf2/flow/ViewPopulator.java.vsl,v retrieving revision 1.7 retrieving revision 1.8 diff -u -w -r1.7 -r1.8 --- ViewPopulator.java.vsl 8 Apr 2008 16:29:06 -0000 1.7 +++ ViewPopulator.java.vsl 15 May 2008 19:30:24 -0000 1.8 @@ -156,6 +156,7 @@ try { #if (!$view.formActions.empty) + final boolean override = (($jsfUtils.requestClassName)facesContext.getExternalContext().getRequest()).getAttribute(${view.useCase.controller.name}.CONTROLLER_EXCEPTION) != null; // - populate the forms if (form != null) { @@ -165,7 +166,7 @@ facesContext, "$action.formBeanName"); // - populate the $action.formBeanName with any parameters from the previous form - ${managedBeansPackage}.${formPopulatorName}.populateForm(form, $action.formBeanName); + ${managedBeansPackage}.${formPopulatorName}.populateForm(form, $action.formBeanName, override); request.setAttribute("$action.formBeanName", $action.formBeanName); #end } 1.13 +4 -0 cartridges/andromda-jsf2/src/main/resources/templates/jsf2/controllers/Controller.java.vsl Index: Controller.java.vsl =================================================================== RCS file: /cvsroot/andromdaplugins/cartridges/andromda-jsf2/src/main/resources/templates/jsf2/controllers/Controller.java.vsl,v retrieving revision 1.12 retrieving revision 1.13 diff -u -w -r1.12 -r1.13 --- Controller.java.vsl 29 Mar 2008 00:05:32 -0000 1.12 +++ Controller.java.vsl 15 May 2008 19:30:28 -0000 1.13 @@ -8,6 +8,8 @@ public abstract class $controller.name implements java.io.Serializable { + static final String CONTROLLER_EXCEPTION = ${controller.name}.class.getName() + ".exception"; + #foreach ($operation in $controller.operations) /** $operation.getDocumentation(" * ") @@ -75,6 +77,7 @@ } catch (final Throwable throwable) { + this.getRequest().setAttribute(CONTROLLER_EXCEPTION, throwable); this.setForm("$action.formKey", currentForm, false); final String messageKey = ${managedBeansPackage}.${patternMatchingExceptionHandler}.instance().handleException(throwable); if(!org.apache.commons.lang.StringUtils.isEmpty(messageKey)) @@ -83,6 +86,7 @@ } catch (final Throwable throwable) { + this.getRequest().setAttribute(CONTROLLER_EXCEPTION, throwable); this.setForm("$action.formKey", currentForm, false); this.addExceptionMessage(throwable); // - set the forward to null so that we stay on the current view |
From: Chad B. <cwb...@us...> - 2008-05-15 17:58:01
|
User: cwbrandon Date: 08/05/15 10:57:49 Modified: andromda-jsf2/src/main/resources/templates/jsf2/utils FormPopulator.java.vsl Log: handle non string property population Revision Changes Path 1.5 +27 -15 cartridges/andromda-jsf2/src/main/resources/templates/jsf2/utils/FormPopulator.java.vsl Index: FormPopulator.java.vsl =================================================================== RCS file: /cvsroot/andromdaplugins/cartridges/andromda-jsf2/src/main/resources/templates/jsf2/utils/FormPopulator.java.vsl,v retrieving revision 1.4 retrieving revision 1.5 diff -u -w -r1.4 -r1.5 --- FormPopulator.java.vsl 3 Apr 2008 20:56:31 -0000 1.4 +++ FormPopulator.java.vsl 15 May 2008 17:57:48 -0000 1.5 @@ -135,29 +135,41 @@ org.apache.commons.beanutils.PropertyUtils.getPropertyDescriptor(form, name); if (descriptor != null) { - final String property = (String)properties.get(name); + final Object property = properties.get(name); + // - only convert if the string is not empty - if (property != null && property.trim().length() > 0) + if (property != null) { Object value = null; + if (property instanceof String) + { + final String propertyAsString = (String)property; + if (propertyAsString.trim().length() > 0) + { java.text.DateFormat formatter = (java.text.DateFormat)formatters.get(name); // - if the formatter is available we use that, otherwise we attempt to convert if (formatter != null) { try { - value = formatter.parse(property); + value = formatter.parse(propertyAsString); } catch (java.text.ParseException parseException) { // - try the default formatter (handles the default java.util.Date.toString() format) formatter = (java.text.DateFormat)formatters.get(null); - value = formatter.parse(property); + value = formatter.parse(propertyAsString); + } + } + else + { + value = org.apache.commons.beanutils.ConvertUtils.convert(propertyAsString, descriptor.getPropertyType()); + } } } else { - value = org.apache.commons.beanutils.ConvertUtils.convert(property, descriptor.getPropertyType()); + value = property; } org.apache.commons.beanutils.PropertyUtils.setProperty(form, name, value); } |
From: Chad B. <cwb...@us...> - 2008-05-15 14:19:36
|
User: cwbrandon Date: 08/05/15 07:19:35 Modified: andromda-jsf2/src/main/resources/templates/jsf2/utils MessagePhaseListener.java.vsl Log: rename trinidad RequestContext to requestContext (to avoid context name collision) Revision Changes Path 1.5 +2 -2 cartridges/andromda-jsf2/src/main/resources/templates/jsf2/utils/MessagePhaseListener.java.vsl Index: MessagePhaseListener.java.vsl =================================================================== RCS file: /cvsroot/andromdaplugins/cartridges/andromda-jsf2/src/main/resources/templates/jsf2/utils/MessagePhaseListener.java.vsl,v retrieving revision 1.4 retrieving revision 1.5 diff -u -w -r1.4 -r1.5 --- MessagePhaseListener.java.vsl 14 May 2008 22:22:12 -0000 1.4 +++ MessagePhaseListener.java.vsl 15 May 2008 14:19:34 -0000 1.5 @@ -53,8 +53,8 @@ } } #if ($standalone) - org.apache.myfaces.trinidad.context.RequestContext context = org.apache.myfaces.trinidad.context.RequestContext.getCurrentInstance(); - final Object form = context != null ? context.getPageFlowScope().get("$actionFormKey") : null; + org.apache.myfaces.trinidad.context.RequestContext requestContext = org.apache.myfaces.trinidad.context.RequestContext.getCurrentInstance(); + final Object form = requestContext != null ? requestContext.getPageFlowScope().get("$actionFormKey") : null; #else final Object form = context != null ? context.getApplication().getVariableResolver().resolveVariable(context, "$actionFormKey") : null; #end |
From: Chad B. <cwb...@us...> - 2008-05-14 22:22:07
|
User: cwbrandon Date: 08/05/14 15:22:13 Modified: andromda-jsf2/src/main/resources/templates/jsf2/utils MessagePhaseListener.java.vsl Log: message handling improvement Revision Changes Path 1.4 +19 -52 cartridges/andromda-jsf2/src/main/resources/templates/jsf2/utils/MessagePhaseListener.java.vsl Index: MessagePhaseListener.java.vsl =================================================================== RCS file: /cvsroot/andromdaplugins/cartridges/andromda-jsf2/src/main/resources/templates/jsf2/utils/MessagePhaseListener.java.vsl,v retrieving revision 1.3 retrieving revision 1.4 diff -u -w -r1.3 -r1.4 --- MessagePhaseListener.java.vsl 14 May 2008 20:29:14 -0000 1.3 +++ MessagePhaseListener.java.vsl 14 May 2008 22:22:12 -0000 1.4 @@ -14,6 +14,8 @@ { private static final long serialVersionUID = 1L; + private static final String ARGUMENT_PREFIX = "arg:"; + @Override protected void handleBeforePhase(javax.faces.event.PhaseEvent event) { @@ -23,6 +25,22 @@ { final String clientId = (String) iterator.next(); final javax.faces.component.UIComponent component = root.findComponent(clientId); + final java.util.Collection<Object> arguments = new java.util.ArrayList<Object>(); + for (final java.util.Iterator iterator2 = component.getChildren().iterator(); iterator2.hasNext();) + { + final Object child = iterator2.next(); + if (child instanceof javax.faces.component.UIParameter) + { + final javax.faces.component.UIParameter parameter = (javax.faces.component.UIParameter)child; + if (parameter.getName() != null) + { + if (parameter.getName().startsWith(ARGUMENT_PREFIX)) + { + arguments.add(parameter.getValue()); + } + } + } + } for (final java.util.Iterator iterator2 = context.getMessages(clientId); iterator2.hasNext();) { final javax.faces.application.FacesMessage facesMessage = (javax.faces.application.FacesMessage)iterator2.next(); @@ -30,17 +48,7 @@ final String newMessage = Messages.get(messageKey, null); if (!newMessage.equals(messageKey)) { - final int maxIndex = this.getMaxIndex(newMessage); - if (maxIndex > N0_ARGUMENTS) - { - final Object[] arguments = new Object[maxIndex + 1]; - for (int ctr = 0; ctr <= maxIndex; ctr++) - { - final Object argument = component.getAttributes().get("arg" + ctr); - arguments[ctr] = argument == null ? "{" + ctr + "}" : argument; - } - facesMessage.setDetail(java.text.MessageFormat.format(newMessage, arguments)); - } + facesMessage.setDetail(java.text.MessageFormat.format(newMessage, arguments.toArray(new Object[0]))); } } } @@ -87,45 +95,4 @@ { return detail != null ? detail.replaceAll(".*:", "").replace(".", "").trim().replaceAll("\\s+", ".").toLowerCase() : null; } - - private static final String ARGUMENT_PATTERN = "(\\{\\s*\\d+\\s*\\})"; - - private static final String REPLACEMENT_PATTERN = "\\{\\s*|\\}\\s*"; - - private static final int N0_ARGUMENTS = -1; - - /** - * Gets the max index from the given string (the max index of the arguments in the format - * {0}, {1}, etc). - * - * @param string the string from which to retrieve the max index. - * @return the max index. - */ - private int getMaxIndex(String string) - { - int maxIndex = N0_ARGUMENTS; - final java.util.regex.Matcher matcher = java.util.regex.Pattern.compile(ARGUMENT_PATTERN).matcher(string); - if (matcher.find()) - { - do - { - final String indexString = matcher.group().replaceAll(REPLACEMENT_PATTERN, ""); - try - { - int index = Integer.valueOf(indexString); - if (index > maxIndex) - { - maxIndex = index; - } - } - catch (NumberFormatException exception) - { - // - ignore, just don't attempt replacement - } - - } - while (matcher.find()); - } - return maxIndex; - } } \ No newline at end of file |
From: Chad B. <cwb...@us...> - 2008-05-14 20:29:08
|
User: cwbrandon Date: 08/05/14 13:29:14 Modified: andromda-jsf2/src/main/resources/templates/jsf2/utils MessagePhaseListener.java.vsl Log: Add ability to set override default jsf validation messages. Revision Changes Path 1.3 +73 -1 cartridges/andromda-jsf2/src/main/resources/templates/jsf2/utils/MessagePhaseListener.java.vsl Index: MessagePhaseListener.java.vsl =================================================================== RCS file: /cvsroot/andromdaplugins/cartridges/andromda-jsf2/src/main/resources/templates/jsf2/utils/MessagePhaseListener.java.vsl,v retrieving revision 1.2 retrieving revision 1.3 diff -u -w -r1.2 -r1.3 --- MessagePhaseListener.java.vsl 21 Mar 2008 16:07:13 -0000 1.2 +++ MessagePhaseListener.java.vsl 14 May 2008 20:29:14 -0000 1.3 @@ -17,11 +17,37 @@ @Override protected void handleBeforePhase(javax.faces.event.PhaseEvent event) { + final javax.faces.context.FacesContext context = event.getFacesContext(); + final javax.faces.component.UIViewRoot root = context.getViewRoot(); + for (final java.util.Iterator iterator = context.getClientIdsWithMessages(); iterator.hasNext();) + { + final String clientId = (String) iterator.next(); + final javax.faces.component.UIComponent component = root.findComponent(clientId); + for (final java.util.Iterator iterator2 = context.getMessages(clientId); iterator2.hasNext();) + { + final javax.faces.application.FacesMessage facesMessage = (javax.faces.application.FacesMessage)iterator2.next(); + final String messageKey = this.getMessageKey(facesMessage.getDetail()); + final String newMessage = Messages.get(messageKey, null); + if (!newMessage.equals(messageKey)) + { + final int maxIndex = this.getMaxIndex(newMessage); + if (maxIndex > N0_ARGUMENTS) + { + final Object[] arguments = new Object[maxIndex + 1]; + for (int ctr = 0; ctr <= maxIndex; ctr++) + { + final Object argument = component.getAttributes().get("arg" + ctr); + arguments[ctr] = argument == null ? "{" + ctr + "}" : argument; + } + facesMessage.setDetail(java.text.MessageFormat.format(newMessage, arguments)); + } + } + } + } #if ($standalone) org.apache.myfaces.trinidad.context.RequestContext context = org.apache.myfaces.trinidad.context.RequestContext.getCurrentInstance(); final Object form = context != null ? context.getPageFlowScope().get("$actionFormKey") : null; #else - final javax.faces.context.FacesContext context = event.getFacesContext(); final Object form = context != null ? context.getApplication().getVariableResolver().resolveVariable(context, "$actionFormKey") : null; #end if (form != null) @@ -56,4 +82,50 @@ { return javax.faces.event.PhaseId.RENDER_RESPONSE; } + + private String getMessageKey(final String detail) + { + return detail != null ? detail.replaceAll(".*:", "").replace(".", "").trim().replaceAll("\\s+", ".").toLowerCase() : null; + } + + private static final String ARGUMENT_PATTERN = "(\\{\\s*\\d+\\s*\\})"; + + private static final String REPLACEMENT_PATTERN = "\\{\\s*|\\}\\s*"; + + private static final int N0_ARGUMENTS = -1; + + /** + * Gets the max index from the given string (the max index of the arguments in the format + * {0}, {1}, etc). + * + * @param string the string from which to retrieve the max index. + * @return the max index. + */ + private int getMaxIndex(String string) + { + int maxIndex = N0_ARGUMENTS; + final java.util.regex.Matcher matcher = java.util.regex.Pattern.compile(ARGUMENT_PATTERN).matcher(string); + if (matcher.find()) + { + do + { + final String indexString = matcher.group().replaceAll(REPLACEMENT_PATTERN, ""); + try + { + int index = Integer.valueOf(indexString); + if (index > maxIndex) + { + maxIndex = index; + } + } + catch (NumberFormatException exception) + { + // - ignore, just don't attempt replacement + } + + } + while (matcher.find()); + } + return maxIndex; + } } \ No newline at end of file |