From 1181c3d502b82fcc0a9570ffc5f3ca71bbed50a2 Mon Sep 17 00:00:00 2001 From: Ted Nathan Husted Date: Mon, 6 Nov 2006 15:01:43 +0000 Subject: [PATCH] WW-1488 Update license headers for Struts 2 source. git-svn-id: https://svn.apache.org/repos/asf/struts/struts2/trunk@471756 13f79535-47bb-0310-9956-ffa450edef68 --- apps/blank/LICENSE.txt | 174 +++ apps/blank/NOTICE.txt | 6 + .../src/main/java/example/ExampleSupport.java | 21 + .../src/main/java/example/HelloWorld.java | 21 + apps/blank/src/main/java/example/Login.java | 21 + .../src/test/java/example/ConfigTest.java | 21 + .../src/test/java/example/HelloWorldTest.java | 21 + .../src/test/java/example/LoginTest.java | 21 + .../java/mailreader2/ApplicationListener.java | 31 +- .../src/main/java/mailreader2/Constants.java | 27 +- .../src/main/java/mailreader2/Login.java | 25 +- .../src/main/java/mailreader2/Logout.java | 25 +- .../java/mailreader2/MailreaderSupport.java | 25 +- .../main/java/mailreader2/Registration.java | 21 + .../main/java/mailreader2/Subscription.java | 23 +- .../src/main/java/mailreader2/Welcome.java | 21 + .../portlet/example/ExampleAction.java | 31 +- .../struts2/portlet/example/FormExample.java | 27 +- .../example/FormExampleWithValidation.java | 29 +- .../portlet/example/FormResultAction.java | 29 +- .../portlet/example/FormTestAction.java | 25 +- .../portlet/example/SavePrefsAction.java | 29 +- .../portlet/example/spring/SpringAction.java | 37 +- .../portlet/example/spring/ThingManager.java | 29 +- .../apache/struts2/showcase/DateAction.java | 25 +- .../showcase/DynamicTreeSelectAction.java | 62 +- .../org/apache/struts2/showcase/Guess.java | 25 +- .../LotsOfOptiontransferselectAction.java | 413 +++---- .../showcase/LotsOfRichtexteditorAction.java | 123 +- .../showcase/ShowDynamicTreeAction.java | 30 +- .../apache/struts2/showcase/UITagExample.java | 303 ++--- .../showcase/action/AbstractCRUDAction.java | 25 +- .../showcase/action/EmployeeAction.java | 25 +- .../struts2/showcase/action/SkillAction.java | 25 +- .../showcase/actionchaining/ActionChain1.java | 55 +- .../showcase/actionchaining/ActionChain2.java | 83 +- .../showcase/actionchaining/ActionChain3.java | 103 +- .../struts2/showcase/ajax/AjaxTestAction.java | 25 +- .../ajax/Example4ShowPanelAction.java | 99 +- .../struts2/showcase/ajax/Example5Action.java | 52 +- .../struts2/showcase/ajax/tree/Category.java | 25 +- .../showcase/ajax/tree/GetCategory.java | 25 +- .../struts2/showcase/ajax/tree/Toggle.java | 25 +- .../showcase/application/MemoryStorage.java | 29 +- .../struts2/showcase/application/Storage.java | 25 +- .../application/TestDataProvider.java | 29 +- .../chat/ChatAuthenticationInterceptor.java | 67 +- .../struts2/showcase/chat/ChatException.java | 47 +- .../showcase/chat/ChatInterceptor.java | 61 +- .../showcase/chat/ChatLoginAction.java | 97 +- .../showcase/chat/ChatLogoutAction.java | 75 +- .../struts2/showcase/chat/ChatMessage.java | 71 +- .../struts2/showcase/chat/ChatService.java | 47 +- .../showcase/chat/ChatServiceImpl.java | 183 +-- .../showcase/chat/ChatSessionListener.java | 59 +- .../struts2/showcase/chat/Constants.java | 27 +- .../struts2/showcase/chat/CrudRoomAction.java | 89 +- .../struts2/showcase/chat/DateConverter.java | 71 +- .../showcase/chat/EnterRoomAction.java | 85 +- .../struts2/showcase/chat/ExitRoomAction.java | 77 +- .../chat/MessagesAvailableInRoomAction.java | 81 +- .../apache/struts2/showcase/chat/Room.java | 161 +-- .../showcase/chat/RoomsAvailableAction.java | 59 +- .../chat/SendMessageToRoomAction.java | 99 +- .../apache/struts2/showcase/chat/User.java | 61 +- .../showcase/chat/UsersAvailableAction.java | 63 +- .../chat/UsersAvailableInRoomAction.java | 85 +- .../struts2/showcase/conversion/Address.java | 47 +- .../showcase/conversion/AddressAction.java | 55 +- .../conversion/EnumTypeConverter.java | 69 +- .../showcase/conversion/OperationsEnum.java | 39 +- .../conversion/OperationsEnumAction.java | 69 +- .../struts2/showcase/conversion/Person.java | 41 +- .../showcase/conversion/PersonAction.java | 57 +- .../struts2/showcase/dao/AbstractDao.java | 25 +- .../org/apache/struts2/showcase/dao/Dao.java | 25 +- .../struts2/showcase/dao/EmployeeDao.java | 27 +- .../apache/struts2/showcase/dao/SkillDao.java | 27 +- .../showcase/exception/CreateException.java | 29 +- .../showcase/exception/DeleteException.java | 29 +- .../exception/DuplicateKeyException.java | 27 +- .../showcase/exception/StorageException.java | 29 +- .../showcase/exception/UpdateException.java | 29 +- .../filedownload/FileDownloadAction.java | 25 +- .../showcase/fileupload/FileUploadAction.java | 43 +- .../MultipleFileUploadUsingArrayAction.java | 41 +- .../MultipleFileUploadUsingListAction.java | 55 +- .../freemarker/CustomFreemarkerManager.java | 59 +- .../CustomFreemarkerManagerUtil.java | 47 +- .../hangman/GetUpdatedHangmanAction.java | 76 +- .../hangman/GuessCharacterAction.java | 76 +- .../struts2/showcase/hangman/Hangman.java | 183 +-- .../showcase/hangman/HangmanConstants.java | 24 +- .../showcase/hangman/HangmanException.java | 63 +- .../showcase/hangman/HangmanService.java | 45 +- .../hangman/PropertiesVocabSource.java | 107 +- .../showcase/hangman/StartHangmanAction.java | 81 +- .../struts2/showcase/hangman/Vocab.java | 137 +-- .../struts2/showcase/hangman/VocabSource.java | 27 +- .../integration/EditGangsterAction.java | 31 +- .../showcase/integration/GangsterForm.java | 34 +- .../integration/SaveGangsterAction.java | 33 +- .../showcase/jsf/JsfEmployeeAction.java | 27 +- .../struts2/showcase/model/Employee.java | 31 +- .../struts2/showcase/model/IdEntity.java | 25 +- .../apache/struts2/showcase/model/Skill.java | 31 +- .../showcase/modelDriven/Gangster.java | 91 +- .../modelDriven/ModelDrivenAction.java | 49 +- .../showcase/person/EditPersonAction.java | 31 +- .../showcase/person/ListPeopleAction.java | 33 +- .../showcase/person/NewPersonAction.java | 35 +- .../struts2/showcase/person/Person.java | 25 +- .../showcase/person/PersonManager.java | 25 +- .../sitemesh/NoneDecoratorMapper.java | 23 +- .../showcase/source/ViewSourceAction.java | 63 +- .../tag/nonui/actionPrefix/SubmitAction.java | 50 +- .../tag/nonui/actiontag/ActionTagDemo.java | 45 +- .../iteratortag/AppendIteratorTagDemo.java | 125 +- .../iteratortag/IteratorGeneratorTagDemo.java | 105 +- .../iteratortag/MergeIteratorTagDemo.java | 125 +- .../iteratortag/SubsetIteratorTagDemo.java | 141 +-- .../struts2/showcase/token/TokenAction.java | 31 +- .../struts2/showcase/tutorial/HelloName.java | 23 - .../struts2/showcase/tutorial/HelloName2.java | 29 - .../struts2/showcase/tutorial/HelloWorld.java | 23 - .../AbstractValidationActionSupport.java | 41 +- .../FieldValidatorsExampleAction.java | 153 +-- .../NonFieldValidatorsExampleAction.java | 75 +- .../showcase/validation/QuizAction.java | 35 +- .../validation/SubmitApplication.java | 87 +- .../struts2/showcase/validation/User.java | 73 +- .../VisitorValidatorsExampleAction.java | 47 +- .../showcase/wait/LongProcessAction.java | 31 +- .../apache/struts2/ServletActionContext.java | 41 +- .../org/apache/struts2/StrutsConstants.java | 63 +- .../org/apache/struts2/StrutsException.java | 35 +- .../org/apache/struts2/StrutsStatics.java | 33 +- .../org/apache/struts2/StrutsTestCase.java | 27 +- .../struts2/components/ActionComponent.java | 89 +- .../struts2/components/ActionError.java | 25 +- .../struts2/components/ActionMessage.java | 27 +- .../org/apache/struts2/components/Anchor.java | 29 +- .../struts2/components/AppendIterator.java | 155 +-- .../org/apache/struts2/components/Bean.java | 31 +- .../apache/struts2/components/Checkbox.java | 25 +- .../struts2/components/CheckboxList.java | 25 +- .../struts2/components/ClosingUIBean.java | 25 +- .../apache/struts2/components/ComboBox.java | 167 +-- .../apache/struts2/components/Component.java | 53 +- .../org/apache/struts2/components/Date.java | 83 +- .../apache/struts2/components/DatePicker.java | 85 +- .../org/apache/struts2/components/Debug.java | 52 +- .../org/apache/struts2/components/Div.java | 51 +- .../struts2/components/DoubleListUIBean.java | 481 ++++---- .../struts2/components/DoubleSelect.java | 25 +- .../org/apache/struts2/components/Else.java | 33 +- .../org/apache/struts2/components/ElseIf.java | 35 +- .../apache/struts2/components/FieldError.java | 37 +- .../org/apache/struts2/components/File.java | 25 +- .../org/apache/struts2/components/Form.java | 47 +- .../apache/struts2/components/FormButton.java | 83 +- .../struts2/components/GenericUIBean.java | 57 +- .../org/apache/struts2/components/Head.java | 25 +- .../org/apache/struts2/components/Hidden.java | 25 +- .../org/apache/struts2/components/I18n.java | 59 +- .../org/apache/struts2/components/If.java | 35 +- .../apache/struts2/components/Include.java | 33 +- .../struts2/components/IteratorComponent.java | 111 +- .../org/apache/struts2/components/Label.java | 25 +- .../apache/struts2/components/ListUIBean.java | 59 +- .../struts2/components/MergeIterator.java | 199 ++-- .../apache/struts2/components/OptGroup.java | 159 +-- .../components/OptionTransferSelect.java | 807 ++++++------- .../org/apache/struts2/components/Panel.java | 25 +- .../org/apache/struts2/components/Param.java | 27 +- .../apache/struts2/components/Password.java | 25 +- .../apache/struts2/components/Property.java | 55 +- .../org/apache/struts2/components/Push.java | 51 +- .../org/apache/struts2/components/Radio.java | 29 +- .../struts2/components/RemoteCallUIBean.java | 25 +- .../org/apache/struts2/components/Reset.java | 25 +- .../org/apache/struts2/components/Select.java | 43 +- .../org/apache/struts2/components/Set.java | 29 +- .../org/apache/struts2/components/Submit.java | 83 +- .../struts2/components/TabbedPanel.java | 25 +- .../org/apache/struts2/components/Text.java | 69 +- .../apache/struts2/components/TextArea.java | 25 +- .../apache/struts2/components/TextField.java | 25 +- .../apache/struts2/components/TimePicker.java | 125 +- .../org/apache/struts2/components/Token.java | 27 +- .../org/apache/struts2/components/Tree.java | 461 ++++---- .../apache/struts2/components/TreeNode.java | 49 +- .../org/apache/struts2/components/UIBean.java | 191 ++-- .../org/apache/struts2/components/URL.java | 133 +-- .../struts2/components/UpDownSelect.java | 367 +++--- .../components/table/AbstractFilterModel.java | 25 +- .../components/table/RenderFilterModel.java | 31 +- .../components/table/SortFilterModel.java | 29 +- .../components/table/SortableTableModel.java | 25 +- .../struts2/components/table/WebTable.java | 25 +- .../components/table/WebTableColumn.java | 25 +- .../table/renderer/AbstractCellRenderer.java | 25 +- .../table/renderer/BooleanCellRenderer.java | 25 +- .../table/renderer/CellRenderer.java | 25 +- .../table/renderer/DateCellRenderer.java | 25 +- .../table/renderer/DefaultCellRenderer.java | 25 +- .../table/renderer/FixedTextCellRenderer.java | 25 +- .../table/renderer/LinkCellRenderer.java | 25 +- .../table/renderer/NumericCellRenderer.java | 25 +- .../template/BaseTemplateEngine.java | 51 +- .../template/FreemarkerTemplateEngine.java | 25 +- .../template/JspTemplateEngine.java | 25 +- .../struts2/components/template/Template.java | 25 +- .../components/template/TemplateEngine.java | 27 +- .../template/TemplateEngineManager.java | 25 +- .../template/TemplateRenderingContext.java | 25 +- .../template/VelocityTemplateEngine.java | 25 +- .../ClasspathConfigurationProvider.java | 107 +- .../struts2/config/DefaultSettings.java | 27 +- .../struts2/config/DelegatingSettings.java | 25 +- .../org/apache/struts2/config/Namespace.java | 27 +- .../org/apache/struts2/config/NullResult.java | 27 +- .../apache/struts2/config/ParentPackage.java | 27 +- .../struts2/config/PropertiesSettings.java | 25 +- .../org/apache/struts2/config/Result.java | 27 +- .../org/apache/struts2/config/Results.java | 27 +- .../config/ServletContextSingleton.java | 29 +- .../org/apache/struts2/config/Settings.java | 27 +- .../StrutsXmlConfigurationProvider.java | 47 +- .../struts2/dispatcher/AbstractFilter.java | 179 +-- .../dispatcher/ActionContextCleanUp.java | 97 +- .../struts2/dispatcher/ApplicationMap.java | 31 +- .../dispatcher/DefaultActionSupport.java | 93 +- .../apache/struts2/dispatcher/Dispatcher.java | 43 +- .../dispatcher/DispatcherListener.java | 31 +- .../struts2/dispatcher/FilterDispatcher.java | 133 +-- .../FilterDispatcherCompatWeblogic61.java | 25 +- .../struts2/dispatcher/HttpHeaderResult.java | 49 +- .../struts2/dispatcher/PlainTextResult.java | 221 ++-- .../apache/struts2/dispatcher/RequestMap.java | 31 +- .../ServletActionRedirectResult.java | 103 +- .../dispatcher/ServletDispatcherResult.java | 57 +- .../dispatcher/ServletRedirectResult.java | 41 +- .../apache/struts2/dispatcher/SessionMap.java | 67 +- .../struts2/dispatcher/StreamResult.java | 71 +- .../dispatcher/StrutsRequestWrapper.java | 29 +- .../dispatcher/StrutsResultSupport.java | 111 +- .../struts2/dispatcher/VelocityResult.java | 47 +- .../dispatcher/mapper/ActionMapper.java | 31 +- .../mapper/ActionMapperFactory.java | 27 +- .../dispatcher/mapper/ActionMapping.java | 29 +- .../mapper/CompositeActionMapper.java | 417 +++---- .../mapper/DefaultActionMapper.java | 109 +- .../mapper/Restful2ActionMapper.java | 33 +- .../mapper/RestfulActionMapper.java | 29 +- .../multipart/JakartaMultiPartRequest.java | 25 +- .../multipart/MultiPartRequest.java | 25 +- .../multipart/MultiPartRequestWrapper.java | 25 +- .../struts2/impl/ActionContextImpl.java | 20 + .../struts2/impl/InterceptorAdapter.java | 20 + .../org/apache/struts2/impl/MessagesImpl.java | 20 + .../struts2/impl/RequestContextImpl.java | 20 + .../apache/struts2/impl/ResultAdapter.java | 20 + .../struts2/impl/StrutsActionProxy.java | 20 + .../impl/StrutsActionProxyFactory.java | 20 + .../struts2/impl/StrutsObjectFactory.java | 20 + .../struts2/impl/ValueStackAdapter.java | 20 + .../struts2/interceptor/ApplicationAware.java | 25 +- .../interceptor/BackgroundProcess.java | 43 +- .../interceptor/CheckboxInterceptor.java | 35 +- .../interceptor/CreateSessionInterceptor.java | 57 +- .../ExecuteAndWaitInterceptor.java | 41 +- .../interceptor/FileUploadInterceptor.java | 37 +- .../interceptor/MessageStoreInterceptor.java | 479 ++++---- .../struts2/interceptor/NoParameters.java | 25 +- .../struts2/interceptor/ParameterAware.java | 25 +- .../struts2/interceptor/PrincipalAware.java | 25 +- .../struts2/interceptor/PrincipalProxy.java | 37 +- .../ProfilingActivationInterceptor.java | 57 +- .../struts2/interceptor/RequestAware.java | 32 +- .../struts2/interceptor/RolesInterceptor.java | 39 +- .../struts2/interceptor/ScopeInterceptor.java | 39 +- .../interceptor/ServletConfigInterceptor.java | 35 +- .../interceptor/ServletRequestAware.java | 25 +- .../interceptor/ServletResponseAware.java | 25 +- .../struts2/interceptor/SessionAware.java | 25 +- .../StrutsConversionErrorInterceptor.java | 31 +- .../struts2/interceptor/TokenInterceptor.java | 55 +- .../TokenSessionStoreInterceptor.java | 49 +- .../debugging/DebuggingInterceptor.java | 31 +- .../debugging/PrettyPrintWriter.java | 28 +- .../portlet/PortletActionConstants.java | 73 +- .../portlet/PortletApplicationMap.java | 297 ++--- .../struts2/portlet/PortletRequestMap.java | 37 +- .../struts2/portlet/PortletSessionMap.java | 37 +- .../portlet/context/PortletActionContext.java | 33 +- .../portlet/context/PreparatorServlet.java | 37 +- .../context/ServletContextHolderListener.java | 37 +- .../DirectRenderFromEventAction.java | 25 +- .../portlet/dispatcher/Jsr168Dispatcher.java | 81 +- .../struts2/portlet/result/PortletResult.java | 49 +- .../portlet/result/PortletVelocityResult.java | 81 +- .../portlet/util/PortletUrlHelper.java | 55 +- .../spring/StrutsSpringObjectFactory.java | 25 +- ...xternalReferenceResolverSetupListener.java | 41 +- .../struts2/util/AppendIteratorFilter.java | 25 +- .../org/apache/struts2/util/AttributeMap.java | 25 +- .../apache/struts2/util/ClassLoaderUtils.java | 25 +- .../org/apache/struts2/util/ContainUtil.java | 95 +- .../java/org/apache/struts2/util/Counter.java | 29 +- .../apache/struts2/util/DateFormatter.java | 25 +- .../util/FastByteArrayOutputStream.java | 25 +- .../struts2/util/InvocationSessionStore.java | 33 +- .../struts2/util/IteratorFilterSupport.java | 25 +- .../struts2/util/IteratorGenerator.java | 67 +- .../org/apache/struts2/util/ListEntry.java | 25 +- .../org/apache/struts2/util/MakeIterator.java | 25 +- .../struts2/util/MergeIteratorFilter.java | 27 +- .../util/ObjectFactoryDestroyable.java | 35 +- .../util/ObjectFactoryInitializable.java | 25 +- .../struts2/util/ObjectFactoryLifecycle.java | 29 +- .../org/apache/struts2/util/PrefixTrie.java | 25 +- .../ResolverSetupServletContextListener.java | 35 +- .../struts2/util/ServletContextAware.java | 25 +- .../struts2/util/SortIteratorFilter.java | 25 +- .../java/org/apache/struts2/util/Sorter.java | 25 +- .../struts2/util/StrutsTypeConverter.java | 29 +- .../org/apache/struts2/util/StrutsUtil.java | 37 +- .../struts2/util/SubsetIteratorFilter.java | 97 +- .../org/apache/struts2/util/TabbedPane.java | 25 +- .../java/org/apache/struts2/util/Timer.java | 25 +- .../org/apache/struts2/util/TokenHelper.java | 55 +- .../java/org/apache/struts2/util/URLBean.java | 25 +- .../struts2/util/VelocityStrutsUtil.java | 25 +- .../struts2/validators/DWRValidator.java | 31 +- .../struts2/views/JspSupportServlet.java | 33 +- .../views/freemarker/FreemarkerManager.java | 33 +- .../views/freemarker/FreemarkerResult.java | 49 +- .../freemarker/PortletFreemarkerResult.java | 41 +- .../views/freemarker/ScopesHashModel.java | 31 +- .../views/freemarker/StrutsBeanWrapper.java | 25 +- .../freemarker/StrutsClassTemplateLoader.java | 25 +- .../freemarker/tags/ActionErrorModel.java | 25 +- .../freemarker/tags/ActionMessageModel.java | 25 +- .../views/freemarker/tags/ActionModel.java | 25 +- .../views/freemarker/tags/AnchorModel.java | 25 +- .../views/freemarker/tags/BeanModel.java | 25 +- .../views/freemarker/tags/CallbackWriter.java | 25 +- .../freemarker/tags/CheckboxListModel.java | 25 +- .../views/freemarker/tags/CheckboxModel.java | 25 +- .../views/freemarker/tags/ComboBoxModel.java | 25 +- .../views/freemarker/tags/ComponentModel.java | 25 +- .../views/freemarker/tags/DateModel.java | 25 +- .../freemarker/tags/DatePickerModel.java | 25 +- .../views/freemarker/tags/DivModel.java | 25 +- .../freemarker/tags/DoubleSelectModel.java | 25 +- .../views/freemarker/tags/ElseIfModel.java | 39 +- .../views/freemarker/tags/ElseModel.java | 39 +- .../freemarker/tags/FieldErrorModel.java | 25 +- .../views/freemarker/tags/FileModel.java | 25 +- .../views/freemarker/tags/FormModel.java | 25 +- .../views/freemarker/tags/HeadModel.java | 25 +- .../views/freemarker/tags/HiddenModel.java | 25 +- .../views/freemarker/tags/I18nModel.java | 25 +- .../views/freemarker/tags/IfModel.java | 39 +- .../views/freemarker/tags/IncludeModel.java | 25 +- .../views/freemarker/tags/IteratorModel.java | 25 +- .../views/freemarker/tags/LabelModel.java | 25 +- .../views/freemarker/tags/OptGroupModel.java | 37 +- .../tags/OptionTransferSelectModel.java | 37 +- .../views/freemarker/tags/PanelModel.java | 25 +- .../views/freemarker/tags/ParamModel.java | 25 +- .../views/freemarker/tags/PasswordModel.java | 25 +- .../views/freemarker/tags/PropertyModel.java | 25 +- .../views/freemarker/tags/PushModel.java | 25 +- .../views/freemarker/tags/RadioModel.java | 25 +- .../views/freemarker/tags/ResetModel.java | 25 +- .../views/freemarker/tags/SelectModel.java | 25 +- .../views/freemarker/tags/SetModel.java | 25 +- .../views/freemarker/tags/StrutsModels.java | 97 +- .../views/freemarker/tags/SubmitModel.java | 25 +- .../freemarker/tags/TabbedPanelModel.java | 25 +- .../views/freemarker/tags/TagModel.java | 25 +- .../views/freemarker/tags/TextAreaModel.java | 25 +- .../views/freemarker/tags/TextFieldModel.java | 25 +- .../views/freemarker/tags/TextModel.java | 25 +- .../views/freemarker/tags/TokenModel.java | 25 +- .../views/freemarker/tags/TreeModel.java | 25 +- .../views/freemarker/tags/TreeNodeModel.java | 25 +- .../views/freemarker/tags/URLModel.java | 25 +- .../freemarker/tags/UpDownSelectModel.java | 39 +- .../views/freemarker/tags/WebTableModel.java | 25 +- .../apache/struts2/views/jsp/ActionTag.java | 41 +- .../org/apache/struts2/views/jsp/BeanTag.java | 31 +- .../views/jsp/ComponentTagSupport.java | 25 +- .../org/apache/struts2/views/jsp/DateTag.java | 31 +- .../apache/struts2/views/jsp/ElseIfTag.java | 33 +- .../org/apache/struts2/views/jsp/ElseTag.java | 31 +- .../org/apache/struts2/views/jsp/I18nTag.java | 33 +- .../org/apache/struts2/views/jsp/IfTag.java | 33 +- .../apache/struts2/views/jsp/IncludeTag.java | 33 +- .../struts2/views/jsp/IteratorStatus.java | 25 +- .../apache/struts2/views/jsp/IteratorTag.java | 35 +- .../apache/struts2/views/jsp/ParamTag.java | 33 +- .../apache/struts2/views/jsp/PropertyTag.java | 33 +- .../org/apache/struts2/views/jsp/PushTag.java | 33 +- .../org/apache/struts2/views/jsp/SetTag.java | 33 +- .../views/jsp/StrutsBodyTagSupport.java | 31 +- .../apache/struts2/views/jsp/TagUtils.java | 25 +- .../org/apache/struts2/views/jsp/TextTag.java | 33 +- .../org/apache/struts2/views/jsp/URLTag.java | 31 +- .../views/jsp/iterator/AppendIteratorTag.java | 35 +- .../jsp/iterator/IteratorGeneratorTag.java | 199 ++-- .../views/jsp/iterator/MergeIteratorTag.java | 33 +- .../views/jsp/iterator/SortIteratorTag.java | 63 +- .../views/jsp/iterator/SubsetIteratorTag.java | 219 ++-- .../views/jsp/ui/AbstractClosingTag.java | 25 +- .../views/jsp/ui/AbstractDoubleListTag.java | 367 +++--- .../struts2/views/jsp/ui/AbstractListTag.java | 25 +- .../views/jsp/ui/AbstractRequiredListTag.java | 37 +- .../struts2/views/jsp/ui/AbstractUITag.java | 43 +- .../struts2/views/jsp/ui/ActionErrorTag.java | 35 +- .../views/jsp/ui/ActionMessageTag.java | 35 +- .../struts2/views/jsp/ui/AnchorTag.java | 35 +- .../struts2/views/jsp/ui/CheckboxListTag.java | 31 +- .../struts2/views/jsp/ui/CheckboxTag.java | 33 +- .../struts2/views/jsp/ui/ComboBoxTag.java | 73 +- .../struts2/views/jsp/ui/ComponentTag.java | 31 +- .../struts2/views/jsp/ui/DatePickerTag.java | 43 +- .../apache/struts2/views/jsp/ui/DivTag.java | 33 +- .../struts2/views/jsp/ui/DoubleSelectTag.java | 33 +- .../struts2/views/jsp/ui/FieldErrorTag.java | 33 +- .../apache/struts2/views/jsp/ui/FileTag.java | 33 +- .../apache/struts2/views/jsp/ui/FormTag.java | 33 +- .../apache/struts2/views/jsp/ui/HeadTag.java | 35 +- .../struts2/views/jsp/ui/HiddenTag.java | 31 +- .../apache/struts2/views/jsp/ui/LabelTag.java | 33 +- .../apache/struts2/views/jsp/ui/OgnlTool.java | 25 +- .../struts2/views/jsp/ui/OptGroupTag.java | 105 +- .../views/jsp/ui/OptionTransferSelectTag.java | 327 +++--- .../apache/struts2/views/jsp/ui/PanelTag.java | 33 +- .../struts2/views/jsp/ui/PasswordTag.java | 33 +- .../apache/struts2/views/jsp/ui/RadioTag.java | 31 +- .../apache/struts2/views/jsp/ui/ResetTag.java | 33 +- .../struts2/views/jsp/ui/SelectTag.java | 33 +- .../struts2/views/jsp/ui/SubmitTag.java | 33 +- .../struts2/views/jsp/ui/TabbedPanelTag.java | 31 +- .../struts2/views/jsp/ui/TextFieldTag.java | 31 +- .../struts2/views/jsp/ui/TextareaTag.java | 33 +- .../struts2/views/jsp/ui/TimePickerTag.java | 79 +- .../apache/struts2/views/jsp/ui/TokenTag.java | 31 +- .../struts2/views/jsp/ui/TreeNodeTag.java | 33 +- .../apache/struts2/views/jsp/ui/TreeTag.java | 307 ++--- .../struts2/views/jsp/ui/UpDownSelectTag.java | 197 ++-- .../views/jsp/ui/table/WebTableTag.java | 31 +- .../struts2/views/util/ContextUtil.java | 29 +- .../struts2/views/util/ResourceUtil.java | 33 +- .../apache/struts2/views/util/UrlHelper.java | 118 +- .../views/velocity/StrutsResourceLoader.java | 25 +- .../views/velocity/StrutsVelocityContext.java | 25 +- .../views/velocity/StrutsVelocityServlet.java | 25 +- .../views/velocity/VelocityManager.java | 71 +- .../components/AbstractDirective.java | 25 +- .../velocity/components/ActionDirective.java | 25 +- .../components/ActionErrorDirective.java | 25 +- .../components/ActionMessageDirective.java | 25 +- .../velocity/components/AnchorDirective.java | 25 +- .../velocity/components/BeanDirective.java | 25 +- .../components/CheckBoxDirective.java | 25 +- .../components/CheckBoxListDirective.java | 25 +- .../components/ComboBoxDirective.java | 25 +- .../components/ComponentDirective.java | 25 +- .../velocity/components/DateDirective.java | 25 +- .../components/DatePickerDirective.java | 25 +- .../velocity/components/DivDirective.java | 25 +- .../components/DoubleSelectDirective.java | 25 +- .../components/FieldErrorDirective.java | 25 +- .../velocity/components/FileDirective.java | 25 +- .../velocity/components/FormDirective.java | 25 +- .../velocity/components/HeadDirective.java | 25 +- .../velocity/components/HiddenDirective.java | 25 +- .../velocity/components/I18nDirective.java | 25 +- .../velocity/components/IncludeDirective.java | 25 +- .../velocity/components/LabelDirective.java | 25 +- .../components/OptGroupDirective.java | 37 +- .../OptionTransferSelectDirective.java | 37 +- .../velocity/components/PanelDirective.java | 25 +- .../velocity/components/ParamDirective.java | 25 +- .../components/PasswordDirective.java | 25 +- .../components/PropertyDirective.java | 25 +- .../velocity/components/PushDirective.java | 25 +- .../velocity/components/RadioDirective.java | 25 +- .../velocity/components/ResetDirective.java | 25 +- .../velocity/components/SelectDirective.java | 25 +- .../velocity/components/SetDirective.java | 25 +- .../velocity/components/SubmitDirective.java | 25 +- .../components/TabbedPanelDirective.java | 25 +- .../components/TextAreaDirective.java | 25 +- .../velocity/components/TextDirective.java | 25 +- .../components/TextFieldDirective.java | 25 +- .../velocity/components/TokenDirective.java | 25 +- .../velocity/components/TreeDirective.java | 25 +- .../components/TreeNodeDirective.java | 25 +- .../velocity/components/URLDirective.java | 25 +- .../components/UpDownSelectDirective.java | 39 +- .../components/WebTableDirective.java | 25 +- .../views/xslt/AbstractAdapterElement.java | 25 +- .../views/xslt/AbstractAdapterNode.java | 25 +- .../struts2/views/xslt/AdapterFactory.java | 27 +- .../struts2/views/xslt/AdapterNode.java | 25 +- .../struts2/views/xslt/ArrayAdapter.java | 25 +- .../struts2/views/xslt/BeanAdapter.java | 29 +- .../struts2/views/xslt/CollectionAdapter.java | 29 +- .../apache/struts2/views/xslt/MapAdapter.java | 39 +- .../struts2/views/xslt/ProxyAttrAdapter.java | 25 +- .../views/xslt/ProxyElementAdapter.java | 25 +- .../struts2/views/xslt/ProxyNamedNodeMap.java | 25 +- .../struts2/views/xslt/ProxyNodeAdapter.java | 29 +- .../views/xslt/ProxyTextNodeAdapter.java | 25 +- .../views/xslt/ServletURIResolver.java | 25 +- .../views/xslt/SimpleAdapterDocument.java | 25 +- .../struts2/views/xslt/SimpleNodeList.java | 25 +- .../struts2/views/xslt/SimpleTextNode.java | 27 +- .../struts2/views/xslt/StringAdapter.java | 25 +- .../apache/struts2/views/xslt/XSLTResult.java | 41 +- .../struts2/ExecutionCountTestAction.java | 29 +- .../org/apache/struts2/RequestUtilsTest.java | 25 +- .../struts2/ServletActionContextTest.java | 25 +- .../java/org/apache/struts2/TestAction.java | 49 +- .../apache/struts2/TestActionTagResult.java | 53 +- .../struts2/TestConfigurationProvider.java | 25 +- .../java/org/apache/struts2/TestResult.java | 29 +- .../struts2/components/ComponentTest.java | 919 +++++++-------- .../struts2/components/FormButtonTest.java | 205 ++-- .../apache/struts2/components/FormTest.java | 25 +- .../struts2/components/PropertyTest.java | 59 +- .../apache/struts2/components/UIBeanTest.java | 91 +- .../struts2/components/UIComponentTest.java | 27 +- .../template/BaseTemplateEngineTest.java | 125 +- .../ClasspathConfigurationProviderTest.java | 39 +- .../struts2/config/CustomNamespaceAction.java | 27 +- .../config/CustomParentPackageAction.java | 27 +- .../apache/struts2/config/SettingsTest.java | 31 +- .../apache/struts2/config/TestSettings.java | 25 +- .../config/cltest/OneResultAction.java | 27 +- .../config/cltest/TwoResultAction.java | 27 +- .../dispatcher/ActionContextCleanUpTest.java | 347 +++--- .../struts2/dispatcher/DispatcherTest.java | 107 +- .../dispatcher/FilterDispatcherTest.java | 275 ++--- .../apache/struts2/dispatcher/FilterTest.java | 613 +++++----- .../dispatcher/HttpHeaderResultTest.java | 25 +- .../struts2/dispatcher/NullActionMapper.java | 53 +- .../dispatcher/PlainTextResultTest.java | 249 ++-- .../ServletActionRedirectResultTest.java | 259 ++--- ...ervletDispatchedTestAssertInterceptor.java | 31 +- .../ServletDispatcherResultTest.java | 25 +- .../dispatcher/ServletRedirectResultTest.java | 27 +- .../struts2/dispatcher/SessionMapTest.java | 81 +- .../struts2/dispatcher/StreamResultTest.java | 45 +- .../dispatcher/StrutsResultSupportTest.java | 199 ++-- .../dispatcher/VelocityResultTest.java | 35 +- .../mapper/CompositeActionMapperTest.java | 641 +++++------ .../mapper/DefaultActionMapperTest.java | 49 +- .../mapper/Restful2ActionMapperTest.java | 27 +- .../mapper/RestfulActionMapperTest.java | 25 +- .../org/apache/struts2/impl/MessagesTest.java | 20 + .../struts2/impl/RequestContextTest.java | 20 + .../CreateSessionInterceptorTest.java | 45 +- .../ExecuteAndWaitDelayAction.java | 25 +- .../ExecuteAndWaitInterceptorTest.java | 25 +- .../FileUploadInterceptorTest.java | 31 +- .../MessageStoreInterceptorTest.java | 431 +++---- .../interceptor/RolesInterceptorTest.java | 51 +- .../ServletConfigInterceptorTest.java | 25 +- .../StrutsConversionErrorInterceptorTest.java | 25 +- .../interceptor/TokenInterceptorTest.java | 25 +- .../TokenSessionStoreInterceptorTest.java | 25 +- .../portlet/PortletApplicationMapTest.java | 27 +- .../portlet/PortletRequestMapTest.java | 73 +- .../portlet/PortletSessionMapTest.java | 85 +- .../context/PortletActionContextTest.java | 73 +- .../context/PreparatorServletTest.java | 37 +- .../ServletContextHolderListenerTest.java | 27 +- .../dispatcher/Jsr168DispatcherTest.java | 121 +- .../portlet/result/PortletResultTest.java | 109 +- .../portlet/util/PortletUrlHelperTest.java | 25 +- .../struts2/portlet/util/StrutsUtilTest.java | 417 +++---- .../spring/StrutsSpringObjectFactoryTest.java | 27 +- .../apache/struts2/util/ContainUtilTest.java | 195 ++-- .../org/apache/struts2/util/CounterTest.java | 25 +- .../util/InvocationSessionStoreTest.java | 25 +- .../apache/struts2/util/PrefixTrieTest.java | 27 +- .../struts2/util/StrutsTypeConverterTest.java | 171 +-- .../apache/struts2/util/TokenHelperTest.java | 25 +- .../views/TemplateEngineManagerTest.java | 25 +- .../freemarker/FreemarkerManagerTest.java | 45 +- .../views/freemarker/FreemarkerTest.java | 25 +- .../struts2/views/freemarker/TestAction.java | 27 +- .../struts2/views/freemarker/TestBean.java | 25 +- .../struts2/views/jsp/AbstractTagTest.java | 25 +- .../struts2/views/jsp/AbstractUITagTest.java | 25 +- .../struts2/views/jsp/ActionTagTest.java | 25 +- .../struts2/views/jsp/AnchorTagTest.java | 25 +- .../views/jsp/AppendIteratorTagTest.java | 311 ++--- .../apache/struts2/views/jsp/BeanTagTest.java | 27 +- .../struts2/views/jsp/ElseIfTagTest.java | 181 +-- .../apache/struts2/views/jsp/ElseTagTest.java | 35 +- .../apache/struts2/views/jsp/IfTagTest.java | 329 +++--- .../struts2/views/jsp/IncludeTagTest.java | 25 +- .../views/jsp/IteratorGeneratorTagTest.java | 371 +++--- .../struts2/views/jsp/IteratorTagTest.java | 147 +-- .../views/jsp/MergeIteratorTagTest.java | 315 +++--- .../struts2/views/jsp/PortletUrlTagTest.java | 559 ++++----- .../struts2/views/jsp/PropertyTagTest.java | 27 +- .../apache/struts2/views/jsp/PushTagTest.java | 25 +- .../apache/struts2/views/jsp/SetTagTest.java | 25 +- .../views/jsp/SortIteratorTagTest.java | 37 +- .../views/jsp/StrutsMockBodyContent.java | 25 +- .../jsp/StrutsMockHttpServletRequest.java | 25 +- .../jsp/StrutsMockHttpServletResponse.java | 39 +- .../views/jsp/StrutsMockHttpSession.java | 25 +- .../views/jsp/StrutsMockJspWriter.java | 25 +- .../views/jsp/StrutsMockPageContext.java | 25 +- .../views/jsp/StrutsMockServletContext.java | 35 +- .../views/jsp/SubsetIteratorTagTest.java | 505 +++++---- .../apache/struts2/views/jsp/TextTagTest.java | 53 +- .../apache/struts2/views/jsp/URLTagTest.java | 397 +++---- .../views/jsp/ui/ActionErrorTagTest.java | 141 +-- .../views/jsp/ui/ActionMessageTagTest.java | 143 +-- .../struts2/views/jsp/ui/AnchorTest.java | 25 +- .../apache/struts2/views/jsp/ui/Category.java | 27 +- .../views/jsp/ui/CheckboxListTest.java | 25 +- .../struts2/views/jsp/ui/CheckboxTest.java | 25 +- .../struts2/views/jsp/ui/ComboBoxTest.java | 125 +- .../struts2/views/jsp/ui/ComponentTest.java | 71 +- .../views/jsp/ui/DatePickerTagTest.java | 29 +- .../struts2/views/jsp/ui/DateTagTest.java | 25 +- .../apache/struts2/views/jsp/ui/DivTest.java | 25 +- .../views/jsp/ui/DoubleSelectTest.java | 43 +- .../views/jsp/ui/FieldErrorTagTest.java | 433 +++---- .../apache/struts2/views/jsp/ui/FileTest.java | 25 +- .../struts2/views/jsp/ui/FormTagTest.java | 25 +- .../struts2/views/jsp/ui/HeadTagTest.java | 27 +- .../struts2/views/jsp/ui/HiddenTest.java | 25 +- .../struts2/views/jsp/ui/JspTemplateTest.java | 25 +- .../struts2/views/jsp/ui/LabelTest.java | 25 +- .../apache/struts2/views/jsp/ui/MockTag.java | 31 +- .../struts2/views/jsp/ui/OptGroupTest.java | 215 ++-- .../jsp/ui/OptionTransferSelectTagTest.java | 1005 +++++++++-------- .../struts2/views/jsp/ui/PasswordTest.java | 25 +- .../struts2/views/jsp/ui/RadioTest.java | 69 +- .../struts2/views/jsp/ui/ResetTest.java | 25 +- .../struts2/views/jsp/ui/SelectTest.java | 183 +-- .../views/jsp/ui/StrutsBodyContent.java | 25 +- .../struts2/views/jsp/ui/SubmitAjaxTest.java | 29 +- .../struts2/views/jsp/ui/SubmitTest.java | 25 +- .../struts2/views/jsp/ui/TestAction1.java | 27 +- .../struts2/views/jsp/ui/TextareaTest.java | 25 +- .../struts2/views/jsp/ui/TextfieldTest.java | 25 +- .../struts2/views/jsp/ui/TokenTagTest.java | 25 +- .../struts2/views/jsp/ui/TooltipTest.java | 37 +- .../apache/struts2/views/jsp/ui/TreeTest.java | 233 ++-- .../views/jsp/ui/UpDownSelectTagTest.java | 455 ++++---- .../org/apache/struts2/views/jsp/ui/User.java | 25 +- .../struts2/views/util/ContextUtilTest.java | 75 +- .../struts2/views/util/ResourceUtilTest.java | 25 +- .../struts2/views/util/TextUtilTest.java | 29 +- .../struts2/views/util/UrlHelperTest.java | 199 ++-- .../struts2/views/xslt/XSLTResultTest.java | 25 +- .../config_browser/ActionNamesAction.java | 33 +- .../config_browser/ConfigurationHelper.java | 25 +- .../config_browser/ListValidatorsAction.java | 33 +- .../config_browser/ShowConfigAction.java | 31 +- .../config_browser/ShowValidatorAction.java | 25 +- .../views/jasperreports/CompileReport.java | 25 +- .../jasperreports/JasperReportConstants.java | 25 +- .../jasperreports/JasperReportsResult.java | 47 +- .../jasperreports/ValueStackDataSource.java | 25 +- .../jasperreports/ValueStackShadowMap.java | 29 +- .../struts2/dispatcher/ChartResult.java | 41 +- .../struts2/dispatcher/ChartResultTest.java | 25 +- .../jsf/ApplyRequestValuesInterceptor.java | 27 +- .../apache/struts2/jsf/FacesInterceptor.java | 31 +- .../org/apache/struts2/jsf/FacesRender.java | 29 +- .../org/apache/struts2/jsf/FacesResult.java | 35 +- .../struts2/jsf/FacesSetupInterceptor.java | 59 +- .../org/apache/struts2/jsf/FacesSupport.java | 253 +++-- .../jsf/InvokeApplicationInterceptor.java | 27 +- .../jsf/ProcessValidationsInterceptor.java | 97 +- .../struts2/jsf/RestoreViewInterceptor.java | 31 +- .../struts2/jsf/StrutsNavigationHandler.java | 57 +- .../struts2/jsf/StrutsVariableResolver.java | 31 +- .../jsf/UpdateModelValuesInterceptor.java | 27 +- .../multipart/PellMultiPartRequest.java | 25 +- .../apache/struts2/plexus/PlexusFilter.java | 25 +- .../plexus/PlexusLifecycleListener.java | 25 +- .../struts2/plexus/PlexusObjectFactory.java | 29 +- .../struts2/plexus/PlexusThreadLocal.java | 25 +- .../apache/struts2/plexus/PlexusUtils.java | 27 +- .../main/java/org/apache/struts2/Main.java | 25 +- .../struts2/quickstart/Configuration.java | 29 +- .../struts2/quickstart/JettyServer.java | 25 +- .../apache/struts2/quickstart/Mapping.java | 25 +- .../quickstart/MultiDirClassLoader.java | 25 +- .../struts2/quickstart/MultiDirResource.java | 33 +- .../MultiWebApplicationContext.java | 29 +- .../apache/struts2/quickstart/QuickStart.java | 25 +- .../main/java/org/apache/struts2/Main.java | 25 +- .../sitegraph/entities/FileBasedView.java | 29 +- .../struts2/sitegraph/entities/JspView.java | 25 +- .../struts2/sitegraph/entities/Target.java | 25 +- .../sitegraph/entities/VelocityView.java | 25 +- .../struts2/sitegraph/entities/View.java | 25 +- .../struts2/sitegraph/model/ActionNode.java | 25 +- .../apache/struts2/sitegraph/model/Graph.java | 25 +- .../struts2/sitegraph/model/IndentWriter.java | 25 +- .../apache/struts2/sitegraph/model/Link.java | 25 +- .../struts2/sitegraph/model/Render.java | 25 +- .../sitegraph/model/SiteGraphNode.java | 25 +- .../struts2/sitegraph/model/SubGraph.java | 25 +- .../struts2/sitegraph/model/ViewNode.java | 25 +- .../sitegraph/renderers/DOTRenderer.java | 25 +- .../struts2/sitegraph/SiteGraphTest.java | 27 +- .../sitemesh/FreeMarkerPageFilter.java | 49 +- .../struts2/sitemesh/TemplatePageFilter.java | 47 +- .../struts2/sitemesh/VelocityPageFilter.java | 29 +- .../struts2/tiles/StrutsTilesListener.java | 27 +- .../struts2/tiles/StrutsTilesUtilImpl.java | 29 +- .../struts2/views/tiles/TilesResult.java | 37 +- 729 files changed, 23440 insertions(+), 20684 deletions(-) create mode 100644 apps/blank/LICENSE.txt create mode 100644 apps/blank/NOTICE.txt delete mode 100644 apps/showcase/src/main/java/org/apache/struts2/showcase/tutorial/HelloName.java delete mode 100644 apps/showcase/src/main/java/org/apache/struts2/showcase/tutorial/HelloName2.java delete mode 100644 apps/showcase/src/main/java/org/apache/struts2/showcase/tutorial/HelloWorld.java diff --git a/apps/blank/LICENSE.txt b/apps/blank/LICENSE.txt new file mode 100644 index 000000000..c6055ec8f --- /dev/null +++ b/apps/blank/LICENSE.txt @@ -0,0 +1,174 @@ + Apache License + Version 2.0, January 2004 + http://www.apache.org/licenses/ + + TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION + + 1. Definitions. + + "License" shall mean the terms and conditions for use, reproduction, + and distribution as defined by Sections 1 through 9 of this document. + + "Licensor" shall mean the copyright owner or entity authorized by + the copyright owner that is granting the License. + + "Legal Entity" shall mean the union of the acting entity and all + other entities that control, are controlled by, or are under common + control with that entity. For the purposes of this definition, + "control" means (i) the power, direct or indirect, to cause the + direction or management of such entity, whether by contract or + otherwise, or (ii) ownership of fifty percent (50%) or more of the + outstanding shares, or (iii) beneficial ownership of such entity. + + "You" (or "Your") shall mean an individual or Legal Entity + exercising permissions granted by this License. + + "Source" form shall mean the preferred form for making modifications, + including but not limited to software source code, documentation + source, and configuration files. + + "Object" form shall mean any form resulting from mechanical + transformation or translation of a Source form, including but + not limited to compiled object code, generated documentation, + and conversions to other media types. + + "Work" shall mean the work of authorship, whether in Source or + Object form, made available under the License, as indicated by a + copyright notice that is included in or attached to the work + (an example is provided in the Appendix below). + + "Derivative Works" shall mean any work, whether in Source or Object + form, that is based on (or derived from) the Work and for which the + editorial revisions, annotations, elaborations, or other modifications + represent, as a whole, an original work of authorship. For the purposes + of this License, Derivative Works shall not include works that remain + separable from, or merely link (or bind by name) to the interfaces of, + the Work and Derivative Works thereof. + + "Contribution" shall mean any work of authorship, including + the original version of the Work and any modifications or additions + to that Work or Derivative Works thereof, that is intentionally + submitted to Licensor for inclusion in the Work by the copyright owner + or by an individual or Legal Entity authorized to submit on behalf of + the copyright owner. For the purposes of this definition, "submitted" + means any form of electronic, verbal, or written communication sent + to the Licensor or its representatives, including but not limited to + communication on electronic mailing lists, source code control systems, + and issue tracking systems that are managed by, or on behalf of, the + Licensor for the purpose of discussing and improving the Work, but + excluding communication that is conspicuously marked or otherwise + designated in writing by the copyright owner as "Not a Contribution." + + "Contributor" shall mean Licensor and any individual or Legal Entity + on behalf of whom a Contribution has been received by Licensor and + subsequently incorporated within the Work. + + 2. Grant of Copyright License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + copyright license to reproduce, prepare Derivative Works of, + publicly display, publicly perform, sublicense, and distribute the + Work and such Derivative Works in Source or Object form. + + 3. Grant of Patent License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + (except as stated in this section) patent license to make, have made, + use, offer to sell, sell, import, and otherwise transfer the Work, + where such license applies only to those patent claims licensable + by such Contributor that are necessarily infringed by their + Contribution(s) alone or by combination of their Contribution(s) + with the Work to which such Contribution(s) was submitted. If You + institute patent litigation against any entity (including a + cross-claim or counterclaim in a lawsuit) alleging that the Work + or a Contribution incorporated within the Work constitutes direct + or contributory patent infringement, then any patent licenses + granted to You under this License for that Work shall terminate + as of the date such litigation is filed. + + 4. Redistribution. You may reproduce and distribute copies of the + Work or Derivative Works thereof in any medium, with or without + modifications, and in Source or Object form, provided that You + meet the following conditions: + + (a) You must give any other recipients of the Work or + Derivative Works a copy of this License; and + + (b) You must cause any modified files to carry prominent notices + stating that You changed the files; and + + (c) You must retain, in the Source form of any Derivative Works + that You distribute, all copyright, patent, trademark, and + attribution notices from the Source form of the Work, + excluding those notices that do not pertain to any part of + the Derivative Works; and + + (d) If the Work includes a "NOTICE" text file as part of its + distribution, then any Derivative Works that You distribute must + include a readable copy of the attribution notices contained + within such NOTICE file, excluding those notices that do not + pertain to any part of the Derivative Works, in at least one + of the following places: within a NOTICE text file distributed + as part of the Derivative Works; within the Source form or + documentation, if provided along with the Derivative Works; or, + within a display generated by the Derivative Works, if and + wherever such third-party notices normally appear. The contents + of the NOTICE file are for informational purposes only and + do not modify the License. You may add Your own attribution + notices within Derivative Works that You distribute, alongside + or as an addendum to the NOTICE text from the Work, provided + that such additional attribution notices cannot be construed + as modifying the License. + + You may add Your own copyright statement to Your modifications and + may provide additional or different license terms and conditions + for use, reproduction, or distribution of Your modifications, or + for any such Derivative Works as a whole, provided Your use, + reproduction, and distribution of the Work otherwise complies with + the conditions stated in this License. + + 5. Submission of Contributions. Unless You explicitly state otherwise, + any Contribution intentionally submitted for inclusion in the Work + by You to the Licensor shall be under the terms and conditions of + this License, without any additional terms or conditions. + Notwithstanding the above, nothing herein shall supersede or modify + the terms of any separate license agreement you may have executed + with Licensor regarding such Contributions. + + 6. Trademarks. This License does not grant permission to use the trade + names, trademarks, service marks, or product names of the Licensor, + except as required for reasonable and customary use in describing the + origin of the Work and reproducing the content of the NOTICE file. + + 7. Disclaimer of Warranty. Unless required by applicable law or + agreed to in writing, Licensor provides the Work (and each + Contributor provides its Contributions) on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or + implied, including, without limitation, any warranties or conditions + of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A + PARTICULAR PURPOSE. You are solely responsible for determining the + appropriateness of using or redistributing the Work and assume any + risks associated with Your exercise of permissions under this License. + + 8. Limitation of Liability. In no event and under no legal theory, + whether in tort (including negligence), contract, or otherwise, + unless required by applicable law (such as deliberate and grossly + negligent acts) or agreed to in writing, shall any Contributor be + liable to You for damages, including any direct, indirect, special, + incidental, or consequential damages of any character arising as a + result of this License or out of the use or inability to use the + Work (including but not limited to damages for loss of goodwill, + work stoppage, computer failure or malfunction, or any and all + other commercial damages or losses), even if such Contributor + has been advised of the possibility of such damages. + + 9. Accepting Warranty or Additional Liability. While redistributing + the Work or Derivative Works thereof, You may choose to offer, + and charge a fee for, acceptance of support, warranty, indemnity, + or other liability obligations and/or rights consistent with this + License. However, in accepting such obligations, You may act only + on Your own behalf and on Your sole responsibility, not on behalf + of any other Contributor, and only if You agree to indemnify, + defend, and hold each Contributor harmless for any liability + incurred by, or claims asserted against, such Contributor by reason + of your accepting any such warranty or additional liability. diff --git a/apps/blank/NOTICE.txt b/apps/blank/NOTICE.txt new file mode 100644 index 000000000..5c3c04fc8 --- /dev/null +++ b/apps/blank/NOTICE.txt @@ -0,0 +1,6 @@ +Apache Struts + +Copyright 2006 The Apache Software Foundation + +This product includes software developed at +The Apache Software Foundation (http://www.apache.org/ diff --git a/apps/blank/src/main/java/example/ExampleSupport.java b/apps/blank/src/main/java/example/ExampleSupport.java index c86b1fc25..554509a0e 100644 --- a/apps/blank/src/main/java/example/ExampleSupport.java +++ b/apps/blank/src/main/java/example/ExampleSupport.java @@ -1,3 +1,24 @@ +/* + * $Id$ + * + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + package example; import com.opensymphony.xwork2.ActionSupport; diff --git a/apps/blank/src/main/java/example/HelloWorld.java b/apps/blank/src/main/java/example/HelloWorld.java index 68f8e7202..d5268ca45 100644 --- a/apps/blank/src/main/java/example/HelloWorld.java +++ b/apps/blank/src/main/java/example/HelloWorld.java @@ -1,3 +1,24 @@ +/* + * $Id$ + * + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + package example; /** diff --git a/apps/blank/src/main/java/example/Login.java b/apps/blank/src/main/java/example/Login.java index a4e6804e5..d425488b9 100644 --- a/apps/blank/src/main/java/example/Login.java +++ b/apps/blank/src/main/java/example/Login.java @@ -1,3 +1,24 @@ +/* + * $Id$ + * + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + package example; public class Login extends ExampleSupport { diff --git a/apps/blank/src/test/java/example/ConfigTest.java b/apps/blank/src/test/java/example/ConfigTest.java index 9b23765d3..d70aa4e7d 100644 --- a/apps/blank/src/test/java/example/ConfigTest.java +++ b/apps/blank/src/test/java/example/ConfigTest.java @@ -1,3 +1,24 @@ +/* + * $Id$ + * + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + package example; import com.opensymphony.xwork2.ActionSupport; diff --git a/apps/blank/src/test/java/example/HelloWorldTest.java b/apps/blank/src/test/java/example/HelloWorldTest.java index 6933c32df..9239a706e 100644 --- a/apps/blank/src/test/java/example/HelloWorldTest.java +++ b/apps/blank/src/test/java/example/HelloWorldTest.java @@ -1,3 +1,24 @@ +/* + * $Id$ + * + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + package example; import com.opensymphony.xwork2.ActionSupport; diff --git a/apps/blank/src/test/java/example/LoginTest.java b/apps/blank/src/test/java/example/LoginTest.java index 3c516e1f0..72b761dac 100644 --- a/apps/blank/src/test/java/example/LoginTest.java +++ b/apps/blank/src/test/java/example/LoginTest.java @@ -1,3 +1,24 @@ +/* + * $Id$ + * + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + package example; import com.opensymphony.xwork2.ActionSupport; diff --git a/apps/mailreader/src/main/java/mailreader2/ApplicationListener.java b/apps/mailreader/src/main/java/mailreader2/ApplicationListener.java index 4570cc43a..fabd98d6e 100644 --- a/apps/mailreader/src/main/java/mailreader2/ApplicationListener.java +++ b/apps/mailreader/src/main/java/mailreader2/ApplicationListener.java @@ -1,19 +1,22 @@ /* - * Copyright 1999-2002,2004 The Apache Software Foundation. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * * $Id$ + * + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. */ package mailreader2; diff --git a/apps/mailreader/src/main/java/mailreader2/Constants.java b/apps/mailreader/src/main/java/mailreader2/Constants.java index 81733bd94..f33b771dd 100644 --- a/apps/mailreader/src/main/java/mailreader2/Constants.java +++ b/apps/mailreader/src/main/java/mailreader2/Constants.java @@ -1,19 +1,22 @@ /* * $Id$ * - * Copyright 1999-2004 The Apache Software Foundation. + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at + * http://www.apache.org/licenses/LICENSE-2.0 * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. */ package mailreader2; @@ -73,7 +76,7 @@ public final class Constants { */ public static final String HOST = "host"; - + // ---- Error Messages ---- /** diff --git a/apps/mailreader/src/main/java/mailreader2/Login.java b/apps/mailreader/src/main/java/mailreader2/Login.java index 7de355718..0efa19b10 100644 --- a/apps/mailreader/src/main/java/mailreader2/Login.java +++ b/apps/mailreader/src/main/java/mailreader2/Login.java @@ -1,19 +1,22 @@ /* * $Id$ * - * Copyright 2000-2004 Apache Software Foundation + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at + * http://www.apache.org/licenses/LICENSE-2.0 * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. */ package mailreader2; diff --git a/apps/mailreader/src/main/java/mailreader2/Logout.java b/apps/mailreader/src/main/java/mailreader2/Logout.java index 1d079aebb..20732966a 100644 --- a/apps/mailreader/src/main/java/mailreader2/Logout.java +++ b/apps/mailreader/src/main/java/mailreader2/Logout.java @@ -1,19 +1,22 @@ /* * $Id$ * - * Copyright 2000-2004 Apache Software Foundation + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at + * http://www.apache.org/licenses/LICENSE-2.0 * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. */ package mailreader2; diff --git a/apps/mailreader/src/main/java/mailreader2/MailreaderSupport.java b/apps/mailreader/src/main/java/mailreader2/MailreaderSupport.java index f93aeebcb..1886d0214 100644 --- a/apps/mailreader/src/main/java/mailreader2/MailreaderSupport.java +++ b/apps/mailreader/src/main/java/mailreader2/MailreaderSupport.java @@ -1,19 +1,22 @@ /* * $Id$ * - * Copyright 1999-2004 The Apache Software Foundation. + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at + * http://www.apache.org/licenses/LICENSE-2.0 * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. */ package mailreader2; diff --git a/apps/mailreader/src/main/java/mailreader2/Registration.java b/apps/mailreader/src/main/java/mailreader2/Registration.java index e87fdf2c5..635fc0d59 100644 --- a/apps/mailreader/src/main/java/mailreader2/Registration.java +++ b/apps/mailreader/src/main/java/mailreader2/Registration.java @@ -1,3 +1,24 @@ +/* + * $Id$ + * + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + package mailreader2; import org.apache.struts.apps.mailreader.dao.User; diff --git a/apps/mailreader/src/main/java/mailreader2/Subscription.java b/apps/mailreader/src/main/java/mailreader2/Subscription.java index a3f32edd3..a495986bc 100644 --- a/apps/mailreader/src/main/java/mailreader2/Subscription.java +++ b/apps/mailreader/src/main/java/mailreader2/Subscription.java @@ -1,3 +1,24 @@ +/* + * $Id$ + * + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + package mailreader2; import com.opensymphony.xwork2.Preparable; @@ -116,7 +137,7 @@ public class Subscription extends MailreaderSupport } if (hasErrors()) return INPUT; - + saveUser(); return SUCCESS; } diff --git a/apps/mailreader/src/main/java/mailreader2/Welcome.java b/apps/mailreader/src/main/java/mailreader2/Welcome.java index 08ec12581..e43d6c463 100644 --- a/apps/mailreader/src/main/java/mailreader2/Welcome.java +++ b/apps/mailreader/src/main/java/mailreader2/Welcome.java @@ -1,3 +1,24 @@ +/* + * $Id$ + * + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + package mailreader2; /** diff --git a/apps/portlet/src/main/java/org/apache/struts2/portlet/example/ExampleAction.java b/apps/portlet/src/main/java/org/apache/struts2/portlet/example/ExampleAction.java index 93bf68ca6..d3e0741b2 100644 --- a/apps/portlet/src/main/java/org/apache/struts2/portlet/example/ExampleAction.java +++ b/apps/portlet/src/main/java/org/apache/struts2/portlet/example/ExampleAction.java @@ -1,19 +1,22 @@ /* * $Id$ * - * Copyright 2006 The Apache Software Foundation. + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at + * http://www.apache.org/licenses/LICENSE-2.0 * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. */ package org.apache.struts2.portlet.example; @@ -23,13 +26,13 @@ import com.opensymphony.xwork2.ActionContext; import com.opensymphony.xwork2.ActionSupport; public class ExampleAction extends ActionSupport { - + private String name = "PortletWork Example"; - + public String getName() { return name; } - + public Map getRenderParameters() { return ActionContext.getContext().getParameters(); } diff --git a/apps/portlet/src/main/java/org/apache/struts2/portlet/example/FormExample.java b/apps/portlet/src/main/java/org/apache/struts2/portlet/example/FormExample.java index 694eb12c4..4a5360a1b 100644 --- a/apps/portlet/src/main/java/org/apache/struts2/portlet/example/FormExample.java +++ b/apps/portlet/src/main/java/org/apache/struts2/portlet/example/FormExample.java @@ -1,19 +1,22 @@ /* * $Id$ * - * Copyright 2006 The Apache Software Foundation. + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at + * http://www.apache.org/licenses/LICENSE-2.0 * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. */ package org.apache.struts2.portlet.example; @@ -22,7 +25,7 @@ import com.opensymphony.xwork2.ActionSupport; /** */ public class FormExample extends ActionSupport { - + String firstName = null; String lastName = null; public String execute() throws Exception { diff --git a/apps/portlet/src/main/java/org/apache/struts2/portlet/example/FormExampleWithValidation.java b/apps/portlet/src/main/java/org/apache/struts2/portlet/example/FormExampleWithValidation.java index ec14710f7..a26609c13 100644 --- a/apps/portlet/src/main/java/org/apache/struts2/portlet/example/FormExampleWithValidation.java +++ b/apps/portlet/src/main/java/org/apache/struts2/portlet/example/FormExampleWithValidation.java @@ -1,19 +1,22 @@ /* * $Id$ * - * Copyright 2006 The Apache Software Foundation. + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at + * http://www.apache.org/licenses/LICENSE-2.0 * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. */ package org.apache.struts2.portlet.example; @@ -24,11 +27,11 @@ import com.opensymphony.xwork2.ActionSupport; public class FormExampleWithValidation extends ActionSupport { private String firstName = null; private String lastName = null; - + public String input() { return SUCCESS; } - + public String getFirstName() { return firstName; } diff --git a/apps/portlet/src/main/java/org/apache/struts2/portlet/example/FormResultAction.java b/apps/portlet/src/main/java/org/apache/struts2/portlet/example/FormResultAction.java index 4dc22714e..6e9aeae22 100644 --- a/apps/portlet/src/main/java/org/apache/struts2/portlet/example/FormResultAction.java +++ b/apps/portlet/src/main/java/org/apache/struts2/portlet/example/FormResultAction.java @@ -1,19 +1,22 @@ /* * $Id$ * - * Copyright 2006 The Apache Software Foundation. + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at + * http://www.apache.org/licenses/LICENSE-2.0 * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. */ package org.apache.struts2.portlet.example; @@ -30,14 +33,14 @@ import com.opensymphony.xwork2.ActionSupport; public class FormResultAction extends ActionSupport { private String result = null; - + public String getResult() { return result; } public void setResult(String result) { this.result = result; } - + public Collection getRenderParams() { RenderRequest req = PortletActionContext.getRenderRequest(); Map params = req.getParameterMap(); diff --git a/apps/portlet/src/main/java/org/apache/struts2/portlet/example/FormTestAction.java b/apps/portlet/src/main/java/org/apache/struts2/portlet/example/FormTestAction.java index b2dacde5a..ebbe102df 100644 --- a/apps/portlet/src/main/java/org/apache/struts2/portlet/example/FormTestAction.java +++ b/apps/portlet/src/main/java/org/apache/struts2/portlet/example/FormTestAction.java @@ -1,19 +1,22 @@ /* * $Id$ * - * Copyright 2006 The Apache Software Foundation. + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at + * http://www.apache.org/licenses/LICENSE-2.0 * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. */ package org.apache.struts2.portlet.example; diff --git a/apps/portlet/src/main/java/org/apache/struts2/portlet/example/SavePrefsAction.java b/apps/portlet/src/main/java/org/apache/struts2/portlet/example/SavePrefsAction.java index f9a5efae6..1998e3796 100644 --- a/apps/portlet/src/main/java/org/apache/struts2/portlet/example/SavePrefsAction.java +++ b/apps/portlet/src/main/java/org/apache/struts2/portlet/example/SavePrefsAction.java @@ -1,19 +1,22 @@ /* * $Id$ * - * Copyright 2006 The Apache Software Foundation. + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at + * http://www.apache.org/licenses/LICENSE-2.0 * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. */ package org.apache.struts2.portlet.example; @@ -40,7 +43,7 @@ public class SavePrefsAction extends ActionSupport { public void setPreferenceTwo(String preferenceTwo) { this.preferenceTwo = preferenceTwo; } - + public String execute() throws Exception { ActionRequest req = PortletActionContext.getActionRequest(); PortletPreferences prefs = req.getPreferences(); @@ -49,7 +52,7 @@ public class SavePrefsAction extends ActionSupport { prefs.store(); return SUCCESS; } - + public String showForm() throws Exception { PortletPreferences prefs = PortletActionContext.getRequest().getPreferences(); preferenceOne = prefs.getValue("preferenceOne", "not set"); diff --git a/apps/portlet/src/main/java/org/apache/struts2/portlet/example/spring/SpringAction.java b/apps/portlet/src/main/java/org/apache/struts2/portlet/example/spring/SpringAction.java index 78704a268..8688423d6 100644 --- a/apps/portlet/src/main/java/org/apache/struts2/portlet/example/spring/SpringAction.java +++ b/apps/portlet/src/main/java/org/apache/struts2/portlet/example/spring/SpringAction.java @@ -1,19 +1,22 @@ /* * $Id$ * - * Copyright 2006 The Apache Software Foundation. + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at + * http://www.apache.org/licenses/LICENSE-2.0 * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. */ package org.apache.struts2.portlet.example.spring; @@ -26,26 +29,26 @@ import com.opensymphony.xwork2.ActionSupport; /** */ public class SpringAction extends ActionSupport { - + private ThingManager thingManager = null; private String thing = null; - + public void setThingManager(ThingManager thingManager) { this.thingManager = thingManager; } - + public List getThings() { return thingManager.getThings(); } - + public String getThing() { return thing; } - + public void setThing(String thing) { this.thing = thing; } - + public String execute() { if(StringUtils.isNotEmpty(thing)) { thingManager.addThing(thing); diff --git a/apps/portlet/src/main/java/org/apache/struts2/portlet/example/spring/ThingManager.java b/apps/portlet/src/main/java/org/apache/struts2/portlet/example/spring/ThingManager.java index cbbb3b9f0..ba117a5a7 100644 --- a/apps/portlet/src/main/java/org/apache/struts2/portlet/example/spring/ThingManager.java +++ b/apps/portlet/src/main/java/org/apache/struts2/portlet/example/spring/ThingManager.java @@ -1,19 +1,22 @@ /* * $Id$ * - * Copyright 2006 The Apache Software Foundation. + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at + * http://www.apache.org/licenses/LICENSE-2.0 * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. */ package org.apache.struts2.portlet.example.spring; @@ -24,11 +27,11 @@ import java.util.List; */ public class ThingManager { private List things = new ArrayList(); - + public void addThing(String thing) { things.add(thing); } - + public List getThings() { return things; } diff --git a/apps/showcase/src/main/java/org/apache/struts2/showcase/DateAction.java b/apps/showcase/src/main/java/org/apache/struts2/showcase/DateAction.java index b7b172959..dab1a7b1c 100644 --- a/apps/showcase/src/main/java/org/apache/struts2/showcase/DateAction.java +++ b/apps/showcase/src/main/java/org/apache/struts2/showcase/DateAction.java @@ -1,19 +1,22 @@ /* * $Id$ * - * Copyright 2006 The Apache Software Foundation. + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at + * http://www.apache.org/licenses/LICENSE-2.0 * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. */ package org.apache.struts2.showcase; diff --git a/apps/showcase/src/main/java/org/apache/struts2/showcase/DynamicTreeSelectAction.java b/apps/showcase/src/main/java/org/apache/struts2/showcase/DynamicTreeSelectAction.java index 3fd80af93..5d22be5ef 100644 --- a/apps/showcase/src/main/java/org/apache/struts2/showcase/DynamicTreeSelectAction.java +++ b/apps/showcase/src/main/java/org/apache/struts2/showcase/DynamicTreeSelectAction.java @@ -1,3 +1,23 @@ +/* + * $Id$ + * + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ package org.apache.struts2.showcase; import org.apache.struts2.showcase.ajax.tree.Category; @@ -8,27 +28,27 @@ import com.opensymphony.xwork2.ActionSupport; public class DynamicTreeSelectAction extends ActionSupport { - private long nodeId; - private Category currentCategory; - - - public void setNodeId(long nodeId) { - this.nodeId = nodeId; - } - public long getNodeId() { - return nodeId; - } - - - public String execute() throws Exception { - currentCategory = Category.getById(nodeId); - return SUCCESS; - } - - - public String getNodeName() { - return currentCategory.getName(); - } + private long nodeId; + private Category currentCategory; + + + public void setNodeId(long nodeId) { + this.nodeId = nodeId; + } + public long getNodeId() { + return nodeId; + } + + + public String execute() throws Exception { + currentCategory = Category.getById(nodeId); + return SUCCESS; + } + + + public String getNodeName() { + return currentCategory.getName(); + } } //START SNIPPET: treeExampleDynamicJavaSelected diff --git a/apps/showcase/src/main/java/org/apache/struts2/showcase/Guess.java b/apps/showcase/src/main/java/org/apache/struts2/showcase/Guess.java index b74d2f3d4..0c0dd3284 100644 --- a/apps/showcase/src/main/java/org/apache/struts2/showcase/Guess.java +++ b/apps/showcase/src/main/java/org/apache/struts2/showcase/Guess.java @@ -1,19 +1,22 @@ /* * $Id$ * - * Copyright 2006 The Apache Software Foundation. + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at + * http://www.apache.org/licenses/LICENSE-2.0 * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. */ package org.apache.struts2.showcase; diff --git a/apps/showcase/src/main/java/org/apache/struts2/showcase/LotsOfOptiontransferselectAction.java b/apps/showcase/src/main/java/org/apache/struts2/showcase/LotsOfOptiontransferselectAction.java index ddc236055..9e9873bf0 100644 --- a/apps/showcase/src/main/java/org/apache/struts2/showcase/LotsOfOptiontransferselectAction.java +++ b/apps/showcase/src/main/java/org/apache/struts2/showcase/LotsOfOptiontransferselectAction.java @@ -1,19 +1,22 @@ /* * $Id$ * - * Copyright 2006 The Apache Software Foundation. + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at + * http://www.apache.org/licenses/LICENSE-2.0 * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. */ package org.apache.struts2.showcase; @@ -26,198 +29,198 @@ import com.opensymphony.xwork2.ActionSupport; /** */ public class LotsOfOptiontransferselectAction extends ActionSupport { - - private List _favouriteCartoonCharactersKeys; - private List _notFavouriteCartoonCharactersKeys; - - private List _favouriteCarsKeys; - private List _notFavouriteCarsKeys; - - private List _favouriteMotorcyclesKeys; - private List _notFavouriteMotorcyclesKeys; - - private List _favouriteCountriesKeys; - private List _notFavouriteCountriesKeys; - - private List _prioritisedFavouriteCartoonCharacters; - private List _prioritisedFavouriteCars; - private List _prioritisedFavouriteCountries; - - - - // Cartoon Characters - public Map getDefaultFavouriteCartoonCharacters() { - Map m = new LinkedHashMap(); - m.put("heMan", "He-Man"); - m.put("popeye", "Popeye"); - m.put("mockeyMouse", "Mickey Mouse"); - return m; - } - - public Map getDefaultNotFavouriteCartoonCharacters() { - Map m = new LinkedHashMap(); - m.put("donaldDuck", "Donald Duck"); - m.put("atomicAnt", "Atomic Ant"); - m.put("pinkPainter", "Pink Painter"); - return m; - } - - public List getFavouriteCartoonCharacters() { - return _favouriteCartoonCharactersKeys; - } - - public void setFavouriteCartoonCharacters(List favouriteCartoonCharacters) { - _favouriteCartoonCharactersKeys = favouriteCartoonCharacters; - } - - public List getNotFavouriteCartoonCharacters() { - return _notFavouriteCartoonCharactersKeys; - } - - public void setNotFavouriteCartoonCharacters(List notFavouriteCartoonCharacters) { - _notFavouriteCartoonCharactersKeys = notFavouriteCartoonCharacters; - } - - - - - - // Cars - public Map getDefaultFavouriteCars() { - Map m = new LinkedHashMap(); - m.put("alfaRomeo", "Alfa Romeo"); - m.put("Toyota", "Toyota"); - m.put("Mitsubitshi", "Mitsubitshi"); - return m; - } - - public Map getDefaultNotFavouriteCars() { - Map m = new LinkedHashMap(); - m.put("ford", "Ford"); - m.put("landRover", "Land Rover"); - m.put("mercedes", "Mercedes"); - return m; - } - - public List getFavouriteCars() { - return _favouriteCarsKeys; - } - - public void setFavouriteCars(List favouriteCars) { - _favouriteCarsKeys = favouriteCars; - } - - public List getNotFavouriteCars() { - return _notFavouriteCarsKeys; - } - - public void setNotFavouriteCars(List notFavouriteCars) { - _notFavouriteCarsKeys = notFavouriteCars; - } - - - - // Motorcycles - public Map getDefaultFavouriteMotorcycles() { - Map m = new LinkedHashMap(); - m.put("honda", "Honda"); - m.put("yamaha", "Yamaha"); - m.put("Aprillia", "Aprillia"); - return m; - } - - public Map getDefaultNotFavouriteMotorcycles() { - Map m = new LinkedHashMap(); - m.put("cagiva", "Cagiva"); - m.put("harleyDavidson", "Harley Davidson"); - m.put("suzuki", "Suzuki"); - return m; - } - - public List getFavouriteMotorcycles() { - return _favouriteMotorcyclesKeys; - } - - public void setFavouriteMotorcycles(List favouriteMotorcycles) { - _favouriteMotorcyclesKeys = favouriteMotorcycles; - } - - public List getNotFavouriteMotorcycles() { - return _notFavouriteMotorcyclesKeys; - } - - public void setNotFavouriteMotorcycles(List notFavouriteMotorcycles) { - _notFavouriteMotorcyclesKeys = notFavouriteMotorcycles; - } - - - - // Countries - public Map getDefaultFavouriteCountries() { - Map m = new LinkedHashMap(); - m.put("england", "England"); - m.put("america", "America"); - m.put("brazil", "Brazil"); - return m; - } - - public Map getDefaultNotFavouriteCountries() { - Map m = new LinkedHashMap(); - m.put("germany", "Germany"); - m.put("china", "China"); - m.put("russia", "Russia"); - return m; - } - - public List getFavouriteCountries() { - return _favouriteCountriesKeys; - } - - public void setFavouriteCountries(List favouriteCountries) { - _favouriteCountriesKeys = favouriteCountries; - } - - public List getNotFavouriteCountries() { - return _notFavouriteCountriesKeys; - } - - public void setNotFavouriteCountries(List notFavouriteCountries) { - _notFavouriteCountriesKeys = notFavouriteCountries; - } - - - public List getPrioritisedFavouriteCartoonCharacters() { - return _prioritisedFavouriteCartoonCharacters; - } - public void setPrioritisedFavouriteCartoonCharacters(List prioritisedFavouriteCartoonCharacters) { - _prioritisedFavouriteCartoonCharacters = prioritisedFavouriteCartoonCharacters; - } - - public List getPrioritisedFavouriteCars() { - return _prioritisedFavouriteCars; - } - public void setPrioritisedFavouriteCars(List prioritisedFavouriteCars) { - _prioritisedFavouriteCars = prioritisedFavouriteCars; - } - - - public List getPrioritisedFavouriteCountries() { - return _prioritisedFavouriteCountries; - } - public void setPrioritisedFavouriteCountries(List prioritisedFavouriteCountries) { - _prioritisedFavouriteCountries = prioritisedFavouriteCountries; - } - - - - - // actions - - public String input() throws Exception { - return SUCCESS; - } - - public String submit() throws Exception { - return SUCCESS; - } + + private List _favouriteCartoonCharactersKeys; + private List _notFavouriteCartoonCharactersKeys; + + private List _favouriteCarsKeys; + private List _notFavouriteCarsKeys; + + private List _favouriteMotorcyclesKeys; + private List _notFavouriteMotorcyclesKeys; + + private List _favouriteCountriesKeys; + private List _notFavouriteCountriesKeys; + + private List _prioritisedFavouriteCartoonCharacters; + private List _prioritisedFavouriteCars; + private List _prioritisedFavouriteCountries; + + + + // Cartoon Characters + public Map getDefaultFavouriteCartoonCharacters() { + Map m = new LinkedHashMap(); + m.put("heMan", "He-Man"); + m.put("popeye", "Popeye"); + m.put("mockeyMouse", "Mickey Mouse"); + return m; + } + + public Map getDefaultNotFavouriteCartoonCharacters() { + Map m = new LinkedHashMap(); + m.put("donaldDuck", "Donald Duck"); + m.put("atomicAnt", "Atomic Ant"); + m.put("pinkPainter", "Pink Painter"); + return m; + } + + public List getFavouriteCartoonCharacters() { + return _favouriteCartoonCharactersKeys; + } + + public void setFavouriteCartoonCharacters(List favouriteCartoonCharacters) { + _favouriteCartoonCharactersKeys = favouriteCartoonCharacters; + } + + public List getNotFavouriteCartoonCharacters() { + return _notFavouriteCartoonCharactersKeys; + } + + public void setNotFavouriteCartoonCharacters(List notFavouriteCartoonCharacters) { + _notFavouriteCartoonCharactersKeys = notFavouriteCartoonCharacters; + } + + + + + + // Cars + public Map getDefaultFavouriteCars() { + Map m = new LinkedHashMap(); + m.put("alfaRomeo", "Alfa Romeo"); + m.put("Toyota", "Toyota"); + m.put("Mitsubitshi", "Mitsubitshi"); + return m; + } + + public Map getDefaultNotFavouriteCars() { + Map m = new LinkedHashMap(); + m.put("ford", "Ford"); + m.put("landRover", "Land Rover"); + m.put("mercedes", "Mercedes"); + return m; + } + + public List getFavouriteCars() { + return _favouriteCarsKeys; + } + + public void setFavouriteCars(List favouriteCars) { + _favouriteCarsKeys = favouriteCars; + } + + public List getNotFavouriteCars() { + return _notFavouriteCarsKeys; + } + + public void setNotFavouriteCars(List notFavouriteCars) { + _notFavouriteCarsKeys = notFavouriteCars; + } + + + + // Motorcycles + public Map getDefaultFavouriteMotorcycles() { + Map m = new LinkedHashMap(); + m.put("honda", "Honda"); + m.put("yamaha", "Yamaha"); + m.put("Aprillia", "Aprillia"); + return m; + } + + public Map getDefaultNotFavouriteMotorcycles() { + Map m = new LinkedHashMap(); + m.put("cagiva", "Cagiva"); + m.put("harleyDavidson", "Harley Davidson"); + m.put("suzuki", "Suzuki"); + return m; + } + + public List getFavouriteMotorcycles() { + return _favouriteMotorcyclesKeys; + } + + public void setFavouriteMotorcycles(List favouriteMotorcycles) { + _favouriteMotorcyclesKeys = favouriteMotorcycles; + } + + public List getNotFavouriteMotorcycles() { + return _notFavouriteMotorcyclesKeys; + } + + public void setNotFavouriteMotorcycles(List notFavouriteMotorcycles) { + _notFavouriteMotorcyclesKeys = notFavouriteMotorcycles; + } + + + + // Countries + public Map getDefaultFavouriteCountries() { + Map m = new LinkedHashMap(); + m.put("england", "England"); + m.put("america", "America"); + m.put("brazil", "Brazil"); + return m; + } + + public Map getDefaultNotFavouriteCountries() { + Map m = new LinkedHashMap(); + m.put("germany", "Germany"); + m.put("china", "China"); + m.put("russia", "Russia"); + return m; + } + + public List getFavouriteCountries() { + return _favouriteCountriesKeys; + } + + public void setFavouriteCountries(List favouriteCountries) { + _favouriteCountriesKeys = favouriteCountries; + } + + public List getNotFavouriteCountries() { + return _notFavouriteCountriesKeys; + } + + public void setNotFavouriteCountries(List notFavouriteCountries) { + _notFavouriteCountriesKeys = notFavouriteCountries; + } + + + public List getPrioritisedFavouriteCartoonCharacters() { + return _prioritisedFavouriteCartoonCharacters; + } + public void setPrioritisedFavouriteCartoonCharacters(List prioritisedFavouriteCartoonCharacters) { + _prioritisedFavouriteCartoonCharacters = prioritisedFavouriteCartoonCharacters; + } + + public List getPrioritisedFavouriteCars() { + return _prioritisedFavouriteCars; + } + public void setPrioritisedFavouriteCars(List prioritisedFavouriteCars) { + _prioritisedFavouriteCars = prioritisedFavouriteCars; + } + + + public List getPrioritisedFavouriteCountries() { + return _prioritisedFavouriteCountries; + } + public void setPrioritisedFavouriteCountries(List prioritisedFavouriteCountries) { + _prioritisedFavouriteCountries = prioritisedFavouriteCountries; + } + + + + + // actions + + public String input() throws Exception { + return SUCCESS; + } + + public String submit() throws Exception { + return SUCCESS; + } } diff --git a/apps/showcase/src/main/java/org/apache/struts2/showcase/LotsOfRichtexteditorAction.java b/apps/showcase/src/main/java/org/apache/struts2/showcase/LotsOfRichtexteditorAction.java index 952fda972..410a499c7 100644 --- a/apps/showcase/src/main/java/org/apache/struts2/showcase/LotsOfRichtexteditorAction.java +++ b/apps/showcase/src/main/java/org/apache/struts2/showcase/LotsOfRichtexteditorAction.java @@ -1,75 +1,78 @@ /* * $Id$ * - * Copyright 2006 The Apache Software Foundation. + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at + * http://www.apache.org/licenses/LICENSE-2.0 * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. */ package org.apache.struts2.showcase; import com.opensymphony.xwork2.ActionSupport; /** - * + * */ public class LotsOfRichtexteditorAction extends ActionSupport { - public String description1; - public String description2 = "This is Description 2"; - public String description3; - public String description4 = "This is Description 4"; - - public String getDescription1() { - return this.description1; - } - public void setDescription1(String description1) { - this.description1 = description1; - } - - - public String getDescription2() { - return this.description2; - } - public void setDescription2(String description2) { - this.description2 = description2; - } - - - public String getDescription3() { - return this.description3; - } - public void setDescription3(String description3) { - this.description3 = description3; - } - - - - - public String getDescription4() { - return this.description4; - } - public void setDescription4(String description4) { - this.description4 = description4; - } - - - - - public String input() throws Exception { - return SUCCESS; - } - - public String submit() throws Exception { - return SUCCESS; - } + public String description1; + public String description2 = "This is Description 2"; + public String description3; + public String description4 = "This is Description 4"; + + public String getDescription1() { + return this.description1; + } + public void setDescription1(String description1) { + this.description1 = description1; + } + + + public String getDescription2() { + return this.description2; + } + public void setDescription2(String description2) { + this.description2 = description2; + } + + + public String getDescription3() { + return this.description3; + } + public void setDescription3(String description3) { + this.description3 = description3; + } + + + + + public String getDescription4() { + return this.description4; + } + public void setDescription4(String description4) { + this.description4 = description4; + } + + + + + public String input() throws Exception { + return SUCCESS; + } + + public String submit() throws Exception { + return SUCCESS; + } } diff --git a/apps/showcase/src/main/java/org/apache/struts2/showcase/ShowDynamicTreeAction.java b/apps/showcase/src/main/java/org/apache/struts2/showcase/ShowDynamicTreeAction.java index 838d76b63..fcbe56d0a 100644 --- a/apps/showcase/src/main/java/org/apache/struts2/showcase/ShowDynamicTreeAction.java +++ b/apps/showcase/src/main/java/org/apache/struts2/showcase/ShowDynamicTreeAction.java @@ -1,16 +1,36 @@ +/* + * $Id$ + * + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ package org.apache.struts2.showcase; import org.apache.struts2.showcase.ajax.tree.Category; import com.opensymphony.xwork2.ActionSupport; -// START SNIPPET: treeExampleDynamicJavaShow +// START SNIPPET: treeExampleDynamicJavaShow public class ShowDynamicTreeAction extends ActionSupport { - - public Category getTreeRootNode() { - return Category.getById(1); - } + + public Category getTreeRootNode() { + return Category.getById(1); + } } // END SNIPPET: treeExampleDynamicJavaShow diff --git a/apps/showcase/src/main/java/org/apache/struts2/showcase/UITagExample.java b/apps/showcase/src/main/java/org/apache/struts2/showcase/UITagExample.java index 3a2729c83..0e9e50894 100644 --- a/apps/showcase/src/main/java/org/apache/struts2/showcase/UITagExample.java +++ b/apps/showcase/src/main/java/org/apache/struts2/showcase/UITagExample.java @@ -1,19 +1,22 @@ /* * $Id$ * - * Copyright 2006 The Apache Software Foundation. + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at + * http://www.apache.org/licenses/LICENSE-2.0 * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. */ package org.apache.struts2.showcase; @@ -33,11 +36,11 @@ import java.io.File; /** */ public class UITagExample extends ActionSupport implements Validateable { - - private static final long serialVersionUID = -94044809860988047L; - - - String name; + + private static final long serialVersionUID = -94044809860988047L; + + + String name; Date birthday; String bio; String favoriteColor; @@ -51,89 +54,89 @@ public class UITagExample extends ActionSupport implements Validateable { String favouriteLanguage; String favouriteVehicalType = "MotorcycleKey"; String favouriteVehicalSpecific = "YamahaKey"; - + List leftSideCartoonCharacters; List rightSideCartoonCharacters; - + List favouriteLanguages = new ArrayList(); List vehicalTypeList = new ArrayList(); Map vehicalSpecificMap = new HashMap(); - + String thoughts; - + public UITagExample() { - favouriteLanguages.add(new Language("EnglishKey", "English Language")); - favouriteLanguages.add(new Language("FrenchKey", "French Language")); - favouriteLanguages.add(new Language("SpanishKey", "Spanish Language")); - - VehicalType car = new VehicalType("CarKey", "Car"); - VehicalType motorcycle = new VehicalType("MotorcycleKey", "Motorcycle"); - vehicalTypeList.add(car); - vehicalTypeList.add(motorcycle); - - List cars = new ArrayList(); - cars.add(new VehicalSpecific("MercedesKey", "Mercedes")); - cars.add(new VehicalSpecific("HondaKey", "Honda")); - cars.add(new VehicalSpecific("FordKey", "Ford")); - - List motorcycles = new ArrayList(); - motorcycles.add(new VehicalSpecific("SuzukiKey", "Suzuki")); - motorcycles.add(new VehicalSpecific("YamahaKey", "Yamaha")); - - vehicalSpecificMap.put(car, cars); - vehicalSpecificMap.put(motorcycle, motorcycles); + favouriteLanguages.add(new Language("EnglishKey", "English Language")); + favouriteLanguages.add(new Language("FrenchKey", "French Language")); + favouriteLanguages.add(new Language("SpanishKey", "Spanish Language")); + + VehicalType car = new VehicalType("CarKey", "Car"); + VehicalType motorcycle = new VehicalType("MotorcycleKey", "Motorcycle"); + vehicalTypeList.add(car); + vehicalTypeList.add(motorcycle); + + List cars = new ArrayList(); + cars.add(new VehicalSpecific("MercedesKey", "Mercedes")); + cars.add(new VehicalSpecific("HondaKey", "Honda")); + cars.add(new VehicalSpecific("FordKey", "Ford")); + + List motorcycles = new ArrayList(); + motorcycles.add(new VehicalSpecific("SuzukiKey", "Suzuki")); + motorcycles.add(new VehicalSpecific("YamahaKey", "Yamaha")); + + vehicalSpecificMap.put(car, cars); + vehicalSpecificMap.put(motorcycle, motorcycles); } - - - + + + public List getLeftSideCartoonCharacters() { - return leftSideCartoonCharacters; + return leftSideCartoonCharacters; } public void setLeftSideCartoonCharacters(List leftSideCartoonCharacters) { - this.leftSideCartoonCharacters = leftSideCartoonCharacters; + this.leftSideCartoonCharacters = leftSideCartoonCharacters; } - - + + public List getRightSideCartoonCharacters() { - return rightSideCartoonCharacters; + return rightSideCartoonCharacters; } public void setRightSideCartoonCharacters(List rightSideCartoonCharacters) { - this.rightSideCartoonCharacters = rightSideCartoonCharacters; + this.rightSideCartoonCharacters = rightSideCartoonCharacters; } - - + + public String getFavouriteVehicalType() { - return favouriteVehicalType; + return favouriteVehicalType; } - + public void setFavouriteVehicalType(String favouriteVehicalType) { - this.favouriteVehicalType = favouriteVehicalType; + this.favouriteVehicalType = favouriteVehicalType; } - + public String getFavouriteVehicalSpecific() { - return favouriteVehicalSpecific; + return favouriteVehicalSpecific; } - + public void setFavouriteVehicalSpecific(String favouriteVehicalSpecific) { - this.favouriteVehicalSpecific = favouriteVehicalSpecific; + this.favouriteVehicalSpecific = favouriteVehicalSpecific; } - + public List getVehicalTypeList() { - return vehicalTypeList; + return vehicalTypeList; } - + public List getVehicalSpecificList() { - ValueStack stack = ServletActionContext.getValueStack(ServletActionContext.getRequest()); - Object vehicalType = stack.findValue("top"); - if (vehicalType != null && vehicalType instanceof VehicalType) { - List l = (List) vehicalSpecificMap.get(vehicalType); - return l; - } - return Collections.EMPTY_LIST; + ValueStack stack = ServletActionContext.getValueStack(ServletActionContext.getRequest()); + Object vehicalType = stack.findValue("top"); + if (vehicalType != null && vehicalType instanceof VehicalType) { + List l = (List) vehicalSpecificMap.get(vehicalType); + return l; + } + return Collections.EMPTY_LIST; } - + public List getFavouriteLanguages() { - return favouriteLanguages; + return favouriteLanguages; } public String execute() throws Exception { @@ -215,100 +218,100 @@ public class UITagExample extends ActionSupport implements Validateable { public void setPictureFileName(String pictureFileName) { this.pictureFileName = pictureFileName; } - + public void setFavouriteLanguage(String favouriteLanguage) { - this.favouriteLanguage = favouriteLanguage; + this.favouriteLanguage = favouriteLanguage; } - + public String getFavouriteLanguage() { - return favouriteLanguage; + return favouriteLanguage; } - - + + public void setThoughts(String thoughts) { - this.thoughts = thoughts; + this.thoughts = thoughts; } - + public String getThoughts() { - return this.thoughts; + return this.thoughts; } - - - + + + public String doSubmit() { - return SUCCESS; + return SUCCESS; } - - - - // === inner class + + + + // === inner class public static class Language { - String description; - String key; - - public Language(String key, String description) { - this.key = key; - this.description = description; - } - - public String getKey() { - return key; - } - public String getDescription() { - return description; - } - + String description; + String key; + + public Language(String key, String description) { + this.key = key; + this.description = description; + } + + public String getKey() { + return key; + } + public String getDescription() { + return description; + } + } - - + + public static class VehicalType { - String key; - String description; - public VehicalType(String key, String description) { - this.key = key; - this.description = description; - } - - public String getKey() { return this.key; } - public String getDescription() { return this.description; } - - public boolean equals(Object obj) { - if (! (obj instanceof VehicalType)) { - return false; - } - else { - return key.equals(((VehicalType)obj).getKey()); - } - } - - public int hashCode() { - return key.hashCode(); - } + String key; + String description; + public VehicalType(String key, String description) { + this.key = key; + this.description = description; + } + + public String getKey() { return this.key; } + public String getDescription() { return this.description; } + + public boolean equals(Object obj) { + if (! (obj instanceof VehicalType)) { + return false; + } + else { + return key.equals(((VehicalType)obj).getKey()); + } + } + + public int hashCode() { + return key.hashCode(); + } } - - + + public static class VehicalSpecific { - String key; - String description; - public VehicalSpecific(String key, String description) { - this.key = key; - this.description = description; - } - - public String getKey() { return this.key; } - public String getDescription() { return this.description; } - - public boolean equals(Object obj) { - if (! (obj instanceof VehicalSpecific)) { - return false; - } - else { - return key.equals(((VehicalSpecific)obj).getKey()); - } - } - - public int hashCode() { - return key.hashCode(); - } + String key; + String description; + public VehicalSpecific(String key, String description) { + this.key = key; + this.description = description; + } + + public String getKey() { return this.key; } + public String getDescription() { return this.description; } + + public boolean equals(Object obj) { + if (! (obj instanceof VehicalSpecific)) { + return false; + } + else { + return key.equals(((VehicalSpecific)obj).getKey()); + } + } + + public int hashCode() { + return key.hashCode(); + } } } diff --git a/apps/showcase/src/main/java/org/apache/struts2/showcase/action/AbstractCRUDAction.java b/apps/showcase/src/main/java/org/apache/struts2/showcase/action/AbstractCRUDAction.java index d57b30f54..081249bb2 100644 --- a/apps/showcase/src/main/java/org/apache/struts2/showcase/action/AbstractCRUDAction.java +++ b/apps/showcase/src/main/java/org/apache/struts2/showcase/action/AbstractCRUDAction.java @@ -1,19 +1,22 @@ /* * $Id$ * - * Copyright 2006 The Apache Software Foundation. + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at + * http://www.apache.org/licenses/LICENSE-2.0 * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. */ package org.apache.struts2.showcase.action; diff --git a/apps/showcase/src/main/java/org/apache/struts2/showcase/action/EmployeeAction.java b/apps/showcase/src/main/java/org/apache/struts2/showcase/action/EmployeeAction.java index b434d0333..3fd8115b7 100644 --- a/apps/showcase/src/main/java/org/apache/struts2/showcase/action/EmployeeAction.java +++ b/apps/showcase/src/main/java/org/apache/struts2/showcase/action/EmployeeAction.java @@ -1,19 +1,22 @@ /* * $Id$ * - * Copyright 2006 The Apache Software Foundation. + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at + * http://www.apache.org/licenses/LICENSE-2.0 * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. */ package org.apache.struts2.showcase.action; diff --git a/apps/showcase/src/main/java/org/apache/struts2/showcase/action/SkillAction.java b/apps/showcase/src/main/java/org/apache/struts2/showcase/action/SkillAction.java index dfcb5dfa0..2c8c73f5a 100644 --- a/apps/showcase/src/main/java/org/apache/struts2/showcase/action/SkillAction.java +++ b/apps/showcase/src/main/java/org/apache/struts2/showcase/action/SkillAction.java @@ -1,19 +1,22 @@ /* * $Id$ * - * Copyright 2006 The Apache Software Foundation. + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at + * http://www.apache.org/licenses/LICENSE-2.0 * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. */ package org.apache.struts2.showcase.action; diff --git a/apps/showcase/src/main/java/org/apache/struts2/showcase/actionchaining/ActionChain1.java b/apps/showcase/src/main/java/org/apache/struts2/showcase/actionchaining/ActionChain1.java index c9dfed9e9..26fb309da 100644 --- a/apps/showcase/src/main/java/org/apache/struts2/showcase/actionchaining/ActionChain1.java +++ b/apps/showcase/src/main/java/org/apache/struts2/showcase/actionchaining/ActionChain1.java @@ -1,42 +1,45 @@ /* * $Id$ * - * Copyright 2006 The Apache Software Foundation. + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at + * http://www.apache.org/licenses/LICENSE-2.0 * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. */ package org.apache.struts2.showcase.actionchaining; import com.opensymphony.xwork2.ActionSupport; /** - * + * */ public class ActionChain1 extends ActionSupport { - private static final long serialVersionUID = -6811701750042275153L; - - private String actionChain1Property1 = "Property Set In Action Chain 1"; + private static final long serialVersionUID = -6811701750042275153L; - public String getActionChain1Property1() { - return actionChain1Property1; - } - public void setActionChain1Property1(String actionChain1Property1) { - this.actionChain1Property1 = actionChain1Property1; - } - - - public String input() throws Exception { - return SUCCESS; - } + private String actionChain1Property1 = "Property Set In Action Chain 1"; + + public String getActionChain1Property1() { + return actionChain1Property1; + } + public void setActionChain1Property1(String actionChain1Property1) { + this.actionChain1Property1 = actionChain1Property1; + } + + + public String input() throws Exception { + return SUCCESS; + } } diff --git a/apps/showcase/src/main/java/org/apache/struts2/showcase/actionchaining/ActionChain2.java b/apps/showcase/src/main/java/org/apache/struts2/showcase/actionchaining/ActionChain2.java index e4b30f9a8..603d19fd9 100644 --- a/apps/showcase/src/main/java/org/apache/struts2/showcase/actionchaining/ActionChain2.java +++ b/apps/showcase/src/main/java/org/apache/struts2/showcase/actionchaining/ActionChain2.java @@ -1,55 +1,58 @@ /* * $Id$ * - * Copyright 2006 The Apache Software Foundation. + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at + * http://www.apache.org/licenses/LICENSE-2.0 * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. */ package org.apache.struts2.showcase.actionchaining; import com.opensymphony.xwork2.ActionSupport; /** - * + * */ public class ActionChain2 extends ActionSupport { - private static final long serialVersionUID = 3951745956044674809L; - - private String actionChain1Property1; - private String actionChain2Property1 = "Property Set in Action Chain 2"; - - - public String getActionChain1Property1() { - return actionChain1Property1; - } - public void setActionChain1Property1(String actionChain1Property1) { - this.actionChain1Property1 = actionChain1Property1; - } - - - - public String getActionChain2Property1() { - return actionChain2Property1; - } - public void setActionChain2Property1(String actionChain2Property1) { - this.actionChain2Property1 = actionChain2Property1; - } - - - - - public String execute() throws Exception { - return SUCCESS; - } + private static final long serialVersionUID = 3951745956044674809L; + + private String actionChain1Property1; + private String actionChain2Property1 = "Property Set in Action Chain 2"; + + + public String getActionChain1Property1() { + return actionChain1Property1; + } + public void setActionChain1Property1(String actionChain1Property1) { + this.actionChain1Property1 = actionChain1Property1; + } + + + + public String getActionChain2Property1() { + return actionChain2Property1; + } + public void setActionChain2Property1(String actionChain2Property1) { + this.actionChain2Property1 = actionChain2Property1; + } + + + + + public String execute() throws Exception { + return SUCCESS; + } } diff --git a/apps/showcase/src/main/java/org/apache/struts2/showcase/actionchaining/ActionChain3.java b/apps/showcase/src/main/java/org/apache/struts2/showcase/actionchaining/ActionChain3.java index 53e7587a5..f2ec60cc9 100644 --- a/apps/showcase/src/main/java/org/apache/struts2/showcase/actionchaining/ActionChain3.java +++ b/apps/showcase/src/main/java/org/apache/struts2/showcase/actionchaining/ActionChain3.java @@ -1,65 +1,68 @@ /* * $Id$ * - * Copyright 2006 The Apache Software Foundation. + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at + * http://www.apache.org/licenses/LICENSE-2.0 * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. */ package org.apache.struts2.showcase.actionchaining; import com.opensymphony.xwork2.ActionSupport; /** - * + * */ public class ActionChain3 extends ActionSupport { - private static final long serialVersionUID = -1456568865075250621L; - - private String actionChain1Property1; - private String actionChain2Property1; - private String actionChain3Property1 = "Property set in Action Chain 3"; - - - public String getActionChain1Property1() { - return actionChain1Property1; - } - public void setActionChain1Property1(String actionChain1Property1) { - this.actionChain1Property1 = actionChain1Property1; - } - - - - public String getActionChain2Property1() { - return actionChain2Property1; - } - public void setActionChain2Property1(String actionChain2Property1) { - this.actionChain2Property1 = actionChain2Property1; - } - - - - public String getActionChain3Property1() { - return actionChain3Property1; - } - public void setActionChain3Property1(String actionChain3Property1) { - this.actionChain3Property1 = actionChain3Property1; - } - - - - - public String execute() throws Exception { - return SUCCESS; - } + private static final long serialVersionUID = -1456568865075250621L; + + private String actionChain1Property1; + private String actionChain2Property1; + private String actionChain3Property1 = "Property set in Action Chain 3"; + + + public String getActionChain1Property1() { + return actionChain1Property1; + } + public void setActionChain1Property1(String actionChain1Property1) { + this.actionChain1Property1 = actionChain1Property1; + } + + + + public String getActionChain2Property1() { + return actionChain2Property1; + } + public void setActionChain2Property1(String actionChain2Property1) { + this.actionChain2Property1 = actionChain2Property1; + } + + + + public String getActionChain3Property1() { + return actionChain3Property1; + } + public void setActionChain3Property1(String actionChain3Property1) { + this.actionChain3Property1 = actionChain3Property1; + } + + + + + public String execute() throws Exception { + return SUCCESS; + } } diff --git a/apps/showcase/src/main/java/org/apache/struts2/showcase/ajax/AjaxTestAction.java b/apps/showcase/src/main/java/org/apache/struts2/showcase/ajax/AjaxTestAction.java index 89e7efccb..9f651e629 100644 --- a/apps/showcase/src/main/java/org/apache/struts2/showcase/ajax/AjaxTestAction.java +++ b/apps/showcase/src/main/java/org/apache/struts2/showcase/ajax/AjaxTestAction.java @@ -1,19 +1,22 @@ /* * $Id$ * - * Copyright 2006 The Apache Software Foundation. + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at + * http://www.apache.org/licenses/LICENSE-2.0 * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. */ package org.apache.struts2.showcase.ajax; diff --git a/apps/showcase/src/main/java/org/apache/struts2/showcase/ajax/Example4ShowPanelAction.java b/apps/showcase/src/main/java/org/apache/struts2/showcase/ajax/Example4ShowPanelAction.java index 8935bead7..6ff756de9 100644 --- a/apps/showcase/src/main/java/org/apache/struts2/showcase/ajax/Example4ShowPanelAction.java +++ b/apps/showcase/src/main/java/org/apache/struts2/showcase/ajax/Example4ShowPanelAction.java @@ -1,19 +1,22 @@ /* * $Id$ * - * Copyright 2006 The Apache Software Foundation. + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at + * http://www.apache.org/licenses/LICENSE-2.0 * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. */ package org.apache.struts2.showcase.ajax; @@ -27,46 +30,46 @@ import com.opensymphony.xwork2.ActionSupport; */ public class Example4ShowPanelAction extends ActionSupport { - private String name; - private String gender; - - private static final long serialVersionUID = 7751976335066456596L; + private String name; + private String gender; - public String panel1() throws Exception { - return SUCCESS; - } - - public String panel2() throws Exception { - return SUCCESS; - } - - public String panel3() throws Exception { - return SUCCESS; - } + private static final long serialVersionUID = 7751976335066456596L; - public String getGender() { - return gender; - } + public String panel1() throws Exception { + return SUCCESS; + } - public void setGender(String gender) { - this.gender = gender; - } + public String panel2() throws Exception { + return SUCCESS; + } - public String getName() { - return name; - } + public String panel3() throws Exception { + return SUCCESS; + } - public void setName(String name) { - this.name = name; - } - - public String getTodayDate() { - SimpleDateFormat sdf = new SimpleDateFormat("dd-MMMM-yyyy"); - return sdf.format(new Date()); - } - - public String getTodayTime() { - SimpleDateFormat sdf = new SimpleDateFormat("kk:mm:ss"); - return sdf.format(new Date()); - } + public String getGender() { + return gender; + } + + public void setGender(String gender) { + this.gender = gender; + } + + public String getName() { + return name; + } + + public void setName(String name) { + this.name = name; + } + + public String getTodayDate() { + SimpleDateFormat sdf = new SimpleDateFormat("dd-MMMM-yyyy"); + return sdf.format(new Date()); + } + + public String getTodayTime() { + SimpleDateFormat sdf = new SimpleDateFormat("kk:mm:ss"); + return sdf.format(new Date()); + } } diff --git a/apps/showcase/src/main/java/org/apache/struts2/showcase/ajax/Example5Action.java b/apps/showcase/src/main/java/org/apache/struts2/showcase/ajax/Example5Action.java index da3c4708b..1d5f0f0fb 100644 --- a/apps/showcase/src/main/java/org/apache/struts2/showcase/ajax/Example5Action.java +++ b/apps/showcase/src/main/java/org/apache/struts2/showcase/ajax/Example5Action.java @@ -1,23 +1,43 @@ +/* + * $Id: $ + * + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ package org.apache.struts2.showcase.ajax; import com.opensymphony.xwork2.ActionSupport; public class Example5Action extends ActionSupport { - private static final long serialVersionUID = 2111967621952300611L; - - private String name; - private Integer age; - - - public String getName() { return name; } - public void setName(String name) { this.name = name; } - - public Integer getAge() { return age; } - public void setAge(Integer age) { this.age = age; } - - @Override - public String execute() throws Exception { - return SUCCESS; - } + private static final long serialVersionUID = 2111967621952300611L; + + private String name; + private Integer age; + + + public String getName() { return name; } + public void setName(String name) { this.name = name; } + + public Integer getAge() { return age; } + public void setAge(Integer age) { this.age = age; } + + @Override + public String execute() throws Exception { + return SUCCESS; + } } diff --git a/apps/showcase/src/main/java/org/apache/struts2/showcase/ajax/tree/Category.java b/apps/showcase/src/main/java/org/apache/struts2/showcase/ajax/tree/Category.java index a66cadb15..923436892 100644 --- a/apps/showcase/src/main/java/org/apache/struts2/showcase/ajax/tree/Category.java +++ b/apps/showcase/src/main/java/org/apache/struts2/showcase/ajax/tree/Category.java @@ -1,19 +1,22 @@ /* * $Id$ * - * Copyright 2006 The Apache Software Foundation. + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at + * http://www.apache.org/licenses/LICENSE-2.0 * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. */ package org.apache.struts2.showcase.ajax.tree; diff --git a/apps/showcase/src/main/java/org/apache/struts2/showcase/ajax/tree/GetCategory.java b/apps/showcase/src/main/java/org/apache/struts2/showcase/ajax/tree/GetCategory.java index 329c653c0..69f6bd064 100644 --- a/apps/showcase/src/main/java/org/apache/struts2/showcase/ajax/tree/GetCategory.java +++ b/apps/showcase/src/main/java/org/apache/struts2/showcase/ajax/tree/GetCategory.java @@ -1,19 +1,22 @@ /* * $Id$ * - * Copyright 2006 The Apache Software Foundation. + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at + * http://www.apache.org/licenses/LICENSE-2.0 * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. */ package org.apache.struts2.showcase.ajax.tree; diff --git a/apps/showcase/src/main/java/org/apache/struts2/showcase/ajax/tree/Toggle.java b/apps/showcase/src/main/java/org/apache/struts2/showcase/ajax/tree/Toggle.java index 80a50a292..fe825f034 100644 --- a/apps/showcase/src/main/java/org/apache/struts2/showcase/ajax/tree/Toggle.java +++ b/apps/showcase/src/main/java/org/apache/struts2/showcase/ajax/tree/Toggle.java @@ -1,19 +1,22 @@ /* * $Id$ * - * Copyright 2006 The Apache Software Foundation. + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at + * http://www.apache.org/licenses/LICENSE-2.0 * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. */ package org.apache.struts2.showcase.ajax.tree; diff --git a/apps/showcase/src/main/java/org/apache/struts2/showcase/application/MemoryStorage.java b/apps/showcase/src/main/java/org/apache/struts2/showcase/application/MemoryStorage.java index 2c09afc15..b788cf1a8 100644 --- a/apps/showcase/src/main/java/org/apache/struts2/showcase/application/MemoryStorage.java +++ b/apps/showcase/src/main/java/org/apache/struts2/showcase/application/MemoryStorage.java @@ -1,19 +1,22 @@ /* * $Id$ * - * Copyright 2006 The Apache Software Foundation. + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at + * http://www.apache.org/licenses/LICENSE-2.0 * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. */ package org.apache.struts2.showcase.application; @@ -38,7 +41,7 @@ import java.util.Map; public class MemoryStorage implements Storage { - private static final long serialVersionUID = 8611213748834904125L; + private static final long serialVersionUID = 8611213748834904125L; private Map memory = new HashMap(); @@ -127,7 +130,7 @@ public class MemoryStorage implements Storage { public Collection findAll( Class entityClass ) { if (entityClass != null) { - return getEntityMap(entityClass).values(); + return getEntityMap(entityClass).values(); } else { return new ArrayList(); } diff --git a/apps/showcase/src/main/java/org/apache/struts2/showcase/application/Storage.java b/apps/showcase/src/main/java/org/apache/struts2/showcase/application/Storage.java index ceba1832f..d3d0e15ea 100644 --- a/apps/showcase/src/main/java/org/apache/struts2/showcase/application/Storage.java +++ b/apps/showcase/src/main/java/org/apache/struts2/showcase/application/Storage.java @@ -1,19 +1,22 @@ /* * $Id$ * - * Copyright 2006 The Apache Software Foundation. + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at + * http://www.apache.org/licenses/LICENSE-2.0 * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. */ package org.apache.struts2.showcase.application; diff --git a/apps/showcase/src/main/java/org/apache/struts2/showcase/application/TestDataProvider.java b/apps/showcase/src/main/java/org/apache/struts2/showcase/application/TestDataProvider.java index 6378a00e3..fbad3955d 100644 --- a/apps/showcase/src/main/java/org/apache/struts2/showcase/application/TestDataProvider.java +++ b/apps/showcase/src/main/java/org/apache/struts2/showcase/application/TestDataProvider.java @@ -1,19 +1,22 @@ /* * $Id$ * - * Copyright 2006 The Apache Software Foundation. + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at + * http://www.apache.org/licenses/LICENSE-2.0 * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. */ package org.apache.struts2.showcase.application; @@ -36,9 +39,9 @@ import java.util.Arrays; public class TestDataProvider implements Serializable, InitializingBean { - private static final long serialVersionUID = 1L; + private static final long serialVersionUID = 1L; - private static final Logger log = Logger.getLogger(TestDataProvider.class); + private static final Logger log = Logger.getLogger(TestDataProvider.class); public static final String[] POSITIONS = { "Developer", diff --git a/apps/showcase/src/main/java/org/apache/struts2/showcase/chat/ChatAuthenticationInterceptor.java b/apps/showcase/src/main/java/org/apache/struts2/showcase/chat/ChatAuthenticationInterceptor.java index 8c934df1d..281f67347 100644 --- a/apps/showcase/src/main/java/org/apache/struts2/showcase/chat/ChatAuthenticationInterceptor.java +++ b/apps/showcase/src/main/java/org/apache/struts2/showcase/chat/ChatAuthenticationInterceptor.java @@ -1,19 +1,22 @@ /* * $Id$ * - * Copyright 2006 The Apache Software Foundation. + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at + * http://www.apache.org/licenses/LICENSE-2.0 * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. */ package org.apache.struts2.showcase.chat; @@ -29,29 +32,29 @@ import com.opensymphony.xwork2.interceptor.Interceptor; public class ChatAuthenticationInterceptor implements Interceptor { - private static final long serialVersionUID = 1L; - - private static final Log _log = LogFactory.getLog(ChatAuthenticationInterceptor.class); - - public static final String USER_SESSION_KEY = "chatUserSessionKey"; + private static final long serialVersionUID = 1L; - public void destroy() { - } + private static final Log _log = LogFactory.getLog(ChatAuthenticationInterceptor.class); - public void init() { - } + public static final String USER_SESSION_KEY = "chatUserSessionKey"; - public String intercept(ActionInvocation invocation) throws Exception { - - _log.debug("Authenticating chat user"); - - SessionMap session = (SessionMap) ActionContext.getContext().get(ActionContext.SESSION); - User user = (User) session.get(USER_SESSION_KEY); - - if (user == null) { - return Action.LOGIN; - } - return invocation.invoke(); - } + public void destroy() { + } + + public void init() { + } + + public String intercept(ActionInvocation invocation) throws Exception { + + _log.debug("Authenticating chat user"); + + SessionMap session = (SessionMap) ActionContext.getContext().get(ActionContext.SESSION); + User user = (User) session.get(USER_SESSION_KEY); + + if (user == null) { + return Action.LOGIN; + } + return invocation.invoke(); + } } diff --git a/apps/showcase/src/main/java/org/apache/struts2/showcase/chat/ChatException.java b/apps/showcase/src/main/java/org/apache/struts2/showcase/chat/ChatException.java index 0207d6192..50b5e9b81 100644 --- a/apps/showcase/src/main/java/org/apache/struts2/showcase/chat/ChatException.java +++ b/apps/showcase/src/main/java/org/apache/struts2/showcase/chat/ChatException.java @@ -1,33 +1,36 @@ /* * $Id$ * - * Copyright 2006 The Apache Software Foundation. + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at + * http://www.apache.org/licenses/LICENSE-2.0 * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. */ package org.apache.struts2.showcase.chat; public class ChatException extends RuntimeException { - - private static final long serialVersionUID = 1L; - public enum ErrorType { - ROOM_ALREADY_EXISTS, - USER_ALREADY_EXISTS, - NO_SUCH_ROOM_EXISTS - } - - public ChatException(String description, ErrorType type) { - super(description); - } + private static final long serialVersionUID = 1L; + + public enum ErrorType { + ROOM_ALREADY_EXISTS, + USER_ALREADY_EXISTS, + NO_SUCH_ROOM_EXISTS + } + + public ChatException(String description, ErrorType type) { + super(description); + } } diff --git a/apps/showcase/src/main/java/org/apache/struts2/showcase/chat/ChatInterceptor.java b/apps/showcase/src/main/java/org/apache/struts2/showcase/chat/ChatInterceptor.java index 791aeed43..4e9afbda0 100644 --- a/apps/showcase/src/main/java/org/apache/struts2/showcase/chat/ChatInterceptor.java +++ b/apps/showcase/src/main/java/org/apache/struts2/showcase/chat/ChatInterceptor.java @@ -1,19 +1,22 @@ /* * $Id$ * - * Copyright 2006 The Apache Software Foundation. + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at + * http://www.apache.org/licenses/LICENSE-2.0 * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. */ package org.apache.struts2.showcase.chat; @@ -31,28 +34,28 @@ import com.opensymphony.xwork2.interceptor.Interceptor; * Authenticate showcase chat example, make sure everyone have a username. */ public class ChatInterceptor implements Interceptor { - - private static final Log _log = LogFactory.getLog(ChatInterceptor.class); - private static final long serialVersionUID = 1L; - - public static final String CHAT_USER_SESSION_KEY = "ChatUserSessionKey"; + private static final Log _log = LogFactory.getLog(ChatInterceptor.class); - public void destroy() { - } + private static final long serialVersionUID = 1L; - public void init() { - } + public static final String CHAT_USER_SESSION_KEY = "ChatUserSessionKey"; - public String intercept(ActionInvocation invocation) throws Exception { - HttpSession session = (HttpSession) ActionContext.getContext().get(ActionContext.SESSION); - User chatUser = (User) session.getAttribute(CHAT_USER_SESSION_KEY); - if (chatUser == null) { - _log.debug("Chat user not logged in"); - return Action.LOGIN; - } - return invocation.invoke(); - } + public void destroy() { + } + + public void init() { + } + + public String intercept(ActionInvocation invocation) throws Exception { + HttpSession session = (HttpSession) ActionContext.getContext().get(ActionContext.SESSION); + User chatUser = (User) session.getAttribute(CHAT_USER_SESSION_KEY); + if (chatUser == null) { + _log.debug("Chat user not logged in"); + return Action.LOGIN; + } + return invocation.invoke(); + } } diff --git a/apps/showcase/src/main/java/org/apache/struts2/showcase/chat/ChatLoginAction.java b/apps/showcase/src/main/java/org/apache/struts2/showcase/chat/ChatLoginAction.java index 28450a7c8..570d54523 100644 --- a/apps/showcase/src/main/java/org/apache/struts2/showcase/chat/ChatLoginAction.java +++ b/apps/showcase/src/main/java/org/apache/struts2/showcase/chat/ChatLoginAction.java @@ -1,19 +1,22 @@ /* * $Id$ * - * Copyright 2006 The Apache Software Foundation. + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at + * http://www.apache.org/licenses/LICENSE-2.0 * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. */ package org.apache.struts2.showcase.chat; @@ -25,41 +28,41 @@ import com.opensymphony.xwork2.ActionSupport; public class ChatLoginAction extends ActionSupport implements SessionAware { - private static final long serialVersionUID = 1L; - - private ChatService chatService; - private Map session; - - private String name; - - public ChatLoginAction(ChatService chatService) { - this.chatService = chatService; - } - - public String getName() { - return this.name; - } - public void setName(String name) { - this.name = name; - } - - - public String execute() throws Exception { - try { - chatService.login(new User(name)); - session.put(ChatAuthenticationInterceptor.USER_SESSION_KEY, new User(name)); - } - catch(ChatException e) { - e.printStackTrace(); - addActionError(e.getMessage()); - return INPUT; - } - return SUCCESS; - } + private static final long serialVersionUID = 1L; - - // === SessionAware === - public void setSession(Map session) { - this.session = session; - } + private ChatService chatService; + private Map session; + + private String name; + + public ChatLoginAction(ChatService chatService) { + this.chatService = chatService; + } + + public String getName() { + return this.name; + } + public void setName(String name) { + this.name = name; + } + + + public String execute() throws Exception { + try { + chatService.login(new User(name)); + session.put(ChatAuthenticationInterceptor.USER_SESSION_KEY, new User(name)); + } + catch(ChatException e) { + e.printStackTrace(); + addActionError(e.getMessage()); + return INPUT; + } + return SUCCESS; + } + + + // === SessionAware === + public void setSession(Map session) { + this.session = session; + } } diff --git a/apps/showcase/src/main/java/org/apache/struts2/showcase/chat/ChatLogoutAction.java b/apps/showcase/src/main/java/org/apache/struts2/showcase/chat/ChatLogoutAction.java index 7f2d326f6..c4a4bcd5e 100644 --- a/apps/showcase/src/main/java/org/apache/struts2/showcase/chat/ChatLogoutAction.java +++ b/apps/showcase/src/main/java/org/apache/struts2/showcase/chat/ChatLogoutAction.java @@ -1,19 +1,22 @@ /* * $Id$ * - * Copyright 2006 The Apache Software Foundation. + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at + * http://www.apache.org/licenses/LICENSE-2.0 * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. */ package org.apache.struts2.showcase.chat; @@ -25,31 +28,31 @@ import com.opensymphony.xwork2.ActionSupport; public class ChatLogoutAction extends ActionSupport implements SessionAware { - private static final long serialVersionUID = 1L; + private static final long serialVersionUID = 1L; - private ChatService chatService; - - private Map session; - - - public ChatLogoutAction(ChatService chatService) { - this.chatService = chatService; - } - - public String execute() throws Exception { - - User user = (User) session.get(ChatAuthenticationInterceptor.USER_SESSION_KEY); - if (user != null) { - chatService.logout(user.getName()); - session.remove(ChatAuthenticationInterceptor.USER_SESSION_KEY); - } - - return SUCCESS; - } + private ChatService chatService; - - // === SessionAware === - public void setSession(Map session) { - this.session = session; - } + private Map session; + + + public ChatLogoutAction(ChatService chatService) { + this.chatService = chatService; + } + + public String execute() throws Exception { + + User user = (User) session.get(ChatAuthenticationInterceptor.USER_SESSION_KEY); + if (user != null) { + chatService.logout(user.getName()); + session.remove(ChatAuthenticationInterceptor.USER_SESSION_KEY); + } + + return SUCCESS; + } + + + // === SessionAware === + public void setSession(Map session) { + this.session = session; + } } diff --git a/apps/showcase/src/main/java/org/apache/struts2/showcase/chat/ChatMessage.java b/apps/showcase/src/main/java/org/apache/struts2/showcase/chat/ChatMessage.java index f2828b818..3426eec0e 100644 --- a/apps/showcase/src/main/java/org/apache/struts2/showcase/chat/ChatMessage.java +++ b/apps/showcase/src/main/java/org/apache/struts2/showcase/chat/ChatMessage.java @@ -1,46 +1,49 @@ /* * $Id$ * - * Copyright 2006 The Apache Software Foundation. + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at + * http://www.apache.org/licenses/LICENSE-2.0 * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. */ package org.apache.struts2.showcase.chat; import java.util.Date; public class ChatMessage { - - private Date creationDate; - private String message; - private User creator; - - public ChatMessage(String message, User creator) { - assert(message != null); - assert(creator != null); - - this.creationDate = new Date(System.currentTimeMillis()); - this.message = message; - this.creator = creator; - } - - public Date getCreationDate() { - return creationDate; - } - public User getCreator() { - return creator; - } - public String getMessage() { - return message; - } + + private Date creationDate; + private String message; + private User creator; + + public ChatMessage(String message, User creator) { + assert(message != null); + assert(creator != null); + + this.creationDate = new Date(System.currentTimeMillis()); + this.message = message; + this.creator = creator; + } + + public Date getCreationDate() { + return creationDate; + } + public User getCreator() { + return creator; + } + public String getMessage() { + return message; + } } diff --git a/apps/showcase/src/main/java/org/apache/struts2/showcase/chat/ChatService.java b/apps/showcase/src/main/java/org/apache/struts2/showcase/chat/ChatService.java index 91e31ab8a..907f77e00 100644 --- a/apps/showcase/src/main/java/org/apache/struts2/showcase/chat/ChatService.java +++ b/apps/showcase/src/main/java/org/apache/struts2/showcase/chat/ChatService.java @@ -1,34 +1,37 @@ /* * $Id$ * - * Copyright 2006 The Apache Software Foundation. + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at + * http://www.apache.org/licenses/LICENSE-2.0 * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. */ package org.apache.struts2.showcase.chat; import java.util.List; public interface ChatService { - List getAvailableUsers(); - void login(User user); - void logout(String name); - - List getAvailableRooms(); - void addRoom(Room room); - void enterRoom(User user, String roomName); - void exitRoom(String userName, String roomName); - List getMessagesInRoom(String roomName); - void sendMessageToRoom(String roomName, User user, String message); - List getUsersAvailableInRoom(String roomName); + List getAvailableUsers(); + void login(User user); + void logout(String name); + + List getAvailableRooms(); + void addRoom(Room room); + void enterRoom(User user, String roomName); + void exitRoom(String userName, String roomName); + List getMessagesInRoom(String roomName); + void sendMessageToRoom(String roomName, User user, String message); + List getUsersAvailableInRoom(String roomName); } diff --git a/apps/showcase/src/main/java/org/apache/struts2/showcase/chat/ChatServiceImpl.java b/apps/showcase/src/main/java/org/apache/struts2/showcase/chat/ChatServiceImpl.java index 3f90971ac..0cd783d7d 100644 --- a/apps/showcase/src/main/java/org/apache/struts2/showcase/chat/ChatServiceImpl.java +++ b/apps/showcase/src/main/java/org/apache/struts2/showcase/chat/ChatServiceImpl.java @@ -1,19 +1,22 @@ /* * $Id$ * - * Copyright 2006 The Apache Software Foundation. + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at + * http://www.apache.org/licenses/LICENSE-2.0 * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. */ package org.apache.struts2.showcase.chat; @@ -23,90 +26,90 @@ import java.util.List; import java.util.Map; public class ChatServiceImpl implements ChatService { - - private Map availableUsers = new LinkedHashMap(); - private Map availableRooms = new LinkedHashMap(); - - - public List getAvailableUsers() { - return new ArrayList(availableUsers.values()); - } - public List getAvailableRooms() { - return new ArrayList(availableRooms.values()); - } + private Map availableUsers = new LinkedHashMap(); + private Map availableRooms = new LinkedHashMap(); - public void addRoom(Room room) { - if (availableRooms.containsKey(room.getName())) { - throw new ChatException("room ["+room.getName()+"] is already available", ChatException.ErrorType.valueOf("ROOM_ALREADY_EXISTS")); - } - availableRooms.put(room.getName(), room); - } - - public void login(User user) { - assert(user != null); - if (availableUsers.containsKey(user.getName())) { - throw new ChatException("User ["+user.getName()+"] already exists", ChatException.ErrorType.valueOf("USER_ALREADY_EXISTS")); - } - availableUsers.put(user.getName(), user); - } - public void logout(String name) { - assert(name != null); - assert(name.trim().length() > 0); - availableUsers.remove(name); - for (Room room : availableRooms.values()) { - if (room.hasMember(name)) { - room.memberExit(name); - } - } - } + public List getAvailableUsers() { + return new ArrayList(availableUsers.values()); + } - public void exitRoom(String userName, String roomName) { - assert(roomName != null); - assert(roomName.trim().length()> 0); - - if (availableRooms.containsKey(roomName)) { - Room room = availableRooms.get(roomName); - room.memberExit(userName); - } - } - - public void enterRoom(User user, String roomName) { - assert(roomName != null); - assert(roomName.trim().length() > 0); - if (! availableRooms.containsKey(roomName)) { - throw new ChatException("No such room exists ["+roomName+"]", ChatException.ErrorType.NO_SUCH_ROOM_EXISTS); - } - Room room = availableRooms.get(roomName); - room.memberEnter(user); - } + public List getAvailableRooms() { + return new ArrayList(availableRooms.values()); + } - public List getMessagesInRoom(String roomName) { - assert(roomName != null); - assert(roomName.trim().length() > 0); - if (! availableRooms.containsKey(roomName)) { - throw new ChatException("No such room exists ["+roomName+"]", ChatException.ErrorType.NO_SUCH_ROOM_EXISTS); - } - Room room = availableRooms.get(roomName); - return room.getChatMessages(); - } + public void addRoom(Room room) { + if (availableRooms.containsKey(room.getName())) { + throw new ChatException("room ["+room.getName()+"] is already available", ChatException.ErrorType.valueOf("ROOM_ALREADY_EXISTS")); + } + availableRooms.put(room.getName(), room); + } - public void sendMessageToRoom(String roomName, User user, String message) { - assert(roomName != null); - if (! availableRooms.containsKey(roomName)) { - throw new ChatException("No such room exists ["+roomName+"]", ChatException.ErrorType.NO_SUCH_ROOM_EXISTS); - } - Room room = availableRooms.get(roomName); - room.addMessage(new ChatMessage(message, user)); - } + public void login(User user) { + assert(user != null); + if (availableUsers.containsKey(user.getName())) { + throw new ChatException("User ["+user.getName()+"] already exists", ChatException.ErrorType.valueOf("USER_ALREADY_EXISTS")); + } + availableUsers.put(user.getName(), user); + } - public List getUsersAvailableInRoom(String roomName) { - assert(roomName != null); - if (! availableRooms.containsKey(roomName)) { - throw new ChatException("No such room exists ["+roomName+"]", ChatException.ErrorType.NO_SUCH_ROOM_EXISTS); - } - Room room = availableRooms.get(roomName); - return room.getMembers(); - } + public void logout(String name) { + assert(name != null); + assert(name.trim().length() > 0); + availableUsers.remove(name); + for (Room room : availableRooms.values()) { + if (room.hasMember(name)) { + room.memberExit(name); + } + } + } + + public void exitRoom(String userName, String roomName) { + assert(roomName != null); + assert(roomName.trim().length()> 0); + + if (availableRooms.containsKey(roomName)) { + Room room = availableRooms.get(roomName); + room.memberExit(userName); + } + } + + public void enterRoom(User user, String roomName) { + assert(roomName != null); + assert(roomName.trim().length() > 0); + if (! availableRooms.containsKey(roomName)) { + throw new ChatException("No such room exists ["+roomName+"]", ChatException.ErrorType.NO_SUCH_ROOM_EXISTS); + } + Room room = availableRooms.get(roomName); + room.memberEnter(user); + } + + public List getMessagesInRoom(String roomName) { + assert(roomName != null); + assert(roomName.trim().length() > 0); + if (! availableRooms.containsKey(roomName)) { + throw new ChatException("No such room exists ["+roomName+"]", ChatException.ErrorType.NO_SUCH_ROOM_EXISTS); + } + Room room = availableRooms.get(roomName); + return room.getChatMessages(); + } + + public void sendMessageToRoom(String roomName, User user, String message) { + assert(roomName != null); + if (! availableRooms.containsKey(roomName)) { + throw new ChatException("No such room exists ["+roomName+"]", ChatException.ErrorType.NO_SUCH_ROOM_EXISTS); + } + Room room = availableRooms.get(roomName); + room.addMessage(new ChatMessage(message, user)); + } + + public List getUsersAvailableInRoom(String roomName) { + assert(roomName != null); + if (! availableRooms.containsKey(roomName)) { + throw new ChatException("No such room exists ["+roomName+"]", ChatException.ErrorType.NO_SUCH_ROOM_EXISTS); + } + Room room = availableRooms.get(roomName); + return room.getMembers(); + } } diff --git a/apps/showcase/src/main/java/org/apache/struts2/showcase/chat/ChatSessionListener.java b/apps/showcase/src/main/java/org/apache/struts2/showcase/chat/ChatSessionListener.java index 57acc1461..0e6d430fe 100644 --- a/apps/showcase/src/main/java/org/apache/struts2/showcase/chat/ChatSessionListener.java +++ b/apps/showcase/src/main/java/org/apache/struts2/showcase/chat/ChatSessionListener.java @@ -1,19 +1,22 @@ /* * $Id$ * - * Copyright 2006 The Apache Software Foundation. + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at + * http://www.apache.org/licenses/LICENSE-2.0 * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. */ package org.apache.struts2.showcase.chat; @@ -28,23 +31,23 @@ import org.springframework.web.context.support.WebApplicationContextUtils; public class ChatSessionListener implements HttpSessionListener { - private static final Log _log = LogFactory.getLog(ChatSessionListener.class); - - public void sessionCreated(HttpSessionEvent event) { - } + private static final Log _log = LogFactory.getLog(ChatSessionListener.class); - public void sessionDestroyed(HttpSessionEvent event) { - HttpSession session = event.getSession(); - WebApplicationContext context = WebApplicationContextUtils.getWebApplicationContext(session.getServletContext()); - if (context != null) { - User user = (User) session.getAttribute(ChatInterceptor.CHAT_USER_SESSION_KEY); - if (user != null) { - ChatService service = (ChatService) context.getBean("chatService"); - service.logout(user.getName()); - - _log.info("session expired, logged user ["+user.getName()+"] out"); - } - } - } + public void sessionCreated(HttpSessionEvent event) { + } + + public void sessionDestroyed(HttpSessionEvent event) { + HttpSession session = event.getSession(); + WebApplicationContext context = WebApplicationContextUtils.getWebApplicationContext(session.getServletContext()); + if (context != null) { + User user = (User) session.getAttribute(ChatInterceptor.CHAT_USER_SESSION_KEY); + if (user != null) { + ChatService service = (ChatService) context.getBean("chatService"); + service.logout(user.getName()); + + _log.info("session expired, logged user ["+user.getName()+"] out"); + } + } + } } diff --git a/apps/showcase/src/main/java/org/apache/struts2/showcase/chat/Constants.java b/apps/showcase/src/main/java/org/apache/struts2/showcase/chat/Constants.java index 59435246e..39ad1fb4d 100644 --- a/apps/showcase/src/main/java/org/apache/struts2/showcase/chat/Constants.java +++ b/apps/showcase/src/main/java/org/apache/struts2/showcase/chat/Constants.java @@ -1,22 +1,25 @@ /* * $Id$ * - * Copyright 2006 The Apache Software Foundation. + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at + * http://www.apache.org/licenses/LICENSE-2.0 * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. */ package org.apache.struts2.showcase.chat; public class Constants { - public static String UPDATE_FREQ = "30000"; + public static String UPDATE_FREQ = "30000"; } diff --git a/apps/showcase/src/main/java/org/apache/struts2/showcase/chat/CrudRoomAction.java b/apps/showcase/src/main/java/org/apache/struts2/showcase/chat/CrudRoomAction.java index 307742720..dcbf24096 100644 --- a/apps/showcase/src/main/java/org/apache/struts2/showcase/chat/CrudRoomAction.java +++ b/apps/showcase/src/main/java/org/apache/struts2/showcase/chat/CrudRoomAction.java @@ -1,19 +1,22 @@ /* * $Id$ * - * Copyright 2006 The Apache Software Foundation. + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at + * http://www.apache.org/licenses/LICENSE-2.0 * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. */ package org.apache.struts2.showcase.chat; @@ -21,41 +24,41 @@ import com.opensymphony.xwork2.ActionSupport; public class CrudRoomAction extends ActionSupport { - private static final long serialVersionUID = 1L; + private static final long serialVersionUID = 1L; - private ChatService chatService; - - private String name; - private String description; - - - public String getDescription() { - return description; - } + private ChatService chatService; - public void setDescription(String description) { - this.description = description; - } + private String name; + private String description; - public String getName() { - return name; - } - public void setName(String name) { - this.name = name; - } + public String getDescription() { + return description; + } - public CrudRoomAction(ChatService chatService) { - this.chatService = chatService; - } - - public String create() throws Exception { - try { - chatService.addRoom(new Room(name, description)); - } - catch(ChatException e) { - addActionError(e.getMessage()); - } - return SUCCESS; - } + public void setDescription(String description) { + this.description = description; + } + + public String getName() { + return name; + } + + public void setName(String name) { + this.name = name; + } + + public CrudRoomAction(ChatService chatService) { + this.chatService = chatService; + } + + public String create() throws Exception { + try { + chatService.addRoom(new Room(name, description)); + } + catch(ChatException e) { + addActionError(e.getMessage()); + } + return SUCCESS; + } } diff --git a/apps/showcase/src/main/java/org/apache/struts2/showcase/chat/DateConverter.java b/apps/showcase/src/main/java/org/apache/struts2/showcase/chat/DateConverter.java index d2c89ae35..72b707813 100644 --- a/apps/showcase/src/main/java/org/apache/struts2/showcase/chat/DateConverter.java +++ b/apps/showcase/src/main/java/org/apache/struts2/showcase/chat/DateConverter.java @@ -1,19 +1,22 @@ /* * $Id$ * - * Copyright 2006 The Apache Software Foundation. + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at + * http://www.apache.org/licenses/LICENSE-2.0 * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. */ package org.apache.struts2.showcase.chat; @@ -27,30 +30,30 @@ import org.apache.commons.logging.LogFactory; import org.apache.struts2.util.StrutsTypeConverter; public class DateConverter extends StrutsTypeConverter { - - private static final Log _log = LogFactory.getLog(DateConverter.class); - public Object convertFromString(Map context, String[] values, Class toClass) { - - if (values.length > 0 && values[0] != null && values[0].trim().length() > 0) { - SimpleDateFormat sdf = new SimpleDateFormat(); - try { - return sdf.parse(values[0]); - } - catch(ParseException e) { - _log.error("error converting value ["+values[0]+"] to Date ", e); - } - } - return null; - } + private static final Log _log = LogFactory.getLog(DateConverter.class); - public String convertToString(Map context, Object o) { - - if (o instanceof Date) { - SimpleDateFormat sdf = new SimpleDateFormat("dd/MM/yyyy hh:mm:ss"); - return sdf.format((Date) o); - } - return ""; - } + public Object convertFromString(Map context, String[] values, Class toClass) { + + if (values.length > 0 && values[0] != null && values[0].trim().length() > 0) { + SimpleDateFormat sdf = new SimpleDateFormat(); + try { + return sdf.parse(values[0]); + } + catch(ParseException e) { + _log.error("error converting value ["+values[0]+"] to Date ", e); + } + } + return null; + } + + public String convertToString(Map context, Object o) { + + if (o instanceof Date) { + SimpleDateFormat sdf = new SimpleDateFormat("dd/MM/yyyy hh:mm:ss"); + return sdf.format((Date) o); + } + return ""; + } } diff --git a/apps/showcase/src/main/java/org/apache/struts2/showcase/chat/EnterRoomAction.java b/apps/showcase/src/main/java/org/apache/struts2/showcase/chat/EnterRoomAction.java index 707e3b5b1..52e872258 100644 --- a/apps/showcase/src/main/java/org/apache/struts2/showcase/chat/EnterRoomAction.java +++ b/apps/showcase/src/main/java/org/apache/struts2/showcase/chat/EnterRoomAction.java @@ -1,19 +1,22 @@ /* * $Id$ * - * Copyright 2006 The Apache Software Foundation. + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at + * http://www.apache.org/licenses/LICENSE-2.0 * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. */ package org.apache.struts2.showcase.chat; @@ -25,35 +28,35 @@ import com.opensymphony.xwork2.ActionSupport; public class EnterRoomAction extends ActionSupport implements SessionAware { - private static final long serialVersionUID = 1L; - - private ChatService chatService; - private Map session; - private String roomName; - - public String getRoomName() { return this.roomName; } - public void setRoomName(String roomName) { this.roomName = roomName; } - - public EnterRoomAction(ChatService chatService) { - this.chatService = chatService; - } - - public String execute() throws Exception { - - User user = (User) session.get(ChatAuthenticationInterceptor.USER_SESSION_KEY); - try { - chatService.enterRoom(user, roomName); - } - catch(Exception e) { - addActionError(e.getMessage()); - } - return SUCCESS; - } + private static final long serialVersionUID = 1L; + + private ChatService chatService; + private Map session; + private String roomName; + + public String getRoomName() { return this.roomName; } + public void setRoomName(String roomName) { this.roomName = roomName; } + + public EnterRoomAction(ChatService chatService) { + this.chatService = chatService; + } + + public String execute() throws Exception { + + User user = (User) session.get(ChatAuthenticationInterceptor.USER_SESSION_KEY); + try { + chatService.enterRoom(user, roomName); + } + catch(Exception e) { + addActionError(e.getMessage()); + } + return SUCCESS; + } + + + // === SessionAware === + public void setSession(Map session) { + this.session = session; + } - - // === SessionAware === - public void setSession(Map session) { - this.session = session; - } - } diff --git a/apps/showcase/src/main/java/org/apache/struts2/showcase/chat/ExitRoomAction.java b/apps/showcase/src/main/java/org/apache/struts2/showcase/chat/ExitRoomAction.java index 2ff90a5f9..5d0990f04 100644 --- a/apps/showcase/src/main/java/org/apache/struts2/showcase/chat/ExitRoomAction.java +++ b/apps/showcase/src/main/java/org/apache/struts2/showcase/chat/ExitRoomAction.java @@ -1,19 +1,22 @@ /* * $Id$ * - * Copyright 2006 The Apache Software Foundation. + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at + * http://www.apache.org/licenses/LICENSE-2.0 * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. */ package org.apache.struts2.showcase.chat; @@ -25,31 +28,31 @@ import com.opensymphony.xwork2.ActionSupport; public class ExitRoomAction extends ActionSupport implements SessionAware { - private static final long serialVersionUID = 1L; + private static final long serialVersionUID = 1L; + + private String roomName; + + private Map session; + + public String getRoomName() { return roomName; } + public void setRoomName(String roomName) { this.roomName = roomName; } + + private ChatService chatService; + + public ExitRoomAction(ChatService chatService) { + this.chatService = chatService; + } + + public String execute() throws Exception { + User user = (User) session.get(ChatAuthenticationInterceptor.USER_SESSION_KEY); + chatService.exitRoom(user.getName(), roomName); + + return SUCCESS; + } + + // === SessionAware === + public void setSession(Map session) { + this.session = session; + } - private String roomName; - - private Map session; - - public String getRoomName() { return roomName; } - public void setRoomName(String roomName) { this.roomName = roomName; } - - private ChatService chatService; - - public ExitRoomAction(ChatService chatService) { - this.chatService = chatService; - } - - public String execute() throws Exception { - User user = (User) session.get(ChatAuthenticationInterceptor.USER_SESSION_KEY); - chatService.exitRoom(user.getName(), roomName); - - return SUCCESS; - } - - // === SessionAware === - public void setSession(Map session) { - this.session = session; - } - } diff --git a/apps/showcase/src/main/java/org/apache/struts2/showcase/chat/MessagesAvailableInRoomAction.java b/apps/showcase/src/main/java/org/apache/struts2/showcase/chat/MessagesAvailableInRoomAction.java index 427a2b9ee..ffb6e54e3 100644 --- a/apps/showcase/src/main/java/org/apache/struts2/showcase/chat/MessagesAvailableInRoomAction.java +++ b/apps/showcase/src/main/java/org/apache/struts2/showcase/chat/MessagesAvailableInRoomAction.java @@ -1,19 +1,22 @@ /* * $Id$ * - * Copyright 2006 The Apache Software Foundation. + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at + * http://www.apache.org/licenses/LICENSE-2.0 * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. */ package org.apache.struts2.showcase.chat; @@ -24,33 +27,33 @@ import com.opensymphony.xwork2.ActionSupport; public class MessagesAvailableInRoomAction extends ActionSupport { - private static final long serialVersionUID = 1L; + private static final long serialVersionUID = 1L; + + private String roomName; + private ChatService chatService; + private List messagesAvailableInRoom = new ArrayList(); + + public String getRoomName() { return this.roomName; } + public void setRoomName(String roomName) { + this.roomName = roomName; + } + + public List getMessagesAvailableInRoom() { + return messagesAvailableInRoom; + } + + public MessagesAvailableInRoomAction(ChatService chatService) { + this.chatService = chatService; + } + + public String execute() throws Exception { + try { + messagesAvailableInRoom = chatService.getMessagesInRoom(roomName); + } + catch(ChatException e) { + addActionError(e.getMessage()); + } + return SUCCESS; + } - private String roomName; - private ChatService chatService; - private List messagesAvailableInRoom = new ArrayList(); - - public String getRoomName() { return this.roomName; } - public void setRoomName(String roomName) { - this.roomName = roomName; - } - - public List getMessagesAvailableInRoom() { - return messagesAvailableInRoom; - } - - public MessagesAvailableInRoomAction(ChatService chatService) { - this.chatService = chatService; - } - - public String execute() throws Exception { - try { - messagesAvailableInRoom = chatService.getMessagesInRoom(roomName); - } - catch(ChatException e) { - addActionError(e.getMessage()); - } - return SUCCESS; - } - } diff --git a/apps/showcase/src/main/java/org/apache/struts2/showcase/chat/Room.java b/apps/showcase/src/main/java/org/apache/struts2/showcase/chat/Room.java index 9ab85da73..1ac856ef7 100644 --- a/apps/showcase/src/main/java/org/apache/struts2/showcase/chat/Room.java +++ b/apps/showcase/src/main/java/org/apache/struts2/showcase/chat/Room.java @@ -1,19 +1,22 @@ /* * $Id$ * - * Copyright 2006 The Apache Software Foundation. + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at + * http://www.apache.org/licenses/LICENSE-2.0 * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. */ package org.apache.struts2.showcase.chat; @@ -24,75 +27,75 @@ import java.util.List; import java.util.Map; public class Room { - - private static final int MAX_CHAT_MESSAGES = 10; - - private String name; - private String description; - private Date creationDate; - - private List messages = new ArrayList(); - - private Map members = new LinkedHashMap(); - - public Room(String name, String description) { - this.name = name; - this.description = description; - this.creationDate = new Date(System.currentTimeMillis()); - } - - - // properties - public Date getCreationDate() { - return creationDate; - } - public String getDescription() { - return description; - } + private static final int MAX_CHAT_MESSAGES = 10; - public String getName() { - return name; - } - - - // (behaviour) members - public List getMembers() { - return new ArrayList(members.values()); - } - public User findMember(String name) { - assert(name != null); - return members.get(name); - } - public boolean hasMember(String name) { - assert(name != null); - return members.containsKey(name); - } - public void memberEnter(User member) { - assert(member != null); - if (! hasMember(member.getName())) { - members.put(member.getName(), member); - } - } - - public void memberExit(String memberName) { - assert(memberName != null); - assert(memberName.trim().length() > 0); - members.remove(memberName); - } + private String name; + private String description; + private Date creationDate; + + private List messages = new ArrayList(); + + private Map members = new LinkedHashMap(); + + public Room(String name, String description) { + this.name = name; + this.description = description; + this.creationDate = new Date(System.currentTimeMillis()); + } + + + // properties + public Date getCreationDate() { + return creationDate; + } + + public String getDescription() { + return description; + } + + public String getName() { + return name; + } + + + // (behaviour) members + public List getMembers() { + return new ArrayList(members.values()); + } + public User findMember(String name) { + assert(name != null); + return members.get(name); + } + public boolean hasMember(String name) { + assert(name != null); + return members.containsKey(name); + } + public void memberEnter(User member) { + assert(member != null); + if (! hasMember(member.getName())) { + members.put(member.getName(), member); + } + } + + public void memberExit(String memberName) { + assert(memberName != null); + assert(memberName.trim().length() > 0); + members.remove(memberName); + } + + + // (behaviour) chat messags + public void addMessage(ChatMessage chatMessage) { + if (messages.size() > MAX_CHAT_MESSAGES) { + // messages.remove(messages.size() - 1); + messages.remove(0); + } + messages.add(chatMessage); + } + + public List getChatMessages() { + return new ArrayList(messages); + } - - // (behaviour) chat messags - public void addMessage(ChatMessage chatMessage) { - if (messages.size() > MAX_CHAT_MESSAGES) { - // messages.remove(messages.size() - 1); - messages.remove(0); - } - messages.add(chatMessage); - } - - public List getChatMessages() { - return new ArrayList(messages); - } - } diff --git a/apps/showcase/src/main/java/org/apache/struts2/showcase/chat/RoomsAvailableAction.java b/apps/showcase/src/main/java/org/apache/struts2/showcase/chat/RoomsAvailableAction.java index 111420bd7..25084d4ee 100644 --- a/apps/showcase/src/main/java/org/apache/struts2/showcase/chat/RoomsAvailableAction.java +++ b/apps/showcase/src/main/java/org/apache/struts2/showcase/chat/RoomsAvailableAction.java @@ -1,19 +1,22 @@ /* * $Id$ * - * Copyright 2006 The Apache Software Foundation. + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at + * http://www.apache.org/licenses/LICENSE-2.0 * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. */ package org.apache.struts2.showcase.chat; @@ -24,22 +27,22 @@ import com.opensymphony.xwork2.ActionSupport; public class RoomsAvailableAction extends ActionSupport { - private static final long serialVersionUID = 1L; + private static final long serialVersionUID = 1L; - private List availableRooms = new ArrayList(); - - private ChatService chatService; - - public RoomsAvailableAction(ChatService chatService) { - this.chatService = chatService; - } - - public String execute() throws Exception { - availableRooms = chatService.getAvailableRooms(); - return SUCCESS; - } - - public List getAvailableRooms() { - return availableRooms; - } + private List availableRooms = new ArrayList(); + + private ChatService chatService; + + public RoomsAvailableAction(ChatService chatService) { + this.chatService = chatService; + } + + public String execute() throws Exception { + availableRooms = chatService.getAvailableRooms(); + return SUCCESS; + } + + public List getAvailableRooms() { + return availableRooms; + } } diff --git a/apps/showcase/src/main/java/org/apache/struts2/showcase/chat/SendMessageToRoomAction.java b/apps/showcase/src/main/java/org/apache/struts2/showcase/chat/SendMessageToRoomAction.java index 42875d78d..a24e6c6c1 100644 --- a/apps/showcase/src/main/java/org/apache/struts2/showcase/chat/SendMessageToRoomAction.java +++ b/apps/showcase/src/main/java/org/apache/struts2/showcase/chat/SendMessageToRoomAction.java @@ -1,19 +1,22 @@ /* * $Id$ * - * Copyright 2006 The Apache Software Foundation. + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at + * http://www.apache.org/licenses/LICENSE-2.0 * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. */ package org.apache.struts2.showcase.chat; @@ -25,43 +28,43 @@ import com.opensymphony.xwork2.ActionSupport; public class SendMessageToRoomAction extends ActionSupport implements SessionAware { - private static final long serialVersionUID = 1L; - - private ChatService chatService; - - private String roomName; - private String message; - private Map session; - - - public SendMessageToRoomAction(ChatService chatService) { - this.chatService = chatService; - } - - public String getRoomName() { return this.roomName; } - public void setRoomName(String roomName) { - this.roomName = roomName; - } - - public String getMessage() { return this.message; } - public void setMessage(String message) { - this.message = message; - } - - - public String execute() throws Exception { - User user = (User) session.get(ChatAuthenticationInterceptor.USER_SESSION_KEY); - try { - chatService.sendMessageToRoom(roomName, user, message); - }catch(ChatException e) { - addActionError(e.getMessage()); - } - return SUCCESS; - } + private static final long serialVersionUID = 1L; + + private ChatService chatService; + + private String roomName; + private String message; + private Map session; + + + public SendMessageToRoomAction(ChatService chatService) { + this.chatService = chatService; + } + + public String getRoomName() { return this.roomName; } + public void setRoomName(String roomName) { + this.roomName = roomName; + } + + public String getMessage() { return this.message; } + public void setMessage(String message) { + this.message = message; + } + + + public String execute() throws Exception { + User user = (User) session.get(ChatAuthenticationInterceptor.USER_SESSION_KEY); + try { + chatService.sendMessageToRoom(roomName, user, message); + }catch(ChatException e) { + addActionError(e.getMessage()); + } + return SUCCESS; + } + + public void setSession(Map session) { + this.session = session; + } - public void setSession(Map session) { - this.session = session; - } - } diff --git a/apps/showcase/src/main/java/org/apache/struts2/showcase/chat/User.java b/apps/showcase/src/main/java/org/apache/struts2/showcase/chat/User.java index 8ca098d62..b649aca5d 100644 --- a/apps/showcase/src/main/java/org/apache/struts2/showcase/chat/User.java +++ b/apps/showcase/src/main/java/org/apache/struts2/showcase/chat/User.java @@ -1,19 +1,22 @@ /* * $Id$ * - * Copyright 2006 The Apache Software Foundation. + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at + * http://www.apache.org/licenses/LICENSE-2.0 * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. */ package org.apache.struts2.showcase.chat; @@ -24,22 +27,22 @@ import java.util.Date; * Represends a user in the Chat example. */ public class User implements Serializable { - - private static final long serialVersionUID = -1434958919516089297L; - - private String name; - private Date creationDate; - - - public User(String name) { - this.name = name; - this.creationDate = new Date(System.currentTimeMillis()); - } - - public Date getCreationDate() { - return creationDate; - } - public String getName() { - return name; - } + + private static final long serialVersionUID = -1434958919516089297L; + + private String name; + private Date creationDate; + + + public User(String name) { + this.name = name; + this.creationDate = new Date(System.currentTimeMillis()); + } + + public Date getCreationDate() { + return creationDate; + } + public String getName() { + return name; + } } diff --git a/apps/showcase/src/main/java/org/apache/struts2/showcase/chat/UsersAvailableAction.java b/apps/showcase/src/main/java/org/apache/struts2/showcase/chat/UsersAvailableAction.java index 82886fe06..eae9a8cfe 100644 --- a/apps/showcase/src/main/java/org/apache/struts2/showcase/chat/UsersAvailableAction.java +++ b/apps/showcase/src/main/java/org/apache/struts2/showcase/chat/UsersAvailableAction.java @@ -1,19 +1,22 @@ /* * $Id$ * - * Copyright 2006 The Apache Software Foundation. + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at + * http://www.apache.org/licenses/LICENSE-2.0 * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. */ package org.apache.struts2.showcase.chat; @@ -24,23 +27,23 @@ import com.opensymphony.xwork2.ActionSupport; public class UsersAvailableAction extends ActionSupport { - private static final long serialVersionUID = 1L; - - private List availableUsers = new ArrayList(); - private ChatService chatService; - - public UsersAvailableAction(ChatService chatService) { - this.chatService = chatService; - } - - public String execute() throws Exception { - - availableUsers = chatService.getAvailableUsers(); - - return SUCCESS; - } - - public List getAvailableUsers() { - return availableUsers; - } + private static final long serialVersionUID = 1L; + + private List availableUsers = new ArrayList(); + private ChatService chatService; + + public UsersAvailableAction(ChatService chatService) { + this.chatService = chatService; + } + + public String execute() throws Exception { + + availableUsers = chatService.getAvailableUsers(); + + return SUCCESS; + } + + public List getAvailableUsers() { + return availableUsers; + } } diff --git a/apps/showcase/src/main/java/org/apache/struts2/showcase/chat/UsersAvailableInRoomAction.java b/apps/showcase/src/main/java/org/apache/struts2/showcase/chat/UsersAvailableInRoomAction.java index 96db8aae8..f56f4334c 100644 --- a/apps/showcase/src/main/java/org/apache/struts2/showcase/chat/UsersAvailableInRoomAction.java +++ b/apps/showcase/src/main/java/org/apache/struts2/showcase/chat/UsersAvailableInRoomAction.java @@ -1,19 +1,22 @@ /* * $Id$ * - * Copyright 2006 The Apache Software Foundation. + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at + * http://www.apache.org/licenses/LICENSE-2.0 * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. */ package org.apache.struts2.showcase.chat; @@ -24,35 +27,35 @@ import com.opensymphony.xwork2.ActionSupport; public class UsersAvailableInRoomAction extends ActionSupport { - private static final long serialVersionUID = 1L; - - private ChatService chatService; - private List usersAvailableInRoom = new ArrayList(); - - private String roomName; - - public UsersAvailableInRoomAction(ChatService chatService) { - this.chatService = chatService; - } - - - public String getRoomName() { return this.roomName; } - public void setRoomName(String roomName) { - this.roomName = roomName; - } - - public List getUsersAvailableInRoom() { - return usersAvailableInRoom; - } - - public String execute() throws Exception { - try { - usersAvailableInRoom = chatService.getUsersAvailableInRoom(roomName); - } - catch(ChatException e) { - addActionError(e.getMessage()); - } - return SUCCESS; - } + private static final long serialVersionUID = 1L; + + private ChatService chatService; + private List usersAvailableInRoom = new ArrayList(); + + private String roomName; + + public UsersAvailableInRoomAction(ChatService chatService) { + this.chatService = chatService; + } + + + public String getRoomName() { return this.roomName; } + public void setRoomName(String roomName) { + this.roomName = roomName; + } + + public List getUsersAvailableInRoom() { + return usersAvailableInRoom; + } + + public String execute() throws Exception { + try { + usersAvailableInRoom = chatService.getUsersAvailableInRoom(roomName); + } + catch(ChatException e) { + addActionError(e.getMessage()); + } + return SUCCESS; + } } diff --git a/apps/showcase/src/main/java/org/apache/struts2/showcase/conversion/Address.java b/apps/showcase/src/main/java/org/apache/struts2/showcase/conversion/Address.java index bf501834e..e928c64cc 100644 --- a/apps/showcase/src/main/java/org/apache/struts2/showcase/conversion/Address.java +++ b/apps/showcase/src/main/java/org/apache/struts2/showcase/conversion/Address.java @@ -1,19 +1,22 @@ /* - * $Id: Person.java 440597 2006-09-06 03:34:39Z tmjee $ + * $Id: $ * - * Copyright 2006 The Apache Software Foundation. + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at + * http://www.apache.org/licenses/LICENSE-2.0 * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. */ package org.apache.struts2.showcase.conversion; @@ -22,14 +25,14 @@ package org.apache.struts2.showcase.conversion; * @version $Date$ $Id$ */ public class Address { - - private String id; - private String address; - - public String getId() { return id; } - public void setId(String id) { this.id = id; } - - public String getAddress() { return address; } - public void setAddress(String address) { this.address = address; } - + + private String id; + private String address; + + public String getId() { return id; } + public void setId(String id) { this.id = id; } + + public String getAddress() { return address; } + public void setAddress(String address) { this.address = address; } + } diff --git a/apps/showcase/src/main/java/org/apache/struts2/showcase/conversion/AddressAction.java b/apps/showcase/src/main/java/org/apache/struts2/showcase/conversion/AddressAction.java index 35f17f5fd..d7f316d62 100644 --- a/apps/showcase/src/main/java/org/apache/struts2/showcase/conversion/AddressAction.java +++ b/apps/showcase/src/main/java/org/apache/struts2/showcase/conversion/AddressAction.java @@ -1,19 +1,22 @@ /* - * $Id: Person.java 440597 2006-09-06 03:34:39Z tmjee $ + * $Id: $ * - * Copyright 2006 The Apache Software Foundation. + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at + * http://www.apache.org/licenses/LICENSE-2.0 * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. */ package org.apache.struts2.showcase.conversion; @@ -27,18 +30,18 @@ import com.opensymphony.xwork2.ActionSupport; */ public class AddressAction extends ActionSupport { - private Set addresses = new LinkedHashSet(); - - public Set getAddresses() { return addresses; } - public void setAddresses(Set addresses) { this.addresses = addresses; } - - - public String input() throws Exception { - return SUCCESS; - } - - public String submit() throws Exception { - System.out.println(addresses); - return SUCCESS; - } + private Set addresses = new LinkedHashSet(); + + public Set getAddresses() { return addresses; } + public void setAddresses(Set addresses) { this.addresses = addresses; } + + + public String input() throws Exception { + return SUCCESS; + } + + public String submit() throws Exception { + System.out.println(addresses); + return SUCCESS; + } } diff --git a/apps/showcase/src/main/java/org/apache/struts2/showcase/conversion/EnumTypeConverter.java b/apps/showcase/src/main/java/org/apache/struts2/showcase/conversion/EnumTypeConverter.java index 0a1b1aa38..cb3df2673 100644 --- a/apps/showcase/src/main/java/org/apache/struts2/showcase/conversion/EnumTypeConverter.java +++ b/apps/showcase/src/main/java/org/apache/struts2/showcase/conversion/EnumTypeConverter.java @@ -1,19 +1,22 @@ /* - * $Id: Person.java 440597 2006-09-06 03:34:39Z tmjee $ + * $Id: $ * - * Copyright 2006 The Apache Software Foundation. + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at + * http://www.apache.org/licenses/LICENSE-2.0 * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. */ package org.apache.struts2.showcase.conversion; @@ -29,27 +32,27 @@ import org.apache.struts2.util.StrutsTypeConverter; */ public class EnumTypeConverter extends StrutsTypeConverter { - @Override - public Object convertFromString(Map context, String[] values, Class toClass) { - List result = new ArrayList(); - for (int a=0; a< values.length; a++) { - Enum e = Enum.valueOf(OperationsEnum.class, values[a]); - if (e != null) - result.add(e); - } - return result; - } + @Override + public Object convertFromString(Map context, String[] values, Class toClass) { + List result = new ArrayList(); + for (int a=0; a< values.length; a++) { + Enum e = Enum.valueOf(OperationsEnum.class, values[a]); + if (e != null) + result.add(e); + } + return result; + } + + @Override + public String convertToString(Map context, Object o) { + List l = (List) o; + String result ="<"; + for (Iterator i = l.iterator(); i.hasNext(); ) { + result = result + "["+ i.next() +"]"; + } + result = result+">"; + return result; + } - @Override - public String convertToString(Map context, Object o) { - List l = (List) o; - String result ="<"; - for (Iterator i = l.iterator(); i.hasNext(); ) { - result = result + "["+ i.next() +"]"; - } - result = result+">"; - return result; - } - } diff --git a/apps/showcase/src/main/java/org/apache/struts2/showcase/conversion/OperationsEnum.java b/apps/showcase/src/main/java/org/apache/struts2/showcase/conversion/OperationsEnum.java index 2db119448..3c23398ea 100644 --- a/apps/showcase/src/main/java/org/apache/struts2/showcase/conversion/OperationsEnum.java +++ b/apps/showcase/src/main/java/org/apache/struts2/showcase/conversion/OperationsEnum.java @@ -1,30 +1,33 @@ /* - * $Id: Person.java 440597 2006-09-06 03:34:39Z tmjee $ + * $Id: $ * - * Copyright 2006 The Apache Software Foundation. + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at + * http://www.apache.org/licenses/LICENSE-2.0 * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. */ package org.apache.struts2.showcase.conversion; /** - * + * * @version $Date$ $Id$ */ public enum OperationsEnum { - ADD, - MINUS, - DIVIDE, - MULTIPLY, - REMAINDER; + ADD, + MINUS, + DIVIDE, + MULTIPLY, + REMAINDER; } diff --git a/apps/showcase/src/main/java/org/apache/struts2/showcase/conversion/OperationsEnumAction.java b/apps/showcase/src/main/java/org/apache/struts2/showcase/conversion/OperationsEnumAction.java index ee2327ff3..cb0259195 100644 --- a/apps/showcase/src/main/java/org/apache/struts2/showcase/conversion/OperationsEnumAction.java +++ b/apps/showcase/src/main/java/org/apache/struts2/showcase/conversion/OperationsEnumAction.java @@ -1,19 +1,22 @@ /* - * $Id: Person.java 440597 2006-09-06 03:34:39Z tmjee $ + * $Id: $ * - * Copyright 2006 The Apache Software Foundation. + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at + * http://www.apache.org/licenses/LICENSE-2.0 * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. */ package org.apache.struts2.showcase.conversion; @@ -24,30 +27,30 @@ import java.util.List; import com.opensymphony.xwork2.ActionSupport; /** - * + * * @version $Date$ $Id$ */ public class OperationsEnumAction extends ActionSupport { - private static final long serialVersionUID = -2229489704988870318L; - - private List selectedOperations = new LinkedList(); - - public List getSelectedOperations() { return this.selectedOperations; } - public void setSelectedOperations(List selectedOperations) { - this.selectedOperations = selectedOperations; - } - - - public List getAvailableOperations() { - return Arrays.asList(OperationsEnum.values()); - } - - public String input() throws Exception { - return SUCCESS; - } - public String submit() throws Exception { - return SUCCESS; - } + private static final long serialVersionUID = -2229489704988870318L; + + private List selectedOperations = new LinkedList(); + + public List getSelectedOperations() { return this.selectedOperations; } + public void setSelectedOperations(List selectedOperations) { + this.selectedOperations = selectedOperations; + } + + + public List getAvailableOperations() { + return Arrays.asList(OperationsEnum.values()); + } + + public String input() throws Exception { + return SUCCESS; + } + public String submit() throws Exception { + return SUCCESS; + } } diff --git a/apps/showcase/src/main/java/org/apache/struts2/showcase/conversion/Person.java b/apps/showcase/src/main/java/org/apache/struts2/showcase/conversion/Person.java index f87072c11..ed63fd42c 100644 --- a/apps/showcase/src/main/java/org/apache/struts2/showcase/conversion/Person.java +++ b/apps/showcase/src/main/java/org/apache/struts2/showcase/conversion/Person.java @@ -1,19 +1,22 @@ /* * $Id$ * - * Copyright 2006 The Apache Software Foundation. + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at + * http://www.apache.org/licenses/LICENSE-2.0 * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. */ package org.apache.struts2.showcase.conversion; @@ -23,12 +26,12 @@ import java.io.Serializable; * */ public class Person implements Serializable { - private String name; - private Integer age; - - public void setName(String name) { this.name = name; } - public String getName() { return this.name; } - - public void setAge(Integer age) { this.age = age; } - public Integer getAge() { return this.age; } + private String name; + private Integer age; + + public void setName(String name) { this.name = name; } + public String getName() { return this.name; } + + public void setAge(Integer age) { this.age = age; } + public Integer getAge() { return this.age; } } diff --git a/apps/showcase/src/main/java/org/apache/struts2/showcase/conversion/PersonAction.java b/apps/showcase/src/main/java/org/apache/struts2/showcase/conversion/PersonAction.java index 1e0bd55e3..96ff77d40 100644 --- a/apps/showcase/src/main/java/org/apache/struts2/showcase/conversion/PersonAction.java +++ b/apps/showcase/src/main/java/org/apache/struts2/showcase/conversion/PersonAction.java @@ -1,19 +1,22 @@ /* * $Id$ * - * Copyright 2006 The Apache Software Foundation. + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at + * http://www.apache.org/licenses/LICENSE-2.0 * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. */ package org.apache.struts2.showcase.conversion; @@ -22,22 +25,22 @@ import java.util.List; import com.opensymphony.xwork2.ActionSupport; /** - * + * */ public class PersonAction extends ActionSupport { - - private List persons; - - public List getPersons() { return persons; } - public void setPersons(List persons) { this.persons = persons; } - - - - public String input() throws Exception { - return SUCCESS; - } - - public String submit() throws Exception { - return SUCCESS; - } + + private List persons; + + public List getPersons() { return persons; } + public void setPersons(List persons) { this.persons = persons; } + + + + public String input() throws Exception { + return SUCCESS; + } + + public String submit() throws Exception { + return SUCCESS; + } } diff --git a/apps/showcase/src/main/java/org/apache/struts2/showcase/dao/AbstractDao.java b/apps/showcase/src/main/java/org/apache/struts2/showcase/dao/AbstractDao.java index 3c61468a1..95c6477f7 100644 --- a/apps/showcase/src/main/java/org/apache/struts2/showcase/dao/AbstractDao.java +++ b/apps/showcase/src/main/java/org/apache/struts2/showcase/dao/AbstractDao.java @@ -1,19 +1,22 @@ /* * $Id$ * - * Copyright 2006 The Apache Software Foundation. + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at + * http://www.apache.org/licenses/LICENSE-2.0 * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. */ package org.apache.struts2.showcase.dao; diff --git a/apps/showcase/src/main/java/org/apache/struts2/showcase/dao/Dao.java b/apps/showcase/src/main/java/org/apache/struts2/showcase/dao/Dao.java index c27eb7ade..71e1d764d 100644 --- a/apps/showcase/src/main/java/org/apache/struts2/showcase/dao/Dao.java +++ b/apps/showcase/src/main/java/org/apache/struts2/showcase/dao/Dao.java @@ -1,19 +1,22 @@ /* * $Id$ * - * Copyright 2006 The Apache Software Foundation. + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at + * http://www.apache.org/licenses/LICENSE-2.0 * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. */ package org.apache.struts2.showcase.dao; diff --git a/apps/showcase/src/main/java/org/apache/struts2/showcase/dao/EmployeeDao.java b/apps/showcase/src/main/java/org/apache/struts2/showcase/dao/EmployeeDao.java index 392dcc86f..4e6caa680 100644 --- a/apps/showcase/src/main/java/org/apache/struts2/showcase/dao/EmployeeDao.java +++ b/apps/showcase/src/main/java/org/apache/struts2/showcase/dao/EmployeeDao.java @@ -1,19 +1,22 @@ /* * $Id$ * - * Copyright 2006 The Apache Software Foundation. + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at + * http://www.apache.org/licenses/LICENSE-2.0 * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. */ package org.apache.struts2.showcase.dao; @@ -30,7 +33,7 @@ import java.util.ArrayList; public class EmployeeDao extends AbstractDao { - private static final long serialVersionUID = -6615310540042830594L; + private static final long serialVersionUID = -6615310540042830594L; protected SkillDao skillDao; diff --git a/apps/showcase/src/main/java/org/apache/struts2/showcase/dao/SkillDao.java b/apps/showcase/src/main/java/org/apache/struts2/showcase/dao/SkillDao.java index d21a3b48d..f51421d5c 100644 --- a/apps/showcase/src/main/java/org/apache/struts2/showcase/dao/SkillDao.java +++ b/apps/showcase/src/main/java/org/apache/struts2/showcase/dao/SkillDao.java @@ -1,19 +1,22 @@ /* * $Id$ * - * Copyright 2006 The Apache Software Foundation. + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at + * http://www.apache.org/licenses/LICENSE-2.0 * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. */ package org.apache.struts2.showcase.dao; @@ -26,7 +29,7 @@ import org.apache.struts2.showcase.model.Skill; public class SkillDao extends AbstractDao { - private static final long serialVersionUID = -8160406514074630866L; + private static final long serialVersionUID = -8160406514074630866L; public Class getFeaturedClass() { return Skill.class; diff --git a/apps/showcase/src/main/java/org/apache/struts2/showcase/exception/CreateException.java b/apps/showcase/src/main/java/org/apache/struts2/showcase/exception/CreateException.java index fbf8b93fc..23cc287e5 100644 --- a/apps/showcase/src/main/java/org/apache/struts2/showcase/exception/CreateException.java +++ b/apps/showcase/src/main/java/org/apache/struts2/showcase/exception/CreateException.java @@ -1,19 +1,22 @@ /* * $Id$ * - * Copyright 2006 The Apache Software Foundation. + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at + * http://www.apache.org/licenses/LICENSE-2.0 * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. */ package org.apache.struts2.showcase.exception; @@ -24,8 +27,8 @@ package org.apache.struts2.showcase.exception; public class CreateException extends StorageException { - private static final long serialVersionUID = 6734349565111633783L; - + private static final long serialVersionUID = 6734349565111633783L; + public CreateException(String message) { super(message); } diff --git a/apps/showcase/src/main/java/org/apache/struts2/showcase/exception/DeleteException.java b/apps/showcase/src/main/java/org/apache/struts2/showcase/exception/DeleteException.java index 86022d1b5..f2d2dfcbb 100644 --- a/apps/showcase/src/main/java/org/apache/struts2/showcase/exception/DeleteException.java +++ b/apps/showcase/src/main/java/org/apache/struts2/showcase/exception/DeleteException.java @@ -1,19 +1,22 @@ /* * $Id$ * - * Copyright 2006 The Apache Software Foundation. + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at + * http://www.apache.org/licenses/LICENSE-2.0 * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. */ package org.apache.struts2.showcase.exception; @@ -24,9 +27,9 @@ package org.apache.struts2.showcase.exception; public class DeleteException extends StorageException { - private static final long serialVersionUID = -5286362812955627352L; + private static final long serialVersionUID = -5286362812955627352L; - public DeleteException(String message) { + public DeleteException(String message) { super(message); } diff --git a/apps/showcase/src/main/java/org/apache/struts2/showcase/exception/DuplicateKeyException.java b/apps/showcase/src/main/java/org/apache/struts2/showcase/exception/DuplicateKeyException.java index 4085de5b8..1ae17ddae 100644 --- a/apps/showcase/src/main/java/org/apache/struts2/showcase/exception/DuplicateKeyException.java +++ b/apps/showcase/src/main/java/org/apache/struts2/showcase/exception/DuplicateKeyException.java @@ -1,19 +1,22 @@ /* * $Id$ * - * Copyright 2006 The Apache Software Foundation. + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at + * http://www.apache.org/licenses/LICENSE-2.0 * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. */ package org.apache.struts2.showcase.exception; @@ -24,7 +27,7 @@ package org.apache.struts2.showcase.exception; public class DuplicateKeyException extends CreateException { - private static final long serialVersionUID = 989620752592415898L; + private static final long serialVersionUID = 989620752592415898L; public DuplicateKeyException(String message) { super(message); diff --git a/apps/showcase/src/main/java/org/apache/struts2/showcase/exception/StorageException.java b/apps/showcase/src/main/java/org/apache/struts2/showcase/exception/StorageException.java index d40397c17..7628bc2f5 100644 --- a/apps/showcase/src/main/java/org/apache/struts2/showcase/exception/StorageException.java +++ b/apps/showcase/src/main/java/org/apache/struts2/showcase/exception/StorageException.java @@ -1,19 +1,22 @@ /* * $Id$ * - * Copyright 2006 The Apache Software Foundation. + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at + * http://www.apache.org/licenses/LICENSE-2.0 * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. */ package org.apache.struts2.showcase.exception; @@ -24,8 +27,8 @@ package org.apache.struts2.showcase.exception; public class StorageException extends Exception { - private static final long serialVersionUID = -2528721270540362905L; - + private static final long serialVersionUID = -2528721270540362905L; + public StorageException(String message) { super(message); } diff --git a/apps/showcase/src/main/java/org/apache/struts2/showcase/exception/UpdateException.java b/apps/showcase/src/main/java/org/apache/struts2/showcase/exception/UpdateException.java index bb9304b94..3f5023c81 100644 --- a/apps/showcase/src/main/java/org/apache/struts2/showcase/exception/UpdateException.java +++ b/apps/showcase/src/main/java/org/apache/struts2/showcase/exception/UpdateException.java @@ -1,19 +1,22 @@ /* * $Id$ * - * Copyright 2006 The Apache Software Foundation. + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at + * http://www.apache.org/licenses/LICENSE-2.0 * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. */ package org.apache.struts2.showcase.exception; @@ -25,8 +28,8 @@ package org.apache.struts2.showcase.exception; public class UpdateException extends StorageException { - private static final long serialVersionUID = -4728238600375630452L; - + private static final long serialVersionUID = -4728238600375630452L; + public UpdateException(String message) { super(message); diff --git a/apps/showcase/src/main/java/org/apache/struts2/showcase/filedownload/FileDownloadAction.java b/apps/showcase/src/main/java/org/apache/struts2/showcase/filedownload/FileDownloadAction.java index 51040156d..c5ae1facf 100644 --- a/apps/showcase/src/main/java/org/apache/struts2/showcase/filedownload/FileDownloadAction.java +++ b/apps/showcase/src/main/java/org/apache/struts2/showcase/filedownload/FileDownloadAction.java @@ -1,19 +1,22 @@ /* * $Id$ * - * Copyright 2006 The Apache Software Foundation. + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at + * http://www.apache.org/licenses/LICENSE-2.0 * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. */ package org.apache.struts2.showcase.filedownload; diff --git a/apps/showcase/src/main/java/org/apache/struts2/showcase/fileupload/FileUploadAction.java b/apps/showcase/src/main/java/org/apache/struts2/showcase/fileupload/FileUploadAction.java index 3d2906a38..20bc2fa60 100644 --- a/apps/showcase/src/main/java/org/apache/struts2/showcase/fileupload/FileUploadAction.java +++ b/apps/showcase/src/main/java/org/apache/struts2/showcase/fileupload/FileUploadAction.java @@ -1,19 +1,22 @@ /* * $Id$ * - * Copyright 2006 The Apache Software Foundation. + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at + * http://www.apache.org/licenses/LICENSE-2.0 * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. */ package org.apache.struts2.showcase.fileupload; @@ -27,23 +30,23 @@ import java.io.File; */ public class FileUploadAction extends ActionSupport { - private static final long serialVersionUID = 5156288255337069381L; - - private String contentType; + private static final long serialVersionUID = 5156288255337069381L; + + private String contentType; private File upload; private String fileName; private String caption; - + // since we are using the file name will be // obtained through getter/setter of FileName public String getUploadFileName() { - return fileName; + return fileName; } public void setUploadFileName(String fileName) { - this.fileName = fileName; + this.fileName = fileName; } - + // since we are using the content type will be // obtained through getter/setter of ContentType public String getUploadContentType() { @@ -53,7 +56,7 @@ public class FileUploadAction extends ActionSupport { this.contentType = contentType; } - + // since we are using the File itself will be // obtained through getter/setter of public File getUpload() { @@ -63,7 +66,7 @@ public class FileUploadAction extends ActionSupport { this.upload = upload; } - + public String getCaption() { return caption; } diff --git a/apps/showcase/src/main/java/org/apache/struts2/showcase/fileupload/MultipleFileUploadUsingArrayAction.java b/apps/showcase/src/main/java/org/apache/struts2/showcase/fileupload/MultipleFileUploadUsingArrayAction.java index b6514eb60..0b494e4ec 100644 --- a/apps/showcase/src/main/java/org/apache/struts2/showcase/fileupload/MultipleFileUploadUsingArrayAction.java +++ b/apps/showcase/src/main/java/org/apache/struts2/showcase/fileupload/MultipleFileUploadUsingArrayAction.java @@ -1,19 +1,22 @@ /* - * $Id: FileUploadAction.java 432886 2006-08-19 22:03:04Z tmjee $ + * $Id: $ * - * Copyright 2006 The Apache Software Foundation. + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at + * http://www.apache.org/licenses/LICENSE-2.0 * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. */ package org.apache.struts2.showcase.fileupload; @@ -23,7 +26,7 @@ import com.opensymphony.xwork2.ActionSupport; /** * Showcase action - mutiple file upload using array. - * + * * @version $Date$ $Id$ */ public class MultipleFileUploadUsingArrayAction extends ActionSupport { @@ -31,17 +34,17 @@ public class MultipleFileUploadUsingArrayAction extends ActionSupport { private File[] uploads; private String[] uploadFileNames; private String[] uploadContentTypes; - + public File[] getUpload() { return this.uploads; } public void setUpload(File[] upload) { this.uploads = upload; } - + public String[] getUploadFileName() { return this.uploadFileNames; } public void setUploadFileName(String[] uploadFileName) { this.uploadFileNames = uploadFileName; } - + public String[] getUploadContentType() { return this.uploadContentTypes; } public void setUploadContentType(String[] uploadContentType) { this.uploadContentTypes = uploadContentType; } - - + + public String upload() throws Exception { System.out.println("\n\n upload2"); System.out.println("files:"); @@ -59,5 +62,5 @@ public class MultipleFileUploadUsingArrayAction extends ActionSupport { System.out.println("\n\n"); return SUCCESS; } - + } diff --git a/apps/showcase/src/main/java/org/apache/struts2/showcase/fileupload/MultipleFileUploadUsingListAction.java b/apps/showcase/src/main/java/org/apache/struts2/showcase/fileupload/MultipleFileUploadUsingListAction.java index 6f83fbed6..bd799fa56 100644 --- a/apps/showcase/src/main/java/org/apache/struts2/showcase/fileupload/MultipleFileUploadUsingListAction.java +++ b/apps/showcase/src/main/java/org/apache/struts2/showcase/fileupload/MultipleFileUploadUsingListAction.java @@ -1,25 +1,22 @@ -package org.apache.struts2.showcase.fileupload; - -import java.io.File; -import java.util.ArrayList; -import java.util.List; - /* - * $Id: FileUploadAction.java 432886 2006-08-19 22:03:04Z tmjee $ + * $Id: $ * - * Copyright 2006 The Apache Software Foundation. + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at + * http://www.apache.org/licenses/LICENSE-2.0 * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. */ import com.opensymphony.xwork2.ActionSupport; @@ -32,34 +29,34 @@ public class MultipleFileUploadUsingListAction extends ActionSupport { private List uploads = new ArrayList(); private List uploadFileNames = new ArrayList(); private List uploadContentTypes = new ArrayList(); - - + + public List getUpload() { return this.uploads; } public void setUpload(List uploads) { this.uploads = uploads; } - + public List getUploadFileName() { return this.uploadFileNames; } public void setUploadFileName(List uploadFileNames) { this.uploadFileNames = uploadFileNames; } - + public List getUploadContentType() { return this.uploadContentTypes; } public void setUploadContentType(List contentTypes) { this.uploadContentTypes = contentTypes; } - - - - + + + + public String upload() throws Exception { - + System.out.println("\n\n upload1"); System.out.println("files:"); for (File u: uploads) { @@ -76,6 +73,6 @@ public class MultipleFileUploadUsingListAction extends ActionSupport { System.out.println("\n\n"); return SUCCESS; } - - + + } diff --git a/apps/showcase/src/main/java/org/apache/struts2/showcase/freemarker/CustomFreemarkerManager.java b/apps/showcase/src/main/java/org/apache/struts2/showcase/freemarker/CustomFreemarkerManager.java index 40b685307..86ef321fe 100644 --- a/apps/showcase/src/main/java/org/apache/struts2/showcase/freemarker/CustomFreemarkerManager.java +++ b/apps/showcase/src/main/java/org/apache/struts2/showcase/freemarker/CustomFreemarkerManager.java @@ -1,19 +1,22 @@ /* * $Id$ * - * Copyright 2006 The Apache Software Foundation. + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at + * http://www.apache.org/licenses/LICENSE-2.0 * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. */ package org.apache.struts2.showcase.freemarker; @@ -26,29 +29,29 @@ import org.apache.struts2.views.freemarker.ScopesHashModel; import com.opensymphony.xwork2.util.OgnlValueStack; /** - * This is an example of a custom FreemarkerManager, mean to be - * instantiated through Spring. + * This is an example of a custom FreemarkerManager, mean to be + * instantiated through Spring. *

- * + * * It will add into Freemarker's model - * an utility class called {@link CustomFreemarkerManagerUtil} as a simple + * an utility class called {@link CustomFreemarkerManagerUtil} as a simple * example demonstrating how to extends FreemarkerManager. *

- * - * The {@link CustomFreemarkerManagerUtil} will be created by Spring and + * + * The {@link CustomFreemarkerManagerUtil} will be created by Spring and * injected through constructor injection. *

*/ public class CustomFreemarkerManager extends FreemarkerManager { - - private CustomFreemarkerManagerUtil util; - - public CustomFreemarkerManager(CustomFreemarkerManagerUtil util) { - this.util = util; - } - - public void populateContext(ScopesHashModel model, OgnlValueStack stack, Object action, HttpServletRequest request, HttpServletResponse response) { - super.populateContext(model, stack, action, request, response); - model.put("customFreemarkerManagerUtil", util); - } + + private CustomFreemarkerManagerUtil util; + + public CustomFreemarkerManager(CustomFreemarkerManagerUtil util) { + this.util = util; + } + + public void populateContext(ScopesHashModel model, OgnlValueStack stack, Object action, HttpServletRequest request, HttpServletResponse response) { + super.populateContext(model, stack, action, request, response); + model.put("customFreemarkerManagerUtil", util); + } } diff --git a/apps/showcase/src/main/java/org/apache/struts2/showcase/freemarker/CustomFreemarkerManagerUtil.java b/apps/showcase/src/main/java/org/apache/struts2/showcase/freemarker/CustomFreemarkerManagerUtil.java index f27079e1e..d80932378 100644 --- a/apps/showcase/src/main/java/org/apache/struts2/showcase/freemarker/CustomFreemarkerManagerUtil.java +++ b/apps/showcase/src/main/java/org/apache/struts2/showcase/freemarker/CustomFreemarkerManagerUtil.java @@ -1,19 +1,22 @@ /* * $Id$ * - * Copyright 2006 The Apache Software Foundation. + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at + * http://www.apache.org/licenses/LICENSE-2.0 * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. */ package org.apache.struts2.showcase.freemarker; @@ -21,19 +24,19 @@ import java.text.SimpleDateFormat; import java.util.Date; /** - * This class is just a simple util that gets injected into + * This class is just a simple util that gets injected into * {@link CustomFreemarkerManager} through Spring's constructor - * injection, serving as a simple example in Struts' Showcase. + * injection, serving as a simple example in Struts' Showcase. */ public class CustomFreemarkerManagerUtil { - public String getTodayDate() { - SimpleDateFormat sdf = new SimpleDateFormat("dd-MM-yyyy"); - return sdf.format(new Date()); - } - - public String getTimeNow() { - SimpleDateFormat sdf = new SimpleDateFormat("hh:mm:ss"); - return sdf.format(new Date()); - } + public String getTodayDate() { + SimpleDateFormat sdf = new SimpleDateFormat("dd-MM-yyyy"); + return sdf.format(new Date()); + } + + public String getTimeNow() { + SimpleDateFormat sdf = new SimpleDateFormat("hh:mm:ss"); + return sdf.format(new Date()); + } } diff --git a/apps/showcase/src/main/java/org/apache/struts2/showcase/hangman/GetUpdatedHangmanAction.java b/apps/showcase/src/main/java/org/apache/struts2/showcase/hangman/GetUpdatedHangmanAction.java index 9e5ec7055..e0c99b205 100644 --- a/apps/showcase/src/main/java/org/apache/struts2/showcase/hangman/GetUpdatedHangmanAction.java +++ b/apps/showcase/src/main/java/org/apache/struts2/showcase/hangman/GetUpdatedHangmanAction.java @@ -1,3 +1,23 @@ +/* + * $Id$ + * + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ package org.apache.struts2.showcase.hangman; import java.util.Map; @@ -7,33 +27,33 @@ import org.apache.struts2.interceptor.SessionAware; import com.opensymphony.xwork2.ActionSupport; public class GetUpdatedHangmanAction extends ActionSupport implements SessionAware { - - private static final long serialVersionUID = 5506025785406043027L; - - private Map session; - private Hangman hangman; - - - public String execute() throws Exception { - hangman = (Hangman) session.get(HangmanConstants.HANGMAN_SESSION_KEY); - - System.out.println("\n\n\n"); - System.out.println("hangman="+hangman); - System.out.println("available = "+hangman.getCharactersAvailable().size()); - System.out.println("guess left="+hangman.guessLeft()); - System.out.println("\n\n\n"); - - return SUCCESS; - } - public void setSession(Map session) { - this.session = session; - } - - public Hangman getHangman() { - return hangman; - } - public void setHangman(Hangman hangman) { - this.hangman = hangman; - } + private static final long serialVersionUID = 5506025785406043027L; + + private Map session; + private Hangman hangman; + + + public String execute() throws Exception { + hangman = (Hangman) session.get(HangmanConstants.HANGMAN_SESSION_KEY); + + System.out.println("\n\n\n"); + System.out.println("hangman="+hangman); + System.out.println("available = "+hangman.getCharactersAvailable().size()); + System.out.println("guess left="+hangman.guessLeft()); + System.out.println("\n\n\n"); + + return SUCCESS; + } + + public void setSession(Map session) { + this.session = session; + } + + public Hangman getHangman() { + return hangman; + } + public void setHangman(Hangman hangman) { + this.hangman = hangman; + } } diff --git a/apps/showcase/src/main/java/org/apache/struts2/showcase/hangman/GuessCharacterAction.java b/apps/showcase/src/main/java/org/apache/struts2/showcase/hangman/GuessCharacterAction.java index aa1851140..d15c223d4 100644 --- a/apps/showcase/src/main/java/org/apache/struts2/showcase/hangman/GuessCharacterAction.java +++ b/apps/showcase/src/main/java/org/apache/struts2/showcase/hangman/GuessCharacterAction.java @@ -1,3 +1,23 @@ +/* + * $Id$ + * + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ package org.apache.struts2.showcase.hangman; import java.util.Map; @@ -7,33 +27,33 @@ import org.apache.struts2.interceptor.SessionAware; import com.opensymphony.xwork2.ActionSupport; public class GuessCharacterAction extends ActionSupport implements SessionAware { - - private static final long serialVersionUID = 9050915577007590674L; - - private Map session; - private Character character; - private Hangman hangman; - - public String execute() throws Exception { - hangman = (Hangman) session.get(HangmanConstants.HANGMAN_SESSION_KEY); - hangman.guess(character); - - return SUCCESS; - } - - public Hangman getHangman() { - return hangman; - } - public void setSession(Map session) { - this.session = session; - } - - public void setCharacter(Character character) { - this.character = character; - } - - public Character getCharacter() { - return this.character; - } + private static final long serialVersionUID = 9050915577007590674L; + + private Map session; + private Character character; + private Hangman hangman; + + public String execute() throws Exception { + hangman = (Hangman) session.get(HangmanConstants.HANGMAN_SESSION_KEY); + hangman.guess(character); + + return SUCCESS; + } + + public Hangman getHangman() { + return hangman; + } + + public void setSession(Map session) { + this.session = session; + } + + public void setCharacter(Character character) { + this.character = character; + } + + public Character getCharacter() { + return this.character; + } } diff --git a/apps/showcase/src/main/java/org/apache/struts2/showcase/hangman/Hangman.java b/apps/showcase/src/main/java/org/apache/struts2/showcase/hangman/Hangman.java index cfbf7a59c..1fdf2daa4 100644 --- a/apps/showcase/src/main/java/org/apache/struts2/showcase/hangman/Hangman.java +++ b/apps/showcase/src/main/java/org/apache/struts2/showcase/hangman/Hangman.java @@ -1,19 +1,22 @@ /* * $Id$ * - * Copyright 2006 The Apache Software Foundation. + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at + * http://www.apache.org/licenses/LICENSE-2.0 * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. */ package org.apache.struts2.showcase.hangman; @@ -23,84 +26,84 @@ import java.util.Arrays; import java.util.List; public class Hangman implements Serializable { - - private static final long serialVersionUID = 8566954355839652509L; - private Vocab vocab; - - private Boolean win = false; - - private int guessLeft = 5; - public List charactersAvailable; - public List charactersGuessed; - - public Hangman(Vocab vocab) { - // Arrays.asList(...) returns List that doesn't support remove(), hence - // we wrap it with an ArrayList to avoid UnsupportedOperationException - // when doing a remove() - charactersAvailable = new ArrayList(Arrays.asList( - new Character[] { - Character.valueOf('A'), Character.valueOf('B'), Character.valueOf('C'), - Character.valueOf('D'), Character.valueOf('E'), Character.valueOf('F'), - Character.valueOf('G'), Character.valueOf('H'), Character.valueOf('I'), - Character.valueOf('J'), Character.valueOf('K'), Character.valueOf('L'), - Character.valueOf('M'), Character.valueOf('N'), Character.valueOf('O'), - Character.valueOf('P'), Character.valueOf('Q'), Character.valueOf('R'), - Character.valueOf('S'), Character.valueOf('T'), Character.valueOf('U'), - Character.valueOf('V'), Character.valueOf('W'), Character.valueOf('X'), - Character.valueOf('Y'), Character.valueOf('Z') - })); - charactersGuessed = new ArrayList(); - this.vocab = vocab; - } - - public void guess(Character character) { - assert(character != null); - - synchronized(charactersAvailable) { - if (guessLeft < 0) { - throw new HangmanException( - HangmanException.Type.valueOf("GAME_ENDED"), "Game already eneded"); - } - Character characterInUpperCase = Character.toUpperCase(character); - boolean ok = charactersAvailable.remove(characterInUpperCase); - if (ok) { - charactersGuessed.add(characterInUpperCase); - if (! vocab.containCharacter(characterInUpperCase)) { - guessLeft = guessLeft - 1; - } - } - if (vocab.containsAllCharacter(charactersGuessed)) { - win = true; - } - System.out.println(" *********************************** "+win); - } - } - - public Boolean isWin() { - return this.win; - } - - public Vocab getVocab() { - return vocab; - } - - public Boolean gameEnded() { - return ((guessLeft < 0) || win); - } - - public Integer guessLeft() { - return guessLeft; - } - - public List getCharactersAvailable() { - synchronized(charactersAvailable) { - return new ArrayList(charactersAvailable); - //return charactersAvailable; - } - } - - public boolean characterGuessedBefore(Character character) { - return charactersGuessed.contains(character); - } + private static final long serialVersionUID = 8566954355839652509L; + + private Vocab vocab; + + private Boolean win = false; + + private int guessLeft = 5; + public List charactersAvailable; + public List charactersGuessed; + + public Hangman(Vocab vocab) { + // Arrays.asList(...) returns List that doesn't support remove(), hence + // we wrap it with an ArrayList to avoid UnsupportedOperationException + // when doing a remove() + charactersAvailable = new ArrayList(Arrays.asList( + new Character[] { + Character.valueOf('A'), Character.valueOf('B'), Character.valueOf('C'), + Character.valueOf('D'), Character.valueOf('E'), Character.valueOf('F'), + Character.valueOf('G'), Character.valueOf('H'), Character.valueOf('I'), + Character.valueOf('J'), Character.valueOf('K'), Character.valueOf('L'), + Character.valueOf('M'), Character.valueOf('N'), Character.valueOf('O'), + Character.valueOf('P'), Character.valueOf('Q'), Character.valueOf('R'), + Character.valueOf('S'), Character.valueOf('T'), Character.valueOf('U'), + Character.valueOf('V'), Character.valueOf('W'), Character.valueOf('X'), + Character.valueOf('Y'), Character.valueOf('Z') + })); + charactersGuessed = new ArrayList(); + this.vocab = vocab; + } + + public void guess(Character character) { + assert(character != null); + + synchronized(charactersAvailable) { + if (guessLeft < 0) { + throw new HangmanException( + HangmanException.Type.valueOf("GAME_ENDED"), "Game already eneded"); + } + Character characterInUpperCase = Character.toUpperCase(character); + boolean ok = charactersAvailable.remove(characterInUpperCase); + if (ok) { + charactersGuessed.add(characterInUpperCase); + if (! vocab.containCharacter(characterInUpperCase)) { + guessLeft = guessLeft - 1; + } + } + if (vocab.containsAllCharacter(charactersGuessed)) { + win = true; + } + System.out.println(" *********************************** "+win); + } + } + + public Boolean isWin() { + return this.win; + } + + public Vocab getVocab() { + return vocab; + } + + public Boolean gameEnded() { + return ((guessLeft < 0) || win); + } + + public Integer guessLeft() { + return guessLeft; + } + + public List getCharactersAvailable() { + synchronized(charactersAvailable) { + return new ArrayList(charactersAvailable); + //return charactersAvailable; + } + } + + public boolean characterGuessedBefore(Character character) { + return charactersGuessed.contains(character); + } } diff --git a/apps/showcase/src/main/java/org/apache/struts2/showcase/hangman/HangmanConstants.java b/apps/showcase/src/main/java/org/apache/struts2/showcase/hangman/HangmanConstants.java index 2c5fd14a4..bae60ded0 100644 --- a/apps/showcase/src/main/java/org/apache/struts2/showcase/hangman/HangmanConstants.java +++ b/apps/showcase/src/main/java/org/apache/struts2/showcase/hangman/HangmanConstants.java @@ -1,6 +1,26 @@ +/* + * $Id$ + * + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ package org.apache.struts2.showcase.hangman; public class HangmanConstants { - // keeps a Hangman object in HttpSession - public static final String HANGMAN_SESSION_KEY = "Hangman_Session_Key"; + // keeps a Hangman object in HttpSession + public static final String HANGMAN_SESSION_KEY = "Hangman_Session_Key"; } diff --git a/apps/showcase/src/main/java/org/apache/struts2/showcase/hangman/HangmanException.java b/apps/showcase/src/main/java/org/apache/struts2/showcase/hangman/HangmanException.java index 95ac17e84..feffb1c22 100644 --- a/apps/showcase/src/main/java/org/apache/struts2/showcase/hangman/HangmanException.java +++ b/apps/showcase/src/main/java/org/apache/struts2/showcase/hangman/HangmanException.java @@ -1,41 +1,44 @@ /* * $Id$ * - * Copyright 2006 The Apache Software Foundation. + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at + * http://www.apache.org/licenses/LICENSE-2.0 * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. */ package org.apache.struts2.showcase.hangman; public class HangmanException extends RuntimeException { - - private static final long serialVersionUID = -8500292863595941335L; - enum Type { - GAME_ENDED, - NO_VOCAB, - NO_VOCAB_SOURCE; - } - - - private Type type; - - public HangmanException (Type type, String reason) { - super(reason); - this.type = type; - } - - public Type getType() { - return type; - } + private static final long serialVersionUID = -8500292863595941335L; + + enum Type { + GAME_ENDED, + NO_VOCAB, + NO_VOCAB_SOURCE; + } + + + private Type type; + + public HangmanException (Type type, String reason) { + super(reason); + this.type = type; + } + + public Type getType() { + return type; + } } diff --git a/apps/showcase/src/main/java/org/apache/struts2/showcase/hangman/HangmanService.java b/apps/showcase/src/main/java/org/apache/struts2/showcase/hangman/HangmanService.java index 0219bfe34..410acd85c 100644 --- a/apps/showcase/src/main/java/org/apache/struts2/showcase/hangman/HangmanService.java +++ b/apps/showcase/src/main/java/org/apache/struts2/showcase/hangman/HangmanService.java @@ -1,31 +1,34 @@ /* * $Id$ * - * Copyright 2006 The Apache Software Foundation. + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at + * http://www.apache.org/licenses/LICENSE-2.0 * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. */ package org.apache.struts2.showcase.hangman; public class HangmanService { - - public VocabSource vocabSource; - - public HangmanService(VocabSource vocabSource) { - this.vocabSource = vocabSource; - } - - public Hangman startNewGame() { - return new Hangman(vocabSource.getRandomVocab()); - } + + public VocabSource vocabSource; + + public HangmanService(VocabSource vocabSource) { + this.vocabSource = vocabSource; + } + + public Hangman startNewGame() { + return new Hangman(vocabSource.getRandomVocab()); + } } diff --git a/apps/showcase/src/main/java/org/apache/struts2/showcase/hangman/PropertiesVocabSource.java b/apps/showcase/src/main/java/org/apache/struts2/showcase/hangman/PropertiesVocabSource.java index ec3e1a89a..0ab443977 100644 --- a/apps/showcase/src/main/java/org/apache/struts2/showcase/hangman/PropertiesVocabSource.java +++ b/apps/showcase/src/main/java/org/apache/struts2/showcase/hangman/PropertiesVocabSource.java @@ -1,19 +1,22 @@ /* * $Id$ * - * Copyright 2006 The Apache Software Foundation. + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at + * http://www.apache.org/licenses/LICENSE-2.0 * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. */ package org.apache.struts2.showcase.hangman; @@ -24,45 +27,45 @@ import java.util.Properties; public class PropertiesVocabSource implements VocabSource { - private Properties prop; - private List vocabs; - - public PropertiesVocabSource() { - } - - public PropertiesVocabSource(Properties prop) { - assert(prop != null); - this.prop = prop; - vocabs = readVocab(prop); - } - - public void setVocabProperties(Properties prop) { - assert(prop != null); - this.prop = prop; - vocabs = readVocab(prop); - } - - public Vocab getRandomVocab() { - if (vocabs == null) { - throw new HangmanException(HangmanException.Type.valueOf("NO_VOCAB_SOURCE"), "No vocab source"); - } - if (vocabs.size() <= 0) { - throw new HangmanException(HangmanException.Type.valueOf("NO_VOCAB"), "No vocab"); - } - long vocabIndex = Math.round((Math.random() * (double)prop.size())); - vocabIndex = vocabIndex == vocabs.size() ? vocabs.size() - 1 : vocabIndex; - return vocabs.get((int)vocabIndex); - } - - protected List readVocab(Properties prop) { - List vocabList = new ArrayList(); - - for (Map.Entry e : prop.entrySet()) { - String vocab = (String) e.getKey(); - String hint = (String) e.getValue(); - - vocabList.add(new Vocab(vocab, hint)); - } - return vocabList; - } + private Properties prop; + private List vocabs; + + public PropertiesVocabSource() { + } + + public PropertiesVocabSource(Properties prop) { + assert(prop != null); + this.prop = prop; + vocabs = readVocab(prop); + } + + public void setVocabProperties(Properties prop) { + assert(prop != null); + this.prop = prop; + vocabs = readVocab(prop); + } + + public Vocab getRandomVocab() { + if (vocabs == null) { + throw new HangmanException(HangmanException.Type.valueOf("NO_VOCAB_SOURCE"), "No vocab source"); + } + if (vocabs.size() <= 0) { + throw new HangmanException(HangmanException.Type.valueOf("NO_VOCAB"), "No vocab"); + } + long vocabIndex = Math.round((Math.random() * (double)prop.size())); + vocabIndex = vocabIndex == vocabs.size() ? vocabs.size() - 1 : vocabIndex; + return vocabs.get((int)vocabIndex); + } + + protected List readVocab(Properties prop) { + List vocabList = new ArrayList(); + + for (Map.Entry e : prop.entrySet()) { + String vocab = (String) e.getKey(); + String hint = (String) e.getValue(); + + vocabList.add(new Vocab(vocab, hint)); + } + return vocabList; + } } diff --git a/apps/showcase/src/main/java/org/apache/struts2/showcase/hangman/StartHangmanAction.java b/apps/showcase/src/main/java/org/apache/struts2/showcase/hangman/StartHangmanAction.java index 508874834..dd62fc9ec 100644 --- a/apps/showcase/src/main/java/org/apache/struts2/showcase/hangman/StartHangmanAction.java +++ b/apps/showcase/src/main/java/org/apache/struts2/showcase/hangman/StartHangmanAction.java @@ -1,19 +1,22 @@ /* * $Id$ * - * Copyright 2006 The Apache Software Foundation. + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at + * http://www.apache.org/licenses/LICENSE-2.0 * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. */ package org.apache.struts2.showcase.hangman; @@ -26,33 +29,33 @@ import org.apache.struts2.interceptor.SessionAware; import com.opensymphony.xwork2.ActionSupport; public class StartHangmanAction extends ActionSupport implements SessionAware { - - private static final long serialVersionUID = 2333463075324892521L; - - private HangmanService service; - private Hangman hangman; - private Map session; - - - public StartHangmanAction(HangmanService service) { - this.service = service; - } - - public String execute() throws Exception { - - hangman = service.startNewGame(); - session.put(HANGMAN_SESSION_KEY, hangman); - - return SUCCESS; - } - public Hangman getHangman() { - return hangman; - } - - - // === SessionAware === - public void setSession(Map session) { - this.session = session; - } + private static final long serialVersionUID = 2333463075324892521L; + + private HangmanService service; + private Hangman hangman; + private Map session; + + + public StartHangmanAction(HangmanService service) { + this.service = service; + } + + public String execute() throws Exception { + + hangman = service.startNewGame(); + session.put(HANGMAN_SESSION_KEY, hangman); + + return SUCCESS; + } + + public Hangman getHangman() { + return hangman; + } + + + // === SessionAware === + public void setSession(Map session) { + this.session = session; + } } diff --git a/apps/showcase/src/main/java/org/apache/struts2/showcase/hangman/Vocab.java b/apps/showcase/src/main/java/org/apache/struts2/showcase/hangman/Vocab.java index b01b4317e..da1cf1541 100644 --- a/apps/showcase/src/main/java/org/apache/struts2/showcase/hangman/Vocab.java +++ b/apps/showcase/src/main/java/org/apache/struts2/showcase/hangman/Vocab.java @@ -1,19 +1,22 @@ /* * $Id$ * - * Copyright 2006 The Apache Software Foundation. + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at + * http://www.apache.org/licenses/LICENSE-2.0 * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. */ package org.apache.struts2.showcase.hangman; @@ -23,61 +26,61 @@ import java.util.Arrays; import java.util.List; public class Vocab implements Serializable { - - private static final long serialVersionUID = 1L; - - private String vocab; - private String hint; - private Character[] characters; // character this vocab is made up of - - public Vocab(String vocab, String hint) { - assert(vocab != null); - assert(hint != null); - - this.vocab = vocab.toUpperCase(); - this.hint = hint; - } - - public String getVocab() { return this.vocab; } - public String getHint() { return this.hint; } - - public Boolean containCharacter(Character character) { - assert(character != null); - - return (vocab.contains(character.toString())) ? true : false; - } - - public Character[] inCharacters() { - if (characters == null) { - char[] c = vocab.toCharArray(); - characters = new Character[c.length]; - for (int a=0; a< c.length; a++) { - characters[a] = Character.valueOf(c[a]); - } - } - return characters; - } - public boolean containsAllCharacter(List charactersGuessed) { - Character[] chars = inCharacters(); - List tmpChars = Arrays.asList(chars); - return charactersGuessed.containsAll(tmpChars); - } - - public static void main(String args[]) throws Exception { - Vocab v = new Vocab("JAVA", "a java word"); - - List list1= new ArrayList(); - list1.add(new Character('J')); - list1.add(new Character('V')); - - List list2 = new ArrayList(); - list2.add(new Character('J')); - list2.add(new Character('V')); - list2.add(new Character('A')); - - System.out.println(v.containsAllCharacter(list1)); - System.out.println(v.containsAllCharacter(list2)); - - } + private static final long serialVersionUID = 1L; + + private String vocab; + private String hint; + private Character[] characters; // character this vocab is made up of + + public Vocab(String vocab, String hint) { + assert(vocab != null); + assert(hint != null); + + this.vocab = vocab.toUpperCase(); + this.hint = hint; + } + + public String getVocab() { return this.vocab; } + public String getHint() { return this.hint; } + + public Boolean containCharacter(Character character) { + assert(character != null); + + return (vocab.contains(character.toString())) ? true : false; + } + + public Character[] inCharacters() { + if (characters == null) { + char[] c = vocab.toCharArray(); + characters = new Character[c.length]; + for (int a=0; a< c.length; a++) { + characters[a] = Character.valueOf(c[a]); + } + } + return characters; + } + + public boolean containsAllCharacter(List charactersGuessed) { + Character[] chars = inCharacters(); + List tmpChars = Arrays.asList(chars); + return charactersGuessed.containsAll(tmpChars); + } + + public static void main(String args[]) throws Exception { + Vocab v = new Vocab("JAVA", "a java word"); + + List list1= new ArrayList(); + list1.add(new Character('J')); + list1.add(new Character('V')); + + List list2 = new ArrayList(); + list2.add(new Character('J')); + list2.add(new Character('V')); + list2.add(new Character('A')); + + System.out.println(v.containsAllCharacter(list1)); + System.out.println(v.containsAllCharacter(list2)); + + } } diff --git a/apps/showcase/src/main/java/org/apache/struts2/showcase/hangman/VocabSource.java b/apps/showcase/src/main/java/org/apache/struts2/showcase/hangman/VocabSource.java index 4682d81a2..b2d64a6a3 100644 --- a/apps/showcase/src/main/java/org/apache/struts2/showcase/hangman/VocabSource.java +++ b/apps/showcase/src/main/java/org/apache/struts2/showcase/hangman/VocabSource.java @@ -1,22 +1,25 @@ /* * $Id$ * - * Copyright 2006 The Apache Software Foundation. + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at + * http://www.apache.org/licenses/LICENSE-2.0 * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. */ package org.apache.struts2.showcase.hangman; public interface VocabSource { - Vocab getRandomVocab(); + Vocab getRandomVocab(); } diff --git a/apps/showcase/src/main/java/org/apache/struts2/showcase/integration/EditGangsterAction.java b/apps/showcase/src/main/java/org/apache/struts2/showcase/integration/EditGangsterAction.java index 49e8d3728..d35a4dc95 100644 --- a/apps/showcase/src/main/java/org/apache/struts2/showcase/integration/EditGangsterAction.java +++ b/apps/showcase/src/main/java/org/apache/struts2/showcase/integration/EditGangsterAction.java @@ -1,19 +1,22 @@ /* - * $Id: Gangster.java 418530 2006-07-01 23:58:13Z mrdon $ + * $Id: $ * - * Copyright 2006 The Apache Software Foundation. + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at + * http://www.apache.org/licenses/LICENSE-2.0 * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. */ package org.apache.struts2.showcase.integration; @@ -33,9 +36,9 @@ public class EditGangsterAction extends Action { @Override public ActionForward execute(ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response) throws Exception { // Some code to load the gangster from the db as necessary - + return mapping.findForward("success"); } - + } diff --git a/apps/showcase/src/main/java/org/apache/struts2/showcase/integration/GangsterForm.java b/apps/showcase/src/main/java/org/apache/struts2/showcase/integration/GangsterForm.java index 477135f48..625bb732c 100644 --- a/apps/showcase/src/main/java/org/apache/struts2/showcase/integration/GangsterForm.java +++ b/apps/showcase/src/main/java/org/apache/struts2/showcase/integration/GangsterForm.java @@ -1,3 +1,23 @@ +/* + * $Id: $ + * + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ package org.apache.struts2.showcase.integration; import javax.servlet.http.HttpServletRequest; @@ -9,12 +29,12 @@ import org.apache.struts.action.ActionMessage; import org.apache.struts.validator.ValidatorForm; public class GangsterForm extends ValidatorForm { - + private String name; private String age; private String description; private boolean bustedBefore; - + /* (non-Javadoc) * @see org.apache.struts.action.ActionForm#reset(org.apache.struts.action.ActionMapping, javax.servlet.http.HttpServletRequest) */ @@ -22,7 +42,7 @@ public class GangsterForm extends ValidatorForm { public void reset(ActionMapping arg0, HttpServletRequest arg1) { bustedBefore = false; } - + /* (non-Javadoc) * @see org.apache.struts.action.ActionForm#validate(org.apache.struts.action.ActionMapping, javax.servlet.http.HttpServletRequest) */ @@ -32,10 +52,10 @@ public class GangsterForm extends ValidatorForm { if (name == null || name.length() == 0) { errors.add("name", new ActionMessage("The name must not be blank")); } - + return errors; } - + /** * @return the age */ @@ -84,6 +104,6 @@ public class GangsterForm extends ValidatorForm { public void setName(String name) { this.name = name; } - - + + } diff --git a/apps/showcase/src/main/java/org/apache/struts2/showcase/integration/SaveGangsterAction.java b/apps/showcase/src/main/java/org/apache/struts2/showcase/integration/SaveGangsterAction.java index 86204855a..bf3448e57 100644 --- a/apps/showcase/src/main/java/org/apache/struts2/showcase/integration/SaveGangsterAction.java +++ b/apps/showcase/src/main/java/org/apache/struts2/showcase/integration/SaveGangsterAction.java @@ -1,19 +1,22 @@ /* - * $Id: Gangster.java 418530 2006-07-01 23:58:13Z mrdon $ + * $Id: $ * - * Copyright 2006 The Apache Software Foundation. + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at + * http://www.apache.org/licenses/LICENSE-2.0 * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. */ package org.apache.struts2.showcase.integration; @@ -34,15 +37,15 @@ public class SaveGangsterAction extends Action { */ @Override public ActionForward execute(ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response) throws Exception { - + // Some code to save the gangster to the db as necessary GangsterForm gform = (GangsterForm) form; ActionMessages messages = new ActionMessages(); messages.add("msg", new ActionMessage("Gangster "+gform.getName()+" added successfully")); addMessages(request, messages); - + return mapping.findForward("success"); } - + } diff --git a/apps/showcase/src/main/java/org/apache/struts2/showcase/jsf/JsfEmployeeAction.java b/apps/showcase/src/main/java/org/apache/struts2/showcase/jsf/JsfEmployeeAction.java index 89f2db5de..d1bcc234e 100644 --- a/apps/showcase/src/main/java/org/apache/struts2/showcase/jsf/JsfEmployeeAction.java +++ b/apps/showcase/src/main/java/org/apache/struts2/showcase/jsf/JsfEmployeeAction.java @@ -1,19 +1,22 @@ /* * $Id$ * - * Copyright 2006 The Apache Software Foundation. + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at + * http://www.apache.org/licenses/LICENSE-2.0 * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. */ package org.apache.struts2.showcase.jsf; @@ -40,7 +43,7 @@ public class JsfEmployeeAction extends EmployeeAction { /** * Creating a default employee and main skill, since the JSF EL can't handle * creating new objects as necessary - * + * */ public JsfEmployeeAction() { Employee e = new Employee(); diff --git a/apps/showcase/src/main/java/org/apache/struts2/showcase/model/Employee.java b/apps/showcase/src/main/java/org/apache/struts2/showcase/model/Employee.java index 9d8ff6208..ed93b20df 100644 --- a/apps/showcase/src/main/java/org/apache/struts2/showcase/model/Employee.java +++ b/apps/showcase/src/main/java/org/apache/struts2/showcase/model/Employee.java @@ -1,19 +1,22 @@ /* * $Id$ * - * Copyright 2006 The Apache Software Foundation. + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at + * http://www.apache.org/licenses/LICENSE-2.0 * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. */ package org.apache.struts2.showcase.model; @@ -28,9 +31,9 @@ import java.util.List; public class Employee implements IdEntity { - private static final long serialVersionUID = -6226845151026823748L; - - private Long empId; //textfield w/ conversion + private static final long serialVersionUID = -6226845151026823748L; + + private Long empId; //textfield w/ conversion private String firstName; private String lastName; private Date birthDate; //datepicker diff --git a/apps/showcase/src/main/java/org/apache/struts2/showcase/model/IdEntity.java b/apps/showcase/src/main/java/org/apache/struts2/showcase/model/IdEntity.java index 6f43eb831..9e1353803 100644 --- a/apps/showcase/src/main/java/org/apache/struts2/showcase/model/IdEntity.java +++ b/apps/showcase/src/main/java/org/apache/struts2/showcase/model/IdEntity.java @@ -1,19 +1,22 @@ /* * $Id$ * - * Copyright 2006 The Apache Software Foundation. + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at + * http://www.apache.org/licenses/LICENSE-2.0 * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. */ package org.apache.struts2.showcase.model; diff --git a/apps/showcase/src/main/java/org/apache/struts2/showcase/model/Skill.java b/apps/showcase/src/main/java/org/apache/struts2/showcase/model/Skill.java index ab2122c84..e105ba0db 100644 --- a/apps/showcase/src/main/java/org/apache/struts2/showcase/model/Skill.java +++ b/apps/showcase/src/main/java/org/apache/struts2/showcase/model/Skill.java @@ -1,19 +1,22 @@ /* * $Id$ * - * Copyright 2006 The Apache Software Foundation. + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at + * http://www.apache.org/licenses/LICENSE-2.0 * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. */ package org.apache.struts2.showcase.model; @@ -26,9 +29,9 @@ import java.io.Serializable; public class Skill implements IdEntity { - private static final long serialVersionUID = -4150317722693212439L; - - private String name; + private static final long serialVersionUID = -4150317722693212439L; + + private String name; private String description; public Skill() { diff --git a/apps/showcase/src/main/java/org/apache/struts2/showcase/modelDriven/Gangster.java b/apps/showcase/src/main/java/org/apache/struts2/showcase/modelDriven/Gangster.java index 90f0d05f8..aa9591fb6 100644 --- a/apps/showcase/src/main/java/org/apache/struts2/showcase/modelDriven/Gangster.java +++ b/apps/showcase/src/main/java/org/apache/struts2/showcase/modelDriven/Gangster.java @@ -1,59 +1,62 @@ /* * $Id$ * - * Copyright 2006 The Apache Software Foundation. + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at + * http://www.apache.org/licenses/LICENSE-2.0 * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. */ package org.apache.struts2.showcase.modelDriven; import java.io.Serializable; /** - * A model class to be used by the simple Model-Driven example. - * + * A model class to be used by the simple Model-Driven example. + * */ public class Gangster implements Serializable { - private static final long serialVersionUID = 3688389475320294992L; - - private String name; - private int age; - private String description; - private boolean bustedBefore; - - public int getAge() { - return age; - } - public void setAge(int age) { - this.age = age; - } - public boolean isBustedBefore() { - return bustedBefore; - } - public void setBustedBefore(boolean bustedBefore) { - this.bustedBefore = bustedBefore; - } - public String getDescription() { - return description; - } - public void setDescription(String description) { - this.description = description; - } - public String getName() { - return name; - } - public void setName(String name) { - this.name = name; - } + private static final long serialVersionUID = 3688389475320294992L; + + private String name; + private int age; + private String description; + private boolean bustedBefore; + + public int getAge() { + return age; + } + public void setAge(int age) { + this.age = age; + } + public boolean isBustedBefore() { + return bustedBefore; + } + public void setBustedBefore(boolean bustedBefore) { + this.bustedBefore = bustedBefore; + } + public String getDescription() { + return description; + } + public void setDescription(String description) { + this.description = description; + } + public String getName() { + return name; + } + public void setName(String name) { + this.name = name; + } } diff --git a/apps/showcase/src/main/java/org/apache/struts2/showcase/modelDriven/ModelDrivenAction.java b/apps/showcase/src/main/java/org/apache/struts2/showcase/modelDriven/ModelDrivenAction.java index 1484dc567..4ab545710 100644 --- a/apps/showcase/src/main/java/org/apache/struts2/showcase/modelDriven/ModelDrivenAction.java +++ b/apps/showcase/src/main/java/org/apache/struts2/showcase/modelDriven/ModelDrivenAction.java @@ -1,19 +1,22 @@ /* * $Id$ * - * Copyright 2006 The Apache Software Foundation. + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at + * http://www.apache.org/licenses/LICENSE-2.0 * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. */ package org.apache.struts2.showcase.modelDriven; @@ -22,21 +25,21 @@ import com.opensymphony.xwork2.ModelDriven; /** * Action to demonstrate simple model-driven feature of the framework. - * + * */ public class ModelDrivenAction extends ActionSupport implements ModelDriven { - private static final long serialVersionUID = 1271130427666936592L; + private static final long serialVersionUID = 1271130427666936592L; - public String input() throws Exception { - return SUCCESS; - } - - public String execute() throws Exception { - return SUCCESS; - } + public String input() throws Exception { + return SUCCESS; + } - public Object getModel() { - return new Gangster(); - } + public String execute() throws Exception { + return SUCCESS; + } + + public Object getModel() { + return new Gangster(); + } } diff --git a/apps/showcase/src/main/java/org/apache/struts2/showcase/person/EditPersonAction.java b/apps/showcase/src/main/java/org/apache/struts2/showcase/person/EditPersonAction.java index 66bca83e6..cf95869a6 100644 --- a/apps/showcase/src/main/java/org/apache/struts2/showcase/person/EditPersonAction.java +++ b/apps/showcase/src/main/java/org/apache/struts2/showcase/person/EditPersonAction.java @@ -1,19 +1,22 @@ /* * $Id$ * - * Copyright 2006 The Apache Software Foundation. + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at + * http://www.apache.org/licenses/LICENSE-2.0 * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. */ package org.apache.struts2.showcase.person; @@ -38,9 +41,9 @@ import com.opensymphony.xwork2.ActionSupport; }) public class EditPersonAction extends ActionSupport { - private static final long serialVersionUID = 7699491775215130850L; - - PersonManager personManager; + private static final long serialVersionUID = 7699491775215130850L; + + PersonManager personManager; List persons = new ArrayList(); public void setPersonManager(PersonManager personManager) { diff --git a/apps/showcase/src/main/java/org/apache/struts2/showcase/person/ListPeopleAction.java b/apps/showcase/src/main/java/org/apache/struts2/showcase/person/ListPeopleAction.java index 5d2971603..0868d9a37 100644 --- a/apps/showcase/src/main/java/org/apache/struts2/showcase/person/ListPeopleAction.java +++ b/apps/showcase/src/main/java/org/apache/struts2/showcase/person/ListPeopleAction.java @@ -1,19 +1,22 @@ /* * $Id$ * - * Copyright 2006 The Apache Software Foundation. + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at + * http://www.apache.org/licenses/LICENSE-2.0 * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. */ package org.apache.struts2.showcase.person; @@ -27,10 +30,10 @@ import com.opensymphony.xwork2.ActionSupport; @Result(value="listPeople.ftl", type=FreemarkerResult.class) public class ListPeopleAction extends ActionSupport { - - private static final long serialVersionUID = 3608017189783645371L; - - PersonManager personManager; + + private static final long serialVersionUID = 3608017189783645371L; + + PersonManager personManager; List people = new ArrayList(); public void setPersonManager(PersonManager personManager) { diff --git a/apps/showcase/src/main/java/org/apache/struts2/showcase/person/NewPersonAction.java b/apps/showcase/src/main/java/org/apache/struts2/showcase/person/NewPersonAction.java index 3746dfb9f..c02ce4d1a 100644 --- a/apps/showcase/src/main/java/org/apache/struts2/showcase/person/NewPersonAction.java +++ b/apps/showcase/src/main/java/org/apache/struts2/showcase/person/NewPersonAction.java @@ -1,19 +1,22 @@ /* - * $Id: CreatePerson.java 420385 2006-07-10 00:57:05Z mrdon $ + * $Id: $ * - * Copyright 2006 The Apache Software Foundation. + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at + * http://www.apache.org/licenses/LICENSE-2.0 * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. */ package org.apache.struts2.showcase.person; @@ -32,10 +35,10 @@ import com.opensymphony.xwork2.ActionSupport; @Result(name="input", value="newPerson.ftl", type=FreemarkerResult.class) }) public class NewPersonAction extends ActionSupport { - - private static final long serialVersionUID = 200410824352645515L; - - PersonManager personManager; + + private static final long serialVersionUID = 200410824352645515L; + + PersonManager personManager; Person person; public void setPersonManager(PersonManager personManager) { diff --git a/apps/showcase/src/main/java/org/apache/struts2/showcase/person/Person.java b/apps/showcase/src/main/java/org/apache/struts2/showcase/person/Person.java index 20cb4d52d..440966a45 100644 --- a/apps/showcase/src/main/java/org/apache/struts2/showcase/person/Person.java +++ b/apps/showcase/src/main/java/org/apache/struts2/showcase/person/Person.java @@ -1,19 +1,22 @@ /* * $Id$ * - * Copyright 2006 The Apache Software Foundation. + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at + * http://www.apache.org/licenses/LICENSE-2.0 * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. */ package org.apache.struts2.showcase.person; diff --git a/apps/showcase/src/main/java/org/apache/struts2/showcase/person/PersonManager.java b/apps/showcase/src/main/java/org/apache/struts2/showcase/person/PersonManager.java index 1a984b108..17771f828 100644 --- a/apps/showcase/src/main/java/org/apache/struts2/showcase/person/PersonManager.java +++ b/apps/showcase/src/main/java/org/apache/struts2/showcase/person/PersonManager.java @@ -1,19 +1,22 @@ /* * $Id$ * - * Copyright 2006 The Apache Software Foundation. + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at + * http://www.apache.org/licenses/LICENSE-2.0 * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. */ package org.apache.struts2.showcase.person; diff --git a/apps/showcase/src/main/java/org/apache/struts2/showcase/sitemesh/NoneDecoratorMapper.java b/apps/showcase/src/main/java/org/apache/struts2/showcase/sitemesh/NoneDecoratorMapper.java index ad701c3f5..8fd9a0a25 100644 --- a/apps/showcase/src/main/java/org/apache/struts2/showcase/sitemesh/NoneDecoratorMapper.java +++ b/apps/showcase/src/main/java/org/apache/struts2/showcase/sitemesh/NoneDecoratorMapper.java @@ -1,3 +1,23 @@ +/* + * $Id$ + * + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ package org.apache.struts2.showcase.sitemesh; import com.opensymphony.module.sitemesh.Decorator; @@ -6,9 +26,6 @@ import com.opensymphony.module.sitemesh.mapper.AbstractDecoratorMapper; import javax.servlet.http.HttpServletRequest; -/** - * @author Patrick Lightbody (plightbo at gmail dot com) - */ public class NoneDecoratorMapper extends AbstractDecoratorMapper { public Decorator getDecorator(HttpServletRequest req, Page page) { if ("none".equals(req.getAttribute("decorator"))) { diff --git a/apps/showcase/src/main/java/org/apache/struts2/showcase/source/ViewSourceAction.java b/apps/showcase/src/main/java/org/apache/struts2/showcase/source/ViewSourceAction.java index 327bfe489..21f3d8e7f 100644 --- a/apps/showcase/src/main/java/org/apache/struts2/showcase/source/ViewSourceAction.java +++ b/apps/showcase/src/main/java/org/apache/struts2/showcase/source/ViewSourceAction.java @@ -1,19 +1,22 @@ /* - * $Id: CreatePerson.java 420385 2006-07-10 00:57:05Z mrdon $ + * $Id: $ * - * Copyright 2006 The Apache Software Foundation. + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at + * http://www.apache.org/licenses/LICENSE-2.0 * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. */ package org.apache.struts2.showcase.source; @@ -42,23 +45,23 @@ public class ViewSourceAction extends ActionSupport implements ServletContextAwa private String page; private String className; private String config; - + private List pageLines; private List classLines; private List configLines; - + private int configLine; private int padding = 10; - + private ServletContext servletContext; - + public String execute() throws MalformedURLException, IOException { - + if (page != null) { - + InputStream in = ClassLoaderUtil.getResourceAsStream(page.substring(page.indexOf("//")+1), getClass()); page = page.replace("//", "/"); - + if (in == null) { in = servletContext.getResourceAsStream(page); while (in == null && page.indexOf('/', 1) > 0) { @@ -68,7 +71,7 @@ public class ViewSourceAction extends ActionSupport implements ServletContextAwa } pageLines = read(in, -1); } - + if (className != null) { className = "/"+className.replace('.', '/') + ".java"; InputStream in = getClass().getResourceAsStream(className); @@ -77,7 +80,7 @@ public class ViewSourceAction extends ActionSupport implements ServletContextAwa } classLines = read(in, -1); } - + if (config != null) { int pos = config.lastIndexOf(':'); configLine = Integer.parseInt(config.substring(pos+1)); @@ -107,15 +110,15 @@ public class ViewSourceAction extends ActionSupport implements ServletContextAwa public void setPage(String page) { this.page = page; } - + /** * @param padding the padding to set */ public void setPadding(int padding) { this.padding = padding; } - - + + /** * @return the classLines @@ -137,7 +140,7 @@ public class ViewSourceAction extends ActionSupport implements ServletContextAwa public List getPageLines() { return pageLines; } - + /** * @return the className */ @@ -158,14 +161,14 @@ public class ViewSourceAction extends ActionSupport implements ServletContextAwa public String getPage() { return page; } - + /** * @return the configLine */ public int getConfigLine() { return configLine; } - + /** * @return the padding */ @@ -176,7 +179,7 @@ public class ViewSourceAction extends ActionSupport implements ServletContextAwa /** * Reads in a strea, optionally only including the target line number * and its padding - * + * * @param in The input stream * @param targetLineNumber The target line number, negative to read all * @return A list of lines @@ -193,7 +196,7 @@ public class ViewSourceAction extends ActionSupport implements ServletContextAwa } try { BufferedReader reader = new BufferedReader(new InputStreamReader(in)); - + int lineno = 0; String line; while ((line = reader.readLine()) != null) { @@ -212,6 +215,6 @@ public class ViewSourceAction extends ActionSupport implements ServletContextAwa public void setServletContext(ServletContext arg0) { this.servletContext = arg0; } - + } diff --git a/apps/showcase/src/main/java/org/apache/struts2/showcase/tag/nonui/actionPrefix/SubmitAction.java b/apps/showcase/src/main/java/org/apache/struts2/showcase/tag/nonui/actionPrefix/SubmitAction.java index fb20f27d9..a8b350c85 100644 --- a/apps/showcase/src/main/java/org/apache/struts2/showcase/tag/nonui/actionPrefix/SubmitAction.java +++ b/apps/showcase/src/main/java/org/apache/struts2/showcase/tag/nonui/actionPrefix/SubmitAction.java @@ -1,22 +1,42 @@ +/* + * $Id$ + * + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ package org.apache.struts2.showcase.tag.nonui.actionPrefix; import com.opensymphony.xwork2.ActionSupport; public class SubmitAction extends ActionSupport { - private static final long serialVersionUID = -7832803019378213087L; - - private String text; - - public String getText() { return text; } - public void setText(String text) { this.text = text; } - - public String execute() throws Exception { - return SUCCESS; - } - - public String alternateMethod() { - return "methodPrefixResult"; - } - + private static final long serialVersionUID = -7832803019378213087L; + + private String text; + + public String getText() { return text; } + public void setText(String text) { this.text = text; } + + public String execute() throws Exception { + return SUCCESS; + } + + public String alternateMethod() { + return "methodPrefixResult"; + } + } diff --git a/apps/showcase/src/main/java/org/apache/struts2/showcase/tag/nonui/actiontag/ActionTagDemo.java b/apps/showcase/src/main/java/org/apache/struts2/showcase/tag/nonui/actiontag/ActionTagDemo.java index 1874adffd..6de46d258 100644 --- a/apps/showcase/src/main/java/org/apache/struts2/showcase/tag/nonui/actiontag/ActionTagDemo.java +++ b/apps/showcase/src/main/java/org/apache/struts2/showcase/tag/nonui/actiontag/ActionTagDemo.java @@ -1,19 +1,22 @@ /* * $Id$ * - * Copyright 2006 The Apache Software Foundation. + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at + * http://www.apache.org/licenses/LICENSE-2.0 * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. */ package org.apache.struts2.showcase.tag.nonui.actiontag; @@ -22,14 +25,14 @@ import com.opensymphony.xwork2.ActionSupport; /** */ public class ActionTagDemo extends ActionSupport { - - private static final long serialVersionUID = -2749145880590245184L; - public String show() throws Exception { - return SUCCESS; - } - - public String doInclude() throws Exception { - return SUCCESS; - } -} + private static final long serialVersionUID = -2749145880590245184L; + + public String show() throws Exception { + return SUCCESS; + } + + public String doInclude() throws Exception { + return SUCCESS; + } +} diff --git a/apps/showcase/src/main/java/org/apache/struts2/showcase/tag/nonui/iteratortag/AppendIteratorTagDemo.java b/apps/showcase/src/main/java/org/apache/struts2/showcase/tag/nonui/iteratortag/AppendIteratorTagDemo.java index b4cc3d033..a47ee62a0 100644 --- a/apps/showcase/src/main/java/org/apache/struts2/showcase/tag/nonui/iteratortag/AppendIteratorTagDemo.java +++ b/apps/showcase/src/main/java/org/apache/struts2/showcase/tag/nonui/iteratortag/AppendIteratorTagDemo.java @@ -1,19 +1,22 @@ /* * $Id$ * - * Copyright 2006 The Apache Software Foundation. + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at + * http://www.apache.org/licenses/LICENSE-2.0 * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. */ package org.apache.struts2.showcase.tag.nonui.iteratortag; @@ -21,57 +24,57 @@ import com.opensymphony.xwork2.ActionSupport; import com.opensymphony.xwork2.Validateable; /** - * + * */ public class AppendIteratorTagDemo extends ActionSupport implements Validateable { - private static final long serialVersionUID = -6525059998526094664L; - - private String iteratorValue1; - private String iteratorValue2; - - - public void validate() { - if (iteratorValue1 == null || iteratorValue1.trim().length() <= 0 ) { - addFieldError("iteratorValue1", "iterator value 1 cannot be empty"); - } - else if (iteratorValue1.trim().indexOf(",") <= 0) { - addFieldError("iteratorValue1", "iterator value 1 needs to be comma separated"); - } - if (iteratorValue2 == null || iteratorValue2.trim().length() <= 0) { - addFieldError("iteratorValue2", "iterator value 2 cannot be empty"); - } - else if (iteratorValue2.trim().indexOf(",") <= 0) { - addFieldError("iteratorValue2", "iterator value 2 needs to be comma separated"); - } - } - - - - - public String getIteratorValue1() { - return iteratorValue1; - } - public void setIteratorValue1(String iteratorValue1) { - this.iteratorValue1 = iteratorValue1; - } - - - - public String getIteratorValue2() { - return iteratorValue2; - } - public void setIteratorValue2(String iteratorValue2) { - this.iteratorValue2 = iteratorValue2; - } - - - - public String input() throws Exception { - return SUCCESS; - } - - public String submit() throws Exception { - return SUCCESS; - } + private static final long serialVersionUID = -6525059998526094664L; + + private String iteratorValue1; + private String iteratorValue2; + + + public void validate() { + if (iteratorValue1 == null || iteratorValue1.trim().length() <= 0 ) { + addFieldError("iteratorValue1", "iterator value 1 cannot be empty"); + } + else if (iteratorValue1.trim().indexOf(",") <= 0) { + addFieldError("iteratorValue1", "iterator value 1 needs to be comma separated"); + } + if (iteratorValue2 == null || iteratorValue2.trim().length() <= 0) { + addFieldError("iteratorValue2", "iterator value 2 cannot be empty"); + } + else if (iteratorValue2.trim().indexOf(",") <= 0) { + addFieldError("iteratorValue2", "iterator value 2 needs to be comma separated"); + } + } + + + + + public String getIteratorValue1() { + return iteratorValue1; + } + public void setIteratorValue1(String iteratorValue1) { + this.iteratorValue1 = iteratorValue1; + } + + + + public String getIteratorValue2() { + return iteratorValue2; + } + public void setIteratorValue2(String iteratorValue2) { + this.iteratorValue2 = iteratorValue2; + } + + + + public String input() throws Exception { + return SUCCESS; + } + + public String submit() throws Exception { + return SUCCESS; + } } diff --git a/apps/showcase/src/main/java/org/apache/struts2/showcase/tag/nonui/iteratortag/IteratorGeneratorTagDemo.java b/apps/showcase/src/main/java/org/apache/struts2/showcase/tag/nonui/iteratortag/IteratorGeneratorTagDemo.java index bbd214ae5..f4b74fd2a 100644 --- a/apps/showcase/src/main/java/org/apache/struts2/showcase/tag/nonui/iteratortag/IteratorGeneratorTagDemo.java +++ b/apps/showcase/src/main/java/org/apache/struts2/showcase/tag/nonui/iteratortag/IteratorGeneratorTagDemo.java @@ -1,19 +1,22 @@ /* * $Id$ * - * Copyright 2006 The Apache Software Foundation. + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at + * http://www.apache.org/licenses/LICENSE-2.0 * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. */ package org.apache.struts2.showcase.tag.nonui.iteratortag; @@ -23,44 +26,44 @@ import com.opensymphony.xwork2.ActionSupport; */ public class IteratorGeneratorTagDemo extends ActionSupport { - private static final long serialVersionUID = 6893616642389337039L; - - private String value; - private Integer count; - private String separator; - - - public String getValue() { - return value; - } - public void setValue(String value) { - this.value = value; - } - - - public Integer getCount() { - return count; - } - public void setCount(Integer count) { - this.count = count; - } - - - - public String getSeparator() { - return this.separator; - } - public void setSeparator(String separator) { - this.separator = separator; - } - - - public String submit() throws Exception { - return SUCCESS; - } - - - public String input() throws Exception { - return SUCCESS; - } + private static final long serialVersionUID = 6893616642389337039L; + + private String value; + private Integer count; + private String separator; + + + public String getValue() { + return value; + } + public void setValue(String value) { + this.value = value; + } + + + public Integer getCount() { + return count; + } + public void setCount(Integer count) { + this.count = count; + } + + + + public String getSeparator() { + return this.separator; + } + public void setSeparator(String separator) { + this.separator = separator; + } + + + public String submit() throws Exception { + return SUCCESS; + } + + + public String input() throws Exception { + return SUCCESS; + } } diff --git a/apps/showcase/src/main/java/org/apache/struts2/showcase/tag/nonui/iteratortag/MergeIteratorTagDemo.java b/apps/showcase/src/main/java/org/apache/struts2/showcase/tag/nonui/iteratortag/MergeIteratorTagDemo.java index 9bd13c43d..64dbe87b1 100644 --- a/apps/showcase/src/main/java/org/apache/struts2/showcase/tag/nonui/iteratortag/MergeIteratorTagDemo.java +++ b/apps/showcase/src/main/java/org/apache/struts2/showcase/tag/nonui/iteratortag/MergeIteratorTagDemo.java @@ -1,19 +1,22 @@ /* * $Id$ * - * Copyright 2006 The Apache Software Foundation. + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at + * http://www.apache.org/licenses/LICENSE-2.0 * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. */ package org.apache.struts2.showcase.tag.nonui.iteratortag; @@ -25,54 +28,54 @@ import com.opensymphony.xwork2.Validateable; */ public class MergeIteratorTagDemo extends ActionSupport implements Validateable { - private static final long serialVersionUID = 4401107963952961695L; - - private String iteratorValue1; - private String iteratorValue2; - - - public void validate() { - if (iteratorValue1 == null || iteratorValue1.trim().length() <= 0 ) { - addFieldError("iteratorValue1", "iterator value 1 cannot be empty"); - } - else if (iteratorValue1.trim().indexOf(",") <= 0) { - addFieldError("iteratorValue1", "iterator value 1 needs to be comma separated"); - } - if (iteratorValue2 == null || iteratorValue2.trim().length() <= 0) { - addFieldError("iteratorValue2", "iterator value 2 cannot be empty"); - } - else if (iteratorValue2.trim().indexOf(",") <= 0) { - addFieldError("iteratorValue2", "iterator value 2 needs to be comma separated"); - } - } - - - - public String getIteratorValue1() { - return this.iteratorValue1; - } - public void setIteratorValue1(String iteratorValue1) { - this.iteratorValue1 = iteratorValue1; - } - - - - public String getIteratorValue2() { - return this.iteratorValue2; - } - public void setIteratorValue2(String iteratorValue2) { - this.iteratorValue2 = iteratorValue2; - } - - - - - - public String input() throws Exception { - return SUCCESS; - } - - public String submit() throws Exception { - return SUCCESS; - } + private static final long serialVersionUID = 4401107963952961695L; + + private String iteratorValue1; + private String iteratorValue2; + + + public void validate() { + if (iteratorValue1 == null || iteratorValue1.trim().length() <= 0 ) { + addFieldError("iteratorValue1", "iterator value 1 cannot be empty"); + } + else if (iteratorValue1.trim().indexOf(",") <= 0) { + addFieldError("iteratorValue1", "iterator value 1 needs to be comma separated"); + } + if (iteratorValue2 == null || iteratorValue2.trim().length() <= 0) { + addFieldError("iteratorValue2", "iterator value 2 cannot be empty"); + } + else if (iteratorValue2.trim().indexOf(",") <= 0) { + addFieldError("iteratorValue2", "iterator value 2 needs to be comma separated"); + } + } + + + + public String getIteratorValue1() { + return this.iteratorValue1; + } + public void setIteratorValue1(String iteratorValue1) { + this.iteratorValue1 = iteratorValue1; + } + + + + public String getIteratorValue2() { + return this.iteratorValue2; + } + public void setIteratorValue2(String iteratorValue2) { + this.iteratorValue2 = iteratorValue2; + } + + + + + + public String input() throws Exception { + return SUCCESS; + } + + public String submit() throws Exception { + return SUCCESS; + } } diff --git a/apps/showcase/src/main/java/org/apache/struts2/showcase/tag/nonui/iteratortag/SubsetIteratorTagDemo.java b/apps/showcase/src/main/java/org/apache/struts2/showcase/tag/nonui/iteratortag/SubsetIteratorTagDemo.java index c313eb7ed..c4002e908 100644 --- a/apps/showcase/src/main/java/org/apache/struts2/showcase/tag/nonui/iteratortag/SubsetIteratorTagDemo.java +++ b/apps/showcase/src/main/java/org/apache/struts2/showcase/tag/nonui/iteratortag/SubsetIteratorTagDemo.java @@ -1,19 +1,22 @@ /* * $Id$ * - * Copyright 2006 The Apache Software Foundation. + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at + * http://www.apache.org/licenses/LICENSE-2.0 * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. */ package org.apache.struts2.showcase.tag.nonui.iteratortag; @@ -21,65 +24,65 @@ import com.opensymphony.xwork2.ActionSupport; import com.opensymphony.xwork2.Validateable; /** - * + * */ public class SubsetIteratorTagDemo extends ActionSupport implements Validateable { - private static final long serialVersionUID = -8151855954644052650L; - - private String iteratorValue; - private Integer count; - private Integer start; - - - public void validate() { - if (iteratorValue == null || iteratorValue.trim().length() <= 0 ) { - addFieldError("iteratorValue1", "iterator value 1 cannot be empty"); - } - else if (iteratorValue.trim().indexOf(",") <= 0) { - addFieldError("iteratorValue1", "iterator value 1 needs to be comma separated"); - } - } - - - - public String getIteratorValue() { - return this.iteratorValue; - } - public void setIteratorValue(String iteratorValue) { - this.iteratorValue = iteratorValue; - } - - - - public Integer getCount() { - return this.count; - } - public void setCount(Integer count) { - this.count = count; - } - - - - public Integer getStart() { - return this.start; - } - public void setStart(Integer start) { - this.start = start; - } - - - - - - public String input() throws Exception { - return SUCCESS; - } - - public String submit() throws Exception { - return SUCCESS; - } - - - + private static final long serialVersionUID = -8151855954644052650L; + + private String iteratorValue; + private Integer count; + private Integer start; + + + public void validate() { + if (iteratorValue == null || iteratorValue.trim().length() <= 0 ) { + addFieldError("iteratorValue1", "iterator value 1 cannot be empty"); + } + else if (iteratorValue.trim().indexOf(",") <= 0) { + addFieldError("iteratorValue1", "iterator value 1 needs to be comma separated"); + } + } + + + + public String getIteratorValue() { + return this.iteratorValue; + } + public void setIteratorValue(String iteratorValue) { + this.iteratorValue = iteratorValue; + } + + + + public Integer getCount() { + return this.count; + } + public void setCount(Integer count) { + this.count = count; + } + + + + public Integer getStart() { + return this.start; + } + public void setStart(Integer start) { + this.start = start; + } + + + + + + public String input() throws Exception { + return SUCCESS; + } + + public String submit() throws Exception { + return SUCCESS; + } + + + } diff --git a/apps/showcase/src/main/java/org/apache/struts2/showcase/token/TokenAction.java b/apps/showcase/src/main/java/org/apache/struts2/showcase/token/TokenAction.java index 9101dd40d..67cc2cedb 100644 --- a/apps/showcase/src/main/java/org/apache/struts2/showcase/token/TokenAction.java +++ b/apps/showcase/src/main/java/org/apache/struts2/showcase/token/TokenAction.java @@ -1,19 +1,22 @@ /* * $Id$ * - * Copyright 2006 The Apache Software Foundation. + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at + * http://www.apache.org/licenses/LICENSE-2.0 * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. */ package org.apache.struts2.showcase.token; @@ -28,9 +31,9 @@ import java.util.Date; */ public class TokenAction extends ActionSupport { - private static final long serialVersionUID = 616150375751184884L; - - private int amount; + private static final long serialVersionUID = 616150375751184884L; + + private int amount; public String execute() throws Exception { // transfer from source to destination diff --git a/apps/showcase/src/main/java/org/apache/struts2/showcase/tutorial/HelloName.java b/apps/showcase/src/main/java/org/apache/struts2/showcase/tutorial/HelloName.java deleted file mode 100644 index 4fa481726..000000000 --- a/apps/showcase/src/main/java/org/apache/struts2/showcase/tutorial/HelloName.java +++ /dev/null @@ -1,23 +0,0 @@ -package org.apache.struts2.showcase.tutorial; - -import com.opensymphony.xwork2.ActionSupport; - -public class HelloName extends ActionSupport { - - public String execute() throws Exception { - if (getName() == null || getName().length() == 0) - return ERROR; - else - return SUCCESS; - } - - private String name; - - public String getName() { - return name; - } - - public void setName(String name) { - this.name = name; - } -} \ No newline at end of file diff --git a/apps/showcase/src/main/java/org/apache/struts2/showcase/tutorial/HelloName2.java b/apps/showcase/src/main/java/org/apache/struts2/showcase/tutorial/HelloName2.java deleted file mode 100644 index 11d51a570..000000000 --- a/apps/showcase/src/main/java/org/apache/struts2/showcase/tutorial/HelloName2.java +++ /dev/null @@ -1,29 +0,0 @@ -package org.apache.struts2.showcase.tutorial; - -import com.opensymphony.xwork2.ActionSupport; -import org.apache.struts2.interceptor.ParameterAware; - -import java.util.Map; - -public class HelloName2 extends ActionSupport implements ParameterAware { - - public static String NAME = "name"; - - public String execute() { - String[] name = (String[]) parameters.get(NAME); - if (name == null || name[0] == null || name[0].length() == 0) - return ERROR; - else - return SUCCESS; - } - - Map parameters; - - public Map getParameters() { - return parameters; - } - - public void setParameters(Map parameters) { - this.parameters = parameters; - } -} diff --git a/apps/showcase/src/main/java/org/apache/struts2/showcase/tutorial/HelloWorld.java b/apps/showcase/src/main/java/org/apache/struts2/showcase/tutorial/HelloWorld.java deleted file mode 100644 index 28a45ba76..000000000 --- a/apps/showcase/src/main/java/org/apache/struts2/showcase/tutorial/HelloWorld.java +++ /dev/null @@ -1,23 +0,0 @@ -package org.apache.struts2.showcase.tutorial; - -import com.opensymphony.xwork2.Action; - -import java.text.DateFormat; -import java.util.Date; - -public class HelloWorld implements Action { - - public String execute() { - message = "Hello, World!\n"; - message += "The time is:\n"; - message += DateFormat.getDateInstance().format(new Date()); - return SUCCESS; - } - - private String message; - - public String getMessage() { - return message; - } - -} \ No newline at end of file diff --git a/apps/showcase/src/main/java/org/apache/struts2/showcase/validation/AbstractValidationActionSupport.java b/apps/showcase/src/main/java/org/apache/struts2/showcase/validation/AbstractValidationActionSupport.java index 39d1047f8..346745d3d 100644 --- a/apps/showcase/src/main/java/org/apache/struts2/showcase/validation/AbstractValidationActionSupport.java +++ b/apps/showcase/src/main/java/org/apache/struts2/showcase/validation/AbstractValidationActionSupport.java @@ -1,19 +1,22 @@ /* * $Id$ * - * Copyright 2006 The Apache Software Foundation. + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at + * http://www.apache.org/licenses/LICENSE-2.0 * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. */ package org.apache.struts2.showcase.validation; @@ -22,12 +25,12 @@ import com.opensymphony.xwork2.ActionSupport; /** */ public abstract class AbstractValidationActionSupport extends ActionSupport { - - public String submit() throws Exception { - return "success"; - } - - public String input() throws Exception { - return "input"; - } + + public String submit() throws Exception { + return "success"; + } + + public String input() throws Exception { + return "input"; + } } diff --git a/apps/showcase/src/main/java/org/apache/struts2/showcase/validation/FieldValidatorsExampleAction.java b/apps/showcase/src/main/java/org/apache/struts2/showcase/validation/FieldValidatorsExampleAction.java index 9da8bd8af..e1c4c41bf 100644 --- a/apps/showcase/src/main/java/org/apache/struts2/showcase/validation/FieldValidatorsExampleAction.java +++ b/apps/showcase/src/main/java/org/apache/struts2/showcase/validation/FieldValidatorsExampleAction.java @@ -1,19 +1,22 @@ /* * $Id$ * - * Copyright 2006 The Apache Software Foundation. + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at + * http://www.apache.org/licenses/LICENSE-2.0 * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. */ package org.apache.struts2.showcase.validation; @@ -25,70 +28,70 @@ import java.sql.Date; // START SNIPPET: fieldValidatorsExample public class FieldValidatorsExampleAction extends AbstractValidationActionSupport { - - private static final long serialVersionUID = -4829381083003175423L; - - private String requiredValidatorField = null; - private String requiredStringValidatorField = null; - private Integer integerValidatorField = null; - private Date dateValidatorField = null; - private String emailValidatorField = null; - private String urlValidatorField = null; - private String stringLengthValidatorField = null; - private String regexValidatorField = null; - private String fieldExpressionValidatorField = null; - - - - public Date getDateValidatorField() { - return dateValidatorField; - } - public void setDateValidatorField(Date dateValidatorField) { - this.dateValidatorField = dateValidatorField; - } - public String getEmailValidatorField() { - return emailValidatorField; - } - public void setEmailValidatorField(String emailValidatorField) { - this.emailValidatorField = emailValidatorField; - } - public Integer getIntegerValidatorField() { - return integerValidatorField; - } - public void setIntegerValidatorField(Integer integerValidatorField) { - this.integerValidatorField = integerValidatorField; - } - public String getRegexValidatorField() { - return regexValidatorField; - } - public void setRegexValidatorField(String regexValidatorField) { - this.regexValidatorField = regexValidatorField; - } - public String getRequiredStringValidatorField() { - return requiredStringValidatorField; - } - public void setRequiredStringValidatorField(String requiredStringValidatorField) { - this.requiredStringValidatorField = requiredStringValidatorField; - } - public String getRequiredValidatorField() { - return requiredValidatorField; - } - public void setRequiredValidatorField(String requiredValidatorField) { - this.requiredValidatorField = requiredValidatorField; - } - public String getStringLengthValidatorField() { - return stringLengthValidatorField; - } - public void setStringLengthValidatorField(String stringLengthValidatorField) { - this.stringLengthValidatorField = stringLengthValidatorField; - } - public String getFieldExpressionValidatorField() { - return fieldExpressionValidatorField; - } - public void setFieldExpressionValidatorField( - String fieldExpressionValidatorField) { - this.fieldExpressionValidatorField = fieldExpressionValidatorField; - } + + private static final long serialVersionUID = -4829381083003175423L; + + private String requiredValidatorField = null; + private String requiredStringValidatorField = null; + private Integer integerValidatorField = null; + private Date dateValidatorField = null; + private String emailValidatorField = null; + private String urlValidatorField = null; + private String stringLengthValidatorField = null; + private String regexValidatorField = null; + private String fieldExpressionValidatorField = null; + + + + public Date getDateValidatorField() { + return dateValidatorField; + } + public void setDateValidatorField(Date dateValidatorField) { + this.dateValidatorField = dateValidatorField; + } + public String getEmailValidatorField() { + return emailValidatorField; + } + public void setEmailValidatorField(String emailValidatorField) { + this.emailValidatorField = emailValidatorField; + } + public Integer getIntegerValidatorField() { + return integerValidatorField; + } + public void setIntegerValidatorField(Integer integerValidatorField) { + this.integerValidatorField = integerValidatorField; + } + public String getRegexValidatorField() { + return regexValidatorField; + } + public void setRegexValidatorField(String regexValidatorField) { + this.regexValidatorField = regexValidatorField; + } + public String getRequiredStringValidatorField() { + return requiredStringValidatorField; + } + public void setRequiredStringValidatorField(String requiredStringValidatorField) { + this.requiredStringValidatorField = requiredStringValidatorField; + } + public String getRequiredValidatorField() { + return requiredValidatorField; + } + public void setRequiredValidatorField(String requiredValidatorField) { + this.requiredValidatorField = requiredValidatorField; + } + public String getStringLengthValidatorField() { + return stringLengthValidatorField; + } + public void setStringLengthValidatorField(String stringLengthValidatorField) { + this.stringLengthValidatorField = stringLengthValidatorField; + } + public String getFieldExpressionValidatorField() { + return fieldExpressionValidatorField; + } + public void setFieldExpressionValidatorField( + String fieldExpressionValidatorField) { + this.fieldExpressionValidatorField = fieldExpressionValidatorField; + } public String getUrlValidatorField() { return urlValidatorField; diff --git a/apps/showcase/src/main/java/org/apache/struts2/showcase/validation/NonFieldValidatorsExampleAction.java b/apps/showcase/src/main/java/org/apache/struts2/showcase/validation/NonFieldValidatorsExampleAction.java index 1461fcda0..447b17c79 100644 --- a/apps/showcase/src/main/java/org/apache/struts2/showcase/validation/NonFieldValidatorsExampleAction.java +++ b/apps/showcase/src/main/java/org/apache/struts2/showcase/validation/NonFieldValidatorsExampleAction.java @@ -1,19 +1,22 @@ /* * $Id$ * - * Copyright 2006 The Apache Software Foundation. + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at + * http://www.apache.org/licenses/LICENSE-2.0 * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. */ package org.apache.struts2.showcase.validation; @@ -23,31 +26,31 @@ package org.apache.struts2.showcase.validation; // START SNIPPET: nonFieldValidatorsExample public class NonFieldValidatorsExampleAction extends AbstractValidationActionSupport { - - private static final long serialVersionUID = -524460368233581186L; - - private String someText; - private String someTextRetype; - private String someTextRetypeAgain; - - public String getSomeText() { - return someText; - } - public void setSomeText(String someText) { - this.someText = someText; - } - public String getSomeTextRetype() { - return someTextRetype; - } - public void setSomeTextRetype(String someTextRetype) { - this.someTextRetype = someTextRetype; - } - public String getSomeTextRetypeAgain() { - return someTextRetypeAgain; - } - public void setSomeTextRetypeAgain(String someTextRetypeAgain) { - this.someTextRetypeAgain = someTextRetypeAgain; - } + + private static final long serialVersionUID = -524460368233581186L; + + private String someText; + private String someTextRetype; + private String someTextRetypeAgain; + + public String getSomeText() { + return someText; + } + public void setSomeText(String someText) { + this.someText = someText; + } + public String getSomeTextRetype() { + return someTextRetype; + } + public void setSomeTextRetype(String someTextRetype) { + this.someTextRetype = someTextRetype; + } + public String getSomeTextRetypeAgain() { + return someTextRetypeAgain; + } + public void setSomeTextRetypeAgain(String someTextRetypeAgain) { + this.someTextRetypeAgain = someTextRetypeAgain; + } } diff --git a/apps/showcase/src/main/java/org/apache/struts2/showcase/validation/QuizAction.java b/apps/showcase/src/main/java/org/apache/struts2/showcase/validation/QuizAction.java index b1c4e6b6f..81e27360b 100644 --- a/apps/showcase/src/main/java/org/apache/struts2/showcase/validation/QuizAction.java +++ b/apps/showcase/src/main/java/org/apache/struts2/showcase/validation/QuizAction.java @@ -1,19 +1,22 @@ /* * $Id$ * - * Copyright 2006 The Apache Software Foundation. + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at + * http://www.apache.org/licenses/LICENSE-2.0 * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. */ package org.apache.struts2.showcase.validation; @@ -22,13 +25,13 @@ import com.opensymphony.xwork2.ActionSupport; /** */ -// START SNIPPET: quizAction +// START SNIPPET: quizAction public class QuizAction extends ActionSupport { - - private static final long serialVersionUID = -7505437345373234225L; - - String name; + + private static final long serialVersionUID = -7505437345373234225L; + + String name; int age; String answer; diff --git a/apps/showcase/src/main/java/org/apache/struts2/showcase/validation/SubmitApplication.java b/apps/showcase/src/main/java/org/apache/struts2/showcase/validation/SubmitApplication.java index 7fbfecac2..99bf87479 100644 --- a/apps/showcase/src/main/java/org/apache/struts2/showcase/validation/SubmitApplication.java +++ b/apps/showcase/src/main/java/org/apache/struts2/showcase/validation/SubmitApplication.java @@ -1,57 +1,60 @@ /* * $Id$ * - * Copyright 2006 The Apache Software Foundation. + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at + * http://www.apache.org/licenses/LICENSE-2.0 * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. */ package org.apache.struts2.showcase.validation; import com.opensymphony.xwork2.ActionSupport; /** - * + * * @version $Date$ $Id$ */ public class SubmitApplication extends ActionSupport { - - private String name; - private Integer age; - - public void setName(String name) { - this.name = name; - } - public String getName() { - return this.name; - } - - public void setAge(Integer age) { - this.age = age; - } - public Integer getAge() { - return age; - } - - public String submitApplication() throws Exception { - return SUCCESS; - } - - public String applicationOk() throws Exception { - addActionMessage("Your application looks ok."); - return SUCCESS; - } - public String cancelApplication() throws Exception { - addActionMessage("So you have decided to cancel the application"); - return SUCCESS; - } + + private String name; + private Integer age; + + public void setName(String name) { + this.name = name; + } + public String getName() { + return this.name; + } + + public void setAge(Integer age) { + this.age = age; + } + public Integer getAge() { + return age; + } + + public String submitApplication() throws Exception { + return SUCCESS; + } + + public String applicationOk() throws Exception { + addActionMessage("Your application looks ok."); + return SUCCESS; + } + public String cancelApplication() throws Exception { + addActionMessage("So you have decided to cancel the application"); + return SUCCESS; + } } diff --git a/apps/showcase/src/main/java/org/apache/struts2/showcase/validation/User.java b/apps/showcase/src/main/java/org/apache/struts2/showcase/validation/User.java index 32a88f228..111f8be52 100644 --- a/apps/showcase/src/main/java/org/apache/struts2/showcase/validation/User.java +++ b/apps/showcase/src/main/java/org/apache/struts2/showcase/validation/User.java @@ -1,19 +1,22 @@ /* * $Id$ * - * Copyright 2006 The Apache Software Foundation. + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at + * http://www.apache.org/licenses/LICENSE-2.0 * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. */ package org.apache.struts2.showcase.validation; @@ -22,29 +25,29 @@ import java.sql.Date; /** */ public class User { - - private String name; - private Integer age; - private Date birthday; - - - public Integer getAge() { - return age; - } - public void setAge(Integer age) { - this.age = age; - } - public Date getBirthday() { - return birthday; - } - public void setBirthday(Date birthday) { - this.birthday = birthday; - } - public String getName() { - return name; - } - public void setName(String name) { - this.name = name; - } + + private String name; + private Integer age; + private Date birthday; + + + public Integer getAge() { + return age; + } + public void setAge(Integer age) { + this.age = age; + } + public Date getBirthday() { + return birthday; + } + public void setBirthday(Date birthday) { + this.birthday = birthday; + } + public String getName() { + return name; + } + public void setName(String name) { + this.name = name; + } } diff --git a/apps/showcase/src/main/java/org/apache/struts2/showcase/validation/VisitorValidatorsExampleAction.java b/apps/showcase/src/main/java/org/apache/struts2/showcase/validation/VisitorValidatorsExampleAction.java index 08a489d19..91391a314 100644 --- a/apps/showcase/src/main/java/org/apache/struts2/showcase/validation/VisitorValidatorsExampleAction.java +++ b/apps/showcase/src/main/java/org/apache/struts2/showcase/validation/VisitorValidatorsExampleAction.java @@ -1,19 +1,22 @@ /* * $Id$ * - * Copyright 2006 The Apache Software Foundation. + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at + * http://www.apache.org/licenses/LICENSE-2.0 * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. */ package org.apache.struts2.showcase.validation; @@ -22,17 +25,17 @@ package org.apache.struts2.showcase.validation; public class VisitorValidatorsExampleAction extends AbstractValidationActionSupport { - private static final long serialVersionUID = 4375454086939598216L; - - private User user; - - public User getUser() { - return user; - } - - public void setUser(User user) { - this.user = user; - } + private static final long serialVersionUID = 4375454086939598216L; + + private User user; + + public User getUser() { + return user; + } + + public void setUser(User user) { + this.user = user; + } } diff --git a/apps/showcase/src/main/java/org/apache/struts2/showcase/wait/LongProcessAction.java b/apps/showcase/src/main/java/org/apache/struts2/showcase/wait/LongProcessAction.java index 7f33be892..e449d9f09 100644 --- a/apps/showcase/src/main/java/org/apache/struts2/showcase/wait/LongProcessAction.java +++ b/apps/showcase/src/main/java/org/apache/struts2/showcase/wait/LongProcessAction.java @@ -1,19 +1,22 @@ /* * $Id$ * - * Copyright 2006 The Apache Software Foundation. + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at + * http://www.apache.org/licenses/LICENSE-2.0 * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. */ package org.apache.struts2.showcase.wait; @@ -25,9 +28,9 @@ import com.opensymphony.xwork2.ActionSupport; */ public class LongProcessAction extends ActionSupport { - private static final long serialVersionUID = 2471910747833998708L; - - private int time; + private static final long serialVersionUID = 2471910747833998708L; + + private int time; public int getTime() { return time; diff --git a/core/src/main/java/org/apache/struts2/ServletActionContext.java b/core/src/main/java/org/apache/struts2/ServletActionContext.java index 4a618d904..c6d83b7ca 100644 --- a/core/src/main/java/org/apache/struts2/ServletActionContext.java +++ b/core/src/main/java/org/apache/struts2/ServletActionContext.java @@ -1,19 +1,22 @@ /* * $Id$ * - * Copyright 2006 The Apache Software Foundation. + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at + * http://www.apache.org/licenses/LICENSE-2.0 * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. */ package org.apache.struts2; @@ -36,10 +39,10 @@ import com.opensymphony.xwork2.util.ValueStack; * web objects like servlet parameters, request attributes and things like the HTTP session. */ public class ServletActionContext extends ActionContext implements StrutsStatics { - - private static final long serialVersionUID = -666854718275106687L; - - public static final String STRUTS_VALUESTACK_KEY = "struts.valueStack"; + + private static final long serialVersionUID = -666854718275106687L; + + public static final String STRUTS_VALUESTACK_KEY = "struts.valueStack"; public static final String ACTION_MAPPING = "struts.actionMapping"; @SuppressWarnings("unused") @@ -49,7 +52,7 @@ public class ServletActionContext extends ActionContext implements StrutsStatics /** * Gets the current action context - * + * * @param req The request * @return The current action context */ @@ -71,10 +74,10 @@ public class ServletActionContext extends ActionContext implements StrutsStatics public static ValueStack getValueStack(HttpServletRequest req) { return (ValueStack) req.getAttribute(STRUTS_VALUESTACK_KEY); } - + /** * Gets the action mapping for this context - * + * * @return The action mapping */ public static ActionMapping getActionMapping() { @@ -137,7 +140,7 @@ public class ServletActionContext extends ActionContext implements StrutsStatics /** * Sets the current servlet context object - * + * * @param servletContext The servlet context to use */ public static void setServletContext(ServletContext servletContext) { diff --git a/core/src/main/java/org/apache/struts2/StrutsConstants.java b/core/src/main/java/org/apache/struts2/StrutsConstants.java index dd3b5539e..02a3a7084 100644 --- a/core/src/main/java/org/apache/struts2/StrutsConstants.java +++ b/core/src/main/java/org/apache/struts2/StrutsConstants.java @@ -1,19 +1,22 @@ /* * $Id$ * - * Copyright 2006 The Apache Software Foundation. + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at + * http://www.apache.org/licenses/LICENSE-2.0 * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. */ package org.apache.struts2; @@ -30,7 +33,7 @@ public final class StrutsConstants { /** Whether the localization messages should automatically be reloaded */ public static final String STRUTS_I18N_RELOAD = "struts.i18n.reload"; - + /** The encoding to use for localization messages */ public static final String STRUTS_I18N_ENCODING = "struts.i18n.encoding"; @@ -45,7 +48,7 @@ public final class StrutsConstants { /** The HTTP port used by Struts URLs */ public static final String STRUTS_URL_HTTP_PORT = "struts.url.http.port"; - + /** The HTTPS port used by Struts URLs */ public static final String STRUTS_URL_HTTPS_PORT = "struts.url.https.port"; @@ -54,7 +57,7 @@ public final class StrutsConstants { /** The com.opensymphony.xwork2.ObjectFactory implementation class */ public static final String STRUTS_OBJECTFACTORY = "struts.objectFactory"; - + /** The com.opensymphony.xwork2.util.ObjectTypeDeterminer implementation class */ public static final String STRUTS_OBJECTTYPEDETERMINER = "struts.objectTypeDeterminer"; @@ -75,37 +78,37 @@ public final class StrutsConstants { /** org.apache.struts2.views.velocity.VelocityManager implementation class */ public static final String STRUTS_VELOCITY_MANAGER_CLASSNAME = "struts.velocity.manager.classname"; - + /** The Velocity configuration file path */ public static final String STRUTS_VELOCITY_CONFIGFILE = "struts.velocity.configfile"; - + /** The location of the Velocity toolbox */ public static final String STRUTS_VELOCITY_TOOLBOXLOCATION = "struts.velocity.toolboxlocation"; - + /** List of Velocity context names */ public static final String STRUTS_VELOCITY_CONTEXTS = "struts.velocity.contexts"; /** The directory containing UI templates */ public static final String STRUTS_UI_TEMPLATEDIR = "struts.ui.templateDir"; - + /** The default UI template theme */ public static final String STRUTS_UI_THEME = "struts.ui.theme"; /** The maximize size of a multipart request (file upload) */ public static final String STRUTS_MULTIPART_MAXSIZE = "struts.multipart.maxSize"; - + /** The directory to use for storing uploaded files */ public static final String STRUTS_MULTIPART_SAVEDIR = "struts.multipart.saveDir"; - - /** - * The org.apache.struts2.dispatcher.multipart.MultiPartRequest parser implementation - * for a multipart request (file upload) + + /** + * The org.apache.struts2.dispatcher.multipart.MultiPartRequest parser implementation + * for a multipart request (file upload) */ public static final String STRUTS_MULTIPART_PARSER = "struts.multipart.parser"; /** Whether Spring should autoWire or not */ public static final String STRUTS_OBJECTFACTORY_SPRING_AUTOWIRE = "struts.objectFactory.spring.autoWire"; - + /** Whether Spring should use its class cache or not */ public static final String STRUTS_OBJECTFACTORY_SPRING_USE_CLASS_CACHE = "struts.objectFactory.spring.useClassCache"; @@ -114,16 +117,16 @@ public final class StrutsConstants { /** Location of additional configuration properties files to load */ public static final String STRUTS_CUSTOM_PROPERTIES = "struts.custom.properties"; - + /** Location of additional localization properties files to load */ public static final String STRUTS_CUSTOM_I18N_RESOURCES = "struts.custom.i18n.resources"; - + /** The org.apache.struts2.dispatcher.mapper.ActionMapper implementation class */ public static final String STRUTS_MAPPER_CLASS = "struts.mapper.class"; /** Whether the Struts filter should serve static content or not */ public static final String STRUTS_SERVE_STATIC_CONTENT = "struts.serve.static"; - + /** If static content served by the Struts filter should set browser caching header properties or not */ public static final String STRUTS_SERVE_STATIC_BROWSER_CACHE = "struts.serve.static.browserCache"; @@ -132,10 +135,10 @@ public final class StrutsConstants { /** A list of configuration files automatically loaded by Struts */ public static final String STRUTS_CONFIGURATION_FILES = "struts.configuration.files"; - - /** Whether slashes in action names are allowed or not */ + + /** Whether slashes in action names are allowed or not */ public static final String STRUTS_ENABLE_SLASHES_IN_ACTION_NAMES = "struts.enable.SlashesInActionNames"; - + /** Prefix used by {@link CompositeActionMapper} to identified its containing {@link ActionMapper} class. */ public static final String STRUTS_MAPPER_COMPOSITE = "struts.mapper.composite."; } diff --git a/core/src/main/java/org/apache/struts2/StrutsException.java b/core/src/main/java/org/apache/struts2/StrutsException.java index b89ad7366..0c57029e6 100644 --- a/core/src/main/java/org/apache/struts2/StrutsException.java +++ b/core/src/main/java/org/apache/struts2/StrutsException.java @@ -1,19 +1,22 @@ /* * $Id$ * - * Copyright 2006 The Apache Software Foundation. + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at + * http://www.apache.org/licenses/LICENSE-2.0 * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. */ package org.apache.struts2; @@ -22,7 +25,7 @@ import com.opensymphony.xwork2.util.location.Locatable; /** - * A generic runtime exception that optionally contains Location information + * A generic runtime exception that optionally contains Location information */ public class StrutsException extends XWorkException implements Locatable { @@ -44,7 +47,7 @@ public class StrutsException extends XWorkException implements Locatable { public StrutsException(String s) { this(s, null, null); } - + /** * Constructs a StrutsException with the specified * detail message and target. @@ -64,7 +67,7 @@ public class StrutsException extends XWorkException implements Locatable { public StrutsException(Throwable cause) { this(null, cause, null); } - + /** * Constructs a StrutsException with the root cause and target * @@ -85,8 +88,8 @@ public class StrutsException extends XWorkException implements Locatable { public StrutsException(String s, Throwable cause) { this(s, cause, null); } - - + + /** * Constructs a StrutsException with the specified * detail message, cause, and target diff --git a/core/src/main/java/org/apache/struts2/StrutsStatics.java b/core/src/main/java/org/apache/struts2/StrutsStatics.java index 5290d21a0..2d6171791 100644 --- a/core/src/main/java/org/apache/struts2/StrutsStatics.java +++ b/core/src/main/java/org/apache/struts2/StrutsStatics.java @@ -1,29 +1,32 @@ /* * $Id$ * - * Copyright 2006 The Apache Software Foundation. + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at + * http://www.apache.org/licenses/LICENSE-2.0 * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. */ package org.apache.struts2; /** - * Constants used by Struts. The constants can be used to get or set objects + * Constants used by Struts. The constants can be used to get or set objects * out of the action context or other collections. - * + * *

- * + * * Example: *

    ActionContext.getContext().put(HTTP_REQUEST, request);
*

@@ -59,7 +62,7 @@ public interface StrutsStatics { * Constant for the JSP {@link javax.servlet.jsp.PageContext page context}. */ public static final String PAGE_CONTEXT = "com.opensymphony.xwork2.dispatcher.PageContext"; - + /** Constant for the PortletContext object */ public static final String STRUTS_PORTLET_CONTEXT = "struts.portlet.context"; } diff --git a/core/src/main/java/org/apache/struts2/StrutsTestCase.java b/core/src/main/java/org/apache/struts2/StrutsTestCase.java index 988c068a1..8e5c02d50 100644 --- a/core/src/main/java/org/apache/struts2/StrutsTestCase.java +++ b/core/src/main/java/org/apache/struts2/StrutsTestCase.java @@ -1,19 +1,22 @@ /* * $Id$ * - * Copyright 2006 The Apache Software Foundation. + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at + * http://www.apache.org/licenses/LICENSE-2.0 * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. */ package org.apache.struts2; @@ -50,7 +53,7 @@ public abstract class StrutsTestCase extends XWorkTestCase { configurationManager.addConfigurationProvider( new StrutsXmlConfigurationProvider("struts.xml", false)); du.setConfigurationManager(configurationManager); - + } protected void tearDown() throws Exception { diff --git a/core/src/main/java/org/apache/struts2/components/ActionComponent.java b/core/src/main/java/org/apache/struts2/components/ActionComponent.java index f3391266b..791dffcac 100644 --- a/core/src/main/java/org/apache/struts2/components/ActionComponent.java +++ b/core/src/main/java/org/apache/struts2/components/ActionComponent.java @@ -1,19 +1,22 @@ /* * $Id$ * - * Copyright 2006 The Apache Software Foundation. + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at + * http://www.apache.org/licenses/LICENSE-2.0 * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. */ package org.apache.struts2.components; @@ -52,8 +55,8 @@ import com.opensymphony.xwork2.util.ValueStackFactory; * *

    *
  • id (String) - the id (if specified) to put the action under stack's context. - *
  • name* (String) - name of the action to be executed (without the extension suffix eg. .action)
  • - *
  • namespace (String) - default to the namespace where this action tag is invoked
  • + *
  • name* (String) - name of the action to be executed (without the extension suffix eg. .action)
  • + *
  • namespace (String) - default to the namespace where this action tag is invoked
  • *
  • executeResult (Boolean) - default is false. Decides wheather the result of this action is to be executed or not
  • *
  • ignoreContextParams (Boolean) - default to false. Decides wheather the request parameters are to be included when the action is invoked
  • *
@@ -63,14 +66,14 @@ import com.opensymphony.xwork2.util.ValueStackFactory; * * public class ActionTagAction extends ActionSupport { * - * public String execute() throws Exception { - * return "done"; - * } + * public String execute() throws Exception { + * return "done"; + * } * - * public String doDefault() throws Exception { - * ServletActionContext.getRequest().setAttribute("stringByAction", "This is a String put in by the action's doDefault()"); - * return "done"; - * } + * public String doDefault() throws Exception { + * ServletActionContext.getRequest().setAttribute("stringByAction", "This is a String put in by the action's doDefault()"); + * return "done"; + * } * } * * @@ -93,12 +96,12 @@ import com.opensymphony.xwork2.util.ValueStackFactory; *
  * 
  *  
The following action tag will execute result and include it in this page
- *
- * + *
+ * *
*
The following action tag will do the same as above, but invokes method specialMethod in action
- *
- * + *
+ * *
*
The following action tag will not execute result, but put a String in request scope * under an id "stringByAction" which will be retrieved using property tag
@@ -130,24 +133,24 @@ public class ActionComponent extends Component { } public boolean end(Writer writer, String body) { - boolean end = super.end(writer, "", false); - try { - if (flush) { - try { - writer.flush(); - } catch (IOException e) { - LOG.warn("error while trying to flush writer ", e); - } - } - executeAction(); + boolean end = super.end(writer, "", false); + try { + if (flush) { + try { + writer.flush(); + } catch (IOException e) { + LOG.warn("error while trying to flush writer ", e); + } + } + executeAction(); - if ((getId() != null) && (proxy != null)) { - getStack().setValue("#attr['" + getId() + "']", - proxy.getAction()); - } - } finally { - popComponentStack(); - } + if ((getId() != null) && (proxy != null)) { + getStack().setValue("#attr['" + getId() + "']", + proxy.getAction()); + } + } finally { + popComponentStack(); + } return end; } @@ -294,12 +297,12 @@ public class ActionComponent extends Component { public void setIgnoreContextParams(boolean ignoreContextParams) { this.ignoreContextParams = ignoreContextParams; } - + /** * whether the writer should be flush upon end of action component tag, default to true. * @s.tagattribute required="false" type="Boolean" default="true" */ public void setFlush(boolean flush) { - this.flush = flush; + this.flush = flush; } } diff --git a/core/src/main/java/org/apache/struts2/components/ActionError.java b/core/src/main/java/org/apache/struts2/components/ActionError.java index a37fa4ea1..7b9f756d0 100644 --- a/core/src/main/java/org/apache/struts2/components/ActionError.java +++ b/core/src/main/java/org/apache/struts2/components/ActionError.java @@ -1,19 +1,22 @@ /* * $Id$ * - * Copyright 2006 The Apache Software Foundation. + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at + * http://www.apache.org/licenses/LICENSE-2.0 * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. */ package org.apache.struts2.components; diff --git a/core/src/main/java/org/apache/struts2/components/ActionMessage.java b/core/src/main/java/org/apache/struts2/components/ActionMessage.java index c614d44f7..1dc85ab4e 100644 --- a/core/src/main/java/org/apache/struts2/components/ActionMessage.java +++ b/core/src/main/java/org/apache/struts2/components/ActionMessage.java @@ -1,19 +1,22 @@ /* * $Id$ * - * Copyright 2006 The Apache Software Foundation. + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at + * http://www.apache.org/licenses/LICENSE-2.0 * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. */ package org.apache.struts2.components; @@ -25,7 +28,7 @@ import com.opensymphony.xwork2.util.ValueStack; /** * * - * Render action messages if they exists, specific rendering layout depends on the + * Render action messages if they exists, specific rendering layout depends on the * theme itself. * * diff --git a/core/src/main/java/org/apache/struts2/components/Anchor.java b/core/src/main/java/org/apache/struts2/components/Anchor.java index 789aa3c95..13e9d5798 100644 --- a/core/src/main/java/org/apache/struts2/components/Anchor.java +++ b/core/src/main/java/org/apache/struts2/components/Anchor.java @@ -1,19 +1,22 @@ /* * $Id$ * - * Copyright 2006 The Apache Software Foundation. + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at + * http://www.apache.org/licenses/LICENSE-2.0 * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. */ package org.apache.struts2.components; @@ -72,14 +75,14 @@ import com.opensymphony.xwork2.util.ValueStack; *
  * 
  * <s:a id="test" theme="ajax" href="/simpeResult.action" preInvokeJS="confirm(\'You sure\')">
- * 	A
+ *  A
  * </s:a>
  * 
  * 
* * @s.tag name="a" tld-body-content="JSP" tld-tag-class="org.apache.struts2.views.jsp.ui.AnchorTag" * description="Render a HTML href element that when clicked calls a URL via remote XMLHttpRequest" - * + * */ public class Anchor extends RemoteCallUIBean { final public static String OPEN_TEMPLATE = "a"; diff --git a/core/src/main/java/org/apache/struts2/components/AppendIterator.java b/core/src/main/java/org/apache/struts2/components/AppendIterator.java index 3f04b7b9e..04ba1e806 100644 --- a/core/src/main/java/org/apache/struts2/components/AppendIterator.java +++ b/core/src/main/java/org/apache/struts2/components/AppendIterator.java @@ -1,19 +1,22 @@ /* * $Id$ * - * Copyright 2006 The Apache Software Foundation. + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at + * http://www.apache.org/licenses/LICENSE-2.0 * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. */ package org.apache.struts2.components; @@ -40,9 +43,9 @@ import com.opensymphony.xwork2.util.ValueStack; * the following will be how the appended iterator entries will be arranged:

* *
    - *
  1. First Entry of the First Iterator
  2. - *
  3. Second Entry of the First Iterator
  4. - *
  5. Third Entry of the First Iterator
  6. + *
  7. First Entry of the First Iterator
  8. + *
  9. Second Entry of the First Iterator
  10. + *
  11. Third Entry of the First Iterator
  12. *
  13. First Entry of the Second Iterator
  14. *
  15. Second Entry of the Second Iterator
  16. *
  17. Third Entry of the Second Iterator
  18. @@ -54,7 +57,7 @@ import com.opensymphony.xwork2.util.ValueStack; * * *
      - *
    • id (String) - the id of which if supplied will have the resultant + *
    • id (String) - the id of which if supplied will have the resultant * appended iterator stored under in the stack's context
    • *
    * @@ -63,45 +66,45 @@ import com.opensymphony.xwork2.util.ValueStack; * * public class AppendIteratorTagAction extends ActionSupport { * - * private List myList1; - * private List myList2; - * private List myList3; + * private List myList1; + * private List myList2; + * private List myList3; * * - * public String execute() throws Exception { + * public String execute() throws Exception { * - * myList1 = new ArrayList(); - * myList1.add("1"); - * myList1.add("2"); - * myList1.add("3"); + * myList1 = new ArrayList(); + * myList1.add("1"); + * myList1.add("2"); + * myList1.add("3"); * - * myList2 = new ArrayList(); - * myList2.add("a"); - * myList2.add("b"); - * myList2.add("c"); + * myList2 = new ArrayList(); + * myList2.add("a"); + * myList2.add("b"); + * myList2.add("c"); * - * myList3 = new ArrayList(); - * myList3.add("A"); - * myList3.add("B"); - * myList3.add("C"); + * myList3 = new ArrayList(); + * myList3.add("A"); + * myList3.add("B"); + * myList3.add("C"); * - * return "done"; - * } + * return "done"; + * } * - * public List getMyList1() { return myList1; } - * public List getMyList2() { return myList2; } - * public List getMyList3() { return myList3; } + * public List getMyList1() { return myList1; } + * public List getMyList2() { return myList2; } + * public List getMyList3() { return myList3; } *} * * * * <s:append id="myAppendIterator"> - * <s:param value="%{myList1}" /> - * <s:param value="%{myList2}" /> - * <s:param value="%{myList3}" /> + * <s:param value="%{myList1}" /> + * <s:param value="%{myList2}" /> + * <s:param value="%{myList3}" /> * </s:append> * <s:iterator value="%{#myAppendIterator}"> - * <s:property /> + * <s:property /> * </s:iterator> * * @@ -114,49 +117,49 @@ import com.opensymphony.xwork2.util.ValueStack; */ public class AppendIterator extends Component implements UnnamedParametric { - private static final Log _log = LogFactory.getLog(AppendIterator.class); - - private AppendIteratorFilter appendIteratorFilter= null; - private List _parameters; - - public AppendIterator(ValueStack stack) { - super(stack); - } - - public boolean start(Writer writer) { - _parameters = new ArrayList(); - appendIteratorFilter = new AppendIteratorFilter(); + private static final Log _log = LogFactory.getLog(AppendIterator.class); + + private AppendIteratorFilter appendIteratorFilter= null; + private List _parameters; + + public AppendIterator(ValueStack stack) { + super(stack); + } + + public boolean start(Writer writer) { + _parameters = new ArrayList(); + appendIteratorFilter = new AppendIteratorFilter(); return super.start(writer); } - - public boolean end(Writer writer, String body) { - - for (Iterator paramEntries = _parameters.iterator(); paramEntries.hasNext(); ) { - - Object iteratorEntryObj = paramEntries.next(); - if (! MakeIterator.isIterable(iteratorEntryObj)) { - _log.warn("param with value resolved as "+iteratorEntryObj+" cannot be make as iterator, it will be ignored and hence will not appear in the merged iterator"); - continue; - } - appendIteratorFilter.setSource(MakeIterator.convert(iteratorEntryObj)); - } - - appendIteratorFilter.execute(); - - if (getId() != null && getId().length() > 0) { - getStack().getContext().put(getId(), appendIteratorFilter); - } - - appendIteratorFilter = null; + + public boolean end(Writer writer, String body) { + + for (Iterator paramEntries = _parameters.iterator(); paramEntries.hasNext(); ) { + + Object iteratorEntryObj = paramEntries.next(); + if (! MakeIterator.isIterable(iteratorEntryObj)) { + _log.warn("param with value resolved as "+iteratorEntryObj+" cannot be make as iterator, it will be ignored and hence will not appear in the merged iterator"); + continue; + } + appendIteratorFilter.setSource(MakeIterator.convert(iteratorEntryObj)); + } + + appendIteratorFilter.execute(); + + if (getId() != null && getId().length() > 0) { + getStack().getContext().put(getId(), appendIteratorFilter); + } + + appendIteratorFilter = null; return super.end(writer, body); } - // UnnamedParametric implementation -------------------------------------- - public void addParameter(Object value) { - _parameters.add(value); - } + // UnnamedParametric implementation -------------------------------------- + public void addParameter(Object value) { + _parameters.add(value); + } /** * the id of which if supplied will have the resultant appended iterator stored under in the stack's context diff --git a/core/src/main/java/org/apache/struts2/components/Bean.java b/core/src/main/java/org/apache/struts2/components/Bean.java index 27b188695..b370ee91c 100644 --- a/core/src/main/java/org/apache/struts2/components/Bean.java +++ b/core/src/main/java/org/apache/struts2/components/Bean.java @@ -1,19 +1,22 @@ /* * $Id$ * - * Copyright 2006 The Apache Software Foundation. + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at + * http://www.apache.org/licenses/LICENSE-2.0 * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. */ package org.apache.struts2.components; @@ -40,8 +43,8 @@ import com.opensymphony.xwork2.util.ValueStack; * * *
      - *
    • id - the stack's context id (if supplied) that the created bean will be store under
    • - *
    • name* - the class name of the bean to be instantiated (must respect JavaBean specification)
    • + *
    • id - the stack's context id (if supplied) that the created bean will be store under
    • + *
    • name* - the class name of the bean to be instantiated (must respect JavaBean specification)
    • *
    * * @@ -58,7 +61,7 @@ import com.opensymphony.xwork2.util.ValueStack; * * <-- in jsp form --> * <s:bean name="org.apache.struts2.example.counter.SimpleCounter" id="counter"> - * <s:param name="foo" value="BAR" /> + * <s:param name="foo" value="BAR" /> * The value of foot is : <s:property value="foo"/>, when inside the bean tag <br /> * </s:bean> * diff --git a/core/src/main/java/org/apache/struts2/components/Checkbox.java b/core/src/main/java/org/apache/struts2/components/Checkbox.java index 5f080f379..058e0463c 100644 --- a/core/src/main/java/org/apache/struts2/components/Checkbox.java +++ b/core/src/main/java/org/apache/struts2/components/Checkbox.java @@ -1,19 +1,22 @@ /* * $Id$ * - * Copyright 2006 The Apache Software Foundation. + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at + * http://www.apache.org/licenses/LICENSE-2.0 * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. */ package org.apache.struts2.components; diff --git a/core/src/main/java/org/apache/struts2/components/CheckboxList.java b/core/src/main/java/org/apache/struts2/components/CheckboxList.java index 86101b58c..d3b305148 100644 --- a/core/src/main/java/org/apache/struts2/components/CheckboxList.java +++ b/core/src/main/java/org/apache/struts2/components/CheckboxList.java @@ -1,19 +1,22 @@ /* * $Id$ * - * Copyright 2006 The Apache Software Foundation. + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at + * http://www.apache.org/licenses/LICENSE-2.0 * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. */ package org.apache.struts2.components; diff --git a/core/src/main/java/org/apache/struts2/components/ClosingUIBean.java b/core/src/main/java/org/apache/struts2/components/ClosingUIBean.java index 466a63a47..9ed434472 100644 --- a/core/src/main/java/org/apache/struts2/components/ClosingUIBean.java +++ b/core/src/main/java/org/apache/struts2/components/ClosingUIBean.java @@ -1,19 +1,22 @@ /* * $Id$ * - * Copyright 2006 The Apache Software Foundation. + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at + * http://www.apache.org/licenses/LICENSE-2.0 * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. */ package org.apache.struts2.components; diff --git a/core/src/main/java/org/apache/struts2/components/ComboBox.java b/core/src/main/java/org/apache/struts2/components/ComboBox.java index 1b31cd43b..7e93f8cf0 100644 --- a/core/src/main/java/org/apache/struts2/components/ComboBox.java +++ b/core/src/main/java/org/apache/struts2/components/ComboBox.java @@ -1,19 +1,22 @@ /* * $Id$ * - * Copyright 2006 The Apache Software Foundation. + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at + * http://www.apache.org/licenses/LICENSE-2.0 * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. */ package org.apache.struts2.components; @@ -56,7 +59,7 @@ import com.opensymphony.xwork2.util.ValueStack; * * <s:combobox label="Birth year" size="6" maxlength="4" name="birthYear" list="#year"/> * </s:bean> - * + * * <-- Example Two --> * - * + * * <-- Example Two --> * = 0) { - int start = componentStack.size() - currPosition - 1; + int start = componentStack.size() - currPosition - 1; - //for (int i = componentStack.size() - 2; i >= 0; i--) { - for (int i = start; i >=0; i--) { - Component component = (Component) componentStack.get(i); - if (clazz.isAssignableFrom(component.getClass()) && component != this) { - return component; - } - } + //for (int i = componentStack.size() - 2; i >= 0; i--) { + for (int i = start; i >=0; i--) { + Component component = (Component) componentStack.get(i); + if (clazz.isAssignableFrom(component.getClass()) && component != this) { + return component; + } + } } return null; @@ -447,9 +450,9 @@ public class Component { * @s.tagattribute required="false" */ public void setId(String id) { - if (id != null) { - this.id = findString(id); - } + if (id != null) { + this.id = findString(id); + } } /** diff --git a/core/src/main/java/org/apache/struts2/components/Date.java b/core/src/main/java/org/apache/struts2/components/Date.java index cec6a6c2f..80bc32618 100644 --- a/core/src/main/java/org/apache/struts2/components/Date.java +++ b/core/src/main/java/org/apache/struts2/components/Date.java @@ -1,19 +1,22 @@ /* * $Id$ * - * Copyright 2006 The Apache Software Foundation. + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at + * http://www.apache.org/licenses/LICENSE-2.0 * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. */ package org.apache.struts2.components; @@ -34,7 +37,7 @@ import com.opensymphony.xwork2.util.ValueStack; /** * - * + * * Format Date object in different ways. *

    * The date tag will allow you to format a Date in a quick and easy way. @@ -47,77 +50,77 @@ import com.opensymphony.xwork2.util.ValueStack; * * Note: If the requested Date object isn't found on the stack, a blank will be returned. *

    - * + * * Configurable attributes are :- *
      *
    • name
    • *
    • nice
    • *
    • format
    • *
    - * + * *

    - * - * Following how the date component will work, depending on the value of nice attribute + * + * Following how the date component will work, depending on the value of nice attribute * (which by default is false) and the format attribute. - * + * *

    - * + * * Condition 1: With nice attribute as true * * * * - * - * - * - * * * - * + * + * + * + * + * * * * - * + * * * * - * + * * * * - * - * + * + * * * - * - * + * + * * * - * - * + * + * * *
    i18n keydefault
    struts.date.format.past{0} ago
    struts.date.format.futurestruts.date.format.past{0} ago
    struts.date.format.futurein {0}
    struts.date.format.secondsstruts.date.format.secondsan instant
    struts.date.format.minutesstruts.date.format.minutes{0,choice,1#one minute|1<{0} minutes}
    struts.date.format.hours{0,choice,1#one hour|1<{0} hours}{1,choice,0#|1#, one minute|1<, {1} minutes}struts.date.format.hours{0,choice,1#one hour|1<{0} hours}{1,choice,0#|1#, one minute|1<, {1} minutes}
    struts.date.format.days{0,choice,1#one day|1<{0} days}{1,choice,0#|1#, one hour|1<, {1} hours}struts.date.format.days{0,choice,1#one day|1<{0} days}{1,choice,0#|1#, one hour|1<, {1} hours}
    struts.date.format.years{0,choice,1#one year|1<{0} years}{1,choice,0#|1#, one day|1<, {1} days}struts.date.format.years{0,choice,1#one year|1<{0} years}{1,choice,0#|1#, one day|1<, {1} days}
    - * + * *

    - * + * * Condition 2: With nice attribute as false and format attribute is specified eg. dd/MM/yyyyy *

    In this case the format attribute will be used.

    - * + * *

    - * + * * Condition 3: With nice attribute as false and no format attribute is specified * * * * - * + * * - * + * * * *
    i18n keydefault
    struts.date.formatstruts.date.formatif one is not found DateFormat.MEDIUM format will be used
    - * - * + * + * * * *

    Examples @@ -379,5 +382,5 @@ public class Date extends Component { */ public boolean isNice() { return nice; - } + } } diff --git a/core/src/main/java/org/apache/struts2/components/DatePicker.java b/core/src/main/java/org/apache/struts2/components/DatePicker.java index 6e59b9329..e97eec11f 100644 --- a/core/src/main/java/org/apache/struts2/components/DatePicker.java +++ b/core/src/main/java/org/apache/struts2/components/DatePicker.java @@ -1,19 +1,22 @@ /* * $Id$ * - * Copyright 2006 The Apache Software Foundation. + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at + * http://www.apache.org/licenses/LICENSE-2.0 * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. */ package org.apache.struts2.components; @@ -29,35 +32,35 @@ import com.opensymphony.xwork2.util.ValueStack; * Format supported by this component are:- * * - * - * + * + * * * - * - * - * - * - * - * + * + * * * - * + * + * + * + * + * * * * - * - * + * + * * * - * + * * * * - * + * * * * - * + * * * *
    FormatDescriptionFormatDescription
    #ddDisplay day in two digits format
    #dTry to display day in one digit format, if cannot use 2 digit format#ddDisplay day in two digits format
    #MM#dTry to display day in one digit format, if cannot use 2 digit format
    #MMDisplay month in two digits format
    #MTry to display month in one digits format, if cannot use 2 digit format#MTry to display month in one digits format, if cannot use 2 digit format
    #yyyy#yyyyDisplay year in four digits format
    #yy#yyDisplay the last two digits of the yaer
    #y#yDisplay the last digits of the year
    @@ -75,7 +78,7 @@ import com.opensymphony.xwork2.util.ValueStack; * <s:datepicker name="order.date" label="Order Date" /> * Example 2: * <s:datepicker name="delivery.date" label="Delivery Date" format="#yyyy-#MM-#dd" /> - * + * * *

*

@@ -85,12 +88,12 @@ import com.opensymphony.xwork2.util.ValueStack; * The css could be changed by using the following :- * * - * + * *

  * 
- * 
+ *
  * <s:datepicker name="birthday" label="Birthday" templateCss="...." />
- * 
+ *
  * 
  * 
* @@ -122,16 +125,16 @@ public class DatePicker extends TextField { addParameter("format", findString(format)); } if (dateIconPath != null) { - addParameter("dateIconPath", dateIconPath); + addParameter("dateIconPath", dateIconPath); } if (templatePath != null) { - addParameter("templatePath", templatePath); + addParameter("templatePath", templatePath); } if (templateCssPath != null) { - addParameter("templateCssPath", templateCssPath); + addParameter("templateCssPath", templateCssPath); } if (size != null) { - addParameter("size", findValue(size, Integer.class)); + addParameter("size", findValue(size, Integer.class)); } } @@ -142,36 +145,36 @@ public class DatePicker extends TextField { public void setFormat(String format) { this.format = format; } - + /** * The date picker icon path * @s.tagattribute required="false" type="String" default="/struts/dojo/struts/widgets/dateIcon.gif" */ public void setDateIconPath(String dateIconPath) { - this.dateIconPath = dateIconPath; + this.dateIconPath = dateIconPath; } - + /** * The datepicker template path. * @s.tagattribute required="false" type="String" */ public void setTemplatePath(String templatePath) { - this.templatePath = templatePath; + this.templatePath = templatePath; } - + /** * The datepicker template css path. * @s.tagattribute required="false" type="String" */ public void setTemplateCssPath(String templateCssPath) { - this.templateCssPath = templateCssPath; + this.templateCssPath = templateCssPath; } - + /** * The datepicker text field size. * @s.tagattribute required="false" type="String" */ public void setSize(String size) { - this.size = size; + this.size = size; } } diff --git a/core/src/main/java/org/apache/struts2/components/Debug.java b/core/src/main/java/org/apache/struts2/components/Debug.java index 4f1220be6..febbf64f5 100644 --- a/core/src/main/java/org/apache/struts2/components/Debug.java +++ b/core/src/main/java/org/apache/struts2/components/Debug.java @@ -1,41 +1,23 @@ -package org.apache.struts2.components; - -import java.io.Writer; -import java.util.ArrayList; -import java.util.Iterator; -import java.util.List; -import java.util.Map; - -import javax.servlet.http.HttpServletRequest; -import javax.servlet.http.HttpServletResponse; - -import org.apache.struts2.StrutsException; - -import com.opensymphony.xwork2.util.OgnlUtil; -import com.opensymphony.xwork2.util.ValueStack; - -/** - * - *

Renders an debug tag.

+/* + * $Id$ * - * The debug information contain mostly stack information: - *
    - *
  • Value Stack Contents
  • - *
  • Stack Context
  • - *
- * + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at * - *

Examples + * http://www.apache.org/licenses/LICENSE-2.0 * - *

- * 
- * <ww:debug/>
- * 
- * 
- * - * @s.tag name="debug" tld-body-content="JSP" tld-tag-class="org.apache.struts2.views.jsp.ui.DebugTag" - * description="Render debug tag" - */ + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ public class Debug extends UIBean { public static final String TEMPLATE = "debug"; diff --git a/core/src/main/java/org/apache/struts2/components/Div.java b/core/src/main/java/org/apache/struts2/components/Div.java index 8b54216c3..faf631f67 100644 --- a/core/src/main/java/org/apache/struts2/components/Div.java +++ b/core/src/main/java/org/apache/struts2/components/Div.java @@ -1,19 +1,22 @@ /* * $Id$ * - * Copyright 2006 The Apache Software Foundation. + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at + * http://www.apache.org/licenses/LICENSE-2.0 * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. */ package org.apache.struts2.components; @@ -52,9 +55,9 @@ import com.opensymphony.xwork2.util.ValueStack; * description="Render HTML div providing content from remote call via AJAX" */ public class Div extends RemoteCallUIBean { - - private static final Log _log = LogFactory.getLog(Div.class); - + + private static final Log _log = LogFactory.getLog(Div.class); + public static final String TEMPLATE = "div"; public static final String TEMPLATE_CLOSE = "div-close"; @@ -91,21 +94,21 @@ public class Div extends RemoteCallUIBean { } else { addParameter("delay", "0"); } - + String tmpUpdateFreq = (String) getParameters().get("delay"); String tmpDelay = (String) getParameters().get("updateFreq"); try { - int _updateFreq = Integer.parseInt(tmpUpdateFreq); - int _delay = Integer.parseInt(tmpDelay); - - if (_updateFreq <= 0 && _delay <= 0) { - addParameter("autoStart", "false"); - } + int _updateFreq = Integer.parseInt(tmpUpdateFreq); + int _delay = Integer.parseInt(tmpDelay); + + if (_updateFreq <= 0 && _delay <= 0) { + addParameter("autoStart", "false"); + } } catch(NumberFormatException e) { - // too bad, invalid updateFreq or delay provided, we - // can't determine autoStart mode. - _log.info("error while parsing updateFreq ["+tmpUpdateFreq+"] or delay ["+tmpDelay+"] to integer, cannot determine autoStart mode", e); + // too bad, invalid updateFreq or delay provided, we + // can't determine autoStart mode. + _log.info("error while parsing updateFreq ["+tmpUpdateFreq+"] or delay ["+tmpDelay+"] to integer, cannot determine autoStart mode", e); } if (loadingText != null) { diff --git a/core/src/main/java/org/apache/struts2/components/DoubleListUIBean.java b/core/src/main/java/org/apache/struts2/components/DoubleListUIBean.java index dde415b5c..a78a015f7 100644 --- a/core/src/main/java/org/apache/struts2/components/DoubleListUIBean.java +++ b/core/src/main/java/org/apache/struts2/components/DoubleListUIBean.java @@ -1,19 +1,22 @@ /* * $Id$ * - * Copyright 2006 The Apache Software Foundation. + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at + * http://www.apache.org/licenses/LICENSE-2.0 * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. */ package org.apache.struts2.components; @@ -30,29 +33,29 @@ import com.opensymphony.xwork2.util.ValueStack; *

* * - * + * * Note that the doublelistkey and doublelistvalue attribute will default to "key" and "value" * respectively only when the doublelist attribute is evaluated to a Map or its decendant. * Other thing else, will result in doublelistkey and doublelistvalue to be null and not used. - * + * * * */ public abstract class DoubleListUIBean extends ListUIBean { - - protected String emptyOption; + + protected String emptyOption; protected String headerKey; protected String headerValue; protected String multiple; protected String size; - + protected String doubleList; protected String doubleListKey; protected String doubleListValue; protected String doubleName; protected String doubleValue; protected String formName; - + protected String doubleId; protected String doubleDisabled; protected String doubleMultiple; @@ -60,10 +63,10 @@ public abstract class DoubleListUIBean extends ListUIBean { protected String doubleHeaderKey; protected String doubleHeaderValue; protected String doubleEmptyOption; - + protected String doubleCssClass; protected String doubleCssStyle; - + protected String doubleOnclick; protected String doubleOndblclick; protected String doubleOnmousedown; @@ -78,9 +81,9 @@ public abstract class DoubleListUIBean extends ListUIBean { protected String doubleOnkeyup; protected String doubleOnselect; protected String doubleOnchange; - + protected String doubleAccesskey; - + public DoubleListUIBean(ValueStack stack, HttpServletRequest request, HttpServletResponse response) { super(stack, request, response); @@ -90,7 +93,7 @@ public abstract class DoubleListUIBean extends ListUIBean { super.evaluateExtraParams(); //Object doubleName = null; - + if (emptyOption != null) { addParameter("emptyOption", findValue(emptyOption, Boolean.class)); } @@ -107,18 +110,18 @@ public abstract class DoubleListUIBean extends ListUIBean { addParameter("headerKey", findString(headerKey)); addParameter("headerValue", findString(headerValue)); } - - + + if (doubleMultiple != null) { - addParameter("doubleMultiple", findValue(doubleMultiple, Boolean.class)); + addParameter("doubleMultiple", findValue(doubleMultiple, Boolean.class)); } - + if (doubleSize != null) { - addParameter("doubleSize", findString(doubleSize)); + addParameter("doubleSize", findString(doubleSize)); } - + if (doubleDisabled != null) { - addParameter("doubleDisabled", findValue(doubleDisabled, Boolean.class)); + addParameter("doubleDisabled", findValue(doubleDisabled, Boolean.class)); } if (doubleName != null) { @@ -128,14 +131,14 @@ public abstract class DoubleListUIBean extends ListUIBean { if (doubleList != null) { addParameter("doubleList", doubleList); } - + Object tmpDoubleList = findValue(doubleList); if (doubleListKey != null) { addParameter("doubleListKey", doubleListKey); }else if (tmpDoubleList instanceof Map) { - addParameter("doubleListKey", "key"); + addParameter("doubleListKey", "key"); } - + if (doubleListValue != null) { if (altSyntax()) { // the same logic as with findValue(String) @@ -147,7 +150,7 @@ public abstract class DoubleListUIBean extends ListUIBean { addParameter("doubleListValue", doubleListValue); }else if (tmpDoubleList instanceof Map) { - addParameter("doubleListValue", "value"); + addParameter("doubleListValue", "value"); } @@ -176,7 +179,7 @@ public abstract class DoubleListUIBean extends ListUIBean { addParameter("doubleNameValue", findValue(doubleName.toString())); } } - + Form form = (Form) findAncestor(Form.class); if (doubleId != null) { // this check is needed for backwards compatibility with 2.1.x @@ -188,78 +191,78 @@ public abstract class DoubleListUIBean extends ListUIBean { } else if (form != null) { addParameter("doubleId", form.getParameters().get("id") + "_" +escape(this.doubleName)); } - + if (doubleOnclick != null) { - addParameter("doubleOnclick", findString(doubleOnclick)); + addParameter("doubleOnclick", findString(doubleOnclick)); } - + if (doubleOndblclick != null) { - addParameter("doubleOndblclick", findString(doubleOndblclick)); + addParameter("doubleOndblclick", findString(doubleOndblclick)); } - + if (doubleOnmousedown != null) { - addParameter("doubleOnmousedown", findString(doubleOnmousedown)); + addParameter("doubleOnmousedown", findString(doubleOnmousedown)); } - + if (doubleOnmouseup != null) { - addParameter("doubleOnmouseup", findString(doubleOnmouseup)); + addParameter("doubleOnmouseup", findString(doubleOnmouseup)); } - + if (doubleOnmouseover != null) { - addParameter("doubleOnmouseover", findString(doubleOnmouseover)); + addParameter("doubleOnmouseover", findString(doubleOnmouseover)); } - + if (doubleOnmousemove != null) { - addParameter("doubleOnmousemove", findString(doubleOnmousemove)); + addParameter("doubleOnmousemove", findString(doubleOnmousemove)); } - + if (doubleOnmouseout != null) { - addParameter("doubleOnmouseout", findString(doubleOnmouseout)); + addParameter("doubleOnmouseout", findString(doubleOnmouseout)); } - + if (doubleOnfocus != null) { - addParameter("doubleOnfocus", findString(doubleOnfocus)); + addParameter("doubleOnfocus", findString(doubleOnfocus)); } - + if (doubleOnblur != null) { - addParameter("doubleOnblur", findString(doubleOnblur)); + addParameter("doubleOnblur", findString(doubleOnblur)); } - + if (doubleOnkeypress != null) { - addParameter("doubleOnkeypress", findString(doubleOnkeypress)); + addParameter("doubleOnkeypress", findString(doubleOnkeypress)); } - + if (doubleOnkeydown != null) { - addParameter("doubleOnkeydown", findString(doubleOnkeydown)); + addParameter("doubleOnkeydown", findString(doubleOnkeydown)); } - + if (doubleOnselect != null) { - addParameter("doubleOnselect", findString(doubleOnselect)); + addParameter("doubleOnselect", findString(doubleOnselect)); } - + if (doubleOnchange != null) { - addParameter("doubleOnchange", findString(doubleOnchange)); + addParameter("doubleOnchange", findString(doubleOnchange)); } - + if (doubleCssClass != null) { - addParameter("doubleCss", findString(doubleCssClass)); + addParameter("doubleCss", findString(doubleCssClass)); } - + if (doubleCssStyle != null) { - addParameter("doubleStyle", findString(doubleCssStyle)); + addParameter("doubleStyle", findString(doubleCssStyle)); } - + if (doubleHeaderKey != null && doubleHeaderValue != null) { - addParameter("doubleHeaderKey", findString(doubleHeaderKey)); - addParameter("doubleHeaderValue", findString(doubleHeaderValue)); + addParameter("doubleHeaderKey", findString(doubleHeaderKey)); + addParameter("doubleHeaderValue", findString(doubleHeaderValue)); } - + if (doubleEmptyOption != null) { - addParameter("doubleEmptyOption", findValue(doubleEmptyOption, Boolean.class)); + addParameter("doubleEmptyOption", findValue(doubleEmptyOption, Boolean.class)); } - + if (doubleAccesskey != null) { - addParameter("doubleAccesskey", findString(doubleAccesskey)); + addParameter("doubleAccesskey", findString(doubleAccesskey)); } } @@ -310,57 +313,57 @@ public abstract class DoubleListUIBean extends ListUIBean { public void setFormName(String formName) { this.formName = formName; } - + public String getFormName() { - return formName; + return formName; } - + /** * The css class for the second list * @s.tagattribute required="false" */ public void setDoubleCssClass(String doubleCssClass) { - this.doubleCssClass = doubleCssClass; + this.doubleCssClass = doubleCssClass; } - + public String getDoubleCssClass() { - return doubleCssClass; + return doubleCssClass; } - + /** * The css style for the second list * @s.tagattribute required="false" */ public void setDoubleCssStyle(String doubleCssStyle) { - this.doubleCssStyle = doubleCssStyle; + this.doubleCssStyle = doubleCssStyle; } - + public String getDoubleCssStyle() { - return doubleCssStyle; + return doubleCssStyle; } - + /** * The header key for the second list * @s.tagattribute required="false" */ public void setDoubleHeaderKey(String doubleHeaderKey) { - this.doubleHeaderKey = doubleHeaderKey; + this.doubleHeaderKey = doubleHeaderKey; } - + public String getDoubleHeaderKey() { - return doubleHeaderKey; + return doubleHeaderKey; } - + /** * The header value for the second list * @s.tagattribute required="false" */ public void setDoubleHeaderValue(String doubleHeaderValue) { - this.doubleHeaderValue = doubleHeaderValue; + this.doubleHeaderValue = doubleHeaderValue; } - + public String getDoubleHeaderValue() { - return doubleHeaderValue; + return doubleHeaderValue; } /** @@ -368,255 +371,255 @@ public abstract class DoubleListUIBean extends ListUIBean { * @s.tagattribute required="false" */ public void setDoubleEmptyOption(String doubleEmptyOption) { - this.doubleEmptyOption = doubleEmptyOption; + this.doubleEmptyOption = doubleEmptyOption; } - + public String getDoubleEmptyOption() { - return this.doubleEmptyOption; + return this.doubleEmptyOption; } - - public String getDoubleDisabled() { - return doubleDisabled; - } - /** + public String getDoubleDisabled() { + return doubleDisabled; + } + + /** * Decides if a disable attribute should be added to the second list * @s.tagattribute required="false" */ - public void setDoubleDisabled(String doubleDisabled) { - this.doubleDisabled = doubleDisabled; - } + public void setDoubleDisabled(String doubleDisabled) { + this.doubleDisabled = doubleDisabled; + } - public String getDoubleId() { - return doubleId; - } + public String getDoubleId() { + return doubleId; + } - /** + /** * The id of the second list * @s.tagattribute required="false" */ - public void setDoubleId(String doubleId) { - this.doubleId = doubleId; - } + public void setDoubleId(String doubleId) { + this.doubleId = doubleId; + } - public String getDoubleMultiple() { - return doubleMultiple; - } + public String getDoubleMultiple() { + return doubleMultiple; + } - /** + /** * Decides if multiple attribute should be set on the second list * @s.tagattribute required="false" */ - public void setDoubleMultiple(String doubleMultiple) { - this.doubleMultiple = doubleMultiple; - } + public void setDoubleMultiple(String doubleMultiple) { + this.doubleMultiple = doubleMultiple; + } - public String getDoubleOnblur() { - return doubleOnblur; - } + public String getDoubleOnblur() { + return doubleOnblur; + } - /** + /** * Set the onblur attribute of the second list * @s.tagattribute required="false" */ - public void setDoubleOnblur(String doubleOnblur) { - this.doubleOnblur = doubleOnblur; - } + public void setDoubleOnblur(String doubleOnblur) { + this.doubleOnblur = doubleOnblur; + } - public String getDoubleOnchange() { - return doubleOnchange; - } + public String getDoubleOnchange() { + return doubleOnchange; + } - /** + /** * Set the onchange attribute of the second list * @s.tagattribute required="false" */ - public void setDoubleOnchange(String doubleOnchange) { - this.doubleOnchange = doubleOnchange; - } + public void setDoubleOnchange(String doubleOnchange) { + this.doubleOnchange = doubleOnchange; + } - public String getDoubleOnclick() { - return doubleOnclick; - } + public String getDoubleOnclick() { + return doubleOnclick; + } - /** + /** * Set the onclick attribute of the second list * @s.tagattribute required="false" */ - public void setDoubleOnclick(String doubleOnclick) { - this.doubleOnclick = doubleOnclick; - } + public void setDoubleOnclick(String doubleOnclick) { + this.doubleOnclick = doubleOnclick; + } - public String getDoubleOndblclick() { - return doubleOndblclick; - } + public String getDoubleOndblclick() { + return doubleOndblclick; + } - /** + /** * Set the ondbclick attribute of the second list * @s.tagattribute required="false" */ - public void setDoubleOndblclick(String doubleOndblclick) { - this.doubleOndblclick = doubleOndblclick; - } + public void setDoubleOndblclick(String doubleOndblclick) { + this.doubleOndblclick = doubleOndblclick; + } - public String getDoubleOnfocus() { - return doubleOnfocus; - } + public String getDoubleOnfocus() { + return doubleOnfocus; + } - /** + /** * Set the onfocus attribute of the second list * @s.tagattribute required="false" */ - public void setDoubleOnfocus(String doubleOnfocus) { - this.doubleOnfocus = doubleOnfocus; - } + public void setDoubleOnfocus(String doubleOnfocus) { + this.doubleOnfocus = doubleOnfocus; + } - public String getDoubleOnkeydown() { - return doubleOnkeydown; - } + public String getDoubleOnkeydown() { + return doubleOnkeydown; + } - /** + /** * Set the onkeydown attribute of the second list * @s.tagattribute required="false" */ - public void setDoubleOnkeydown(String doubleOnkeydown) { - this.doubleOnkeydown = doubleOnkeydown; - } + public void setDoubleOnkeydown(String doubleOnkeydown) { + this.doubleOnkeydown = doubleOnkeydown; + } - public String getDoubleOnkeypress() { - return doubleOnkeypress; - } + public String getDoubleOnkeypress() { + return doubleOnkeypress; + } - /** + /** * Set the onkeypress attribute of the second list * @s.tagattribute required="false" */ - public void setDoubleOnkeypress(String doubleOnkeypress) { - this.doubleOnkeypress = doubleOnkeypress; - } + public void setDoubleOnkeypress(String doubleOnkeypress) { + this.doubleOnkeypress = doubleOnkeypress; + } - public String getDoubleOnkeyup() { - return doubleOnkeyup; - } + public String getDoubleOnkeyup() { + return doubleOnkeyup; + } - /** + /** * Set the onkeyup attribute of the second list * @s.tagattribute required="false" */ - public void setDoubleOnkeyup(String doubleOnkeyup) { - this.doubleOnkeyup = doubleOnkeyup; - } + public void setDoubleOnkeyup(String doubleOnkeyup) { + this.doubleOnkeyup = doubleOnkeyup; + } - public String getDoubleOnmousedown() { - return doubleOnmousedown; - } + public String getDoubleOnmousedown() { + return doubleOnmousedown; + } - /** + /** * Set the onmousedown attribute of the second list * @s.tagattribute required="false" */ - public void setDoubleOnmousedown(String doubleOnmousedown) { - this.doubleOnmousedown = doubleOnmousedown; - } + public void setDoubleOnmousedown(String doubleOnmousedown) { + this.doubleOnmousedown = doubleOnmousedown; + } - public String getDoubleOnmousemove() { - return doubleOnmousemove; - } + public String getDoubleOnmousemove() { + return doubleOnmousemove; + } - /** + /** * Set the onmousemove attribute of the second list * @s.tagattribute required="false" */ - public void setDoubleOnmousemove(String doubleOnmousemove) { - this.doubleOnmousemove = doubleOnmousemove; - } + public void setDoubleOnmousemove(String doubleOnmousemove) { + this.doubleOnmousemove = doubleOnmousemove; + } - public String getDoubleOnmouseout() { - return doubleOnmouseout; - } + public String getDoubleOnmouseout() { + return doubleOnmouseout; + } - /** + /** * Set the onmouseout attribute of the second list * @s.tagattribute required="false" */ - public void setDoubleOnmouseout(String doubleOnmouseout) { - this.doubleOnmouseout = doubleOnmouseout; - } + public void setDoubleOnmouseout(String doubleOnmouseout) { + this.doubleOnmouseout = doubleOnmouseout; + } - public String getDoubleOnmouseover() { - return doubleOnmouseover; - } + public String getDoubleOnmouseover() { + return doubleOnmouseover; + } - /** + /** * Set the onmouseover attribute of the second list * @s.tagattribute required="false" */ - public void setDoubleOnmouseover(String doubleOnmouseover) { - this.doubleOnmouseover = doubleOnmouseover; - } + public void setDoubleOnmouseover(String doubleOnmouseover) { + this.doubleOnmouseover = doubleOnmouseover; + } - public String getDoubleOnmouseup() { - return doubleOnmouseup; - } + public String getDoubleOnmouseup() { + return doubleOnmouseup; + } - /** + /** * Set the onmouseup attribute of the second list * @s.tagattribute required="false" */ - public void setDoubleOnmouseup(String doubleOnmouseup) { - this.doubleOnmouseup = doubleOnmouseup; - } + public void setDoubleOnmouseup(String doubleOnmouseup) { + this.doubleOnmouseup = doubleOnmouseup; + } - public String getDoubleOnselect() { - return doubleOnselect; - } + public String getDoubleOnselect() { + return doubleOnselect; + } - /** + /** * Set the onselect attribute of the second list * @s.tagattribute required="false" */ - public void setDoubleOnselect(String doubleOnselect) { - this.doubleOnselect = doubleOnselect; - } + public void setDoubleOnselect(String doubleOnselect) { + this.doubleOnselect = doubleOnselect; + } - public String getDoubleSize() { - return doubleSize; - } + public String getDoubleSize() { + return doubleSize; + } - /** + /** * Set the size attribute of the second list * @s.tagattribute required="false" */ - public void setDoubleSize(String doubleSize) { - this.doubleSize = doubleSize; - } + public void setDoubleSize(String doubleSize) { + this.doubleSize = doubleSize; + } - public String getDoubleList() { - return doubleList; - } + public String getDoubleList() { + return doubleList; + } - /** + /** * Set the list key of the second attribute * @s.tagattribute required="false" */ - public String getDoubleListKey() { - return doubleListKey; - } + public String getDoubleListKey() { + return doubleListKey; + } - public String getDoubleListValue() { - return doubleListValue; - } + public String getDoubleListValue() { + return doubleListValue; + } - public String getDoubleName() { - return doubleName; - } + public String getDoubleName() { + return doubleName; + } - public String getDoubleValue() { - return doubleValue; - } - - /** + public String getDoubleValue() { + return doubleValue; + } + + /** * Decides of an empty option is to be inserted in the second list * @s.tagattribute required="false" default="false" type="Boolean" */ @@ -656,12 +659,12 @@ public abstract class DoubleListUIBean extends ListUIBean { public void setSize(String size) { this.size = size; } - + /** * Set the html accesskey attribute. * @s.tagattribute required="false" */ public void setDoubleAccesskey(String doubleAccesskey) { - this.doubleAccesskey = doubleAccesskey; + this.doubleAccesskey = doubleAccesskey; } } diff --git a/core/src/main/java/org/apache/struts2/components/DoubleSelect.java b/core/src/main/java/org/apache/struts2/components/DoubleSelect.java index d7d9eba3f..93e608950 100644 --- a/core/src/main/java/org/apache/struts2/components/DoubleSelect.java +++ b/core/src/main/java/org/apache/struts2/components/DoubleSelect.java @@ -1,19 +1,22 @@ /* * $Id$ * - * Copyright 2006 The Apache Software Foundation. + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at + * http://www.apache.org/licenses/LICENSE-2.0 * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. */ package org.apache.struts2.components; diff --git a/core/src/main/java/org/apache/struts2/components/Else.java b/core/src/main/java/org/apache/struts2/components/Else.java index 128e22cfb..38cf3027e 100644 --- a/core/src/main/java/org/apache/struts2/components/Else.java +++ b/core/src/main/java/org/apache/struts2/components/Else.java @@ -1,19 +1,22 @@ /* * $Id$ * - * Copyright 2006 The Apache Software Foundation. + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at + * http://www.apache.org/licenses/LICENSE-2.0 * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. */ package org.apache.struts2.components; @@ -40,13 +43,13 @@ import com.opensymphony.xwork2.util.ValueStack; *

  * 
  *  <s:if test="%{false}">
- * 	    <div>Will Not Be Executed</div>
+ *      <div>Will Not Be Executed</div>
  *  </s:if>
- * 	<s:elseif test="%{true}">
- * 	    <div>Will Be Executed</div>
+ *  <s:elseif test="%{true}">
+ *      <div>Will Be Executed</div>
  *  </s:elseif>
  *  <s:else>
- * 	    <div>Will Not Be Executed</div>
+ *      <div>Will Not Be Executed</div>
  *  </s:else>
  * 
  * 
diff --git a/core/src/main/java/org/apache/struts2/components/ElseIf.java b/core/src/main/java/org/apache/struts2/components/ElseIf.java index de4968619..bc150ec7b 100644 --- a/core/src/main/java/org/apache/struts2/components/ElseIf.java +++ b/core/src/main/java/org/apache/struts2/components/ElseIf.java @@ -1,19 +1,22 @@ /* * $Id$ * - * Copyright 2006 The Apache Software Foundation. + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at + * http://www.apache.org/licenses/LICENSE-2.0 * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. */ package org.apache.struts2.components; @@ -44,13 +47,13 @@ import com.opensymphony.xwork2.util.ValueStack; *
  * 
  *  <s:if test="%{false}">
- * 	    <div>Will Not Be Executed</div>
+ *      <div>Will Not Be Executed</div>
  *  </s:if>
- * 	<s:elseif test="%{true}">
- * 	    <div>Will Be Executed</div>
+ *  <s:elseif test="%{true}">
+ *      <div>Will Be Executed</div>
  *  </s:elseif>
  *  <s:else>
- * 	    <div>Will Not Be Executed</div>
+ *      <div>Will Not Be Executed</div>
  *  </s:else>
  * 
  * 
@@ -67,7 +70,7 @@ public class ElseIf extends Component { public boolean start(Writer writer) { Boolean ifResult = (Boolean) stack.getContext().get(If.ANSWER); - + if ((ifResult == null) || (ifResult.booleanValue())) { return false; } diff --git a/core/src/main/java/org/apache/struts2/components/FieldError.java b/core/src/main/java/org/apache/struts2/components/FieldError.java index 72f8111b5..bffe637d4 100644 --- a/core/src/main/java/org/apache/struts2/components/FieldError.java +++ b/core/src/main/java/org/apache/struts2/components/FieldError.java @@ -1,19 +1,22 @@ /* * $Id$ * - * Copyright 2006 The Apache Software Foundation. + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at + * http://www.apache.org/licenses/LICENSE-2.0 * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. */ package org.apache.struts2.components; @@ -38,7 +41,7 @@ import com.opensymphony.xwork2.util.ValueStack; * *
  * 
- * 
+ *
  *    <!-- example 1 -->
  *    <s:fielderror />
  *
@@ -54,24 +57,24 @@ import com.opensymphony.xwork2.util.ValueStack;
  *    OR
  *
  *    <s:fielderror>
- *    		<s:param value="%{'field1'}" />
- *    		<s:param value="%{'field2'}" />
+ *          <s:param value="%{'field1'}" />
+ *          <s:param value="%{'field2'}" />
  *    </s:fielderror>
  *    <s:form .... >>
  *       ....
  *    </s:form>
- *    
+ *
  * 
  * 
* * *

Description

* - * + * *

  * 
  *
- * Example 1: display all field errors

+ * Example 1: display all field errors

* Example 2: display field errors only for 'field1' and 'field2'

* * diff --git a/core/src/main/java/org/apache/struts2/components/File.java b/core/src/main/java/org/apache/struts2/components/File.java index a1e2e6af2..e3c5e6a13 100644 --- a/core/src/main/java/org/apache/struts2/components/File.java +++ b/core/src/main/java/org/apache/struts2/components/File.java @@ -1,19 +1,22 @@ /* * $Id$ * - * Copyright 2006 The Apache Software Foundation. + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at + * http://www.apache.org/licenses/LICENSE-2.0 * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. */ package org.apache.struts2.components; diff --git a/core/src/main/java/org/apache/struts2/components/Form.java b/core/src/main/java/org/apache/struts2/components/Form.java index 996aa5996..83fe28e3a 100644 --- a/core/src/main/java/org/apache/struts2/components/Form.java +++ b/core/src/main/java/org/apache/struts2/components/Form.java @@ -1,19 +1,22 @@ /* * $Id$ * - * Copyright 2006 The Apache Software Foundation. + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at + * http://www.apache.org/licenses/LICENSE-2.0 * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. */ package org.apache.struts2.components; @@ -96,7 +99,7 @@ public class Form extends ClosingUIBean { public static final String TEMPLATE = "form-close"; private int sequence = 0; - + protected String onsubmit; protected String action; protected String target; @@ -180,7 +183,7 @@ public class Form extends ClosingUIBean { addParameter("tagNames", new ArrayList()); } } - + /** * Form component determine the its HTML element id as follows:- *

    @@ -189,16 +192,16 @@ public class Form extends ClosingUIBean { *
*/ protected void populateComponentHtmlId(Form form) { - boolean isAjax = "ajax".equalsIgnoreCase(this.theme); - - String action = null; + boolean isAjax = "ajax".equalsIgnoreCase(this.theme); + + String action = null; if (this.action != null) { // if it isn't specified, we'll make somethig up action = findString(this.action); } if (id != null) { - addParameter("id", escape(id)); + addParameter("id", escape(id)); } if (Dispatcher.getInstance().isPortletSupportActive() && PortletActionContext.isPortletRequest()) { evaluateExtraParamsPortletRequest(namespace, action); @@ -301,7 +304,7 @@ public class Form extends ClosingUIBean { } // WW-1284 - // evaluate if client-side js is to be enabled. (if validation interceptor + // evaluate if client-side js is to be enabled. (if validation interceptor // does allow validation eg. method is not filtered out) evaluateClientSideJsEnablement(actionName, namespace, actionMethod); } @@ -404,16 +407,16 @@ public class Form extends ClosingUIBean { return validators; } - + /** * Get a incrementing sequence unique to this Form component. - * It is used by Form component's child that might need a + * It is used by Form component's child that might need a * sequence to make them unique. - * + * * @return int */ protected int getSequence() { - return sequence++; + return sequence++; } diff --git a/core/src/main/java/org/apache/struts2/components/FormButton.java b/core/src/main/java/org/apache/struts2/components/FormButton.java index c9cc084b9..5e3440aea 100644 --- a/core/src/main/java/org/apache/struts2/components/FormButton.java +++ b/core/src/main/java/org/apache/struts2/components/FormButton.java @@ -1,19 +1,22 @@ /* * $Id$ * - * Copyright 2006 The Apache Software Foundation. + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at + * http://www.apache.org/licenses/LICENSE-2.0 * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. */ package org.apache.struts2.components; @@ -42,7 +45,7 @@ public abstract class FormButton extends UIBean { //public void evaluateParams() { public void evaluateExtraParams() { - super.evaluateExtraParams(); + super.evaluateExtraParams(); if (align == null) { align = "right"; } @@ -80,12 +83,12 @@ public abstract class FormButton extends UIBean { addParameter("align", findString(align)); } - + /** * Override UIBean's implementation, such that component Html id is determined * in the following order :- *
    - *
  1. This component id attribute
  2. + *
  3. This component id attribute
  4. *
  5. [containing_form_id]_[this_component_name]
  6. *
  7. [containing_form_id]_[this_component_action]_[this_component_method]
  8. *
  9. [containing_form_id]_[this_component_method]
  10. @@ -100,40 +103,40 @@ public abstract class FormButton extends UIBean { if (id != null) { // this check is needed for backwards compatibility with 2.1.x if (altSyntax()) { - _tmp_id = findString(id); + _tmp_id = findString(id); } else { - _tmp_id = id; + _tmp_id = id; } } else { - if (form != null && form.getParameters().get("id") != null) { - _tmp_id = _tmp_id + form.getParameters().get("id").toString() + "_"; - } - if (name != null) { - _tmp_id = _tmp_id + escape(name); - } else if (action != null || method != null){ - if (action != null) { - _tmp_id = _tmp_id + escape(action); - } - if (method != null) { - _tmp_id = _tmp_id + "_" + escape(method); - } - } else { - // if form is null, this component is used, without a form, i guess - // there's not much we could do then. - if (form != null) { - _tmp_id = _tmp_id + form.getSequence(); - } - } + if (form != null && form.getParameters().get("id") != null) { + _tmp_id = _tmp_id + form.getParameters().get("id").toString() + "_"; + } + if (name != null) { + _tmp_id = _tmp_id + escape(name); + } else if (action != null || method != null){ + if (action != null) { + _tmp_id = _tmp_id + escape(action); + } + if (method != null) { + _tmp_id = _tmp_id + "_" + escape(method); + } + } else { + // if form is null, this component is used, without a form, i guess + // there's not much we could do then. + if (form != null) { + _tmp_id = _tmp_id + form.getSequence(); + } + } } - addParameter("id", _tmp_id); + addParameter("id", _tmp_id); } /** - * Indicate whether the concrete button supports the type "image". - * - * @return true if type image is supported. - */ + * Indicate whether the concrete button supports the type "image". + * + * @return true if type image is supported. + */ protected abstract boolean supportsImageType(); /** diff --git a/core/src/main/java/org/apache/struts2/components/GenericUIBean.java b/core/src/main/java/org/apache/struts2/components/GenericUIBean.java index 0221742c9..0ca4082ca 100644 --- a/core/src/main/java/org/apache/struts2/components/GenericUIBean.java +++ b/core/src/main/java/org/apache/struts2/components/GenericUIBean.java @@ -1,19 +1,22 @@ /* * $Id$ * - * Copyright 2006 The Apache Software Foundation. + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at + * http://www.apache.org/licenses/LICENSE-2.0 * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. */ package org.apache.struts2.components; @@ -26,23 +29,23 @@ import com.opensymphony.xwork2.util.ValueStack; /** * - * + * * Renders an custom UI widget using the specified templates. Additional objects can be passed in to the template * using the param tags.

    - * + * * Freemarker:

    * Objects provided can be retrieve from within the template via $parameters._paramname_.

    - * + * * Jsp:

    * Objects provided can be retrieve from within the template via <s:property value="%{parameters._paramname_}" />

    * * * In the bottom JSP and Velocity samples, two parameters are being passed in to the component. From within the * component, they can be accessed as:-

    - * + * * Freemarker:

    * $parameters.get('key1') and $parameters.get('key2') or $parameters.key1 and $parameters.key2

    - * + * * Jsp:

    * <s:property value="%{parameters.key1}" /> and <s:property value="%{'parameters.key2'}" /> or * <s:property value="%{parameters.get('key1')}" /> and <s:property value="%{parameters.get('key2')}" />

    @@ -54,7 +57,7 @@ import com.opensymphony.xwork2.util.ValueStack; * string literal to your component, make sure to wrap it in quotes i.e. value="'value1'" otherwise, the the value * stack will search for an Object on the stack with a method of getValue1(). (now that i've written this, i'm not * entirely sure this is the case. i should verify this manana)

    - * + * * * *

    Examples @@ -63,7 +66,7 @@ import com.opensymphony.xwork2.util.ValueStack; * * JSP * <s:component template="/my/custom/component.vm"/> - * + * * or * * <s:component template="/my/custom/component.vm"> @@ -80,29 +83,29 @@ import com.opensymphony.xwork2.util.ValueStack; * #s-param( "name=key1" "value=value1" ) * #s-param( "name=key2" "value=value2" ) * #end - * + * * Freemarker * <@s..component template="/my/custom/component.ftl" /> - * + * * or - * + * * <@s..component template="/my/custom/component.ftl"> * <@s..param name="key1" value="%{'value1'}" /> * <@s..param name="key2" value="%{'value2'}" /> * </@s..component> - * + * * *

- * + * *

- * + * * NOTE: * - * - * If Jsp is used as the template, the jsp template itself must lie within the + * + * If Jsp is used as the template, the jsp template itself must lie within the * webapp itself and not the classpath. Unlike Freemarker or Velocity, JSP template * could not be picked up from the classpath. - * + * * * * @s.tag name="component" tld-body-content="JSP" tld-tag-class="org.apache.struts2.views.jsp.ui.ComponentTag" diff --git a/core/src/main/java/org/apache/struts2/components/Head.java b/core/src/main/java/org/apache/struts2/components/Head.java index 1c29db8b1..210466e0f 100644 --- a/core/src/main/java/org/apache/struts2/components/Head.java +++ b/core/src/main/java/org/apache/struts2/components/Head.java @@ -1,19 +1,22 @@ /* * $Id$ * - * Copyright 2006 The Apache Software Foundation. + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at + * http://www.apache.org/licenses/LICENSE-2.0 * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. */ package org.apache.struts2.components; diff --git a/core/src/main/java/org/apache/struts2/components/Hidden.java b/core/src/main/java/org/apache/struts2/components/Hidden.java index 3d1f1c9da..2e2ccb0bd 100644 --- a/core/src/main/java/org/apache/struts2/components/Hidden.java +++ b/core/src/main/java/org/apache/struts2/components/Hidden.java @@ -1,19 +1,22 @@ /* * $Id$ * - * Copyright 2006 The Apache Software Foundation. + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at + * http://www.apache.org/licenses/LICENSE-2.0 * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. */ package org.apache.struts2.components; diff --git a/core/src/main/java/org/apache/struts2/components/I18n.java b/core/src/main/java/org/apache/struts2/components/I18n.java index 832052148..3114eb416 100644 --- a/core/src/main/java/org/apache/struts2/components/I18n.java +++ b/core/src/main/java/org/apache/struts2/components/I18n.java @@ -1,19 +1,22 @@ /* * $Id$ * - * Copyright 2006 The Apache Software Foundation. + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at + * http://www.apache.org/licenses/LICENSE-2.0 * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. */ package org.apache.struts2.components; @@ -31,48 +34,48 @@ import com.opensymphony.xwork2.util.ValueStack; /** * - * + * * Gets a resource bundle and place it on the value stack. This allows * the text tag to access messages from any bundle, and not just the bundle * associated with the current action. - * + * * - * + * *

- * + * * - * + * *

    - *
  • name* - the resource bundle's name (eg foo/bar/customBundle)
  • + *
  • name* - the resource bundle's name (eg foo/bar/customBundle)
  • *
- * + * * - * + * *

- * + * * Example: - * + * *

  * 
- * 
+ *
  * <s:i18n name="myCustomBundle">
  *    The i18n value for key aaa.bbb.ccc in myCustomBundle is <s:property value="text('aaa.bbb.ccc')" />
  * </s:i18n>
- * 
+ *
  * 
  * 
- * - * + * + * *
  * 
- * 
+ *
  * <s:i18n name="some.package.bundle" >
  *      <s:text name="some.key" />
  * </s:i18n>
- * 
+ *
  * 
  * 
- * + * * @s.tag name="i18n" tld-body-content="JSP" tld-tag-class="org.apache.struts2.views.jsp.I18nTag" * description="Get a resource bundle and place it on the value stack" */ diff --git a/core/src/main/java/org/apache/struts2/components/If.java b/core/src/main/java/org/apache/struts2/components/If.java index 2e5f3cd66..86fb42978 100644 --- a/core/src/main/java/org/apache/struts2/components/If.java +++ b/core/src/main/java/org/apache/struts2/components/If.java @@ -1,19 +1,22 @@ /* * $Id$ * - * Copyright 2006 The Apache Software Foundation. + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at + * http://www.apache.org/licenses/LICENSE-2.0 * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. */ package org.apache.struts2.components; @@ -44,13 +47,13 @@ import com.opensymphony.xwork2.util.ValueStack; *
  * 
  *  <s:if test="%{false}">
- *	    <div>Will Not Be Executed</div>
+ *      <div>Will Not Be Executed</div>
  *  </s:if>
- * 	<s:elseif test="%{true}">
- *	    <div>Will Be Executed</div>
+ *  <s:elseif test="%{true}">
+ *      <div>Will Be Executed</div>
  *  </s:elseif>
  *  <s:else>
- *	    <div>Will Not Be Executed</div>
+ *      <div>Will Not Be Executed</div>
  *  </s:else>
  * 
  * 
@@ -89,7 +92,7 @@ public class If extends Component { } public boolean end(Writer writer, String body) { - stack.getContext().put(ANSWER, answer); + stack.getContext().put(ANSWER, answer); return super.end(writer, body); } } diff --git a/core/src/main/java/org/apache/struts2/components/Include.java b/core/src/main/java/org/apache/struts2/components/Include.java index 0d2099e47..8e6da344f 100644 --- a/core/src/main/java/org/apache/struts2/components/Include.java +++ b/core/src/main/java/org/apache/struts2/components/Include.java @@ -1,19 +1,22 @@ /* * $Id$ * - * Copyright 2006 The Apache Software Foundation. + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at + * http://www.apache.org/licenses/LICENSE-2.0 * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. */ package org.apache.struts2.components; @@ -56,7 +59,7 @@ import com.opensymphony.xwork2.util.ValueStack; * * *
    - *
  • value* (String) - jsp page to be included
  • + *
  • value* (String) - jsp page to be included
  • *
* * @@ -92,7 +95,7 @@ import com.opensymphony.xwork2.util.ValueStack; */ public class Include extends Component { - private static final Log _log = LogFactory.getLog(Include.class); + private static final Log _log = LogFactory.getLog(Include.class); private static String encoding; private static boolean encodingDefined = true; @@ -136,7 +139,7 @@ public class Include extends Component { try { urlBuf.append(URLEncoder.encode(values.get(i).toString(), "UTF-8")); } catch (Exception e) { - _log.warn("unable to url-encode "+values.get(i).toString()+", it will be ignored"); + _log.warn("unable to url-encode "+values.get(i).toString()+", it will be ignored"); } concat = "&"; @@ -215,7 +218,7 @@ public class Include extends Component { public void addParameter(String key, Object value) { // don't use the default implementation of addParameter, // instead, include tag requires that each parameter be a list of objects, - // just like the HTTP servlet interfaces are (String[]) + // just like the HTTP servlet interfaces are (String[]) if (value != null) { List currentValues = (List) parameters.get(key); diff --git a/core/src/main/java/org/apache/struts2/components/IteratorComponent.java b/core/src/main/java/org/apache/struts2/components/IteratorComponent.java index 6b50da71e..f2cb10c9e 100644 --- a/core/src/main/java/org/apache/struts2/components/IteratorComponent.java +++ b/core/src/main/java/org/apache/struts2/components/IteratorComponent.java @@ -1,19 +1,22 @@ /* * $Id$ * - * Copyright 2006 The Apache Software Foundation. + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at + * http://www.apache.org/licenses/LICENSE-2.0 * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. */ package org.apache.struts2.components; @@ -71,11 +74,11 @@ import com.opensymphony.xwork2.util.ValueStack; * colours:

* * - * - * + * + * *
  * 
- * 
+ *
  * <s:bean name="org.apache.struts2.example.IteratorExample" id="it">
  *   <s:param name="day" value="'foo'"/>
  *   <s:param name="day" value="'bar'"/>
@@ -97,7 +100,7 @@ import com.opensymphony.xwork2.util.ValueStack;
  *   </tr>
  * </s:iterator>
  * </table>
- * 
+ *
  * 
  * 
* @@ -111,19 +114,19 @@ import com.opensymphony.xwork2.util.ValueStack; * *
  * 
- * 
- * 	<s:iterator value="groupDao.groups" status="groupStatus">
- * 		<tr class="<s:if test="#groupStatus.odd == true ">odd</s:if><s:else>even</s:else>">
- * 			<td><s:property value="name" /></td>
- * 			<td><s:property value="description" /></td>
- * 			<td>
- * 				<s:iterator value="users" status="userStatus">
- * 					<s:property value="fullName" /><s:if test="!#userStatus.last">,</s:if>
- * 				</s:iterator>
- * 			</td>
- * 		</tr>
- * 	</s:iterator>
- * 
+ *
+ *  <s:iterator value="groupDao.groups" status="groupStatus">
+ *      <tr class="<s:if test="#groupStatus.odd == true ">odd</s:if><s:else>even</s:else>">
+ *          <td><s:property value="name" /></td>
+ *          <td><s:property value="description" /></td>
+ *          <td>
+ *              <s:iterator value="users" status="userStatus">
+ *                  <s:property value="fullName" /><s:if test="!#userStatus.last">,</s:if>
+ *              </s:iterator>
+ *          </td>
+ *      </tr>
+ *  </s:iterator>
+ *
  * 
  * 
*

@@ -139,43 +142,43 @@ import com.opensymphony.xwork2.util.ValueStack; * *

  * 
- * 
- * 		<s:action name="entries" id="entries"/>
- * 		<s:iterator value="#entries.entries" >
- * 			<s:property value="name" />
- * 			<s:property />
- * 			<s:push value="...">
- * 				<s:action name="edit" id="edit" >
- * 					<s:param name="entry" value="[0]" />
- * 				</s:action>
- * 			</push>
- * 		</s:iterator>
- * 
+ *
+ *      <s:action name="entries" id="entries"/>
+ *      <s:iterator value="#entries.entries" >
+ *          <s:property value="name" />
+ *          <s:property />
+ *          <s:push value="...">
+ *              <s:action name="edit" id="edit" >
+ *                  <s:param name="entry" value="[0]" />
+ *              </s:action>
+ *          </push>
+ *      </s:iterator>
+ *
  * 
  * 
- * + * * - * - *

To simulate a simple loop with iterator tag, the following could be done. + * + *

To simulate a simple loop with iterator tag, the following could be done. * It does the loop 5 times. - * + * * - * + * *
  * 
- * 
+ *
  * <s:iterator status="stat" value="{1,2,3,4,5}" >
  *    <!-- grab the index (start with 0 ... ) -->
  *    <s:property value="#stat.index" />
- *    
+ *
  *    <!-- grab the top of the stack which should be the -->
  *    <!-- current iteration value (0, 1, ... 5) -->
  *    <s:property value="top" />
  * </s:iterator>
- * 
+ *
  * 
  * 
- * + * * @s.tag name="iterator" tld-body-content="JSP" tld-tag-class="org.apache.struts2.views.jsp.IteratorTag" * description="Iterate over a iterable value" */ @@ -204,18 +207,18 @@ public class IteratorComponent extends Component { value = "top"; } iterator = MakeIterator.convert(findValue(value)); - + // get the first if ((iterator != null) && iterator.hasNext()) { Object currentValue = iterator.next(); stack.push(currentValue); String id = getId(); - + if ((id != null) && (currentValue != null)) { //pageContext.setAttribute(id, currentValue); //pageContext.setAttribute(id, currentValue, PageContext.REQUEST_SCOPE); - stack.getContext().put(id, currentValue); + stack.getContext().put(id, currentValue); } // Status object @@ -227,7 +230,7 @@ public class IteratorComponent extends Component { return true; } else { - super.end(writer, ""); + super.end(writer, ""); return false; } } @@ -247,7 +250,7 @@ public class IteratorComponent extends Component { if ((id != null) && (currentValue != null)) { //pageContext.setAttribute(id, currentValue); //pageContext.setAttribute(id, currentValue, PageContext.REQUEST_SCOPE); - stack.getContext().put(id, currentValue); + stack.getContext().put(id, currentValue); } // Update status diff --git a/core/src/main/java/org/apache/struts2/components/Label.java b/core/src/main/java/org/apache/struts2/components/Label.java index f964e5127..4dffff71c 100644 --- a/core/src/main/java/org/apache/struts2/components/Label.java +++ b/core/src/main/java/org/apache/struts2/components/Label.java @@ -1,19 +1,22 @@ /* * $Id$ * - * Copyright 2006 The Apache Software Foundation. + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at + * http://www.apache.org/licenses/LICENSE-2.0 * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. */ package org.apache.struts2.components; diff --git a/core/src/main/java/org/apache/struts2/components/ListUIBean.java b/core/src/main/java/org/apache/struts2/components/ListUIBean.java index 9497a4e36..2fe512a0d 100644 --- a/core/src/main/java/org/apache/struts2/components/ListUIBean.java +++ b/core/src/main/java/org/apache/struts2/components/ListUIBean.java @@ -1,19 +1,22 @@ /* * $Id$ * - * Copyright 2006 The Apache Software Foundation. + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at + * http://www.apache.org/licenses/LICENSE-2.0 * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. */ package org.apache.struts2.components; @@ -33,13 +36,13 @@ import com.opensymphony.xwork2.util.ValueStack; * DoubleListUIBean is the standard superclass of all Struts list handling components. * *

- * + * * - * + * * Note that the listkey and listvalue attribute will default to "key" and "value" * respectively only when the list attribute is evaluated to a Map or its decendant. * Other thing else, will result in listkey and listvalue to be null and not used. - * + * * * */ @@ -47,9 +50,9 @@ public abstract class ListUIBean extends UIBean { protected Object list; protected String listKey; protected String listValue; - + // indicate if an exception is to be thrown when value attribute is null - protected boolean throwExceptionOnNullValueAttribute = false; + protected boolean throwExceptionOnNullValueAttribute = false; protected ListUIBean(ValueStack stack, HttpServletRequest request, HttpServletResponse response) { super(stack, request, response); @@ -70,17 +73,17 @@ public abstract class ListUIBean extends UIBean { value = MakeIterator.convert(list); } if (value == null) { - if (throwExceptionOnNullValueAttribute) { - // will throw an exception if not found - value = findValue((list == null) ? (String) list : list.toString(), "list", + if (throwExceptionOnNullValueAttribute) { + // will throw an exception if not found + value = findValue((list == null) ? (String) list : list.toString(), "list", "The requested list key '" + list + "' could not be resolved as a collection/array/map/enumeration/iterator type. " + "Example: people or people.{name}"); - } - else { - // ww-1010, allows value with null value to be compatible with ww - // 2.1.7 behaviour - value = findValue((list == null)?(String) list:list.toString()); - } + } + else { + // ww-1010, allows value with null value to be compatible with ww + // 2.1.7 behaviour + value = findValue((list == null)?(String) list:list.toString()); + } } if (value instanceof Collection) { @@ -148,9 +151,9 @@ public abstract class ListUIBean extends UIBean { public void setListValue(String listValue) { this.listValue = listValue; } - - + + public void setThrowExceptionOnNullValueAttribute(boolean throwExceptionOnNullValueAttribute) { - this.throwExceptionOnNullValueAttribute = throwExceptionOnNullValueAttribute; + this.throwExceptionOnNullValueAttribute = throwExceptionOnNullValueAttribute; } } diff --git a/core/src/main/java/org/apache/struts2/components/MergeIterator.java b/core/src/main/java/org/apache/struts2/components/MergeIterator.java index 1468bc21a..4305c1af7 100644 --- a/core/src/main/java/org/apache/struts2/components/MergeIterator.java +++ b/core/src/main/java/org/apache/struts2/components/MergeIterator.java @@ -1,19 +1,22 @@ /* * $Id$ * - * Copyright 2006 The Apache Software Foundation. + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at + * http://www.apache.org/licenses/LICENSE-2.0 * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. */ package org.apache.struts2.components; @@ -32,20 +35,20 @@ import com.opensymphony.xwork2.util.ValueStack; /** * - *

Component for MergeIteratorTag, which job is to merge iterators and successive - * call to the merged iterator will cause each merge iterator to have a chance to - * expose its element, subsequently next call will allow the next iterator to expose + *

Component for MergeIteratorTag, which job is to merge iterators and successive + * call to the merged iterator will cause each merge iterator to have a chance to + * expose its element, subsequently next call will allow the next iterator to expose * its element. Once the last iterator is done exposing its element, the first iterator * is allowed to do so again (unless it is exhausted of entries).

- * + * *

Internally the task are delegated to MergeIteratorFilter

- * + * *

Example if there are 3 lists being merged, each list have 3 entries, the following will * be the logic.

*
    - *
  1. Display first element of the first list
  2. - *
  3. Display first element of the second list
  4. - *
  5. Display first element of the third list
  6. + *
  7. Display first element of the first list
  8. + *
  9. Display first element of the second list
  10. + *
  11. Display first element of the third list
  12. *
  13. Display second element of the first list
  14. *
  15. Display second element of the second list
  16. *
  17. Display second element of the third list
  18. @@ -54,64 +57,64 @@ import com.opensymphony.xwork2.util.ValueStack; *
  19. Display third element of the thrid list
  20. *
* - * + * * *
    - *
  • id (String) - the id where the resultant merged iterator will be stored in the stack's context
  • + *
  • id (String) - the id where the resultant merged iterator will be stored in the stack's context
  • *
* - * - * + * + * * * public class MergeIteratorTagAction extends ActionSupport { * - * private List myList1; - * private List myList2; - * private List myList3; - * - * public List getMyList1() { - * return myList1; - * } - * - * public List getMyList2() { - * return myList2; - * } - * - * public List getMyList3() { - * return myList3; - * } - * - * - * public String execute() throws Exception { - * - * myList1 = new ArrayList(); - * myList1.add("1"); - * myList1.add("2"); - * myList1.add("3"); - * - * myList2 = new ArrayList(); - * myList2.add("a"); - * myList2.add("b"); - * myList2.add("c"); - * - * myList3 = new ArrayList(); - * myList3.add("A"); - * myList3.add("B"); - * myList3.add("C"); - * - * return "done"; - * } + * private List myList1; + * private List myList2; + * private List myList3; + * + * public List getMyList1() { + * return myList1; + * } + * + * public List getMyList2() { + * return myList2; + * } + * + * public List getMyList3() { + * return myList3; + * } + * + * + * public String execute() throws Exception { + * + * myList1 = new ArrayList(); + * myList1.add("1"); + * myList1.add("2"); + * myList1.add("3"); + * + * myList2 = new ArrayList(); + * myList2.add("a"); + * myList2.add("b"); + * myList2.add("c"); + * + * myList3 = new ArrayList(); + * myList3.add("A"); + * myList3.add("B"); + * myList3.add("C"); + * + * return "done"; + * } * } * * * * <s:merge id="myMergedIterator1"> - * <s:param value="%{myList1}" /> - * <s:param value="%{myList2}" /> - * <s:param value="%{myList3}" /> + * <s:param value="%{myList1}" /> + * <s:param value="%{myList2}" /> + * <s:param value="%{myList3}" /> * </s:merge> * <s:iterator value="%{#myMergedIterator1}"> - * <s:property /> + * <s:property /> * </s:iterator> * * @@ -126,43 +129,43 @@ import com.opensymphony.xwork2.util.ValueStack; * description="Merge the values of a list of iterators into one iterator" */ public class MergeIterator extends Component implements UnnamedParametric { - - private static final Log _log = LogFactory.getLog(MergeIterator.class); - - private MergeIteratorFilter mergeIteratorFilter = null; - private List _parameters; - public MergeIterator(ValueStack stack) { - super(stack); - } - - public boolean start(Writer writer) { - - mergeIteratorFilter = new MergeIteratorFilter(); - _parameters = new ArrayList(); + private static final Log _log = LogFactory.getLog(MergeIterator.class); + + private MergeIteratorFilter mergeIteratorFilter = null; + private List _parameters; + + public MergeIterator(ValueStack stack) { + super(stack); + } + + public boolean start(Writer writer) { + + mergeIteratorFilter = new MergeIteratorFilter(); + _parameters = new ArrayList(); return super.start(writer); } - - public boolean end(Writer writer, String body) { - - for (Iterator parametersIterator = _parameters.iterator(); parametersIterator.hasNext(); ) { - Object iteratorEntryObj = parametersIterator.next(); - if (! MakeIterator.isIterable(iteratorEntryObj)) { - _log.warn("param with value resolved as "+iteratorEntryObj+" cannot be make as iterator, it will be ignored and hence will not appear in the merged iterator"); - continue; - } - mergeIteratorFilter.setSource(MakeIterator.convert(iteratorEntryObj)); - } - - mergeIteratorFilter.execute(); - // if id exists, we put it in the stack's context - if (getId() != null && getId().length() > 0) { - getStack().getContext().put(getId(), mergeIteratorFilter); - } - - mergeIteratorFilter = null; + public boolean end(Writer writer, String body) { + + for (Iterator parametersIterator = _parameters.iterator(); parametersIterator.hasNext(); ) { + Object iteratorEntryObj = parametersIterator.next(); + if (! MakeIterator.isIterable(iteratorEntryObj)) { + _log.warn("param with value resolved as "+iteratorEntryObj+" cannot be make as iterator, it will be ignored and hence will not appear in the merged iterator"); + continue; + } + mergeIteratorFilter.setSource(MakeIterator.convert(iteratorEntryObj)); + } + + mergeIteratorFilter.execute(); + + // if id exists, we put it in the stack's context + if (getId() != null && getId().length() > 0) { + getStack().getContext().put(getId(), mergeIteratorFilter); + } + + mergeIteratorFilter = null; return super.end(writer, body); } @@ -176,7 +179,7 @@ public class MergeIterator extends Component implements UnnamedParametric { } // == UnnamedParametric interface implementation --------------------- - public void addParameter(Object value) { - _parameters.add(value); - } + public void addParameter(Object value) { + _parameters.add(value); + } } diff --git a/core/src/main/java/org/apache/struts2/components/OptGroup.java b/core/src/main/java/org/apache/struts2/components/OptGroup.java index d16c6fe28..2005fdf49 100644 --- a/core/src/main/java/org/apache/struts2/components/OptGroup.java +++ b/core/src/main/java/org/apache/struts2/components/OptGroup.java @@ -1,19 +1,22 @@ /* * $Id$ * - * Copyright 2006 The Apache Software Foundation. + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at + * http://www.apache.org/licenses/LICENSE-2.0 * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. */ package org.apache.struts2.components; @@ -67,83 +70,83 @@ import com.opensymphony.xwork2.util.ValueStack; */ public class OptGroup extends Component { - public static final String INTERNAL_LIST_UI_BEAN_LIST_PARAMETER_KEY = "optGroupInternalListUiBeanList"; + public static final String INTERNAL_LIST_UI_BEAN_LIST_PARAMETER_KEY = "optGroupInternalListUiBeanList"; - private static Log _log = LogFactory.getLog(OptGroup.class); + private static Log _log = LogFactory.getLog(OptGroup.class); - protected HttpServletRequest req; - protected HttpServletResponse res; + protected HttpServletRequest req; + protected HttpServletResponse res; - protected ListUIBean internalUiBean; + protected ListUIBean internalUiBean; - public OptGroup(ValueStack stack, HttpServletRequest req, HttpServletResponse res) { - super(stack); - this.req = req; - this.res = res; - internalUiBean = new ListUIBean(stack, req, res) { - protected String getDefaultTemplate() { - return "empty"; - } - }; - } + public OptGroup(ValueStack stack, HttpServletRequest req, HttpServletResponse res) { + super(stack); + this.req = req; + this.res = res; + internalUiBean = new ListUIBean(stack, req, res) { + protected String getDefaultTemplate() { + return "empty"; + } + }; + } - public boolean end(Writer writer, String body) { - Select select = (Select) findAncestor(Select.class); - if (select == null) { - _log.error("incorrect use of OptGroup component, this component must be used within a Select component", - new IllegalStateException("incorrect use of OptGroup component, this component must be used within a Select component")); - return false; - } - internalUiBean.start(writer); - internalUiBean.end(writer, body); + public boolean end(Writer writer, String body) { + Select select = (Select) findAncestor(Select.class); + if (select == null) { + _log.error("incorrect use of OptGroup component, this component must be used within a Select component", + new IllegalStateException("incorrect use of OptGroup component, this component must be used within a Select component")); + return false; + } + internalUiBean.start(writer); + internalUiBean.end(writer, body); - List listUiBeans = (List) select.getParameters().get(INTERNAL_LIST_UI_BEAN_LIST_PARAMETER_KEY); - if (listUiBeans == null) { - listUiBeans = new ArrayList(); - } - listUiBeans.add(internalUiBean); - select.addParameter(INTERNAL_LIST_UI_BEAN_LIST_PARAMETER_KEY, listUiBeans); + List listUiBeans = (List) select.getParameters().get(INTERNAL_LIST_UI_BEAN_LIST_PARAMETER_KEY); + if (listUiBeans == null) { + listUiBeans = new ArrayList(); + } + listUiBeans.add(internalUiBean); + select.addParameter(INTERNAL_LIST_UI_BEAN_LIST_PARAMETER_KEY, listUiBeans); - return false; - } + return false; + } - /** - * Set the label attribute. - * @s.tagattribute required="false" - */ - public void setLabel(String label) { - internalUiBean.setLabel(label); - } + /** + * Set the label attribute. + * @s.tagattribute required="false" + */ + public void setLabel(String label) { + internalUiBean.setLabel(label); + } - /** - * Set the disable attribute. - * @s.tagattribute required="false" - */ - public void setDisabled(String disabled) { - internalUiBean.setDisabled(disabled); - } + /** + * Set the disable attribute. + * @s.tagattribute required="false" + */ + public void setDisabled(String disabled) { + internalUiBean.setDisabled(disabled); + } - /** - * Set the list attribute. - * @s.tagattribute required="false" - */ - public void setList(String list) { - internalUiBean.setList(list); - } + /** + * Set the list attribute. + * @s.tagattribute required="false" + */ + public void setList(String list) { + internalUiBean.setList(list); + } - /** - * Set the listKey attribute. - * @s.tagattribute required="false" - */ - public void setListKey(String listKey) { - internalUiBean.setListKey(listKey); - } + /** + * Set the listKey attribute. + * @s.tagattribute required="false" + */ + public void setListKey(String listKey) { + internalUiBean.setListKey(listKey); + } - /** - * Set the listValue attribute. - * @s.tagattribute required="false" - */ - public void setListValue(String listValue) { - internalUiBean.setListValue(listValue); - } + /** + * Set the listValue attribute. + * @s.tagattribute required="false" + */ + public void setListValue(String listValue) { + internalUiBean.setListValue(listValue); + } } diff --git a/core/src/main/java/org/apache/struts2/components/OptionTransferSelect.java b/core/src/main/java/org/apache/struts2/components/OptionTransferSelect.java index 0cba4511e..d928846b4 100644 --- a/core/src/main/java/org/apache/struts2/components/OptionTransferSelect.java +++ b/core/src/main/java/org/apache/struts2/components/OptionTransferSelect.java @@ -1,19 +1,22 @@ /* * $Id$ * - * Copyright 2006 The Apache Software Foundation. + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at + * http://www.apache.org/licenses/LICENSE-2.0 * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. */ package org.apache.struts2.components; @@ -30,516 +33,516 @@ import com.opensymphony.xwork2.util.ValueStack; /** * - * + * * Create a option transfer select component which is basically two <select ...> - * tag with buttons in the middle of them allowing options in each of the - * <select ...> to be moved between themselves. Will auto-select all its + * tag with buttons in the middle of them allowing options in each of the + * <select ...> to be moved between themselves. Will auto-select all its * elements upon its containing form submision. - * + * * - * + * *

- * - * + * + * * - * + * * NOTE: The id and doubleId need not be supplied as they will generated provided - * that the optiontransferselect tag is being used in a form tag. The generated id - * and doubleId will be <form_id>_<optiontransferselect_doubleName> and + * that the optiontransferselect tag is being used in a form tag. The generated id + * and doubleId will be <form_id>_<optiontransferselect_doubleName> and * <form_id>_<optiontransferselect_doubleName> respectively. - * + * * - * + * *

- * + * *

  * 
- * 
+ *
  * <-- minimum configuration -->
  * <s:optiontransferselect
- *   	label="Favourite Cartoons Characters"
- *		name="leftSideCartoonCharacters" 
- *		list="{'Popeye', 'He-Man', 'Spiderman'}" 
- *		doubleName="rightSideCartoonCharacters"
- *		doubleList="{'Superman', 'Mickey Mouse', 'Donald Duck'}" 
- *	/>
+ *      label="Favourite Cartoons Characters"
+ *      name="leftSideCartoonCharacters"
+ *      list="{'Popeye', 'He-Man', 'Spiderman'}"
+ *      doubleName="rightSideCartoonCharacters"
+ *      doubleList="{'Superman', 'Mickey Mouse', 'Donald Duck'}"
+ *  />
  *
  *  <-- possible configuration -->
  *  <s:optiontransferselect
- *   	label="Favourite Cartoons Characters"
- *		name="leftSideCartoonCharacters" 
- *		leftTitle="Left Title"
- *		rightTitle="Right Title"
- *		list="{'Popeye', 'He-Man', 'Spiderman'}" 
- *		multiple="true"
- *		headerKey="headerKey"
- *		headerValue="--- Please Select ---"
- *		emptyOption="true"
- *		doubleList="{'Superman', 'Mickey Mouse', 'Donald Duck'}" 
- *		doubleName="rightSideCartoonCharacters"
- *		doubleHeaderKey="doubleHeaderKey"
- *		doubleHeaderValue="--- Please Select ---" 
- *		doubleEmptyOption="true"
- *		doubleMultiple="true"
- *	/>
- * 
+ *      label="Favourite Cartoons Characters"
+ *      name="leftSideCartoonCharacters"
+ *      leftTitle="Left Title"
+ *      rightTitle="Right Title"
+ *      list="{'Popeye', 'He-Man', 'Spiderman'}"
+ *      multiple="true"
+ *      headerKey="headerKey"
+ *      headerValue="--- Please Select ---"
+ *      emptyOption="true"
+ *      doubleList="{'Superman', 'Mickey Mouse', 'Donald Duck'}"
+ *      doubleName="rightSideCartoonCharacters"
+ *      doubleHeaderKey="doubleHeaderKey"
+ *      doubleHeaderValue="--- Please Select ---"
+ *      doubleEmptyOption="true"
+ *      doubleMultiple="true"
+ *  />
+ *
  * 
  * 
- * + * * @s.tag name="optiontransferselect" tld-body-content="JSP" tld-tag-class="org.apache.struts2.views.jsp.ui.OptionTransferSelectTag" * description="Renders an input form" */ public class OptionTransferSelect extends DoubleListUIBean { - - private static final Log _log = LogFactory.getLog(OptionTransferSelect.class); - private static final String TEMPLATE = "optiontransferselect"; - - protected String allowAddToLeft; - protected String allowAddToRight; - protected String allowAddAllToLeft; - protected String allowAddAllToRight; - protected String allowSelectAll; - protected String allowUpDownOnLeft; - protected String allowUpDownOnRight; - - protected String leftTitle; - protected String rightTitle; - - protected String buttonCssClass; - protected String buttonCssStyle; + private static final Log _log = LogFactory.getLog(OptionTransferSelect.class); - protected String addToLeftLabel; - protected String addToRightLabel; - protected String addAllToLeftLabel; - protected String addAllToRightLabel; - protected String selectAllLabel; - protected String leftUpLabel; - protected String leftDownlabel; - protected String rightUpLabel; - protected String rightDownLabel; - - - public OptionTransferSelect(ValueStack stack, HttpServletRequest request, HttpServletResponse response) { - super(stack, request, response); - } + private static final String TEMPLATE = "optiontransferselect"; - protected String getDefaultTemplate() { - return TEMPLATE; - } - - - public void evaluateExtraParams() { - super.evaluateExtraParams(); - - Object doubleValue = null; - - // override DoubleListUIBean's + protected String allowAddToLeft; + protected String allowAddToRight; + protected String allowAddAllToLeft; + protected String allowAddAllToRight; + protected String allowSelectAll; + protected String allowUpDownOnLeft; + protected String allowUpDownOnRight; + + protected String leftTitle; + protected String rightTitle; + + protected String buttonCssClass; + protected String buttonCssStyle; + + protected String addToLeftLabel; + protected String addToRightLabel; + protected String addAllToLeftLabel; + protected String addAllToRightLabel; + protected String selectAllLabel; + protected String leftUpLabel; + protected String leftDownlabel; + protected String rightUpLabel; + protected String rightDownLabel; + + + public OptionTransferSelect(ValueStack stack, HttpServletRequest request, HttpServletResponse response) { + super(stack, request, response); + } + + protected String getDefaultTemplate() { + return TEMPLATE; + } + + + public void evaluateExtraParams() { + super.evaluateExtraParams(); + + Object doubleValue = null; + + // override DoubleListUIBean's if (doubleList != null) { doubleValue = findValue(doubleList); addParameter("doubleList", doubleValue); } if (size == null || size.trim().length() <= 0) { - addParameter("size", "15"); + addParameter("size", "15"); } if (doubleSize == null || doubleSize.trim().length() <= 0) { - addParameter("doubleSize", "15"); + addParameter("doubleSize", "15"); } if (multiple == null || multiple.trim().length() <= 0) { - addParameter("multiple", Boolean.TRUE); + addParameter("multiple", Boolean.TRUE); } if (doubleMultiple == null || doubleMultiple.trim().length() <= 0) { - addParameter("doubleMultiple", Boolean.TRUE); + addParameter("doubleMultiple", Boolean.TRUE); } - - - - - - // buttonCssClass + + + + + + // buttonCssClass if (buttonCssClass != null && buttonCssClass.trim().length() > 0) { - addParameter("buttonCssClass", buttonCssClass); + addParameter("buttonCssClass", buttonCssClass); } - + // buttonCssStyle if (buttonCssStyle != null && buttonCssStyle.trim().length() > 0) { - addParameter("buttonCssStyle", buttonCssStyle); + addParameter("buttonCssStyle", buttonCssStyle); } - - + + // allowSelectAll - addParameter("allowSelectAll", - allowSelectAll != null ? findValue(allowSelectAll, Boolean.class) : Boolean.TRUE); - - // allowAddToLeft - addParameter("allowAddToLeft", - allowAddToLeft != null ? findValue(allowAddToLeft, Boolean.class) : Boolean.TRUE); - - // allowAddToRight - addParameter("allowAddToRight", - allowAddToRight != null ? findValue(allowAddToRight, Boolean.class) : Boolean.TRUE); - - // allowAddAllToLeft - addParameter("allowAddAllToLeft", - allowAddAllToLeft != null ? findValue(allowAddAllToLeft, Boolean.class) : Boolean.TRUE); - - // allowAddAllToRight - addParameter("allowAddAllToRight", - allowAddAllToRight != null ? findValue(allowAddAllToRight, Boolean.class) : Boolean.TRUE); - - // allowUpDownOnLeft - addParameter("allowUpDownOnLeft", - allowUpDownOnLeft != null ? findValue(allowUpDownOnLeft, Boolean.class) : Boolean.TRUE); - - // allowUpDownOnRight - addParameter("allowUpDownOnRight", - allowUpDownOnRight != null ? findValue(allowUpDownOnRight, Boolean.class) : Boolean.TRUE); - - - // leftTitle - if (leftTitle != null) { - addParameter("leftTitle", findValue(leftTitle, String.class)); - } - - // rightTitle - if (rightTitle != null) { - addParameter("rightTitle", findValue(rightTitle, String.class)); - } - - - // addToLeftLabel - addParameter("addToLeftLabel", - addToLeftLabel != null ? findValue(addToLeftLabel, String.class) : "<-" ); - - // addToRightLabel - addParameter("addToRightLabel", - addToRightLabel != null ? findValue(addToRightLabel, String.class) : "->"); - - // addAllToLeftLabel - addParameter("addAllToLeftLabel", - addAllToLeftLabel != null ? findValue(addAllToLeftLabel, String.class) : "<<--"); - - // addAllToRightLabel - addParameter("addAllToRightLabel", - addAllToRightLabel != null ? findValue(addAllToRightLabel, String.class) : "-->>"); - - // selectAllLabel - addParameter("selectAllLabel", - selectAllLabel != null ? findValue(selectAllLabel, String.class) : "<*>"); - - // leftUpLabel - addParameter("leftUpLabel", - leftUpLabel != null ? findValue(leftUpLabel, String.class) : "^"); - - - // leftDownLabel - addParameter("leftDownLabel", - leftDownlabel != null ? findValue(leftDownlabel, String.class) : "v"); - - - // rightUpLabel - addParameter("rightUpLabel", - rightUpLabel != null ? findValue(rightUpLabel, String.class) : "^"); - - - // rightDownlabel - addParameter("rightDownLabel", - rightDownLabel != null ? findValue(rightDownLabel, String.class) : "v"); - - - - // inform the form component our select tag infos, so they know how to select - // its elements upon onsubmit - Form formAncestor = (Form) findAncestor(Form.class); - if (formAncestor != null) { - - // inform ancestor form that we are having a customOnsubmit (see form-close.ftl [simple theme]) - enableAncestorFormCustomOnsubmit(); - - - // key -> select tag id, value -> headerKey (if exists) - Map formOptiontransferselectIds = (Map) formAncestor.getParameters().get("optiontransferselectIds"); - Map formOptiontransferselectDoubleIds = (Map) formAncestor.getParameters().get("optiontransferselectDoubleIds"); + addParameter("allowSelectAll", + allowSelectAll != null ? findValue(allowSelectAll, Boolean.class) : Boolean.TRUE); - // init lists - if (formOptiontransferselectIds == null) { - formOptiontransferselectIds = new LinkedHashMap(); - } - if (formOptiontransferselectDoubleIds == null) { - formOptiontransferselectDoubleIds = new LinkedHashMap(); - } - - - // id - String tmpId = (String) getParameters().get("id"); - String tmpHeaderKey = (String) getParameters().get("headerKey"); - if (tmpId != null && (! formOptiontransferselectIds.containsKey(tmpId))) { - formOptiontransferselectIds.put(tmpId, tmpHeaderKey); - } - - // doubleId - String tmpDoubleId = (String) getParameters().get("doubleId"); - String tmpDoubleHeaderKey = (String) getParameters().get("doubleHeaderKey"); - if (tmpDoubleId != null && (! formOptiontransferselectDoubleIds.containsKey(tmpDoubleId))) { - formOptiontransferselectDoubleIds.put(tmpDoubleId, tmpDoubleHeaderKey); - } - - formAncestor.getParameters().put("optiontransferselectIds", formOptiontransferselectIds); - formAncestor.getParameters().put("optiontransferselectDoubleIds", formOptiontransferselectDoubleIds); - - } - else { - _log.warn("form enclosing optiontransferselect "+this+" not found, auto select upon form submit of optiontransferselect will not work"); - } - } - - - - public String getAddAllToLeftLabel() { - return addAllToLeftLabel; - } + // allowAddToLeft + addParameter("allowAddToLeft", + allowAddToLeft != null ? findValue(allowAddToLeft, Boolean.class) : Boolean.TRUE); - /** + // allowAddToRight + addParameter("allowAddToRight", + allowAddToRight != null ? findValue(allowAddToRight, Boolean.class) : Boolean.TRUE); + + // allowAddAllToLeft + addParameter("allowAddAllToLeft", + allowAddAllToLeft != null ? findValue(allowAddAllToLeft, Boolean.class) : Boolean.TRUE); + + // allowAddAllToRight + addParameter("allowAddAllToRight", + allowAddAllToRight != null ? findValue(allowAddAllToRight, Boolean.class) : Boolean.TRUE); + + // allowUpDownOnLeft + addParameter("allowUpDownOnLeft", + allowUpDownOnLeft != null ? findValue(allowUpDownOnLeft, Boolean.class) : Boolean.TRUE); + + // allowUpDownOnRight + addParameter("allowUpDownOnRight", + allowUpDownOnRight != null ? findValue(allowUpDownOnRight, Boolean.class) : Boolean.TRUE); + + + // leftTitle + if (leftTitle != null) { + addParameter("leftTitle", findValue(leftTitle, String.class)); + } + + // rightTitle + if (rightTitle != null) { + addParameter("rightTitle", findValue(rightTitle, String.class)); + } + + + // addToLeftLabel + addParameter("addToLeftLabel", + addToLeftLabel != null ? findValue(addToLeftLabel, String.class) : "<-" ); + + // addToRightLabel + addParameter("addToRightLabel", + addToRightLabel != null ? findValue(addToRightLabel, String.class) : "->"); + + // addAllToLeftLabel + addParameter("addAllToLeftLabel", + addAllToLeftLabel != null ? findValue(addAllToLeftLabel, String.class) : "<<--"); + + // addAllToRightLabel + addParameter("addAllToRightLabel", + addAllToRightLabel != null ? findValue(addAllToRightLabel, String.class) : "-->>"); + + // selectAllLabel + addParameter("selectAllLabel", + selectAllLabel != null ? findValue(selectAllLabel, String.class) : "<*>"); + + // leftUpLabel + addParameter("leftUpLabel", + leftUpLabel != null ? findValue(leftUpLabel, String.class) : "^"); + + + // leftDownLabel + addParameter("leftDownLabel", + leftDownlabel != null ? findValue(leftDownlabel, String.class) : "v"); + + + // rightUpLabel + addParameter("rightUpLabel", + rightUpLabel != null ? findValue(rightUpLabel, String.class) : "^"); + + + // rightDownlabel + addParameter("rightDownLabel", + rightDownLabel != null ? findValue(rightDownLabel, String.class) : "v"); + + + + // inform the form component our select tag infos, so they know how to select + // its elements upon onsubmit + Form formAncestor = (Form) findAncestor(Form.class); + if (formAncestor != null) { + + // inform ancestor form that we are having a customOnsubmit (see form-close.ftl [simple theme]) + enableAncestorFormCustomOnsubmit(); + + + // key -> select tag id, value -> headerKey (if exists) + Map formOptiontransferselectIds = (Map) formAncestor.getParameters().get("optiontransferselectIds"); + Map formOptiontransferselectDoubleIds = (Map) formAncestor.getParameters().get("optiontransferselectDoubleIds"); + + // init lists + if (formOptiontransferselectIds == null) { + formOptiontransferselectIds = new LinkedHashMap(); + } + if (formOptiontransferselectDoubleIds == null) { + formOptiontransferselectDoubleIds = new LinkedHashMap(); + } + + + // id + String tmpId = (String) getParameters().get("id"); + String tmpHeaderKey = (String) getParameters().get("headerKey"); + if (tmpId != null && (! formOptiontransferselectIds.containsKey(tmpId))) { + formOptiontransferselectIds.put(tmpId, tmpHeaderKey); + } + + // doubleId + String tmpDoubleId = (String) getParameters().get("doubleId"); + String tmpDoubleHeaderKey = (String) getParameters().get("doubleHeaderKey"); + if (tmpDoubleId != null && (! formOptiontransferselectDoubleIds.containsKey(tmpDoubleId))) { + formOptiontransferselectDoubleIds.put(tmpDoubleId, tmpDoubleHeaderKey); + } + + formAncestor.getParameters().put("optiontransferselectIds", formOptiontransferselectIds); + formAncestor.getParameters().put("optiontransferselectDoubleIds", formOptiontransferselectDoubleIds); + + } + else { + _log.warn("form enclosing optiontransferselect "+this+" not found, auto select upon form submit of optiontransferselect will not work"); + } + } + + + + public String getAddAllToLeftLabel() { + return addAllToLeftLabel; + } + + /** * set Add To Left button label - * @s.tagattribute required="false" - */ - public void setAddAllToLeftLabel(String addAllToLeftLabel) { - this.addAllToLeftLabel = addAllToLeftLabel; - } + * @s.tagattribute required="false" + */ + public void setAddAllToLeftLabel(String addAllToLeftLabel) { + this.addAllToLeftLabel = addAllToLeftLabel; + } - public String getAddAllToRightLabel() { - return addAllToRightLabel; - } + public String getAddAllToRightLabel() { + return addAllToRightLabel; + } - /** + /** * set Add All To Right button label - * @s.tagattribute required="false" - */ - public void setAddAllToRightLabel(String addAllToRightLabel) { - this.addAllToRightLabel = addAllToRightLabel; - } + * @s.tagattribute required="false" + */ + public void setAddAllToRightLabel(String addAllToRightLabel) { + this.addAllToRightLabel = addAllToRightLabel; + } - public String getAddToLeftLabel() { - return addToLeftLabel; - } + public String getAddToLeftLabel() { + return addToLeftLabel; + } - /** + /** * set Add To Left button label - * @s.tagattribute required="false" - */ - public void setAddToLeftLabel(String addToLeftLabel) { - this.addToLeftLabel = addToLeftLabel; - } + * @s.tagattribute required="false" + */ + public void setAddToLeftLabel(String addToLeftLabel) { + this.addToLeftLabel = addToLeftLabel; + } - public String getAddToRightLabel() { - return addToRightLabel; - } + public String getAddToRightLabel() { + return addToRightLabel; + } - /** + /** * set Add To Right button label - * @s.tagattribute required="false" - */ - public void setAddToRightLabel(String addToRightLabel) { - this.addToRightLabel = addToRightLabel; - } + * @s.tagattribute required="false" + */ + public void setAddToRightLabel(String addToRightLabel) { + this.addToRightLabel = addToRightLabel; + } - public String getAllowAddAllToLeft() { - return allowAddAllToLeft; - } + public String getAllowAddAllToLeft() { + return allowAddAllToLeft; + } - /** + /** * enable Add All To Left button - * @s.tagattribute required="false" - */ - public void setAllowAddAllToLeft(String allowAddAllToLeft) { - this.allowAddAllToLeft = allowAddAllToLeft; - } + * @s.tagattribute required="false" + */ + public void setAllowAddAllToLeft(String allowAddAllToLeft) { + this.allowAddAllToLeft = allowAddAllToLeft; + } - public String getAllowAddAllToRight() { - return allowAddAllToRight; - } + public String getAllowAddAllToRight() { + return allowAddAllToRight; + } - /** + /** * enable Add All To Right button - * @s.tagattribute required="false" - */ - public void setAllowAddAllToRight(String allowAddAllToRight) { - this.allowAddAllToRight = allowAddAllToRight; - } + * @s.tagattribute required="false" + */ + public void setAllowAddAllToRight(String allowAddAllToRight) { + this.allowAddAllToRight = allowAddAllToRight; + } - public String getAllowAddToLeft() { - return allowAddToLeft; - } + public String getAllowAddToLeft() { + return allowAddToLeft; + } - /** + /** * enable Add To Left button - * @s.tagattribute required="false" - */ - public void setAllowAddToLeft(String allowAddToLeft) { - this.allowAddToLeft = allowAddToLeft; - } + * @s.tagattribute required="false" + */ + public void setAllowAddToLeft(String allowAddToLeft) { + this.allowAddToLeft = allowAddToLeft; + } - public String getAllowAddToRight() { - return allowAddToRight; - } + public String getAllowAddToRight() { + return allowAddToRight; + } - /** + /** * enable Add To Right button - * @s.tagattribute required="false" - */ - public void setAllowAddToRight(String allowAddToRight) { - this.allowAddToRight = allowAddToRight; - } + * @s.tagattribute required="false" + */ + public void setAllowAddToRight(String allowAddToRight) { + this.allowAddToRight = allowAddToRight; + } - public String getLeftTitle() { - return leftTitle; - } - - - /** - * enable up / down on the left side - * @a2 tagattribute required="false" - */ - public void setAllowUpDownOnLeft(String allowUpDownOnLeft) { - this.allowUpDownOnLeft = allowUpDownOnLeft; - } - - public String getAllowUpDownOnLeft() { - return this.allowUpDownOnLeft; - } - - - /** - * enable up / down on the right side - * @a2 tagattribute required="false" - */ - public void setAllowUpDownOnRight(String allowUpDownOnRight) { - this.allowUpDownOnRight = allowUpDownOnRight; - } - - public String getAllowUpDownOnRight() { - return this.allowUpDownOnRight; - } - + public String getLeftTitle() { + return leftTitle; + } - /** + + /** + * enable up / down on the left side + * @a2 tagattribute required="false" + */ + public void setAllowUpDownOnLeft(String allowUpDownOnLeft) { + this.allowUpDownOnLeft = allowUpDownOnLeft; + } + + public String getAllowUpDownOnLeft() { + return this.allowUpDownOnLeft; + } + + + /** + * enable up / down on the right side + * @a2 tagattribute required="false" + */ + public void setAllowUpDownOnRight(String allowUpDownOnRight) { + this.allowUpDownOnRight = allowUpDownOnRight; + } + + public String getAllowUpDownOnRight() { + return this.allowUpDownOnRight; + } + + + /** * set Left title - * @s.tagattribute required="false" - */ - public void setLeftTitle(String leftTitle) { - this.leftTitle = leftTitle; - } + * @s.tagattribute required="false" + */ + public void setLeftTitle(String leftTitle) { + this.leftTitle = leftTitle; + } - public String getRightTitle() { - return rightTitle; - } + public String getRightTitle() { + return rightTitle; + } - /** + /** * set Right title - * @s.tagattribute required="false" - */ - public void setRightTitle(String rightTitle) { - this.rightTitle = rightTitle; - } - - - /** + * @s.tagattribute required="false" + */ + public void setRightTitle(String rightTitle) { + this.rightTitle = rightTitle; + } + + + /** * enable Select All button - * @s.tagattribute required="false" - */ - public void setAllowSelectAll(String allowSelectAll) { - this.allowSelectAll = allowSelectAll; - } + * @s.tagattribute required="false" + */ + public void setAllowSelectAll(String allowSelectAll) { + this.allowSelectAll = allowSelectAll; + } public String getAllowSelectAll() { - return this.allowSelectAll; - } - - - /** + return this.allowSelectAll; + } + + + /** * set Select All button label - * @s.tagattribute required="false" - */ - public void setSelectAllLabel(String selectAllLabel) { - this.selectAllLabel = selectAllLabel; - } + * @s.tagattribute required="false" + */ + public void setSelectAllLabel(String selectAllLabel) { + this.selectAllLabel = selectAllLabel; + } public String getSelectAllLabel() { - return this.selectAllLabel; - } + return this.selectAllLabel; + } /** * set buttons css class - * @s.tagattribute required="false" - */ - public void setButtonCssClass(String buttonCssClass) { - this.buttonCssClass = buttonCssClass; - } + * @s.tagattribute required="false" + */ + public void setButtonCssClass(String buttonCssClass) { + this.buttonCssClass = buttonCssClass; + } public String getButtonCssClass() { - return buttonCssClass; - } - - - /** + return buttonCssClass; + } + + + /** * set button css style - * @s.tagattribute required="false" - */ - public void setButtonCssStyle(String buttonCssStyle) { - this.buttonCssStyle = buttonCssStyle; - } + * @s.tagattribute required="false" + */ + public void setButtonCssStyle(String buttonCssStyle) { + this.buttonCssStyle = buttonCssStyle; + } public String getButtonCssStyle() { - return this.buttonCssStyle; - } - - + return this.buttonCssStyle; + } + + /** * Up label for the left side * @a2 tagattribute required="false" */ public void setLeftUpLabel(String leftUpLabel) { - this.leftUpLabel = leftUpLabel; + this.leftUpLabel = leftUpLabel; } public String getLeftUpLabel() { - return this.leftUpLabel; + return this.leftUpLabel; } - + /** * Down label for the left side. * @a2 tagattribute required="false" */ public void setLeftDownLabel(String leftDownLabel) { - this.leftDownlabel = leftDownLabel; + this.leftDownlabel = leftDownLabel; } public String getLeftDownLabel() { - return this.leftDownlabel; + return this.leftDownlabel; } - + /** * Up label for the right side. * @a2 tagattribute required="false" */ public void setRightUpLabel(String rightUpLabel) { - this.rightUpLabel = rightUpLabel; + this.rightUpLabel = rightUpLabel; } public String getRightUpLabel() { - return this.rightUpLabel; + return this.rightUpLabel; } - - + + /** * Down label for the left side. * @a2 tagattribute required="false" */ public void setRightDownLabel(String rightDownlabel) { - this.rightDownLabel = rightDownlabel; + this.rightDownLabel = rightDownlabel; } public String getRightDownLabel() { - return rightDownLabel; + return rightDownLabel; } - - + + } diff --git a/core/src/main/java/org/apache/struts2/components/Panel.java b/core/src/main/java/org/apache/struts2/components/Panel.java index f32987738..db276b464 100644 --- a/core/src/main/java/org/apache/struts2/components/Panel.java +++ b/core/src/main/java/org/apache/struts2/components/Panel.java @@ -1,19 +1,22 @@ /* * $Id$ * - * Copyright 2006 The Apache Software Foundation. + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at + * http://www.apache.org/licenses/LICENSE-2.0 * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. */ package org.apache.struts2.components; diff --git a/core/src/main/java/org/apache/struts2/components/Param.java b/core/src/main/java/org/apache/struts2/components/Param.java index e48c8bf3b..1b0f4a134 100644 --- a/core/src/main/java/org/apache/struts2/components/Param.java +++ b/core/src/main/java/org/apache/struts2/components/Param.java @@ -1,19 +1,22 @@ /* * $Id$ * - * Copyright 2006 The Apache Software Foundation. + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at + * http://www.apache.org/licenses/LICENSE-2.0 * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. */ package org.apache.struts2.components; @@ -37,7 +40,7 @@ import com.opensymphony.xwork2.util.ValueStack; * This tag has the following two paramters. * *
    - *
  • name (String) - the name of the parameter
  • + *
  • name (String) - the name of the parameter
  • *
  • value (Object) - the value of the parameter
  • *
* diff --git a/core/src/main/java/org/apache/struts2/components/Password.java b/core/src/main/java/org/apache/struts2/components/Password.java index 3b2b92a15..50507d8c9 100644 --- a/core/src/main/java/org/apache/struts2/components/Password.java +++ b/core/src/main/java/org/apache/struts2/components/Password.java @@ -1,19 +1,22 @@ /* * $Id$ * - * Copyright 2006 The Apache Software Foundation. + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at + * http://www.apache.org/licenses/LICENSE-2.0 * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. */ package org.apache.struts2.components; diff --git a/core/src/main/java/org/apache/struts2/components/Property.java b/core/src/main/java/org/apache/struts2/components/Property.java index 56b413f51..3492df327 100644 --- a/core/src/main/java/org/apache/struts2/components/Property.java +++ b/core/src/main/java/org/apache/struts2/components/Property.java @@ -1,19 +1,22 @@ /* * $Id$ * - * Copyright 2006 The Apache Software Foundation. + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at + * http://www.apache.org/licenses/LICENSE-2.0 * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. */ package org.apache.struts2.components; @@ -28,29 +31,29 @@ import com.opensymphony.xwork2.util.TextUtils; /** * - * + * * Used to get the property of a value, which will default to the top of * the stack if none is specified. - * + * * - * + * *

- * + * * * - * + * *

    *
  • default (String) - The default value to be used if value attribute is null
  • *
  • escape (Boolean) - Escape HTML. Default to true
  • *
  • value (Object) - value to be displayed
  • *
- * + * * * * *
  * 
- * 
+ *
  * 
  *     
  *     
@@ -58,25 +61,25 @@ import com.opensymphony.xwork2.util.TextUtils;
  *     TextUtils
  *     
  * 
- * 
+ *
  * 
  * 
- * + * *
  * 
- * 
+ *
  * Example 1 prints the result of myBean's getMyBeanProperty() method.
  * Example 2 prints the result of myBean's getMyBeanProperty() method and if it is null, print 'a default value' instead.
- * 
+ *
  * 
  * 
- * - * + * + * *
  * 
- * 
+ *
  * <s:property value="getText('some.key')" />
- * 
+ *
  * 
  * 
* diff --git a/core/src/main/java/org/apache/struts2/components/Push.java b/core/src/main/java/org/apache/struts2/components/Push.java index 378baeee2..794a38e31 100644 --- a/core/src/main/java/org/apache/struts2/components/Push.java +++ b/core/src/main/java/org/apache/struts2/components/Push.java @@ -1,19 +1,22 @@ /* * $Id$ * - * Copyright 2006 The Apache Software Foundation. + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at + * http://www.apache.org/licenses/LICENSE-2.0 * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. */ package org.apache.struts2.components; @@ -28,7 +31,7 @@ import com.opensymphony.xwork2.util.ValueStack; * * *
    - *
  • value* (Object) - value to be pushed into the top of the stack
  • + *
  • value* (Object) - value to be pushed into the top of the stack
  • *
* * @@ -42,22 +45,22 @@ import com.opensymphony.xwork2.util.ValueStack; * </s:push> * * - * + * * - * Pushed user into the stack, and hence property tag could access user's properties + * Pushed user into the stack, and hence property tag could access user's properties * (firstName, lastName etc) since user is not at the top of the stack * - * + * *
  * 
  *  <s:push value="myObject">                              ----- (1)
  *       <s:bean name="jp.SomeBean" id="myBean"/>        ----- (2)
- * 		    <s:param name="myParam" value="top"/>        ----- (3)
+ *          <s:param name="myParam" value="top"/>        ----- (3)
  *       </s:bean>
  *   </s:push>
  * 
  * 
- * + * *
  * 
  * when in (1), myObject is at the top of the stack
@@ -65,7 +68,7 @@ import com.opensymphony.xwork2.util.ValueStack;
  * when in (3), top will get the jp.SomeBean instance
  * 
  * 
- * + * *
  * 
  * <s:push value="myObject">                                       ---(A)
@@ -75,7 +78,7 @@ import com.opensymphony.xwork2.util.ValueStack;
  * </s:push>
  * 
  * 
- * + * *
  * 
  * when in (A), myObject is at the top of the stack
@@ -83,9 +86,9 @@ import com.opensymphony.xwork2.util.ValueStack;
  * when in (C), top refers to jp.SomeBean instance. so top.mySomeOtherValue would invoke SomeBean's mySomeOtherValue() method
  * 
  * 
- * + * *
- *        
+ * 
  * <s:push value="myObject">                                 ---- (i)
  *    <s:bean name="jp.SomeBean" id="myBean"/>             ---- (ii)
  *       <s:param name="myParam" value="[1].top"/>         -----(iii)
@@ -93,15 +96,15 @@ import com.opensymphony.xwork2.util.ValueStack;
  * </s:push>
  * 
  * 
- * + * *
  * 
  * when in (i), myObject is at the top of the stack
  * when in (ii), jp.SomeBean is at the top of the stack, followed by myObject
- * when in (iii), [1].top will returned top of the cut of stack starting from myObject, namely myObject itself 
+ * when in (iii), [1].top will returned top of the cut of stack starting from myObject, namely myObject itself
  * 
  * 
- * + * * @s.tag name="push" tld-body-content="JSP" tld-tag-class="org.apache.struts2.views.jsp.PushTag" * description="Push value on stack for simplified usage." */ diff --git a/core/src/main/java/org/apache/struts2/components/Radio.java b/core/src/main/java/org/apache/struts2/components/Radio.java index f48e2527e..b1433287b 100644 --- a/core/src/main/java/org/apache/struts2/components/Radio.java +++ b/core/src/main/java/org/apache/struts2/components/Radio.java @@ -1,19 +1,22 @@ /* * $Id$ * - * Copyright 2006 The Apache Software Foundation. + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at + * http://www.apache.org/licenses/LICENSE-2.0 * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. */ package org.apache.struts2.components; @@ -32,8 +35,8 @@ import com.opensymphony.xwork2.util.ValueStack; * * In this example, a radio control is displayed with a list of genders. The gender list is built from attribute * id=genders. The framework calls getGenders() which will return a Map. For examples using listKey and listValue attributes, - * see the section select tag. The default selected one will be determined (in this case) by the getMale() method - * in the action class which should retun a value similar to the key of the getGenters() map if that particular + * see the section select tag. The default selected one will be determined (in this case) by the getMale() method + * in the action class which should retun a value similar to the key of the getGenters() map if that particular * gender is to be selected.

* *

diff --git a/core/src/main/java/org/apache/struts2/components/RemoteCallUIBean.java b/core/src/main/java/org/apache/struts2/components/RemoteCallUIBean.java
index 5d5f85875..1f1757fff 100644
--- a/core/src/main/java/org/apache/struts2/components/RemoteCallUIBean.java
+++ b/core/src/main/java/org/apache/struts2/components/RemoteCallUIBean.java
@@ -1,19 +1,22 @@
 /*
  * $Id$
  *
- * Copyright 2006 The Apache Software Foundation.
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
  *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
+ *  http://www.apache.org/licenses/LICENSE-2.0
  *
- *      http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
  */
 package org.apache.struts2.components;
 
diff --git a/core/src/main/java/org/apache/struts2/components/Reset.java b/core/src/main/java/org/apache/struts2/components/Reset.java
index db96b85e9..5fe7bdb07 100644
--- a/core/src/main/java/org/apache/struts2/components/Reset.java
+++ b/core/src/main/java/org/apache/struts2/components/Reset.java
@@ -1,19 +1,22 @@
 /*
  * $Id$
  *
- * Copyright 2006 The Apache Software Foundation.
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
  *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
+ *  http://www.apache.org/licenses/LICENSE-2.0
  *
- *      http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
  */
 package org.apache.struts2.components;
 
diff --git a/core/src/main/java/org/apache/struts2/components/Select.java b/core/src/main/java/org/apache/struts2/components/Select.java
index 0335b6ffb..e615271e0 100644
--- a/core/src/main/java/org/apache/struts2/components/Select.java
+++ b/core/src/main/java/org/apache/struts2/components/Select.java
@@ -1,19 +1,22 @@
 /*
  * $Id$
  *
- * Copyright 2006 The Apache Software Foundation.
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
  *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
+ *  http://www.apache.org/licenses/LICENSE-2.0
  *
- *      http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
  */
 package org.apache.struts2.components;
 
@@ -24,15 +27,15 @@ import com.opensymphony.xwork2.util.ValueStack;
 
 /**
  * 
- * 
- * Render an HTML input tag of type select. 
- * 
+ *
+ * Render an HTML input tag of type select.
+ *
  * 
  *
  * 

Examples *

  * 
- * 
+ *
  * <s:select label="Pets"
  *        name="petIds"
  *        list="petDao.pets"
@@ -53,21 +56,21 @@ import com.opensymphony.xwork2.util.ValueStack;
  *
  * // The month id (01, 02, ...) returned by the getSelectedMonth() call
  * // against the stack will be auto-selected
- * 
+ *
  * 
  * 
- * + * *

- * + * * - * + * * Note: For any of the tags that use lists (select probably being the most ubiquitous), which uses the OGNL list * notation (see the "months" example above), it should be noted that the map key created (in the months example, * the '01', '02', etc.) is typed. '1' is a char, '01' is a String, "1" is a String. This is important since if * the value returned by your "value" attribute is NOT the same type as the key in the "list" attribute, they * WILL NOT MATCH, even though their String values may be equivalent. If they don't match, nothing in your list * will be auto-selected.

- * + * * * * @s.tag name="select" tld-body-content="JSP" tld-tag-class="org.apache.struts2.views.jsp.ui.SelectTag" diff --git a/core/src/main/java/org/apache/struts2/components/Set.java b/core/src/main/java/org/apache/struts2/components/Set.java index a8c8c3e14..4e7d28781 100644 --- a/core/src/main/java/org/apache/struts2/components/Set.java +++ b/core/src/main/java/org/apache/struts2/components/Set.java @@ -1,19 +1,22 @@ /* * $Id$ * - * Copyright 2006 The Apache Software Foundation. + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at + * http://www.apache.org/licenses/LICENSE-2.0 * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. */ package org.apache.struts2.components; @@ -27,7 +30,7 @@ import com.opensymphony.xwork2.util.ValueStack; * complex expression and then simply reference that variable each time rather than the complex expression. This is * useful in both cases: when the complex expression takes time (performance improvement) or is hard to read (code * readability improvement).

- * + * * The scopes available are as follows :- *
    *
  • application - the value will be set in application scope according to servlet spec. using the name as its key
  • @@ -36,7 +39,7 @@ import com.opensymphony.xwork2.util.ValueStack; *
  • page - the value will be set in request scope according to servlet sepc. using the name as key
  • *
  • action - the value will be set in the request scope and Struts' action context using the name as key
  • *
- * + * * NOTE:

* If no scope is specified, it will default to action scope. * diff --git a/core/src/main/java/org/apache/struts2/components/Submit.java b/core/src/main/java/org/apache/struts2/components/Submit.java index f173caf43..1998629bd 100644 --- a/core/src/main/java/org/apache/struts2/components/Submit.java +++ b/core/src/main/java/org/apache/struts2/components/Submit.java @@ -1,19 +1,22 @@ /* * $Id$ * - * Copyright 2006 The Apache Software Foundation. + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at + * http://www.apache.org/licenses/LICENSE-2.0 * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. */ package org.apache.struts2.components; @@ -42,7 +45,7 @@ import com.opensymphony.xwork2.util.ValueStack; * <s:submit value="%{'Submit'}" /> * *

- * + * *
  * 
  * Render an image submit:
@@ -60,24 +63,24 @@ import com.opensymphony.xwork2.util.ValueStack;
  * 
  * THE FOLLOWING IS ONLY VALID WHEN AJAX IS CONFIGURED
  * 
    - *
  • resultDivId
  • - *
  • notifyTopics
  • - *
  • onLoadJS
  • - *
  • preInvokeJS
  • + *
  • resultDivId
  • + *
  • notifyTopics
  • + *
  • onLoadJS
  • + *
  • preInvokeJS
  • *
- * The remote form has three basic modes of use, using the resultDivId, - * the notifyTopics, or the onLoadJS. You can mix and match any combination of - * them to get your desired result. All of these examples are contained in the + * The remote form has three basic modes of use, using the resultDivId, + * the notifyTopics, or the onLoadJS. You can mix and match any combination of + * them to get your desired result. All of these examples are contained in the * Ajax example webapp. Lets go through some scenarios to see how you might use it: * - * + * * - * Show the results in another div. If you want your results to be shown in - * a div, use the resultDivId where the id is the id of the div you want them - * shown in. This is an inner HTML approah. Your results get jammed into + * Show the results in another div. If you want your results to be shown in + * a div, use the resultDivId where the id is the id of the div you want them + * shown in. This is an inner HTML approah. Your results get jammed into * the div for you. Here is a sample of this approach: * - * + * *
  * 
  * Remote form replacing another div:
@@ -95,24 +98,24 @@ import com.opensymphony.xwork2.util.ValueStack;
  * </s:form >
  * 
  * 
- * - * + * + * * - * Notify other controls(divs) of a change. Using an pub-sub model you can - * notify others that your control changed and they can take the appropriate action. - * Most likely they will execute some action to refresh. The notifyTopics does this - * for you. You can have many topic names in a comma delimited list. + * Notify other controls(divs) of a change. Using an pub-sub model you can + * notify others that your control changed and they can take the appropriate action. + * Most likely they will execute some action to refresh. The notifyTopics does this + * for you. You can have many topic names in a comma delimited list. * eg: notifyTopics="newPerson, dataChanged" . * Here is an example of this approach: * - * + * *
  * 
  * <s:form id="frm1" action="newPersonWithXMLResult" theme="ajax"  >
  *     <s:textfield label="Name" name="person.name" value="person.name" size="20" required="true" />
  *     <s:submit id="submitBtn" value="Save" theme="ajax"  cssClass="primary"  notifyTopics="personUpdated, systemWorking" />
  * </s:form >
- * 
+ *
  * <s:div href="/listPeople.action" theme="ajax" errorText="error opps"
  *         loadingText="loading..." id="cart-body" >
  *     <s:action namespace="" name="listPeople" executeResult="true" />
@@ -122,12 +125,12 @@ import com.opensymphony.xwork2.util.ValueStack;
  *
  * 
  * Massage the results with JavaScript. Say that your result returns some h
- * appy XML and you want to parse it and do lots of cool things with it. 
+ * appy XML and you want to parse it and do lots of cool things with it.
  * The way to do this is with a onLoadJS handler. Here you provide the name of
  * a JavaScript function to be called back with the result and the event type.
- * The only key is that you must use the variable names 'data' and 'type' when 
+ * The only key is that you must use the variable names 'data' and 'type' when
  * defining the callback. For example: onLoadJS="myFancyDancyFunction(data, type)".
- * While I talked about XML in this example, your not limited to XML, the data in 
+ * While I talked about XML in this example, your not limited to XML, the data in
  * the callback will be exactly whats returned as your result.
  * Here is an example of this approach:
  * 
@@ -136,7 +139,7 @@ import com.opensymphony.xwork2.util.ValueStack;
  * 
  * <script language="JavaScript" type="text/javascript">
  *     function doGreatThings(data, type) {
- *         //Do whatever with your returned fragment... 
+ *         //Do whatever with your returned fragment...
  *         //Perhapps.... if xml...
  *               var xml = dojo.xml.domUtil.createDocumentFromText(data);
  *               var people = xml.getElementsByTagName("person");
@@ -179,14 +182,14 @@ public class Submit extends FormButton {
     }
 
     public void evaluateParams() {
-    	if (value == null) {
+        if (value == null) {
             value = "Submit";
         }
-    	super.evaluateParams();
+        super.evaluateParams();
     }
-    
+
     public void evaluateExtraParams() {
-    	super.evaluateExtraParams();
+        super.evaluateExtraParams();
 
        /* if (value == null) {
             value = "Submit";
diff --git a/core/src/main/java/org/apache/struts2/components/TabbedPanel.java b/core/src/main/java/org/apache/struts2/components/TabbedPanel.java
index 750c3f599..e69e65feb 100644
--- a/core/src/main/java/org/apache/struts2/components/TabbedPanel.java
+++ b/core/src/main/java/org/apache/struts2/components/TabbedPanel.java
@@ -1,19 +1,22 @@
 /*
  * $Id$
  *
- * Copyright 2006 The Apache Software Foundation.
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
  *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
+ *  http://www.apache.org/licenses/LICENSE-2.0
  *
- *      http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
  */
 package org.apache.struts2.components;
 
diff --git a/core/src/main/java/org/apache/struts2/components/Text.java b/core/src/main/java/org/apache/struts2/components/Text.java
index 7485b4676..d6e204f40 100644
--- a/core/src/main/java/org/apache/struts2/components/Text.java
+++ b/core/src/main/java/org/apache/struts2/components/Text.java
@@ -1,19 +1,22 @@
 /*
  * $Id$
  *
- * Copyright 2006 The Apache Software Foundation.
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
  *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
+ *  http://www.apache.org/licenses/LICENSE-2.0
  *
- *      http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
  */
 package org.apache.struts2.components;
 
@@ -33,8 +36,8 @@ import com.opensymphony.xwork2.TextProvider;
 
 /**
  * 
- * Render a I18n text message. 
- * 
+ * Render a I18n text message.
+ *
  * 

* * The message must be in a resource bundle @@ -47,17 +50,17 @@ import com.opensymphony.xwork2.TextProvider; * * If the named message is not found, then the body of the tag will be used as default message. * If no body is used, then the name of the message will be used. - * + * * * * * * - * + * *

    *
  • name* (String) - the i18n message key
  • *
- * + * * * *

@@ -65,15 +68,15 @@ import com.opensymphony.xwork2.TextProvider; * Example: *

  * 
- * 
+ *
  * Accessing messages from a given bundle (the i18n Shop example bundle in the first example) and using bundle defined through the framework in the second example.

- * + * * *
* *
  * 
- * 
+ *
  * <!-- First Example -->
  * <s:i18n name="struts.action.test.i18n.Shop">
  *     <s:text name="main.title"/>
@@ -81,30 +84,30 @@ import com.opensymphony.xwork2.TextProvider;
  *
  * <!-- Second Example -->
  * <s:text name="main.title" />
- * 
+ *
  * <!-- Third Examlpe -->
  * <s:text name="i18n.label.greetings">
  *    <s:param >Mr Smith</s:param>
  * </s:text>
- * 
+ *
  * 
  * 
- * - * + * + * *
  * 
- * 
+ *
  * <-- Fourth Example -->
  * <s:text name="some.key" />
- * 
+ *
  * <-- Fifth Example -->
  * <s:text name="some.invalid.key" >
  *    The Default Message That Will Be Displayed
  * </s:text>
- * 
+ *
  * 
  * 
- * + * * @see Param * * @s.tag name="text" tld-body-content="JSP" tld-tag-class="org.apache.struts2.views.jsp.TextTag" @@ -128,13 +131,13 @@ public class Text extends Component implements Param.UnnamedParametric { public void setName(String name) { this.name = name; } - - + + public boolean usesBody() { - // overriding this to true such that EVAL_BODY_BUFFERED is return and - // bodyContent will be valid hence, text between start & end tag will - // be honoured as default message (WW-1268) - return true; + // overriding this to true such that EVAL_BODY_BUFFERED is return and + // bodyContent will be valid hence, text between start & end tag will + // be honoured as default message (WW-1268) + return true; } public boolean end(Writer writer, String body) { diff --git a/core/src/main/java/org/apache/struts2/components/TextArea.java b/core/src/main/java/org/apache/struts2/components/TextArea.java index 6d8e49446..17fd9090e 100644 --- a/core/src/main/java/org/apache/struts2/components/TextArea.java +++ b/core/src/main/java/org/apache/struts2/components/TextArea.java @@ -1,19 +1,22 @@ /* * $Id$ * - * Copyright 2006 The Apache Software Foundation. + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at + * http://www.apache.org/licenses/LICENSE-2.0 * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. */ package org.apache.struts2.components; diff --git a/core/src/main/java/org/apache/struts2/components/TextField.java b/core/src/main/java/org/apache/struts2/components/TextField.java index d724983b0..83433e599 100644 --- a/core/src/main/java/org/apache/struts2/components/TextField.java +++ b/core/src/main/java/org/apache/struts2/components/TextField.java @@ -1,19 +1,22 @@ /* * $Id$ * - * Copyright 2006 The Apache Software Foundation. + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at + * http://www.apache.org/licenses/LICENSE-2.0 * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. */ package org.apache.struts2.components; diff --git a/core/src/main/java/org/apache/struts2/components/TimePicker.java b/core/src/main/java/org/apache/struts2/components/TimePicker.java index edc995bfb..7f5eba5a2 100644 --- a/core/src/main/java/org/apache/struts2/components/TimePicker.java +++ b/core/src/main/java/org/apache/struts2/components/TimePicker.java @@ -1,19 +1,22 @@ /* * $Id$ * - * Copyright 2006 The Apache Software Foundation. + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at + * http://www.apache.org/licenses/LICENSE-2.0 * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. */ package org.apache.struts2.components; @@ -28,23 +31,23 @@ import com.opensymphony.xwork2.util.ValueStack; * Format supported by this component are:- * * - * - * + * + * * * - * - * + * + * * * - * - * + * + * * * - * - * + * + * * * - * + * * * * @@ -52,102 +55,102 @@ import com.opensymphony.xwork2.util.ValueStack; * * * - * + * * * *
FormatDescriptionFormatDescription
#HHDisplay hour in two digit format#HHDisplay hour in two digit format
#HTry to display hour in one digit format, if cannot use 2 digits#HTry to display hour in one digit format, if cannot use 2 digits
#hhDisplay hour in two digit format#hhDisplay hour in two digit format
#h#hTry to display hour in one digit format, if cannot use 2 digits
Display minutes in 2 digits format
#m#mTry to display minutes in 2 digits fomrat, if cannot use 2 digits
- * + * * - * - * + * + * *
  * 
- * 
+ *
  * <s:timepicker label="Show Time" name="showTime" value="05:00" format="#hh:#mm" />
- * 
+ *
  * <s:timepicker label="Dinner Time" name="dinnerTime" format="#hh-#mm" />
- * 
+ *
  * 
  * 
- * + * * @version $Date$ $Id$ */ public class TimePicker extends TextField { - final public static String TEMPLATE = "timepicker"; - - protected String format; - protected String templatePath; - protected String templateCssPath; - protected String timeIconPath; - protected String size; - - public TimePicker(ValueStack stack, HttpServletRequest request, HttpServletResponse response) { - super(stack, request, response); - } + final public static String TEMPLATE = "timepicker"; - protected void evaluateExtraParams() { - super.evaluateExtraParams(); - - if (format != null) { + protected String format; + protected String templatePath; + protected String templateCssPath; + protected String timeIconPath; + protected String size; + + public TimePicker(ValueStack stack, HttpServletRequest request, HttpServletResponse response) { + super(stack, request, response); + } + + protected void evaluateExtraParams() { + super.evaluateExtraParams(); + + if (format != null) { addParameter("format", findString(format)); } if (timeIconPath != null) { - addParameter("timeIconPath", timeIconPath); + addParameter("timeIconPath", timeIconPath); } if (templatePath != null) { - addParameter("templatePath", templatePath); + addParameter("templatePath", templatePath); } if (templateCssPath != null) { - addParameter("templateCssPath", templateCssPath); + addParameter("templateCssPath", templateCssPath); } if (size != null) { - addParameter("size", findValue(size, Integer.class)); + addParameter("size", findValue(size, Integer.class)); } - } - - protected String getDefaultTemplate() { + } + + protected String getDefaultTemplate() { return TEMPLATE; } - - /** + + /** * The format to use for time field. * @s.tagattribute required="false" type="String" default="Dateformat specified by language preset (%Y/%m/%d for en)" */ public void setFormat(String format) { this.format = format; } - + /** * The time picker icon path * @s.tagattribute required="false" type="String" default="/struts/dojo/struts/widgets/dateIcon.gif" */ public void setTimeIconPath(String timeIconPath) { - this.timeIconPath = timeIconPath; + this.timeIconPath = timeIconPath; } - + /** * The time picker template path. * @s.tagattribute required="false" type="String" */ public void setTemplatePath(String templatePath) { - this.templatePath = templatePath; + this.templatePath = templatePath; } - + /** * The time picker template css path. * @s.tagattribute required="false" type="String" */ public void setTemplateCssPath(String templateCssPath) { - this.templateCssPath = templateCssPath; + this.templateCssPath = templateCssPath; } - + /** * The time picker text field size. * @s.tagattribute required="false" type="String" */ public void setSize(String size) { - this.size = size; + this.size = size; } - + } diff --git a/core/src/main/java/org/apache/struts2/components/Token.java b/core/src/main/java/org/apache/struts2/components/Token.java index 1b33f6ed9..bc4249ce1 100644 --- a/core/src/main/java/org/apache/struts2/components/Token.java +++ b/core/src/main/java/org/apache/struts2/components/Token.java @@ -1,19 +1,22 @@ /* * $Id$ * - * Copyright 2006 The Apache Software Foundation. + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at + * http://www.apache.org/licenses/LICENSE-2.0 * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. */ package org.apache.struts2.components; @@ -50,7 +53,7 @@ import com.opensymphony.xwork2.util.ValueStack; * description="Stop double-submission of forms" */ public class Token extends UIBean { - + public static final String TEMPLATE = "token"; public Token(ValueStack stack, HttpServletRequest request, HttpServletResponse response) { diff --git a/core/src/main/java/org/apache/struts2/components/Tree.java b/core/src/main/java/org/apache/struts2/components/Tree.java index e76f16253..615dd6ff5 100644 --- a/core/src/main/java/org/apache/struts2/components/Tree.java +++ b/core/src/main/java/org/apache/struts2/components/Tree.java @@ -1,19 +1,22 @@ /* * $Id$ * - * Copyright 2006 The Apache Software Foundation. + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at + * http://www.apache.org/licenses/LICENSE-2.0 * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. */ package org.apache.struts2.components; @@ -28,7 +31,7 @@ import com.opensymphony.xwork2.util.ValueStack; * * * Renders a tree widget with AJAX support.

- * + * * The id attribute is normally specified, such that it could be looked up using * javascript if necessary.

* @@ -38,7 +41,7 @@ import com.opensymphony.xwork2.util.ValueStack; * *

  * 
- * 
+ *
  * <-- statically -->
  * <s:tree id="..." label="...">
  *    <s:treenode id="..." label="..." />
@@ -48,27 +51,27 @@ import com.opensymphony.xwork2.util.ValueStack;
  *    &;lt;/s:treenode>
  *    <s:treenode id="..." label="..." />
  * </s:tree>
- * 
+ *
  * <-- dynamically -->
  * <s:tree
- * 			id="..."
+ *          id="..."
  *          rootNode="..."
  *          nodeIdProperty="..."
  *          nodeTitleProperty="..."
  *          childCollectionProperty="..." />
- * 
+ *
  * 
  * 
- * + * * * @s.tag name="tree" tld-body-content="JSP" tld-tag-class="org.apache.struts2.views.jsp.ui.TreeTag" * description="Render a tree widget." */ public class Tree extends ClosingUIBean { - - private static final String TEMPLATE = "tree-close"; + + private static final String TEMPLATE = "tree-close"; private static final String OPEN_TEMPLATE = "tree"; - + private String toggle = "fade"; private String treeSelectedTopic; private String treeExpandedTopic; @@ -78,20 +81,20 @@ public class Tree extends ClosingUIBean { protected String nodeTitleProperty; protected String nodeIdProperty; private String showRootGrid; - + private String showGrid; private String blankIconSrc; - private String gridIconSrcL; - private String gridIconSrcV; - private String gridIconSrcP; - private String gridIconSrcC; - private String gridIconSrcX; - private String gridIconSrcY; - private String expandIconSrcPlus; - private String expandIconSrcMinus; - private String iconWidth; - private String iconHeight; - private String toggleDuration; + private String gridIconSrcL; + private String gridIconSrcV; + private String gridIconSrcP; + private String gridIconSrcC; + private String gridIconSrcX; + private String gridIconSrcY; + private String expandIconSrcPlus; + private String expandIconSrcMinus; + private String iconWidth; + private String iconHeight; + private String toggleDuration; private String templateCssPath; public Tree(ValueStack stack, HttpServletRequest request, HttpServletResponse response) { @@ -147,63 +150,63 @@ public class Tree extends ClosingUIBean { if (nodeIdProperty != null) { addParameter("nodeIdProperty", findString(nodeIdProperty)); } - + if (showRootGrid != null) { - addParameter("showRootGrid", findValue(showRootGrid, Boolean.class)); + addParameter("showRootGrid", findValue(showRootGrid, Boolean.class)); } - - + + if (showGrid != null) { - addParameter("showGrid", findValue(showGrid, Boolean.class)); + addParameter("showGrid", findValue(showGrid, Boolean.class)); } - + if (blankIconSrc != null) { - addParameter("blankIconSrc", findString(blankIconSrc)); + addParameter("blankIconSrc", findString(blankIconSrc)); + } + + if (gridIconSrcL != null) { + addParameter("gridIconSrcL", findString(gridIconSrcL)); + } + + if (gridIconSrcV != null) { + addParameter("gridIconSrcV", findString(gridIconSrcV)); + } + + if (gridIconSrcP != null) { + addParameter("gridIconSrcP", findString(gridIconSrcP)); + } + + if (gridIconSrcC != null) { + addParameter("gridIconSrcC", findString(gridIconSrcC)); + } + + if (gridIconSrcX != null) { + addParameter("gridIconSrcX", findString(gridIconSrcX)); + } + + if (gridIconSrcY != null) { + addParameter("gridIconSrcY", findString(gridIconSrcY)); + } + + if (expandIconSrcPlus != null) { + addParameter("expandIconSrcPlus", findString(expandIconSrcPlus)); + } + + if (expandIconSrcMinus != null) { + addParameter("expandIconSrcMinus", findString(expandIconSrcMinus)); + } + + if (iconWidth != null) { + addParameter("iconWidth", findValue(iconWidth, Integer.class)); + } + if (iconHeight != null) { + addParameter("iconHeight", findValue(iconHeight, Integer.class)); + } + if (toggleDuration != null) { + addParameter("toggleDuration", findValue(toggleDuration, Integer.class)); } - - if (gridIconSrcL != null) { - addParameter("gridIconSrcL", findString(gridIconSrcL)); - } - - if (gridIconSrcV != null) { - addParameter("gridIconSrcV", findString(gridIconSrcV)); - } - - if (gridIconSrcP != null) { - addParameter("gridIconSrcP", findString(gridIconSrcP)); - } - - if (gridIconSrcC != null) { - addParameter("gridIconSrcC", findString(gridIconSrcC)); - } - - if (gridIconSrcX != null) { - addParameter("gridIconSrcX", findString(gridIconSrcX)); - } - - if (gridIconSrcY != null) { - addParameter("gridIconSrcY", findString(gridIconSrcY)); - } - - if (expandIconSrcPlus != null) { - addParameter("expandIconSrcPlus", findString(expandIconSrcPlus)); - } - - if (expandIconSrcMinus != null) { - addParameter("expandIconSrcMinus", findString(expandIconSrcMinus)); - } - - if (iconWidth != null) { - addParameter("iconWidth", findValue(iconWidth, Integer.class)); - } - if (iconHeight != null) { - addParameter("iconHeight", findValue(iconHeight, Integer.class)); - } - if (toggleDuration != null) { - addParameter("toggleDuration", findValue(toggleDuration, Integer.class)); - } if (templateCssPath != null) { - addParameter("templateCssPath", findString(templateCssPath)); + addParameter("templateCssPath", findString(templateCssPath)); } } @@ -310,189 +313,189 @@ public class Tree extends ClosingUIBean { public void setNodeIdProperty(String nodeIdProperty) { this.nodeIdProperty = nodeIdProperty; } - + /** * The showRootGrid property (default true). * @s.tagattribute required="false" */ public void setShowRootGrid(String showRootGrid) { - this.showRootGrid = showRootGrid; + this.showRootGrid = showRootGrid; } - + public String getShowRootGrid() { - return showRootGrid; + return showRootGrid; } - public String getBlankIconSrc() { - return blankIconSrc; - } + public String getBlankIconSrc() { + return blankIconSrc; + } - /** - * Blank icon image source. - * @s.tagattribute required="false" - */ - public void setBlankIconSrc(String blankIconSrc) { - this.blankIconSrc = blankIconSrc; - } + /** + * Blank icon image source. + * @s.tagattribute required="false" + */ + public void setBlankIconSrc(String blankIconSrc) { + this.blankIconSrc = blankIconSrc; + } - public String getExpandIconSrcMinus() { - return expandIconSrcMinus; - } + public String getExpandIconSrcMinus() { + return expandIconSrcMinus; + } - /** - * Expand icon (-) image source. - * @s.tagattribute required="false" - */ - public void setExpandIconSrcMinus(String expandIconSrcMinus) { - this.expandIconSrcMinus = expandIconSrcMinus; - } + /** + * Expand icon (-) image source. + * @s.tagattribute required="false" + */ + public void setExpandIconSrcMinus(String expandIconSrcMinus) { + this.expandIconSrcMinus = expandIconSrcMinus; + } - public String getExpandIconSrcPlus() { - return expandIconSrcPlus; - } + public String getExpandIconSrcPlus() { + return expandIconSrcPlus; + } - /** - * Expand Icon (+) image source. - * @s.tagattribute required="false" - */ - public void setExpandIconSrcPlus(String expandIconSrcPlus) { - this.expandIconSrcPlus = expandIconSrcPlus; - } + /** + * Expand Icon (+) image source. + * @s.tagattribute required="false" + */ + public void setExpandIconSrcPlus(String expandIconSrcPlus) { + this.expandIconSrcPlus = expandIconSrcPlus; + } - public String getGridIconSrcC() { - return gridIconSrcC; - } + public String getGridIconSrcC() { + return gridIconSrcC; + } - /** - * Image source for under child item child icons. - * @s.tagattribute required="false" - */ - public void setGridIconSrcC(String gridIconSrcC) { - this.gridIconSrcC = gridIconSrcC; - } + /** + * Image source for under child item child icons. + * @s.tagattribute required="false" + */ + public void setGridIconSrcC(String gridIconSrcC) { + this.gridIconSrcC = gridIconSrcC; + } - public String getGridIconSrcL() { - return gridIconSrcL; - } + public String getGridIconSrcL() { + return gridIconSrcL; + } - - /** - * Image source for last child grid. - * @s.tagattribute required="false" - */ - public void setGridIconSrcL(String gridIconSrcL) { - this.gridIconSrcL = gridIconSrcL; - } - public String getGridIconSrcP() { - return gridIconSrcP; - } + /** + * Image source for last child grid. + * @s.tagattribute required="false" + */ + public void setGridIconSrcL(String gridIconSrcL) { + this.gridIconSrcL = gridIconSrcL; + } - /** - * Image source for under parent item child icons. - * @s.tagattribute required="false" - */ - public void setGridIconSrcP(String gridIconSrcP) { - this.gridIconSrcP = gridIconSrcP; - } + public String getGridIconSrcP() { + return gridIconSrcP; + } - public String getGridIconSrcV() { - return gridIconSrcV; - } + /** + * Image source for under parent item child icons. + * @s.tagattribute required="false" + */ + public void setGridIconSrcP(String gridIconSrcP) { + this.gridIconSrcP = gridIconSrcP; + } - /** - * Image source for vertical line. - * @s.tagattribute required="false" - */ - public void setGridIconSrcV(String gridIconSrcV) { - this.gridIconSrcV = gridIconSrcV; - } + public String getGridIconSrcV() { + return gridIconSrcV; + } - public String getGridIconSrcX() { - return gridIconSrcX; - } + /** + * Image source for vertical line. + * @s.tagattribute required="false" + */ + public void setGridIconSrcV(String gridIconSrcV) { + this.gridIconSrcV = gridIconSrcV; + } - /** - * Image source for grid for sole root item. - * @s.tagattribute required="false" - */ - public void setGridIconSrcX(String gridIconSrcX) { - this.gridIconSrcX = gridIconSrcX; - } + public String getGridIconSrcX() { + return gridIconSrcX; + } - public String getGridIconSrcY() { - return gridIconSrcY; - } + /** + * Image source for grid for sole root item. + * @s.tagattribute required="false" + */ + public void setGridIconSrcX(String gridIconSrcX) { + this.gridIconSrcX = gridIconSrcX; + } - /** - * Image source for grid for last root item. - * @s.tagattribute required="false" - */ - public void setGridIconSrcY(String gridIconSrcY) { - this.gridIconSrcY = gridIconSrcY; - } + public String getGridIconSrcY() { + return gridIconSrcY; + } - public String getIconHeight() { - return iconHeight; - } + /** + * Image source for grid for last root item. + * @s.tagattribute required="false" + */ + public void setGridIconSrcY(String gridIconSrcY) { + this.gridIconSrcY = gridIconSrcY; + } - - /** - * Icon height (default 18 pixels). - * @s.tagattribute required="false" - */ - public void setIconHeight(String iconHeight) { - this.iconHeight = iconHeight; - } + public String getIconHeight() { + return iconHeight; + } - public String getIconWidth() { - return iconWidth; - } - /** - * Icon width (default 19 pixels). - * @s.tagattribute required="false" - */ - public void setIconWidth(String iconWidth) { - this.iconWidth = iconWidth; - } + /** + * Icon height (default 18 pixels). + * @s.tagattribute required="false" + */ + public void setIconHeight(String iconHeight) { + this.iconHeight = iconHeight; + } - + public String getIconWidth() { + return iconWidth; + } - public String getTemplateCssPath() { - return templateCssPath; - } + /** + * Icon width (default 19 pixels). + * @s.tagattribute required="false" + */ + public void setIconWidth(String iconWidth) { + this.iconWidth = iconWidth; + } - /** - * Template css path (default {contextPath}/struts/tree.css. - * @s.tagattribute required="false" - */ - public void setTemplateCssPath(String templateCssPath) { - this.templateCssPath = templateCssPath; - } - public String getToggleDuration() { - return toggleDuration; - } - /** - * Toggle duration (default 150 ms) - * @s.tagattribute required="false" - */ - public void setToggleDuration(String toggleDuration) { - this.toggleDuration = toggleDuration; - } + public String getTemplateCssPath() { + return templateCssPath; + } - public String getShowGrid() { - return showGrid; - } + /** + * Template css path (default {contextPath}/struts/tree.css. + * @s.tagattribute required="false" + */ + public void setTemplateCssPath(String templateCssPath) { + this.templateCssPath = templateCssPath; + } - /** - * Show grid (default true). - * @s.tagattribute required="false" - */ - public void setShowGrid(String showGrid) { - this.showGrid = showGrid; - } + public String getToggleDuration() { + return toggleDuration; + } + + /** + * Toggle duration (default 150 ms) + * @s.tagattribute required="false" + */ + public void setToggleDuration(String toggleDuration) { + this.toggleDuration = toggleDuration; + } + + public String getShowGrid() { + return showGrid; + } + + /** + * Show grid (default true). + * @s.tagattribute required="false" + */ + public void setShowGrid(String showGrid) { + this.showGrid = showGrid; + } } diff --git a/core/src/main/java/org/apache/struts2/components/TreeNode.java b/core/src/main/java/org/apache/struts2/components/TreeNode.java index a4ad9bca7..98359ff68 100644 --- a/core/src/main/java/org/apache/struts2/components/TreeNode.java +++ b/core/src/main/java/org/apache/struts2/components/TreeNode.java @@ -1,19 +1,22 @@ /* * $Id$ * - * Copyright 2006 The Apache Software Foundation. + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at + * http://www.apache.org/licenses/LICENSE-2.0 * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. */ package org.apache.struts2.components; @@ -27,21 +30,21 @@ import com.opensymphony.xwork2.util.ValueStack; * * Renders a tree node within a tree widget with AJAX support.

* - * Either of the following combinations should be used depending on if the tree + * Either of the following combinations should be used depending on if the tree * is to be constrcted dynamically or statically.

- * + * * Dynamically *

    - *
  • id - id of this tree node
  • - *
  • title - label to be displayed for this tree node
  • + *
  • id - id of this tree node
  • + *
  • title - label to be displayed for this tree node
  • *
- * + * * Statically *
    - *
  • rootNode - the parent node of which this tree is derived from
  • - *
  • nodeIdProperty - property to obtained this current tree node's id
  • - *
  • nodeTitleProperty - property to obtained this current tree node's title
  • - *
  • childCollectionProperty - property that returnds this current tree node's children
  • + *
  • rootNode - the parent node of which this tree is derived from
  • + *
  • nodeIdProperty - property to obtained this current tree node's id
  • + *
  • nodeTitleProperty - property to obtained this current tree node's title
  • + *
  • childCollectionProperty - property that returnds this current tree node's children
  • *
* * @@ -50,7 +53,7 @@ import com.opensymphony.xwork2.util.ValueStack; * *
  * 
- * 
+ *
  * <-- statically -->
  * <s:tree id="..." label="...">
  *    <s:treenode id="..." label="..." />
@@ -60,7 +63,7 @@ import com.opensymphony.xwork2.util.ValueStack;
  *    &;lt;/s:treenode>
  *    <s:treenode id="..." label="..." />
  * </s:tree>
- * 
+ *
  * <-- dynamically -->
  * <s:tree
  *          id="..."
@@ -68,7 +71,7 @@ import com.opensymphony.xwork2.util.ValueStack;
  *          nodeIdProperty="..."
  *          nodeTitleProperty="..."
  *          childCollectionProperty="..." />
- * 
+ *
  * 
  * 
* diff --git a/core/src/main/java/org/apache/struts2/components/UIBean.java b/core/src/main/java/org/apache/struts2/components/UIBean.java index 1e34ed3e7..91b425f47 100644 --- a/core/src/main/java/org/apache/struts2/components/UIBean.java +++ b/core/src/main/java/org/apache/struts2/components/UIBean.java @@ -1,19 +1,22 @@ /* * $Id$ * - * Copyright 2006 The Apache Software Foundation. + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at + * http://www.apache.org/licenses/LICENSE-2.0 * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. */ package org.apache.struts2.components; @@ -272,10 +275,10 @@ import com.opensymphony.xwork2.util.ValueStack; * Description * * - * tooltip - * String - * none - * Set the tooltip of this particular component + * tooltip + * String + * none + * Set the tooltip of this particular component * * * jsTooltipEnabled @@ -284,15 +287,15 @@ import com.opensymphony.xwork2.util.ValueStack; * Enable js tooltip rendering * * - * tooltipIcon - * String - * /struts/static/tooltip/tooltip.gif - * The url to the tooltip icon + * tooltipIcon + * String + * /struts/static/tooltip/tooltip.gif + * The url to the tooltip icon * - * tooltipDelay - * String - * 500 - * Tooltip shows up after the specified timeout (miliseconds). A behavior similar to that of OS based tooltips. + * tooltipDelay + * String + * 500 + * Tooltip shows up after the specified timeout (miliseconds). A behavior similar to that of OS based tooltips. * * * @@ -335,7 +338,7 @@ import com.opensymphony.xwork2.util.ValueStack; * * <!-- Example 1: --> * <s:form - * tooltipConfig="#{'tooltipDelay':'500', + * tooltipConfig="#{'tooltipDelay':'500', * 'tooltipIcon='/myImages/myIcon.gif'}" .... > * .... * <s:textfield label="Customer Name" tooltip="Enter the customer name" .... /> @@ -345,7 +348,7 @@ import com.opensymphony.xwork2.util.ValueStack; * <!-- Example 2: --> * <s:form * tooltipConfig="#{'tooltipDelay':'500', - * 'tooltipIcon':'/myImages/myIcon.gif'}" ... > + * 'tooltipIcon':'/myImages/myIcon.gif'}" ... > * .... * <s:textfield label="Address" * tooltip="Enter your address" @@ -357,19 +360,19 @@ import com.opensymphony.xwork2.util.ValueStack; * <-- Example 3: --> * <s:textfield * label="Customer Name" - * tooltip="One of our customer Details'"> + * tooltip="One of our customer Details'"> * <s:param name="tooltipConfig"> * tooltipDelay = 500 | - * tooltipIcon = /myImages/myIcon.gif + * tooltipIcon = /myImages/myIcon.gif * </s:param> * </s:textfield> * * * <-- Example 4: --> * <s:textfield - * label="Customer Address" - * tooltip="Enter The Customer Address" > - * <s:param + * label="Customer Address" + * tooltip="Enter The Customer Address" > + * <s:param * name="tooltipConfig" * value="#{'tooltipDelay':'500', * 'tooltipIcon':'/myImages/myIcon.gif'}" /> @@ -437,7 +440,7 @@ public abstract class UIBean extends Component { protected String onkeyup; protected String onselect; protected String onchange; - + // common html attributes protected String accesskey; @@ -455,7 +458,7 @@ public abstract class UIBean extends Component { LOG.error("error when rendering", e); } finally { - popComponentStack(); + popComponentStack(); } return false; @@ -645,9 +648,9 @@ public abstract class UIBean extends Component { } if (accesskey != null) { - addParameter("accesskey", findString(accesskey)); + addParameter("accesskey", findString(accesskey)); } - + if (cssClass != null) { addParameter("cssClass", findString(cssClass)); } @@ -698,7 +701,7 @@ public abstract class UIBean extends Component { addParameter("form", form.getParameters()); if ( name != null ) { - // list should have been created by the form component + // list should have been created by the form component List tags = (List) form.getParameters().get("tagNames"); tags.add(name); } @@ -710,29 +713,29 @@ public abstract class UIBean extends Component { // tooltip & tooltipConfig if (tooltipConfig != null) { - addParameter("tooltipConfig", findValue(tooltipConfig)); - } + addParameter("tooltipConfig", findValue(tooltipConfig)); + } if (tooltip != null) { - addParameter("tooltip", findString(tooltip)); + addParameter("tooltip", findString(tooltip)); - Map tooltipConfigMap = getTooltipConfig(this); + Map tooltipConfigMap = getTooltipConfig(this); - if (form != null) { // inform the containing form that we need tooltip javascript included - form.addParameter("hasTooltip", Boolean.TRUE); + if (form != null) { // inform the containing form that we need tooltip javascript included + form.addParameter("hasTooltip", Boolean.TRUE); - // tooltipConfig defined in component itseilf will take precedence - // over those defined in the containing form - Map overallTooltipConfigMap = getTooltipConfig(form); - overallTooltipConfigMap.putAll(tooltipConfigMap); // override parent form's tooltip config + // tooltipConfig defined in component itseilf will take precedence + // over those defined in the containing form + Map overallTooltipConfigMap = getTooltipConfig(form); + overallTooltipConfigMap.putAll(tooltipConfigMap); // override parent form's tooltip config - for (Iterator i = overallTooltipConfigMap.entrySet().iterator(); i.hasNext(); ) { - Map.Entry entry = (Map.Entry) i.next(); - addParameter((String) entry.getKey(), entry.getValue()); - } - } - else { - LOG.warn("No ancestor Form found, javascript based tooltip will not work, however standard HTML tooltip using alt and title attribute will still work "); - } + for (Iterator i = overallTooltipConfigMap.entrySet().iterator(); i.hasNext(); ) { + Map.Entry entry = (Map.Entry) i.next(); + addParameter((String) entry.getKey(), entry.getValue()); + } + } + else { + LOG.warn("No ancestor Form found, javascript based tooltip will not work, however standard HTML tooltip using alt and title attribute will still work "); + } } evaluateExtraParams(); @@ -766,62 +769,62 @@ public abstract class UIBean extends Component { } protected void enableAncestorFormCustomOnsubmit() { - Form form = (Form) findAncestor(Form.class); - if (form != null) { - form.addParameter("customOnsubmitEnabled", Boolean.TRUE); - } else { - LOG.warn("Cannot find an Ancestor form, custom onsubmit is NOT enabled"); - } + Form form = (Form) findAncestor(Form.class); + if (form != null) { + form.addParameter("customOnsubmitEnabled", Boolean.TRUE); + } else { + LOG.warn("Cannot find an Ancestor form, custom onsubmit is NOT enabled"); + } } protected Map getTooltipConfig(UIBean component) { - Object tooltipConfigObj = component.getParameters().get("tooltipConfig"); - Map tooltipConfig = new LinkedHashMap(); + Object tooltipConfigObj = component.getParameters().get("tooltipConfig"); + Map tooltipConfig = new LinkedHashMap(); - if (tooltipConfigObj instanceof Map) { - // we get this if its configured using - // 1] UI component's tooltipConfig attribute OR - // 2] param tag value attribute + if (tooltipConfigObj instanceof Map) { + // we get this if its configured using + // 1] UI component's tooltipConfig attribute OR + // 2] param tag value attribute - tooltipConfig = new LinkedHashMap((Map)tooltipConfigObj); - } else if (tooltipConfigObj instanceof String) { + tooltipConfig = new LinkedHashMap((Map)tooltipConfigObj); + } else if (tooltipConfigObj instanceof String) { - // we get this if its configured using - // ... tag's body - String tooltipConfigStr = (String) tooltipConfigObj; - String[] tooltipConfigArray = tooltipConfigStr.split("\\|"); + // we get this if its configured using + // ... tag's body + String tooltipConfigStr = (String) tooltipConfigObj; + String[] tooltipConfigArray = tooltipConfigStr.split("\\|"); - for (int a=0; a 1) { - value = configEntry[1].trim(); - tooltipConfig.put(key, value.toString()); - } - else { - LOG.warn("component "+component+" tooltip config param "+key+" has no value defined, skipped"); - } - } - } - return tooltipConfig; + for (int a=0; a 1) { + value = configEntry[1].trim(); + tooltipConfig.put(key, value.toString()); + } + else { + LOG.warn("component "+component+" tooltip config param "+key+" has no value defined, skipped"); + } + } + } + return tooltipConfig; } /** * Create HTML id element for the component and populate this component parmaeter * map. - * + * * The order is as follows :- *
    *
  1. This component id attribute
  2. *
  3. [containing_form_id]_[this_component_name]
  4. *
  5. [this_component_name]
  6. *
- * + * * @param form */ protected void populateComponentHtmlId(Form form) { - if (id != null) { + if (id != null) { // this check is needed for backwards compatibility with 2.1.x if (altSyntax()) { addParameter("id", findString(id)); @@ -834,14 +837,14 @@ public abstract class UIBean extends Component { addParameter("id", escape(name)); } } - + /** * The template directory. * @s.tagattribute required="false" */ public void setTemplateDir(String templateDir) { - this.templateDir = templateDir; + this.templateDir = templateDir; } /** @@ -1063,13 +1066,13 @@ public abstract class UIBean extends Component { public void setOnchange(String onchange) { this.onchange = onchange; } - + /** * Set the html accesskey attribute on rendered html element * @s.tagattribute required="false" */ public void setAccesskey(String accesskey) { - this.accesskey = accesskey; + this.accesskey = accesskey; } /** @@ -1077,7 +1080,7 @@ public abstract class UIBean extends Component { * @s.tagattribute required="false" type="String" default="" */ public void setTooltip(String tooltip) { - this.tooltip = tooltip; + this.tooltip = tooltip; } /** @@ -1085,6 +1088,6 @@ public abstract class UIBean extends Component { * @s.tagattribute required="false" type="String" default="" */ public void setTooltipConfig(String tooltipConfig) { - this.tooltipConfig = tooltipConfig; + this.tooltipConfig = tooltipConfig; } } diff --git a/core/src/main/java/org/apache/struts2/components/URL.java b/core/src/main/java/org/apache/struts2/components/URL.java index 7a2e67b47..fc78f81ad 100644 --- a/core/src/main/java/org/apache/struts2/components/URL.java +++ b/core/src/main/java/org/apache/struts2/components/URL.java @@ -1,19 +1,22 @@ /* * $Id$ * - * Copyright 2006 The Apache Software Foundation. + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at + * http://www.apache.org/licenses/LICENSE-2.0 * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. */ package org.apache.struts2.components; @@ -43,25 +46,25 @@ import com.opensymphony.xwork2.util.XWorkContinuationConfig; /** * - * + * *

This tag is used to create a URL.

* *

You can use the "param" tag inside the body to provide * additional request parameters.

- * + * * NOTE: *

When includeParams is 'all' or 'get', the parameter defined in param tag will take - * precedence and will not be overriden if they exists in the parameter submitted. For + * precedence and will not be overriden if they exists in the parameter submitted. For * example, in Example 3 below, if there is a id parameter in the url where the page this * tag is included like http://://editUser.action?id=3333&name=John * the generated url will be http://:/context>/editUser.action?id=22&name=John * cause the parameter defined in the param tag will take precedence.

- * + * * * * * - * + * *
    *
  • action (String) - (value or action choose either one, if both exist value takes precedence) action's name (alias)
  • *
  • value (String) - (value or action choose either one, if both exist value takes precedence) the url itself
  • @@ -76,13 +79,13 @@ import com.opensymphony.xwork2.util.XWorkContinuationConfig; * *
  • includeContext (Boolean) - determine wheather to include the web app context path. Default is true.
  • *
- * + * * * *

Examples *

  * 
- * 
+ *
  * <-- Example 1 -->
  * <s:url value="editGadget.action">
  *     <s:param name="id" value="%{selected}" />
@@ -92,12 +95,12 @@ import com.opensymphony.xwork2.util.XWorkContinuationConfig;
  * <s:url action="editGadget">
  *     <s:param name="id" value="%{selected}" />
  * </s:url>
- * 
+ *
  * <-- Example 3-->
  * <s:url includeParams="get"  >
  *     <:param name="id" value="%{'22'}" />
  * </s:url>
- * 
+ *
  * 
  * 
* @@ -154,7 +157,7 @@ public class URL extends Component { // no explicit url set so attach params from current url, do // this at start so body params can override any of these they wish. try { - // ww-1266 + // ww-1266 String includeParams = Settings.isSet(StrutsConstants.STRUTS_URL_INCLUDEPARAMS) ? Settings.get(StrutsConstants.STRUTS_URL_INCLUDEPARAMS).toLowerCase() : GET; @@ -165,7 +168,7 @@ public class URL extends Component { } if (NONE.equalsIgnoreCase(includeParams)) { - mergeRequestParameters(value, parameters, Collections.EMPTY_MAP); + mergeRequestParameters(value, parameters, Collections.EMPTY_MAP); ActionContext.getContext().put(XWorkContinuationConfig.CONTINUE_KEY, null); } else if (ALL.equalsIgnoreCase(includeParams)) { mergeRequestParameters(value, parameters, req.getParameterMap()); @@ -227,13 +230,13 @@ public class URL extends Component { result = PortletUrlHelper.buildResourceUrl(value, parameters); } else { - String _value = value; - - // We don't include the request parameters cause they would have been - // prioritised before this [in start(Writer) method] - if (_value != null && _value.indexOf("?") > 0) { - _value = _value.substring(0, _value.indexOf("?")); - } + String _value = value; + + // We don't include the request parameters cause they would have been + // prioritised before this [in start(Writer) method] + if (_value != null && _value.indexOf("?") > 0) { + _value = _value.substring(0, _value.indexOf("?")); + } result = UrlHelper.buildUrl(_value, req, res, parameters, scheme, includeContext, encode); } } @@ -321,7 +324,7 @@ public class URL extends Component { public void setIncludeContext(boolean includeContext) { this.includeContext = includeContext; } - + /** * The resulting portlet mode * @s.tagattribute required="false" @@ -357,55 +360,55 @@ public class URL extends Component { /** * Merge request parameters into current parameters. If a parameter is - * already present, than the request parameter in the current request and value atrribute + * already present, than the request parameter in the current request and value atrribute * will not override its value. - * + * * The priority is as follows:- *
    - *
  • parameter from the current request (least priority)
  • + *
  • parameter from the current request (least priority)
  • *
  • parameter form the value attribute (more priority)
  • *
  • parameter from the param tag (most priority)
  • *
- * + * * @param value the value attribute (url to be generated by this component) * @param parameters component parameters * @param contextParameters request parameters */ protected void mergeRequestParameters(String value, Map parameters, Map contextParameters){ - - Map mergedParams = new LinkedHashMap(contextParameters); - - // Merge contextParameters (from current request) with parameters specified in value attribute - // eg. value="someAction.action?id=someId&venue=someVenue" - // where the parameters specified in value attribute takes priority. - - if (value != null && value.trim().length() > 0 && value.indexOf("?") > 0) { - mergedParams = new LinkedHashMap(); - - String queryString = value.substring(value.indexOf("?")+1); - - mergedParams = UrlHelper.parseQueryString(queryString); - for (Iterator iterator = contextParameters.entrySet().iterator(); iterator.hasNext();) { - Map.Entry entry = (Map.Entry) iterator.next(); - Object key = entry.getKey(); - - if (!mergedParams.containsKey(key)) { - mergedParams.put(key, entry.getValue()); - } - } - } - - - // Merge parameters specified in value attribute - // eg. value="someAction.action?id=someId&venue=someVenue" - // with parameters specified though param tag - // eg. - // where parameters specified through param tag takes priority. - + + Map mergedParams = new LinkedHashMap(contextParameters); + + // Merge contextParameters (from current request) with parameters specified in value attribute + // eg. value="someAction.action?id=someId&venue=someVenue" + // where the parameters specified in value attribute takes priority. + + if (value != null && value.trim().length() > 0 && value.indexOf("?") > 0) { + mergedParams = new LinkedHashMap(); + + String queryString = value.substring(value.indexOf("?")+1); + + mergedParams = UrlHelper.parseQueryString(queryString); + for (Iterator iterator = contextParameters.entrySet().iterator(); iterator.hasNext();) { + Map.Entry entry = (Map.Entry) iterator.next(); + Object key = entry.getKey(); + + if (!mergedParams.containsKey(key)) { + mergedParams.put(key, entry.getValue()); + } + } + } + + + // Merge parameters specified in value attribute + // eg. value="someAction.action?id=someId&venue=someVenue" + // with parameters specified though param tag + // eg. + // where parameters specified through param tag takes priority. + for (Iterator iterator = mergedParams.entrySet().iterator(); iterator.hasNext();) { Map.Entry entry = (Map.Entry) iterator.next(); Object key = entry.getKey(); - + if (!parameters.containsKey(key)) { parameters.put(key, entry.getValue()); } diff --git a/core/src/main/java/org/apache/struts2/components/UpDownSelect.java b/core/src/main/java/org/apache/struts2/components/UpDownSelect.java index 8ece3cda9..abc943a85 100644 --- a/core/src/main/java/org/apache/struts2/components/UpDownSelect.java +++ b/core/src/main/java/org/apache/struts2/components/UpDownSelect.java @@ -1,19 +1,22 @@ /* * $Id$ * - * Copyright 2006 The Apache Software Foundation. + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at + * http://www.apache.org/licenses/LICENSE-2.0 * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. */ package org.apache.struts2.components; @@ -30,201 +33,201 @@ import com.opensymphony.xwork2.util.ValueStack; /** * - * + * * Create a Select component with buttons to move the elements in the select component - * up and down. When the containing form is submited, its elements will be submitted in + * up and down. When the containing form is submited, its elements will be submitted in * the order they are arranged (top to bottom). - * + * * - * + * *

- * + * *

  * 
- * 
+ *
  * <!-- Example 1: simple example -->
  * <s:updownselect
- * list="#{'england':'England', 'america':'America', 'germany':'Germany'}" 
- * name="prioritisedFavouriteCountries" 
- * headerKey="-1" 
- * headerValue="--- Please Order Them Accordingly ---" 
+ * list="#{'england':'England', 'america':'America', 'germany':'Germany'}"
+ * name="prioritisedFavouriteCountries"
+ * headerKey="-1"
+ * headerValue="--- Please Order Them Accordingly ---"
  * emptyOption="true" />
  *
  * <!-- Example 2: more complex example -->
  * <s:updownselect
- * list="defaultFavouriteCartoonCharacters" 
- * name="prioritisedFavouriteCartoonCharacters" 
- * headerKey="-1" 
- * headerValue="--- Please Order ---" 
- * emptyOption="true" 
- * allowMoveUp="true" 
- * allowMoveDown="true" 
- * allowSelectAll="true" 
+ * list="defaultFavouriteCartoonCharacters"
+ * name="prioritisedFavouriteCartoonCharacters"
+ * headerKey="-1"
+ * headerValue="--- Please Order ---"
+ * emptyOption="true"
+ * allowMoveUp="true"
+ * allowMoveDown="true"
+ * allowSelectAll="true"
  * moveUpLabel="Move Up"
- * moveDownLabel="Move Down" 
+ * moveDownLabel="Move Down"
  * selectAllLabel="Select All" />
- * 
+ *
  * 
  * 
- * + * * @version $Date$ $Id$ - * + * * @s.tag name="updownselect" tld-body-content="JSP" tld-tag-class="org.apache.struts2.views.jsp.ui.UpDownSelectTag" * description="Render a up down select element" */ public class UpDownSelect extends Select { - - private static final Log _log = LogFactory.getLog(UpDownSelect.class); - - final public static String TEMPLATE = "updownselect"; - - protected String allowMoveUp; - protected String allowMoveDown; - protected String allowSelectAll; - - protected String moveUpLabel; - protected String moveDownLabel; - protected String selectAllLabel; - - - public String getDefaultTemplate() { - return TEMPLATE; - } - - public UpDownSelect(ValueStack stack, HttpServletRequest request, HttpServletResponse response) { - super(stack, request, response); - } - - public void evaluateParams() { - super.evaluateParams(); - - - // override Select's default - if (size == null || size.trim().length() <= 0) { - addParameter("size", "5"); - } - if (multiple == null || multiple.trim().length() <= 0) { - addParameter("multiple", Boolean.TRUE); - } - - - - if (allowMoveUp != null) { - addParameter("allowMoveUp", findValue(allowMoveUp, Boolean.class)); - } - if (allowMoveDown != null) { - addParameter("allowMoveDown", findValue(allowMoveDown, Boolean.class)); - } - if (allowSelectAll != null) { - addParameter("allowSelectAll", findValue(allowSelectAll, Boolean.class)); - } - - if (moveUpLabel != null) { - addParameter("moveUpLabel", findString(moveUpLabel)); - } - if (moveDownLabel != null) { - addParameter("moveDownLabel", findString(moveDownLabel)); - } - if (selectAllLabel != null) { - addParameter("selectAllLabel", findString(selectAllLabel)); - } - - - // inform our form ancestor about this UpDownSelect so the form knows how to - // auto select all options upon it submission - Form ancestorForm = (Form) findAncestor(Form.class); - if (ancestorForm != null) { - - // inform form ancestor that we are using a custom onsubmit - enableAncestorFormCustomOnsubmit(); - - Map m = (Map) ancestorForm.getParameters().get("updownselectIds"); - if (m == null) { - // map with key -> id , value -> headerKey - m = new LinkedHashMap(); - } - m.put(getParameters().get("id"), getParameters().get("headerKey")); - ancestorForm.getParameters().put("updownselectIds", m); - } - else { - _log.warn("no ancestor form found for updownselect "+this+", therefore autoselect of all elements upon form submission will not work "); - } - } + private static final Log _log = LogFactory.getLog(UpDownSelect.class); - - public String getAllowMoveUp() { - return allowMoveUp; - } - /** + + final public static String TEMPLATE = "updownselect"; + + protected String allowMoveUp; + protected String allowMoveDown; + protected String allowSelectAll; + + protected String moveUpLabel; + protected String moveDownLabel; + protected String selectAllLabel; + + + public String getDefaultTemplate() { + return TEMPLATE; + } + + public UpDownSelect(ValueStack stack, HttpServletRequest request, HttpServletResponse response) { + super(stack, request, response); + } + + public void evaluateParams() { + super.evaluateParams(); + + + // override Select's default + if (size == null || size.trim().length() <= 0) { + addParameter("size", "5"); + } + if (multiple == null || multiple.trim().length() <= 0) { + addParameter("multiple", Boolean.TRUE); + } + + + + if (allowMoveUp != null) { + addParameter("allowMoveUp", findValue(allowMoveUp, Boolean.class)); + } + if (allowMoveDown != null) { + addParameter("allowMoveDown", findValue(allowMoveDown, Boolean.class)); + } + if (allowSelectAll != null) { + addParameter("allowSelectAll", findValue(allowSelectAll, Boolean.class)); + } + + if (moveUpLabel != null) { + addParameter("moveUpLabel", findString(moveUpLabel)); + } + if (moveDownLabel != null) { + addParameter("moveDownLabel", findString(moveDownLabel)); + } + if (selectAllLabel != null) { + addParameter("selectAllLabel", findString(selectAllLabel)); + } + + + // inform our form ancestor about this UpDownSelect so the form knows how to + // auto select all options upon it submission + Form ancestorForm = (Form) findAncestor(Form.class); + if (ancestorForm != null) { + + // inform form ancestor that we are using a custom onsubmit + enableAncestorFormCustomOnsubmit(); + + Map m = (Map) ancestorForm.getParameters().get("updownselectIds"); + if (m == null) { + // map with key -> id , value -> headerKey + m = new LinkedHashMap(); + } + m.put(getParameters().get("id"), getParameters().get("headerKey")); + ancestorForm.getParameters().put("updownselectIds", m); + } + else { + _log.warn("no ancestor form found for updownselect "+this+", therefore autoselect of all elements upon form submission will not work "); + } + } + + + public String getAllowMoveUp() { + return allowMoveUp; + } + /** * Whether move up button should be displayed - * @s.tagattribute required="false" type="Boolean" default="true" - */ - public void setAllowMoveUp(String allowMoveUp) { - this.allowMoveUp = allowMoveUp; - } - - - - public String getAllowMoveDown() { - return allowMoveDown; - } - /** - * Whether move down button should be displayed - * @s.tagattribute required="false" type="Boolean" default="true" - */ - public void setAllowMoveDown(String allowMoveDown) { - this.allowMoveDown = allowMoveDown; - } - - - - public String getAllowSelectAll() { - return allowSelectAll; - } - /** - * Whether or not select all button should be displayed - * @s.tagattribute required="false" type="Boolean" default="true" - */ - public void setAllowSelectAll(String allowSelectAll) { - this.allowSelectAll = allowSelectAll; - } - - - public String getMoveUpLabel() { - return moveUpLabel; - } - /** - * Text to display on the move up button - * @s.tagattribute required="false" type="String" default="^" - */ - public void setMoveUpLabel(String moveUpLabel) { - this.moveUpLabel = moveUpLabel; - } - - - - public String getMoveDownLabel() { - return moveDownLabel; - } - /** - * Text to display on the move down button - * @s.tagattribute required="false" type="String" default="v" - */ - public void setMoveDownLabel(String moveDownLabel) { - this.moveDownLabel = moveDownLabel; - } - + * @s.tagattribute required="false" type="Boolean" default="true" + */ + public void setAllowMoveUp(String allowMoveUp) { + this.allowMoveUp = allowMoveUp; + } - - public String getSelectAllLabel() { - return selectAllLabel; - } - /** + + + public String getAllowMoveDown() { + return allowMoveDown; + } + /** + * Whether move down button should be displayed + * @s.tagattribute required="false" type="Boolean" default="true" + */ + public void setAllowMoveDown(String allowMoveDown) { + this.allowMoveDown = allowMoveDown; + } + + + + public String getAllowSelectAll() { + return allowSelectAll; + } + /** + * Whether or not select all button should be displayed + * @s.tagattribute required="false" type="Boolean" default="true" + */ + public void setAllowSelectAll(String allowSelectAll) { + this.allowSelectAll = allowSelectAll; + } + + + public String getMoveUpLabel() { + return moveUpLabel; + } + /** + * Text to display on the move up button + * @s.tagattribute required="false" type="String" default="^" + */ + public void setMoveUpLabel(String moveUpLabel) { + this.moveUpLabel = moveUpLabel; + } + + + + public String getMoveDownLabel() { + return moveDownLabel; + } + /** + * Text to display on the move down button + * @s.tagattribute required="false" type="String" default="v" + */ + public void setMoveDownLabel(String moveDownLabel) { + this.moveDownLabel = moveDownLabel; + } + + + + public String getSelectAllLabel() { + return selectAllLabel; + } + /** * Text to display on the select all button - * @s.tagattribute required="false" type="String" default="*" - */ - public void setSelectAllLabel(String selectAllLabel) { - this.selectAllLabel = selectAllLabel; - } + * @s.tagattribute required="false" type="String" default="*" + */ + public void setSelectAllLabel(String selectAllLabel) { + this.selectAllLabel = selectAllLabel; + } } diff --git a/core/src/main/java/org/apache/struts2/components/table/AbstractFilterModel.java b/core/src/main/java/org/apache/struts2/components/table/AbstractFilterModel.java index e0fc5cbc9..f3a39bd81 100644 --- a/core/src/main/java/org/apache/struts2/components/table/AbstractFilterModel.java +++ b/core/src/main/java/org/apache/struts2/components/table/AbstractFilterModel.java @@ -1,19 +1,22 @@ /* * $Id$ * - * Copyright 2006 The Apache Software Foundation. + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at + * http://www.apache.org/licenses/LICENSE-2.0 * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. */ package org.apache.struts2.components.table; diff --git a/core/src/main/java/org/apache/struts2/components/table/RenderFilterModel.java b/core/src/main/java/org/apache/struts2/components/table/RenderFilterModel.java index c9b5469b6..9ab1d5e14 100644 --- a/core/src/main/java/org/apache/struts2/components/table/RenderFilterModel.java +++ b/core/src/main/java/org/apache/struts2/components/table/RenderFilterModel.java @@ -1,19 +1,22 @@ /* * $Id$ * - * Copyright 2006 The Apache Software Foundation. + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at + * http://www.apache.org/licenses/LICENSE-2.0 * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. */ package org.apache.struts2.components.table; @@ -24,9 +27,9 @@ import javax.swing.table.TableModel; */ public class RenderFilterModel extends AbstractFilterModel { - private static final long serialVersionUID = -2501708467650344057L; - - private boolean rendered; + private static final long serialVersionUID = -2501708467650344057L; + + private boolean rendered; public RenderFilterModel(TableModel tm) { diff --git a/core/src/main/java/org/apache/struts2/components/table/SortFilterModel.java b/core/src/main/java/org/apache/struts2/components/table/SortFilterModel.java index 235d43cb7..402343e81 100644 --- a/core/src/main/java/org/apache/struts2/components/table/SortFilterModel.java +++ b/core/src/main/java/org/apache/struts2/components/table/SortFilterModel.java @@ -1,19 +1,22 @@ /* * $Id$ * - * Copyright 2006 The Apache Software Foundation. + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at + * http://www.apache.org/licenses/LICENSE-2.0 * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. */ package org.apache.struts2.components.table; @@ -32,9 +35,9 @@ import javax.swing.table.TableModel; */ public class SortFilterModel extends AbstractFilterModel implements TableModelListener, SortableTableModel { - private static final long serialVersionUID = 2214225803442793597L; + private static final long serialVersionUID = 2214225803442793597L; - private ArrayList rows = new ArrayList(); + private ArrayList rows = new ArrayList(); /** * These are just here to implement the interface diff --git a/core/src/main/java/org/apache/struts2/components/table/SortableTableModel.java b/core/src/main/java/org/apache/struts2/components/table/SortableTableModel.java index fbbdf7d6d..e060980db 100644 --- a/core/src/main/java/org/apache/struts2/components/table/SortableTableModel.java +++ b/core/src/main/java/org/apache/struts2/components/table/SortableTableModel.java @@ -1,19 +1,22 @@ /* * $Id$ * - * Copyright 2006 The Apache Software Foundation. + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at + * http://www.apache.org/licenses/LICENSE-2.0 * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. */ package org.apache.struts2.components.table; diff --git a/core/src/main/java/org/apache/struts2/components/table/WebTable.java b/core/src/main/java/org/apache/struts2/components/table/WebTable.java index ea13cc01d..08d7f5b2c 100644 --- a/core/src/main/java/org/apache/struts2/components/table/WebTable.java +++ b/core/src/main/java/org/apache/struts2/components/table/WebTable.java @@ -1,19 +1,22 @@ /* * $Id$ * - * Copyright 2006 The Apache Software Foundation. + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at + * http://www.apache.org/licenses/LICENSE-2.0 * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. */ package org.apache.struts2.components.table; diff --git a/core/src/main/java/org/apache/struts2/components/table/WebTableColumn.java b/core/src/main/java/org/apache/struts2/components/table/WebTableColumn.java index 04069599c..8b46195e5 100644 --- a/core/src/main/java/org/apache/struts2/components/table/WebTableColumn.java +++ b/core/src/main/java/org/apache/struts2/components/table/WebTableColumn.java @@ -1,19 +1,22 @@ /* * $Id$ * - * Copyright 2006 The Apache Software Foundation. + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at + * http://www.apache.org/licenses/LICENSE-2.0 * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. */ package org.apache.struts2.components.table; diff --git a/core/src/main/java/org/apache/struts2/components/table/renderer/AbstractCellRenderer.java b/core/src/main/java/org/apache/struts2/components/table/renderer/AbstractCellRenderer.java index 4e901e695..a9009f2e9 100644 --- a/core/src/main/java/org/apache/struts2/components/table/renderer/AbstractCellRenderer.java +++ b/core/src/main/java/org/apache/struts2/components/table/renderer/AbstractCellRenderer.java @@ -1,19 +1,22 @@ /* * $Id$ * - * Copyright 2006 The Apache Software Foundation. + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at + * http://www.apache.org/licenses/LICENSE-2.0 * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. */ package org.apache.struts2.components.table.renderer; diff --git a/core/src/main/java/org/apache/struts2/components/table/renderer/BooleanCellRenderer.java b/core/src/main/java/org/apache/struts2/components/table/renderer/BooleanCellRenderer.java index 44e228fb3..b9a8cadae 100644 --- a/core/src/main/java/org/apache/struts2/components/table/renderer/BooleanCellRenderer.java +++ b/core/src/main/java/org/apache/struts2/components/table/renderer/BooleanCellRenderer.java @@ -1,19 +1,22 @@ /* * $Id$ * - * Copyright 2006 The Apache Software Foundation. + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at + * http://www.apache.org/licenses/LICENSE-2.0 * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. */ package org.apache.struts2.components.table.renderer; diff --git a/core/src/main/java/org/apache/struts2/components/table/renderer/CellRenderer.java b/core/src/main/java/org/apache/struts2/components/table/renderer/CellRenderer.java index 40ccd103a..0364fadbf 100644 --- a/core/src/main/java/org/apache/struts2/components/table/renderer/CellRenderer.java +++ b/core/src/main/java/org/apache/struts2/components/table/renderer/CellRenderer.java @@ -1,19 +1,22 @@ /* * $Id$ * - * Copyright 2006 The Apache Software Foundation. + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at + * http://www.apache.org/licenses/LICENSE-2.0 * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. */ package org.apache.struts2.components.table.renderer; diff --git a/core/src/main/java/org/apache/struts2/components/table/renderer/DateCellRenderer.java b/core/src/main/java/org/apache/struts2/components/table/renderer/DateCellRenderer.java index ee7d3ca0e..e0cca59b0 100644 --- a/core/src/main/java/org/apache/struts2/components/table/renderer/DateCellRenderer.java +++ b/core/src/main/java/org/apache/struts2/components/table/renderer/DateCellRenderer.java @@ -1,19 +1,22 @@ /* * $Id$ * - * Copyright 2006 The Apache Software Foundation. + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at + * http://www.apache.org/licenses/LICENSE-2.0 * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. */ package org.apache.struts2.components.table.renderer; diff --git a/core/src/main/java/org/apache/struts2/components/table/renderer/DefaultCellRenderer.java b/core/src/main/java/org/apache/struts2/components/table/renderer/DefaultCellRenderer.java index 032a5082f..5b7b5ace6 100644 --- a/core/src/main/java/org/apache/struts2/components/table/renderer/DefaultCellRenderer.java +++ b/core/src/main/java/org/apache/struts2/components/table/renderer/DefaultCellRenderer.java @@ -1,19 +1,22 @@ /* * $Id$ * - * Copyright 2006 The Apache Software Foundation. + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at + * http://www.apache.org/licenses/LICENSE-2.0 * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. */ package org.apache.struts2.components.table.renderer; diff --git a/core/src/main/java/org/apache/struts2/components/table/renderer/FixedTextCellRenderer.java b/core/src/main/java/org/apache/struts2/components/table/renderer/FixedTextCellRenderer.java index 71e2a0870..aa877c2f7 100644 --- a/core/src/main/java/org/apache/struts2/components/table/renderer/FixedTextCellRenderer.java +++ b/core/src/main/java/org/apache/struts2/components/table/renderer/FixedTextCellRenderer.java @@ -1,19 +1,22 @@ /* * $Id$ * - * Copyright 2006 The Apache Software Foundation. + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at + * http://www.apache.org/licenses/LICENSE-2.0 * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. */ package org.apache.struts2.components.table.renderer; diff --git a/core/src/main/java/org/apache/struts2/components/table/renderer/LinkCellRenderer.java b/core/src/main/java/org/apache/struts2/components/table/renderer/LinkCellRenderer.java index 67e97be13..ec98a35a5 100644 --- a/core/src/main/java/org/apache/struts2/components/table/renderer/LinkCellRenderer.java +++ b/core/src/main/java/org/apache/struts2/components/table/renderer/LinkCellRenderer.java @@ -1,19 +1,22 @@ /* * $Id$ * - * Copyright 2006 The Apache Software Foundation. + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at + * http://www.apache.org/licenses/LICENSE-2.0 * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. */ package org.apache.struts2.components.table.renderer; diff --git a/core/src/main/java/org/apache/struts2/components/table/renderer/NumericCellRenderer.java b/core/src/main/java/org/apache/struts2/components/table/renderer/NumericCellRenderer.java index 420004b35..f249b6195 100644 --- a/core/src/main/java/org/apache/struts2/components/table/renderer/NumericCellRenderer.java +++ b/core/src/main/java/org/apache/struts2/components/table/renderer/NumericCellRenderer.java @@ -1,19 +1,22 @@ /* * $Id$ * - * Copyright 2006 The Apache Software Foundation. + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at + * http://www.apache.org/licenses/LICENSE-2.0 * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. */ package org.apache.struts2.components.table.renderer; diff --git a/core/src/main/java/org/apache/struts2/components/template/BaseTemplateEngine.java b/core/src/main/java/org/apache/struts2/components/template/BaseTemplateEngine.java index a5cf580ee..073cfd7db 100644 --- a/core/src/main/java/org/apache/struts2/components/template/BaseTemplateEngine.java +++ b/core/src/main/java/org/apache/struts2/components/template/BaseTemplateEngine.java @@ -1,19 +1,22 @@ /* * $Id$ * - * Copyright 2006 The Apache Software Foundation. + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at + * http://www.apache.org/licenses/LICENSE-2.0 * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. */ package org.apache.struts2.components.template; @@ -35,9 +38,9 @@ import com.opensymphony.xwork2.util.ClassLoaderUtil; * Base class for template engines. */ public abstract class BaseTemplateEngine implements TemplateEngine { - + private static final Log LOG = LogFactory.getLog(BaseTemplateEngine.class); - + /** The default theme properties file name. Default is 'theme.properties' */ public static final String DEFAULT_THEME_PROPERTIES_FILE_NAME = "theme.properties"; @@ -48,25 +51,25 @@ public abstract class BaseTemplateEngine implements TemplateEngine { Properties props = (Properties) themeProps.get(template.getTheme()); if (props == null) { String propName = template.getDir() + "/" + template.getTheme() + "/"+getThemePropertiesFileName(); - + // WW-1292 // let's try getting it from the filesystem File propFile = new File(propName); InputStream is = null; try { - if (propFile.exists()) { - is = new FileInputStream(propFile); - } + if (propFile.exists()) { + is = new FileInputStream(propFile); + } } catch(FileNotFoundException e) { - LOG.warn("Unable to find file in filesystem ["+propFile.getAbsolutePath()+"]"); + LOG.warn("Unable to find file in filesystem ["+propFile.getAbsolutePath()+"]"); } - + if (is == null) { - // if its not in filesystem. let's try the classpath - is = ClassLoaderUtil.getResourceAsStream(propName, getClass()); + // if its not in filesystem. let's try the classpath + is = ClassLoaderUtil.getResourceAsStream(propName, getClass()); } - + props = new Properties(); if (is != null) { @@ -92,9 +95,9 @@ public abstract class BaseTemplateEngine implements TemplateEngine { return t; } - + protected String getThemePropertiesFileName() { - return DEFAULT_THEME_PROPERTIES_FILE_NAME; + return DEFAULT_THEME_PROPERTIES_FILE_NAME; } protected abstract String getSuffix(); diff --git a/core/src/main/java/org/apache/struts2/components/template/FreemarkerTemplateEngine.java b/core/src/main/java/org/apache/struts2/components/template/FreemarkerTemplateEngine.java index 8e09ca6ab..fa4c73924 100644 --- a/core/src/main/java/org/apache/struts2/components/template/FreemarkerTemplateEngine.java +++ b/core/src/main/java/org/apache/struts2/components/template/FreemarkerTemplateEngine.java @@ -1,19 +1,22 @@ /* * $Id$ * - * Copyright 2006 The Apache Software Foundation. + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at + * http://www.apache.org/licenses/LICENSE-2.0 * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. */ package org.apache.struts2.components.template; diff --git a/core/src/main/java/org/apache/struts2/components/template/JspTemplateEngine.java b/core/src/main/java/org/apache/struts2/components/template/JspTemplateEngine.java index a0b21d039..7dd7cbe80 100644 --- a/core/src/main/java/org/apache/struts2/components/template/JspTemplateEngine.java +++ b/core/src/main/java/org/apache/struts2/components/template/JspTemplateEngine.java @@ -1,19 +1,22 @@ /* * $Id$ * - * Copyright 2006 The Apache Software Foundation. + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at + * http://www.apache.org/licenses/LICENSE-2.0 * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. */ package org.apache.struts2.components.template; diff --git a/core/src/main/java/org/apache/struts2/components/template/Template.java b/core/src/main/java/org/apache/struts2/components/template/Template.java index f0bf1c4b7..8294af729 100644 --- a/core/src/main/java/org/apache/struts2/components/template/Template.java +++ b/core/src/main/java/org/apache/struts2/components/template/Template.java @@ -1,19 +1,22 @@ /* * $Id$ * - * Copyright 2006 The Apache Software Foundation. + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at + * http://www.apache.org/licenses/LICENSE-2.0 * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. */ package org.apache.struts2.components.template; diff --git a/core/src/main/java/org/apache/struts2/components/template/TemplateEngine.java b/core/src/main/java/org/apache/struts2/components/template/TemplateEngine.java index 83f66e1f0..5f0401fd0 100644 --- a/core/src/main/java/org/apache/struts2/components/template/TemplateEngine.java +++ b/core/src/main/java/org/apache/struts2/components/template/TemplateEngine.java @@ -1,19 +1,22 @@ /* * $Id$ * - * Copyright 2006 The Apache Software Foundation. + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at + * http://www.apache.org/licenses/LICENSE-2.0 * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. */ package org.apache.struts2.components.template; @@ -39,5 +42,5 @@ public interface TemplateEngine { * @return the properties as key value pairs. */ Map getThemeProps(Template template); - + } diff --git a/core/src/main/java/org/apache/struts2/components/template/TemplateEngineManager.java b/core/src/main/java/org/apache/struts2/components/template/TemplateEngineManager.java index e4cf9e0d6..9268ac06a 100644 --- a/core/src/main/java/org/apache/struts2/components/template/TemplateEngineManager.java +++ b/core/src/main/java/org/apache/struts2/components/template/TemplateEngineManager.java @@ -1,19 +1,22 @@ /* * $Id$ * - * Copyright 2006 The Apache Software Foundation. + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at + * http://www.apache.org/licenses/LICENSE-2.0 * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. */ package org.apache.struts2.components.template; diff --git a/core/src/main/java/org/apache/struts2/components/template/TemplateRenderingContext.java b/core/src/main/java/org/apache/struts2/components/template/TemplateRenderingContext.java index df0809e73..a3ae7f1c5 100644 --- a/core/src/main/java/org/apache/struts2/components/template/TemplateRenderingContext.java +++ b/core/src/main/java/org/apache/struts2/components/template/TemplateRenderingContext.java @@ -1,19 +1,22 @@ /* * $Id$ * - * Copyright 2006 The Apache Software Foundation. + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at + * http://www.apache.org/licenses/LICENSE-2.0 * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. */ package org.apache.struts2.components.template; diff --git a/core/src/main/java/org/apache/struts2/components/template/VelocityTemplateEngine.java b/core/src/main/java/org/apache/struts2/components/template/VelocityTemplateEngine.java index c9d0ae531..26f4a9cd3 100644 --- a/core/src/main/java/org/apache/struts2/components/template/VelocityTemplateEngine.java +++ b/core/src/main/java/org/apache/struts2/components/template/VelocityTemplateEngine.java @@ -1,19 +1,22 @@ /* * $Id$ * - * Copyright 2006 The Apache Software Foundation. + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at + * http://www.apache.org/licenses/LICENSE-2.0 * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. */ package org.apache.struts2.components.template; diff --git a/core/src/main/java/org/apache/struts2/config/ClasspathConfigurationProvider.java b/core/src/main/java/org/apache/struts2/config/ClasspathConfigurationProvider.java index 226c96076..3f19614b2 100644 --- a/core/src/main/java/org/apache/struts2/config/ClasspathConfigurationProvider.java +++ b/core/src/main/java/org/apache/struts2/config/ClasspathConfigurationProvider.java @@ -1,19 +1,22 @@ /* - * $Id: DefaultSettings.java 439747 2006-09-03 09:22:46Z mrdon $ + * $Id: $ * - * Copyright 2006 The Apache Software Foundation. + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at + * http://www.apache.org/licenses/LICENSE-2.0 * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. */ package org.apache.struts2.config; @@ -44,7 +47,7 @@ import com.opensymphony.xwork2.util.TextUtils; /** * Loads the configuration by scanning the classpath looking for classes that end in - * 'Action'. + * 'Action'. */ public class ClasspathConfigurationProvider implements ConfigurationProvider { @@ -58,34 +61,34 @@ public class ClasspathConfigurationProvider implements ConfigurationProvider { private String defaultPagePrefix = ""; private PageLocator pageLocator = new ClasspathPageLocator(); private boolean initialized = false; - - private Map loadedPackageConfigs = new HashMap(); - + + private Map loadedPackageConfigs = new HashMap(); + private static final Log LOG = LogFactory.getLog(ClasspathConfigurationProvider.class); - + private Configuration configuration; - + public ClasspathConfigurationProvider(String[] pkgs) { this.packages = pkgs; - + if (Settings.isSet(DEFAULT_PARENT_PACKAGE)) { defaultParentPackage = Settings.get(DEFAULT_PARENT_PACKAGE); } - + if (Settings.isSet(DEFAULT_PAGE_EXTENSION)) { defaultPageExtension = Settings.get(DEFAULT_PAGE_EXTENSION); } - + if (Settings.isSet(DEFAULT_PAGE_PREFIX)) { defaultPagePrefix = Settings.get(DEFAULT_PAGE_PREFIX); } - + } - + public static interface PageLocator { public URL locate(String path); } - + public static class ClasspathPageLocator implements PageLocator { public URL locate(String path) { return ClassLoaderUtil.getResource(path, getClass()); @@ -98,7 +101,7 @@ public class ClasspathConfigurationProvider implements ConfigurationProvider { public void setDefaultParentPackage(String defaultParentPackage) { this.defaultParentPackage = defaultParentPackage; } - + /** * @param defaultPageExtension the defaultPageExtension to set */ @@ -112,7 +115,7 @@ public class ClasspathConfigurationProvider implements ConfigurationProvider { public void setDefaultPagePrefix(String defaultPagePrefix) { this.defaultPagePrefix = defaultPagePrefix; } - + public void setPageLocator(PageLocator locator) { this.pageLocator = locator; } @@ -130,12 +133,12 @@ public class ClasspathConfigurationProvider implements ConfigurationProvider { processActionClass(cls, pkgs); } } - + for (String key : loadedPackageConfigs.keySet()) { configuration.addPackageConfig(key, loadedPackageConfigs.get(key)); } } - + protected void processActionClass(Class cls, String[] pkgs) { String name = cls.getName(); String actionPackage = cls.getPackage().getName(); @@ -147,7 +150,7 @@ public class ClasspathConfigurationProvider implements ConfigurationProvider { LOG.debug("Processing class "+name); } name = name.substring(pkg.length() + 1); - + actionNamespace = ""; actionName = name; int pos = name.lastIndexOf('.'); @@ -158,9 +161,9 @@ public class ClasspathConfigurationProvider implements ConfigurationProvider { break; } } - + PackageConfig pkgConfig = loadPackageConfig(actionNamespace, actionPackage, cls); - + Annotation annotation = cls.getAnnotation(ParentPackage.class); if (annotation != null) { String parent = ((ParentPackage)annotation).value(); @@ -169,14 +172,14 @@ public class ClasspathConfigurationProvider implements ConfigurationProvider { throw new ConfigurationException("Unable to locate parent package "+parent, annotation); } pkgConfig.addParent(parentPkg); - + if (!TextUtils.stringSet(pkgConfig.getNamespace()) && TextUtils.stringSet(parentPkg.getNamespace())) { pkgConfig.setNamespace(parentPkg.getNamespace()); } } - + actionName = actionName.substring(0, actionName.length() - ACTION.length()); - + if (actionName.length() > 1) { int lowerPos = actionName.lastIndexOf('/') + 1; StringBuilder sb = new StringBuilder(); @@ -185,13 +188,13 @@ public class ClasspathConfigurationProvider implements ConfigurationProvider { sb.append(actionName.substring(lowerPos + 1)); actionName = sb.toString(); } - + ActionConfig actionConfig = new ActionConfig(); actionConfig.setClassName(cls.getName()); actionConfig.setPackageName(actionPackage); - + actionConfig.setResults(new ResultMap(cls, actionName, pkgConfig)); - + pkgConfig.addActionConfig(actionName, actionConfig); } @@ -200,7 +203,7 @@ public class ClasspathConfigurationProvider implements ConfigurationProvider { */ protected PackageConfig loadPackageConfig(String actionNamespace, String actionPackage, Class actionClass) { PackageConfig parent = null; - + if (actionClass != null) { Namespace ns = (Namespace) actionClass.getAnnotation(Namespace.class); if (ns != null) { @@ -209,7 +212,7 @@ public class ClasspathConfigurationProvider implements ConfigurationProvider { actionPackage = actionClass.getName(); } } - + PackageConfig pkgConfig = loadedPackageConfigs.get(actionPackage); if (pkgConfig == null) { pkgConfig = new PackageConfig(); @@ -218,22 +221,22 @@ public class ClasspathConfigurationProvider implements ConfigurationProvider { if (parent == null) { parent = configuration.getPackageConfig(defaultParentPackage); } - + if (parent == null) { throw new ConfigurationException("Unable to locate default parent package: " + defaultParentPackage); } pkgConfig.addParent(parent); - + pkgConfig.setNamespace(actionNamespace); - + loadedPackageConfigs.put(actionPackage, pkgConfig); } return pkgConfig; } public void destroy() { - + } public void init(Configuration configuration) throws ConfigurationException { @@ -246,7 +249,7 @@ public class ClasspathConfigurationProvider implements ConfigurationProvider { public boolean needsReload() { return !initialized; } - + /** * Creates result configs from result annotations, and if a result isn't found, * creates them on the fly. @@ -260,7 +263,7 @@ public class ClasspathConfigurationProvider implements ConfigurationProvider { this.actionClass = actionClass; this.actionName = actionName; this.pkgConfig = pkgConfig; - + // check if any annotations are around while (!actionClass.getName().equals(Object.class.getName())) { //noinspection unchecked @@ -283,9 +286,9 @@ public class ClasspathConfigurationProvider implements ConfigurationProvider { actionClass = actionClass.getSuperclass(); } - + } - + protected ResultConfig createResultConfig(Result result) { Class cls = result.type(); if (cls == NullResult.class) { @@ -295,16 +298,16 @@ public class ClasspathConfigurationProvider implements ConfigurationProvider { } public V get(Object key) { - + Object result = super.get(key); if (result != null) { return (V) result; } else { - + // TODO: This code never is actually used, do to how the runtime configuration // is created. String actionPath = pkgConfig.getNamespace() + "/" + actionName; - + String fileName = actionPath + "-" + key + defaultPageExtension; if (pageLocator.locate(defaultPagePrefix + fileName) == null) { fileName = actionPath + defaultPageExtension; @@ -334,7 +337,7 @@ public class ClasspathConfigurationProvider implements ConfigurationProvider { throw new ConfigurationException("Unable to locate result class "+className, actionClass); } } - + String defaultParam; try { defaultParam = (String) resultClass.getField("DEFAULT_PARAM").get(null); @@ -342,7 +345,7 @@ public class ClasspathConfigurationProvider implements ConfigurationProvider { // not sure why this happened, but let's just use a sensible choice defaultParam = "location"; } - + HashMap params = new HashMap(); if (configParams != null) { params.putAll(configParams); diff --git a/core/src/main/java/org/apache/struts2/config/DefaultSettings.java b/core/src/main/java/org/apache/struts2/config/DefaultSettings.java index dacb970be..68399b1da 100644 --- a/core/src/main/java/org/apache/struts2/config/DefaultSettings.java +++ b/core/src/main/java/org/apache/struts2/config/DefaultSettings.java @@ -1,19 +1,22 @@ /* * $Id$ * - * Copyright 2006 The Apache Software Foundation. + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at + * http://www.apache.org/licenses/LICENSE-2.0 * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. */ package org.apache.struts2.config; @@ -44,7 +47,7 @@ public class DefaultSettings extends Settings { * in this class will call that settings object. */ public DefaultSettings() { - // Create default implementations + // Create default implementations // Use default properties and struts.properties ArrayList list = new ArrayList(); diff --git a/core/src/main/java/org/apache/struts2/config/DelegatingSettings.java b/core/src/main/java/org/apache/struts2/config/DelegatingSettings.java index 6580686dd..4ad086a71 100644 --- a/core/src/main/java/org/apache/struts2/config/DelegatingSettings.java +++ b/core/src/main/java/org/apache/struts2/config/DelegatingSettings.java @@ -1,19 +1,22 @@ /* * $Id$ * - * Copyright 2006 The Apache Software Foundation. + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at + * http://www.apache.org/licenses/LICENSE-2.0 * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. */ package org.apache.struts2.config; diff --git a/core/src/main/java/org/apache/struts2/config/Namespace.java b/core/src/main/java/org/apache/struts2/config/Namespace.java index b23a44b5d..08b485dc7 100644 --- a/core/src/main/java/org/apache/struts2/config/Namespace.java +++ b/core/src/main/java/org/apache/struts2/config/Namespace.java @@ -1,19 +1,22 @@ /* - * $Id: DefaultSettings.java 439747 2006-09-03 09:22:46Z mrdon $ + * $Id: $ * - * Copyright 2006 The Apache Software Foundation. + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at + * http://www.apache.org/licenses/LICENSE-2.0 * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. */ package org.apache.struts2.config; diff --git a/core/src/main/java/org/apache/struts2/config/NullResult.java b/core/src/main/java/org/apache/struts2/config/NullResult.java index f7365e990..c5c80ae7d 100644 --- a/core/src/main/java/org/apache/struts2/config/NullResult.java +++ b/core/src/main/java/org/apache/struts2/config/NullResult.java @@ -1,19 +1,22 @@ /* - * $Id: DefaultSettings.java 439747 2006-09-03 09:22:46Z mrdon $ + * $Id: $ * - * Copyright 2006 The Apache Software Foundation. + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at + * http://www.apache.org/licenses/LICENSE-2.0 * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. */ package org.apache.struts2.config; diff --git a/core/src/main/java/org/apache/struts2/config/ParentPackage.java b/core/src/main/java/org/apache/struts2/config/ParentPackage.java index bf097c74b..341fd3095 100644 --- a/core/src/main/java/org/apache/struts2/config/ParentPackage.java +++ b/core/src/main/java/org/apache/struts2/config/ParentPackage.java @@ -1,19 +1,22 @@ /* - * $Id: DefaultSettings.java 439747 2006-09-03 09:22:46Z mrdon $ + * $Id: $ * - * Copyright 2006 The Apache Software Foundation. + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at + * http://www.apache.org/licenses/LICENSE-2.0 * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. */ package org.apache.struts2.config; diff --git a/core/src/main/java/org/apache/struts2/config/PropertiesSettings.java b/core/src/main/java/org/apache/struts2/config/PropertiesSettings.java index dc2420810..a365de3e6 100644 --- a/core/src/main/java/org/apache/struts2/config/PropertiesSettings.java +++ b/core/src/main/java/org/apache/struts2/config/PropertiesSettings.java @@ -1,19 +1,22 @@ /* * $Id$ * - * Copyright 2006 The Apache Software Foundation. + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at + * http://www.apache.org/licenses/LICENSE-2.0 * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. */ package org.apache.struts2.config; diff --git a/core/src/main/java/org/apache/struts2/config/Result.java b/core/src/main/java/org/apache/struts2/config/Result.java index ade0aa584..9fd275c77 100644 --- a/core/src/main/java/org/apache/struts2/config/Result.java +++ b/core/src/main/java/org/apache/struts2/config/Result.java @@ -1,19 +1,22 @@ /* - * $Id: DefaultSettings.java 439747 2006-09-03 09:22:46Z mrdon $ + * $Id: $ * - * Copyright 2006 The Apache Software Foundation. + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at + * http://www.apache.org/licenses/LICENSE-2.0 * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. */ package org.apache.struts2.config; diff --git a/core/src/main/java/org/apache/struts2/config/Results.java b/core/src/main/java/org/apache/struts2/config/Results.java index b1bf55f87..9cb8663f8 100644 --- a/core/src/main/java/org/apache/struts2/config/Results.java +++ b/core/src/main/java/org/apache/struts2/config/Results.java @@ -1,19 +1,22 @@ /* - * $Id: DefaultSettings.java 439747 2006-09-03 09:22:46Z mrdon $ + * $Id: $ * - * Copyright 2006 The Apache Software Foundation. + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at + * http://www.apache.org/licenses/LICENSE-2.0 * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. */ package org.apache.struts2.config; diff --git a/core/src/main/java/org/apache/struts2/config/ServletContextSingleton.java b/core/src/main/java/org/apache/struts2/config/ServletContextSingleton.java index 42ce49a1a..ed8806794 100644 --- a/core/src/main/java/org/apache/struts2/config/ServletContextSingleton.java +++ b/core/src/main/java/org/apache/struts2/config/ServletContextSingleton.java @@ -1,19 +1,22 @@ /* * $Id$ * - * Copyright 2006 The Apache Software Foundation. + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at + * http://www.apache.org/licenses/LICENSE-2.0 * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. */ package org.apache.struts2.config; @@ -69,7 +72,7 @@ public class ServletContextSingleton { /** * Gets the servlet context - * + * * @return The web servlet context */ public ServletContext getServletContext() { @@ -78,7 +81,7 @@ public class ServletContextSingleton { /** * Sets the servlet context - * + * * @param context The web servlet context */ public void setServletContext(ServletContext context) { diff --git a/core/src/main/java/org/apache/struts2/config/Settings.java b/core/src/main/java/org/apache/struts2/config/Settings.java index b4c9d3474..70f968a86 100644 --- a/core/src/main/java/org/apache/struts2/config/Settings.java +++ b/core/src/main/java/org/apache/struts2/config/Settings.java @@ -1,19 +1,22 @@ /* * $Id$ * - * Copyright 2006 The Apache Software Foundation. + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at + * http://www.apache.org/licenses/LICENSE-2.0 * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. */ package org.apache.struts2.config; @@ -135,7 +138,7 @@ public class Settings { return val; } - + /** * Returns an Iterator of all properties names. * diff --git a/core/src/main/java/org/apache/struts2/config/StrutsXmlConfigurationProvider.java b/core/src/main/java/org/apache/struts2/config/StrutsXmlConfigurationProvider.java index 1d03fe0b7..2ea5ace64 100644 --- a/core/src/main/java/org/apache/struts2/config/StrutsXmlConfigurationProvider.java +++ b/core/src/main/java/org/apache/struts2/config/StrutsXmlConfigurationProvider.java @@ -1,5 +1,22 @@ /* - * Created on Aug 12, 2004 by mgreer + * $Id$ + * + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. */ package org.apache.struts2.config; @@ -30,18 +47,18 @@ public class StrutsXmlConfigurationProvider extends XmlConfigurationProvider { private String filename; private String reloadKey; - /** + /** * Constructs the configuration provider - * + * * @param errorIfMissing If we should throw an exception if the file can't be found */ public StrutsXmlConfigurationProvider(boolean errorIfMissing) { this("struts.xml", errorIfMissing); } - - /** + + /** * Constructs the configuration provider - * + * * @param filename The filename to look for * @param errorIfMissing If we should throw an exception if the file can't be found */ @@ -57,8 +74,8 @@ public class StrutsXmlConfigurationProvider extends XmlConfigurationProvider { this.baseDir = file.getParentFile(); } } - - + + /* (non-Javadoc) * @see com.opensymphony.xwork2.config.providers.XmlConfigurationProvider#init(com.opensymphony.xwork2.config.Configuration) @@ -84,7 +101,7 @@ public class StrutsXmlConfigurationProvider extends XmlConfigurationProvider { if (url == null) { return super.getConfigurationUrls(fileName); } - } + } if (url != null) { List list = new ArrayList(); list.add(url); @@ -93,14 +110,14 @@ public class StrutsXmlConfigurationProvider extends XmlConfigurationProvider { return super.getConfigurationUrls(fileName); } } - + protected URL findInFileSystem(String fileName) throws IOException { URL url = null; File file = new File(fileName); if (LOG.isDebugEnabled()) { LOG.debug("Trying to load file " + file); } - + // Trying relative path to original file if (!file.exists()) { file = new File(baseDir, fileName); @@ -111,7 +128,7 @@ public class StrutsXmlConfigurationProvider extends XmlConfigurationProvider { } catch (MalformedURLException e) { throw new IOException("Unable to convert "+file+" to a URL"); } - } + } return url; } @@ -125,8 +142,8 @@ public class StrutsXmlConfigurationProvider extends XmlConfigurationProvider { return super.needsReload(); } return false; - + } - - + + } diff --git a/core/src/main/java/org/apache/struts2/dispatcher/AbstractFilter.java b/core/src/main/java/org/apache/struts2/dispatcher/AbstractFilter.java index cf29ec729..39c66b85b 100644 --- a/core/src/main/java/org/apache/struts2/dispatcher/AbstractFilter.java +++ b/core/src/main/java/org/apache/struts2/dispatcher/AbstractFilter.java @@ -1,19 +1,22 @@ /* - * $Id: ActionContextCleanUp.java 454720 2006-10-10 12:31:52Z tmjee $ + * $Id: $ * - * Copyright 2006 The Apache Software Foundation. + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at + * http://www.apache.org/licenses/LICENSE-2.0 * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. */ package org.apache.struts2.dispatcher; @@ -30,61 +33,61 @@ import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; /** - * An abstract for superclass for Struts2 filter, encapsulating common logics and - * helper methods usefull to subclass, to avoid duplication. - * + * An abstract for superclass for Struts2 filter, encapsulating common logics and + * helper methods usefull to subclass, to avoid duplication. + * * Common logics encapsulated:- *
    - *
  • - * Dispatcher instance creation through createDispatcher method that acts - * as a hook subclass could override. By default it creates an instance of Dispatcher. + *
  • + * Dispatcher instance creation through createDispatcher method that acts + * as a hook subclass could override. By default it creates an instance of Dispatcher. *
  • *
  • - * postInit(FilterConfig) is a hook subclass may use to add post initialization + * postInit(FilterConfig) is a hook subclass may use to add post initialization * logics in {@link javax.servlet.Filter#init(FilterConfig)}. It is called before * {@link javax.servlet.Filter#init(FilterConfig)} method ends. *
  • *
  • - * A default {@link javax.servlet.Filter#destroy()} that clean up Dispatcher by + * A default {@link javax.servlet.Filter#destroy()} that clean up Dispatcher by * calling dispatcher.cleanup() *
  • *
  • - * prepareDispatcherAndWrapRequest(HttpServletRequest, HttpServletResponse) helper method - * that basically called dispatcher.prepare(), wrap the HttpServletRequest and return the + * prepareDispatcherAndWrapRequest(HttpServletRequest, HttpServletResponse) helper method + * that basically called dispatcher.prepare(), wrap the HttpServletRequest and return the * wrapped version. *
  • *
  • - * Various other common helper methods like + * Various other common helper methods like *
      - *
    • getFilterConfig
    • - *
    • getServletContext
    • + *
    • getFilterConfig
    • + *
    • getServletContext
    • *
    *
  • *
- * - * + * + * * @see Dispatcher * @see FilterDispatcher * @see ActionContextCleanUp - * + * * @version $Date$ $Id$ */ public abstract class AbstractFilter implements Filter { - private static final Log LOG = LogFactory.getLog(AbstractFilter.class); - - /** Internal copy of dispatcher, created when Filter instance gets initialized. */ - private Dispatcher _dispatcher; - - protected FilterConfig filterConfig; - - /** Dispatcher instance to be used by subclass. */ - protected Dispatcher dispatcher; - - - /** + private static final Log LOG = LogFactory.getLog(AbstractFilter.class); + + /** Internal copy of dispatcher, created when Filter instance gets initialized. */ + private Dispatcher _dispatcher; + + protected FilterConfig filterConfig; + + /** Dispatcher instance to be used by subclass. */ + protected Dispatcher dispatcher; + + + /** * Initializes the filter - * + * * @param filterConfig The filter configuration */ public void init(FilterConfig filterConfig) throws ServletException { @@ -92,39 +95,39 @@ public abstract class AbstractFilter implements Filter { _dispatcher = createDispatcher(); postInit(filterConfig); } - + /** * Cleans up the dispatcher - * + * * @see javax.servlet.Filter#destroy() */ public void destroy() { if (_dispatcher == null) { - LOG.warn("something is seriously wrong, Dispatcher is not initialized (null) "); + LOG.warn("something is seriously wrong, Dispatcher is not initialized (null) "); } else { - _dispatcher.cleanup(); + _dispatcher.cleanup(); } } - + /** - * Hook for subclass todo custom initialization, called after + * Hook for subclass todo custom initialization, called after * javax.servlet.Filter.init(FilterConfig). - * + * * @param filterConfig * @throws ServletException */ protected abstract void postInit(FilterConfig filterConfig) throws ServletException; - + /** * Create a {@link Dispatcher}, this serves as a hook for subclass to overried - * such that a custom {@link Dispatcher} could be created. - * + * such that a custom {@link Dispatcher} could be created. + * * @return Dispatcher */ protected Dispatcher createDispatcher() { - return new Dispatcher(filterConfig.getServletContext()); + return new Dispatcher(filterConfig.getServletContext()); } - + /** * Servlet 2.3 specifies that the servlet context can be retrieved from the session. Unfortunately, some versions of * WebLogic can only retrieve the servlet context from the filter config. Hence, this method enables subclasses to @@ -136,56 +139,56 @@ public abstract class AbstractFilter implements Filter { protected ServletContext getServletContext() { return filterConfig.getServletContext(); } - - /** + + /** * Gets this filter's configuration - * + * * @return The filter config */ protected FilterConfig getFilterConfig() { return filterConfig; } - + /** - * Helper method that prepare Dispatcher + * Helper method that prepare Dispatcher * (by calling Dispatcher.prepare(HttpServletRequest, HttpServletResponse)) - * following by wrapping and returning the wrapping HttpServletRequest [ through + * following by wrapping and returning the wrapping HttpServletRequest [ through * dispatcher.wrapRequest(HttpServletRequest, ServletContext) ] - * + * * @param request * @param response * @return HttpServletRequest * @throws ServletException */ protected HttpServletRequest prepareDispatcherAndWrapRequest(HttpServletRequest request, HttpServletResponse response) throws ServletException { - - Dispatcher du = Dispatcher.getInstance(); - - // Prepare and wrap the request if the cleanup filter hasn't already, cleanup filter should be - // configured first before struts2 dispatcher filter, hence when its cleanup filter's turn, - // static instance of Dispatcher should be null. - if (du == null) { - dispatcher = _dispatcher; - - Dispatcher.setInstance(dispatcher); - - // prepare the request no matter what - this ensures that the proper character encoding - // is used before invoking the mapper (see WW-9127) - dispatcher.prepare(request, response); - try { - // Wrap request first, just in case it is multipart/form-data - // parameters might not be accessible through before encoding (ww-1278) - request = dispatcher.wrapRequest(request, getServletContext()); - } catch (IOException e) { - String message = "Could not wrap servlet request with MultipartRequestWrapper!"; - LOG.error(message, e); - throw new ServletException(message, e); - } - } - else { - dispatcher = du; - } - return request; + Dispatcher du = Dispatcher.getInstance(); + + // Prepare and wrap the request if the cleanup filter hasn't already, cleanup filter should be + // configured first before struts2 dispatcher filter, hence when its cleanup filter's turn, + // static instance of Dispatcher should be null. + if (du == null) { + dispatcher = _dispatcher; + + Dispatcher.setInstance(dispatcher); + + // prepare the request no matter what - this ensures that the proper character encoding + // is used before invoking the mapper (see WW-9127) + dispatcher.prepare(request, response); + + try { + // Wrap request first, just in case it is multipart/form-data + // parameters might not be accessible through before encoding (ww-1278) + request = dispatcher.wrapRequest(request, getServletContext()); + } catch (IOException e) { + String message = "Could not wrap servlet request with MultipartRequestWrapper!"; + LOG.error(message, e); + throw new ServletException(message, e); + } + } + else { + dispatcher = du; + } + return request; } } diff --git a/core/src/main/java/org/apache/struts2/dispatcher/ActionContextCleanUp.java b/core/src/main/java/org/apache/struts2/dispatcher/ActionContextCleanUp.java index 567b18887..f1fd7527f 100644 --- a/core/src/main/java/org/apache/struts2/dispatcher/ActionContextCleanUp.java +++ b/core/src/main/java/org/apache/struts2/dispatcher/ActionContextCleanUp.java @@ -1,19 +1,22 @@ /* * $Id$ * - * Copyright 2006 The Apache Software Foundation. + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at + * http://www.apache.org/licenses/LICENSE-2.0 * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. */ package org.apache.struts2.dispatcher; @@ -58,7 +61,7 @@ import com.opensymphony.xwork2.util.profiling.UtilTimerStack; * @see FilterDispatcher * @see AbstractFilter * @see Dispatcher - * + * * @version $Date$ $Id$ */ public class ActionContextCleanUp extends AbstractFilter { @@ -74,9 +77,9 @@ public class ActionContextCleanUp extends AbstractFilter { * Empty implementation. */ protected void postInit(FilterConfig filterConfig) throws ServletException { - // does nothing. + // does nothing. } - + /** * @see javax.servlet.Filter#doFilter(javax.servlet.ServletRequest, javax.servlet.ServletResponse, javax.servlet.FilterChain) */ @@ -87,58 +90,58 @@ public class ActionContextCleanUp extends AbstractFilter { String timerKey = "ActionContextCleanUp_doFilter: "; try { - UtilTimerStack.push(timerKey); - - request = prepareDispatcherAndWrapRequest(request, response); + UtilTimerStack.push(timerKey); - try { - Integer count = (Integer)request.getAttribute(COUNTER); - if (count == null) { - count = new Integer(1); - } - else { - count = new Integer(count.intValue()+1); - } - request.setAttribute(COUNTER, count); - - if (LOG.isDebugEnabled()) { - LOG.debug("filtering counter="+count); - } - - chain.doFilter(request, response); - } finally { - int counterVal = ((Integer)request.getAttribute(COUNTER)).intValue(); - counterVal -= 1; - request.setAttribute(COUNTER, new Integer(counterVal)); - cleanUp(request); - } + request = prepareDispatcherAndWrapRequest(request, response); + + try { + Integer count = (Integer)request.getAttribute(COUNTER); + if (count == null) { + count = new Integer(1); + } + else { + count = new Integer(count.intValue()+1); + } + request.setAttribute(COUNTER, count); + + if (LOG.isDebugEnabled()) { + LOG.debug("filtering counter="+count); + } + + chain.doFilter(request, response); + } finally { + int counterVal = ((Integer)request.getAttribute(COUNTER)).intValue(); + counterVal -= 1; + request.setAttribute(COUNTER, new Integer(counterVal)); + cleanUp(request); + } } finally { - UtilTimerStack.pop(timerKey); + UtilTimerStack.pop(timerKey); } } /** * Clean up the request of threadlocals if this is the last execution - * + * * @param req The servlet request */ protected static void cleanUp(ServletRequest req) { // should we clean up yet? - Integer count = (Integer) req.getAttribute(COUNTER); + Integer count = (Integer) req.getAttribute(COUNTER); if (count != null && count > 0 ) { - if (LOG.isDebugEnabled()) { - LOG.debug("skipping cleanup counter="+count); - } + if (LOG.isDebugEnabled()) { + LOG.debug("skipping cleanup counter="+count); + } return; } // always dontClean up the thread request, even if an action hasn't been executed ActionContext.setContext(null); Dispatcher.setInstance(null); - + if (LOG.isDebugEnabled()) { - LOG.debug("clean up "); - } + LOG.debug("clean up "); + } } } diff --git a/core/src/main/java/org/apache/struts2/dispatcher/ApplicationMap.java b/core/src/main/java/org/apache/struts2/dispatcher/ApplicationMap.java index 79e782f39..15de3e174 100644 --- a/core/src/main/java/org/apache/struts2/dispatcher/ApplicationMap.java +++ b/core/src/main/java/org/apache/struts2/dispatcher/ApplicationMap.java @@ -1,19 +1,22 @@ /* * $Id$ * - * Copyright 2006 The Apache Software Foundation. + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at + * http://www.apache.org/licenses/LICENSE-2.0 * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. */ package org.apache.struts2.dispatcher; @@ -36,9 +39,9 @@ import javax.servlet.ServletContext; */ public class ApplicationMap extends AbstractMap implements Serializable { - private static final long serialVersionUID = 9136809763083228202L; - - private ServletContext context; + private static final long serialVersionUID = 9136809763083228202L; + + private ServletContext context; private Set entries; diff --git a/core/src/main/java/org/apache/struts2/dispatcher/DefaultActionSupport.java b/core/src/main/java/org/apache/struts2/dispatcher/DefaultActionSupport.java index 91164aa29..59f02ba01 100644 --- a/core/src/main/java/org/apache/struts2/dispatcher/DefaultActionSupport.java +++ b/core/src/main/java/org/apache/struts2/dispatcher/DefaultActionSupport.java @@ -1,19 +1,22 @@ /* * $Id$ * - * Copyright 2006 The Apache Software Foundation. + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at + * http://www.apache.org/licenses/LICENSE-2.0 * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. */ package org.apache.struts2.dispatcher; @@ -25,45 +28,45 @@ import org.apache.struts2.ServletActionContext; import com.opensymphony.xwork2.ActionSupport; /** - * A simple action support class that sets properties to be able to serve + * A simple action support class that sets properties to be able to serve */ public class DefaultActionSupport extends ActionSupport { - private static final long serialVersionUID = -2426166391283746095L; - - private String successResultValue; - - - /** - * Constructor - */ - public DefaultActionSupport() { - super(); - } + private static final long serialVersionUID = -2426166391283746095L; - /* (non-Javadoc) - * @see com.opensymphony.xwork2.ActionSupport#execute() - */ - public String execute() throws Exception { - HttpServletRequest request = ServletActionContext.getRequest(); - String requestedUrl = request.getPathInfo(); - if (successResultValue == null) successResultValue = requestedUrl; - return SUCCESS; - } + private String successResultValue; - /** - * @return Returns the successResultValue. - */ - public String getSuccessResultValue() { - return successResultValue; - } - /** - * @param successResultValue The successResultValue to set. - */ - public void setSuccessResultValue(String successResultValue) { - this.successResultValue = successResultValue; - } - + /** + * Constructor + */ + public DefaultActionSupport() { + super(); + } + + /* (non-Javadoc) + * @see com.opensymphony.xwork2.ActionSupport#execute() + */ + public String execute() throws Exception { + HttpServletRequest request = ServletActionContext.getRequest(); + String requestedUrl = request.getPathInfo(); + if (successResultValue == null) successResultValue = requestedUrl; + return SUCCESS; + } + + /** + * @return Returns the successResultValue. + */ + public String getSuccessResultValue() { + return successResultValue; + } + + /** + * @param successResultValue The successResultValue to set. + */ + public void setSuccessResultValue(String successResultValue) { + this.successResultValue = successResultValue; + } + } diff --git a/core/src/main/java/org/apache/struts2/dispatcher/Dispatcher.java b/core/src/main/java/org/apache/struts2/dispatcher/Dispatcher.java index 10370a08f..be21e0403 100644 --- a/core/src/main/java/org/apache/struts2/dispatcher/Dispatcher.java +++ b/core/src/main/java/org/apache/struts2/dispatcher/Dispatcher.java @@ -1,19 +1,22 @@ /* * $Id$ * - * Copyright 2006 The Apache Software Foundation. + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at + * http://www.apache.org/licenses/LICENSE-2.0 * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. */ package org.apache.struts2.dispatcher; @@ -264,19 +267,19 @@ public class Dispatcher { } if (configFiles != null) { List packages = new ArrayList(); - String[] files = configFiles.split("\\s*[,]\\s*"); - for (String file : files) { + String[] files = configFiles.split("\\s*[,]\\s*"); + for (String file : files) { if (file.endsWith(".xml")) { - if ("xwork.xml".equals(file)) { - configurationManager.addConfigurationProvider(new XmlConfigurationProvider(file, false)); - } else { - configurationManager.addConfigurationProvider(new StrutsXmlConfigurationProvider(file, false)); - } + if ("xwork.xml".equals(file)) { + configurationManager.addConfigurationProvider(new XmlConfigurationProvider(file, false)); + } else { + configurationManager.addConfigurationProvider(new StrutsXmlConfigurationProvider(file, false)); + } } else { packages.add(file); } - } - + } + // Initialize the classloader scanner with the configured paths if (packages.size() > 0) { ClasspathConfigurationProvider provider = new ClasspathConfigurationProvider((String[])packages.toArray(new String[]{})); diff --git a/core/src/main/java/org/apache/struts2/dispatcher/DispatcherListener.java b/core/src/main/java/org/apache/struts2/dispatcher/DispatcherListener.java index 1030cef47..444ce664f 100644 --- a/core/src/main/java/org/apache/struts2/dispatcher/DispatcherListener.java +++ b/core/src/main/java/org/apache/struts2/dispatcher/DispatcherListener.java @@ -1,19 +1,22 @@ /* * $Id$ * - * Copyright 2006 The Apache Software Foundation. + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at + * http://www.apache.org/licenses/LICENSE-2.0 * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. */ package org.apache.struts2.dispatcher; @@ -25,14 +28,14 @@ public interface DispatcherListener { /** * Called when the dispatcher is initialized - * + * * @param du The dispatcher instance */ public void dispatcherInitialized(Dispatcher du); - + /** * Called when the dispatcher is destroyed - * + * * @param du The dispatcher instance */ public void dispatcherDestroyed(Dispatcher du); diff --git a/core/src/main/java/org/apache/struts2/dispatcher/FilterDispatcher.java b/core/src/main/java/org/apache/struts2/dispatcher/FilterDispatcher.java index 72e9b5c10..5e89c9ea1 100644 --- a/core/src/main/java/org/apache/struts2/dispatcher/FilterDispatcher.java +++ b/core/src/main/java/org/apache/struts2/dispatcher/FilterDispatcher.java @@ -1,19 +1,22 @@ /* * $Id$ * - * Copyright 2006 The Apache Software Foundation. + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at + * http://www.apache.org/licenses/LICENSE-2.0 * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. */ package org.apache.struts2.dispatcher; @@ -52,7 +55,7 @@ import com.opensymphony.xwork2.util.profiling.UtilTimerStack; import com.opensymphony.xwork2.ActionContext; /** - * Master filter for Struts that handles four distinct + * Master filter for Struts that handles four distinct * responsibilities: * *
    @@ -106,18 +109,18 @@ import com.opensymphony.xwork2.ActionContext; * database access credentials. * *

    - * - * To use a custom {@link Dispatcher}, the createDispatcher() method could be overriden by + * + * To use a custom {@link Dispatcher}, the createDispatcher() method could be overriden by * the subclass. * * @see org.apache.struts2.lifecycle.LifecycleListener * @see ActionMapper * @see ActionContextCleanUp - * + * * @version $Date$ $Id$ */ public class FilterDispatcher extends AbstractFilter implements StrutsStatics { - + private static final Log LOG = LogFactory.getLog(FilterDispatcher.class); private String[] pathPrefixes; @@ -126,26 +129,26 @@ public class FilterDispatcher extends AbstractFilter implements StrutsStatics { private final Calendar lastModifiedCal = Calendar.getInstance(TimeZone.getTimeZone("GMT")); private final String lastModified = df.format(lastModifiedCal.getTime()); - + /** * Look for "packages" defined through filter-config's parameters. - * + * * @param FilterConfig * @throws ServletException */ protected void postInit(FilterConfig filterConfig) throws ServletException { - String param = filterConfig.getInitParameter("packages"); + String param = filterConfig.getInitParameter("packages"); String packages = "org.apache.struts2.static template org.apache.struts2.interceptor.debugging"; if (param != null) { packages = param + " " + packages; } this.pathPrefixes = parse(packages); } - + /** * Parses the list of packages - * - * @param packages A comma-delimited String + * + * @param packages A comma-delimited String * @return A string array of packages */ protected String[] parse(String packages) { @@ -177,58 +180,58 @@ public class FilterDispatcher extends AbstractFilter implements StrutsStatics { String timerKey = "FilterDispatcher_doFilter: "; try { - UtilTimerStack.push(timerKey); - - request = prepareDispatcherAndWrapRequest(request, response); + UtilTimerStack.push(timerKey); + + request = prepareDispatcherAndWrapRequest(request, response); - ActionMapper mapper = null; - ActionMapping mapping = null; - try { - mapper = ActionMapperFactory.getMapper(); - mapping = mapper.getMapping(request, dispatcher.getConfigurationManager()); - } catch (Exception ex) { - LOG.error("error getting ActionMapping", ex); - dispatcher.sendError(request, response, servletContext, HttpServletResponse.SC_INTERNAL_SERVER_ERROR, ex); - ActionContextCleanUp.cleanUp(req); - return; - } + ActionMapper mapper = null; + ActionMapping mapping = null; + try { + mapper = ActionMapperFactory.getMapper(); + mapping = mapper.getMapping(request, dispatcher.getConfigurationManager()); + } catch (Exception ex) { + LOG.error("error getting ActionMapping", ex); + dispatcher.sendError(request, response, servletContext, HttpServletResponse.SC_INTERNAL_SERVER_ERROR, ex); + ActionContextCleanUp.cleanUp(req); + return; + } - if (mapping == null) { - // there is no action in this request, should we look for a static resource? - String resourcePath = RequestUtils.getServletPath(request); + if (mapping == null) { + // there is no action in this request, should we look for a static resource? + String resourcePath = RequestUtils.getServletPath(request); - if ("".equals(resourcePath) && null != request.getPathInfo()) { - resourcePath = request.getPathInfo(); - } + if ("".equals(resourcePath) && null != request.getPathInfo()) { + resourcePath = request.getPathInfo(); + } - if ("true".equals(Settings.get(StrutsConstants.STRUTS_SERVE_STATIC_CONTENT)) + if ("true".equals(Settings.get(StrutsConstants.STRUTS_SERVE_STATIC_CONTENT)) && resourcePath.startsWith("/struts")) { - String name = resourcePath.substring("/struts".length()); - findStaticResource(name, response); - } else { - // this is a normal request, let it pass through - chain.doFilter(request, response); - } - // The framework did its job here - return; - } + String name = resourcePath.substring("/struts".length()); + findStaticResource(name, response); + } else { + // this is a normal request, let it pass through + chain.doFilter(request, response); + } + // The framework did its job here + return; + } - try { - dispatcher.serviceAction(request, response, servletContext, mapping); - } finally { - ActionContextCleanUp.cleanUp(req); - } + try { + dispatcher.serviceAction(request, response, servletContext, mapping); + } finally { + ActionContextCleanUp.cleanUp(req); + } } finally { - UtilTimerStack.pop(timerKey); + UtilTimerStack.pop(timerKey); } } /** * Finds a static resource - * + * * @param name The resource name * @param response The request * @throws IOException If anything goes wrong @@ -243,9 +246,9 @@ public class FilterDispatcher extends AbstractFilter implements StrutsStatics { if (contentType != null) { response.setContentType(contentType); } - + if ("true".equals(Settings.get(StrutsConstants.STRUTS_SERVE_STATIC_BROWSER_CACHE))) { - // set heading information for caching static content + // set heading information for caching static content Calendar cal = Calendar.getInstance(TimeZone.getTimeZone("GMT")); response.setHeader("Date",df.format(cal.getTime())+" GMT"); cal.add(Calendar.DAY_OF_MONTH,1); @@ -255,7 +258,7 @@ public class FilterDispatcher extends AbstractFilter implements StrutsStatics { response.setHeader("Last-Modified",lastModified+" GMT"); } else { - response.setHeader("Cache-Control","no-cache"); + response.setHeader("Cache-Control","no-cache"); response.setHeader("Pragma","no-cache"); response.setHeader("Expires","-1"); } @@ -275,7 +278,7 @@ public class FilterDispatcher extends AbstractFilter implements StrutsStatics { /** * Determines the content type for the resource name - * + * * @param name The resource name * @return The mime type */ @@ -303,7 +306,7 @@ public class FilterDispatcher extends AbstractFilter implements StrutsStatics { /** * Copies the from the input stream to the output stream - * + * * @param input The input stream * @param output The output stream * @throws IOException If anything goes wrong @@ -318,7 +321,7 @@ public class FilterDispatcher extends AbstractFilter implements StrutsStatics { /** * Looks for a static resource in the classpath - * + * * @param name The resource name * @param packagePrefix The package prefix to use to locate the resource * @return The inputstream of the resource diff --git a/core/src/main/java/org/apache/struts2/dispatcher/FilterDispatcherCompatWeblogic61.java b/core/src/main/java/org/apache/struts2/dispatcher/FilterDispatcherCompatWeblogic61.java index 9063bb903..d9a57f1c9 100644 --- a/core/src/main/java/org/apache/struts2/dispatcher/FilterDispatcherCompatWeblogic61.java +++ b/core/src/main/java/org/apache/struts2/dispatcher/FilterDispatcherCompatWeblogic61.java @@ -1,19 +1,22 @@ /* * $Id$ * - * Copyright 2006 The Apache Software Foundation. + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at + * http://www.apache.org/licenses/LICENSE-2.0 * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. */ package org.apache.struts2.dispatcher; diff --git a/core/src/main/java/org/apache/struts2/dispatcher/HttpHeaderResult.java b/core/src/main/java/org/apache/struts2/dispatcher/HttpHeaderResult.java index 4c4540920..786c0465d 100644 --- a/core/src/main/java/org/apache/struts2/dispatcher/HttpHeaderResult.java +++ b/core/src/main/java/org/apache/struts2/dispatcher/HttpHeaderResult.java @@ -1,19 +1,22 @@ /* * $Id$ * - * Copyright 2006 The Apache Software Foundation. + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at + * http://www.apache.org/licenses/LICENSE-2.0 * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. */ package org.apache.struts2.dispatcher; @@ -36,7 +39,7 @@ import com.opensymphony.xwork2.util.ValueStack; * * * A custom Result type for setting HTTP headers and status by optionally evaluating against the ValueStack. - * + * * *

    * This result type takes the following parameters: @@ -68,25 +71,25 @@ import com.opensymphony.xwork2.util.ValueStack; */ public class HttpHeaderResult implements Result { - private static final long serialVersionUID = 195648957144219214L; + private static final long serialVersionUID = 195648957144219214L; /** The default parameter */ - public static final String DEFAULT_PARAM = "status"; + public static final String DEFAULT_PARAM = "status"; private boolean parse = true; private Map headers; private int status = -1; - + public HttpHeaderResult() { - super(); - headers = new HashMap(); + super(); + headers = new HashMap(); } - + public HttpHeaderResult(int status) { - this(); - this.status = status; - this.parse = false; + this(); + this.status = status; + this.parse = false; } @@ -118,14 +121,14 @@ public class HttpHeaderResult implements Result { public void setStatus(int status) { this.status = status; } - + /** * Adds an HTTP header to the response * @param name * @param value */ public void addHeader(String name, String value) { - headers.put(name, value); + headers.put(name, value); } /** diff --git a/core/src/main/java/org/apache/struts2/dispatcher/PlainTextResult.java b/core/src/main/java/org/apache/struts2/dispatcher/PlainTextResult.java index 62490a4f0..d789ef306 100644 --- a/core/src/main/java/org/apache/struts2/dispatcher/PlainTextResult.java +++ b/core/src/main/java/org/apache/struts2/dispatcher/PlainTextResult.java @@ -1,19 +1,22 @@ /* * $Id$ * - * Copyright 2006 The Apache Software Foundation. + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at + * http://www.apache.org/licenses/LICENSE-2.0 * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. */ package org.apache.struts2.dispatcher; @@ -31,137 +34,137 @@ import com.opensymphony.xwork2.ActionInvocation; /** * - * + * * A result that send the content out as plain text. Usefull typically when needed * to display the raw content of a JSP or Html file for example. - * + * * - * - * + * + * * - * + * *

      - *
    • location (default) = location of the file (jsp/html) to be displayed as plain text.
    • + *
    • location (default) = location of the file (jsp/html) to be displayed as plain text.
    • *
    • charSet (optional) = character set to be used. This character set will be used to set the - * response type (eg. Content-Type=text/plain; charset=UTF-8) and when reading - * using a Reader. Some example of charSet would be UTF-8, ISO-8859-1 etc. + * response type (eg. Content-Type=text/plain; charset=UTF-8) and when reading + * using a Reader. Some example of charSet would be UTF-8, ISO-8859-1 etc. *
    - * + * * - * - * + * + * *
      * 
    - * 
    + *
      * <action name="displayJspRawContent" >
      *   <result type="plaintext">/myJspFile.jsp</result>
      * </action>
    - * 
    - * 
    + *
    + *
      * <action name="displayJspRawContent" >
      *   <result type="plaintext">
      *      <param name="location">/myJspFile.jsp</param>
      *      <param name="charSet">UTF-8</param>
      *   </result>
      * </action>
    - * 
    + *
      * 
      * 
    - * + * */ public class PlainTextResult extends StrutsResultSupport { public static final int BUFFER_SIZE = 1024; - - private static final Log _log = LogFactory.getLog(PlainTextResult.class); - private static final long serialVersionUID = 3633371605905583950L; - - private String charSet; - - public PlainTextResult() { - super(); - } - - public PlainTextResult(String location) { - super(location); - } - + private static final Log _log = LogFactory.getLog(PlainTextResult.class); + + private static final long serialVersionUID = 3633371605905583950L; + + private String charSet; + + public PlainTextResult() { + super(); + } + + public PlainTextResult(String location) { + super(location); + } + /** * Set the character set - * + * * @return The character set */ - public String getCharSet() { - return charSet; - } - + public String getCharSet() { + return charSet; + } + /** * Set the character set - * + * * @param charSet The character set */ - public void setCharSet(String charSet) { - this.charSet = charSet; - } - - /* (non-Javadoc) - * @see org.apache.struts2.dispatcher.StrutsResultSupport#doExecute(java.lang.String, com.opensymphony.xwork2.ActionInvocation) - */ - protected void doExecute(String finalLocation, ActionInvocation invocation) throws Exception { - - // verify charset - Charset charset = null; - if (charSet != null) { - if (Charset.isSupported(charSet)) { - charset = Charset.forName(charSet); - } - else { - _log.warn("charset ["+charSet+"] is not recognized "); - charset = null; - } - } - - HttpServletResponse response = (HttpServletResponse) invocation.getInvocationContext().get(HTTP_RESPONSE); - ServletContext servletContext = (ServletContext) invocation.getInvocationContext().get(SERVLET_CONTEXT); + public void setCharSet(String charSet) { + this.charSet = charSet; + } - - if (charset != null) { - response.setContentType("text/plain; charset="+charSet); - } - else { - response.setContentType("text/plain"); - } - response.setHeader("Content-Disposition", "inline"); - - - PrintWriter writer = response.getWriter(); - InputStreamReader reader = null; - try { - if (charset != null) { - reader = new InputStreamReader(servletContext.getResourceAsStream(finalLocation), charset); - } - else { - reader = new InputStreamReader(servletContext.getResourceAsStream(finalLocation)); - } - if (reader == null) { - _log.warn("resource at location ["+finalLocation+"] cannot be obtained (return null) from ServletContext !!! "); - } - else { - char[] buffer = new char[BUFFER_SIZE]; - int charRead = 0; - while((charRead = reader.read(buffer)) != -1) { - writer.write(buffer, 0, charRead); - } - } - } - finally { - if (reader != null) - reader.close(); - if (writer != null) { - writer.flush(); - writer.close(); - } - } - } + /* (non-Javadoc) + * @see org.apache.struts2.dispatcher.StrutsResultSupport#doExecute(java.lang.String, com.opensymphony.xwork2.ActionInvocation) + */ + protected void doExecute(String finalLocation, ActionInvocation invocation) throws Exception { + + // verify charset + Charset charset = null; + if (charSet != null) { + if (Charset.isSupported(charSet)) { + charset = Charset.forName(charSet); + } + else { + _log.warn("charset ["+charSet+"] is not recognized "); + charset = null; + } + } + + HttpServletResponse response = (HttpServletResponse) invocation.getInvocationContext().get(HTTP_RESPONSE); + ServletContext servletContext = (ServletContext) invocation.getInvocationContext().get(SERVLET_CONTEXT); + + + if (charset != null) { + response.setContentType("text/plain; charset="+charSet); + } + else { + response.setContentType("text/plain"); + } + response.setHeader("Content-Disposition", "inline"); + + + PrintWriter writer = response.getWriter(); + InputStreamReader reader = null; + try { + if (charset != null) { + reader = new InputStreamReader(servletContext.getResourceAsStream(finalLocation), charset); + } + else { + reader = new InputStreamReader(servletContext.getResourceAsStream(finalLocation)); + } + if (reader == null) { + _log.warn("resource at location ["+finalLocation+"] cannot be obtained (return null) from ServletContext !!! "); + } + else { + char[] buffer = new char[BUFFER_SIZE]; + int charRead = 0; + while((charRead = reader.read(buffer)) != -1) { + writer.write(buffer, 0, charRead); + } + } + } + finally { + if (reader != null) + reader.close(); + if (writer != null) { + writer.flush(); + writer.close(); + } + } + } } diff --git a/core/src/main/java/org/apache/struts2/dispatcher/RequestMap.java b/core/src/main/java/org/apache/struts2/dispatcher/RequestMap.java index a4183b52b..01efd753b 100644 --- a/core/src/main/java/org/apache/struts2/dispatcher/RequestMap.java +++ b/core/src/main/java/org/apache/struts2/dispatcher/RequestMap.java @@ -1,19 +1,22 @@ /* * $Id$ * - * Copyright 2006 The Apache Software Foundation. + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at + * http://www.apache.org/licenses/LICENSE-2.0 * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. */ package org.apache.struts2.dispatcher; @@ -31,9 +34,9 @@ import javax.servlet.http.HttpServletRequest; */ public class RequestMap extends AbstractMap implements Serializable { - private static final long serialVersionUID = -7675640869293787926L; - - private Set entries; + private static final long serialVersionUID = -7675640869293787926L; + + private Set entries; private HttpServletRequest request; diff --git a/core/src/main/java/org/apache/struts2/dispatcher/ServletActionRedirectResult.java b/core/src/main/java/org/apache/struts2/dispatcher/ServletActionRedirectResult.java index fad79a4ae..ba8823b0c 100644 --- a/core/src/main/java/org/apache/struts2/dispatcher/ServletActionRedirectResult.java +++ b/core/src/main/java/org/apache/struts2/dispatcher/ServletActionRedirectResult.java @@ -1,19 +1,22 @@ /* * $Id$ * - * Copyright 2006 The Apache Software Foundation. + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at + * http://www.apache.org/licenses/LICENSE-2.0 * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. */ package org.apache.struts2.dispatcher; @@ -47,7 +50,7 @@ import com.opensymphony.xwork2.config.entities.ResultConfig; * passed because they are part of the config param for this particular result. * *
      - *
    • actionName
    • + *
    • actionName
    • *
    • namespace
    • *
    • method
    • *
    • encode
    • @@ -101,14 +104,14 @@ import com.opensymphony.xwork2.config.entities.ResultConfig; * </package> * * <package name="passingRequestParameters" extends="struts-default" namespace="/passingRequestParameters"> - * <-- Pass parameters (reportType, width and height) --> + * <-- Pass parameters (reportType, width and height) --> * <!-- * The redirect-action url generated will be : * /genReport/generateReport.action?reportType=pie&width=100&height=100 * --> * <action name="gatherReportInfo" class="..."> * <result name="showReportResult" type="redirect-action"> - * <param name="actionName">generateReport</param> + * <param name="actionName">generateReport</param> * <param name="namespace">/genReport</param> * <param name="reportType">pie</param> * <param name="width">100</param> @@ -124,39 +127,39 @@ import com.opensymphony.xwork2.config.entities.ResultConfig; */ public class ServletActionRedirectResult extends ServletRedirectResult { - private static final long serialVersionUID = -9042425229314584066L; + private static final long serialVersionUID = -9042425229314584066L; /** The default parameter */ - public static final String DEFAULT_PARAM = "actionName"; + public static final String DEFAULT_PARAM = "actionName"; protected String actionName; protected String namespace; protected String method; - + private Map requestParameters = new HashMap(); public ServletActionRedirectResult() { - super(); + super(); } - + public ServletActionRedirectResult(String actionName) { - this(null, actionName, null); + this(null, actionName, null); } - + public ServletActionRedirectResult(String actionName, String method) { - this(null, actionName, method); + this(null, actionName, method); } - - public ServletActionRedirectResult(String namespace, String actionName, String method) { - super(null); - this.namespace = namespace; - this.actionName = actionName; - this.method = method; - } - + + public ServletActionRedirectResult(String namespace, String actionName, String method) { + super(null); + this.namespace = namespace; + this.actionName = actionName; + this.method = method; + } + protected List prohibitedResultParam = Arrays.asList(new String[] { - DEFAULT_PARAM, "namespace", "method", "encode", "parse", "location", - "prependServletContext" }); + DEFAULT_PARAM, "namespace", "method", "encode", "parse", "location", + "prependServletContext" }); /** * @see com.opensymphony.xwork2.Result#execute(com.opensymphony.xwork2.ActionInvocation) @@ -169,25 +172,25 @@ public class ServletActionRedirectResult extends ServletRedirectResult { namespace = conditionalParse(namespace, invocation); } if (method == null) { - method = ""; + method = ""; } else { - method = conditionalParse(method, invocation); + method = conditionalParse(method, invocation); } String resultCode = invocation.getResultCode(); if (resultCode != null) { - ResultConfig resultConfig = invocation.getProxy().getConfig().getResults().get( - resultCode); - Map resultConfigParams = resultConfig.getParams(); - for (Iterator i = resultConfigParams.entrySet().iterator(); i.hasNext(); ) { - Map.Entry e = (Map.Entry) i.next(); - if (! prohibitedResultParam.contains(e.getKey())) { - requestParameters.put(e.getKey().toString(), - e.getValue() == null ? "": - conditionalParse(e.getValue().toString(), invocation)); - } - } + ResultConfig resultConfig = invocation.getProxy().getConfig().getResults().get( + resultCode); + Map resultConfigParams = resultConfig.getParams(); + for (Iterator i = resultConfigParams.entrySet().iterator(); i.hasNext(); ) { + Map.Entry e = (Map.Entry) i.next(); + if (! prohibitedResultParam.contains(e.getKey())) { + requestParameters.put(e.getKey().toString(), + e.getValue() == null ? "": + conditionalParse(e.getValue().toString(), invocation)); + } + } } ActionMapper mapper = ActionMapperFactory.getMapper(); @@ -223,18 +226,18 @@ public class ServletActionRedirectResult extends ServletRedirectResult { * @param method The method */ public void setMethod(String method) { - this.method = method; + this.method = method; } - + /** * Adds a request parameter to be added to the redirect url - * + * * @param key The parameter name * @param value The parameter value */ public ServletActionRedirectResult addParameter(String key, Object value) { - requestParameters.put(key, String.valueOf(value)); - return this; + requestParameters.put(key, String.valueOf(value)); + return this; } } diff --git a/core/src/main/java/org/apache/struts2/dispatcher/ServletDispatcherResult.java b/core/src/main/java/org/apache/struts2/dispatcher/ServletDispatcherResult.java index 4efd35227..ad43609da 100644 --- a/core/src/main/java/org/apache/struts2/dispatcher/ServletDispatcherResult.java +++ b/core/src/main/java/org/apache/struts2/dispatcher/ServletDispatcherResult.java @@ -1,19 +1,22 @@ /* * $Id$ * - * Copyright 2006 The Apache Software Foundation. + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at + * http://www.apache.org/licenses/LICENSE-2.0 * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. */ package org.apache.struts2.dispatcher; @@ -39,7 +42,7 @@ import com.opensymphony.xwork2.ActionInvocation; * available. *

      * There are three possible ways the result can be executed: - * + * *

        * *
      • If we are in the scope of a JSP (a PageContext is available), PageContext's @@ -49,10 +52,10 @@ import com.opensymphony.xwork2.ActionInvocation; * "javax.servlet.include.servlet_path" in the request attributes), then a call to * {@link RequestDispatcher#forward(javax.servlet.ServletRequest, javax.servlet.ServletResponse) forward} * is made.
      • - * + * *
      • Otherwise, {@link RequestDispatcher#include(javax.servlet.ServletRequest, javax.servlet.ServletResponse) include} * is called.
      • - * + * *
      * * @@ -84,18 +87,18 @@ import com.opensymphony.xwork2.ActionInvocation; */ public class ServletDispatcherResult extends StrutsResultSupport { - private static final long serialVersionUID = -1970659272360685627L; - - private static final Log log = LogFactory.getLog(ServletDispatcherResult.class); + private static final long serialVersionUID = -1970659272360685627L; + + private static final Log log = LogFactory.getLog(ServletDispatcherResult.class); + + public ServletDispatcherResult() { + super(); + } + + public ServletDispatcherResult(String location) { + super(location); + } - public ServletDispatcherResult() { - super(); - } - - public ServletDispatcherResult(String location) { - super(location); - } - /** * Dispatches to the given location. Does its forward via a RequestDispatcher. If the * dispatch fails a 404 error will be sent back in the http response. @@ -127,8 +130,8 @@ public class ServletDispatcherResult extends StrutsResultSupport { } // If we're included, then include the view - // Otherwise do forward - // This allow the page to, for example, set content type + // Otherwise do forward + // This allow the page to, for example, set content type if (!response.isCommitted() && (request.getAttribute("javax.servlet.include.servlet_path") == null)) { request.setAttribute("struts.view_uri", finalLocation); request.setAttribute("struts.request_uri", request.getRequestURI()); diff --git a/core/src/main/java/org/apache/struts2/dispatcher/ServletRedirectResult.java b/core/src/main/java/org/apache/struts2/dispatcher/ServletRedirectResult.java index 5eee5b9b3..97d4a9dbc 100644 --- a/core/src/main/java/org/apache/struts2/dispatcher/ServletRedirectResult.java +++ b/core/src/main/java/org/apache/struts2/dispatcher/ServletRedirectResult.java @@ -1,19 +1,22 @@ /* * $Id$ * - * Copyright 2006 The Apache Software Foundation. + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at + * http://www.apache.org/licenses/LICENSE-2.0 * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. */ package org.apache.struts2.dispatcher; @@ -51,7 +54,7 @@ import com.opensymphony.xwork2.ActionInvocation; * *
    • location (default) - the location to go to after execution.
    • * - *
    • parse - true by default. If set to false, the location param will + *
    • parse - true by default. If set to false, the location param will * not be parsed for Ognl expressions.
    • * *
    @@ -73,21 +76,21 @@ import com.opensymphony.xwork2.ActionInvocation; * */ public class ServletRedirectResult extends StrutsResultSupport { - - private static final long serialVersionUID = 6316947346435301270L; - private static final Log log = LogFactory.getLog(ServletRedirectResult.class); + private static final long serialVersionUID = 6316947346435301270L; + + private static final Log log = LogFactory.getLog(ServletRedirectResult.class); protected boolean prependServletContext = true; public ServletRedirectResult() { - super(); + super(); } - + public ServletRedirectResult(String location) { - super(location); + super(location); } - + /** * Sets whether or not to prepend the servlet context path to the redirected URL. * diff --git a/core/src/main/java/org/apache/struts2/dispatcher/SessionMap.java b/core/src/main/java/org/apache/struts2/dispatcher/SessionMap.java index 81fa69d29..af83057f3 100644 --- a/core/src/main/java/org/apache/struts2/dispatcher/SessionMap.java +++ b/core/src/main/java/org/apache/struts2/dispatcher/SessionMap.java @@ -1,19 +1,22 @@ /* * $Id$ * - * Copyright 2006 The Apache Software Foundation. + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at + * http://www.apache.org/licenses/LICENSE-2.0 * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. */ package org.apache.struts2.dispatcher; @@ -37,9 +40,9 @@ import javax.servlet.http.HttpSession; */ public class SessionMap extends AbstractMap implements Serializable { - private static final long serialVersionUID = 4678843241638046854L; - - protected HttpSession session; + private static final long serialVersionUID = 4678843241638046854L; + + protected HttpSession session; protected Set entries; protected HttpServletRequest request; @@ -62,34 +65,34 @@ public class SessionMap extends AbstractMap implements Serializable { * Invalidate the http session. */ public void invalidate() { - if (session == null) { - return; - } + if (session == null) { + return; + } - synchronized (session) { - session.invalidate(); - session = null; - entries = null; - } - } + synchronized (session) { + session.invalidate(); + session = null; + entries = null; + } + } /** - * Removes all attributes from the session as well as clears entries in this - * map. - */ + * Removes all attributes from the session as well as clears entries in this + * map. + */ public void clear() { if (session == null ) { return; } synchronized (session) { - entries = null; - Enumeration attributeNamesEnum = session.getAttributeNames(); - while(attributeNamesEnum.hasMoreElements()) { - session.removeAttribute(attributeNamesEnum.nextElement()); - } + entries = null; + Enumeration attributeNamesEnum = session.getAttributeNames(); + while(attributeNamesEnum.hasMoreElements()) { + session.removeAttribute(attributeNamesEnum.nextElement()); + } } - + } /** diff --git a/core/src/main/java/org/apache/struts2/dispatcher/StreamResult.java b/core/src/main/java/org/apache/struts2/dispatcher/StreamResult.java index 6f4f0a044..e853a8351 100644 --- a/core/src/main/java/org/apache/struts2/dispatcher/StreamResult.java +++ b/core/src/main/java/org/apache/struts2/dispatcher/StreamResult.java @@ -1,19 +1,22 @@ /* * $Id$ * - * Copyright 2006 The Apache Software Foundation. + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at + * http://www.apache.org/licenses/LICENSE-2.0 * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. */ package org.apache.struts2.dispatcher; @@ -74,10 +77,10 @@ import com.opensymphony.xwork2.ActionInvocation; * */ public class StreamResult extends StrutsResultSupport { - - private static final long serialVersionUID = -1468409635999059850L; - protected static final Log log = LogFactory.getLog(StreamResult.class); + private static final long serialVersionUID = -1468409635999059850L; + + protected static final Log log = LogFactory.getLog(StreamResult.class); protected String contentType = "text/plain"; protected String contentLength; @@ -87,13 +90,13 @@ public class StreamResult extends StrutsResultSupport { protected int bufferSize = 1024; public StreamResult() { - super(); + super(); } - + public StreamResult(InputStream in) { - this.inputStream = in; + this.inputStream = in; } - + /** * @return Returns the bufferSize. */ @@ -172,11 +175,11 @@ public class StreamResult extends StrutsResultSupport { OutputStream oOutput = null; try { - if (inputStream == null) { - // Find the inputstream from the invocation variable stack - inputStream = (InputStream) invocation.getStack().findValue(conditionalParse(inputName, invocation)); - } - + if (inputStream == null) { + // Find the inputstream from the invocation variable stack + inputStream = (InputStream) invocation.getStack().findValue(conditionalParse(inputName, invocation)); + } + if (inputStream == null) { String msg = ("Can not find a java.io.InputStream with the name [" + inputName + "] in the invocation stack. " + "Check the tag specified for this action."); @@ -192,17 +195,17 @@ public class StreamResult extends StrutsResultSupport { // Set the content length if (contentLength != null) { - String _contentLength = conditionalParse(contentLength, invocation); - int _contentLengthAsInt = -1; - try { - _contentLengthAsInt = Integer.parseInt(_contentLength); - if (_contentLengthAsInt >= 0) { - oResponse.setContentLength(_contentLengthAsInt); - } - } - catch(NumberFormatException e) { - log.warn("failed to recongnize "+_contentLength+" as a number, contentLength header will not be set", e); - } + String _contentLength = conditionalParse(contentLength, invocation); + int _contentLengthAsInt = -1; + try { + _contentLengthAsInt = Integer.parseInt(_contentLength); + if (_contentLengthAsInt >= 0) { + oResponse.setContentLength(_contentLengthAsInt); + } + } + catch(NumberFormatException e) { + log.warn("failed to recongnize "+_contentLength+" as a number, contentLength header will not be set", e); + } } // Set the content-disposition diff --git a/core/src/main/java/org/apache/struts2/dispatcher/StrutsRequestWrapper.java b/core/src/main/java/org/apache/struts2/dispatcher/StrutsRequestWrapper.java index 7d002afdc..a5e219232 100644 --- a/core/src/main/java/org/apache/struts2/dispatcher/StrutsRequestWrapper.java +++ b/core/src/main/java/org/apache/struts2/dispatcher/StrutsRequestWrapper.java @@ -1,19 +1,22 @@ /* * $Id$ * - * Copyright 2006 The Apache Software Foundation. + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at + * http://www.apache.org/licenses/LICENSE-2.0 * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. */ package org.apache.struts2.dispatcher; @@ -36,7 +39,7 @@ import com.opensymphony.xwork2.util.ValueStack; * */ public class StrutsRequestWrapper extends HttpServletRequestWrapper { - + /** * The constructor * @param req The request @@ -47,7 +50,7 @@ public class StrutsRequestWrapper extends HttpServletRequestWrapper { /** * Gets the object, looking in the value stack if not found - * + * * @param s The attribute key */ public Object getAttribute(String s) { diff --git a/core/src/main/java/org/apache/struts2/dispatcher/StrutsResultSupport.java b/core/src/main/java/org/apache/struts2/dispatcher/StrutsResultSupport.java index ac1685f4d..317285134 100644 --- a/core/src/main/java/org/apache/struts2/dispatcher/StrutsResultSupport.java +++ b/core/src/main/java/org/apache/struts2/dispatcher/StrutsResultSupport.java @@ -1,19 +1,22 @@ /* * $Id$ * - * Copyright 2006 The Apache Software Foundation. + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at + * http://www.apache.org/licenses/LICENSE-2.0 * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. */ package org.apache.struts2.dispatcher; @@ -31,7 +34,7 @@ import com.opensymphony.xwork2.util.TextParseUtil; /** * - * + * * A base class for all Struts action execution results. * The "location" param is the default parameter, meaning the most common usage of this result would be: *

    @@ -44,16 +47,16 @@ import com.opensymphony.xwork2.util.TextParseUtil; *

  • parse - true by default. If set to false, the location param will not be parsed for expressions
  • *
  • encode - false by default. If set to false, the location param will not be url encoded. This only have effect when parse is true
  • * - * + * * NOTE: * The encode param will only have effect when parse is true - * + * * - * + * *

    - * + * * - * + * *

    * In the struts.xml configuration file, these would be included as: *

    @@ -71,7 +74,7 @@ import com.opensymphony.xwork2.util.TextParseUtil; * <param name="encode">true</param> * </result> *

    - * In the above case, myUrl will be parsed against Ognl Value Stack and then + * In the above case, myUrl will be parsed against Ognl Value Stack and then * URL encoded. *

    * or when using the default parameter feature @@ -94,13 +97,13 @@ import com.opensymphony.xwork2.util.TextParseUtil; * Please see the {@link com.opensymphony.xwork2.Result} class for more info on Results in general. * * - * + * * @see com.opensymphony.xwork2.Result */ public abstract class StrutsResultSupport implements Result, StrutsStatics { - - private static final Log _log = LogFactory.getLog(StrutsResultSupport.class); - + + private static final Log _log = LogFactory.getLog(StrutsResultSupport.class); + /** The default parameter */ public static final String DEFAULT_PARAM = "location"; @@ -110,19 +113,19 @@ public abstract class StrutsResultSupport implements Result, StrutsStatics { private String lastFinalLocation; public StrutsResultSupport() { - this(null, true, false); + this(null, true, false); } - + public StrutsResultSupport(String location) { - this(location, false, false); + this(location, false, false); } - + public StrutsResultSupport(String location, boolean parse, boolean encode) { - this.location = location; - this.parse = parse; - this.encode = encode; + this.location = location; + this.parse = parse; + this.encode = encode; } - + /** * The location to go to after action execution. This could be a JSP page or another action. * The location can contain OGNL expressions which will be evaulated if the parse @@ -134,7 +137,7 @@ public abstract class StrutsResultSupport implements Result, StrutsStatics { public void setLocation(String location) { this.location = location; } - + /** * Returns the last parsed and encoded location value */ @@ -151,15 +154,15 @@ public abstract class StrutsResultSupport implements Result, StrutsStatics { public void setParse(boolean parse) { this.parse = parse; } - + /** * Set encode to true to indicate that the location should be url encoded. This is set to * true by default - * + * * @param encode true if the location parameter should be url encode, false otherwise. */ public void setEncode(boolean encode) { - this.encode = encode; + this.encode = encode; } /** @@ -174,36 +177,36 @@ public abstract class StrutsResultSupport implements Result, StrutsStatics { lastFinalLocation = conditionalParse(location, invocation); doExecute(lastFinalLocation, invocation); } - + /** * Parses the parameter for OGNL expressions against the valuestack - * + * * @param param The parameter value * @param invocation The action invocation instance * @return The resulting string */ protected String conditionalParse(String param, ActionInvocation invocation) { if (parse && param != null && invocation != null) { - return TextParseUtil.translateVariables(param, invocation.getStack(), - new TextParseUtil.ParsedValueEvaluator() { - public Object evaluate(Object parsedValue) { - if (encode) { - if (parsedValue != null) { - try { - // use UTF-8 as this is the recommended encoding by W3C to - // avoid incompatibilities. - return URLEncoder.encode(parsedValue.toString(), "UTF-8"); - } - catch(UnsupportedEncodingException e) { - _log.warn("error while trying to encode ["+parsedValue+"]", e); - } - } - } - return parsedValue; - } + return TextParseUtil.translateVariables(param, invocation.getStack(), + new TextParseUtil.ParsedValueEvaluator() { + public Object evaluate(Object parsedValue) { + if (encode) { + if (parsedValue != null) { + try { + // use UTF-8 as this is the recommended encoding by W3C to + // avoid incompatibilities. + return URLEncoder.encode(parsedValue.toString(), "UTF-8"); + } + catch(UnsupportedEncodingException e) { + _log.warn("error while trying to encode ["+parsedValue+"]", e); + } + } + } + return parsedValue; + } }); } else { - return param; + return param; } } diff --git a/core/src/main/java/org/apache/struts2/dispatcher/VelocityResult.java b/core/src/main/java/org/apache/struts2/dispatcher/VelocityResult.java index b4a4dd246..263b9090c 100644 --- a/core/src/main/java/org/apache/struts2/dispatcher/VelocityResult.java +++ b/core/src/main/java/org/apache/struts2/dispatcher/VelocityResult.java @@ -1,19 +1,22 @@ /* * $Id$ * - * Copyright 2006 The Apache Software Foundation. + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at + * http://www.apache.org/licenses/LICENSE-2.0 * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. */ package org.apache.struts2.dispatcher; @@ -60,7 +63,7 @@ import com.opensymphony.xwork2.util.ValueStack; * *

  • location (default) - the location of the template to process.
  • * - *
  • parse - true by default. If set to false, the location param will + *
  • parse - true by default. If set to false, the location param will * not be parsed for Ognl expressions.
  • * * @@ -81,17 +84,17 @@ import com.opensymphony.xwork2.util.ValueStack; */ public class VelocityResult extends StrutsResultSupport { - private static final long serialVersionUID = 7268830767762559424L; - - private static final Log log = LogFactory.getLog(VelocityResult.class); + private static final long serialVersionUID = 7268830767762559424L; - public VelocityResult() { - super(); - } - - public VelocityResult(String location) { - super(location); - } + private static final Log log = LogFactory.getLog(VelocityResult.class); + + public VelocityResult() { + super(); + } + + public VelocityResult(String location) { + super(location); + } /** * Creates a Velocity context from the action, loads a Velocity template and executes the diff --git a/core/src/main/java/org/apache/struts2/dispatcher/mapper/ActionMapper.java b/core/src/main/java/org/apache/struts2/dispatcher/mapper/ActionMapper.java index c3447938b..d3e7a22cf 100644 --- a/core/src/main/java/org/apache/struts2/dispatcher/mapper/ActionMapper.java +++ b/core/src/main/java/org/apache/struts2/dispatcher/mapper/ActionMapper.java @@ -1,19 +1,22 @@ /* * $Id$ * - * Copyright 2006 The Apache Software Foundation. + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at + * http://www.apache.org/licenses/LICENSE-2.0 * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. */ package org.apache.struts2.dispatcher.mapper; @@ -39,10 +42,10 @@ import com.opensymphony.xwork2.config.ConfigurationManager; * */ public interface ActionMapper { - + /** * Gets an action mapping for the current request - * + * * @param request The servlet request * @param config The current configuration manager * @return The appropriate action mapping @@ -51,7 +54,7 @@ public interface ActionMapper { /** * Converts an ActionMapping into a URI string - * + * * @param mapping The action mapping * @return The URI string that represents this mapping */ diff --git a/core/src/main/java/org/apache/struts2/dispatcher/mapper/ActionMapperFactory.java b/core/src/main/java/org/apache/struts2/dispatcher/mapper/ActionMapperFactory.java index ad3ce291e..46d87b172 100644 --- a/core/src/main/java/org/apache/struts2/dispatcher/mapper/ActionMapperFactory.java +++ b/core/src/main/java/org/apache/struts2/dispatcher/mapper/ActionMapperFactory.java @@ -1,19 +1,22 @@ /* * $Id$ * - * Copyright 2006 The Apache Software Foundation. + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at + * http://www.apache.org/licenses/LICENSE-2.0 * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. */ package org.apache.struts2.dispatcher.mapper; @@ -43,7 +46,7 @@ public class ActionMapperFactory { /** * Gets an instance of the ActionMapper - * + * * @return The action mapper */ public static ActionMapper getMapper() { diff --git a/core/src/main/java/org/apache/struts2/dispatcher/mapper/ActionMapping.java b/core/src/main/java/org/apache/struts2/dispatcher/mapper/ActionMapping.java index 3680ddff0..888ec7264 100644 --- a/core/src/main/java/org/apache/struts2/dispatcher/mapper/ActionMapping.java +++ b/core/src/main/java/org/apache/struts2/dispatcher/mapper/ActionMapping.java @@ -1,19 +1,22 @@ /* * $Id$ * - * Copyright 2006 The Apache Software Foundation. + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at + * http://www.apache.org/licenses/LICENSE-2.0 * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. */ package org.apache.struts2.dispatcher.mapper; @@ -43,7 +46,7 @@ public class ActionMapping { /** * Constructs an ActionMapping with a default result - * + * * @param result The default result */ public ActionMapping(Result result) { @@ -52,7 +55,7 @@ public class ActionMapping { /** * Constructs an ActionMapping with its values - * + * * @param name The action name * @param namespace The action namespace * @param method The method diff --git a/core/src/main/java/org/apache/struts2/dispatcher/mapper/CompositeActionMapper.java b/core/src/main/java/org/apache/struts2/dispatcher/mapper/CompositeActionMapper.java index 68fdec70f..0cc872225 100644 --- a/core/src/main/java/org/apache/struts2/dispatcher/mapper/CompositeActionMapper.java +++ b/core/src/main/java/org/apache/struts2/dispatcher/mapper/CompositeActionMapper.java @@ -1,19 +1,22 @@ /* - * $Id: ActionMapper.java 449367 2006-09-24 06:49:04Z mrdon $ + * $Id: $ * - * Copyright 2006 The Apache Software Foundation. + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at + * http://www.apache.org/licenses/LICENSE-2.0 * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. */ package org.apache.struts2.dispatcher.mapper; @@ -36,11 +39,11 @@ import com.opensymphony.xwork2.util.FileManager; /** * - * - * A composite action mapper that is capable of delegating to a series of {@link ActionMapper} if the former + * + * A composite action mapper that is capable of delegating to a series of {@link ActionMapper} if the former * failed to obtained a valid {@link ActionMapping} or uri. *

    - * It is configured through struts.properties. + * It is configured through struts.properties. *

    * For example, with the following entries in struts.properties *

    @@ -51,17 +54,17 @@ import com.opensymphony.xwork2.util.FileManager; * struts.mapper.composite.3=org.apache.struts2.dispatcher.mapper.Restful2ActionMapper * *

    - * When {@link CompositeActionMapper#getMapping(HttpServletRequest, ConfigurationManager)} or - * {@link CompositeActionMapper#getUriFromActionMapping(ActionMapping)} is invoked, - * {@link CompositeActionMapper} would go through these {@link ActionMapper}s in sequence - * starting from {@link ActionMapper} identified by 'struts.mapper.composite.1', followed by + * When {@link CompositeActionMapper#getMapping(HttpServletRequest, ConfigurationManager)} or + * {@link CompositeActionMapper#getUriFromActionMapping(ActionMapping)} is invoked, + * {@link CompositeActionMapper} would go through these {@link ActionMapper}s in sequence + * starting from {@link ActionMapper} identified by 'struts.mapper.composite.1', followed by * 'struts.mapper.composite.2' and finally 'struts.mapper.composite.3' (in this case) until either * one of the {@link ActionMapper} return a valid result (not null) or it runs out of {@link ActionMapper} - * in which case it will just return null for both - * {@link CompositeActionMapper#getMapping(HttpServletRequest, ConfigurationManager)} and + * in which case it will just return null for both + * {@link CompositeActionMapper#getMapping(HttpServletRequest, ConfigurationManager)} and * {@link CompositeActionMapper#getUriFromActionMapping(ActionMapping)} methods. *

    - * + * * For example with the following in struts.properties :- *

      * struts.mapper.class=org.apache.struts2.dispatcher.mapper.CompositeActionMapper
    @@ -71,201 +74,201 @@ import com.opensymphony.xwork2.util.FileManager;
      * 
    *

    * CompositeActionMapper will be configured with 3 ActionMapper, namely - * "DefaultActionMapper", "MyActionMapper" and "MyAnotherActionMapper". + * "DefaultActionMapper", "MyActionMapper" and "MyAnotherActionMapper". * CompositeActionMapper would consult each of them in order described above. - * + * * - * + * * @see ActionMapper * @see ActionMapperFactory * @see ActionMapping * @see IndividualActionMapperEntry - * + * * @version $Date$ $Id$ */ public class CompositeActionMapper implements ActionMapper { - private static final Log LOG = LogFactory.getLog(CompositeActionMapper.class); - - protected List orderedActionMappers; - - - public ActionMapping getMapping(HttpServletRequest request, ConfigurationManager configManager) { - - for (IndividualActionMapperEntry actionMapperEntry: getOrderedActionMapperEntries()) { - ActionMapping actionMapping = actionMapperEntry.actionMapper.getMapping(request, configManager); - if (LOG.isDebugEnabled()) { - LOG.debug("Using ActionMapper from entry ["+actionMapperEntry.propertyName+"="+actionMapperEntry.propertyValue+"]"); - } - if (actionMapping == null) { - if (LOG.isDebugEnabled()) { - LOG.debug("ActionMapper from entry ["+actionMapperEntry.propertyName+"="+actionMapperEntry.propertyValue+"] failed to return an ActionMapping (null)"); - } - } - else { - return actionMapping; - } - } - if (LOG.isDebugEnabled()) { - LOG.debug("exhausted from ActionMapper that could return an ActionMapping"); - } - return null; - } + private static final Log LOG = LogFactory.getLog(CompositeActionMapper.class); - public String getUriFromActionMapping(ActionMapping mapping) { - - for (IndividualActionMapperEntry actionMapperEntry: getOrderedActionMapperEntries()) { - String uri = actionMapperEntry.actionMapper.getUriFromActionMapping(mapping); - if (LOG.isDebugEnabled()) { - LOG.debug("Using ActionMapper from entry ["+actionMapperEntry.propertyName+"="+actionMapperEntry.propertyValue+"]"); - } - if (uri == null) { - if (LOG.isDebugEnabled()) { - LOG.debug("ActionMapper from entry ["+actionMapperEntry.propertyName+"="+actionMapperEntry.propertyValue+"] failed to return a uri (null)"); - } - } - else { - return uri; - } - } - if (LOG.isDebugEnabled()) { - LOG.debug("exhausted from ActionMapper that could return a uri"); - } - return null; - } - - - protected List getOrderedActionMapperEntries() { - if (this.orderedActionMappers == null || FileManager.isReloadingConfigs()) { - - List actionMapperEntriesContainer = new ArrayList(); - Iterator settings = Settings.list(); - while(settings.hasNext()) { - String setting = settings.next().toString(); - if (setting.startsWith(StrutsConstants.STRUTS_MAPPER_COMPOSITE)) { - try { - int order = Integer.valueOf(setting.substring(StrutsConstants.STRUTS_MAPPER_COMPOSITE.length(), setting.length())); - String propertyValue = Settings.get(setting); - if (propertyValue != null && propertyValue.trim().length() > 0) { - actionMapperEntriesContainer.add( - new IndividualActionMapperEntry(order, setting, propertyValue)); - } - else { - LOG.warn("Ignoring property "+setting+" that contains no value"); - } - } - catch(NumberFormatException e) { - LOG.warn("Ignoring malformed property "+setting); - } - } - } - - Collections.sort(actionMapperEntriesContainer, new Comparator() { - public int compare(IndividualActionMapperEntry o1, IndividualActionMapperEntry o2) { - return o1.compareTo(o2); - } - }); - - - ObjectFactory objectFactory = ObjectFactory.getObjectFactory(); - List result = new ArrayList(); - for (IndividualActionMapperEntry entry: actionMapperEntriesContainer) { - String actionMapperClassName = entry.propertyValue; - try { - // Let us get ClassCastException if it does not implement ActionMapper - ActionMapper actionMapper = (ActionMapper) objectFactory.buildBean(actionMapperClassName, null); - result.add(new IndividualActionMapperEntry(entry.order, entry.propertyName, entry.propertyValue, actionMapper)); - } - catch(Exception e) { - LOG.warn("failed to create action mapper "+actionMapperClassName+", ignoring it", e); - } - } - - this.orderedActionMappers = result; - } - - return this.orderedActionMappers; - } - - - /** - * A value object (holder) that holds information regarding {@link ActionMapper} this {@link CompositeActionMapper} - * is capable of delegating to. - *

    - * The information stored are :- - *

      - *
    • order
    • - *
    • propertyValue
    • - *
    • propertyName
    • - *
    • actionMapper
    • - *
    - * - * eg. if we have the following entry in struts.properties - *
    -	 * struts.mapper.composite.1=foo.bar.ActionMapper1
    -	 * struts.mapper.composite.2=foo.bar.ActionMapper2
    -	 * struts.mapper.composite.3=foo.bar.ActionMapper3
    -	 * 
    - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - *
    orderpropertyNamepropertyValueactionMapper
    1struts.mapper.composite.1foo.bar.ActionMapper1instance of foo.bar.ActionMapper1
    2struts.mapper.composite.2foo.bar.ActionMapper2instance of foo.bar.ActionMapper2
    3struts.mapper.composite.3foo.bar.ActionMapper3instance of foo.bar.ActionMapper3
    - * - * @version $Date$ $Id$ - */ - public class IndividualActionMapperEntry implements Comparable { - - public Integer order; - public String propertyValue; - public String propertyName; - public ActionMapper actionMapper; - - - private IndividualActionMapperEntry(Integer order, String propertyName, String propertyValue) { - assert(order != null); - assert(propertyValue != null); - assert(propertyName != null); - this.order = order; - this.propertyValue = propertyValue; - this.propertyName = propertyName; - } - - public IndividualActionMapperEntry(Integer order, String propertyName, String propertyValue, ActionMapper actionMapper) { - assert(order != null); - assert(propertyValue != null); - assert(propertyName != null); - assert(actionMapper != null); - this.order = order; - this.propertyValue = propertyValue; - this.propertyName = propertyName; - this.actionMapper = actionMapper; - } + protected List orderedActionMappers; - public int compareTo(IndividualActionMapperEntry o) { - return order - o.order; - } - } + + public ActionMapping getMapping(HttpServletRequest request, ConfigurationManager configManager) { + + for (IndividualActionMapperEntry actionMapperEntry: getOrderedActionMapperEntries()) { + ActionMapping actionMapping = actionMapperEntry.actionMapper.getMapping(request, configManager); + if (LOG.isDebugEnabled()) { + LOG.debug("Using ActionMapper from entry ["+actionMapperEntry.propertyName+"="+actionMapperEntry.propertyValue+"]"); + } + if (actionMapping == null) { + if (LOG.isDebugEnabled()) { + LOG.debug("ActionMapper from entry ["+actionMapperEntry.propertyName+"="+actionMapperEntry.propertyValue+"] failed to return an ActionMapping (null)"); + } + } + else { + return actionMapping; + } + } + if (LOG.isDebugEnabled()) { + LOG.debug("exhausted from ActionMapper that could return an ActionMapping"); + } + return null; + } + + public String getUriFromActionMapping(ActionMapping mapping) { + + for (IndividualActionMapperEntry actionMapperEntry: getOrderedActionMapperEntries()) { + String uri = actionMapperEntry.actionMapper.getUriFromActionMapping(mapping); + if (LOG.isDebugEnabled()) { + LOG.debug("Using ActionMapper from entry ["+actionMapperEntry.propertyName+"="+actionMapperEntry.propertyValue+"]"); + } + if (uri == null) { + if (LOG.isDebugEnabled()) { + LOG.debug("ActionMapper from entry ["+actionMapperEntry.propertyName+"="+actionMapperEntry.propertyValue+"] failed to return a uri (null)"); + } + } + else { + return uri; + } + } + if (LOG.isDebugEnabled()) { + LOG.debug("exhausted from ActionMapper that could return a uri"); + } + return null; + } + + + protected List getOrderedActionMapperEntries() { + if (this.orderedActionMappers == null || FileManager.isReloadingConfigs()) { + + List actionMapperEntriesContainer = new ArrayList(); + Iterator settings = Settings.list(); + while(settings.hasNext()) { + String setting = settings.next().toString(); + if (setting.startsWith(StrutsConstants.STRUTS_MAPPER_COMPOSITE)) { + try { + int order = Integer.valueOf(setting.substring(StrutsConstants.STRUTS_MAPPER_COMPOSITE.length(), setting.length())); + String propertyValue = Settings.get(setting); + if (propertyValue != null && propertyValue.trim().length() > 0) { + actionMapperEntriesContainer.add( + new IndividualActionMapperEntry(order, setting, propertyValue)); + } + else { + LOG.warn("Ignoring property "+setting+" that contains no value"); + } + } + catch(NumberFormatException e) { + LOG.warn("Ignoring malformed property "+setting); + } + } + } + + Collections.sort(actionMapperEntriesContainer, new Comparator() { + public int compare(IndividualActionMapperEntry o1, IndividualActionMapperEntry o2) { + return o1.compareTo(o2); + } + }); + + + ObjectFactory objectFactory = ObjectFactory.getObjectFactory(); + List result = new ArrayList(); + for (IndividualActionMapperEntry entry: actionMapperEntriesContainer) { + String actionMapperClassName = entry.propertyValue; + try { + // Let us get ClassCastException if it does not implement ActionMapper + ActionMapper actionMapper = (ActionMapper) objectFactory.buildBean(actionMapperClassName, null); + result.add(new IndividualActionMapperEntry(entry.order, entry.propertyName, entry.propertyValue, actionMapper)); + } + catch(Exception e) { + LOG.warn("failed to create action mapper "+actionMapperClassName+", ignoring it", e); + } + } + + this.orderedActionMappers = result; + } + + return this.orderedActionMappers; + } + + + /** + * A value object (holder) that holds information regarding {@link ActionMapper} this {@link CompositeActionMapper} + * is capable of delegating to. + *

    + * The information stored are :- + *

      + *
    • order
    • + *
    • propertyValue
    • + *
    • propertyName
    • + *
    • actionMapper
    • + *
    + * + * eg. if we have the following entry in struts.properties + *
    +     * struts.mapper.composite.1=foo.bar.ActionMapper1
    +     * struts.mapper.composite.2=foo.bar.ActionMapper2
    +     * struts.mapper.composite.3=foo.bar.ActionMapper3
    +     * 
    + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + *
    orderpropertyNamepropertyValueactionMapper
    1struts.mapper.composite.1foo.bar.ActionMapper1instance of foo.bar.ActionMapper1
    2struts.mapper.composite.2foo.bar.ActionMapper2instance of foo.bar.ActionMapper2
    3struts.mapper.composite.3foo.bar.ActionMapper3instance of foo.bar.ActionMapper3
    + * + * @version $Date$ $Id$ + */ + public class IndividualActionMapperEntry implements Comparable { + + public Integer order; + public String propertyValue; + public String propertyName; + public ActionMapper actionMapper; + + + private IndividualActionMapperEntry(Integer order, String propertyName, String propertyValue) { + assert(order != null); + assert(propertyValue != null); + assert(propertyName != null); + this.order = order; + this.propertyValue = propertyValue; + this.propertyName = propertyName; + } + + public IndividualActionMapperEntry(Integer order, String propertyName, String propertyValue, ActionMapper actionMapper) { + assert(order != null); + assert(propertyValue != null); + assert(propertyName != null); + assert(actionMapper != null); + this.order = order; + this.propertyValue = propertyValue; + this.propertyName = propertyName; + this.actionMapper = actionMapper; + } + + public int compareTo(IndividualActionMapperEntry o) { + return order - o.order; + } + } } diff --git a/core/src/main/java/org/apache/struts2/dispatcher/mapper/DefaultActionMapper.java b/core/src/main/java/org/apache/struts2/dispatcher/mapper/DefaultActionMapper.java index 86ac636d1..e6c5c63d7 100644 --- a/core/src/main/java/org/apache/struts2/dispatcher/mapper/DefaultActionMapper.java +++ b/core/src/main/java/org/apache/struts2/dispatcher/mapper/DefaultActionMapper.java @@ -1,19 +1,22 @@ /* * $Id$ * - * Copyright 2006 The Apache Software Foundation. + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at + * http://www.apache.org/licenses/LICENSE-2.0 * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. */ package org.apache.struts2.dispatcher.mapper; @@ -36,48 +39,48 @@ import com.opensymphony.xwork2.config.entities.PackageConfig; /** * - * + * * Default action mapper implementation, using the standard *.[ext] (where ext * usually "action") pattern. The extension is looked up from the Struts * configuration key struts.action.exection. - * + * *

    To help with dealing with buttons and other related requirements, this * mapper (and other {@link ActionMapper}s, we hope) has the ability to name a * button with some predefined prefix and have that button name alter the * execution behaviour. The four prefixes are: - * + * *

      - * + * *
    • Method prefix - method:default
    • - * + * *
    • Action prefix - action:dashboard
    • - * + * *
    • Redirect prefix - redirect:cancel.jsp
    • - * + * *
    • Redirect-action prefix - redirect-action:cancel
    • - * + * *
    - * + * *

    In addition to these four prefixes, this mapper also understands the * action naming pattern of foo!bar in either the extension form (eg: * foo!bar.action) or in the prefix form (eg: action:foo!bar). This syntax tells * this mapper to map to the action named foo and the method bar. - * + * * - * + * *

    Method Prefix

    - * + * * - * + * * With method-prefix, instead of calling baz action's execute() method (by * default if it isn't overriden in struts.xml to be something else), the baz * action's anotherMethod() will be called. A very elegant way determine which * button is clicked. Alternatively, one would have submit button set a * particular value on the action when clicked, and the execute() method decides * on what to do with the setted value depending on which button is clicked. - * + * * - * + * *

      *  <!-- START SNIPPET: method-example -->
      *  <a:form action="baz">
    @@ -87,18 +90,18 @@ import com.opensymphony.xwork2.config.entities.PackageConfig;
      *  </a:form>
      *  <!-- END SNIPPET: method-example -->
      * 
    - * + * *

    Action prefix

    - * + * * - * + * * With action-prefix, instead of executing baz action's execute() method (by * default if it isn't overriden in struts.xml to be something else), the * anotherAction action's execute() method (assuming again if it isn't overriden * with something else in struts.xml) will be executed. - * + * * - * + * *

      *  <!-- START SNIPPET: action-example -->
      *  <a:form action="baz">
    @@ -108,18 +111,18 @@ import com.opensymphony.xwork2.config.entities.PackageConfig;
      *  </a:form>
      *  <!-- END SNIPPET: action-example -->
      * 
    - * + * *

    Redirect prefix

    - * + * * - * + * * With redirect-prefix, instead of executing baz action's execute() method (by * default it isn't overriden in struts.xml to be something else), it will get * redirected to, in this case to www.google.com. Internally it uses * ServletRedirectResult to do the task. - * + * * - * + * *

      *  <!-- START SNIPPET: redirect-example -->
      *  <a:form action="baz">
    @@ -129,19 +132,19 @@ import com.opensymphony.xwork2.config.entities.PackageConfig;
      *  </a:form>
      *  <!-- END SNIPPET: redirect-example -->
      * 
    - * + * *

    Redirect-action prefix

    - * + * * - * + * * With redirect-action-prefix, instead of executing baz action's execute() * method (by default it isn't overriden in struts.xml to be something else), it * will get redirected to, in this case 'dashboard.action'. Internally it uses * ServletRedirectResult to do the task and read off the extension from the * struts.properties. - * + * * - * + * *

      *  <!-- START SNIPPET: redirect-action-example -->
      *  <a:form action="baz">
    @@ -151,7 +154,7 @@ import com.opensymphony.xwork2.config.entities.PackageConfig;
      *  </a:form>
      *  <!-- END SNIPPET: redirect-action-example -->
      * 
    - * + * */ public class DefaultActionMapper implements ActionMapper { @@ -164,7 +167,7 @@ public class DefaultActionMapper implements ActionMapper { static final String REDIRECT_ACTION_PREFIX = "redirect-action:"; private boolean allowDynamicMethodCalls = true; - + private boolean allowSlashesInActionNames = false; private PrefixTrie prefixTrie = null; @@ -174,12 +177,12 @@ public class DefaultActionMapper implements ActionMapper { allowDynamicMethodCalls = "true".equals(Settings .get(StrutsConstants.STRUTS_ENABLE_DYNAMIC_METHOD_INVOCATION)); } - + if (Settings.isSet(StrutsConstants.STRUTS_ENABLE_SLASHES_IN_ACTION_NAMES)) { allowSlashesInActionNames = "true".equals(Settings .get(StrutsConstants.STRUTS_ENABLE_SLASHES_IN_ACTION_NAMES)); } - + prefixTrie = new PrefixTrie() { { put(METHOD_PREFIX, new ParameterAction() { @@ -233,7 +236,7 @@ public class DefaultActionMapper implements ActionMapper { /* * (non-Javadoc) - * + * * @see org.apache.struts2.dispatcher.mapper.ActionMapper#getMapping(javax.servlet.http.HttpServletRequest) */ public ActionMapping getMapping(HttpServletRequest request, @@ -270,7 +273,7 @@ public class DefaultActionMapper implements ActionMapper { /** * Special parameters, as described in the class-level comment, are searched * for and handled. - * + * * @param request * The request * @param mapping @@ -294,7 +297,7 @@ public class DefaultActionMapper implements ActionMapper { /** * Parses the name and namespace from the uri - * + * * @param uri * The uri * @param mapping @@ -329,21 +332,21 @@ public class DefaultActionMapper implements ActionMapper { name = uri.substring(namespace.length() + 1); } - + if (!allowSlashesInActionNames && name != null) { int pos = name.lastIndexOf('/'); if (pos > -1 && pos < name.length() - 1) { name = name.substring(pos + 1); } } - + mapping.setNamespace(namespace); mapping.setName(name); } /** * Drops the extension from the action name - * + * * @param name * The action name * @return The action name without its extension @@ -392,7 +395,7 @@ public class DefaultActionMapper implements ActionMapper { /** * Gets the uri from the request - * + * * @param request * The request * @return The uri @@ -416,7 +419,7 @@ public class DefaultActionMapper implements ActionMapper { /* * (non-Javadoc) - * + * * @see org.apache.struts2.dispatcher.mapper.ActionMapper#getUriFromActionMapping(org.apache.struts2.dispatcher.mapper.ActionMapping) */ public String getUriFromActionMapping(ActionMapping mapping) { diff --git a/core/src/main/java/org/apache/struts2/dispatcher/mapper/Restful2ActionMapper.java b/core/src/main/java/org/apache/struts2/dispatcher/mapper/Restful2ActionMapper.java index 8a8c3ea93..95ef179fa 100644 --- a/core/src/main/java/org/apache/struts2/dispatcher/mapper/Restful2ActionMapper.java +++ b/core/src/main/java/org/apache/struts2/dispatcher/mapper/Restful2ActionMapper.java @@ -1,19 +1,22 @@ /* - * $Id: RestfulActionMapper.java 449367 2006-09-24 06:49:04Z mrdon $ + * $Id: $ * - * Copyright 2006 The Apache Software Foundation. + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at + * http://www.apache.org/licenses/LICENSE-2.0 * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. */ package org.apache.struts2.dispatcher.mapper; @@ -28,8 +31,8 @@ import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; /** - * - * + * + * * Improved restful action mapper that adds several ReST-style improvements to * action mapping, but supports fully-customized URL's via XML. The two primary * ReST enhancements are: @@ -74,7 +77,7 @@ import org.apache.commons.logging.LogFactory; * http://ryandaigle.com/articles/2006/08/01/whats-new-in-edge-rails-simply-restful-support-and-how-to-use-it * *

    - * + * * */ public class Restful2ActionMapper extends DefaultActionMapper { diff --git a/core/src/main/java/org/apache/struts2/dispatcher/mapper/RestfulActionMapper.java b/core/src/main/java/org/apache/struts2/dispatcher/mapper/RestfulActionMapper.java index 0389554cd..898c0d4b2 100644 --- a/core/src/main/java/org/apache/struts2/dispatcher/mapper/RestfulActionMapper.java +++ b/core/src/main/java/org/apache/struts2/dispatcher/mapper/RestfulActionMapper.java @@ -1,19 +1,22 @@ /* * $Id$ * - * Copyright 2006 The Apache Software Foundation. + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at + * http://www.apache.org/licenses/LICENSE-2.0 * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. */ package org.apache.struts2.dispatcher.mapper; @@ -34,7 +37,7 @@ import com.opensymphony.xwork2.config.ConfigurationManager; /** * - * + * * A custom action mapper using the following format: *

    *

    @@ -55,7 +58,7 @@ import com.opensymphony.xwork2.config.ConfigurationManager; *

    * Your action just needs a setArticleId() method, and requests such as /article/1, /article/2, etc will all map * to that URL pattern. - * + * * * */ diff --git a/core/src/main/java/org/apache/struts2/dispatcher/multipart/JakartaMultiPartRequest.java b/core/src/main/java/org/apache/struts2/dispatcher/multipart/JakartaMultiPartRequest.java index 4cb541e6d..176d0c8eb 100644 --- a/core/src/main/java/org/apache/struts2/dispatcher/multipart/JakartaMultiPartRequest.java +++ b/core/src/main/java/org/apache/struts2/dispatcher/multipart/JakartaMultiPartRequest.java @@ -1,19 +1,22 @@ /* * $Id$ * - * Copyright 2006 The Apache Software Foundation. + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at + * http://www.apache.org/licenses/LICENSE-2.0 * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. */ package org.apache.struts2.dispatcher.multipart; diff --git a/core/src/main/java/org/apache/struts2/dispatcher/multipart/MultiPartRequest.java b/core/src/main/java/org/apache/struts2/dispatcher/multipart/MultiPartRequest.java index 35fc41da0..68b3036c7 100644 --- a/core/src/main/java/org/apache/struts2/dispatcher/multipart/MultiPartRequest.java +++ b/core/src/main/java/org/apache/struts2/dispatcher/multipart/MultiPartRequest.java @@ -1,19 +1,22 @@ /* * $Id$ * - * Copyright 2006 The Apache Software Foundation. + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at + * http://www.apache.org/licenses/LICENSE-2.0 * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. */ package org.apache.struts2.dispatcher.multipart; diff --git a/core/src/main/java/org/apache/struts2/dispatcher/multipart/MultiPartRequestWrapper.java b/core/src/main/java/org/apache/struts2/dispatcher/multipart/MultiPartRequestWrapper.java index 3b754cb51..35ce509a0 100644 --- a/core/src/main/java/org/apache/struts2/dispatcher/multipart/MultiPartRequestWrapper.java +++ b/core/src/main/java/org/apache/struts2/dispatcher/multipart/MultiPartRequestWrapper.java @@ -1,19 +1,22 @@ /* * $Id$ * - * Copyright 2006 The Apache Software Foundation. + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at + * http://www.apache.org/licenses/LICENSE-2.0 * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. */ package org.apache.struts2.dispatcher.multipart; diff --git a/core/src/main/java/org/apache/struts2/impl/ActionContextImpl.java b/core/src/main/java/org/apache/struts2/impl/ActionContextImpl.java index bc61e0414..546413a2d 100644 --- a/core/src/main/java/org/apache/struts2/impl/ActionContextImpl.java +++ b/core/src/main/java/org/apache/struts2/impl/ActionContextImpl.java @@ -1,3 +1,23 @@ +/* + * $Id$ + * + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ // Copyright 2006 Google Inc. All Rights Reserved. package org.apache.struts2.impl; diff --git a/core/src/main/java/org/apache/struts2/impl/InterceptorAdapter.java b/core/src/main/java/org/apache/struts2/impl/InterceptorAdapter.java index 68e3d57ec..45067a525 100644 --- a/core/src/main/java/org/apache/struts2/impl/InterceptorAdapter.java +++ b/core/src/main/java/org/apache/struts2/impl/InterceptorAdapter.java @@ -1,3 +1,23 @@ +/* + * $Id$ + * + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ // Copyright 2006 Google Inc. All Rights Reserved. package org.apache.struts2.impl; diff --git a/core/src/main/java/org/apache/struts2/impl/MessagesImpl.java b/core/src/main/java/org/apache/struts2/impl/MessagesImpl.java index 32a759e37..9c7ed91d9 100644 --- a/core/src/main/java/org/apache/struts2/impl/MessagesImpl.java +++ b/core/src/main/java/org/apache/struts2/impl/MessagesImpl.java @@ -1,3 +1,23 @@ +/* + * $Id$ + * + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ // Copyright 2006 Google Inc. All Rights Reserved. package org.apache.struts2.impl; diff --git a/core/src/main/java/org/apache/struts2/impl/RequestContextImpl.java b/core/src/main/java/org/apache/struts2/impl/RequestContextImpl.java index 1d853806e..e9c3de916 100644 --- a/core/src/main/java/org/apache/struts2/impl/RequestContextImpl.java +++ b/core/src/main/java/org/apache/struts2/impl/RequestContextImpl.java @@ -1,3 +1,23 @@ +/* + * $Id$ + * + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ // Copyright 2006 Google Inc. All Rights Reserved. package org.apache.struts2.impl; diff --git a/core/src/main/java/org/apache/struts2/impl/ResultAdapter.java b/core/src/main/java/org/apache/struts2/impl/ResultAdapter.java index f71c8f32f..85e910707 100644 --- a/core/src/main/java/org/apache/struts2/impl/ResultAdapter.java +++ b/core/src/main/java/org/apache/struts2/impl/ResultAdapter.java @@ -1,3 +1,23 @@ +/* + * $Id$ + * + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ // Copyright 2006 Google Inc. All Rights Reserved. package org.apache.struts2.impl; diff --git a/core/src/main/java/org/apache/struts2/impl/StrutsActionProxy.java b/core/src/main/java/org/apache/struts2/impl/StrutsActionProxy.java index f13340531..1bed10810 100644 --- a/core/src/main/java/org/apache/struts2/impl/StrutsActionProxy.java +++ b/core/src/main/java/org/apache/struts2/impl/StrutsActionProxy.java @@ -1,3 +1,23 @@ +/* + * $Id$ + * + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ // Copyright 2006 Google Inc. All Rights Reserved. package org.apache.struts2.impl; diff --git a/core/src/main/java/org/apache/struts2/impl/StrutsActionProxyFactory.java b/core/src/main/java/org/apache/struts2/impl/StrutsActionProxyFactory.java index c55e5fd14..9630d7306 100644 --- a/core/src/main/java/org/apache/struts2/impl/StrutsActionProxyFactory.java +++ b/core/src/main/java/org/apache/struts2/impl/StrutsActionProxyFactory.java @@ -1,3 +1,23 @@ +/* + * $Id$ + * + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ // Copyright 2006 Google Inc. All Rights Reserved. package org.apache.struts2.impl; diff --git a/core/src/main/java/org/apache/struts2/impl/StrutsObjectFactory.java b/core/src/main/java/org/apache/struts2/impl/StrutsObjectFactory.java index dda52dfd6..f78d1fb0c 100644 --- a/core/src/main/java/org/apache/struts2/impl/StrutsObjectFactory.java +++ b/core/src/main/java/org/apache/struts2/impl/StrutsObjectFactory.java @@ -1,3 +1,23 @@ +/* + * $Id$ + * + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ // Copyright 2006 Google Inc. All Rights Reserved. package org.apache.struts2.impl; diff --git a/core/src/main/java/org/apache/struts2/impl/ValueStackAdapter.java b/core/src/main/java/org/apache/struts2/impl/ValueStackAdapter.java index 652a4fcdd..ae239cfa9 100644 --- a/core/src/main/java/org/apache/struts2/impl/ValueStackAdapter.java +++ b/core/src/main/java/org/apache/struts2/impl/ValueStackAdapter.java @@ -1,3 +1,23 @@ +/* + * $Id$ + * + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ // Copyright 2006 Google Inc. All Rights Reserved. package org.apache.struts2.impl; diff --git a/core/src/main/java/org/apache/struts2/interceptor/ApplicationAware.java b/core/src/main/java/org/apache/struts2/interceptor/ApplicationAware.java index 7c173c1e1..b9cc4aca8 100644 --- a/core/src/main/java/org/apache/struts2/interceptor/ApplicationAware.java +++ b/core/src/main/java/org/apache/struts2/interceptor/ApplicationAware.java @@ -1,19 +1,22 @@ /* * $Id$ * - * Copyright 2006 The Apache Software Foundation. + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at + * http://www.apache.org/licenses/LICENSE-2.0 * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. */ package org.apache.struts2.interceptor; diff --git a/core/src/main/java/org/apache/struts2/interceptor/BackgroundProcess.java b/core/src/main/java/org/apache/struts2/interceptor/BackgroundProcess.java index ba82b1719..c103f976d 100644 --- a/core/src/main/java/org/apache/struts2/interceptor/BackgroundProcess.java +++ b/core/src/main/java/org/apache/struts2/interceptor/BackgroundProcess.java @@ -1,19 +1,22 @@ /* * $Id$ * - * Copyright 2006 The Apache Software Foundation. + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at + * http://www.apache.org/licenses/LICENSE-2.0 * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. */ package org.apache.struts2.interceptor; @@ -26,10 +29,10 @@ import com.opensymphony.xwork2.ActionInvocation; * */ public class BackgroundProcess implements Serializable { - - private static final long serialVersionUID = 3884464776311686443L; - - protected Object action; + + private static final long serialVersionUID = 3884464776311686443L; + + protected Object action; protected ActionInvocation invocation; protected String result; protected Exception exception; @@ -37,7 +40,7 @@ public class BackgroundProcess implements Serializable { /** * Constructs a background process - * + * * @param threadName The thread name * @param invocation The action invocation * @param threadPriority The thread priority @@ -97,7 +100,7 @@ public class BackgroundProcess implements Serializable { /** * Retrieves the action invocation. - * + * * @return the action invocation */ public ActionInvocation getInvocation() { @@ -106,7 +109,7 @@ public class BackgroundProcess implements Serializable { /** * Gets the result of the background process. - * + * * @return the result; null if not done. */ public String getResult() { @@ -115,7 +118,7 @@ public class BackgroundProcess implements Serializable { /** * Gets the exception if any was thrown during the execution of the background process. - * + * * @return the exception or null if no exception was thrown. */ public Exception getException() { @@ -124,7 +127,7 @@ public class BackgroundProcess implements Serializable { /** * Returns the status of the background process. - * + * * @return true if finished, false otherwise */ public boolean isDone() { diff --git a/core/src/main/java/org/apache/struts2/interceptor/CheckboxInterceptor.java b/core/src/main/java/org/apache/struts2/interceptor/CheckboxInterceptor.java index b441dbb97..982109219 100644 --- a/core/src/main/java/org/apache/struts2/interceptor/CheckboxInterceptor.java +++ b/core/src/main/java/org/apache/struts2/interceptor/CheckboxInterceptor.java @@ -1,19 +1,22 @@ /* - * $Id: CheckboxListTest.java 439747 2006-09-03 09:22:46Z mrdon $ + * $Id: $ * - * Copyright 2006 The Apache Software Foundation. + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at + * http://www.apache.org/licenses/LICENSE-2.0 * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. */ package org.apache.struts2.interceptor; @@ -28,7 +31,7 @@ import java.util.Iterator; /** * * Looks for a hidden identification field that specifies the original value of the checkbox. - * If the checkbox isn't submitted, insert it into the parameters as if it was with the value + * If the checkbox isn't submitted, insert it into the parameters as if it was with the value * of 'false'. * *

    @@ -43,10 +46,10 @@ import java.util.Iterator; * */ public class CheckboxInterceptor implements Interceptor { - + /** Auto-generated serialization id */ private static final long serialVersionUID = -586878104807229585L; - + private String uncheckedValue = Boolean.FALSE.toString(); public void destroy() { @@ -82,7 +85,7 @@ public class CheckboxInterceptor implements Interceptor { /** * Overrides the default value for an unchecked checkbox - * + * * @param uncheckedValue The uncheckedValue to set */ public void setUncheckedValue(String uncheckedValue) { diff --git a/core/src/main/java/org/apache/struts2/interceptor/CreateSessionInterceptor.java b/core/src/main/java/org/apache/struts2/interceptor/CreateSessionInterceptor.java index a81dcd4f2..32d9daeca 100644 --- a/core/src/main/java/org/apache/struts2/interceptor/CreateSessionInterceptor.java +++ b/core/src/main/java/org/apache/struts2/interceptor/CreateSessionInterceptor.java @@ -1,19 +1,22 @@ /* * $Id$ * - * Copyright 2006 The Apache Software Foundation. + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at + * http://www.apache.org/licenses/LICENSE-2.0 * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. */ package org.apache.struts2.interceptor; @@ -32,18 +35,18 @@ import com.opensymphony.xwork2.interceptor.AbstractInterceptor; * This is particular usefull when using the <@s.token> tag in freemarker templates. * The tag do require that a HttpSession is already created since freemarker commits * the response to the client immediately. - * + * * * *

    Interceptor parameters: * * * - * + * *

      - *
    • none
    • + *
    • none
    • *
    - * + * * * * @@ -61,32 +64,32 @@ import com.opensymphony.xwork2.interceptor.AbstractInterceptor; * *
      * 
    - * 
    + *
      * <action name="someAction" class="com.examples.SomeAction">
      *     <interceptor-ref name="create-session"/>
      *     <interceptor-ref name="defaultStack"/>
      *     <result name="input">input_with_token_tag.ftl</result>
      * </action>
    - * 
    + *
      * 
      * 
    - * + * * @version $Date$ $Id$ */ public class CreateSessionInterceptor extends AbstractInterceptor { - - private static final long serialVersionUID = -4590322556118858869L; - - private static final Log _log = LogFactory.getLog(CreateSessionInterceptor.class); - - + + private static final long serialVersionUID = -4590322556118858869L; + + private static final Log _log = LogFactory.getLog(CreateSessionInterceptor.class); + + /* (non-Javadoc) * @see com.opensymphony.xwork2.interceptor.Interceptor#intercept(com.opensymphony.xwork2.ActionInvocation) */ public String intercept(ActionInvocation invocation) throws Exception { - _log.debug("Creating HttpSession"); - ServletActionContext.getRequest().getSession(true); + _log.debug("Creating HttpSession"); + ServletActionContext.getRequest().getSession(true); return invocation.invoke(); - } + } } diff --git a/core/src/main/java/org/apache/struts2/interceptor/ExecuteAndWaitInterceptor.java b/core/src/main/java/org/apache/struts2/interceptor/ExecuteAndWaitInterceptor.java index 0e821df7d..c3780a2f4 100644 --- a/core/src/main/java/org/apache/struts2/interceptor/ExecuteAndWaitInterceptor.java +++ b/core/src/main/java/org/apache/struts2/interceptor/ExecuteAndWaitInterceptor.java @@ -1,19 +1,22 @@ /* * $Id$ * - * Copyright 2006 The Apache Software Foundation. + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at + * http://www.apache.org/licenses/LICENSE-2.0 * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. */ package org.apache.struts2.interceptor; @@ -159,17 +162,17 @@ import com.opensymphony.xwork2.interceptor.MethodFilterInterceptor; * */ public class ExecuteAndWaitInterceptor extends MethodFilterInterceptor { - - private static final long serialVersionUID = -2754639196749652512L; - private static final Log LOG = LogFactory.getLog(ExecuteAndWaitInterceptor.class); + private static final long serialVersionUID = -2754639196749652512L; + + private static final Log LOG = LogFactory.getLog(ExecuteAndWaitInterceptor.class); public static final String KEY = "__execWait"; public static final String WAIT = "wait"; protected int delay; protected int delaySleepInterval = 100; // default sleep 100 millis before checking if background process is done protected boolean executeAfterValidationPass = false; - + private int threadPriority = Thread.NORM_PRIORITY; /* (non-Javadoc) @@ -180,7 +183,7 @@ public class ExecuteAndWaitInterceptor extends MethodFilterInterceptor { /** * Creates a new background process - * + * * @param name The process name * @param actionInvocation The action invocation * @param threadPriority The thread priority @@ -322,12 +325,12 @@ public class ExecuteAndWaitInterceptor extends MethodFilterInterceptor { /** * Whether to start the background process after the second pass (first being validation) * or not - * + * * @param executeAfterValidationPass the executeAfterValidationPass to set */ public void setExecuteAfterValidationPass(boolean executeAfterValidationPass) { this.executeAfterValidationPass = executeAfterValidationPass; } - - + + } diff --git a/core/src/main/java/org/apache/struts2/interceptor/FileUploadInterceptor.java b/core/src/main/java/org/apache/struts2/interceptor/FileUploadInterceptor.java index 3e90bc717..bf43216dd 100644 --- a/core/src/main/java/org/apache/struts2/interceptor/FileUploadInterceptor.java +++ b/core/src/main/java/org/apache/struts2/interceptor/FileUploadInterceptor.java @@ -1,19 +1,22 @@ /* * $Id$ * - * Copyright 2006 The Apache Software Foundation. + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at + * http://www.apache.org/licenses/LICENSE-2.0 * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. */ package org.apache.struts2.interceptor; @@ -156,10 +159,10 @@ import com.opensymphony.xwork2.util.LocalizedTextUtil; * */ public class FileUploadInterceptor extends AbstractInterceptor { - - private static final long serialVersionUID = -4764627478894962478L; - - protected static final Log log = LogFactory.getLog(FileUploadInterceptor.class); + + private static final long serialVersionUID = -4764627478894962478L; + + protected static final Log log = LogFactory.getLog(FileUploadInterceptor.class); private static final String DEFAULT_DELIMITER = ","; private static final String DEFAULT_MESSAGE = "no.message.found"; @@ -169,7 +172,7 @@ public class FileUploadInterceptor extends AbstractInterceptor { /** * Sets the allowed mimetypes - * + * * @param allowedTypes A comma-delimited list of types */ public void setAllowedTypes(String allowedTypes) { @@ -181,7 +184,7 @@ public class FileUploadInterceptor extends AbstractInterceptor { /** * Sets the maximum size of an uploaded file - * + * * @param maximumSize The maximum size in bytes */ public void setMaximumSize(Long maximumSize) { diff --git a/core/src/main/java/org/apache/struts2/interceptor/MessageStoreInterceptor.java b/core/src/main/java/org/apache/struts2/interceptor/MessageStoreInterceptor.java index 5fecf94ad..d76cf1a72 100644 --- a/core/src/main/java/org/apache/struts2/interceptor/MessageStoreInterceptor.java +++ b/core/src/main/java/org/apache/struts2/interceptor/MessageStoreInterceptor.java @@ -1,19 +1,22 @@ /* * $Id$ * - * Copyright 2006 The Apache Software Foundation. + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at + * http://www.apache.org/licenses/LICENSE-2.0 * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. */ package org.apache.struts2.interceptor; @@ -32,27 +35,27 @@ import com.opensymphony.xwork2.interceptor.Interceptor; /** * - * - * An interceptor to store {@link ValidationAware} action's messages / errors and field errors into + * + * An interceptor to store {@link ValidationAware} action's messages / errors and field errors into * Http Session, such that it will be retrieveable at a later stage. This allows the action's message / * errors and field errors to be available longer that just the particular http request. - * + * *

    - * - * In the 'STORE' mode, the interceptor will store the {@link ValidationAware} action's message / errors + * + * In the 'STORE' mode, the interceptor will store the {@link ValidationAware} action's message / errors * and field errors into Http session. - * + * *

    - * + * * In the 'RETRIEVE' mode, the interceptor will retrieve the stored action's message / errors and field * errors and put them back into the {@link ValidationAware} action. - * + * *

    - * + * * The interceptor does nothing in the 'NONE' mode, which is the default. - * + * *

    - * + * * The operation mode could be switched using :-

    * 1] Setting the iterceptor parameter eg. *

    @@ -64,267 +67,267 @@ import com.opensymphony.xwork2.interceptor.Interceptor;
      *      ....
      *   </action>
      * 
    - * + * * 2] Through request parameter (allowRequestParameterSwitch must be 'true' which is the default) *
      *   // the request will have the operation mode in 'STORE'
      *   http://localhost:8080/context/submitApplication.action?operationMode=STORE
      * 
    - * + * * - * - * + * + * * - * + * *
      - *
    • allowRequestParameterSwitch - To enable request parameter that could switch the operation mode - * of this interceptor.
    • - *
    • requestParameterSwitch - The request parameter that will indicate what mode this - * interceptor is in.
    • - *
    • operationMode - The operation mode this interceptor should be in - * (either 'STORE', 'RETRIEVE' or 'NONE'). 'NONE' being the default.
    • + *
    • allowRequestParameterSwitch - To enable request parameter that could switch the operation mode + * of this interceptor.
    • + *
    • requestParameterSwitch - The request parameter that will indicate what mode this + * interceptor is in.
    • + *
    • operationMode - The operation mode this interceptor should be in + * (either 'STORE', 'RETRIEVE' or 'NONE'). 'NONE' being the default.
    • *
    - * + * * - * + * *

    - * + * * - * + * * The following method could be overriden :- *

      - *
    • getRequestOperationMode - get the operation mode of this interceptor based on the request parameters
    • + *
    • getRequestOperationMode - get the operation mode of this interceptor based on the request parameters
    • *
    • mergeCollection - merge two collections
    • *
    • mergeMap - merge two map
    • *
    - * + * * - * + * *
      * 
    - * 
    + *
      * <action name="submitApplication" ....>
      *    <interceptor-ref name="store">
    - *    	<param name="operationMode">STORE</param>
    + *      <param name="operationMode">STORE</param>
      *    </interceptor-ref>
      *    <interceptor-ref name="defaultStack" />
      *    <result name="input" type="redirect">applicationFailed.action</result>
      *    <result type="dispatcher">applicationSuccess.jsp</result>
      * </action>
    - * 
    + *
      * <action name="applicationFailed" ....>
      *    <interceptor-ref name="store">
      *       <param name="operationMode">RETRIEVE</param>
      *    </interceptor-ref>
      *    <result>applicationFailed.jsp</result>
      * </action>
    - * 
    + *
      * 
      * 
    - * + * * - * + * * With the example above, 'submitApplication.action' will have the action messages / errors / field errors stored * in the Http Session. Later when needed, (in this case, when 'applicationFailed.action' is fired, it - * will get the action messages / errors / field errors stored in the Http Session and put them back into - * the action. - * + * will get the action messages / errors / field errors stored in the Http Session and put them back into + * the action. + * * - * + * * @version $Date$ $Id$ */ public class MessageStoreInterceptor implements Interceptor { - private static final long serialVersionUID = 4491997514314242420L; - - private static final Log _log = LogFactory.getLog(MessageStoreInterceptor.class); - - - public static final String STORE_MODE = "STORE"; - public static final String RETRIEVE_MODE = "RETRIEVE"; - public static final String NONE = "NONE"; - - private boolean allowRequestParameterSwitch = true; - private String requestParameterSwitch = "operationMode"; - private String operationMode = NONE; - - public static String fieldErrorsSessionKey = "__MessageStoreInterceptor_FieldErrors_SessionKey"; - public static String actionErrorsSessionKey = "__MessageStoreInterceptor_ActionErrors_SessionKey"; - public static String actionMessagesSessionKey = "__MessageStoreInterceptor_ActionMessages_SessionKey"; - - - - public void setAllowRequestParameterSwitch(boolean allowRequestParameterSwitch) { - this.allowRequestParameterSwitch = allowRequestParameterSwitch; - } - public boolean getAllowRequestParameterSwitch() { - return this.allowRequestParameterSwitch; - } - - - public void setRequestParameterSwitch(String requestParameterSwitch) { - this.requestParameterSwitch = requestParameterSwitch; - } - public String getRequestParameterSwitch() { - return this.requestParameterSwitch; - } - - - - public void setOperationMode(String operationMode) { - this.operationMode = operationMode; - } - public String getOperationModel() { - return this.operationMode; - } - + private static final long serialVersionUID = 4491997514314242420L; - public void destroy() { - } + private static final Log _log = LogFactory.getLog(MessageStoreInterceptor.class); - public void init() { - } - public String intercept(ActionInvocation invocation) throws Exception { - _log.debug("entering MessageStoreInterceptor ..."); - - before(invocation); - String result = invocation.invoke(); - after(invocation, result); - - _log.debug("exit executing MessageStoreInterceptor"); - return result; - } - - /** - * Handle the retrieving of field errors / action messages / field errors, which is - * done before action invocation, and the operationMode is 'RETRIEVE'. - * - * @param invocation - * @throws Exception - */ - protected void before(ActionInvocation invocation) throws Exception { - String reqOperationMode = getRequestOperationMode(invocation); - - if (RETRIEVE_MODE.equalsIgnoreCase(reqOperationMode) || - RETRIEVE_MODE.equalsIgnoreCase(operationMode)) { - - Object action = invocation.getAction(); - if (action instanceof ValidationAware) { - // retrieve error / message from session - Map session = (Map) invocation.getInvocationContext().get(ActionContext.SESSION); - ValidationAware validationAwareAction = (ValidationAware) action; - - _log.debug("retrieve error / message from session to populate into action ["+action+"]"); - - Collection actionErrors = (Collection) session.get(actionErrorsSessionKey); - Collection actionMessages = (Collection) session.get(actionMessagesSessionKey); - Map fieldErrors = (Map) session.get(fieldErrorsSessionKey); - - if (actionErrors != null && actionErrors.size() > 0) { - Collection mergedActionErrors = mergeCollection(validationAwareAction.getActionErrors(), actionErrors); - validationAwareAction.setActionErrors(mergedActionErrors); - } - - if (actionMessages != null && actionMessages.size() > 0) { - Collection mergedActionMessages = mergeCollection(validationAwareAction.getActionMessages(), actionMessages); - validationAwareAction.setActionMessages(mergedActionMessages); - } - - if (fieldErrors != null && fieldErrors.size() > 0) { - Map mergedFieldErrors = mergeMap(validationAwareAction.getFieldErrors(), fieldErrors); - validationAwareAction.setFieldErrors(mergedFieldErrors); - } - session.remove(actionErrorsSessionKey); - session.remove(actionMessagesSessionKey); - session.remove(fieldErrorsSessionKey); - } - } - } - - /** - * Handle the storing of field errors / action messages / field errors, which is - * done after action invocation, and the operationMode is in 'STORE'. - * - * @param invocation - * @param result - * @throws Exception - */ - protected void after(ActionInvocation invocation, String result) throws Exception { - - String reqOperationMode = getRequestOperationMode(invocation); - if (STORE_MODE.equalsIgnoreCase(reqOperationMode) || - STORE_MODE.equalsIgnoreCase(operationMode)) { - - Object action = invocation.getAction(); - if (action instanceof ValidationAware) { - // store error / messages into session - Map session = (Map) invocation.getInvocationContext().get(ActionContext.SESSION); - - _log.debug("store action ["+action+"] error/messages into session "); - - ValidationAware validationAwareAction = (ValidationAware) action; - session.put(actionErrorsSessionKey, validationAwareAction.getActionErrors()); - session.put(actionMessagesSessionKey, validationAwareAction.getActionMessages()); - session.put(fieldErrorsSessionKey, validationAwareAction.getFieldErrors()); - } - else { - _log.debug("Action ["+action+"] is not ValidationAware, no message / error that are storeable"); - } - } - } - - - /** - * Get the operationMode through request paramter, if allowRequestParameterSwitch - * is 'true', else it simply returns 'NONE', meaning its neither in the 'STORE_MODE' nor - * 'RETRIEVE_MODE'. - * - * @return String - */ - protected String getRequestOperationMode(ActionInvocation invocation) { - String reqOperationMode = NONE; - if (allowRequestParameterSwitch) { - Map reqParams = (Map) invocation.getInvocationContext().get(ActionContext.PARAMETERS); - boolean containsParameter = reqParams.containsKey(requestParameterSwitch); - if (containsParameter) { - String[] reqParamsArr = (String[]) reqParams.get(requestParameterSwitch); - if (reqParamsArr != null && reqParamsArr.length > 0) { - reqOperationMode = reqParamsArr[0]; - } - } - } - return reqOperationMode; - } - - /** - * Merge col1 and col2 and return the composite - * Collection. - * - * @param col1 - * @param col2 - * @return Collection - */ - protected Collection mergeCollection(Collection col1, Collection col2) { - Collection _col1 = (col1 == null ? new ArrayList() : col1); - Collection _col2 = (col2 == null ? new ArrayList() : col2); - _col1.addAll(_col2); - return _col1; - } - - /** - * Merge map1 and map2 and return the composite - * Map - * - * @param map1 - * @param map2 - * @return Map - */ - protected Map mergeMap(Map map1, Map map2) { - Map _map1 = (map1 == null ? new LinkedHashMap() : map1); - Map _map2 = (map2 == null ? new LinkedHashMap() : map2); - _map1.putAll(_map2); - return _map1; - } + public static final String STORE_MODE = "STORE"; + public static final String RETRIEVE_MODE = "RETRIEVE"; + public static final String NONE = "NONE"; + + private boolean allowRequestParameterSwitch = true; + private String requestParameterSwitch = "operationMode"; + private String operationMode = NONE; + + public static String fieldErrorsSessionKey = "__MessageStoreInterceptor_FieldErrors_SessionKey"; + public static String actionErrorsSessionKey = "__MessageStoreInterceptor_ActionErrors_SessionKey"; + public static String actionMessagesSessionKey = "__MessageStoreInterceptor_ActionMessages_SessionKey"; + + + + public void setAllowRequestParameterSwitch(boolean allowRequestParameterSwitch) { + this.allowRequestParameterSwitch = allowRequestParameterSwitch; + } + public boolean getAllowRequestParameterSwitch() { + return this.allowRequestParameterSwitch; + } + + + public void setRequestParameterSwitch(String requestParameterSwitch) { + this.requestParameterSwitch = requestParameterSwitch; + } + public String getRequestParameterSwitch() { + return this.requestParameterSwitch; + } + + + + public void setOperationMode(String operationMode) { + this.operationMode = operationMode; + } + public String getOperationModel() { + return this.operationMode; + } + + + public void destroy() { + } + + public void init() { + } + + public String intercept(ActionInvocation invocation) throws Exception { + _log.debug("entering MessageStoreInterceptor ..."); + + before(invocation); + String result = invocation.invoke(); + after(invocation, result); + + _log.debug("exit executing MessageStoreInterceptor"); + return result; + } + + /** + * Handle the retrieving of field errors / action messages / field errors, which is + * done before action invocation, and the operationMode is 'RETRIEVE'. + * + * @param invocation + * @throws Exception + */ + protected void before(ActionInvocation invocation) throws Exception { + String reqOperationMode = getRequestOperationMode(invocation); + + if (RETRIEVE_MODE.equalsIgnoreCase(reqOperationMode) || + RETRIEVE_MODE.equalsIgnoreCase(operationMode)) { + + Object action = invocation.getAction(); + if (action instanceof ValidationAware) { + // retrieve error / message from session + Map session = (Map) invocation.getInvocationContext().get(ActionContext.SESSION); + ValidationAware validationAwareAction = (ValidationAware) action; + + _log.debug("retrieve error / message from session to populate into action ["+action+"]"); + + Collection actionErrors = (Collection) session.get(actionErrorsSessionKey); + Collection actionMessages = (Collection) session.get(actionMessagesSessionKey); + Map fieldErrors = (Map) session.get(fieldErrorsSessionKey); + + if (actionErrors != null && actionErrors.size() > 0) { + Collection mergedActionErrors = mergeCollection(validationAwareAction.getActionErrors(), actionErrors); + validationAwareAction.setActionErrors(mergedActionErrors); + } + + if (actionMessages != null && actionMessages.size() > 0) { + Collection mergedActionMessages = mergeCollection(validationAwareAction.getActionMessages(), actionMessages); + validationAwareAction.setActionMessages(mergedActionMessages); + } + + if (fieldErrors != null && fieldErrors.size() > 0) { + Map mergedFieldErrors = mergeMap(validationAwareAction.getFieldErrors(), fieldErrors); + validationAwareAction.setFieldErrors(mergedFieldErrors); + } + session.remove(actionErrorsSessionKey); + session.remove(actionMessagesSessionKey); + session.remove(fieldErrorsSessionKey); + } + } + } + + /** + * Handle the storing of field errors / action messages / field errors, which is + * done after action invocation, and the operationMode is in 'STORE'. + * + * @param invocation + * @param result + * @throws Exception + */ + protected void after(ActionInvocation invocation, String result) throws Exception { + + String reqOperationMode = getRequestOperationMode(invocation); + if (STORE_MODE.equalsIgnoreCase(reqOperationMode) || + STORE_MODE.equalsIgnoreCase(operationMode)) { + + Object action = invocation.getAction(); + if (action instanceof ValidationAware) { + // store error / messages into session + Map session = (Map) invocation.getInvocationContext().get(ActionContext.SESSION); + + _log.debug("store action ["+action+"] error/messages into session "); + + ValidationAware validationAwareAction = (ValidationAware) action; + session.put(actionErrorsSessionKey, validationAwareAction.getActionErrors()); + session.put(actionMessagesSessionKey, validationAwareAction.getActionMessages()); + session.put(fieldErrorsSessionKey, validationAwareAction.getFieldErrors()); + } + else { + _log.debug("Action ["+action+"] is not ValidationAware, no message / error that are storeable"); + } + } + } + + + /** + * Get the operationMode through request paramter, if allowRequestParameterSwitch + * is 'true', else it simply returns 'NONE', meaning its neither in the 'STORE_MODE' nor + * 'RETRIEVE_MODE'. + * + * @return String + */ + protected String getRequestOperationMode(ActionInvocation invocation) { + String reqOperationMode = NONE; + if (allowRequestParameterSwitch) { + Map reqParams = (Map) invocation.getInvocationContext().get(ActionContext.PARAMETERS); + boolean containsParameter = reqParams.containsKey(requestParameterSwitch); + if (containsParameter) { + String[] reqParamsArr = (String[]) reqParams.get(requestParameterSwitch); + if (reqParamsArr != null && reqParamsArr.length > 0) { + reqOperationMode = reqParamsArr[0]; + } + } + } + return reqOperationMode; + } + + /** + * Merge col1 and col2 and return the composite + * Collection. + * + * @param col1 + * @param col2 + * @return Collection + */ + protected Collection mergeCollection(Collection col1, Collection col2) { + Collection _col1 = (col1 == null ? new ArrayList() : col1); + Collection _col2 = (col2 == null ? new ArrayList() : col2); + _col1.addAll(_col2); + return _col1; + } + + /** + * Merge map1 and map2 and return the composite + * Map + * + * @param map1 + * @param map2 + * @return Map + */ + protected Map mergeMap(Map map1, Map map2) { + Map _map1 = (map1 == null ? new LinkedHashMap() : map1); + Map _map2 = (map2 == null ? new LinkedHashMap() : map2); + _map1.putAll(_map2); + return _map1; + } } diff --git a/core/src/main/java/org/apache/struts2/interceptor/NoParameters.java b/core/src/main/java/org/apache/struts2/interceptor/NoParameters.java index 5fb3eb877..56615617d 100644 --- a/core/src/main/java/org/apache/struts2/interceptor/NoParameters.java +++ b/core/src/main/java/org/apache/struts2/interceptor/NoParameters.java @@ -1,19 +1,22 @@ /* * $Id$ * - * Copyright 2006 The Apache Software Foundation. + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at + * http://www.apache.org/licenses/LICENSE-2.0 * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. */ package org.apache.struts2.interceptor; diff --git a/core/src/main/java/org/apache/struts2/interceptor/ParameterAware.java b/core/src/main/java/org/apache/struts2/interceptor/ParameterAware.java index a1071c48a..e094196c3 100644 --- a/core/src/main/java/org/apache/struts2/interceptor/ParameterAware.java +++ b/core/src/main/java/org/apache/struts2/interceptor/ParameterAware.java @@ -1,19 +1,22 @@ /* * $Id$ * - * Copyright 2006 The Apache Software Foundation. + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at + * http://www.apache.org/licenses/LICENSE-2.0 * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. */ package org.apache.struts2.interceptor; diff --git a/core/src/main/java/org/apache/struts2/interceptor/PrincipalAware.java b/core/src/main/java/org/apache/struts2/interceptor/PrincipalAware.java index 891a86092..8b9c843ea 100644 --- a/core/src/main/java/org/apache/struts2/interceptor/PrincipalAware.java +++ b/core/src/main/java/org/apache/struts2/interceptor/PrincipalAware.java @@ -1,19 +1,22 @@ /* * $Id$ * - * Copyright 2006 The Apache Software Foundation. + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at + * http://www.apache.org/licenses/LICENSE-2.0 * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. */ package org.apache.struts2.interceptor; diff --git a/core/src/main/java/org/apache/struts2/interceptor/PrincipalProxy.java b/core/src/main/java/org/apache/struts2/interceptor/PrincipalProxy.java index e513071be..abea631d6 100644 --- a/core/src/main/java/org/apache/struts2/interceptor/PrincipalProxy.java +++ b/core/src/main/java/org/apache/struts2/interceptor/PrincipalProxy.java @@ -1,19 +1,22 @@ /* * $Id$ * - * Copyright 2006 The Apache Software Foundation. + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at + * http://www.apache.org/licenses/LICENSE-2.0 * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. */ package org.apache.struts2.interceptor; @@ -31,7 +34,7 @@ public class PrincipalProxy { /** * Constructs a proxy - * + * * @param request The underlying request */ public PrincipalProxy(HttpServletRequest request) { @@ -40,7 +43,7 @@ public class PrincipalProxy { /** * True if the user is in the given role - * + * * @param role The role * @return True if the user is in that role */ @@ -50,7 +53,7 @@ public class PrincipalProxy { /** * Gets the user principal - * + * * @return The principal */ public Principal getUserPrincipal() { @@ -59,7 +62,7 @@ public class PrincipalProxy { /** * Gets the user id - * + * * @return The user id */ public String getRemoteUser() { @@ -68,7 +71,7 @@ public class PrincipalProxy { /** * Is the request using https? - * + * * @return True if using https */ public boolean isRequestSecure() { @@ -77,7 +80,7 @@ public class PrincipalProxy { /** * Gets the request - * + * * @return The request */ public HttpServletRequest getRequest() { diff --git a/core/src/main/java/org/apache/struts2/interceptor/ProfilingActivationInterceptor.java b/core/src/main/java/org/apache/struts2/interceptor/ProfilingActivationInterceptor.java index d4743b125..1e091d6e6 100644 --- a/core/src/main/java/org/apache/struts2/interceptor/ProfilingActivationInterceptor.java +++ b/core/src/main/java/org/apache/struts2/interceptor/ProfilingActivationInterceptor.java @@ -1,19 +1,22 @@ /* - * $Id: CreateSessionInterceptor.java 439747 2006-09-03 09:22:46Z mrdon $ + * $Id: $ * - * Copyright 2006 The Apache Software Foundation. + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at + * http://www.apache.org/licenses/LICENSE-2.0 * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. */ package org.apache.struts2.interceptor; @@ -25,30 +28,30 @@ import com.opensymphony.xwork2.util.profiling.UtilTimerStack; /** * - * + * * Allows profiling to be enabled or disabled via request parameters, when * devMode is enabled. - * + * * - * - * + * + * * - * + * *
      *
    • profilingKey
    • *
    - * + * * - * + * * - * + * * none - * + * * - * + * *
      * 
    - * 
    + *
      * // to change the profiling key
      * 
      *   ...
    @@ -57,16 +60,16 @@ import com.opensymphony.xwork2.util.profiling.UtilTimerStack;
      *   
      *   ...
      * 
    - * 
    + *
      * 
      * 
    - * + * * @version $Date$ $Id$ */ public class ProfilingActivationInterceptor extends AbstractInterceptor { private String profilingKey = "profiling"; - + /** * @return the profilingKey */ @@ -93,7 +96,7 @@ public class ProfilingActivationInterceptor extends AbstractInterceptor { } } return invocation.invoke(); - + } } diff --git a/core/src/main/java/org/apache/struts2/interceptor/RequestAware.java b/core/src/main/java/org/apache/struts2/interceptor/RequestAware.java index 77b42d46b..76d1e1dc2 100644 --- a/core/src/main/java/org/apache/struts2/interceptor/RequestAware.java +++ b/core/src/main/java/org/apache/struts2/interceptor/RequestAware.java @@ -1,35 +1,39 @@ /* * $Id$ * - * Copyright 2006 The Apache Software Foundation. + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at + * http://www.apache.org/licenses/LICENSE-2.0 * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. */ + package org.apache.struts2.interceptor; import java.util.Map; /** * Actions that want access to the current serlvet request attributes should implement this interface.

    - * + * * This interface is only relevant if the Action is used in a servlet environment.

    - * + * * Note that using this interface makes the Action tied to a servlet environment, so it should be * avoided if possible since things like unit testing will become more difficult. */ public interface RequestAware { - /** + /** * Sets the Map of request attributes in the implementing class. * * @param request a Map of HTTP request attribute name/value pairs. diff --git a/core/src/main/java/org/apache/struts2/interceptor/RolesInterceptor.java b/core/src/main/java/org/apache/struts2/interceptor/RolesInterceptor.java index e031cf508..1ea85ee47 100644 --- a/core/src/main/java/org/apache/struts2/interceptor/RolesInterceptor.java +++ b/core/src/main/java/org/apache/struts2/interceptor/RolesInterceptor.java @@ -1,19 +1,22 @@ /* - * $Id: ScopeInterceptor.java 451544 2006-09-30 05:38:02Z mrdon $ + * $Id: $ * - * Copyright 2006 The Apache Software Foundation. + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at + * http://www.apache.org/licenses/LICENSE-2.0 * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. */ package org.apache.struts2.interceptor; @@ -34,7 +37,7 @@ import org.apache.struts2.ServletActionContext; * This interceptor ensures that the action * will only be executed if the user has the correct role. - * + * *

    Interceptor parameters: * * @@ -48,7 +51,7 @@ import org.apache.struts2.ServletActionContext; * * * - * + * * There are two extensions to the * existing interceptor: *

      @@ -58,7 +61,7 @@ import org.apache.struts2.ServletActionContext; * request. *
    * - * + * *
      *  <!-- START SNIPPET: example -->
      *  <!-- only allows the admin and member roles -->
    @@ -96,7 +99,7 @@ public class RolesInterceptor extends AbstractInterceptor {
             }
             return result;
         }
    -    
    +
         /**
          * Splits a string into a List
          */
    @@ -111,7 +114,7 @@ public class RolesInterceptor extends AbstractInterceptor {
     
         /**
          * Determines if the request should be allowed for the action
    -     * 
    +     *
          * @param request The request
          * @param action The action object
          * @return True if allowed, false otherwise
    @@ -137,7 +140,7 @@ public class RolesInterceptor extends AbstractInterceptor {
     
         /**
          * Handles a rejection by sending a 403 HTTP error
    -     * 
    +     *
          * @param invocation The invocation
          * @return The result code
          * @throws Exception
    diff --git a/core/src/main/java/org/apache/struts2/interceptor/ScopeInterceptor.java b/core/src/main/java/org/apache/struts2/interceptor/ScopeInterceptor.java
    index bcf63ab89..dea4e5923 100644
    --- a/core/src/main/java/org/apache/struts2/interceptor/ScopeInterceptor.java
    +++ b/core/src/main/java/org/apache/struts2/interceptor/ScopeInterceptor.java
    @@ -1,19 +1,22 @@
     /*
      * $Id$
      *
    - * Copyright 2006 The Apache Software Foundation.
    + * Licensed to the Apache Software Foundation (ASF) under one
    + * or more contributor license agreements.  See the NOTICE file
    + * distributed with this work for additional information
    + * regarding copyright ownership.  The ASF licenses this file
    + * to you under the Apache License, Version 2.0 (the
    + * "License"); you may not use this file except in compliance
    + * with the License.  You may obtain a copy of the License at
      *
    - * Licensed under the Apache License, Version 2.0 (the "License");
    - * you may not use this file except in compliance with the License.
    - * You may obtain a copy of the License at
    + *  http://www.apache.org/licenses/LICENSE-2.0
      *
    - *      http://www.apache.org/licenses/LICENSE-2.0
    - *
    - * Unless required by applicable law or agreed to in writing, software
    - * distributed under the License is distributed on an "AS IS" BASIS,
    - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
    - * See the License for the specific language governing permissions and
    - * limitations under the License.
    + * Unless required by applicable law or agreed to in writing,
    + * software distributed under the License is distributed on an
    + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
    + * KIND, either express or implied.  See the License for the
    + * specific language governing permissions and limitations
    + * under the License.
      */
     package org.apache.struts2.interceptor;
     
    @@ -135,9 +138,9 @@ import com.opensymphony.xwork2.util.ValueStack;
      */
     public class ScopeInterceptor extends AbstractInterceptor implements PreResultListener {
     
    -	private static final long serialVersionUID = 9120762699600054395L;
    +    private static final long serialVersionUID = 9120762699600054395L;
     
    -	private static final Log LOG = LogFactory.getLog(ScopeInterceptor.class);
    +    private static final Log LOG = LogFactory.getLog(ScopeInterceptor.class);
     
         private String[] application = null;
         private String[] session = null;
    @@ -149,7 +152,7 @@ public class ScopeInterceptor extends AbstractInterceptor implements PreResultLi
     
         /**
          * Sets a list of application scoped properties
    -     * 
    +     *
          * @param s A comma-delimited list
          */
         public void setApplication(String s) {
    @@ -160,7 +163,7 @@ public class ScopeInterceptor extends AbstractInterceptor implements PreResultLi
     
         /**
          * Sets a list of session scoped properties
    -     * 
    +     *
          * @param s A comma-delimited list
          */
         public void setSession(String s) {
    @@ -171,7 +174,7 @@ public class ScopeInterceptor extends AbstractInterceptor implements PreResultLi
     
         /**
          * Sets if the session should be automatically created
    -     * 
    +     *
          * @param value True if it should be created
          */
         public void setAutoCreateSession(String value) {
    @@ -373,14 +376,14 @@ public class ScopeInterceptor extends AbstractInterceptor implements PreResultLi
     
         /**
          * @return The type of scope operation, "start" or "end"
    -     */      
    +     */
         public String getType() {
             return type;
         }
     
         /**
          * Sets the type of scope operation
    -     * 
    +     *
          * @param type Either "start" or "end"
          */
         public void setType(String type) {
    diff --git a/core/src/main/java/org/apache/struts2/interceptor/ServletConfigInterceptor.java b/core/src/main/java/org/apache/struts2/interceptor/ServletConfigInterceptor.java
    index 96b1039ba..ea55c9f75 100644
    --- a/core/src/main/java/org/apache/struts2/interceptor/ServletConfigInterceptor.java
    +++ b/core/src/main/java/org/apache/struts2/interceptor/ServletConfigInterceptor.java
    @@ -1,19 +1,22 @@
     /*
      * $Id$
      *
    - * Copyright 2006 The Apache Software Foundation.
    + * Licensed to the Apache Software Foundation (ASF) under one
    + * or more contributor license agreements.  See the NOTICE file
    + * distributed with this work for additional information
    + * regarding copyright ownership.  The ASF licenses this file
    + * to you under the Apache License, Version 2.0 (the
    + * "License"); you may not use this file except in compliance
    + * with the License.  You may obtain a copy of the License at
      *
    - * Licensed under the Apache License, Version 2.0 (the "License");
    - * you may not use this file except in compliance with the License.
    - * You may obtain a copy of the License at
    + *  http://www.apache.org/licenses/LICENSE-2.0
      *
    - *      http://www.apache.org/licenses/LICENSE-2.0
    - *
    - * Unless required by applicable law or agreed to in writing, software
    - * distributed under the License is distributed on an "AS IS" BASIS,
    - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
    - * See the License for the specific language governing permissions and
    - * limitations under the License.
    + * Unless required by applicable law or agreed to in writing,
    + * software distributed under the License is distributed on an
    + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
    + * KIND, either express or implied.  See the License for the
    + * specific language governing permissions and limitations
    + * under the License.
      */
     package org.apache.struts2.interceptor;
     
    @@ -49,7 +52,7 @@ import com.opensymphony.xwork2.interceptor.AbstractInterceptor;
      * 
  • {@link ServletResponseAware}
  • * *
  • {@link ParameterAware}
  • - * + * *
  • {@link RequestAware}
  • * *
  • {@link SessionAware}
  • @@ -105,8 +108,8 @@ import com.opensymphony.xwork2.interceptor.AbstractInterceptor; * @see PrincipalAware */ public class ServletConfigInterceptor extends AbstractInterceptor implements StrutsStatics { - - private static final long serialVersionUID = 605261777858676638L; + + private static final long serialVersionUID = 605261777858676638L; /** * Sets action properties based on the interfaces an action implements. Things like application properties, @@ -132,9 +135,9 @@ public class ServletConfigInterceptor extends AbstractInterceptor implements Str if (action instanceof ParameterAware) { ((ParameterAware) action).setParameters(context.getParameters()); } - + if (action instanceof RequestAware) { - ((RequestAware) action).setRequest((Map) context.get("request")); + ((RequestAware) action).setRequest((Map) context.get("request")); } if (action instanceof SessionAware) { diff --git a/core/src/main/java/org/apache/struts2/interceptor/ServletRequestAware.java b/core/src/main/java/org/apache/struts2/interceptor/ServletRequestAware.java index d372a7089..09e5b8029 100644 --- a/core/src/main/java/org/apache/struts2/interceptor/ServletRequestAware.java +++ b/core/src/main/java/org/apache/struts2/interceptor/ServletRequestAware.java @@ -1,19 +1,22 @@ /* * $Id$ * - * Copyright 2006 The Apache Software Foundation. + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at + * http://www.apache.org/licenses/LICENSE-2.0 * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. */ package org.apache.struts2.interceptor; diff --git a/core/src/main/java/org/apache/struts2/interceptor/ServletResponseAware.java b/core/src/main/java/org/apache/struts2/interceptor/ServletResponseAware.java index 5fef895ee..0d6b6d293 100644 --- a/core/src/main/java/org/apache/struts2/interceptor/ServletResponseAware.java +++ b/core/src/main/java/org/apache/struts2/interceptor/ServletResponseAware.java @@ -1,19 +1,22 @@ /* * $Id$ * - * Copyright 2006 The Apache Software Foundation. + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at + * http://www.apache.org/licenses/LICENSE-2.0 * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. */ package org.apache.struts2.interceptor; diff --git a/core/src/main/java/org/apache/struts2/interceptor/SessionAware.java b/core/src/main/java/org/apache/struts2/interceptor/SessionAware.java index f21b999de..1b2f3155e 100644 --- a/core/src/main/java/org/apache/struts2/interceptor/SessionAware.java +++ b/core/src/main/java/org/apache/struts2/interceptor/SessionAware.java @@ -1,19 +1,22 @@ /* * $Id$ * - * Copyright 2006 The Apache Software Foundation. + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at + * http://www.apache.org/licenses/LICENSE-2.0 * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. */ package org.apache.struts2.interceptor; diff --git a/core/src/main/java/org/apache/struts2/interceptor/StrutsConversionErrorInterceptor.java b/core/src/main/java/org/apache/struts2/interceptor/StrutsConversionErrorInterceptor.java index 9938900ce..8e3f89a36 100644 --- a/core/src/main/java/org/apache/struts2/interceptor/StrutsConversionErrorInterceptor.java +++ b/core/src/main/java/org/apache/struts2/interceptor/StrutsConversionErrorInterceptor.java @@ -1,19 +1,22 @@ /* * $Id$ * - * Copyright 2006 The Apache Software Foundation. + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at + * http://www.apache.org/licenses/LICENSE-2.0 * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. */ package org.apache.struts2.interceptor; @@ -67,10 +70,10 @@ import com.opensymphony.xwork2.util.ValueStack; * @see ConversionErrorInterceptor */ public class StrutsConversionErrorInterceptor extends ConversionErrorInterceptor { - - private static final long serialVersionUID = 2759744840082921602L; - protected Object getOverrideExpr(ActionInvocation invocation, Object value) { + private static final long serialVersionUID = 2759744840082921602L; + + protected Object getOverrideExpr(ActionInvocation invocation, Object value) { ValueStack stack = invocation.getStack(); try { diff --git a/core/src/main/java/org/apache/struts2/interceptor/TokenInterceptor.java b/core/src/main/java/org/apache/struts2/interceptor/TokenInterceptor.java index 515c08388..9f850c249 100644 --- a/core/src/main/java/org/apache/struts2/interceptor/TokenInterceptor.java +++ b/core/src/main/java/org/apache/struts2/interceptor/TokenInterceptor.java @@ -1,19 +1,22 @@ /* * $Id$ * - * Copyright 2006 The Apache Software Foundation. + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at + * http://www.apache.org/licenses/LICENSE-2.0 * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. */ package org.apache.struts2.interceptor; @@ -36,24 +39,24 @@ import com.opensymphony.xwork2.util.LocalizedTextUtil; * invalid token is found: it returns the result invalid.token, which can be mapped in your action configuration. * A more complex implementation, {@link TokenSessionStoreInterceptor}, can provide much better logic for when invalid * tokens are found. - * + * *

    * * Note: To set a token in your form, you should use the token tag. This tag is required and must be used * in the forms that submit to actions protected by this interceptor. Any request that does not provide a token (using * the token tag) will be processed as a request with an invalid token. - * + * *

    - * + * * Internationalization Note: The following key could be used to internationalized the action errors generated * by this token interceptor - * + * *

      *
    • struts.messages.invalid.token
    • *
    - * + * *

    - * + * * NOTE: As this method extends off MethodFilterInterceptor, it is capable of * deciding if it is applicable only to selective methods in the action class. See * MethodFilterInterceptor for more info. @@ -88,23 +91,23 @@ import com.opensymphony.xwork2.util.LocalizedTextUtil; * *

      * 
    - * 
    + *
      * <action name="someAction" class="com.examples.SomeAction">
      *     <interceptor-ref name="token"/>
      *     <interceptor-ref name="basicStack"/>
      *     <result name="success">good_result.ftl</result>
      * </action>
    - * 
    - * <-- In this case, myMethod of the action class will not 
    + *
    + * <-- In this case, myMethod of the action class will not
      *        get checked for invalidity of token -->
      * <action name="someAction" class="com.examples.SomeAction">
      *     <interceptor-ref name="token">
    - *     	  <param name="excludeMethods">myMethod</param>
    + *        <param name="excludeMethods">myMethod</param>
      *     </interceptor-ref name="token"/>
      *     <interceptor-ref name="basicStack"/>
      *     <result name="success">good_result.ftl</result>
      * </action>
    - * 
    + *
      * 
      * 
    * @@ -112,10 +115,10 @@ import com.opensymphony.xwork2.util.LocalizedTextUtil; * @see TokenHelper */ public class TokenInterceptor extends MethodFilterInterceptor { - - private static final long serialVersionUID = -6680894220590585506L; - - public static final String INVALID_TOKEN_CODE = "invalid.token"; + + private static final long serialVersionUID = -6680894220590585506L; + + public static final String INVALID_TOKEN_CODE = "invalid.token"; /** * @see com.opensymphony.xwork2.interceptor.MethodFilterInterceptor#doIntercept(com.opensymphony.xwork2.ActionInvocation) diff --git a/core/src/main/java/org/apache/struts2/interceptor/TokenSessionStoreInterceptor.java b/core/src/main/java/org/apache/struts2/interceptor/TokenSessionStoreInterceptor.java index faedeeb77..4cf0a52f3 100644 --- a/core/src/main/java/org/apache/struts2/interceptor/TokenSessionStoreInterceptor.java +++ b/core/src/main/java/org/apache/struts2/interceptor/TokenSessionStoreInterceptor.java @@ -1,19 +1,22 @@ /* * $Id$ * - * Copyright 2006 The Apache Software Foundation. + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at + * http://www.apache.org/licenses/LICENSE-2.0 * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. */ package org.apache.struts2.interceptor; @@ -40,9 +43,9 @@ import com.opensymphony.xwork2.util.ValueStack; * complete, and then instead of returning the invalid.token code, it will attempt to display the same response * that the original, valid action invocation would have displayed if no multiple requests were submitted in the first * place. - * + * *

    - * + * * NOTE: As this method extends off MethodFilterInterceptor, it is capable of * deciding if it is applicable only to selective methods in the action class. See * MethodFilterInterceptor for more info. @@ -75,14 +78,14 @@ import com.opensymphony.xwork2.util.ValueStack; * *

      * 
    - * 
    + *
      * <action name="someAction" class="com.examples.SomeAction">
      *     <interceptor-ref name="token-session/>
      *     <interceptor-ref name="basicStack"/>
      *     <result name="success">good_result.ftl</result>
      * </action>
    - * 
    - * <-- In this case, myMethod of the action class will not 
    + *
    + * <-- In this case, myMethod of the action class will not
      *        get checked for invalidity of token -->
      * <action name="someAction" class="com.examples.SomeAction">
      *     <interceptor-ref name="token-session>
    @@ -91,19 +94,19 @@ import com.opensymphony.xwork2.util.ValueStack;
      *     <interceptor-ref name="basicStack"/>
      *     <result name="success">good_result.ftl</result>
      * </action>
    - * 
    + *
      * 
      * 
    * */ public class TokenSessionStoreInterceptor extends TokenInterceptor { - - private static final long serialVersionUID = -9032347965469098195L; - /* (non-Javadoc) - * @see org.apache.struts2.interceptor.TokenInterceptor#handleInvalidToken(com.opensymphony.xwork2.ActionInvocation) - */ - protected String handleInvalidToken(ActionInvocation invocation) throws Exception { + private static final long serialVersionUID = -9032347965469098195L; + + /* (non-Javadoc) + * @see org.apache.struts2.interceptor.TokenInterceptor#handleInvalidToken(com.opensymphony.xwork2.ActionInvocation) + */ + protected String handleInvalidToken(ActionInvocation invocation) throws Exception { ActionContext ac = invocation.getInvocationContext(); HttpServletRequest request = (HttpServletRequest) ac.get(ServletActionContext.HTTP_REQUEST); diff --git a/core/src/main/java/org/apache/struts2/interceptor/debugging/DebuggingInterceptor.java b/core/src/main/java/org/apache/struts2/interceptor/debugging/DebuggingInterceptor.java index 66535199e..d83f72e56 100644 --- a/core/src/main/java/org/apache/struts2/interceptor/debugging/DebuggingInterceptor.java +++ b/core/src/main/java/org/apache/struts2/interceptor/debugging/DebuggingInterceptor.java @@ -1,19 +1,22 @@ /* * $Id$ * - * Copyright 2006 The Apache Software Foundation. + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at + * http://www.apache.org/licenses/LICENSE-2.0 * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. */ package org.apache.struts2.interceptor.debugging; @@ -85,7 +88,7 @@ public class DebuggingInterceptor implements Interceptor { private final static String DEBUG_PARAM = "debug"; private final static String EXPRESSION_PARAM = "expression"; - + private boolean enableXmlWithConsole = false; @@ -352,7 +355,7 @@ public class DebuggingInterceptor implements Interceptor { this.enableXmlWithConsole = enableXmlWithConsole; } - - + + } diff --git a/core/src/main/java/org/apache/struts2/interceptor/debugging/PrettyPrintWriter.java b/core/src/main/java/org/apache/struts2/interceptor/debugging/PrettyPrintWriter.java index f73681424..6aed59f14 100644 --- a/core/src/main/java/org/apache/struts2/interceptor/debugging/PrettyPrintWriter.java +++ b/core/src/main/java/org/apache/struts2/interceptor/debugging/PrettyPrintWriter.java @@ -1,18 +1,22 @@ -package org.apache.struts2.interceptor.debugging; - -import java.io.PrintWriter; -import java.io.Writer; -import java.util.Stack; - -/** - * A simple writer that outputs XML in a pretty-printed indented stream. +/* + * $Id$ * - *

    By default, the chars

    & < > " ' \r are escaped and replaced with a suitable XML entity. - * To alter this behavior, override the the {@link #writeText(com.thoughtworks.xstream.core.util.QuickWriter, String)} - * and {@link #writeAttributeValue(com.thoughtworks.xstream.core.util.QuickWriter, String)} methods.

    + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at * - *

    This code was taken from the XStream project under the BSD license.

    + * http://www.apache.org/licenses/LICENSE-2.0 * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. */ public class PrettyPrintWriter { diff --git a/core/src/main/java/org/apache/struts2/portlet/PortletActionConstants.java b/core/src/main/java/org/apache/struts2/portlet/PortletActionConstants.java index 2d452a2cb..f913cb124 100644 --- a/core/src/main/java/org/apache/struts2/portlet/PortletActionConstants.java +++ b/core/src/main/java/org/apache/struts2/portlet/PortletActionConstants.java @@ -1,44 +1,47 @@ /* * $Id$ * - * Copyright 2006 The Apache Software Foundation. + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at + * http://www.apache.org/licenses/LICENSE-2.0 * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. */ package org.apache.struts2.portlet; /** * Interface defining some constants used in the Struts portlet implementation - * + * */ public interface PortletActionConstants { - /** - * Default action name to use when no default action has been configured in the portlet - * init parameters. - */ - String DEFAULT_ACTION_NAME = "default"; - - /** - * Action name parameter name - */ - String ACTION_PARAM = "struts.portlet.action"; - - /** - * Key for parameter holding the last executed portlet mode. - */ - String MODE_PARAM = "struts.portlet.mode"; - - /** + /** + * Default action name to use when no default action has been configured in the portlet + * init parameters. + */ + String DEFAULT_ACTION_NAME = "default"; + + /** + * Action name parameter name + */ + String ACTION_PARAM = "struts.portlet.action"; + + /** + * Key for parameter holding the last executed portlet mode. + */ + String MODE_PARAM = "struts.portlet.mode"; + + /** * Key used for looking up and storing the portlet phase */ String PHASE = "struts.portlet.phase"; @@ -66,7 +69,7 @@ public interface PortletActionConstants { * {@link javax.portlet.PortletResponse} */ String RESPONSE = "struts.portlet.response"; - + /** * Key used for looking up and storing the action that was invoked in the event phase. */ @@ -84,19 +87,19 @@ public interface PortletActionConstants { String ERROR_ACTION = "errorHandler"; /** - * Key for the portlet namespace stored in the + * Key for the portlet namespace stored in the * {@link org.apache.struts2.portlet.context.PortletActionContext}. */ String PORTLET_NAMESPACE = "struts.portlet.portletNamespace"; - + /** - * Key for the mode-to-namespace map stored in the + * Key for the mode-to-namespace map stored in the * {@link org.apache.struts2.portlet.context.PortletActionContext}. */ String MODE_NAMESPACE_MAP = "struts.portlet.modeNamespaceMap"; - + /** - * Key for the default action name for the portlet, stored in the + * Key for the default action name for the portlet, stored in the * {@link org.apache.struts2.portlet.context.PortletActionContext}. */ String DEFAULT_ACTION_FOR_MODE = "struts.portlet.defaultActionForMode"; diff --git a/core/src/main/java/org/apache/struts2/portlet/PortletApplicationMap.java b/core/src/main/java/org/apache/struts2/portlet/PortletApplicationMap.java index 34c5223c4..76ee49f38 100644 --- a/core/src/main/java/org/apache/struts2/portlet/PortletApplicationMap.java +++ b/core/src/main/java/org/apache/struts2/portlet/PortletApplicationMap.java @@ -1,19 +1,22 @@ /* * $Id$ * - * Copyright 2006 The Apache Software Foundation. + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at + * http://www.apache.org/licenses/LICENSE-2.0 * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. */ package org.apache.struts2.portlet; @@ -29,175 +32,175 @@ import javax.portlet.PortletContext; /** * Portlet specific {@link java.util.Map} implementation representing the * {@link javax.portlet.PortletContext} of a Portlet. - * + * */ public class PortletApplicationMap extends AbstractMap implements Serializable { - private static final long serialVersionUID = 2296107511063504414L; + private static final long serialVersionUID = 2296107511063504414L; private PortletContext context; - private Set entries; + private Set entries; - /** - * Creates a new map object given the {@link PortletContext}. - * - * @param ctx The portlet context. - */ - public PortletApplicationMap(PortletContext ctx) { - this.context = ctx; - } + /** + * Creates a new map object given the {@link PortletContext}. + * + * @param ctx The portlet context. + */ + public PortletApplicationMap(PortletContext ctx) { + this.context = ctx; + } - /** - * Removes all entries from the Map and removes all attributes from the - * portlet context. - */ - public void clear() { - entries = null; + /** + * Removes all entries from the Map and removes all attributes from the + * portlet context. + */ + public void clear() { + entries = null; - Enumeration e = context.getAttributeNames(); + Enumeration e = context.getAttributeNames(); - while (e.hasMoreElements()) { - context.removeAttribute(e.nextElement().toString()); - } - } + while (e.hasMoreElements()) { + context.removeAttribute(e.nextElement().toString()); + } + } - /** - * Creates a Set of all portlet context attributes as well as context init - * parameters. - * - * @return a Set of all portlet context attributes as well as context init - * parameters. - */ - public Set entrySet() { - if (entries == null) { - entries = new HashSet(); + /** + * Creates a Set of all portlet context attributes as well as context init + * parameters. + * + * @return a Set of all portlet context attributes as well as context init + * parameters. + */ + public Set entrySet() { + if (entries == null) { + entries = new HashSet(); - // Add portlet context attributes - Enumeration enumeration = context.getAttributeNames(); + // Add portlet context attributes + Enumeration enumeration = context.getAttributeNames(); - while (enumeration.hasMoreElements()) { - final String key = enumeration.nextElement().toString(); - final Object value = context.getAttribute(key); - entries.add(new Map.Entry() { - public boolean equals(Object obj) { - Map.Entry entry = (Map.Entry) obj; + while (enumeration.hasMoreElements()) { + final String key = enumeration.nextElement().toString(); + final Object value = context.getAttribute(key); + entries.add(new Map.Entry() { + public boolean equals(Object obj) { + Map.Entry entry = (Map.Entry) obj; - return ((key == null) ? (entry.getKey() == null) : key - .equals(entry.getKey())) - && ((value == null) ? (entry.getValue() == null) - : value.equals(entry.getValue())); - } + return ((key == null) ? (entry.getKey() == null) : key + .equals(entry.getKey())) + && ((value == null) ? (entry.getValue() == null) + : value.equals(entry.getValue())); + } - public int hashCode() { - return ((key == null) ? 0 : key.hashCode()) - ^ ((value == null) ? 0 : value.hashCode()); - } + public int hashCode() { + return ((key == null) ? 0 : key.hashCode()) + ^ ((value == null) ? 0 : value.hashCode()); + } - public Object getKey() { - return key; - } + public Object getKey() { + return key; + } - public Object getValue() { - return value; - } + public Object getValue() { + return value; + } - public Object setValue(Object obj) { - context.setAttribute(key.toString(), obj); + public Object setValue(Object obj) { + context.setAttribute(key.toString(), obj); - return value; - } - }); - } + return value; + } + }); + } - // Add portlet context init params - enumeration = context.getInitParameterNames(); + // Add portlet context init params + enumeration = context.getInitParameterNames(); - while (enumeration.hasMoreElements()) { - final String key = enumeration.nextElement().toString(); - final Object value = context.getInitParameter(key); - entries.add(new Map.Entry() { - public boolean equals(Object obj) { - Map.Entry entry = (Map.Entry) obj; + while (enumeration.hasMoreElements()) { + final String key = enumeration.nextElement().toString(); + final Object value = context.getInitParameter(key); + entries.add(new Map.Entry() { + public boolean equals(Object obj) { + Map.Entry entry = (Map.Entry) obj; - return ((key == null) ? (entry.getKey() == null) : key - .equals(entry.getKey())) - && ((value == null) ? (entry.getValue() == null) - : value.equals(entry.getValue())); - } + return ((key == null) ? (entry.getKey() == null) : key + .equals(entry.getKey())) + && ((value == null) ? (entry.getValue() == null) + : value.equals(entry.getValue())); + } - public int hashCode() { - return ((key == null) ? 0 : key.hashCode()) - ^ ((value == null) ? 0 : value.hashCode()); - } + public int hashCode() { + return ((key == null) ? 0 : key.hashCode()) + ^ ((value == null) ? 0 : value.hashCode()); + } - public Object getKey() { - return key; - } + public Object getKey() { + return key; + } - public Object getValue() { - return value; - } + public Object getValue() { + return value; + } - public Object setValue(Object obj) { - context.setAttribute(key.toString(), obj); + public Object setValue(Object obj) { + context.setAttribute(key.toString(), obj); - return value; - } - }); - } - } + return value; + } + }); + } + } - return entries; - } + return entries; + } - /** - * Returns the portlet context attribute or init parameter based on the - * given key. If the entry is not found, null is returned. - * - * @param key - * the entry key. - * @return the portlet context attribute or init parameter or null - * if the entry is not found. - */ - public Object get(Object key) { - // Try context attributes first, then init params - // This gives the proper shadowing effects - String keyString = key.toString(); - Object value = context.getAttribute(keyString); + /** + * Returns the portlet context attribute or init parameter based on the + * given key. If the entry is not found, null is returned. + * + * @param key + * the entry key. + * @return the portlet context attribute or init parameter or null + * if the entry is not found. + */ + public Object get(Object key) { + // Try context attributes first, then init params + // This gives the proper shadowing effects + String keyString = key.toString(); + Object value = context.getAttribute(keyString); - return (value == null) ? context.getInitParameter(keyString) : value; - } + return (value == null) ? context.getInitParameter(keyString) : value; + } - /** - * Sets a portlet context attribute given a attribute name and value. - * - * @param key - * the name of the attribute. - * @param value - * the value to set. - * @return the attribute that was just set. - */ - public Object put(Object key, Object value) { - entries = null; - context.setAttribute(key.toString(), value); + /** + * Sets a portlet context attribute given a attribute name and value. + * + * @param key + * the name of the attribute. + * @param value + * the value to set. + * @return the attribute that was just set. + */ + public Object put(Object key, Object value) { + entries = null; + context.setAttribute(key.toString(), value); - return get(key); - } + return get(key); + } - /** - * Removes the specified portlet context attribute. - * - * @param key - * the attribute to remove. - * @return the entry that was just removed. - */ - public Object remove(Object key) { - entries = null; + /** + * Removes the specified portlet context attribute. + * + * @param key + * the attribute to remove. + * @return the entry that was just removed. + */ + public Object remove(Object key) { + entries = null; - Object value = get(key); - context.removeAttribute(key.toString()); + Object value = get(key); + context.removeAttribute(key.toString()); - return value; - } + return value; + } } diff --git a/core/src/main/java/org/apache/struts2/portlet/PortletRequestMap.java b/core/src/main/java/org/apache/struts2/portlet/PortletRequestMap.java index b76b5baa3..d70e6d0df 100644 --- a/core/src/main/java/org/apache/struts2/portlet/PortletRequestMap.java +++ b/core/src/main/java/org/apache/struts2/portlet/PortletRequestMap.java @@ -1,19 +1,22 @@ /* * $Id$ * - * Copyright 2006 The Apache Software Foundation. + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at + * http://www.apache.org/licenses/LICENSE-2.0 * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. */ package org.apache.struts2.portlet; @@ -30,12 +33,12 @@ import org.apache.commons.logging.LogFactory; /** * A simple implementation of the {@link java.util.Map} interface to handle a collection of request attributes. - * + * */ public class PortletRequestMap extends AbstractMap { private static final Log LOG = LogFactory.getLog(PortletRequestMap.class); - + private Set entries = null; private PortletRequest request = null; @@ -73,7 +76,7 @@ public class PortletRequestMap extends AbstractMap { /** * Returns a Set of attributes from the portlet request. - * + * * @return a Set of attributes from the portlet request. */ public Set entrySet() { @@ -123,7 +126,7 @@ public class PortletRequestMap extends AbstractMap { /** * Returns the request attribute associated with the given key or * null if it doesn't exist. - * + * * @param key the name of the request attribute. * @return the request attribute or null if it doesn't exist. */ @@ -133,7 +136,7 @@ public class PortletRequestMap extends AbstractMap { /** * Saves an attribute in the request. - * + * * @param key the name of the request attribute. * @param value the value to set. * @return the object that was just set. @@ -147,7 +150,7 @@ public class PortletRequestMap extends AbstractMap { /** * Removes the specified request attribute. - * + * * @param key the name of the attribute to remove. * @return the value that was removed or null if the value was * not found (and hence, not removed). diff --git a/core/src/main/java/org/apache/struts2/portlet/PortletSessionMap.java b/core/src/main/java/org/apache/struts2/portlet/PortletSessionMap.java index b3ff045f6..2d76559bb 100644 --- a/core/src/main/java/org/apache/struts2/portlet/PortletSessionMap.java +++ b/core/src/main/java/org/apache/struts2/portlet/PortletSessionMap.java @@ -1,19 +1,22 @@ /* * $Id$ * - * Copyright 2006 The Apache Software Foundation. + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at + * http://www.apache.org/licenses/LICENSE-2.0 * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. */ package org.apache.struts2.portlet; @@ -33,17 +36,17 @@ import org.apache.commons.logging.LogFactory; * A simple implementation of the {@link java.util.Map} interface to handle a collection of portlet session * attributes. The {@link #entrySet()} method enumerates over all session attributes and creates a Set of entries. * Note, this will occur lazily - only when the entry set is asked for. - * + * */ public class PortletSessionMap extends AbstractMap { - + private static final Log LOG = LogFactory.getLog(PortletSessionMap.class); private PortletSession session = null; private Set entries = null; /** - * Creates a new session map given a portlet request. + * Creates a new session map given a portlet request. * * @param request the portlet request object. */ @@ -112,7 +115,7 @@ public class PortletSessionMap extends AbstractMap { /** * Returns the session attribute associated with the given key or * null if it doesn't exist. - * + * * @param key the name of the session attribute. * @return the session attribute or null if it doesn't exist. */ @@ -124,7 +127,7 @@ public class PortletSessionMap extends AbstractMap { /** * Saves an attribute in the session. - * + * * @param key the name of the session attribute. * @param value the value to set. * @return the object that was just set. @@ -150,7 +153,7 @@ public class PortletSessionMap extends AbstractMap { /** * Removes the specified session attribute. - * + * * @param key the name of the attribute to remove. * @return the value that was removed or null if the value was * not found (and hence, not removed). diff --git a/core/src/main/java/org/apache/struts2/portlet/context/PortletActionContext.java b/core/src/main/java/org/apache/struts2/portlet/context/PortletActionContext.java index 86870b409..e3bc45330 100644 --- a/core/src/main/java/org/apache/struts2/portlet/context/PortletActionContext.java +++ b/core/src/main/java/org/apache/struts2/portlet/context/PortletActionContext.java @@ -1,19 +1,22 @@ /* * $Id$ * - * Copyright 2006 The Apache Software Foundation. + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at + * http://www.apache.org/licenses/LICENSE-2.0 * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. */ package org.apache.struts2.portlet.context; @@ -34,7 +37,7 @@ import com.opensymphony.xwork2.ActionContext; /** * PortletActionContext. ActionContext thread local for the portlet environment. - * + * * @version $Revision$ $Date$ */ public class PortletActionContext implements PortletActionConstants { @@ -103,7 +106,7 @@ public class PortletActionContext implements PortletActionConstants { } return (ActionResponse) getContext().get(RESPONSE); } - + /** * Get the action namespace of the portlet. Used to organize actions for multiple portlets in * the same portlet application. @@ -162,7 +165,7 @@ public class PortletActionContext implements PortletActionConstants { private static ActionContext getContext() { return ActionContext.getContext(); } - + /** * Check to see if the current request is a portlet request. * @@ -183,7 +186,7 @@ public class PortletActionContext implements PortletActionConstants { /** * Get the namespace to mode mappings. - * + * * @return The map of the namespaces for each mode. */ public static Map getModeNamespaceMap() { diff --git a/core/src/main/java/org/apache/struts2/portlet/context/PreparatorServlet.java b/core/src/main/java/org/apache/struts2/portlet/context/PreparatorServlet.java index 181229de0..42a9951a4 100644 --- a/core/src/main/java/org/apache/struts2/portlet/context/PreparatorServlet.java +++ b/core/src/main/java/org/apache/struts2/portlet/context/PreparatorServlet.java @@ -1,19 +1,22 @@ /* * $Id$ * - * Copyright 2006 The Apache Software Foundation. + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at + * http://www.apache.org/licenses/LICENSE-2.0 * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. */ package org.apache.struts2.portlet.context; @@ -32,18 +35,18 @@ import org.apache.struts2.StrutsStatics; import com.opensymphony.xwork2.ActionContext; /** - * Since a portlet is not dispatched the same way as a servlet, the - * {@link org.apache.struts2.ServletActionContext} is not immediately available, as it + * Since a portlet is not dispatched the same way as a servlet, the + * {@link org.apache.struts2.ServletActionContext} is not immediately available, as it * depends on objects from the servlet API. However, the WW2 view implementations require access * to the objects in the {@link org.apache.struts2.ServletActionContext}, and this servlet * makes sure that these are available when the portlet actions are executing the render results. - * + * */ public class PreparatorServlet extends HttpServlet implements StrutsStatics { - private static final long serialVersionUID = 1853399729352984089L; - - private final static Log LOG = LogFactory.getLog(PreparatorServlet.class); + private static final long serialVersionUID = 1853399729352984089L; + + private final static Log LOG = LogFactory.getLog(PreparatorServlet.class); /** * Prepares the {@link org.apache.struts2.ServletActionContext} with the diff --git a/core/src/main/java/org/apache/struts2/portlet/context/ServletContextHolderListener.java b/core/src/main/java/org/apache/struts2/portlet/context/ServletContextHolderListener.java index 23d174b52..74e799484 100644 --- a/core/src/main/java/org/apache/struts2/portlet/context/ServletContextHolderListener.java +++ b/core/src/main/java/org/apache/struts2/portlet/context/ServletContextHolderListener.java @@ -1,19 +1,22 @@ /* * $Id$ * - * Copyright 2006 The Apache Software Foundation. + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at + * http://www.apache.org/licenses/LICENSE-2.0 * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. */ package org.apache.struts2.portlet.context; @@ -22,12 +25,12 @@ import javax.servlet.ServletContextEvent; import javax.servlet.ServletContextListener; /** - * Some of the factory/managers (e.g. the ObjectFactory) need access to + * Some of the factory/managers (e.g. the ObjectFactory) need access to * the {@link org.apache.struts2.ServletActionContext} object when initializing. - * This {@link javax.servlet.ServletContextListener} keeps a reference to the + * This {@link javax.servlet.ServletContextListener} keeps a reference to the * {@link javax.servlet.ServletContext} and exposes it through a public static * method. - * + * */ public class ServletContextHolderListener implements ServletContextListener { @@ -42,19 +45,19 @@ public class ServletContextHolderListener implements ServletContextListener { /** * Stores the reference to the {@link ServletContext}. - * + * * @see javax.servlet.ServletContextListener#contextInitialized(javax.servlet.ServletContextEvent) */ public void contextInitialized(ServletContextEvent event) { context = event.getServletContext(); - + } /** * @see javax.servlet.ServletContextListener#contextDestroyed(javax.servlet.ServletContextEvent) */ public void contextDestroyed(ServletContextEvent event) { - context = null; + context = null; } } diff --git a/core/src/main/java/org/apache/struts2/portlet/dispatcher/DirectRenderFromEventAction.java b/core/src/main/java/org/apache/struts2/portlet/dispatcher/DirectRenderFromEventAction.java index 7a9172a49..4028b5604 100644 --- a/core/src/main/java/org/apache/struts2/portlet/dispatcher/DirectRenderFromEventAction.java +++ b/core/src/main/java/org/apache/struts2/portlet/dispatcher/DirectRenderFromEventAction.java @@ -1,19 +1,22 @@ /* * $Id$ * - * Copyright 2006 The Apache Software Foundation. + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at + * http://www.apache.org/licenses/LICENSE-2.0 * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. */ package org.apache.struts2.portlet.dispatcher; diff --git a/core/src/main/java/org/apache/struts2/portlet/dispatcher/Jsr168Dispatcher.java b/core/src/main/java/org/apache/struts2/portlet/dispatcher/Jsr168Dispatcher.java index 321bff6dc..27c075ef7 100644 --- a/core/src/main/java/org/apache/struts2/portlet/dispatcher/Jsr168Dispatcher.java +++ b/core/src/main/java/org/apache/struts2/portlet/dispatcher/Jsr168Dispatcher.java @@ -1,19 +1,22 @@ /* * $Id$ * - * Copyright 2006 The Apache Software Foundation. + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at + * http://www.apache.org/licenses/LICENSE-2.0 * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. */ package org.apache.struts2.portlet.dispatcher; @@ -70,55 +73,55 @@ import com.opensymphony.xwork2.util.LocalizedTextUtil; * but adjusted to a portal environment. The portlet is configured through the portlet.xml * descriptor. Examples and descriptions follow below: *

    - * - * + * + * * @author Nils-Helge Garli * @author Rainer Hermanns - * + * *

    Init parameters

    * * * - * + * * * * * - * + * * * - * + * * * - * + * * * - * + * * * * + * specified * * * + * specified * * * + * specified * *
    NameNameDescriptionDefault value
    portletNamespaceThe namespace for the portlet in the xwork configuration. This - * namespace is prepended to all action lookups, and makes it possible to host multiple - * portlets in the same portlet application. If this parameter is set, the complete namespace - * will be /portletNamespace/modeNamespace/actionNameThe default namespaceportletNamespaceThe namespace for the portlet in the xwork configuration. This + * namespace is prepended to all action lookups, and makes it possible to host multiple + * portlets in the same portlet application. If this parameter is set, the complete namespace + * will be /portletNamespace/modeNamespace/actionNameThe default namespace
    viewNamespaceBase namespace in the xwork configuration for the view portlet - * modeThe default namespaceviewNamespaceBase namespace in the xwork configuration for the view portlet + * modeThe default namespace
    editNamespaceBase namespace in the xwork configuration for the edit portlet - * modeThe default namespaceeditNamespaceBase namespace in the xwork configuration for the edit portlet + * modeThe default namespace
    helpNamespaceBase namespace in the xwork configuration for the help portlet - * modeThe default namespacehelpNamespaceBase namespace in the xwork configuration for the help portlet + * modeThe default namespace
    defaultViewActionDefault action to invoke in the view portlet mode if no action is - * specifieddefaultdefault
    defaultEditActionDefault action to invoke in the edit portlet mode if no action is - * specifieddefaultdefault
    defaultHelpActionDefault action to invoke in the help portlet mode if no action is - * specifieddefaultdefault
    * *

    Example:

    *
      * 
    - * 
    + *
      * <init-param>
      *     <!-- The view mode namespace. Maps to a namespace in the xwork config file -->
      *     <name>viewNamespace</name>
    @@ -126,7 +129,7 @@ import com.opensymphony.xwork2.util.LocalizedTextUtil;
      * </init-param>
      * <init-param>
      *    <!-- The default action to invoke in view mode -->
    - *	  <name>defaultViewAction</name>
    + *    <name>defaultViewAction</name>
      *    <value>index</value>
      * </init-param>
      * <init-param>
    @@ -137,7 +140,7 @@ import com.opensymphony.xwork2.util.LocalizedTextUtil;
      * <init-param>
      *     <!-- The default action to invoke in view mode -->
      *     <name>defaultEditAction</name>
    - *	   <value>index</value>
    + *     <value>index</value>
      * </init-param>
      * <init-param>
      *     <!-- The view mode namespace. Maps to a namespace in the xwork config file -->
    @@ -149,7 +152,7 @@ import com.opensymphony.xwork2.util.LocalizedTextUtil;
      *     <name>defaultHelpAction</name>
      *     <value>index</value>
      * </init-param>
    - *   
    + *
      * 
      * 
    */ @@ -165,7 +168,7 @@ public class Jsr168Dispatcher extends GenericPortlet implements StrutsStatics, private Map actionMap = new HashMap(3); private String portletNamespace = null; - + private Dispatcher dispatcherUtils; /** @@ -460,7 +463,7 @@ public class Jsr168Dispatcher extends GenericPortlet implements StrutsStatics, /** * Returns a Map of all application attributes. Copies all attributes from * the {@link PortletActionContext}into an {@link ApplicationMap}. - * + * * @return a Map of all application attributes. */ protected Map getApplicationMap() { @@ -472,7 +475,7 @@ public class Jsr168Dispatcher extends GenericPortlet implements StrutsStatics, * same as the portlet mode. E.g, view mode is mapped to namespace * view, and edit mode is mapped to the namespace * edit - * + * * @param request the PortletRequest object. * @return the namespace of the action. */ @@ -531,7 +534,7 @@ public class Jsr168Dispatcher extends GenericPortlet implements StrutsStatics, /** * Returns a Map of all request parameters. This implementation just calls * {@link PortletRequest#getParameterMap()}. - * + * * @param request the PortletRequest object. * @return a Map of all request parameters. * @throws IOException if an exception occurs while retrieving the parameter @@ -545,7 +548,7 @@ public class Jsr168Dispatcher extends GenericPortlet implements StrutsStatics, * Returns a Map of all request attributes. The default implementation is to * wrap the request in a {@link RequestMap}. Override this method to * customize how request attributes are mapped. - * + * * @param request the PortletRequest object. * @return a Map of all request attributes. */ @@ -557,7 +560,7 @@ public class Jsr168Dispatcher extends GenericPortlet implements StrutsStatics, * Returns a Map of all session attributes. The default implementation is to * wrap the reqeust in a {@link SessionMap}. Override this method to * customize how session attributes are mapped. - * + * * @param request the PortletRequest object. * @return a Map of all session attributes. */ @@ -576,7 +579,7 @@ public class Jsr168Dispatcher extends GenericPortlet implements StrutsStatics, /** * Check to see if the action parameter is valid for the current portlet mode. If the portlet * mode has been changed with the portal widgets, the action name is invalid, since the - * action name belongs to the previous executing portlet mode. If this method evaluates to + * action name belongs to the previous executing portlet mode. If this method evaluates to * true the default<Mode>Action is used instead. * @param request The portlet request. * @return true if the action should be reset. diff --git a/core/src/main/java/org/apache/struts2/portlet/result/PortletResult.java b/core/src/main/java/org/apache/struts2/portlet/result/PortletResult.java index ba33f3348..6c4792fee 100644 --- a/core/src/main/java/org/apache/struts2/portlet/result/PortletResult.java +++ b/core/src/main/java/org/apache/struts2/portlet/result/PortletResult.java @@ -1,19 +1,22 @@ /* * $Id$ * - * Copyright 2006 The Apache Software Foundation. + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at + * http://www.apache.org/licenses/LICENSE-2.0 * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. */ package org.apache.struts2.portlet.result; @@ -43,13 +46,13 @@ import com.opensymphony.xwork2.ActionInvocation; /** * Result type that includes a JSP to render. - * + * */ public class PortletResult extends StrutsResultSupport { - private static final long serialVersionUID = 434251393926178567L; + private static final long serialVersionUID = 434251393926178567L; - /** + /** * Logger instance. */ private static final Log LOG = LogFactory.getLog(PortletResult.class); @@ -57,20 +60,20 @@ public class PortletResult extends StrutsResultSupport { private String contentType = "text/html"; private String title; - + public PortletResult() { - super(); + super(); } - + public PortletResult(String location) { - super(location); + super(location); } /** * Execute the result. Obtains the * {@link javax.portlet.PortletRequestDispatcher}from the * {@link PortletActionContext}and includes the JSP. - * + * * @see com.opensymphony.xwork2.Result#execute(com.opensymphony.xwork2.ActionInvocation) */ public void doExecute(String finalLocation, @@ -179,7 +182,7 @@ public class PortletResult extends StrutsResultSupport { .getNamedDispatcher("preparator"); if(preparator == null) { throw new PortletException("Cannot look up 'preparator' servlet. Make sure that you" + - "have configured it correctly in the web.xml file."); + "have configured it correctly in the web.xml file."); } new IncludeTemplate() { protected void when(PortletException e) { @@ -220,7 +223,7 @@ public class PortletResult extends StrutsResultSupport { public void setTitle(String title) { this.title = title; } - + static class IncludeTemplate { protected void include(PortletRequestDispatcher dispatcher, RenderRequest req, RenderResponse res) throws PortletException, IOException{ try { @@ -235,9 +238,9 @@ public class PortletResult extends StrutsResultSupport { throw e; } } - + protected void when(PortletException e) {} - + protected void when(IOException e) {} } } diff --git a/core/src/main/java/org/apache/struts2/portlet/result/PortletVelocityResult.java b/core/src/main/java/org/apache/struts2/portlet/result/PortletVelocityResult.java index 313abdfbf..957a3d028 100644 --- a/core/src/main/java/org/apache/struts2/portlet/result/PortletVelocityResult.java +++ b/core/src/main/java/org/apache/struts2/portlet/result/PortletVelocityResult.java @@ -1,19 +1,22 @@ /* * $Id$ * - * Copyright 2006 The Apache Software Foundation. + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at + * http://www.apache.org/licenses/LICENSE-2.0 * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. */ package org.apache.struts2.portlet.result; @@ -51,33 +54,33 @@ import com.opensymphony.xwork2.util.ValueStack; /** * - * + * * Using the Servlet container's {@link JspFactory}, this result mocks a JSP * execution environment and then displays a Velocity template that will be * streamed directly to the servlet output. - * + * *

    This result type takes the * following parameters: - * + * * - * + * *

      - * + * *
    • location (default) - the location of the template to process. *
    • - * + * *
    • parse - true by default. If set to false, the location param * will not be parsed for Ognl expressions.
    • - * + * *
    *

    * This result follows the same rules from {@link StrutsResultSupport}. *

    - * + * * - * + * * Example: - * + * *
      * <!-- START SNIPPET: example -->
      *  <result name="success" type="velocity">
    @@ -85,23 +88,23 @@ import com.opensymphony.xwork2.util.ValueStack;
      *  </result>
      *  <!-- END SNIPPET: example -->
      * 
    - * + * */ public class PortletVelocityResult extends StrutsResultSupport { - private static final long serialVersionUID = -8241086555872212274L; - - private static final Log log = LogFactory + private static final long serialVersionUID = -8241086555872212274L; + + private static final Log log = LogFactory .getLog(PortletVelocityResult.class); - public PortletVelocityResult() { - super(); - } - - public PortletVelocityResult(String location) { - super(location); - } - + public PortletVelocityResult() { + super(); + } + + public PortletVelocityResult(String location) { + super(location); + } + /* (non-Javadoc) * @see org.apache.struts2.dispatcher.StrutsResultSupport#doExecute(java.lang.String, com.opensymphony.xwork2.ActionInvocation) */ @@ -116,7 +119,7 @@ public class PortletVelocityResult extends StrutsResultSupport { /** * Executes the result - * + * * @param location The location string * @param invocation The action invocation */ @@ -135,7 +138,7 @@ public class PortletVelocityResult extends StrutsResultSupport { /** * Creates a Velocity context from the action, loads a Velocity template and * executes the template. Output is written to the servlet output stream. - * + * * @param finalLocation the location of the Velocity template * @param invocation an encapsulation of the action execution state. * @throws Exception if an error occurs when creating the Velocity context, @@ -213,7 +216,7 @@ public class PortletVelocityResult extends StrutsResultSupport { * Retrieve the content type for this template.

    People can override * this method if they want to provide specific content types for specific * templates (eg text/xml). - * + * * @return The content type associated with this template (default * "text/html") */ @@ -224,7 +227,7 @@ public class PortletVelocityResult extends StrutsResultSupport { /** * Retrieve the encoding for this template.

    People can override this * method if they want to provide specific encodings for specific templates. - * + * * @return The encoding associated with this template (defaults to the value * of 'struts.i18n.encoding' property) */ @@ -243,7 +246,7 @@ public class PortletVelocityResult extends StrutsResultSupport { /** * Given a value stack, a Velocity engine, and an action invocation, this * method returns the appropriate Velocity template to render. - * + * * @param stack the value stack to resolve the location again (when parse * equals true) * @param velocity the velocity engine to process the request against @@ -267,7 +270,7 @@ public class PortletVelocityResult extends StrutsResultSupport { /** * Creates the VelocityContext that we'll use to render this page. - * + * * @param velocityManager a reference to the velocityManager to use * @param stack the value stack to resolve the location against (when parse * equals true) diff --git a/core/src/main/java/org/apache/struts2/portlet/util/PortletUrlHelper.java b/core/src/main/java/org/apache/struts2/portlet/util/PortletUrlHelper.java index ee3920ceb..f512c859d 100644 --- a/core/src/main/java/org/apache/struts2/portlet/util/PortletUrlHelper.java +++ b/core/src/main/java/org/apache/struts2/portlet/util/PortletUrlHelper.java @@ -1,19 +1,22 @@ /* * $Id$ * - * Copyright 2006 The Apache Software Foundation. + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at + * http://www.apache.org/licenses/LICENSE-2.0 * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. */ package org.apache.struts2.portlet.util; @@ -41,19 +44,19 @@ import org.apache.struts2.portlet.context.PortletActionContext; /** * Helper class for creating Portlet URLs. Portlet URLs are fundamentally different from regular * servlet URLs since they never target the application itself; all requests go through the portlet - * container and must therefore be programatically constructed using the - * {@link javax.portlet.RenderResponse#createActionURL()} and + * container and must therefore be programatically constructed using the + * {@link javax.portlet.RenderResponse#createActionURL()} and * {@link javax.portlet.RenderResponse#createRenderURL()} APIs. - * + * */ public class PortletUrlHelper { public static final String ENCODING = "UTF-8"; - + private static final Log LOG = LogFactory.getLog(PortletUrlHelper.class); /** * Create a portlet URL with for the specified action and namespace. - * + * * @param action The action the URL should invoke. * @param namespace The namespace of the action to invoke. * @param params The parameters of the URL. @@ -69,8 +72,8 @@ public class PortletUrlHelper { } /** - * Create a portlet URL with for the specified action and namespace. - * + * Create a portlet URL with for the specified action and namespace. + * * @see #buildUrl(String, String, Map, String, String, String) */ public static String buildUrl(String action, String namespace, Map params, @@ -144,12 +147,12 @@ public class PortletUrlHelper { } /** - * + * * Prepend the namespace configuration for the specified namespace and PortletMode. - * + * * @param namespace The base namespace. * @param portletMode The PortletMode. - * + * * @return prepended namespace. */ private static String prependNamespace(String namespace, String portletMode) { @@ -183,7 +186,7 @@ public class PortletUrlHelper { /** * Encode an url to a non Struts action resource, like stylesheet, image or * servlet. - * + * * @param value * @return encoded url to non Struts action resources. */ @@ -201,7 +204,7 @@ public class PortletUrlHelper { while(it.hasNext()) { String key = (String)it.next(); String val = (String)params.get(key); - + sb.append(URLEncoder.encode(key, ENCODING)).append("="); sb.append(URLEncoder.encode(val, ENCODING)); if(it.hasNext()) { @@ -220,7 +223,7 @@ public class PortletUrlHelper { /** * Will ensure that all entries in params are String arrays, * as requried by the setParameters on the PortletURL. - * + * * @param params The parameters to the URL. * @return A Map with all parameters as String arrays. */ @@ -244,7 +247,7 @@ public class PortletUrlHelper { /** * Convert the given String to a WindowState object. - * + * * @param portletReq The RenderRequest. * @param windowState The WindowState as a String. * @return The WindowState that mathces the windowState String, or if @@ -271,7 +274,7 @@ public class PortletUrlHelper { /** * Convert the given String to a PortletMode object. - * + * * @param portletReq The RenderRequest. * @param portletMode The PortletMode as a String. * @return The PortletMode that mathces the portletMode String, or if diff --git a/core/src/main/java/org/apache/struts2/spring/StrutsSpringObjectFactory.java b/core/src/main/java/org/apache/struts2/spring/StrutsSpringObjectFactory.java index 45d1e4d30..54cd0bc8b 100644 --- a/core/src/main/java/org/apache/struts2/spring/StrutsSpringObjectFactory.java +++ b/core/src/main/java/org/apache/struts2/spring/StrutsSpringObjectFactory.java @@ -1,19 +1,22 @@ /* * $Id$ * - * Copyright 2006 The Apache Software Foundation. + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at + * http://www.apache.org/licenses/LICENSE-2.0 * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. */ package org.apache.struts2.spring; diff --git a/core/src/main/java/org/apache/struts2/spring/lifecycle/SpringExternalReferenceResolverSetupListener.java b/core/src/main/java/org/apache/struts2/spring/lifecycle/SpringExternalReferenceResolverSetupListener.java index b98688508..e32af7ab9 100644 --- a/core/src/main/java/org/apache/struts2/spring/lifecycle/SpringExternalReferenceResolverSetupListener.java +++ b/core/src/main/java/org/apache/struts2/spring/lifecycle/SpringExternalReferenceResolverSetupListener.java @@ -1,19 +1,22 @@ /* * $Id$ * - * Copyright 2006 The Apache Software Foundation. + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at + * http://www.apache.org/licenses/LICENSE-2.0 * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. */ package org.apache.struts2.spring.lifecycle; @@ -44,9 +47,9 @@ import com.opensymphony.xwork2.config.entities.PackageConfig; */ public class SpringExternalReferenceResolverSetupListener implements ServletContextListener { - + private Map listeners = new HashMap(); - + /* (non-Javadoc) * @see javax.servlet.ServletContextListener#contextDestroyed(javax.servlet.ServletContextEvent) */ @@ -64,7 +67,7 @@ public class SpringExternalReferenceResolverSetupListener implements Dispatcher.addDispatcherListener(l); listeners.put(event.getServletContext(), l); } - + /** * Handles initializing and cleaning up the dispatcher * @author brownd @@ -73,16 +76,16 @@ public class SpringExternalReferenceResolverSetupListener implements private class Listener implements DispatcherListener { private ServletContext servletContext; - + /** * Constructs the listener - * + * * @param ctx The servlet context */ public Listener(ServletContext ctx) { this.servletContext = ctx; } - + /* (non-Javadoc) * @see org.apache.struts2.dispatcher.DispatcherListener#dispatcherInitialized(org.apache.struts2.dispatcher.Dispatcher) */ @@ -93,7 +96,7 @@ public class SpringExternalReferenceResolverSetupListener implements Configuration xworkConfig = du.getConfigurationManager().getConfiguration(); Map packageConfigs = xworkConfig.getPackageConfigs(); Iterator i = packageConfigs.values().iterator(); - + while (i.hasNext()) { PackageConfig packageConfig = (PackageConfig) i.next(); ExternalReferenceResolver resolver = packageConfig.getExternalRefResolver(); @@ -102,7 +105,7 @@ public class SpringExternalReferenceResolverSetupListener implements ApplicationContextAware contextAware = (ApplicationContextAware) resolver; contextAware.setApplicationContext(appContext); } - + } /* (non-Javadoc) diff --git a/core/src/main/java/org/apache/struts2/util/AppendIteratorFilter.java b/core/src/main/java/org/apache/struts2/util/AppendIteratorFilter.java index a148e6598..87cf5edf2 100644 --- a/core/src/main/java/org/apache/struts2/util/AppendIteratorFilter.java +++ b/core/src/main/java/org/apache/struts2/util/AppendIteratorFilter.java @@ -1,19 +1,22 @@ /* * $Id$ * - * Copyright 2006 The Apache Software Foundation. + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at + * http://www.apache.org/licenses/LICENSE-2.0 * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. */ package org.apache.struts2.util; diff --git a/core/src/main/java/org/apache/struts2/util/AttributeMap.java b/core/src/main/java/org/apache/struts2/util/AttributeMap.java index 93b04ccdf..8b827f0a5 100644 --- a/core/src/main/java/org/apache/struts2/util/AttributeMap.java +++ b/core/src/main/java/org/apache/struts2/util/AttributeMap.java @@ -1,19 +1,22 @@ /* * $Id$ * - * Copyright 2006 The Apache Software Foundation. + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at + * http://www.apache.org/licenses/LICENSE-2.0 * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. */ package org.apache.struts2.util; diff --git a/core/src/main/java/org/apache/struts2/util/ClassLoaderUtils.java b/core/src/main/java/org/apache/struts2/util/ClassLoaderUtils.java index b07e64841..5a0b6679f 100644 --- a/core/src/main/java/org/apache/struts2/util/ClassLoaderUtils.java +++ b/core/src/main/java/org/apache/struts2/util/ClassLoaderUtils.java @@ -1,19 +1,22 @@ /* * $Id$ * - * Copyright 2006 The Apache Software Foundation. + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at + * http://www.apache.org/licenses/LICENSE-2.0 * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. */ package org.apache.struts2.util; diff --git a/core/src/main/java/org/apache/struts2/util/ContainUtil.java b/core/src/main/java/org/apache/struts2/util/ContainUtil.java index 8fee59585..214ddf974 100644 --- a/core/src/main/java/org/apache/struts2/util/ContainUtil.java +++ b/core/src/main/java/org/apache/struts2/util/ContainUtil.java @@ -1,19 +1,22 @@ /* * $Id$ * - * Copyright 2006 The Apache Software Foundation. + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at + * http://www.apache.org/licenses/LICENSE-2.0 * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. */ package org.apache.struts2.util; @@ -30,41 +33,41 @@ import java.util.Map; */ public class ContainUtil { - /** - * Determine if obj2 exists in obj1. - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - *
    Type Of obj1Comparison type
    null - * always return false
    MapMap containsKey(obj2)
    CollectionCollection contains(obj2)
    Arraythere's an array element (e) where e.equals(obj2)
    Objectobj1.equals(obj2)
    - * - * - * @param obj1 - * @param obj2 - * @return - */ + /** + * Determine if obj2 exists in obj1. + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + *
    Type Of obj1Comparison type
    null + * always return false
    MapMap containsKey(obj2)
    CollectionCollection contains(obj2)
    Arraythere's an array element (e) where e.equals(obj2)
    Objectobj1.equals(obj2)
    + * + * + * @param obj1 + * @param obj2 + * @return + */ public static boolean contains(Object obj1, Object obj2) { if ((obj1 == null) || (obj2 == null)) { //log.debug("obj1 or obj2 are null."); diff --git a/core/src/main/java/org/apache/struts2/util/Counter.java b/core/src/main/java/org/apache/struts2/util/Counter.java index ad5e53d0c..6d2dffd6c 100644 --- a/core/src/main/java/org/apache/struts2/util/Counter.java +++ b/core/src/main/java/org/apache/struts2/util/Counter.java @@ -1,19 +1,22 @@ /* * $Id$ * - * Copyright 2006 The Apache Software Foundation. + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at + * http://www.apache.org/licenses/LICENSE-2.0 * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. */ package org.apache.struts2.util; @@ -28,9 +31,9 @@ import java.io.Serializable; */ public class Counter implements java.util.Iterator, Serializable { - private static final long serialVersionUID = 2796965884308060179L; + private static final long serialVersionUID = 2796965884308060179L; - boolean wrap = false; + boolean wrap = false; // Attributes ---------------------------------------------------- long first = 1; diff --git a/core/src/main/java/org/apache/struts2/util/DateFormatter.java b/core/src/main/java/org/apache/struts2/util/DateFormatter.java index 61e569f1b..a7c10b7c3 100644 --- a/core/src/main/java/org/apache/struts2/util/DateFormatter.java +++ b/core/src/main/java/org/apache/struts2/util/DateFormatter.java @@ -1,19 +1,22 @@ /* * $Id$ * - * Copyright 2006 The Apache Software Foundation. + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at + * http://www.apache.org/licenses/LICENSE-2.0 * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. */ package org.apache.struts2.util; diff --git a/core/src/main/java/org/apache/struts2/util/FastByteArrayOutputStream.java b/core/src/main/java/org/apache/struts2/util/FastByteArrayOutputStream.java index e3dde75ef..74ed0f598 100644 --- a/core/src/main/java/org/apache/struts2/util/FastByteArrayOutputStream.java +++ b/core/src/main/java/org/apache/struts2/util/FastByteArrayOutputStream.java @@ -1,19 +1,22 @@ /* * $Id$ * - * Copyright 2006 The Apache Software Foundation. + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at + * http://www.apache.org/licenses/LICENSE-2.0 * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. */ package org.apache.struts2.util; diff --git a/core/src/main/java/org/apache/struts2/util/InvocationSessionStore.java b/core/src/main/java/org/apache/struts2/util/InvocationSessionStore.java index 53119682c..fa70c79b7 100644 --- a/core/src/main/java/org/apache/struts2/util/InvocationSessionStore.java +++ b/core/src/main/java/org/apache/struts2/util/InvocationSessionStore.java @@ -1,19 +1,22 @@ /* * $Id$ * - * Copyright 2006 The Apache Software Foundation. + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at + * http://www.apache.org/licenses/LICENSE-2.0 * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. */ package org.apache.struts2.util; @@ -104,10 +107,10 @@ public class InvocationSessionStore { private static class InvocationContext implements Serializable { - - private static final long serialVersionUID = -286697666275777888L; - - ActionInvocation invocation; + + private static final long serialVersionUID = -286697666275777888L; + + ActionInvocation invocation; String token; public InvocationContext(ActionInvocation invocation, String token) { diff --git a/core/src/main/java/org/apache/struts2/util/IteratorFilterSupport.java b/core/src/main/java/org/apache/struts2/util/IteratorFilterSupport.java index 5f3a26913..e0ffe0cc7 100644 --- a/core/src/main/java/org/apache/struts2/util/IteratorFilterSupport.java +++ b/core/src/main/java/org/apache/struts2/util/IteratorFilterSupport.java @@ -1,19 +1,22 @@ /* * $Id$ * - * Copyright 2006 The Apache Software Foundation. + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at + * http://www.apache.org/licenses/LICENSE-2.0 * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. */ package org.apache.struts2.util; diff --git a/core/src/main/java/org/apache/struts2/util/IteratorGenerator.java b/core/src/main/java/org/apache/struts2/util/IteratorGenerator.java index 6bf81d650..93702580d 100644 --- a/core/src/main/java/org/apache/struts2/util/IteratorGenerator.java +++ b/core/src/main/java/org/apache/struts2/util/IteratorGenerator.java @@ -1,19 +1,22 @@ /* * $Id$ * - * Copyright 2006 The Apache Software Foundation. + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at + * http://www.apache.org/licenses/LICENSE-2.0 * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. */ package org.apache.struts2.util; @@ -30,12 +33,12 @@ import com.opensymphony.xwork2.Action; /** * A bean that generates an iterator filled with a given object depending on the count, - * separator and converter defined. It is being used by IteratorGeneratorTag. + * separator and converter defined. It is being used by IteratorGeneratorTag. * */ public class IteratorGenerator implements Iterator, Action { - - private static final Log _log = LogFactory.getLog(IteratorGenerator.class); + + private static final Log _log = LogFactory.getLog(IteratorGenerator.class); List values; Object value; @@ -62,9 +65,9 @@ public class IteratorGenerator implements Iterator, Action { public void setSeparator(String aChar) { separator = aChar; } - + public void setConverter(Converter aConverter) { - converter = aConverter; + converter = aConverter; } // Public -------------------------------------------------------- @@ -83,19 +86,19 @@ public class IteratorGenerator implements Iterator, Action { StringTokenizer tokens = new StringTokenizer(value.toString(), separator); while (tokens.hasMoreTokens()) { - String token = tokens.nextToken().trim(); - if (converter != null) { - try { - Object convertedObj = converter.convert(token); - values.add(convertedObj); - } - catch(Exception e) { // make sure things, goes on, we just ignore the bad ones - _log.warn("unable to convert ["+token+"], skipping this token, it will not appear in the generated iterator", e); - } - } - else { - values.add(token); - } + String token = tokens.nextToken().trim(); + if (converter != null) { + try { + Object convertedObj = converter.convert(token); + values.add(convertedObj); + } + catch(Exception e) { // make sure things, goes on, we just ignore the bad ones + _log.warn("unable to convert ["+token+"], skipping this token, it will not appear in the generated iterator", e); + } + } + else { + values.add(token); + } } } else { values.add(value.toString()); @@ -126,13 +129,13 @@ public class IteratorGenerator implements Iterator, Action { public void remove() { throw new UnsupportedOperationException("Remove is not supported in IteratorGenerator."); } - - + + // Inner class -------------------------------------------------- /** * Interface for converting each separated token into an Object of choice. */ public static interface Converter { - Object convert(String token) throws Exception; + Object convert(String token) throws Exception; } } diff --git a/core/src/main/java/org/apache/struts2/util/ListEntry.java b/core/src/main/java/org/apache/struts2/util/ListEntry.java index db7b195e7..229f0e666 100644 --- a/core/src/main/java/org/apache/struts2/util/ListEntry.java +++ b/core/src/main/java/org/apache/struts2/util/ListEntry.java @@ -1,19 +1,22 @@ /* * $Id$ * - * Copyright 2006 The Apache Software Foundation. + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at + * http://www.apache.org/licenses/LICENSE-2.0 * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. */ package org.apache.struts2.util; diff --git a/core/src/main/java/org/apache/struts2/util/MakeIterator.java b/core/src/main/java/org/apache/struts2/util/MakeIterator.java index fe59ec284..0033738f2 100644 --- a/core/src/main/java/org/apache/struts2/util/MakeIterator.java +++ b/core/src/main/java/org/apache/struts2/util/MakeIterator.java @@ -1,19 +1,22 @@ /* * $Id$ * - * Copyright 2006 The Apache Software Foundation. + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at + * http://www.apache.org/licenses/LICENSE-2.0 * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. */ package org.apache.struts2.util; diff --git a/core/src/main/java/org/apache/struts2/util/MergeIteratorFilter.java b/core/src/main/java/org/apache/struts2/util/MergeIteratorFilter.java index e46ec4685..02245729e 100644 --- a/core/src/main/java/org/apache/struts2/util/MergeIteratorFilter.java +++ b/core/src/main/java/org/apache/struts2/util/MergeIteratorFilter.java @@ -1,19 +1,22 @@ /* * $Id$ * - * Copyright 2006 The Apache Software Foundation. + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at + * http://www.apache.org/licenses/LICENSE-2.0 * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. */ package org.apache.struts2.util; @@ -25,7 +28,7 @@ import com.opensymphony.xwork2.Action; /** - * A bean that takes several iterators and outputs the merge of them. Used by + * A bean that takes several iterators and outputs the merge of them. Used by * MergeIteratorTag. * * @see org.apache.struts2.views.jsp.iterator.MergeIteratorTag diff --git a/core/src/main/java/org/apache/struts2/util/ObjectFactoryDestroyable.java b/core/src/main/java/org/apache/struts2/util/ObjectFactoryDestroyable.java index c2e26b277..56ca7d1f9 100644 --- a/core/src/main/java/org/apache/struts2/util/ObjectFactoryDestroyable.java +++ b/core/src/main/java/org/apache/struts2/util/ObjectFactoryDestroyable.java @@ -1,30 +1,33 @@ /* * $Id$ * - * Copyright 2006 The Apache Software Foundation. + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at + * http://www.apache.org/licenses/LICENSE-2.0 * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. */ package org.apache.struts2.util; /** - * An interface to be implemented by any ObjectFactory implementation - * if it requires shutdown hook whenever an ObjectFactory is to be - * destroyed. - * + * An interface to be implemented by any ObjectFactory implementation + * if it requires shutdown hook whenever an ObjectFactory is to be + * destroyed. + * * @see org.apache.struts2.dispatcher.FilterDispatcher * @see org.apache.struts2.dispatcher.Dispatcher */ public interface ObjectFactoryDestroyable { - void destroy(); + void destroy(); } diff --git a/core/src/main/java/org/apache/struts2/util/ObjectFactoryInitializable.java b/core/src/main/java/org/apache/struts2/util/ObjectFactoryInitializable.java index 7db4f8992..1b19efa90 100644 --- a/core/src/main/java/org/apache/struts2/util/ObjectFactoryInitializable.java +++ b/core/src/main/java/org/apache/struts2/util/ObjectFactoryInitializable.java @@ -1,19 +1,22 @@ /* * $Id$ * - * Copyright 2006 The Apache Software Foundation. + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at + * http://www.apache.org/licenses/LICENSE-2.0 * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. */ package org.apache.struts2.util; diff --git a/core/src/main/java/org/apache/struts2/util/ObjectFactoryLifecycle.java b/core/src/main/java/org/apache/struts2/util/ObjectFactoryLifecycle.java index 84356f4d1..c03e37205 100644 --- a/core/src/main/java/org/apache/struts2/util/ObjectFactoryLifecycle.java +++ b/core/src/main/java/org/apache/struts2/util/ObjectFactoryLifecycle.java @@ -1,30 +1,33 @@ /* * $Id$ * - * Copyright 2006 The Apache Software Foundation. + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at + * http://www.apache.org/licenses/LICENSE-2.0 * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. */ package org.apache.struts2.util; /** * An interface indicating the lifecycle of an ObjectFactory implementation. - * + * * @see ObjectFactoryLifecycle * @see com.opensymphony.xwork2.ObjectFactory * @see org.apache.struts2.util.ObjectFactoryInitializable * @see org.apache.struts2.util.ObjectFactoryDestroyable */ public interface ObjectFactoryLifecycle extends ObjectFactoryInitializable, ObjectFactoryDestroyable { - + } diff --git a/core/src/main/java/org/apache/struts2/util/PrefixTrie.java b/core/src/main/java/org/apache/struts2/util/PrefixTrie.java index 24288b13b..7166b2f17 100644 --- a/core/src/main/java/org/apache/struts2/util/PrefixTrie.java +++ b/core/src/main/java/org/apache/struts2/util/PrefixTrie.java @@ -1,19 +1,22 @@ /* * $Id$ * - * Copyright 2006 The Apache Software Foundation. + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at + * http://www.apache.org/licenses/LICENSE-2.0 * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. */ package org.apache.struts2.util; diff --git a/core/src/main/java/org/apache/struts2/util/ResolverSetupServletContextListener.java b/core/src/main/java/org/apache/struts2/util/ResolverSetupServletContextListener.java index 9f26f8651..1627d8191 100644 --- a/core/src/main/java/org/apache/struts2/util/ResolverSetupServletContextListener.java +++ b/core/src/main/java/org/apache/struts2/util/ResolverSetupServletContextListener.java @@ -1,19 +1,22 @@ /* * $Id$ * - * Copyright 2006 The Apache Software Foundation. + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at + * http://www.apache.org/licenses/LICENSE-2.0 * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. */ package org.apache.struts2.util; @@ -43,7 +46,7 @@ import com.opensymphony.xwork2.config.entities.PackageConfig; public class ResolverSetupServletContextListener implements ServletContextListener { Map listeners = new HashMap(); - + public synchronized void contextDestroyed(ServletContextEvent event) { Listener l = listeners.get(event.getServletContext()); Dispatcher.removeDispatcherListener(l); @@ -55,15 +58,15 @@ public class ResolverSetupServletContextListener implements ServletContextListen Dispatcher.addDispatcherListener(l); listeners.put(event.getServletContext(), l); } - + private class Listener implements DispatcherListener { private ServletContext servletContext; - + public Listener(ServletContext ctx) { this.servletContext = ctx; } - + public void dispatcherInitialized(Dispatcher du) { Configuration config = du.getConfigurationManager().getConfiguration(); String key; @@ -78,7 +81,7 @@ public class ResolverSetupServletContextListener implements ServletContextListen ((ServletContextAware) packageConfig.getExternalRefResolver()).setServletContext(servletContext); } } - + } public void dispatcherDestroyed(Dispatcher du) { diff --git a/core/src/main/java/org/apache/struts2/util/ServletContextAware.java b/core/src/main/java/org/apache/struts2/util/ServletContextAware.java index 17a60d255..b009d6b75 100644 --- a/core/src/main/java/org/apache/struts2/util/ServletContextAware.java +++ b/core/src/main/java/org/apache/struts2/util/ServletContextAware.java @@ -1,19 +1,22 @@ /* * $Id$ * - * Copyright 2006 The Apache Software Foundation. + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at + * http://www.apache.org/licenses/LICENSE-2.0 * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. */ package org.apache.struts2.util; diff --git a/core/src/main/java/org/apache/struts2/util/SortIteratorFilter.java b/core/src/main/java/org/apache/struts2/util/SortIteratorFilter.java index 9fdf2c5a7..b5563e32c 100644 --- a/core/src/main/java/org/apache/struts2/util/SortIteratorFilter.java +++ b/core/src/main/java/org/apache/struts2/util/SortIteratorFilter.java @@ -1,19 +1,22 @@ /* * $Id$ * - * Copyright 2006 The Apache Software Foundation. + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at + * http://www.apache.org/licenses/LICENSE-2.0 * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. */ package org.apache.struts2.util; diff --git a/core/src/main/java/org/apache/struts2/util/Sorter.java b/core/src/main/java/org/apache/struts2/util/Sorter.java index c1e929e01..d6bb88c08 100644 --- a/core/src/main/java/org/apache/struts2/util/Sorter.java +++ b/core/src/main/java/org/apache/struts2/util/Sorter.java @@ -1,19 +1,22 @@ /* * $Id$ * - * Copyright 2006 The Apache Software Foundation. + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at + * http://www.apache.org/licenses/LICENSE-2.0 * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. */ package org.apache.struts2.util; diff --git a/core/src/main/java/org/apache/struts2/util/StrutsTypeConverter.java b/core/src/main/java/org/apache/struts2/util/StrutsTypeConverter.java index e81c3b0d6..5fca16bab 100644 --- a/core/src/main/java/org/apache/struts2/util/StrutsTypeConverter.java +++ b/core/src/main/java/org/apache/struts2/util/StrutsTypeConverter.java @@ -1,19 +1,22 @@ /* * $Id$ * - * Copyright 2006 The Apache Software Foundation. + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at + * http://www.apache.org/licenses/LICENSE-2.0 * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. */ package org.apache.struts2.util; @@ -49,7 +52,7 @@ public abstract class StrutsTypeConverter extends DefaultTypeConverter { } else if (o instanceof String) { return convertFromString(context, new String[]{(String) o}, toClass); } else { - return performFallbackConversion(context, o, toClass); + return performFallbackConversion(context, o, toClass); } } @@ -64,7 +67,7 @@ public abstract class StrutsTypeConverter extends DefaultTypeConverter { * @return The fallback conversion */ protected Object performFallbackConversion(Map context, Object o, Class toClass) { - return super.convertValue(context, o, toClass); + return super.convertValue(context, o, toClass); } diff --git a/core/src/main/java/org/apache/struts2/util/StrutsUtil.java b/core/src/main/java/org/apache/struts2/util/StrutsUtil.java index 0440e3d78..5d0273b81 100644 --- a/core/src/main/java/org/apache/struts2/util/StrutsUtil.java +++ b/core/src/main/java/org/apache/struts2/util/StrutsUtil.java @@ -1,19 +1,22 @@ /* * $Id$ * - * Copyright 2006 The Apache Software Foundation. + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at + * http://www.apache.org/licenses/LICENSE-2.0 * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. */ package org.apache.struts2.util; @@ -137,15 +140,15 @@ public class StrutsUtil { } public String getText(String text) { - return (String) stack.findValue("getText('" + text + "')"); + return (String) stack.findValue("getText('" + text + "')"); } /* - * @return the url ContextPath. An empty string if one does not exist. - */ - public String getContext() { - return (request == null)? "" : request.getContextPath(); - } + * @return the url ContextPath. An empty string if one does not exist. + */ + public String getContext() { + return (request == null)? "" : request.getContextPath(); + } /** * the selectedList objects are matched to the list.listValue diff --git a/core/src/main/java/org/apache/struts2/util/SubsetIteratorFilter.java b/core/src/main/java/org/apache/struts2/util/SubsetIteratorFilter.java index 5909dc168..5451bb9da 100644 --- a/core/src/main/java/org/apache/struts2/util/SubsetIteratorFilter.java +++ b/core/src/main/java/org/apache/struts2/util/SubsetIteratorFilter.java @@ -1,19 +1,22 @@ /* * $Id$ * - * Copyright 2006 The Apache Software Foundation. + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at + * http://www.apache.org/licenses/LICENSE-2.0 * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. */ package org.apache.struts2.util; @@ -33,13 +36,13 @@ import com.opensymphony.xwork2.Action; */ public class SubsetIteratorFilter extends IteratorFilterSupport implements Iterator, Action { - private static final Log _log = LogFactory.getLog(SubsetIteratorFilter.class); - + private static final Log _log = LogFactory.getLog(SubsetIteratorFilter.class); + Iterator iterator; Object source; int count = -1; int currentCount = 0; - + Decider decider; // Attributes ---------------------------------------------------- @@ -58,9 +61,9 @@ public class SubsetIteratorFilter extends IteratorFilterSupport implements Itera public void setStart(int aStart) { this.start = aStart; } - + public void setDecider(Decider aDecider) { - this.decider = aDecider; + this.decider = aDecider; } // Action implementation ----------------------------------------- @@ -77,42 +80,42 @@ public class SubsetIteratorFilter extends IteratorFilterSupport implements Itera // Calculate iterator filter if (source instanceof Iterator) { iterator = (Iterator) source; - + // Read away items for (int i = 0; (i < start) && iterator.hasNext(); i++) { iterator.next(); } - - + + // now let Decider decide if element should be added (if a decider exist) if (decider != null) { - List list = new ArrayList(); - while(iterator.hasNext()) { - Object currentElement = iterator.next(); - if (decide(currentElement)) { - list.add(currentElement); - } - } - iterator = list.iterator(); + List list = new ArrayList(); + while(iterator.hasNext()) { + Object currentElement = iterator.next(); + if (decide(currentElement)) { + list.add(currentElement); + } + } + iterator = list.iterator(); } - + } else if (source.getClass().isArray()) { ArrayList list = new ArrayList(((Object[]) source).length); Object[] objects = (Object[]) source; int len = objects.length; if (count >= 0) { - len = start + count; - if (len > objects.length) { - len = objects.length; - } + len = start + count; + if (len > objects.length) { + len = objects.length; + } } for (int j = start; j < len; j++) { - if (decide(objects[j])) { + if (decide(objects[j])) { list.add(objects[j]); - } + } } count = -1; // Don't have to check this in the iterator code @@ -140,7 +143,7 @@ public class SubsetIteratorFilter extends IteratorFilterSupport implements Itera public void remove() { iterator.remove(); } - + // inner class --------------------------------------------------- /** * A decider determines if the given element should be added to the list or not. @@ -155,19 +158,19 @@ public class SubsetIteratorFilter extends IteratorFilterSupport implements Itera */ boolean decide(Object element) throws Exception; } - + // protected ----------------------------------------------------- protected boolean decide(Object element) { - if (decider != null) { - try { - boolean okToAdd = decider.decide(element); - return okToAdd; - } - catch(Exception e) { - _log.warn("decider ["+decider+"] encountered an error while decide adding element ["+element+"], element will be ignored, it will not appeared in subseted iterator", e); - return false; - } - } - return true; + if (decider != null) { + try { + boolean okToAdd = decider.decide(element); + return okToAdd; + } + catch(Exception e) { + _log.warn("decider ["+decider+"] encountered an error while decide adding element ["+element+"], element will be ignored, it will not appeared in subseted iterator", e); + return false; + } + } + return true; } } diff --git a/core/src/main/java/org/apache/struts2/util/TabbedPane.java b/core/src/main/java/org/apache/struts2/util/TabbedPane.java index 890bb73b1..4c8782880 100644 --- a/core/src/main/java/org/apache/struts2/util/TabbedPane.java +++ b/core/src/main/java/org/apache/struts2/util/TabbedPane.java @@ -1,19 +1,22 @@ /* * $Id$ * - * Copyright 2006 The Apache Software Foundation. + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at + * http://www.apache.org/licenses/LICENSE-2.0 * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. */ package org.apache.struts2.util; diff --git a/core/src/main/java/org/apache/struts2/util/Timer.java b/core/src/main/java/org/apache/struts2/util/Timer.java index c06ea1879..1fba0d49e 100644 --- a/core/src/main/java/org/apache/struts2/util/Timer.java +++ b/core/src/main/java/org/apache/struts2/util/Timer.java @@ -1,19 +1,22 @@ /* * $Id$ * - * Copyright 2006 The Apache Software Foundation. + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at + * http://www.apache.org/licenses/LICENSE-2.0 * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. */ package org.apache.struts2.util; diff --git a/core/src/main/java/org/apache/struts2/util/TokenHelper.java b/core/src/main/java/org/apache/struts2/util/TokenHelper.java index 8dce61b00..87b3c38aa 100644 --- a/core/src/main/java/org/apache/struts2/util/TokenHelper.java +++ b/core/src/main/java/org/apache/struts2/util/TokenHelper.java @@ -1,19 +1,22 @@ /* * $Id$ * - * Copyright 2006 The Apache Software Foundation. + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at + * http://www.apache.org/licenses/LICENSE-2.0 * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. */ package org.apache.struts2.util; @@ -37,7 +40,7 @@ public class TokenHelper { * The default name to map the token value */ public static final String DEFAULT_TOKEN_NAME = "struts.token"; - + /** * The name of the field which will hold the token name */ @@ -65,28 +68,28 @@ public class TokenHelper { Map session = ActionContext.getContext().getSession(); String token = generateGUID(); try { - session.put(tokenName, token); + session.put(tokenName, token); } catch(IllegalStateException e) { - // WW-1182 explain to user what the problem is - String msg = "Error creating HttpSession due response is commited to client. You can use the CreateSessionInterceptor or create the HttpSession from your action before the result is rendered to the client: " + e.getMessage(); - LOG.error(msg, e); - throw new IllegalArgumentException(msg); + // WW-1182 explain to user what the problem is + String msg = "Error creating HttpSession due response is commited to client. You can use the CreateSessionInterceptor or create the HttpSession from your action before the result is rendered to the client: " + e.getMessage(); + LOG.error(msg, e); + throw new IllegalArgumentException(msg); } return token; } - + /** * Gets a transaction token into the session using the default token name. - * + * * @return token */ public static String getToken() { - return getToken(DEFAULT_TOKEN_NAME); + return getToken(DEFAULT_TOKEN_NAME); } - + /** * Gets the Token value from the params in the ServletActionContext using the given name * @@ -147,16 +150,16 @@ public class TokenHelper { String tokenName = getTokenName(); if (tokenName == null) { - if (LOG.isDebugEnabled()) - LOG.debug("no token name found -> Invalid token "); + if (LOG.isDebugEnabled()) + LOG.debug("no token name found -> Invalid token "); return false; } String token = getToken(tokenName); if (token == null) { - if (LOG.isDebugEnabled()) - LOG.debug("no token found for token name "+tokenName+" -> Invalid token "); + if (LOG.isDebugEnabled()) + LOG.debug("no token found for token name "+tokenName+" -> Invalid token "); return false; } @@ -176,7 +179,7 @@ public class TokenHelper { return true; } - + public static String generateGUID() { return new BigInteger(165, RANDOM).toString(36).toUpperCase(); } diff --git a/core/src/main/java/org/apache/struts2/util/URLBean.java b/core/src/main/java/org/apache/struts2/util/URLBean.java index db5cd3db4..dff92a592 100644 --- a/core/src/main/java/org/apache/struts2/util/URLBean.java +++ b/core/src/main/java/org/apache/struts2/util/URLBean.java @@ -1,19 +1,22 @@ /* * $Id$ * - * Copyright 2006 The Apache Software Foundation. + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at + * http://www.apache.org/licenses/LICENSE-2.0 * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. */ package org.apache.struts2.util; diff --git a/core/src/main/java/org/apache/struts2/util/VelocityStrutsUtil.java b/core/src/main/java/org/apache/struts2/util/VelocityStrutsUtil.java index 0f4f8c56d..cee874065 100644 --- a/core/src/main/java/org/apache/struts2/util/VelocityStrutsUtil.java +++ b/core/src/main/java/org/apache/struts2/util/VelocityStrutsUtil.java @@ -1,19 +1,22 @@ /* * $Id$ * - * Copyright 2006 The Apache Software Foundation. + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at + * http://www.apache.org/licenses/LICENSE-2.0 * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. */ package org.apache.struts2.util; diff --git a/core/src/main/java/org/apache/struts2/validators/DWRValidator.java b/core/src/main/java/org/apache/struts2/validators/DWRValidator.java index 9c27d8531..78eae1dfb 100644 --- a/core/src/main/java/org/apache/struts2/validators/DWRValidator.java +++ b/core/src/main/java/org/apache/struts2/validators/DWRValidator.java @@ -1,19 +1,22 @@ /* * $Id$ * - * Copyright 2006 The Apache Software Foundation. + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at + * http://www.apache.org/licenses/LICENSE-2.0 * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. */ package org.apache.struts2.validators; @@ -45,17 +48,17 @@ import com.opensymphony.xwork2.config.entities.ActionConfig; /** *

    * Use the dwr configuration as follows :- - * + * *

      * 
    - * 
    + *
      * <dwr<
      *    <allow<
      *      <create creator="new" javascript="validator" class="org.apache.struts2.validators.DWRValidator"/<
      *      <convert converter="bean" match="com.opensymphony.xwork2.ValidationAwareSupport"/<
      *    </allow<
      * </dwr<
    - * 
    + *
      * 
      * 
    */ diff --git a/core/src/main/java/org/apache/struts2/views/JspSupportServlet.java b/core/src/main/java/org/apache/struts2/views/JspSupportServlet.java index 8fde4da96..238ab18f8 100644 --- a/core/src/main/java/org/apache/struts2/views/JspSupportServlet.java +++ b/core/src/main/java/org/apache/struts2/views/JspSupportServlet.java @@ -1,19 +1,22 @@ /* * $Id$ * - * Copyright 2006 The Apache Software Foundation. + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at + * http://www.apache.org/licenses/LICENSE-2.0 * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. */ package org.apache.struts2.views; @@ -24,10 +27,10 @@ import javax.servlet.http.HttpServlet; /** */ public class JspSupportServlet extends HttpServlet { - - private static final long serialVersionUID = 8302309812391541933L; - - public static JspSupportServlet jspSupportServlet; + + private static final long serialVersionUID = 8302309812391541933L; + + public static JspSupportServlet jspSupportServlet; public void init(ServletConfig servletConfig) throws ServletException { super.init(servletConfig); diff --git a/core/src/main/java/org/apache/struts2/views/freemarker/FreemarkerManager.java b/core/src/main/java/org/apache/struts2/views/freemarker/FreemarkerManager.java index 0a3c8d88a..e6f3585dc 100644 --- a/core/src/main/java/org/apache/struts2/views/freemarker/FreemarkerManager.java +++ b/core/src/main/java/org/apache/struts2/views/freemarker/FreemarkerManager.java @@ -1,19 +1,22 @@ /* * $Id$ * - * Copyright 2006 The Apache Software Foundation. + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at + * http://www.apache.org/licenses/LICENSE-2.0 * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. */ package org.apache.struts2.views.freemarker; @@ -211,8 +214,8 @@ public class FreemarkerManager { // Create hash model wrapper for request parameters HttpRequestParametersHashModel reqParametersModel = (HttpRequestParametersHashModel) request.getAttribute(ATTR_REQUEST_PARAMETERS_MODEL); if (reqParametersModel == null || requestModel.getRequest() != request) { - reqParametersModel = new HttpRequestParametersHashModel(request); - request.setAttribute(ATTR_REQUEST_PARAMETERS_MODEL, reqParametersModel); + reqParametersModel = new HttpRequestParametersHashModel(request); + request.setAttribute(ATTR_REQUEST_PARAMETERS_MODEL, reqParametersModel); } model.put(KEY_REQUEST_PARAMETER_MODEL, reqParametersModel); @@ -295,7 +298,7 @@ public class FreemarkerManager { * @param servletContext */ protected freemarker.template.Configuration createConfiguration(ServletContext servletContext) throws TemplateException { - freemarker.template.Configuration configuration = new freemarker.template.Configuration(); + freemarker.template.Configuration configuration = new freemarker.template.Configuration(); configuration.setTemplateLoader(getTemplateLoader(servletContext)); @@ -304,7 +307,7 @@ public class FreemarkerManager { configuration.setObjectWrapper(getObjectWrapper()); if (Settings.isSet(StrutsConstants.STRUTS_I18N_ENCODING)) { - configuration.setDefaultEncoding(Settings.get(StrutsConstants.STRUTS_I18N_ENCODING)); + configuration.setDefaultEncoding(Settings.get(StrutsConstants.STRUTS_I18N_ENCODING)); } loadSettings(servletContext, configuration); diff --git a/core/src/main/java/org/apache/struts2/views/freemarker/FreemarkerResult.java b/core/src/main/java/org/apache/struts2/views/freemarker/FreemarkerResult.java index ac6105df0..25bacc63c 100644 --- a/core/src/main/java/org/apache/struts2/views/freemarker/FreemarkerResult.java +++ b/core/src/main/java/org/apache/struts2/views/freemarker/FreemarkerResult.java @@ -1,19 +1,22 @@ /* * $Id$ * - * Copyright 2006 The Apache Software Foundation. + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at + * http://www.apache.org/licenses/LICENSE-2.0 * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. */ package org.apache.struts2.views.freemarker; @@ -45,7 +48,7 @@ import freemarker.template.TemplateModelException; /** * * - * Renders a view using the Freemarker template engine. + * Renders a view using the Freemarker template engine. *

    * The FreemarkarManager class configures the template loaders so that the * template location can be either @@ -55,7 +58,7 @@ import freemarker.template.TemplateModelException; * *

  • relative to the web root folder. eg /WEB-INF/views/home.ftl *
  • - * + * *
  • a classpath resuorce. eg com/company/web/views/home.ftl
  • * * @@ -70,7 +73,7 @@ import freemarker.template.TemplateModelException; * *
  • location (default) - the location of the template to process.
  • * - *
  • parse - true by default. If set to false, the location param will + *
  • parse - true by default. If set to false, the location param will * not be parsed for Ognl expressions.
  • * *
  • contentType - defaults to "text/html" unless specified.
  • @@ -83,17 +86,17 @@ import freemarker.template.TemplateModelException; * *
      * 
    - * 
    + *
      * <result name="success" type="freemarker">foo.ftl</result>
    - * 
    + *
      * 
      * 
    */ public class FreemarkerResult extends StrutsResultSupport { - private static final long serialVersionUID = -3778230771704661631L; - - protected ActionInvocation invocation; + private static final long serialVersionUID = -3778230771704661631L; + + protected ActionInvocation invocation; protected Configuration configuration; protected ObjectWrapper wrapper; @@ -106,11 +109,11 @@ public class FreemarkerResult extends StrutsResultSupport { private String pContentType = "text/html"; public FreemarkerResult() { - super(); + super(); } - + public FreemarkerResult(String location) { - super(location); + super(location); } public void setContentType(String aContentType) { @@ -146,7 +149,7 @@ public class FreemarkerResult extends StrutsResultSupport { String base = ResourceUtil.getResourceBase(req); location = base + "/" + location; } - + Template template = configuration.getTemplate(location, deduceLocale()); TemplateModel model = createModel(); diff --git a/core/src/main/java/org/apache/struts2/views/freemarker/PortletFreemarkerResult.java b/core/src/main/java/org/apache/struts2/views/freemarker/PortletFreemarkerResult.java index b5d3c5aa9..e0a6d9583 100644 --- a/core/src/main/java/org/apache/struts2/views/freemarker/PortletFreemarkerResult.java +++ b/core/src/main/java/org/apache/struts2/views/freemarker/PortletFreemarkerResult.java @@ -1,19 +1,22 @@ /* * $Id$ * - * Copyright 2006 The Apache Software Foundation. + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at + * http://www.apache.org/licenses/LICENSE-2.0 * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. */ package org.apache.struts2.views.freemarker; @@ -48,9 +51,9 @@ import freemarker.template.TemplateModelException; */ public class PortletFreemarkerResult extends StrutsResultSupport { - private static final long serialVersionUID = -5570612389289887543L; + private static final long serialVersionUID = -5570612389289887543L; - protected ActionInvocation invocation; + protected ActionInvocation invocation; protected Configuration configuration; @@ -58,7 +61,7 @@ public class PortletFreemarkerResult extends StrutsResultSupport { /* * Struts results are constructed for each result execeution - * + * * the current context is availible to subclasses via these protected fields */ protected String location; @@ -66,13 +69,13 @@ public class PortletFreemarkerResult extends StrutsResultSupport { private String pContentType = "text/html"; public PortletFreemarkerResult() { - super(); + super(); } - + public PortletFreemarkerResult(String location) { - super(location); + super(location); } - + public void setContentType(String aContentType) { pContentType = aContentType; } @@ -155,7 +158,7 @@ public class PortletFreemarkerResult extends StrutsResultSupport { } /** - * + * */ private void prepareServletActionContext() throws PortletException, IOException { diff --git a/core/src/main/java/org/apache/struts2/views/freemarker/ScopesHashModel.java b/core/src/main/java/org/apache/struts2/views/freemarker/ScopesHashModel.java index b8387d55c..ace98a588 100644 --- a/core/src/main/java/org/apache/struts2/views/freemarker/ScopesHashModel.java +++ b/core/src/main/java/org/apache/struts2/views/freemarker/ScopesHashModel.java @@ -1,19 +1,22 @@ /* * $Id$ * - * Copyright 2006 The Apache Software Foundation. + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at + * http://www.apache.org/licenses/LICENSE-2.0 * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. */ package org.apache.struts2.views.freemarker; @@ -38,9 +41,9 @@ import freemarker.template.TemplateModelException; */ public class ScopesHashModel extends SimpleHash { - private static final long serialVersionUID = 5551686380141886764L; - - private HttpServletRequest request; + private static final long serialVersionUID = 5551686380141886764L; + + private HttpServletRequest request; private ServletContext servletContext; private ValueStack stack; diff --git a/core/src/main/java/org/apache/struts2/views/freemarker/StrutsBeanWrapper.java b/core/src/main/java/org/apache/struts2/views/freemarker/StrutsBeanWrapper.java index 1cf4284a4..92e051502 100644 --- a/core/src/main/java/org/apache/struts2/views/freemarker/StrutsBeanWrapper.java +++ b/core/src/main/java/org/apache/struts2/views/freemarker/StrutsBeanWrapper.java @@ -1,19 +1,22 @@ /* * $Id$ * - * Copyright 2006 The Apache Software Foundation. + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at + * http://www.apache.org/licenses/LICENSE-2.0 * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. */ package org.apache.struts2.views.freemarker; diff --git a/core/src/main/java/org/apache/struts2/views/freemarker/StrutsClassTemplateLoader.java b/core/src/main/java/org/apache/struts2/views/freemarker/StrutsClassTemplateLoader.java index cda5b46e9..0ef88c0b5 100644 --- a/core/src/main/java/org/apache/struts2/views/freemarker/StrutsClassTemplateLoader.java +++ b/core/src/main/java/org/apache/struts2/views/freemarker/StrutsClassTemplateLoader.java @@ -1,19 +1,22 @@ /* * $Id$ * - * Copyright 2006 The Apache Software Foundation. + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at + * http://www.apache.org/licenses/LICENSE-2.0 * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. */ package org.apache.struts2.views.freemarker; diff --git a/core/src/main/java/org/apache/struts2/views/freemarker/tags/ActionErrorModel.java b/core/src/main/java/org/apache/struts2/views/freemarker/tags/ActionErrorModel.java index 9e66613b4..2c892f1dd 100644 --- a/core/src/main/java/org/apache/struts2/views/freemarker/tags/ActionErrorModel.java +++ b/core/src/main/java/org/apache/struts2/views/freemarker/tags/ActionErrorModel.java @@ -1,19 +1,22 @@ /* * $Id$ * - * Copyright 2006 The Apache Software Foundation. + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at + * http://www.apache.org/licenses/LICENSE-2.0 * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. */ package org.apache.struts2.views.freemarker.tags; diff --git a/core/src/main/java/org/apache/struts2/views/freemarker/tags/ActionMessageModel.java b/core/src/main/java/org/apache/struts2/views/freemarker/tags/ActionMessageModel.java index a3c7508c6..7e1eae03f 100644 --- a/core/src/main/java/org/apache/struts2/views/freemarker/tags/ActionMessageModel.java +++ b/core/src/main/java/org/apache/struts2/views/freemarker/tags/ActionMessageModel.java @@ -1,19 +1,22 @@ /* * $Id$ * - * Copyright 2006 The Apache Software Foundation. + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at + * http://www.apache.org/licenses/LICENSE-2.0 * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. */ package org.apache.struts2.views.freemarker.tags; diff --git a/core/src/main/java/org/apache/struts2/views/freemarker/tags/ActionModel.java b/core/src/main/java/org/apache/struts2/views/freemarker/tags/ActionModel.java index b057657f5..b935c107c 100644 --- a/core/src/main/java/org/apache/struts2/views/freemarker/tags/ActionModel.java +++ b/core/src/main/java/org/apache/struts2/views/freemarker/tags/ActionModel.java @@ -1,19 +1,22 @@ /* * $Id$ * - * Copyright 2006 The Apache Software Foundation. + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at + * http://www.apache.org/licenses/LICENSE-2.0 * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. */ package org.apache.struts2.views.freemarker.tags; diff --git a/core/src/main/java/org/apache/struts2/views/freemarker/tags/AnchorModel.java b/core/src/main/java/org/apache/struts2/views/freemarker/tags/AnchorModel.java index bb529ad80..05b4004a1 100644 --- a/core/src/main/java/org/apache/struts2/views/freemarker/tags/AnchorModel.java +++ b/core/src/main/java/org/apache/struts2/views/freemarker/tags/AnchorModel.java @@ -1,19 +1,22 @@ /* * $Id$ * - * Copyright 2006 The Apache Software Foundation. + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at + * http://www.apache.org/licenses/LICENSE-2.0 * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. */ package org.apache.struts2.views.freemarker.tags; diff --git a/core/src/main/java/org/apache/struts2/views/freemarker/tags/BeanModel.java b/core/src/main/java/org/apache/struts2/views/freemarker/tags/BeanModel.java index d3e7a2678..2ce6f8562 100644 --- a/core/src/main/java/org/apache/struts2/views/freemarker/tags/BeanModel.java +++ b/core/src/main/java/org/apache/struts2/views/freemarker/tags/BeanModel.java @@ -1,19 +1,22 @@ /* * $Id$ * - * Copyright 2006 The Apache Software Foundation. + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at + * http://www.apache.org/licenses/LICENSE-2.0 * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. */ package org.apache.struts2.views.freemarker.tags; diff --git a/core/src/main/java/org/apache/struts2/views/freemarker/tags/CallbackWriter.java b/core/src/main/java/org/apache/struts2/views/freemarker/tags/CallbackWriter.java index cedd7b6b0..89629caf7 100644 --- a/core/src/main/java/org/apache/struts2/views/freemarker/tags/CallbackWriter.java +++ b/core/src/main/java/org/apache/struts2/views/freemarker/tags/CallbackWriter.java @@ -1,19 +1,22 @@ /* * $Id$ * - * Copyright 2006 The Apache Software Foundation. + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at + * http://www.apache.org/licenses/LICENSE-2.0 * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. */ package org.apache.struts2.views.freemarker.tags; diff --git a/core/src/main/java/org/apache/struts2/views/freemarker/tags/CheckboxListModel.java b/core/src/main/java/org/apache/struts2/views/freemarker/tags/CheckboxListModel.java index fb9e28438..ca6c0d953 100644 --- a/core/src/main/java/org/apache/struts2/views/freemarker/tags/CheckboxListModel.java +++ b/core/src/main/java/org/apache/struts2/views/freemarker/tags/CheckboxListModel.java @@ -1,19 +1,22 @@ /* * $Id$ * - * Copyright 2006 The Apache Software Foundation. + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at + * http://www.apache.org/licenses/LICENSE-2.0 * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. */ package org.apache.struts2.views.freemarker.tags; diff --git a/core/src/main/java/org/apache/struts2/views/freemarker/tags/CheckboxModel.java b/core/src/main/java/org/apache/struts2/views/freemarker/tags/CheckboxModel.java index 75f68d84e..8477d7b5e 100644 --- a/core/src/main/java/org/apache/struts2/views/freemarker/tags/CheckboxModel.java +++ b/core/src/main/java/org/apache/struts2/views/freemarker/tags/CheckboxModel.java @@ -1,19 +1,22 @@ /* * $Id$ * - * Copyright 2006 The Apache Software Foundation. + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at + * http://www.apache.org/licenses/LICENSE-2.0 * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. */ package org.apache.struts2.views.freemarker.tags; diff --git a/core/src/main/java/org/apache/struts2/views/freemarker/tags/ComboBoxModel.java b/core/src/main/java/org/apache/struts2/views/freemarker/tags/ComboBoxModel.java index 48f620eb3..b572d2ca8 100644 --- a/core/src/main/java/org/apache/struts2/views/freemarker/tags/ComboBoxModel.java +++ b/core/src/main/java/org/apache/struts2/views/freemarker/tags/ComboBoxModel.java @@ -1,19 +1,22 @@ /* * $Id$ * - * Copyright 2006 The Apache Software Foundation. + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at + * http://www.apache.org/licenses/LICENSE-2.0 * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. */ package org.apache.struts2.views.freemarker.tags; diff --git a/core/src/main/java/org/apache/struts2/views/freemarker/tags/ComponentModel.java b/core/src/main/java/org/apache/struts2/views/freemarker/tags/ComponentModel.java index 8e8b851af..597f72891 100644 --- a/core/src/main/java/org/apache/struts2/views/freemarker/tags/ComponentModel.java +++ b/core/src/main/java/org/apache/struts2/views/freemarker/tags/ComponentModel.java @@ -1,19 +1,22 @@ /* * $Id$ * - * Copyright 2006 The Apache Software Foundation. + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at + * http://www.apache.org/licenses/LICENSE-2.0 * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. */ package org.apache.struts2.views.freemarker.tags; diff --git a/core/src/main/java/org/apache/struts2/views/freemarker/tags/DateModel.java b/core/src/main/java/org/apache/struts2/views/freemarker/tags/DateModel.java index 56ac58386..b7f7c71c6 100644 --- a/core/src/main/java/org/apache/struts2/views/freemarker/tags/DateModel.java +++ b/core/src/main/java/org/apache/struts2/views/freemarker/tags/DateModel.java @@ -1,19 +1,22 @@ /* * $Id$ * - * Copyright 2006 The Apache Software Foundation. + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at + * http://www.apache.org/licenses/LICENSE-2.0 * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. */ package org.apache.struts2.views.freemarker.tags; diff --git a/core/src/main/java/org/apache/struts2/views/freemarker/tags/DatePickerModel.java b/core/src/main/java/org/apache/struts2/views/freemarker/tags/DatePickerModel.java index 51ee611e4..07fe5661e 100644 --- a/core/src/main/java/org/apache/struts2/views/freemarker/tags/DatePickerModel.java +++ b/core/src/main/java/org/apache/struts2/views/freemarker/tags/DatePickerModel.java @@ -1,19 +1,22 @@ /* * $Id$ * - * Copyright 2006 The Apache Software Foundation. + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at + * http://www.apache.org/licenses/LICENSE-2.0 * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. */ package org.apache.struts2.views.freemarker.tags; diff --git a/core/src/main/java/org/apache/struts2/views/freemarker/tags/DivModel.java b/core/src/main/java/org/apache/struts2/views/freemarker/tags/DivModel.java index 2d4134536..6e480d42a 100644 --- a/core/src/main/java/org/apache/struts2/views/freemarker/tags/DivModel.java +++ b/core/src/main/java/org/apache/struts2/views/freemarker/tags/DivModel.java @@ -1,19 +1,22 @@ /* * $Id$ * - * Copyright 2006 The Apache Software Foundation. + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at + * http://www.apache.org/licenses/LICENSE-2.0 * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. */ package org.apache.struts2.views.freemarker.tags; diff --git a/core/src/main/java/org/apache/struts2/views/freemarker/tags/DoubleSelectModel.java b/core/src/main/java/org/apache/struts2/views/freemarker/tags/DoubleSelectModel.java index 4baea67ab..4d6363c43 100644 --- a/core/src/main/java/org/apache/struts2/views/freemarker/tags/DoubleSelectModel.java +++ b/core/src/main/java/org/apache/struts2/views/freemarker/tags/DoubleSelectModel.java @@ -1,19 +1,22 @@ /* * $Id$ * - * Copyright 2006 The Apache Software Foundation. + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at + * http://www.apache.org/licenses/LICENSE-2.0 * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. */ package org.apache.struts2.views.freemarker.tags; diff --git a/core/src/main/java/org/apache/struts2/views/freemarker/tags/ElseIfModel.java b/core/src/main/java/org/apache/struts2/views/freemarker/tags/ElseIfModel.java index 434324ed3..e4248468a 100644 --- a/core/src/main/java/org/apache/struts2/views/freemarker/tags/ElseIfModel.java +++ b/core/src/main/java/org/apache/struts2/views/freemarker/tags/ElseIfModel.java @@ -1,19 +1,22 @@ /* * $Id$ * - * Copyright 2006 The Apache Software Foundation. + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at + * http://www.apache.org/licenses/LICENSE-2.0 * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. */ package org.apache.struts2.views.freemarker.tags; @@ -30,12 +33,12 @@ import com.opensymphony.xwork2.util.ValueStack; */ public class ElseIfModel extends TagModel { - public ElseIfModel(ValueStack stack, HttpServletRequest req, HttpServletResponse res) { - super(stack, req, res); - } + public ElseIfModel(ValueStack stack, HttpServletRequest req, HttpServletResponse res) { + super(stack, req, res); + } + + protected Component getBean() { + return new ElseIf(stack); + } - protected Component getBean() { - return new ElseIf(stack); - } - } diff --git a/core/src/main/java/org/apache/struts2/views/freemarker/tags/ElseModel.java b/core/src/main/java/org/apache/struts2/views/freemarker/tags/ElseModel.java index 64ca5dd94..6ae43665a 100644 --- a/core/src/main/java/org/apache/struts2/views/freemarker/tags/ElseModel.java +++ b/core/src/main/java/org/apache/struts2/views/freemarker/tags/ElseModel.java @@ -1,19 +1,22 @@ /* * $Id$ * - * Copyright 2006 The Apache Software Foundation. + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at + * http://www.apache.org/licenses/LICENSE-2.0 * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. */ package org.apache.struts2.views.freemarker.tags; @@ -26,17 +29,17 @@ import org.apache.struts2.components.Else; import com.opensymphony.xwork2.util.ValueStack; /** - * + * * @version $Date$ $Id$ */ public class ElseModel extends TagModel { - public ElseModel(ValueStack stack, HttpServletRequest req, HttpServletResponse res) { - super(stack, req, res); - } + public ElseModel(ValueStack stack, HttpServletRequest req, HttpServletResponse res) { + super(stack, req, res); + } - protected Component getBean() { - return new Else(stack); - } + protected Component getBean() { + return new Else(stack); + } } diff --git a/core/src/main/java/org/apache/struts2/views/freemarker/tags/FieldErrorModel.java b/core/src/main/java/org/apache/struts2/views/freemarker/tags/FieldErrorModel.java index 93a5e3006..104933009 100644 --- a/core/src/main/java/org/apache/struts2/views/freemarker/tags/FieldErrorModel.java +++ b/core/src/main/java/org/apache/struts2/views/freemarker/tags/FieldErrorModel.java @@ -1,19 +1,22 @@ /* * $Id$ * - * Copyright 2006 The Apache Software Foundation. + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at + * http://www.apache.org/licenses/LICENSE-2.0 * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. */ package org.apache.struts2.views.freemarker.tags; diff --git a/core/src/main/java/org/apache/struts2/views/freemarker/tags/FileModel.java b/core/src/main/java/org/apache/struts2/views/freemarker/tags/FileModel.java index 495513671..3325311ab 100644 --- a/core/src/main/java/org/apache/struts2/views/freemarker/tags/FileModel.java +++ b/core/src/main/java/org/apache/struts2/views/freemarker/tags/FileModel.java @@ -1,19 +1,22 @@ /* * $Id$ * - * Copyright 2006 The Apache Software Foundation. + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at + * http://www.apache.org/licenses/LICENSE-2.0 * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. */ package org.apache.struts2.views.freemarker.tags; diff --git a/core/src/main/java/org/apache/struts2/views/freemarker/tags/FormModel.java b/core/src/main/java/org/apache/struts2/views/freemarker/tags/FormModel.java index a8b1b91bc..b7ea200d8 100644 --- a/core/src/main/java/org/apache/struts2/views/freemarker/tags/FormModel.java +++ b/core/src/main/java/org/apache/struts2/views/freemarker/tags/FormModel.java @@ -1,19 +1,22 @@ /* * $Id$ * - * Copyright 2006 The Apache Software Foundation. + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at + * http://www.apache.org/licenses/LICENSE-2.0 * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. */ package org.apache.struts2.views.freemarker.tags; diff --git a/core/src/main/java/org/apache/struts2/views/freemarker/tags/HeadModel.java b/core/src/main/java/org/apache/struts2/views/freemarker/tags/HeadModel.java index 9100ed41b..adf01b9ee 100644 --- a/core/src/main/java/org/apache/struts2/views/freemarker/tags/HeadModel.java +++ b/core/src/main/java/org/apache/struts2/views/freemarker/tags/HeadModel.java @@ -1,19 +1,22 @@ /* * $Id$ * - * Copyright 2006 The Apache Software Foundation. + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at + * http://www.apache.org/licenses/LICENSE-2.0 * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. */ package org.apache.struts2.views.freemarker.tags; diff --git a/core/src/main/java/org/apache/struts2/views/freemarker/tags/HiddenModel.java b/core/src/main/java/org/apache/struts2/views/freemarker/tags/HiddenModel.java index 5d2a87433..766207a2d 100644 --- a/core/src/main/java/org/apache/struts2/views/freemarker/tags/HiddenModel.java +++ b/core/src/main/java/org/apache/struts2/views/freemarker/tags/HiddenModel.java @@ -1,19 +1,22 @@ /* * $Id$ * - * Copyright 2006 The Apache Software Foundation. + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at + * http://www.apache.org/licenses/LICENSE-2.0 * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. */ package org.apache.struts2.views.freemarker.tags; diff --git a/core/src/main/java/org/apache/struts2/views/freemarker/tags/I18nModel.java b/core/src/main/java/org/apache/struts2/views/freemarker/tags/I18nModel.java index d2f90974c..28a6017e8 100644 --- a/core/src/main/java/org/apache/struts2/views/freemarker/tags/I18nModel.java +++ b/core/src/main/java/org/apache/struts2/views/freemarker/tags/I18nModel.java @@ -1,19 +1,22 @@ /* * $Id$ * - * Copyright 2006 The Apache Software Foundation. + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at + * http://www.apache.org/licenses/LICENSE-2.0 * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. */ package org.apache.struts2.views.freemarker.tags; diff --git a/core/src/main/java/org/apache/struts2/views/freemarker/tags/IfModel.java b/core/src/main/java/org/apache/struts2/views/freemarker/tags/IfModel.java index ef008c23f..60a44ddce 100644 --- a/core/src/main/java/org/apache/struts2/views/freemarker/tags/IfModel.java +++ b/core/src/main/java/org/apache/struts2/views/freemarker/tags/IfModel.java @@ -1,19 +1,22 @@ /* * $Id$ * - * Copyright 2006 The Apache Software Foundation. + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at + * http://www.apache.org/licenses/LICENSE-2.0 * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. */ package org.apache.struts2.views.freemarker.tags; @@ -30,12 +33,12 @@ import com.opensymphony.xwork2.util.ValueStack; */ public class IfModel extends TagModel { - - public IfModel(ValueStack stack, HttpServletRequest req, HttpServletResponse res) { - super(stack, req, res); - } - protected Component getBean() { - return new If(stack); - } + public IfModel(ValueStack stack, HttpServletRequest req, HttpServletResponse res) { + super(stack, req, res); + } + + protected Component getBean() { + return new If(stack); + } } diff --git a/core/src/main/java/org/apache/struts2/views/freemarker/tags/IncludeModel.java b/core/src/main/java/org/apache/struts2/views/freemarker/tags/IncludeModel.java index a74a67afb..a62e2ec7c 100644 --- a/core/src/main/java/org/apache/struts2/views/freemarker/tags/IncludeModel.java +++ b/core/src/main/java/org/apache/struts2/views/freemarker/tags/IncludeModel.java @@ -1,19 +1,22 @@ /* * $Id$ * - * Copyright 2006 The Apache Software Foundation. + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at + * http://www.apache.org/licenses/LICENSE-2.0 * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. */ package org.apache.struts2.views.freemarker.tags; diff --git a/core/src/main/java/org/apache/struts2/views/freemarker/tags/IteratorModel.java b/core/src/main/java/org/apache/struts2/views/freemarker/tags/IteratorModel.java index f4ea11718..00cb8dbe0 100644 --- a/core/src/main/java/org/apache/struts2/views/freemarker/tags/IteratorModel.java +++ b/core/src/main/java/org/apache/struts2/views/freemarker/tags/IteratorModel.java @@ -1,19 +1,22 @@ /* * $Id$ * - * Copyright 2006 The Apache Software Foundation. + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at + * http://www.apache.org/licenses/LICENSE-2.0 * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. */ package org.apache.struts2.views.freemarker.tags; diff --git a/core/src/main/java/org/apache/struts2/views/freemarker/tags/LabelModel.java b/core/src/main/java/org/apache/struts2/views/freemarker/tags/LabelModel.java index d8088e6f4..e7a106181 100644 --- a/core/src/main/java/org/apache/struts2/views/freemarker/tags/LabelModel.java +++ b/core/src/main/java/org/apache/struts2/views/freemarker/tags/LabelModel.java @@ -1,19 +1,22 @@ /* * $Id$ * - * Copyright 2006 The Apache Software Foundation. + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at + * http://www.apache.org/licenses/LICENSE-2.0 * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. */ package org.apache.struts2.views.freemarker.tags; diff --git a/core/src/main/java/org/apache/struts2/views/freemarker/tags/OptGroupModel.java b/core/src/main/java/org/apache/struts2/views/freemarker/tags/OptGroupModel.java index 8d193d734..a428b157b 100644 --- a/core/src/main/java/org/apache/struts2/views/freemarker/tags/OptGroupModel.java +++ b/core/src/main/java/org/apache/struts2/views/freemarker/tags/OptGroupModel.java @@ -1,19 +1,22 @@ /* * $Id$ * - * Copyright 2006 The Apache Software Foundation. + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at + * http://www.apache.org/licenses/LICENSE-2.0 * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. */ package org.apache.struts2.views.freemarker.tags; @@ -30,11 +33,11 @@ import com.opensymphony.xwork2.util.ValueStack; * */ public class OptGroupModel extends TagModel { - public OptGroupModel(ValueStack stack, HttpServletRequest req, HttpServletResponse res) { - super(stack, req, res); - } + public OptGroupModel(ValueStack stack, HttpServletRequest req, HttpServletResponse res) { + super(stack, req, res); + } - protected Component getBean() { - return new OptGroup(stack, req, res); - } + protected Component getBean() { + return new OptGroup(stack, req, res); + } } diff --git a/core/src/main/java/org/apache/struts2/views/freemarker/tags/OptionTransferSelectModel.java b/core/src/main/java/org/apache/struts2/views/freemarker/tags/OptionTransferSelectModel.java index 15b76a7b1..be8b71898 100644 --- a/core/src/main/java/org/apache/struts2/views/freemarker/tags/OptionTransferSelectModel.java +++ b/core/src/main/java/org/apache/struts2/views/freemarker/tags/OptionTransferSelectModel.java @@ -1,19 +1,22 @@ /* * $Id$ * - * Copyright 2006 The Apache Software Foundation. + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at + * http://www.apache.org/licenses/LICENSE-2.0 * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. */ package org.apache.struts2.views.freemarker.tags; @@ -30,12 +33,12 @@ import com.opensymphony.xwork2.util.ValueStack; */ public class OptionTransferSelectModel extends TagModel { - public OptionTransferSelectModel(ValueStack stack, HttpServletRequest req, HttpServletResponse res) { - super(stack, req, res); - } + public OptionTransferSelectModel(ValueStack stack, HttpServletRequest req, HttpServletResponse res) { + super(stack, req, res); + } - protected Component getBean() { - return new OptionTransferSelect(stack, req, res); - } + protected Component getBean() { + return new OptionTransferSelect(stack, req, res); + } } diff --git a/core/src/main/java/org/apache/struts2/views/freemarker/tags/PanelModel.java b/core/src/main/java/org/apache/struts2/views/freemarker/tags/PanelModel.java index 00dc0858c..6e8edffbc 100644 --- a/core/src/main/java/org/apache/struts2/views/freemarker/tags/PanelModel.java +++ b/core/src/main/java/org/apache/struts2/views/freemarker/tags/PanelModel.java @@ -1,19 +1,22 @@ /* * $Id$ * - * Copyright 2006 The Apache Software Foundation. + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at + * http://www.apache.org/licenses/LICENSE-2.0 * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. */ package org.apache.struts2.views.freemarker.tags; diff --git a/core/src/main/java/org/apache/struts2/views/freemarker/tags/ParamModel.java b/core/src/main/java/org/apache/struts2/views/freemarker/tags/ParamModel.java index 74fb7792d..11d584611 100644 --- a/core/src/main/java/org/apache/struts2/views/freemarker/tags/ParamModel.java +++ b/core/src/main/java/org/apache/struts2/views/freemarker/tags/ParamModel.java @@ -1,19 +1,22 @@ /* * $Id$ * - * Copyright 2006 The Apache Software Foundation. + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at + * http://www.apache.org/licenses/LICENSE-2.0 * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. */ package org.apache.struts2.views.freemarker.tags; diff --git a/core/src/main/java/org/apache/struts2/views/freemarker/tags/PasswordModel.java b/core/src/main/java/org/apache/struts2/views/freemarker/tags/PasswordModel.java index 6f9a4d87d..da59537b6 100644 --- a/core/src/main/java/org/apache/struts2/views/freemarker/tags/PasswordModel.java +++ b/core/src/main/java/org/apache/struts2/views/freemarker/tags/PasswordModel.java @@ -1,19 +1,22 @@ /* * $Id$ * - * Copyright 2006 The Apache Software Foundation. + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at + * http://www.apache.org/licenses/LICENSE-2.0 * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. */ package org.apache.struts2.views.freemarker.tags; diff --git a/core/src/main/java/org/apache/struts2/views/freemarker/tags/PropertyModel.java b/core/src/main/java/org/apache/struts2/views/freemarker/tags/PropertyModel.java index 61e9fa034..b0ad49190 100644 --- a/core/src/main/java/org/apache/struts2/views/freemarker/tags/PropertyModel.java +++ b/core/src/main/java/org/apache/struts2/views/freemarker/tags/PropertyModel.java @@ -1,19 +1,22 @@ /* * $Id$ * - * Copyright 2006 The Apache Software Foundation. + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at + * http://www.apache.org/licenses/LICENSE-2.0 * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. */ package org.apache.struts2.views.freemarker.tags; diff --git a/core/src/main/java/org/apache/struts2/views/freemarker/tags/PushModel.java b/core/src/main/java/org/apache/struts2/views/freemarker/tags/PushModel.java index dc74f0d83..c2824938a 100644 --- a/core/src/main/java/org/apache/struts2/views/freemarker/tags/PushModel.java +++ b/core/src/main/java/org/apache/struts2/views/freemarker/tags/PushModel.java @@ -1,19 +1,22 @@ /* * $Id$ * - * Copyright 2006 The Apache Software Foundation. + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at + * http://www.apache.org/licenses/LICENSE-2.0 * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. */ package org.apache.struts2.views.freemarker.tags; diff --git a/core/src/main/java/org/apache/struts2/views/freemarker/tags/RadioModel.java b/core/src/main/java/org/apache/struts2/views/freemarker/tags/RadioModel.java index 358be7f6d..7ecd43a4d 100644 --- a/core/src/main/java/org/apache/struts2/views/freemarker/tags/RadioModel.java +++ b/core/src/main/java/org/apache/struts2/views/freemarker/tags/RadioModel.java @@ -1,19 +1,22 @@ /* * $Id$ * - * Copyright 2006 The Apache Software Foundation. + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at + * http://www.apache.org/licenses/LICENSE-2.0 * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. */ package org.apache.struts2.views.freemarker.tags; diff --git a/core/src/main/java/org/apache/struts2/views/freemarker/tags/ResetModel.java b/core/src/main/java/org/apache/struts2/views/freemarker/tags/ResetModel.java index 40efe93d6..96246e8cb 100644 --- a/core/src/main/java/org/apache/struts2/views/freemarker/tags/ResetModel.java +++ b/core/src/main/java/org/apache/struts2/views/freemarker/tags/ResetModel.java @@ -1,19 +1,22 @@ /* * $Id$ * - * Copyright 2006 The Apache Software Foundation. + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at + * http://www.apache.org/licenses/LICENSE-2.0 * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. */ package org.apache.struts2.views.freemarker.tags; diff --git a/core/src/main/java/org/apache/struts2/views/freemarker/tags/SelectModel.java b/core/src/main/java/org/apache/struts2/views/freemarker/tags/SelectModel.java index 43bc7460f..f92602f36 100644 --- a/core/src/main/java/org/apache/struts2/views/freemarker/tags/SelectModel.java +++ b/core/src/main/java/org/apache/struts2/views/freemarker/tags/SelectModel.java @@ -1,19 +1,22 @@ /* * $Id$ * - * Copyright 2006 The Apache Software Foundation. + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at + * http://www.apache.org/licenses/LICENSE-2.0 * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. */ package org.apache.struts2.views.freemarker.tags; diff --git a/core/src/main/java/org/apache/struts2/views/freemarker/tags/SetModel.java b/core/src/main/java/org/apache/struts2/views/freemarker/tags/SetModel.java index f3828652b..74378afe8 100644 --- a/core/src/main/java/org/apache/struts2/views/freemarker/tags/SetModel.java +++ b/core/src/main/java/org/apache/struts2/views/freemarker/tags/SetModel.java @@ -1,19 +1,22 @@ /* * $Id$ * - * Copyright 2006 The Apache Software Foundation. + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at + * http://www.apache.org/licenses/LICENSE-2.0 * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. */ package org.apache.struts2.views.freemarker.tags; diff --git a/core/src/main/java/org/apache/struts2/views/freemarker/tags/StrutsModels.java b/core/src/main/java/org/apache/struts2/views/freemarker/tags/StrutsModels.java index 298a8388e..d2f1c1a89 100644 --- a/core/src/main/java/org/apache/struts2/views/freemarker/tags/StrutsModels.java +++ b/core/src/main/java/org/apache/struts2/views/freemarker/tags/StrutsModels.java @@ -1,19 +1,22 @@ /* * $Id$ * - * Copyright 2006 The Apache Software Foundation. + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at + * http://www.apache.org/licenses/LICENSE-2.0 * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. */ package org.apache.struts2.views.freemarker.tags; @@ -78,7 +81,7 @@ public class StrutsModels { protected ElseModel elseModel; protected ElseIfModel elseIfModel; protected TimePickerModel timePickerModel; - + public StrutsModels(ValueStack stack, HttpServletRequest req, HttpServletResponse res) { this.stack = stack; @@ -404,12 +407,12 @@ public class StrutsModels { return fielderror; } - + public OptionTransferSelectModel getOptiontransferselect() { - if (optiontransferselect == null) { - optiontransferselect = new OptionTransferSelectModel(stack, req, res); - } - return optiontransferselect; + if (optiontransferselect == null) { + optiontransferselect = new OptionTransferSelectModel(stack, req, res); + } + return optiontransferselect; } public TreeModel getTree() { @@ -418,46 +421,46 @@ public class StrutsModels { } return treeModel; } - + public UpDownSelectModel getUpdownselect() { - if (updownselect == null) { - updownselect = new UpDownSelectModel(stack, req, res); - } - return updownselect; + if (updownselect == null) { + updownselect = new UpDownSelectModel(stack, req, res); + } + return updownselect; } - + public OptGroupModel getOptgroup() { - if (optGroupModel == null) { - optGroupModel = new OptGroupModel(stack, req, res); - } - return optGroupModel; + if (optGroupModel == null) { + optGroupModel = new OptGroupModel(stack, req, res); + } + return optGroupModel; } - + public IfModel getIf() { - if (ifModel == null) { - ifModel = new IfModel(stack, req, res); - } - return ifModel; + if (ifModel == null) { + ifModel = new IfModel(stack, req, res); + } + return ifModel; } - + public ElseModel getElse() { - if (elseModel == null) { - elseModel = new ElseModel(stack, req, res); - } - return elseModel; + if (elseModel == null) { + elseModel = new ElseModel(stack, req, res); + } + return elseModel; } - + public ElseIfModel getElseif() { - if (elseIfModel == null) { - elseIfModel = new ElseIfModel(stack, req, res); - } - return elseIfModel; + if (elseIfModel == null) { + elseIfModel = new ElseIfModel(stack, req, res); + } + return elseIfModel; } - + public TimePickerModel getTimepicker() { - if (timePickerModel == null) { - timePickerModel = new TimePickerModel(stack, req, res); - } - return timePickerModel; + if (timePickerModel == null) { + timePickerModel = new TimePickerModel(stack, req, res); + } + return timePickerModel; } } diff --git a/core/src/main/java/org/apache/struts2/views/freemarker/tags/SubmitModel.java b/core/src/main/java/org/apache/struts2/views/freemarker/tags/SubmitModel.java index 6d91e4fa6..fc881b8be 100644 --- a/core/src/main/java/org/apache/struts2/views/freemarker/tags/SubmitModel.java +++ b/core/src/main/java/org/apache/struts2/views/freemarker/tags/SubmitModel.java @@ -1,19 +1,22 @@ /* * $Id$ * - * Copyright 2006 The Apache Software Foundation. + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at + * http://www.apache.org/licenses/LICENSE-2.0 * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. */ package org.apache.struts2.views.freemarker.tags; diff --git a/core/src/main/java/org/apache/struts2/views/freemarker/tags/TabbedPanelModel.java b/core/src/main/java/org/apache/struts2/views/freemarker/tags/TabbedPanelModel.java index 00db842a9..b4b4a2bff 100644 --- a/core/src/main/java/org/apache/struts2/views/freemarker/tags/TabbedPanelModel.java +++ b/core/src/main/java/org/apache/struts2/views/freemarker/tags/TabbedPanelModel.java @@ -1,19 +1,22 @@ /* * $Id$ * - * Copyright 2006 The Apache Software Foundation. + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at + * http://www.apache.org/licenses/LICENSE-2.0 * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. */ package org.apache.struts2.views.freemarker.tags; diff --git a/core/src/main/java/org/apache/struts2/views/freemarker/tags/TagModel.java b/core/src/main/java/org/apache/struts2/views/freemarker/tags/TagModel.java index 4b89a654c..008de0ed7 100644 --- a/core/src/main/java/org/apache/struts2/views/freemarker/tags/TagModel.java +++ b/core/src/main/java/org/apache/struts2/views/freemarker/tags/TagModel.java @@ -1,19 +1,22 @@ /* * $Id$ * - * Copyright 2006 The Apache Software Foundation. + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at + * http://www.apache.org/licenses/LICENSE-2.0 * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. */ package org.apache.struts2.views.freemarker.tags; diff --git a/core/src/main/java/org/apache/struts2/views/freemarker/tags/TextAreaModel.java b/core/src/main/java/org/apache/struts2/views/freemarker/tags/TextAreaModel.java index 69f7ada39..540c3757a 100644 --- a/core/src/main/java/org/apache/struts2/views/freemarker/tags/TextAreaModel.java +++ b/core/src/main/java/org/apache/struts2/views/freemarker/tags/TextAreaModel.java @@ -1,19 +1,22 @@ /* * $Id$ * - * Copyright 2006 The Apache Software Foundation. + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at + * http://www.apache.org/licenses/LICENSE-2.0 * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. */ package org.apache.struts2.views.freemarker.tags; diff --git a/core/src/main/java/org/apache/struts2/views/freemarker/tags/TextFieldModel.java b/core/src/main/java/org/apache/struts2/views/freemarker/tags/TextFieldModel.java index d80d5c693..b73ce5439 100644 --- a/core/src/main/java/org/apache/struts2/views/freemarker/tags/TextFieldModel.java +++ b/core/src/main/java/org/apache/struts2/views/freemarker/tags/TextFieldModel.java @@ -1,19 +1,22 @@ /* * $Id$ * - * Copyright 2006 The Apache Software Foundation. + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at + * http://www.apache.org/licenses/LICENSE-2.0 * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. */ package org.apache.struts2.views.freemarker.tags; diff --git a/core/src/main/java/org/apache/struts2/views/freemarker/tags/TextModel.java b/core/src/main/java/org/apache/struts2/views/freemarker/tags/TextModel.java index e14f05129..2894d1de5 100644 --- a/core/src/main/java/org/apache/struts2/views/freemarker/tags/TextModel.java +++ b/core/src/main/java/org/apache/struts2/views/freemarker/tags/TextModel.java @@ -1,19 +1,22 @@ /* * $Id$ * - * Copyright 2006 The Apache Software Foundation. + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at + * http://www.apache.org/licenses/LICENSE-2.0 * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. */ package org.apache.struts2.views.freemarker.tags; diff --git a/core/src/main/java/org/apache/struts2/views/freemarker/tags/TokenModel.java b/core/src/main/java/org/apache/struts2/views/freemarker/tags/TokenModel.java index 0d800a990..0cbeb494c 100644 --- a/core/src/main/java/org/apache/struts2/views/freemarker/tags/TokenModel.java +++ b/core/src/main/java/org/apache/struts2/views/freemarker/tags/TokenModel.java @@ -1,19 +1,22 @@ /* * $Id$ * - * Copyright 2006 The Apache Software Foundation. + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at + * http://www.apache.org/licenses/LICENSE-2.0 * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. */ package org.apache.struts2.views.freemarker.tags; diff --git a/core/src/main/java/org/apache/struts2/views/freemarker/tags/TreeModel.java b/core/src/main/java/org/apache/struts2/views/freemarker/tags/TreeModel.java index b27a238fc..a337d4f62 100644 --- a/core/src/main/java/org/apache/struts2/views/freemarker/tags/TreeModel.java +++ b/core/src/main/java/org/apache/struts2/views/freemarker/tags/TreeModel.java @@ -1,19 +1,22 @@ /* * $Id$ * - * Copyright 2006 The Apache Software Foundation. + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at + * http://www.apache.org/licenses/LICENSE-2.0 * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. */ package org.apache.struts2.views.freemarker.tags; diff --git a/core/src/main/java/org/apache/struts2/views/freemarker/tags/TreeNodeModel.java b/core/src/main/java/org/apache/struts2/views/freemarker/tags/TreeNodeModel.java index c2735e3bc..4fe047bea 100644 --- a/core/src/main/java/org/apache/struts2/views/freemarker/tags/TreeNodeModel.java +++ b/core/src/main/java/org/apache/struts2/views/freemarker/tags/TreeNodeModel.java @@ -1,19 +1,22 @@ /* * $Id$ * - * Copyright 2006 The Apache Software Foundation. + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at + * http://www.apache.org/licenses/LICENSE-2.0 * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. */ package org.apache.struts2.views.freemarker.tags; diff --git a/core/src/main/java/org/apache/struts2/views/freemarker/tags/URLModel.java b/core/src/main/java/org/apache/struts2/views/freemarker/tags/URLModel.java index 0b3cd8557..61049750f 100644 --- a/core/src/main/java/org/apache/struts2/views/freemarker/tags/URLModel.java +++ b/core/src/main/java/org/apache/struts2/views/freemarker/tags/URLModel.java @@ -1,19 +1,22 @@ /* * $Id$ * - * Copyright 2006 The Apache Software Foundation. + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at + * http://www.apache.org/licenses/LICENSE-2.0 * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. */ package org.apache.struts2.views.freemarker.tags; diff --git a/core/src/main/java/org/apache/struts2/views/freemarker/tags/UpDownSelectModel.java b/core/src/main/java/org/apache/struts2/views/freemarker/tags/UpDownSelectModel.java index 484cacbbe..4ce573ed8 100644 --- a/core/src/main/java/org/apache/struts2/views/freemarker/tags/UpDownSelectModel.java +++ b/core/src/main/java/org/apache/struts2/views/freemarker/tags/UpDownSelectModel.java @@ -1,19 +1,22 @@ /* * $Id$ * - * Copyright 2006 The Apache Software Foundation. + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at + * http://www.apache.org/licenses/LICENSE-2.0 * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. */ package org.apache.struts2.views.freemarker.tags; @@ -27,16 +30,16 @@ import com.opensymphony.xwork2.util.ValueStack; /** * @see UpDownSelect - * + * */ public class UpDownSelectModel extends TagModel { - public UpDownSelectModel(ValueStack stack, HttpServletRequest req, HttpServletResponse res) { - super(stack, req, res); - } + public UpDownSelectModel(ValueStack stack, HttpServletRequest req, HttpServletResponse res) { + super(stack, req, res); + } - protected Component getBean() { - return new UpDownSelect(stack, req, res); - } + protected Component getBean() { + return new UpDownSelect(stack, req, res); + } } diff --git a/core/src/main/java/org/apache/struts2/views/freemarker/tags/WebTableModel.java b/core/src/main/java/org/apache/struts2/views/freemarker/tags/WebTableModel.java index 2757dbfba..ee7d7df79 100644 --- a/core/src/main/java/org/apache/struts2/views/freemarker/tags/WebTableModel.java +++ b/core/src/main/java/org/apache/struts2/views/freemarker/tags/WebTableModel.java @@ -1,19 +1,22 @@ /* * $Id$ * - * Copyright 2006 The Apache Software Foundation. + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at + * http://www.apache.org/licenses/LICENSE-2.0 * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. */ package org.apache.struts2.views.freemarker.tags; diff --git a/core/src/main/java/org/apache/struts2/views/jsp/ActionTag.java b/core/src/main/java/org/apache/struts2/views/jsp/ActionTag.java index 8538ede4c..5aeef45e6 100644 --- a/core/src/main/java/org/apache/struts2/views/jsp/ActionTag.java +++ b/core/src/main/java/org/apache/struts2/views/jsp/ActionTag.java @@ -1,19 +1,22 @@ /* * $Id$ * - * Copyright 2006 The Apache Software Foundation. + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at + * http://www.apache.org/licenses/LICENSE-2.0 * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. */ package org.apache.struts2.views.jsp; @@ -29,10 +32,10 @@ import com.opensymphony.xwork2.util.ValueStack; * @see ActionComponent */ public class ActionTag extends ComponentTagSupport { - - private static final long serialVersionUID = -5384167073331678855L; - - protected String name; + + private static final long serialVersionUID = -5384167073331678855L; + + protected String name; protected String namespace; protected boolean executeResult; protected boolean ignoreContextParams; @@ -74,12 +77,12 @@ public class ActionTag extends ComponentTagSupport { public void setIgnoreContextParams(boolean ignoreContextParams) { this.ignoreContextParams = ignoreContextParams; } - + public void setFlush(boolean flush) { - this.flush = flush; + this.flush = flush; } - + public boolean getFlush() { - return this.flush; + return this.flush; } } diff --git a/core/src/main/java/org/apache/struts2/views/jsp/BeanTag.java b/core/src/main/java/org/apache/struts2/views/jsp/BeanTag.java index 1316ace2f..cc6f4d916 100644 --- a/core/src/main/java/org/apache/struts2/views/jsp/BeanTag.java +++ b/core/src/main/java/org/apache/struts2/views/jsp/BeanTag.java @@ -1,19 +1,22 @@ /* * $Id$ * - * Copyright 2006 The Apache Software Foundation. + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at + * http://www.apache.org/licenses/LICENSE-2.0 * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. */ package org.apache.struts2.views.jsp; @@ -32,10 +35,10 @@ import com.opensymphony.xwork2.util.ValueStack; * @see Bean */ public class BeanTag extends ComponentTagSupport { - - private static final long serialVersionUID = -3863152522071209267L; - protected static Log log = LogFactory.getLog(BeanTag.class); + private static final long serialVersionUID = -3863152522071209267L; + + protected static Log log = LogFactory.getLog(BeanTag.class); protected String name; diff --git a/core/src/main/java/org/apache/struts2/views/jsp/ComponentTagSupport.java b/core/src/main/java/org/apache/struts2/views/jsp/ComponentTagSupport.java index 32ba71620..b27ea80ab 100644 --- a/core/src/main/java/org/apache/struts2/views/jsp/ComponentTagSupport.java +++ b/core/src/main/java/org/apache/struts2/views/jsp/ComponentTagSupport.java @@ -1,19 +1,22 @@ /* * $Id$ * - * Copyright 2006 The Apache Software Foundation. + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at + * http://www.apache.org/licenses/LICENSE-2.0 * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. */ package org.apache.struts2.views.jsp; diff --git a/core/src/main/java/org/apache/struts2/views/jsp/DateTag.java b/core/src/main/java/org/apache/struts2/views/jsp/DateTag.java index 893cb83db..309faea10 100644 --- a/core/src/main/java/org/apache/struts2/views/jsp/DateTag.java +++ b/core/src/main/java/org/apache/struts2/views/jsp/DateTag.java @@ -1,19 +1,22 @@ /* * $Id$ * - * Copyright 2006 The Apache Software Foundation. + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at + * http://www.apache.org/licenses/LICENSE-2.0 * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. */ package org.apache.struts2.views.jsp; @@ -30,9 +33,9 @@ import com.opensymphony.xwork2.util.ValueStack; */ public class DateTag extends ComponentTagSupport { - private static final long serialVersionUID = -6216963123295613440L; - - protected String name; + private static final long serialVersionUID = -6216963123295613440L; + + protected String name; protected String format; protected boolean nice; diff --git a/core/src/main/java/org/apache/struts2/views/jsp/ElseIfTag.java b/core/src/main/java/org/apache/struts2/views/jsp/ElseIfTag.java index d52c853ce..d464b6dae 100644 --- a/core/src/main/java/org/apache/struts2/views/jsp/ElseIfTag.java +++ b/core/src/main/java/org/apache/struts2/views/jsp/ElseIfTag.java @@ -1,19 +1,22 @@ /* * $Id$ * - * Copyright 2006 The Apache Software Foundation. + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at + * http://www.apache.org/licenses/LICENSE-2.0 * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. */ package org.apache.struts2.views.jsp; @@ -29,10 +32,10 @@ import com.opensymphony.xwork2.util.ValueStack; * @see ElseIf */ public class ElseIfTag extends ComponentTagSupport { - - private static final long serialVersionUID = -3872016920741400345L; - - protected String test; + + private static final long serialVersionUID = -3872016920741400345L; + + protected String test; public Component getBean(ValueStack stack, HttpServletRequest req, HttpServletResponse res) { return new ElseIf(stack); diff --git a/core/src/main/java/org/apache/struts2/views/jsp/ElseTag.java b/core/src/main/java/org/apache/struts2/views/jsp/ElseTag.java index 7954e26de..ee795f747 100644 --- a/core/src/main/java/org/apache/struts2/views/jsp/ElseTag.java +++ b/core/src/main/java/org/apache/struts2/views/jsp/ElseTag.java @@ -1,19 +1,22 @@ /* * $Id$ * - * Copyright 2006 The Apache Software Foundation. + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at + * http://www.apache.org/licenses/LICENSE-2.0 * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. */ package org.apache.struts2.views.jsp; @@ -30,10 +33,10 @@ import com.opensymphony.xwork2.util.ValueStack; * @see Else */ public class ElseTag extends ComponentTagSupport { - - private static final long serialVersionUID = 8166807953193406785L; - public Component getBean(ValueStack stack, HttpServletRequest req, HttpServletResponse res) { + private static final long serialVersionUID = 8166807953193406785L; + + public Component getBean(ValueStack stack, HttpServletRequest req, HttpServletResponse res) { return new Else(stack); } } diff --git a/core/src/main/java/org/apache/struts2/views/jsp/I18nTag.java b/core/src/main/java/org/apache/struts2/views/jsp/I18nTag.java index 49b24a9e2..2fee30acd 100644 --- a/core/src/main/java/org/apache/struts2/views/jsp/I18nTag.java +++ b/core/src/main/java/org/apache/struts2/views/jsp/I18nTag.java @@ -1,19 +1,22 @@ /* * $Id$ * - * Copyright 2006 The Apache Software Foundation. + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at + * http://www.apache.org/licenses/LICENSE-2.0 * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. */ package org.apache.struts2.views.jsp; @@ -30,10 +33,10 @@ import com.opensymphony.xwork2.util.ValueStack; * @see I18n */ public class I18nTag extends ComponentTagSupport { - - private static final long serialVersionUID = -7914587341936116887L; - - protected String name; + + private static final long serialVersionUID = -7914587341936116887L; + + protected String name; public Component getBean(ValueStack stack, HttpServletRequest req, HttpServletResponse res) { return new I18n(stack); diff --git a/core/src/main/java/org/apache/struts2/views/jsp/IfTag.java b/core/src/main/java/org/apache/struts2/views/jsp/IfTag.java index 6f5bdcda0..c181a4529 100644 --- a/core/src/main/java/org/apache/struts2/views/jsp/IfTag.java +++ b/core/src/main/java/org/apache/struts2/views/jsp/IfTag.java @@ -1,19 +1,22 @@ /* * $Id$ * - * Copyright 2006 The Apache Software Foundation. + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at + * http://www.apache.org/licenses/LICENSE-2.0 * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. */ package org.apache.struts2.views.jsp; @@ -30,10 +33,10 @@ import com.opensymphony.xwork2.util.ValueStack; * @see If */ public class IfTag extends ComponentTagSupport { - - private static final long serialVersionUID = 4448870162549923833L; - - String test; + + private static final long serialVersionUID = 4448870162549923833L; + + String test; public Component getBean(ValueStack stack, HttpServletRequest req, HttpServletResponse res) { return new If(stack); diff --git a/core/src/main/java/org/apache/struts2/views/jsp/IncludeTag.java b/core/src/main/java/org/apache/struts2/views/jsp/IncludeTag.java index a2d45bf3a..dacfc302f 100644 --- a/core/src/main/java/org/apache/struts2/views/jsp/IncludeTag.java +++ b/core/src/main/java/org/apache/struts2/views/jsp/IncludeTag.java @@ -1,19 +1,22 @@ /* * $Id$ * - * Copyright 2006 The Apache Software Foundation. + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at + * http://www.apache.org/licenses/LICENSE-2.0 * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. */ package org.apache.struts2.views.jsp; @@ -30,10 +33,10 @@ import com.opensymphony.xwork2.util.ValueStack; * @see Include */ public class IncludeTag extends ComponentTagSupport { - - private static final long serialVersionUID = -1585165567043278243L; - - protected String value; + + private static final long serialVersionUID = -1585165567043278243L; + + protected String value; public Component getBean(ValueStack stack, HttpServletRequest req, HttpServletResponse res) { return new Include(stack, req, res); diff --git a/core/src/main/java/org/apache/struts2/views/jsp/IteratorStatus.java b/core/src/main/java/org/apache/struts2/views/jsp/IteratorStatus.java index ff216b0b3..3b1dbe4bf 100644 --- a/core/src/main/java/org/apache/struts2/views/jsp/IteratorStatus.java +++ b/core/src/main/java/org/apache/struts2/views/jsp/IteratorStatus.java @@ -1,19 +1,22 @@ /* * $Id$ * - * Copyright 2006 The Apache Software Foundation. + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at + * http://www.apache.org/licenses/LICENSE-2.0 * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. */ package org.apache.struts2.views.jsp; diff --git a/core/src/main/java/org/apache/struts2/views/jsp/IteratorTag.java b/core/src/main/java/org/apache/struts2/views/jsp/IteratorTag.java index 1c944ff60..1e0066ea2 100644 --- a/core/src/main/java/org/apache/struts2/views/jsp/IteratorTag.java +++ b/core/src/main/java/org/apache/struts2/views/jsp/IteratorTag.java @@ -1,19 +1,22 @@ /* * $Id$ * - * Copyright 2006 The Apache Software Foundation. + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at + * http://www.apache.org/licenses/LICENSE-2.0 * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. */ package org.apache.struts2.views.jsp; @@ -31,9 +34,9 @@ import com.opensymphony.xwork2.util.ValueStack; */ public class IteratorTag extends ComponentTagSupport { - private static final long serialVersionUID = -1827978135193581901L; - - protected String statusAttr; + private static final long serialVersionUID = -1827978135193581901L; + + protected String statusAttr; protected String value; public Component getBean(ValueStack stack, HttpServletRequest req, HttpServletResponse res) { @@ -41,8 +44,8 @@ public class IteratorTag extends ComponentTagSupport { } protected void populateParams() { - super.populateParams(); - + super.populateParams(); + IteratorComponent tag = (IteratorComponent) getComponent(); tag.setStatus(statusAttr); tag.setValue(value); diff --git a/core/src/main/java/org/apache/struts2/views/jsp/ParamTag.java b/core/src/main/java/org/apache/struts2/views/jsp/ParamTag.java index fd67c5d2f..8819ff116 100644 --- a/core/src/main/java/org/apache/struts2/views/jsp/ParamTag.java +++ b/core/src/main/java/org/apache/struts2/views/jsp/ParamTag.java @@ -1,19 +1,22 @@ /* * $Id$ * - * Copyright 2006 The Apache Software Foundation. + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at + * http://www.apache.org/licenses/LICENSE-2.0 * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. */ package org.apache.struts2.views.jsp; @@ -29,10 +32,10 @@ import com.opensymphony.xwork2.util.ValueStack; * @see Param */ public class ParamTag extends ComponentTagSupport { - - private static final long serialVersionUID = -968332732207156408L; - - protected String name; + + private static final long serialVersionUID = -968332732207156408L; + + protected String name; protected String value; public Component getBean(ValueStack stack, HttpServletRequest req, HttpServletResponse res) { diff --git a/core/src/main/java/org/apache/struts2/views/jsp/PropertyTag.java b/core/src/main/java/org/apache/struts2/views/jsp/PropertyTag.java index ffd925aee..ed612d9db 100644 --- a/core/src/main/java/org/apache/struts2/views/jsp/PropertyTag.java +++ b/core/src/main/java/org/apache/struts2/views/jsp/PropertyTag.java @@ -1,19 +1,22 @@ /* * $Id$ * - * Copyright 2006 The Apache Software Foundation. + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at + * http://www.apache.org/licenses/LICENSE-2.0 * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. */ package org.apache.struts2.views.jsp; @@ -30,10 +33,10 @@ import com.opensymphony.xwork2.util.ValueStack; * @see Property */ public class PropertyTag extends ComponentTagSupport { - - private static final long serialVersionUID = 435308349113743852L; - - private String defaultValue; + + private static final long serialVersionUID = 435308349113743852L; + + private String defaultValue; private String value; private boolean escape = true; diff --git a/core/src/main/java/org/apache/struts2/views/jsp/PushTag.java b/core/src/main/java/org/apache/struts2/views/jsp/PushTag.java index 6645f4a7b..14cfa0b06 100644 --- a/core/src/main/java/org/apache/struts2/views/jsp/PushTag.java +++ b/core/src/main/java/org/apache/struts2/views/jsp/PushTag.java @@ -1,19 +1,22 @@ /* * $Id$ * - * Copyright 2006 The Apache Software Foundation. + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at + * http://www.apache.org/licenses/LICENSE-2.0 * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. */ package org.apache.struts2.views.jsp; @@ -30,10 +33,10 @@ import com.opensymphony.xwork2.util.ValueStack; * @see Push */ public class PushTag extends ComponentTagSupport { - - private static final long serialVersionUID = -1357895305148907931L; - - protected String value; + + private static final long serialVersionUID = -1357895305148907931L; + + protected String value; public Component getBean(ValueStack stack, HttpServletRequest req, HttpServletResponse res) { return new Push(stack); diff --git a/core/src/main/java/org/apache/struts2/views/jsp/SetTag.java b/core/src/main/java/org/apache/struts2/views/jsp/SetTag.java index 13170ed48..9c64c3de9 100644 --- a/core/src/main/java/org/apache/struts2/views/jsp/SetTag.java +++ b/core/src/main/java/org/apache/struts2/views/jsp/SetTag.java @@ -1,19 +1,22 @@ /* * $Id$ * - * Copyright 2006 The Apache Software Foundation. + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at + * http://www.apache.org/licenses/LICENSE-2.0 * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. */ package org.apache.struts2.views.jsp; @@ -30,10 +33,10 @@ import com.opensymphony.xwork2.util.ValueStack; * @see Set */ public class SetTag extends ComponentTagSupport { - - private static final long serialVersionUID = -5074213926790716974L; - - protected String name; + + private static final long serialVersionUID = -5074213926790716974L; + + protected String name; protected String scope; protected String value; diff --git a/core/src/main/java/org/apache/struts2/views/jsp/StrutsBodyTagSupport.java b/core/src/main/java/org/apache/struts2/views/jsp/StrutsBodyTagSupport.java index 8b7b7e5ce..2dab2181b 100644 --- a/core/src/main/java/org/apache/struts2/views/jsp/StrutsBodyTagSupport.java +++ b/core/src/main/java/org/apache/struts2/views/jsp/StrutsBodyTagSupport.java @@ -1,19 +1,22 @@ /* * $Id$ * - * Copyright 2006 The Apache Software Foundation. + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at + * http://www.apache.org/licenses/LICENSE-2.0 * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. */ package org.apache.struts2.views.jsp; @@ -29,7 +32,7 @@ import com.opensymphony.xwork2.util.ValueStack; /** * Contains common functonalities for Struts JSP Tags. - * + * */ public class StrutsBodyTagSupport extends BodyTagSupport { @@ -42,7 +45,7 @@ public class StrutsBodyTagSupport extends BodyTagSupport { public void setId(String string) { super.setId(string); } - + protected boolean altSyntax() { return ContextUtil.isUseAltSyntax(getStack().getContext()); } @@ -97,7 +100,7 @@ public class StrutsBodyTagSupport extends BodyTagSupport { return bodyContent.getString().trim(); } } - + public static String translateVariables(String expression, ValueStack stack) { while (true) { int x = expression.indexOf("%{"); diff --git a/core/src/main/java/org/apache/struts2/views/jsp/TagUtils.java b/core/src/main/java/org/apache/struts2/views/jsp/TagUtils.java index cb7c1d778..58f2aa3dd 100644 --- a/core/src/main/java/org/apache/struts2/views/jsp/TagUtils.java +++ b/core/src/main/java/org/apache/struts2/views/jsp/TagUtils.java @@ -1,19 +1,22 @@ /* * $Id$ * - * Copyright 2006 The Apache Software Foundation. + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at + * http://www.apache.org/licenses/LICENSE-2.0 * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. */ package org.apache.struts2.views.jsp; diff --git a/core/src/main/java/org/apache/struts2/views/jsp/TextTag.java b/core/src/main/java/org/apache/struts2/views/jsp/TextTag.java index ebcdc549a..e9eb4adaf 100644 --- a/core/src/main/java/org/apache/struts2/views/jsp/TextTag.java +++ b/core/src/main/java/org/apache/struts2/views/jsp/TextTag.java @@ -1,19 +1,22 @@ /* * $Id$ * - * Copyright 2006 The Apache Software Foundation. + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at + * http://www.apache.org/licenses/LICENSE-2.0 * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. */ package org.apache.struts2.views.jsp; @@ -30,10 +33,10 @@ import com.opensymphony.xwork2.util.ValueStack; * @see Text */ public class TextTag extends ComponentTagSupport { - - private static final long serialVersionUID = -3075088084198264581L; - - protected String name; + + private static final long serialVersionUID = -3075088084198264581L; + + protected String name; public Component getBean(ValueStack stack, HttpServletRequest req, HttpServletResponse res) { return new Text(stack); diff --git a/core/src/main/java/org/apache/struts2/views/jsp/URLTag.java b/core/src/main/java/org/apache/struts2/views/jsp/URLTag.java index 9fbf7780d..f8fbb5381 100644 --- a/core/src/main/java/org/apache/struts2/views/jsp/URLTag.java +++ b/core/src/main/java/org/apache/struts2/views/jsp/URLTag.java @@ -1,19 +1,22 @@ /* * $Id$ * - * Copyright 2006 The Apache Software Foundation. + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at + * http://www.apache.org/licenses/LICENSE-2.0 * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. */ package org.apache.struts2.views.jsp; @@ -30,10 +33,10 @@ import com.opensymphony.xwork2.util.ValueStack; * @see URL */ public class URLTag extends ComponentTagSupport { - - private static final long serialVersionUID = 1722460444125206226L; - protected String includeParams; + private static final long serialVersionUID = 1722460444125206226L; + + protected String includeParams; protected String scheme; protected String value; protected String action; diff --git a/core/src/main/java/org/apache/struts2/views/jsp/iterator/AppendIteratorTag.java b/core/src/main/java/org/apache/struts2/views/jsp/iterator/AppendIteratorTag.java index 0d68b356b..484c37546 100644 --- a/core/src/main/java/org/apache/struts2/views/jsp/iterator/AppendIteratorTag.java +++ b/core/src/main/java/org/apache/struts2/views/jsp/iterator/AppendIteratorTag.java @@ -1,19 +1,22 @@ /* * $Id$ * - * Copyright 2006 The Apache Software Foundation. + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at + * http://www.apache.org/licenses/LICENSE-2.0 * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. */ package org.apache.struts2.views.jsp.iterator; @@ -35,10 +38,10 @@ import com.opensymphony.xwork2.util.ValueStack; */ public class AppendIteratorTag extends ComponentTagSupport { - private static final long serialVersionUID = -6017337859763283691L; + private static final long serialVersionUID = -6017337859763283691L; + + public Component getBean(ValueStack stack, HttpServletRequest req, HttpServletResponse res) { + return new AppendIterator(stack); + } - public Component getBean(ValueStack stack, HttpServletRequest req, HttpServletResponse res) { - return new AppendIterator(stack); - } - } diff --git a/core/src/main/java/org/apache/struts2/views/jsp/iterator/IteratorGeneratorTag.java b/core/src/main/java/org/apache/struts2/views/jsp/iterator/IteratorGeneratorTag.java index 90e4c921b..050fb321c 100644 --- a/core/src/main/java/org/apache/struts2/views/jsp/iterator/IteratorGeneratorTag.java +++ b/core/src/main/java/org/apache/struts2/views/jsp/iterator/IteratorGeneratorTag.java @@ -1,19 +1,22 @@ /* * $Id$ * - * Copyright 2006 The Apache Software Foundation. + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at + * http://www.apache.org/licenses/LICENSE-2.0 * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. */ package org.apache.struts2.views.jsp.iterator; @@ -29,20 +32,20 @@ import org.apache.struts2.views.jsp.StrutsBodyTagSupport; /** * * NOTE: JSP-TAG - * + * *

    Generate an iterator based on the val attribute supplied.

    - * + * * NOTE: The generated iterator will ALWAYS be pushed into the top of the stack, and poped * at the end of the tag. * * * *
      - *
    • val* (Object) - the source to be parsed into an iterator
    • - *
    • count (Object) - the max number (Integer, Float, Double, Long, String) entries to be in the iterator
    • - *
    • separator (String) - the separator to be used in separating the val into entries of the iterator
    • - *
    • id (String) - the id to store the resultant iterator into page context, if such id is supplied
    • - *
    • converter (Object) - the converter (must extends off IteratorGenerator.Converter interface) to convert the String entry parsed from val into an object
    • + *
    • val* (Object) - the source to be parsed into an iterator
    • + *
    • count (Object) - the max number (Integer, Float, Double, Long, String) entries to be in the iterator
    • + *
    • separator (String) - the separator to be used in separating the val into entries of the iterator
    • + *
    • id (String) - the id to store the resultant iterator into page context, if such id is supplied
    • + *
    • converter (Object) - the converter (must extends off IteratorGenerator.Converter interface) to convert the String entry parsed from val into an object
    • *
    * * @@ -52,9 +55,9 @@ import org.apache.struts2.views.jsp.StrutsBodyTagSupport; *
      * Generate a simple iterator
      * <s:generator val="%{'aaa,bbb,ccc,ddd,eee'}">
    - *	<s:iterator>
    - *		<s:property /><br/>
    - *	</s:iterator>
    + *  <s:iterator>
    + *      <s:property /><br/>
    + *  </s:iterator>
      * </s:generator>
      * 
    * This generates an iterator and print it out using the iterator tag. @@ -63,9 +66,9 @@ import org.apache.struts2.views.jsp.StrutsBodyTagSupport; *
      * Generate an iterator with count attribute
      * <s:generator val="%{'aaa,bbb,ccc,ddd,eee'}" count="3">
    - *	<s:iterator>
    - *		<s:property /><br/>
    - *	</s:iterator>
    + *  <s:iterator>
    + *      <s:property /><br/>
    + *  </s:iterator>
      * </s:generator>
      * 
    * This generates an iterator, but only 3 entries will be available in the iterator @@ -76,11 +79,11 @@ import org.apache.struts2.views.jsp.StrutsBodyTagSupport; * Generate an iterator with id attribute * <s:generator val="%{'aaa,bbb,ccc,ddd,eee'}" count="4" separator="," id="myAtt" /> * <% - * Iterator i = (Iterator) pageContext.getAttribute("myAtt"); - * while(i.hasNext()) { - * String s = (String) i.next(); %> - * <%=s%> <br/> - * <% } + * Iterator i = (Iterator) pageContext.getAttribute("myAtt"); + * while(i.hasNext()) { + * String s = (String) i.next(); %> + * <%=s%> <br/> + * <% } * %> * * This generates an iterator and put it in the PageContext under the key as specified @@ -91,9 +94,9 @@ import org.apache.struts2.views.jsp.StrutsBodyTagSupport; *
      * Generate an iterator with comparator attribute
      * <s:generator val="%{'aaa,bbb,ccc,ddd,eee'}" converter="%{myConverter}">
    - *	<s:iterator>
    - * 		<s:property /><br/>
    - * 	</s:iterator>
    + *  <s:iterator>
    + *      <s:property /><br/>
    + *  </s:iterator>
      * </s:generator>
      *
      *
    @@ -101,13 +104,13 @@ import org.apache.struts2.views.jsp.StrutsBodyTagSupport;
      *
      *   ....
      *
    - *	 public Converter getMyConverter() {
    - *		return new Converter() {
    - *			public Object convert(String value) throws Exception {
    - *				return "converter-"+value;
    - *			}
    - *		};
    - *	 }
    + *   public Converter getMyConverter() {
    + *      return new Converter() {
    + *          public Object convert(String value) throws Exception {
    + *              return "converter-"+value;
    + *          }
    + *      };
    + *   }
      *
      *   ...
      *
    @@ -124,11 +127,11 @@ import org.apache.struts2.views.jsp.StrutsBodyTagSupport;
      */
     public class IteratorGeneratorTag extends StrutsBodyTagSupport {
     
    -	private static final long serialVersionUID = 2968037295463973936L;
    +    private static final long serialVersionUID = 2968037295463973936L;
     
    -	public static final String DEFAULT_SEPARATOR = ",";
    +    public static final String DEFAULT_SEPARATOR = ",";
     
    -	private static final Log _log = LogFactory.getLog(IteratorGeneratorTag.class);
    +    private static final Log _log = LogFactory.getLog(IteratorGeneratorTag.class);
     
         String countAttr;
         String separatorAttr;
    @@ -166,7 +169,7 @@ public class IteratorGeneratorTag extends StrutsBodyTagSupport {
          * description="the converter to convert the String entry parsed from val into an object"
          */
         public void setConverter(String aConverter) {
    -    	converterAttr = aConverter;
    +        converterAttr = aConverter;
         }
     
         /**
    @@ -179,75 +182,75 @@ public class IteratorGeneratorTag extends StrutsBodyTagSupport {
     
         public int doStartTag() throws JspException {
     
    -    	// value
    -    	Object value = findValue(valueAttr);
    +        // value
    +        Object value = findValue(valueAttr);
     
    -    	// separator
    -    	String separator = DEFAULT_SEPARATOR;
    -    	if (separatorAttr != null && separatorAttr.length() > 0) {
    -    		separator = findString(separatorAttr);
    -    	}
    +        // separator
    +        String separator = DEFAULT_SEPARATOR;
    +        if (separatorAttr != null && separatorAttr.length() > 0) {
    +            separator = findString(separatorAttr);
    +        }
     
    -    	// TODO: maybe this could be put into an Util class, or there is already one?
    -    	// count
    -    	int count = 0;
    -    	if (countAttr != null && countAttr.length() > 0) {
    -    		Object countObj = findValue(countAttr);
    -    		if (countObj instanceof Integer) {
    -    			count = ((Integer)countObj).intValue();
    -    		}
    -    		else if (countObj instanceof Float) {
    -    			count = ((Float)countObj).intValue();
    -    		}
    -    		else if (countObj instanceof Long) {
    -    			count = ((Long)countObj).intValue();
    -    		}
    -    		else if (countObj instanceof Double) {
    -    			count = ((Long)countObj).intValue();
    -    		}
    -    		else if (countObj instanceof String) {
    -    			try {
    -    				count = Integer.parseInt((String)countObj);
    -    			}
    -    			catch(NumberFormatException e) {
    -    				_log.warn("unable to convert count attribute ["+countObj+"] to number, ignore count attribute", e);
    -    			}
    -    		}
    -    	}
    +        // TODO: maybe this could be put into an Util class, or there is already one?
    +        // count
    +        int count = 0;
    +        if (countAttr != null && countAttr.length() > 0) {
    +            Object countObj = findValue(countAttr);
    +            if (countObj instanceof Integer) {
    +                count = ((Integer)countObj).intValue();
    +            }
    +            else if (countObj instanceof Float) {
    +                count = ((Float)countObj).intValue();
    +            }
    +            else if (countObj instanceof Long) {
    +                count = ((Long)countObj).intValue();
    +            }
    +            else if (countObj instanceof Double) {
    +                count = ((Long)countObj).intValue();
    +            }
    +            else if (countObj instanceof String) {
    +                try {
    +                    count = Integer.parseInt((String)countObj);
    +                }
    +                catch(NumberFormatException e) {
    +                    _log.warn("unable to convert count attribute ["+countObj+"] to number, ignore count attribute", e);
    +                }
    +            }
    +        }
     
    -    	// converter
    -    	Converter converter = null;
    -    	if (converterAttr != null && converterAttr.length() > 0) {
    -    		converter = (Converter) findValue(converterAttr);
    -    	}
    +        // converter
    +        Converter converter = null;
    +        if (converterAttr != null && converterAttr.length() > 0) {
    +            converter = (Converter) findValue(converterAttr);
    +        }
     
     
    -    	iteratorGenerator = new IteratorGenerator();
    -    	iteratorGenerator.setValues(value);
    -    	iteratorGenerator.setCount(count);
    -    	iteratorGenerator.setSeparator(separator);
    -    	iteratorGenerator.setConverter(converter);
    +        iteratorGenerator = new IteratorGenerator();
    +        iteratorGenerator.setValues(value);
    +        iteratorGenerator.setCount(count);
    +        iteratorGenerator.setSeparator(separator);
    +        iteratorGenerator.setConverter(converter);
     
    -    	iteratorGenerator.execute();
    +        iteratorGenerator.execute();
     
     
     
    -    	// push resulting iterator into stack
    -    	getStack().push(iteratorGenerator);
    -    	if (getId() != null && getId().length() > 0) {
    -    		// if an id is specified, we have the resulting iterator set into
    -    		// the pageContext attribute as well
    -    		pageContext.setAttribute(getId(), iteratorGenerator);
    -    	}
    +        // push resulting iterator into stack
    +        getStack().push(iteratorGenerator);
    +        if (getId() != null && getId().length() > 0) {
    +            // if an id is specified, we have the resulting iterator set into
    +            // the pageContext attribute as well
    +            pageContext.setAttribute(getId(), iteratorGenerator);
    +        }
     
             return EVAL_BODY_INCLUDE;
         }
     
         public int doEndTag() throws JspException {
    -    	// pop resulting iterator from stack at end tag
    -    	getStack().pop();
    -    	iteratorGenerator = null; // clean up
    +        // pop resulting iterator from stack at end tag
    +        getStack().pop();
    +        iteratorGenerator = null; // clean up
     
    -    	return EVAL_PAGE;
    +        return EVAL_PAGE;
         }
     }
    diff --git a/core/src/main/java/org/apache/struts2/views/jsp/iterator/MergeIteratorTag.java b/core/src/main/java/org/apache/struts2/views/jsp/iterator/MergeIteratorTag.java
    index 9d3eec513..a673dd631 100644
    --- a/core/src/main/java/org/apache/struts2/views/jsp/iterator/MergeIteratorTag.java
    +++ b/core/src/main/java/org/apache/struts2/views/jsp/iterator/MergeIteratorTag.java
    @@ -1,19 +1,22 @@
     /*
      * $Id$
      *
    - * Copyright 2006 The Apache Software Foundation.
    + * Licensed to the Apache Software Foundation (ASF) under one
    + * or more contributor license agreements.  See the NOTICE file
    + * distributed with this work for additional information
    + * regarding copyright ownership.  The ASF licenses this file
    + * to you under the Apache License, Version 2.0 (the
    + * "License"); you may not use this file except in compliance
    + * with the License.  You may obtain a copy of the License at
      *
    - * Licensed under the Apache License, Version 2.0 (the "License");
    - * you may not use this file except in compliance with the License.
    - * You may obtain a copy of the License at
    + *  http://www.apache.org/licenses/LICENSE-2.0
      *
    - *      http://www.apache.org/licenses/LICENSE-2.0
    - *
    - * Unless required by applicable law or agreed to in writing, software
    - * distributed under the License is distributed on an "AS IS" BASIS,
    - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
    - * See the License for the specific language governing permissions and
    - * limitations under the License.
    + * Unless required by applicable law or agreed to in writing,
    + * software distributed under the License is distributed on an
    + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
    + * KIND, either express or implied.  See the License for the
    + * specific language governing permissions and limitations
    + * under the License.
      */
     package org.apache.struts2.views.jsp.iterator;
     
    @@ -36,10 +39,10 @@ import com.opensymphony.xwork2.util.ValueStack;
      */
     public class MergeIteratorTag extends ComponentTagSupport {
     
    -	private static final long serialVersionUID = 4999729472466011218L;
    +    private static final long serialVersionUID = 4999729472466011218L;
     
    -	public Component getBean(ValueStack stack, HttpServletRequest req, HttpServletResponse res) {
    -		return new MergeIterator(stack);
    -	}
    +    public Component getBean(ValueStack stack, HttpServletRequest req, HttpServletResponse res) {
    +        return new MergeIterator(stack);
    +    }
     
     }
    diff --git a/core/src/main/java/org/apache/struts2/views/jsp/iterator/SortIteratorTag.java b/core/src/main/java/org/apache/struts2/views/jsp/iterator/SortIteratorTag.java
    index 2c7f6e65b..9ef3bfd02 100644
    --- a/core/src/main/java/org/apache/struts2/views/jsp/iterator/SortIteratorTag.java
    +++ b/core/src/main/java/org/apache/struts2/views/jsp/iterator/SortIteratorTag.java
    @@ -1,19 +1,22 @@
     /*
      * $Id$
      *
    - * Copyright 2006 The Apache Software Foundation.
    + * Licensed to the Apache Software Foundation (ASF) under one
    + * or more contributor license agreements.  See the NOTICE file
    + * distributed with this work for additional information
    + * regarding copyright ownership.  The ASF licenses this file
    + * to you under the Apache License, Version 2.0 (the
    + * "License"); you may not use this file except in compliance
    + * with the License.  You may obtain a copy of the License at
      *
    - * Licensed under the Apache License, Version 2.0 (the "License");
    - * you may not use this file except in compliance with the License.
    - * You may obtain a copy of the License at
    + *  http://www.apache.org/licenses/LICENSE-2.0
      *
    - *      http://www.apache.org/licenses/LICENSE-2.0
    - *
    - * Unless required by applicable law or agreed to in writing, software
    - * distributed under the License is distributed on an "AS IS" BASIS,
    - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
    - * See the License for the specific language governing permissions and
    - * limitations under the License.
    + * Unless required by applicable law or agreed to in writing,
    + * software distributed under the License is distributed on an
    + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
    + * KIND, either express or implied.  See the License for the
    + * specific language governing permissions and limitations
    + * under the License.
      */
     package org.apache.struts2.views.jsp.iterator;
     
    @@ -30,7 +33,7 @@ import org.apache.struts2.views.jsp.StrutsBodyTagSupport;
      * 
      *
      * NOTE: JSP-TAG
    - * 
    + *
      * 

    A Tag that sorts a List using a Comparator both passed in as the tag attribute. * If 'id' attribute is specified, the sorted list will be placed into the PageContext * attribute using the key specified by 'id'. The sorted list will ALWAYS be @@ -42,9 +45,9 @@ import org.apache.struts2.views.jsp.StrutsBodyTagSupport; * * *

      - *
    • id (String) - if specified, the sorted iterator will be place with this id under page context
    • - *
    • source (Object) - the source for the sort to take place (should be iteratable) else JspException will be thrown
    • - *
    • comparator* (Object) - the comparator used to do sorting (should be a type of Comparator or its decendent) else JspException will be thrown
    • + *
    • id (String) - if specified, the sorted iterator will be place with this id under page context
    • + *
    • source (Object) - the source for the sort to take place (should be iteratable) else JspException will be thrown
    • + *
    • comparator* (Object) - the comparator used to do sorting (should be a type of Comparator or its decendent) else JspException will be thrown
    • *
    * * @@ -57,8 +60,8 @@ import org.apache.struts2.views.jsp.StrutsBodyTagSupport; * USAGE 1: * <s:sort comparator="myComparator" source="myList"> * <s:iterator> - * <!-- do something with each sorted elements --> - * <s:property value="..." /> + * <!-- do something with each sorted elements --> + * <s:property value="..." /> * </s:iterator> * </s:sort> * @@ -68,7 +71,7 @@ import org.apache.struts2.views.jsp.StrutsBodyTagSupport; * <% * Iterator sortedIterator = (Iterator) pageContext.getAttribute("mySortedList"); * for (Iterator i = sortedIterator; i.hasNext(); ) { - * // do something with each of the sorted elements + * // do something with each of the sorted elements * } * %> * @@ -83,9 +86,9 @@ import org.apache.struts2.views.jsp.StrutsBodyTagSupport; */ public class SortIteratorTag extends StrutsBodyTagSupport { - private static final long serialVersionUID = -7835719609764092235L; + private static final long serialVersionUID = -7835719609764092235L; - String comparatorAttr; + String comparatorAttr; String sourceAttr; SortIteratorFilter sortIteratorFilter = null; @@ -107,7 +110,7 @@ public class SortIteratorTag extends StrutsBodyTagSupport { } public int doStartTag() throws JspException { - // Source + // Source Object srcToSort; if (sourceAttr == null) { srcToSort = findValue("top"); @@ -115,13 +118,13 @@ public class SortIteratorTag extends StrutsBodyTagSupport { srcToSort = findValue(sourceAttr); } if (! MakeIterator.isIterable(srcToSort)) { // see if source is Iteratable - throw new JspException("source ["+srcToSort+"] is not iteratable"); + throw new JspException("source ["+srcToSort+"] is not iteratable"); } // Comparator Object comparatorObj = findValue(comparatorAttr); if (! (comparatorObj instanceof Comparator)) { - throw new JspException("comparator ["+comparatorObj+"] does not implements Comparator interface"); + throw new JspException("comparator ["+comparatorObj+"] does not implements Comparator interface"); } Comparator c = (Comparator) findValue(comparatorAttr); @@ -132,21 +135,21 @@ public class SortIteratorTag extends StrutsBodyTagSupport { sortIteratorFilter.execute(); // push sorted iterator into stack, so nexted tag have access to it - getStack().push(sortIteratorFilter); + getStack().push(sortIteratorFilter); if (getId() != null && getId().length() > 0) { - pageContext.setAttribute(getId(), sortIteratorFilter); + pageContext.setAttribute(getId(), sortIteratorFilter); } return EVAL_BODY_INCLUDE; } public int doEndTag() throws JspException { - int returnVal = super.doEndTag(); + int returnVal = super.doEndTag(); - // pop sorted list from stack at the end of tag - getStack().pop(); - sortIteratorFilter = null; + // pop sorted list from stack at the end of tag + getStack().pop(); + sortIteratorFilter = null; - return returnVal; + return returnVal; } } diff --git a/core/src/main/java/org/apache/struts2/views/jsp/iterator/SubsetIteratorTag.java b/core/src/main/java/org/apache/struts2/views/jsp/iterator/SubsetIteratorTag.java index 47a7b5e5f..6f6b55c2a 100644 --- a/core/src/main/java/org/apache/struts2/views/jsp/iterator/SubsetIteratorTag.java +++ b/core/src/main/java/org/apache/struts2/views/jsp/iterator/SubsetIteratorTag.java @@ -1,19 +1,22 @@ /* * $Id$ * - * Copyright 2006 The Apache Software Foundation. + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at + * http://www.apache.org/licenses/LICENSE-2.0 * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. */ package org.apache.struts2.views.jsp.iterator; @@ -29,7 +32,7 @@ import org.apache.struts2.views.jsp.StrutsBodyTagSupport; /** * * NOTE: JSP-TAG - * + * *

    A tag that takes an iterator and outputs a subset of it. It delegates to * {@link org.apache.struts2.util.SubsetIteratorFilter} internally to * perform the subset functionality.

    @@ -37,11 +40,11 @@ import org.apache.struts2.views.jsp.StrutsBodyTagSupport; * * *
      - *
    • count (Object) - Indicate the number of entries to be in the resulting subset iterator
    • - *
    • source* (Object) - Indicate the source of which the resulting subset iterator is to be derived base on
    • - *
    • start (Object) - Indicate the starting index (eg. first entry is 0) of entries in the source to be available as the first entry in the resulting subset iterator
    • - *
    • decider (Object) - Extension to plug-in a decider to determine if that particular entry is to be included in the resulting subset iterator
    • - *
    • id (String) - Indicate the pageContext attribute id to store the resultant subset iterator in
    • + *
    • count (Object) - Indicate the number of entries to be in the resulting subset iterator
    • + *
    • source* (Object) - Indicate the source of which the resulting subset iterator is to be derived base on
    • + *
    • start (Object) - Indicate the starting index (eg. first entry is 0) of entries in the source to be available as the first entry in the resulting subset iterator
    • + *
    • decider (Object) - Extension to plug-in a decider to determine if that particular entry is to be included in the resulting subset iterator
    • + *
    • id (String) - Indicate the pageContext attribute id to store the resultant subset iterator in
    • *
    * * @@ -50,33 +53,33 @@ import org.apache.struts2.views.jsp.StrutsBodyTagSupport; * * public class MySubsetTagAction extends ActionSupport { * public String execute() throws Exception { - * l = new ArrayList(); - * l.add(new Integer(1)); - * l.add(new Integer(2)); - * l.add(new Integer(3)); - * l.add(new Integer(4)); - * l.add(new Integer(5)); - * return "done"; - * } + * l = new ArrayList(); + * l.add(new Integer(1)); + * l.add(new Integer(2)); + * l.add(new Integer(3)); + * l.add(new Integer(4)); + * l.add(new Integer(5)); + * return "done"; + * } * * - * public Integer[] getMyArray() { - * return a; - * } + * public Integer[] getMyArray() { + * return a; + * } * - * public List getMyList() { - * return l; - * } + * public List getMyList() { + * return l; + * } * * public Decider getMyDecider() { - * return new Decider() { - * public boolean decide(Object element) throws Exception { - * int i = ((Integer)element).intValue(); - * return (((i % 2) == 0)?true:false); - * } - * }; - * } - * } + * return new Decider() { + * public boolean decide(Object element) throws Exception { + * int i = ((Integer)element).intValue(); + * return (((i % 2) == 0)?true:false); + * } + * }; + * } + * } * *
    * @@ -85,9 +88,9 @@ import org.apache.struts2.views.jsp.StrutsBodyTagSupport; * * <!-- s: List basic --> * <s:subset source="myList"> - * <s:iterator> - * <s:property /> - * </s:iterator> + * <s:iterator> + * <s:property /> + * </s:iterator> * </s:subset> * * @@ -96,9 +99,9 @@ import org.apache.struts2.views.jsp.StrutsBodyTagSupport; * * <!-- B: List with count --> * <s:subset source="myList" count="3"> - * <s:iterator> - * <s:property /> - * </s:iterator> + * <s:iterator> + * <s:property /> + * </s:iterator> * </s:subset> * * @@ -107,9 +110,9 @@ import org.apache.struts2.views.jsp.StrutsBodyTagSupport; * * <!-- C: List with start --> * <s:subset source="myList" count="13" start="3"> - * <s:iterator> - * <s:property /> - * </s:iterator> + * <s:iterator> + * <s:property /> + * </s:iterator> * </s:subset> * * @@ -119,7 +122,7 @@ import org.apache.struts2.views.jsp.StrutsBodyTagSupport; * <!-- D: List with id --> * <s:subset id="mySubset" source="myList" count="13" start="3" /> * <% - * Iterator i = (Iterator) pageContext.getAttribute("mySubset"); + * Iterator i = (Iterator) pageContext.getAttribute("mySubset"); * while(i.hasNext()) { * %> * <%=i.next() %> @@ -131,9 +134,9 @@ import org.apache.struts2.views.jsp.StrutsBodyTagSupport; * * <!-- D: List with Decider --> * <s:subset source="myList" decider="myDecider"> - * <s:iterator> - * <s:property /> - * </s:iterator> + * <s:iterator> + * <s:property /> + * </s:iterator> * </s:subset> * * @@ -144,9 +147,9 @@ import org.apache.struts2.views.jsp.StrutsBodyTagSupport; */ public class SubsetIteratorTag extends StrutsBodyTagSupport { - private static final long serialVersionUID = -6252696081713080102L; + private static final long serialVersionUID = -6252696081713080102L; - private static final Log _log = LogFactory.getLog(SubsetIteratorTag.class); + private static final Log _log = LogFactory.getLog(SubsetIteratorTag.class); String countAttr; String sourceAttr; @@ -185,7 +188,7 @@ public class SubsetIteratorTag extends StrutsBodyTagSupport { * description="Extension to plug-in a decider to determine if that particular entry is to be included in the resulting subset iterator" */ public void setDecider(String decider) { - deciderAttr = decider; + deciderAttr = decider; } @@ -194,71 +197,71 @@ public class SubsetIteratorTag extends StrutsBodyTagSupport { // source Object source = null; if (sourceAttr == null && sourceAttr.length() <= 0) { - source = findValue("top"); + source = findValue("top"); } else { source = findValue(sourceAttr); } // count int count = -1; - if (countAttr != null && countAttr.length() > 0) { - Object countObj = findValue(countAttr); - if (countObj instanceof Integer) { - count = ((Integer)countObj).intValue(); - } - else if (countObj instanceof Float) { - count = ((Float)countObj).intValue(); - } - else if (countObj instanceof Long) { - count = ((Long)countObj).intValue(); - } - else if (countObj instanceof Double) { - count = ((Long)countObj).intValue(); - } - else if (countObj instanceof String) { - try { - count = Integer.parseInt((String)countObj); - } - catch(NumberFormatException e) { - _log.warn("unable to convert count attribute ["+countObj+"] to number, ignore count attribute", e); - } - } - } + if (countAttr != null && countAttr.length() > 0) { + Object countObj = findValue(countAttr); + if (countObj instanceof Integer) { + count = ((Integer)countObj).intValue(); + } + else if (countObj instanceof Float) { + count = ((Float)countObj).intValue(); + } + else if (countObj instanceof Long) { + count = ((Long)countObj).intValue(); + } + else if (countObj instanceof Double) { + count = ((Long)countObj).intValue(); + } + else if (countObj instanceof String) { + try { + count = Integer.parseInt((String)countObj); + } + catch(NumberFormatException e) { + _log.warn("unable to convert count attribute ["+countObj+"] to number, ignore count attribute", e); + } + } + } // start - int start = 0; + int start = 0; if (startAttr != null && startAttr.length() > 0) { Object startObj = findValue(startAttr); if (startObj instanceof Integer) { - start = ((Integer)startObj).intValue(); - } - else if (startObj instanceof Float) { - start = ((Float)startObj).intValue(); - } - else if (startObj instanceof Long) { - start = ((Long)startObj).intValue(); - } - else if (startObj instanceof Double) { - start = ((Long)startObj).intValue(); - } - else if (startObj instanceof String) { - try { - start = Integer.parseInt((String)startObj); - } - catch(NumberFormatException e) { - _log.warn("unable to convert count attribute ["+startObj+"] to number, ignore count attribute", e); - } - } + start = ((Integer)startObj).intValue(); + } + else if (startObj instanceof Float) { + start = ((Float)startObj).intValue(); + } + else if (startObj instanceof Long) { + start = ((Long)startObj).intValue(); + } + else if (startObj instanceof Double) { + start = ((Long)startObj).intValue(); + } + else if (startObj instanceof String) { + try { + start = Integer.parseInt((String)startObj); + } + catch(NumberFormatException e) { + _log.warn("unable to convert count attribute ["+startObj+"] to number, ignore count attribute", e); + } + } } // decider Decider decider = null; if (deciderAttr != null && deciderAttr.length() > 0) { - Object deciderObj = findValue(deciderAttr); - if (! (deciderObj instanceof Decider)) { - throw new JspException("decider found from stack ["+deciderObj+"] does not implement "+Decider.class); - } - decider = (Decider) deciderObj; + Object deciderObj = findValue(deciderAttr); + if (! (deciderObj instanceof Decider)) { + throw new JspException("decider found from stack ["+deciderObj+"] does not implement "+Decider.class); + } + decider = (Decider) deciderObj; } @@ -271,7 +274,7 @@ public class SubsetIteratorTag extends StrutsBodyTagSupport { getStack().push(subsetIteratorFilter); if (getId() != null) { - pageContext.setAttribute(getId(), subsetIteratorFilter); + pageContext.setAttribute(getId(), subsetIteratorFilter); } return EVAL_BODY_INCLUDE; @@ -279,10 +282,10 @@ public class SubsetIteratorTag extends StrutsBodyTagSupport { public int doEndTag() throws JspException { - getStack().pop(); + getStack().pop(); - subsetIteratorFilter = null; + subsetIteratorFilter = null; - return EVAL_PAGE; + return EVAL_PAGE; } } diff --git a/core/src/main/java/org/apache/struts2/views/jsp/ui/AbstractClosingTag.java b/core/src/main/java/org/apache/struts2/views/jsp/ui/AbstractClosingTag.java index f6feec829..6b92a95c4 100644 --- a/core/src/main/java/org/apache/struts2/views/jsp/ui/AbstractClosingTag.java +++ b/core/src/main/java/org/apache/struts2/views/jsp/ui/AbstractClosingTag.java @@ -1,19 +1,22 @@ /* * $Id$ * - * Copyright 2006 The Apache Software Foundation. + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at + * http://www.apache.org/licenses/LICENSE-2.0 * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. */ package org.apache.struts2.views.jsp.ui; diff --git a/core/src/main/java/org/apache/struts2/views/jsp/ui/AbstractDoubleListTag.java b/core/src/main/java/org/apache/struts2/views/jsp/ui/AbstractDoubleListTag.java index 26d3d1c31..50dee4455 100644 --- a/core/src/main/java/org/apache/struts2/views/jsp/ui/AbstractDoubleListTag.java +++ b/core/src/main/java/org/apache/struts2/views/jsp/ui/AbstractDoubleListTag.java @@ -1,19 +1,22 @@ /* * $Id$ * - * Copyright 2006 The Apache Software Foundation. + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at + * http://www.apache.org/licenses/LICENSE-2.0 * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. */ package org.apache.struts2.views.jsp.ui; @@ -23,20 +26,20 @@ import org.apache.struts2.components.DoubleListUIBean; /** */ public abstract class AbstractDoubleListTag extends AbstractRequiredListTag { - + protected String doubleList; protected String doubleListKey; protected String doubleListValue; protected String doubleName; protected String doubleValue; protected String formName; - + protected String emptyOption; protected String headerKey; protected String headerValue; protected String multiple; protected String size; - + protected String doubleId; protected String doubleDisabled; protected String doubleMultiple; @@ -44,10 +47,10 @@ public abstract class AbstractDoubleListTag extends AbstractRequiredListTag { protected String doubleHeaderKey; protected String doubleHeaderValue; protected String doubleEmptyOption; - + protected String doubleCssClass; protected String doubleCssStyle; - + protected String doubleOnclick; protected String doubleOndblclick; protected String doubleOnmousedown; @@ -62,7 +65,7 @@ public abstract class AbstractDoubleListTag extends AbstractRequiredListTag { protected String doubleOnkeyup; protected String doubleOnselect; protected String doubleOnchange; - + protected String doubleAccesskey; protected void populateParams() { @@ -75,7 +78,7 @@ public abstract class AbstractDoubleListTag extends AbstractRequiredListTag { bean.setDoubleName(doubleName); bean.setDoubleValue(doubleValue); bean.setFormName(formName); - + bean.setDoubleId(doubleId); bean.setDoubleDisabled(doubleDisabled); bean.setDoubleMultiple(doubleMultiple); @@ -83,10 +86,10 @@ public abstract class AbstractDoubleListTag extends AbstractRequiredListTag { bean.setDoubleHeaderKey(doubleHeaderKey); bean.setDoubleHeaderValue(doubleHeaderValue); bean.setDoubleEmptyOption(doubleEmptyOption); - + bean.setDoubleCssClass(doubleCssClass); bean.setDoubleCssStyle(doubleCssStyle); - + bean.setDoubleOnclick(doubleOnclick); bean.setDoubleOndblclick(doubleOndblclick); bean.setDoubleOnmousedown(doubleOnmousedown); @@ -101,9 +104,9 @@ public abstract class AbstractDoubleListTag extends AbstractRequiredListTag { bean.setDoubleOnkeyup(doubleOnkeyup); bean.setDoubleOnselect(doubleOnselect); bean.setDoubleOnchange(doubleOnchange); - + bean.setDoubleAccesskey(doubleAccesskey); - + bean.setEmptyOption(emptyOption); bean.setHeaderKey(headerKey); bean.setHeaderValue(headerValue); @@ -135,215 +138,215 @@ public abstract class AbstractDoubleListTag extends AbstractRequiredListTag { this.formName = formName; } - public String getDoubleCssClass() { - return doubleCssClass; - } + public String getDoubleCssClass() { + return doubleCssClass; + } - public void setDoubleCssClass(String doubleCssClass) { - this.doubleCssClass = doubleCssClass; - } + public void setDoubleCssClass(String doubleCssClass) { + this.doubleCssClass = doubleCssClass; + } - public String getDoubleCssStyle() { - return doubleCssStyle; - } + public String getDoubleCssStyle() { + return doubleCssStyle; + } - public void setDoubleCssStyle(String doubleCssStyle) { - this.doubleCssStyle = doubleCssStyle; - } + public void setDoubleCssStyle(String doubleCssStyle) { + this.doubleCssStyle = doubleCssStyle; + } - public String getDoubleDisabled() { - return doubleDisabled; - } + public String getDoubleDisabled() { + return doubleDisabled; + } - public void setDoubleDisabled(String doubleDisabled) { - this.doubleDisabled = doubleDisabled; - } + public void setDoubleDisabled(String doubleDisabled) { + this.doubleDisabled = doubleDisabled; + } - public String getDoubleEmptyOption() { - return doubleEmptyOption; - } + public String getDoubleEmptyOption() { + return doubleEmptyOption; + } - public void setDoubleEmptyOption(String doubleEmptyOption) { - this.doubleEmptyOption = doubleEmptyOption; - } + public void setDoubleEmptyOption(String doubleEmptyOption) { + this.doubleEmptyOption = doubleEmptyOption; + } - public String getDoubleHeaderKey() { - return doubleHeaderKey; - } + public String getDoubleHeaderKey() { + return doubleHeaderKey; + } - public void setDoubleHeaderKey(String doubleHeaderKey) { - this.doubleHeaderKey = doubleHeaderKey; - } + public void setDoubleHeaderKey(String doubleHeaderKey) { + this.doubleHeaderKey = doubleHeaderKey; + } - public String getDoubleHeaderValue() { - return doubleHeaderValue; - } + public String getDoubleHeaderValue() { + return doubleHeaderValue; + } - public void setDoubleHeaderValue(String doubleHeaderValue) { - this.doubleHeaderValue = doubleHeaderValue; - } + public void setDoubleHeaderValue(String doubleHeaderValue) { + this.doubleHeaderValue = doubleHeaderValue; + } - public String getDoubleId() { - return doubleId; - } + public String getDoubleId() { + return doubleId; + } - public void setDoubleId(String doubleId) { - this.doubleId = doubleId; - } + public void setDoubleId(String doubleId) { + this.doubleId = doubleId; + } - public String getDoubleMultiple() { - return doubleMultiple; - } + public String getDoubleMultiple() { + return doubleMultiple; + } - public void setDoubleMultiple(String doubleMultiple) { - this.doubleMultiple = doubleMultiple; - } + public void setDoubleMultiple(String doubleMultiple) { + this.doubleMultiple = doubleMultiple; + } - public String getDoubleOnblur() { - return doubleOnblur; - } + public String getDoubleOnblur() { + return doubleOnblur; + } - public void setDoubleOnblur(String doubleOnblur) { - this.doubleOnblur = doubleOnblur; - } + public void setDoubleOnblur(String doubleOnblur) { + this.doubleOnblur = doubleOnblur; + } - public String getDoubleOnchange() { - return doubleOnchange; - } + public String getDoubleOnchange() { + return doubleOnchange; + } - public void setDoubleOnchange(String doubleOnchange) { - this.doubleOnchange = doubleOnchange; - } + public void setDoubleOnchange(String doubleOnchange) { + this.doubleOnchange = doubleOnchange; + } - public String getDoubleOnclick() { - return doubleOnclick; - } + public String getDoubleOnclick() { + return doubleOnclick; + } - public void setDoubleOnclick(String doubleOnclick) { - this.doubleOnclick = doubleOnclick; - } + public void setDoubleOnclick(String doubleOnclick) { + this.doubleOnclick = doubleOnclick; + } - public String getDoubleOndblclick() { - return doubleOndblclick; - } + public String getDoubleOndblclick() { + return doubleOndblclick; + } - public void setDoubleOndblclick(String doubleOndblclick) { - this.doubleOndblclick = doubleOndblclick; - } + public void setDoubleOndblclick(String doubleOndblclick) { + this.doubleOndblclick = doubleOndblclick; + } - public String getDoubleOnfocus() { - return doubleOnfocus; - } + public String getDoubleOnfocus() { + return doubleOnfocus; + } - public void setDoubleOnfocus(String doubleOnfocus) { - this.doubleOnfocus = doubleOnfocus; - } + public void setDoubleOnfocus(String doubleOnfocus) { + this.doubleOnfocus = doubleOnfocus; + } - public String getDoubleOnkeydown() { - return doubleOnkeydown; - } + public String getDoubleOnkeydown() { + return doubleOnkeydown; + } - public void setDoubleOnkeydown(String doubleOnkeydown) { - this.doubleOnkeydown = doubleOnkeydown; - } + public void setDoubleOnkeydown(String doubleOnkeydown) { + this.doubleOnkeydown = doubleOnkeydown; + } - public String getDoubleOnkeypress() { - return doubleOnkeypress; - } + public String getDoubleOnkeypress() { + return doubleOnkeypress; + } - public void setDoubleOnkeypress(String doubleOnkeypress) { - this.doubleOnkeypress = doubleOnkeypress; - } + public void setDoubleOnkeypress(String doubleOnkeypress) { + this.doubleOnkeypress = doubleOnkeypress; + } - public String getDoubleOnkeyup() { - return doubleOnkeyup; - } + public String getDoubleOnkeyup() { + return doubleOnkeyup; + } - public void setDoubleOnkeyup(String doubleOnkeyup) { - this.doubleOnkeyup = doubleOnkeyup; - } + public void setDoubleOnkeyup(String doubleOnkeyup) { + this.doubleOnkeyup = doubleOnkeyup; + } - public String getDoubleOnmousedown() { - return doubleOnmousedown; - } + public String getDoubleOnmousedown() { + return doubleOnmousedown; + } - public void setDoubleOnmousedown(String doubleOnmousedown) { - this.doubleOnmousedown = doubleOnmousedown; - } + public void setDoubleOnmousedown(String doubleOnmousedown) { + this.doubleOnmousedown = doubleOnmousedown; + } - public String getDoubleOnmousemove() { - return doubleOnmousemove; - } + public String getDoubleOnmousemove() { + return doubleOnmousemove; + } - public void setDoubleOnmousemove(String doubleOnmousemove) { - this.doubleOnmousemove = doubleOnmousemove; - } + public void setDoubleOnmousemove(String doubleOnmousemove) { + this.doubleOnmousemove = doubleOnmousemove; + } - public String getDoubleOnmouseout() { - return doubleOnmouseout; - } + public String getDoubleOnmouseout() { + return doubleOnmouseout; + } - public void setDoubleOnmouseout(String doubleOnmouseout) { - this.doubleOnmouseout = doubleOnmouseout; - } + public void setDoubleOnmouseout(String doubleOnmouseout) { + this.doubleOnmouseout = doubleOnmouseout; + } - public String getDoubleOnmouseover() { - return doubleOnmouseover; - } + public String getDoubleOnmouseover() { + return doubleOnmouseover; + } - public void setDoubleOnmouseover(String doubleOnmouseover) { - this.doubleOnmouseover = doubleOnmouseover; - } + public void setDoubleOnmouseover(String doubleOnmouseover) { + this.doubleOnmouseover = doubleOnmouseover; + } - public String getDoubleOnmouseup() { - return doubleOnmouseup; - } + public String getDoubleOnmouseup() { + return doubleOnmouseup; + } - public void setDoubleOnmouseup(String doubleOnmouseup) { - this.doubleOnmouseup = doubleOnmouseup; - } + public void setDoubleOnmouseup(String doubleOnmouseup) { + this.doubleOnmouseup = doubleOnmouseup; + } - public String getDoubleOnselect() { - return doubleOnselect; - } + public String getDoubleOnselect() { + return doubleOnselect; + } - public void setDoubleOnselect(String doubleOnselect) { - this.doubleOnselect = doubleOnselect; - } + public void setDoubleOnselect(String doubleOnselect) { + this.doubleOnselect = doubleOnselect; + } - public String getDoubleSize() { - return doubleSize; - } + public String getDoubleSize() { + return doubleSize; + } - public void setDoubleSize(String doubleSize) { - this.doubleSize = doubleSize; - } + public void setDoubleSize(String doubleSize) { + this.doubleSize = doubleSize; + } - public String getDoubleList() { - return doubleList; - } + public String getDoubleList() { + return doubleList; + } - public String getDoubleListKey() { - return doubleListKey; - } + public String getDoubleListKey() { + return doubleListKey; + } - public String getDoubleListValue() { - return doubleListValue; - } + public String getDoubleListValue() { + return doubleListValue; + } - public String getDoubleName() { - return doubleName; - } + public String getDoubleName() { + return doubleName; + } - public String getDoubleValue() { - return doubleValue; - } + public String getDoubleValue() { + return doubleValue; + } - public String getFormName() { - return formName; - } - - public void setEmptyOption(String emptyOption) { + public String getFormName() { + return formName; + } + + public void setEmptyOption(String emptyOption) { this.emptyOption = emptyOption; } @@ -362,8 +365,8 @@ public abstract class AbstractDoubleListTag extends AbstractRequiredListTag { public void setSize(String size) { this.size = size; } - + public void setDoubleAccesskey(String doubleAccesskey) { - this.doubleAccesskey = doubleAccesskey; + this.doubleAccesskey = doubleAccesskey; } } diff --git a/core/src/main/java/org/apache/struts2/views/jsp/ui/AbstractListTag.java b/core/src/main/java/org/apache/struts2/views/jsp/ui/AbstractListTag.java index 372f93ecf..84634bdc7 100644 --- a/core/src/main/java/org/apache/struts2/views/jsp/ui/AbstractListTag.java +++ b/core/src/main/java/org/apache/struts2/views/jsp/ui/AbstractListTag.java @@ -1,19 +1,22 @@ /* * $Id$ * - * Copyright 2006 The Apache Software Foundation. + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at + * http://www.apache.org/licenses/LICENSE-2.0 * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. */ package org.apache.struts2.views.jsp.ui; diff --git a/core/src/main/java/org/apache/struts2/views/jsp/ui/AbstractRequiredListTag.java b/core/src/main/java/org/apache/struts2/views/jsp/ui/AbstractRequiredListTag.java index db6ed4afe..91c887ba8 100644 --- a/core/src/main/java/org/apache/struts2/views/jsp/ui/AbstractRequiredListTag.java +++ b/core/src/main/java/org/apache/struts2/views/jsp/ui/AbstractRequiredListTag.java @@ -1,19 +1,22 @@ /* * $Id$ * - * Copyright 2006 The Apache Software Foundation. + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at + * http://www.apache.org/licenses/LICENSE-2.0 * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. */ package org.apache.struts2.views.jsp.ui; @@ -24,11 +27,11 @@ import org.apache.struts2.components.ListUIBean; */ public abstract class AbstractRequiredListTag extends AbstractListTag { - protected void populateParams() { - super.populateParams(); - - ListUIBean listUIBean = (ListUIBean) component; - listUIBean.setThrowExceptionOnNullValueAttribute(true); - } + protected void populateParams() { + super.populateParams(); + + ListUIBean listUIBean = (ListUIBean) component; + listUIBean.setThrowExceptionOnNullValueAttribute(true); + } } diff --git a/core/src/main/java/org/apache/struts2/views/jsp/ui/AbstractUITag.java b/core/src/main/java/org/apache/struts2/views/jsp/ui/AbstractUITag.java index cf9dbe48e..9afff38a8 100644 --- a/core/src/main/java/org/apache/struts2/views/jsp/ui/AbstractUITag.java +++ b/core/src/main/java/org/apache/struts2/views/jsp/ui/AbstractUITag.java @@ -1,19 +1,22 @@ /* * $Id$ * - * Copyright 2006 The Apache Software Foundation. + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at + * http://www.apache.org/licenses/LICENSE-2.0 * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. */ package org.apache.struts2.views.jsp.ui; @@ -55,7 +58,7 @@ public abstract class AbstractUITag extends ComponentTagSupport { protected String onselect; protected String onchange; protected String accesskey; - + // tooltip attributes protected String tooltip; protected String tooltipConfig; @@ -144,9 +147,9 @@ public abstract class AbstractUITag extends ComponentTagSupport { } public void setTemplateDir(String templateDir) { - this.templateDir = templateDir; + this.templateDir = templateDir; } - + public void setTemplate(String template) { this.template = template; } @@ -210,16 +213,16 @@ public abstract class AbstractUITag extends ComponentTagSupport { public void setOnchange(String onchange) { this.onchange = onchange; } - + public void setTooltip(String tooltip) { - this.tooltip = tooltip; + this.tooltip = tooltip; } - + public void setTooltipConfig(String tooltipConfig) { - this.tooltipConfig = tooltipConfig; + this.tooltipConfig = tooltipConfig; } - + public void setAccesskey(String accesskey) { - this.accesskey = accesskey; + this.accesskey = accesskey; } } diff --git a/core/src/main/java/org/apache/struts2/views/jsp/ui/ActionErrorTag.java b/core/src/main/java/org/apache/struts2/views/jsp/ui/ActionErrorTag.java index 020229830..1d7349f70 100644 --- a/core/src/main/java/org/apache/struts2/views/jsp/ui/ActionErrorTag.java +++ b/core/src/main/java/org/apache/struts2/views/jsp/ui/ActionErrorTag.java @@ -1,19 +1,22 @@ /* * $Id$ * - * Copyright 2006 The Apache Software Foundation. + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at + * http://www.apache.org/licenses/LICENSE-2.0 * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. */ package org.apache.struts2.views.jsp.ui; @@ -27,14 +30,14 @@ import com.opensymphony.xwork2.util.ValueStack; /** * ActionError Tag. - * + * */ public class ActionErrorTag extends AbstractUITag { - private static final long serialVersionUID = -3710234378022378639L; + private static final long serialVersionUID = -3710234378022378639L; - public Component getBean(ValueStack stack, HttpServletRequest req, HttpServletResponse res) { - return new ActionError(stack, req, res); - } + public Component getBean(ValueStack stack, HttpServletRequest req, HttpServletResponse res) { + return new ActionError(stack, req, res); + } } diff --git a/core/src/main/java/org/apache/struts2/views/jsp/ui/ActionMessageTag.java b/core/src/main/java/org/apache/struts2/views/jsp/ui/ActionMessageTag.java index 54d6bd569..7d1aa2cb4 100644 --- a/core/src/main/java/org/apache/struts2/views/jsp/ui/ActionMessageTag.java +++ b/core/src/main/java/org/apache/struts2/views/jsp/ui/ActionMessageTag.java @@ -1,19 +1,22 @@ /* * $Id$ * - * Copyright 2006 The Apache Software Foundation. + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at + * http://www.apache.org/licenses/LICENSE-2.0 * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. */ package org.apache.struts2.views.jsp.ui; @@ -27,13 +30,13 @@ import com.opensymphony.xwork2.util.ValueStack; /** * ActionMessage Tag. - * + * */ public class ActionMessageTag extends AbstractUITag { - private static final long serialVersionUID = 243396927554182506L; + private static final long serialVersionUID = 243396927554182506L; - public Component getBean(ValueStack stack, HttpServletRequest req, HttpServletResponse res) { - return new ActionMessage(stack, req, res); - } + public Component getBean(ValueStack stack, HttpServletRequest req, HttpServletResponse res) { + return new ActionMessage(stack, req, res); + } } diff --git a/core/src/main/java/org/apache/struts2/views/jsp/ui/AnchorTag.java b/core/src/main/java/org/apache/struts2/views/jsp/ui/AnchorTag.java index 79f88b826..f2249b9fa 100644 --- a/core/src/main/java/org/apache/struts2/views/jsp/ui/AnchorTag.java +++ b/core/src/main/java/org/apache/struts2/views/jsp/ui/AnchorTag.java @@ -1,19 +1,22 @@ /* * $Id$ * - * Copyright 2006 The Apache Software Foundation. + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at + * http://www.apache.org/licenses/LICENSE-2.0 * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. */ package org.apache.struts2.views.jsp.ui; @@ -29,10 +32,10 @@ import com.opensymphony.xwork2.util.ValueStack; * @see Anchor */ public class AnchorTag extends AbstractClosingTag { - - private static final long serialVersionUID = -1034616578492431113L; - - protected String href; + + private static final long serialVersionUID = -1034616578492431113L; + + protected String href; protected String errorText; protected String showErrorTransportText; protected String notifyTopics; @@ -47,7 +50,7 @@ public class AnchorTag extends AbstractClosingTag { super.populateParams(); Anchor link = (Anchor) component; - + link.setHref(href); link.setErrorText(errorText); link.setShowErrorTransportText(showErrorTransportText); diff --git a/core/src/main/java/org/apache/struts2/views/jsp/ui/CheckboxListTag.java b/core/src/main/java/org/apache/struts2/views/jsp/ui/CheckboxListTag.java index 610856829..144f3780a 100644 --- a/core/src/main/java/org/apache/struts2/views/jsp/ui/CheckboxListTag.java +++ b/core/src/main/java/org/apache/struts2/views/jsp/ui/CheckboxListTag.java @@ -1,19 +1,22 @@ /* * $Id$ * - * Copyright 2006 The Apache Software Foundation. + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at + * http://www.apache.org/licenses/LICENSE-2.0 * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. */ package org.apache.struts2.views.jsp.ui; @@ -30,10 +33,10 @@ import com.opensymphony.xwork2.util.ValueStack; * @see CheckboxList */ public class CheckboxListTag extends AbstractRequiredListTag { - - private static final long serialVersionUID = 4023034029558150010L; - public Component getBean(ValueStack stack, HttpServletRequest req, HttpServletResponse res) { + private static final long serialVersionUID = 4023034029558150010L; + + public Component getBean(ValueStack stack, HttpServletRequest req, HttpServletResponse res) { return new CheckboxList(stack, req, res); } } diff --git a/core/src/main/java/org/apache/struts2/views/jsp/ui/CheckboxTag.java b/core/src/main/java/org/apache/struts2/views/jsp/ui/CheckboxTag.java index 4bc493ca9..57b3f1139 100644 --- a/core/src/main/java/org/apache/struts2/views/jsp/ui/CheckboxTag.java +++ b/core/src/main/java/org/apache/struts2/views/jsp/ui/CheckboxTag.java @@ -1,19 +1,22 @@ /* * $Id$ * - * Copyright 2006 The Apache Software Foundation. + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at + * http://www.apache.org/licenses/LICENSE-2.0 * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. */ package org.apache.struts2.views.jsp.ui; @@ -30,10 +33,10 @@ import com.opensymphony.xwork2.util.ValueStack; * @see Checkbox */ public class CheckboxTag extends AbstractUITag { - - private static final long serialVersionUID = -350752809266337636L; - - protected String fieldValue; + + private static final long serialVersionUID = -350752809266337636L; + + protected String fieldValue; public Component getBean(ValueStack stack, HttpServletRequest req, HttpServletResponse res) { return new Checkbox(stack, req, res); diff --git a/core/src/main/java/org/apache/struts2/views/jsp/ui/ComboBoxTag.java b/core/src/main/java/org/apache/struts2/views/jsp/ui/ComboBoxTag.java index c699c0a39..889fd59ad 100644 --- a/core/src/main/java/org/apache/struts2/views/jsp/ui/ComboBoxTag.java +++ b/core/src/main/java/org/apache/struts2/views/jsp/ui/ComboBoxTag.java @@ -1,19 +1,22 @@ /* * $Id$ * - * Copyright 2006 The Apache Software Foundation. + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at + * http://www.apache.org/licenses/LICENSE-2.0 * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. */ package org.apache.struts2.views.jsp.ui; @@ -29,37 +32,37 @@ import com.opensymphony.xwork2.util.ValueStack; * @see ComboBox */ public class ComboBoxTag extends TextFieldTag { - - private static final long serialVersionUID = 3509392460170385605L; - - protected String list; - protected String listKey; - protected String listValue; - protected String headerKey; - protected String headerValue; - protected String emptyOption; + + private static final long serialVersionUID = 3509392460170385605L; + + protected String list; + protected String listKey; + protected String listValue; + protected String headerKey; + protected String headerValue; + protected String emptyOption; public void setEmptyOption(String emptyOption) { - this.emptyOption = emptyOption; - } + this.emptyOption = emptyOption; + } - public void setHeaderKey(String headerKey) { - this.headerKey = headerKey; - } + public void setHeaderKey(String headerKey) { + this.headerKey = headerKey; + } - public void setHeaderValue(String headerValue) { - this.headerValue = headerValue; - } + public void setHeaderValue(String headerValue) { + this.headerValue = headerValue; + } - public void setListKey(String listKey) { - this.listKey = listKey; - } + public void setListKey(String listKey) { + this.listKey = listKey; + } - public void setListValue(String listValue) { - this.listValue = listValue; - } + public void setListValue(String listValue) { + this.listValue = listValue; + } - public Component getBean(ValueStack stack, HttpServletRequest req, HttpServletResponse res) { + public Component getBean(ValueStack stack, HttpServletRequest req, HttpServletResponse res) { return new ComboBox(stack, req, res); } diff --git a/core/src/main/java/org/apache/struts2/views/jsp/ui/ComponentTag.java b/core/src/main/java/org/apache/struts2/views/jsp/ui/ComponentTag.java index 4aa464fba..ee79268eb 100644 --- a/core/src/main/java/org/apache/struts2/views/jsp/ui/ComponentTag.java +++ b/core/src/main/java/org/apache/struts2/views/jsp/ui/ComponentTag.java @@ -1,19 +1,22 @@ /* * $Id$ * - * Copyright 2006 The Apache Software Foundation. + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at + * http://www.apache.org/licenses/LICENSE-2.0 * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. */ package org.apache.struts2.views.jsp.ui; @@ -29,10 +32,10 @@ import com.opensymphony.xwork2.util.ValueStack; * @see GenericUIBean */ public class ComponentTag extends AbstractUITag { - - private static final long serialVersionUID = 5448365363044104731L; - public Component getBean(ValueStack stack, HttpServletRequest req, HttpServletResponse res) { + private static final long serialVersionUID = 5448365363044104731L; + + public Component getBean(ValueStack stack, HttpServletRequest req, HttpServletResponse res) { return new GenericUIBean(stack, req, res); } } diff --git a/core/src/main/java/org/apache/struts2/views/jsp/ui/DatePickerTag.java b/core/src/main/java/org/apache/struts2/views/jsp/ui/DatePickerTag.java index e10d92475..83e886d1b 100644 --- a/core/src/main/java/org/apache/struts2/views/jsp/ui/DatePickerTag.java +++ b/core/src/main/java/org/apache/struts2/views/jsp/ui/DatePickerTag.java @@ -1,19 +1,22 @@ /* * $Id$ * - * Copyright 2006 The Apache Software Foundation. + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at + * http://www.apache.org/licenses/LICENSE-2.0 * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. */ package org.apache.struts2.views.jsp.ui; @@ -30,13 +33,13 @@ import com.opensymphony.xwork2.util.ValueStack; */ public class DatePickerTag extends TextFieldTag { - private static final long serialVersionUID = 4054114507143447232L; - + private static final long serialVersionUID = 4054114507143447232L; + protected String format; protected String dateIconPath; protected String templatePath; protected String templateCssPath; - + public Component getBean(ValueStack stack, HttpServletRequest req, HttpServletResponse res) { return new DatePicker(stack, req, res); @@ -55,17 +58,17 @@ public class DatePickerTag extends TextFieldTag { public void setFormat(String format) { this.format = format; } - + public void setDateIconPath(String dateIconPath) { - this.dateIconPath = dateIconPath; + this.dateIconPath = dateIconPath; } - + public void setTemplatePath(String templatePath) { - this.templatePath = templatePath; + this.templatePath = templatePath; } - + public void setTemplateCssPath(String templateCsspath) { - this.templateCssPath = templateCsspath; + this.templateCssPath = templateCsspath; } } diff --git a/core/src/main/java/org/apache/struts2/views/jsp/ui/DivTag.java b/core/src/main/java/org/apache/struts2/views/jsp/ui/DivTag.java index 20ce6fcda..7e0cf3ffe 100644 --- a/core/src/main/java/org/apache/struts2/views/jsp/ui/DivTag.java +++ b/core/src/main/java/org/apache/struts2/views/jsp/ui/DivTag.java @@ -1,19 +1,22 @@ /* * $Id$ * - * Copyright 2006 The Apache Software Foundation. + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at + * http://www.apache.org/licenses/LICENSE-2.0 * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. */ package org.apache.struts2.views.jsp.ui; @@ -26,10 +29,10 @@ import org.apache.struts2.components.Div; import com.opensymphony.xwork2.util.ValueStack; public class DivTag extends AbstractClosingTag { - - private static final long serialVersionUID = 5309231035916461758L; - - protected String href; + + private static final long serialVersionUID = 5309231035916461758L; + + protected String href; protected String updateFreq; protected String delay="1"; protected String loadingText; diff --git a/core/src/main/java/org/apache/struts2/views/jsp/ui/DoubleSelectTag.java b/core/src/main/java/org/apache/struts2/views/jsp/ui/DoubleSelectTag.java index 832ecae25..053d032a0 100644 --- a/core/src/main/java/org/apache/struts2/views/jsp/ui/DoubleSelectTag.java +++ b/core/src/main/java/org/apache/struts2/views/jsp/ui/DoubleSelectTag.java @@ -1,19 +1,22 @@ /* * $Id$ * - * Copyright 2006 The Apache Software Foundation. + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at + * http://www.apache.org/licenses/LICENSE-2.0 * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. */ package org.apache.struts2.views.jsp.ui; @@ -29,10 +32,10 @@ import com.opensymphony.xwork2.util.ValueStack; * @see DoubleSelect */ public class DoubleSelectTag extends AbstractDoubleListTag { - - private static final long serialVersionUID = 7426011596359509386L; - public Component getBean(ValueStack stack, HttpServletRequest req, HttpServletResponse res) { + private static final long serialVersionUID = 7426011596359509386L; + + public Component getBean(ValueStack stack, HttpServletRequest req, HttpServletResponse res) { return new DoubleSelect(stack, req, res); } @@ -45,6 +48,6 @@ public class DoubleSelectTag extends AbstractDoubleListTag { doubleSelect.setHeaderValue(headerValue); doubleSelect.setMultiple(multiple); doubleSelect.setSize(size); - + } } diff --git a/core/src/main/java/org/apache/struts2/views/jsp/ui/FieldErrorTag.java b/core/src/main/java/org/apache/struts2/views/jsp/ui/FieldErrorTag.java index ce4e86f01..7fbfb4fd3 100644 --- a/core/src/main/java/org/apache/struts2/views/jsp/ui/FieldErrorTag.java +++ b/core/src/main/java/org/apache/struts2/views/jsp/ui/FieldErrorTag.java @@ -1,19 +1,22 @@ /* * $Id$ * - * Copyright 2006 The Apache Software Foundation. + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at + * http://www.apache.org/licenses/LICENSE-2.0 * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. */ package org.apache.struts2.views.jsp.ui; @@ -30,10 +33,10 @@ import com.opensymphony.xwork2.util.ValueStack; */ public class FieldErrorTag extends AbstractUITag { - private static final long serialVersionUID = -182532967507726323L; + private static final long serialVersionUID = -182532967507726323L; - public Component getBean(ValueStack stack, HttpServletRequest req, HttpServletResponse res) { - return new FieldError(stack, req, res); - } + public Component getBean(ValueStack stack, HttpServletRequest req, HttpServletResponse res) { + return new FieldError(stack, req, res); + } } diff --git a/core/src/main/java/org/apache/struts2/views/jsp/ui/FileTag.java b/core/src/main/java/org/apache/struts2/views/jsp/ui/FileTag.java index 75be076b4..65d55a675 100644 --- a/core/src/main/java/org/apache/struts2/views/jsp/ui/FileTag.java +++ b/core/src/main/java/org/apache/struts2/views/jsp/ui/FileTag.java @@ -1,19 +1,22 @@ /* * $Id$ * - * Copyright 2006 The Apache Software Foundation. + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at + * http://www.apache.org/licenses/LICENSE-2.0 * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. */ package org.apache.struts2.views.jsp.ui; @@ -30,10 +33,10 @@ import com.opensymphony.xwork2.util.ValueStack; * @see File */ public class FileTag extends AbstractUITag { - - private static final long serialVersionUID = -2154950640215144864L; - - protected String accept; + + private static final long serialVersionUID = -2154950640215144864L; + + protected String accept; protected String size; public Component getBean(ValueStack stack, HttpServletRequest req, HttpServletResponse res) { diff --git a/core/src/main/java/org/apache/struts2/views/jsp/ui/FormTag.java b/core/src/main/java/org/apache/struts2/views/jsp/ui/FormTag.java index 82aa83333..435261b96 100644 --- a/core/src/main/java/org/apache/struts2/views/jsp/ui/FormTag.java +++ b/core/src/main/java/org/apache/struts2/views/jsp/ui/FormTag.java @@ -1,19 +1,22 @@ /* * $Id$ * - * Copyright 2006 The Apache Software Foundation. + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at + * http://www.apache.org/licenses/LICENSE-2.0 * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. */ package org.apache.struts2.views.jsp.ui; @@ -30,10 +33,10 @@ import com.opensymphony.xwork2.util.ValueStack; * @see Form */ public class FormTag extends AbstractClosingTag { - - private static final long serialVersionUID = 2792301046860819658L; - - protected String action; + + private static final long serialVersionUID = 2792301046860819658L; + + protected String action; protected String target; protected String enctype; protected String method; diff --git a/core/src/main/java/org/apache/struts2/views/jsp/ui/HeadTag.java b/core/src/main/java/org/apache/struts2/views/jsp/ui/HeadTag.java index e7af7dbfd..6c3a776d5 100644 --- a/core/src/main/java/org/apache/struts2/views/jsp/ui/HeadTag.java +++ b/core/src/main/java/org/apache/struts2/views/jsp/ui/HeadTag.java @@ -1,19 +1,22 @@ /* * $Id$ * - * Copyright 2006 The Apache Software Foundation. + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at + * http://www.apache.org/licenses/LICENSE-2.0 * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. */ package org.apache.struts2.views.jsp.ui; @@ -30,9 +33,9 @@ import com.opensymphony.xwork2.util.ValueStack; */ public class HeadTag extends AbstractUITag { - private static final long serialVersionUID = 6876765769175246030L; - - private String calendarcss; + private static final long serialVersionUID = 6876765769175246030L; + + private String calendarcss; private String debug; public Component getBean(ValueStack stack, HttpServletRequest req, HttpServletResponse res) { @@ -42,10 +45,10 @@ public class HeadTag extends AbstractUITag { protected void populateParams() { super.populateParams(); if (calendarcss != null) { - ((Head) component).setCalendarcss(calendarcss); + ((Head) component).setCalendarcss(calendarcss); } if (debug != null) { - ((Head) component).setDebug(Boolean.valueOf(debug).booleanValue()); + ((Head) component).setDebug(Boolean.valueOf(debug).booleanValue()); } } diff --git a/core/src/main/java/org/apache/struts2/views/jsp/ui/HiddenTag.java b/core/src/main/java/org/apache/struts2/views/jsp/ui/HiddenTag.java index 45a9aa61c..355cbb36d 100644 --- a/core/src/main/java/org/apache/struts2/views/jsp/ui/HiddenTag.java +++ b/core/src/main/java/org/apache/struts2/views/jsp/ui/HiddenTag.java @@ -1,19 +1,22 @@ /* * $Id$ * - * Copyright 2006 The Apache Software Foundation. + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at + * http://www.apache.org/licenses/LICENSE-2.0 * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. */ package org.apache.struts2.views.jsp.ui; @@ -30,10 +33,10 @@ import com.opensymphony.xwork2.util.ValueStack; * @see Hidden */ public class HiddenTag extends AbstractUITag { - - private static final long serialVersionUID = -1124367972048371675L; - public Component getBean(ValueStack stack, HttpServletRequest req, HttpServletResponse res) { + private static final long serialVersionUID = -1124367972048371675L; + + public Component getBean(ValueStack stack, HttpServletRequest req, HttpServletResponse res) { return new Hidden(stack, req, res); } } diff --git a/core/src/main/java/org/apache/struts2/views/jsp/ui/LabelTag.java b/core/src/main/java/org/apache/struts2/views/jsp/ui/LabelTag.java index 29052fd82..33b5e03d8 100644 --- a/core/src/main/java/org/apache/struts2/views/jsp/ui/LabelTag.java +++ b/core/src/main/java/org/apache/struts2/views/jsp/ui/LabelTag.java @@ -1,19 +1,22 @@ /* * $Id$ * - * Copyright 2006 The Apache Software Foundation. + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at + * http://www.apache.org/licenses/LICENSE-2.0 * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. */ package org.apache.struts2.views.jsp.ui; @@ -30,10 +33,10 @@ import com.opensymphony.xwork2.util.ValueStack; * @see Label */ public class LabelTag extends AbstractUITag { - - private static final long serialVersionUID = 4008321310097730458L; - - protected String forAttr; + + private static final long serialVersionUID = 4008321310097730458L; + + protected String forAttr; public Component getBean(ValueStack stack, HttpServletRequest req, HttpServletResponse res) { return new Label(stack, req, res); diff --git a/core/src/main/java/org/apache/struts2/views/jsp/ui/OgnlTool.java b/core/src/main/java/org/apache/struts2/views/jsp/ui/OgnlTool.java index f94b412b0..64f0d31be 100644 --- a/core/src/main/java/org/apache/struts2/views/jsp/ui/OgnlTool.java +++ b/core/src/main/java/org/apache/struts2/views/jsp/ui/OgnlTool.java @@ -1,19 +1,22 @@ /* * $Id$ * - * Copyright 2006 The Apache Software Foundation. + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at + * http://www.apache.org/licenses/LICENSE-2.0 * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. */ package org.apache.struts2.views.jsp.ui; diff --git a/core/src/main/java/org/apache/struts2/views/jsp/ui/OptGroupTag.java b/core/src/main/java/org/apache/struts2/views/jsp/ui/OptGroupTag.java index 9578f8d02..741455f79 100644 --- a/core/src/main/java/org/apache/struts2/views/jsp/ui/OptGroupTag.java +++ b/core/src/main/java/org/apache/struts2/views/jsp/ui/OptGroupTag.java @@ -1,19 +1,22 @@ /* * $Id$ * - * Copyright 2006 The Apache Software Foundation. + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at + * http://www.apache.org/licenses/LICENSE-2.0 * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. */ package org.apache.struts2.views.jsp.ui; @@ -27,50 +30,50 @@ import org.apache.struts2.views.jsp.ComponentTagSupport; import com.opensymphony.xwork2.util.ValueStack; /** - * + * */ public class OptGroupTag extends ComponentTagSupport { - private static final long serialVersionUID = 7367401003498678762L; + private static final long serialVersionUID = 7367401003498678762L; - protected String list; - protected String label; - protected String disabled; - protected String listKey; - protected String listValue; - - public Component getBean(ValueStack stack, HttpServletRequest req, HttpServletResponse res) { - return new OptGroup(stack, req, res); - } + protected String list; + protected String label; + protected String disabled; + protected String listKey; + protected String listValue; - protected void populateParams() { - super.populateParams(); - - OptGroup optGroup = (OptGroup) component; - optGroup.setList(list); - optGroup.setLabel(label); - optGroup.setDisabled(disabled); - optGroup.setListKey(listKey); - optGroup.setListValue(listValue); - } - - public void setList(String list) { - this.list = list; - } - - public void setLabel(String label) { - this.label = label; - } - - public void setDisabled(String disabled) { - this.disabled = disabled; - } - - public void setListKey(String listKey) { - this.listKey = listKey; - } + public Component getBean(ValueStack stack, HttpServletRequest req, HttpServletResponse res) { + return new OptGroup(stack, req, res); + } - public void setListValue(String listValue) { - this.listValue = listValue; - } + protected void populateParams() { + super.populateParams(); + + OptGroup optGroup = (OptGroup) component; + optGroup.setList(list); + optGroup.setLabel(label); + optGroup.setDisabled(disabled); + optGroup.setListKey(listKey); + optGroup.setListValue(listValue); + } + + public void setList(String list) { + this.list = list; + } + + public void setLabel(String label) { + this.label = label; + } + + public void setDisabled(String disabled) { + this.disabled = disabled; + } + + public void setListKey(String listKey) { + this.listKey = listKey; + } + + public void setListValue(String listValue) { + this.listValue = listValue; + } } diff --git a/core/src/main/java/org/apache/struts2/views/jsp/ui/OptionTransferSelectTag.java b/core/src/main/java/org/apache/struts2/views/jsp/ui/OptionTransferSelectTag.java index c6e41640c..64005e83e 100644 --- a/core/src/main/java/org/apache/struts2/views/jsp/ui/OptionTransferSelectTag.java +++ b/core/src/main/java/org/apache/struts2/views/jsp/ui/OptionTransferSelectTag.java @@ -1,19 +1,22 @@ /* * $Id$ * - * Copyright 2006 The Apache Software Foundation. + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at + * http://www.apache.org/licenses/LICENSE-2.0 * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. */ package org.apache.struts2.views.jsp.ui; @@ -30,196 +33,196 @@ import com.opensymphony.xwork2.util.ValueStack; */ public class OptionTransferSelectTag extends AbstractDoubleListTag { - private static final long serialVersionUID = 250474334495763536L; - - protected String allowAddToLeft; - protected String allowAddToRight; - protected String allowAddAllToLeft; - protected String allowAddAllToRight; - protected String allowSelectAll; - protected String allowUpDownOnLeft; - protected String allowUpDownOnRight; - - protected String leftTitle; - protected String rightTitle; - - protected String buttonCssClass; - protected String buttonCssStyle; + private static final long serialVersionUID = 250474334495763536L; - protected String addToLeftLabel; - protected String addToRightLabel; - protected String addAllToLeftLabel; - protected String addAllToRightLabel; - protected String selectAllLabel; - protected String leftUpLabel; - protected String leftDownLabel; - protected String rightUpLabel; - protected String rightDownLabel; - - - public Component getBean(ValueStack stack, HttpServletRequest req, HttpServletResponse res) { - return new OptionTransferSelect(stack, req, res); - } - - protected void populateParams() { - super.populateParams(); - - OptionTransferSelect optionTransferSelect = (OptionTransferSelect) component; - optionTransferSelect.setAllowAddToLeft(allowAddToLeft); - optionTransferSelect.setAllowAddToRight(allowAddToRight); - optionTransferSelect.setAllowAddAllToLeft(allowAddAllToLeft); - optionTransferSelect.setAllowAddAllToRight(allowAddAllToRight); - optionTransferSelect.setAllowSelectAll(allowSelectAll); - optionTransferSelect.setAllowUpDownOnLeft(allowUpDownOnLeft); - optionTransferSelect.setAllowUpDownOnRight(allowUpDownOnRight); - - optionTransferSelect.setAddToLeftLabel(addToLeftLabel); - optionTransferSelect.setAddToRightLabel(addToRightLabel); - optionTransferSelect.setAddAllToLeftLabel(addAllToLeftLabel); - optionTransferSelect.setAddAllToRightLabel(addAllToRightLabel); - optionTransferSelect.setSelectAllLabel(selectAllLabel); - optionTransferSelect.setLeftUpLabel(leftUpLabel); - optionTransferSelect.setLeftDownLabel(leftDownLabel); - optionTransferSelect.setRightUpLabel(rightUpLabel); - optionTransferSelect.setRightDownLabel(rightDownLabel); - - optionTransferSelect.setButtonCssClass(buttonCssClass); - optionTransferSelect.setButtonCssStyle(buttonCssStyle); - - optionTransferSelect.setLeftTitle(leftTitle); - optionTransferSelect.setRightTitle(rightTitle); - } + protected String allowAddToLeft; + protected String allowAddToRight; + protected String allowAddAllToLeft; + protected String allowAddAllToRight; + protected String allowSelectAll; + protected String allowUpDownOnLeft; + protected String allowUpDownOnRight; + + protected String leftTitle; + protected String rightTitle; + + protected String buttonCssClass; + protected String buttonCssStyle; + + protected String addToLeftLabel; + protected String addToRightLabel; + protected String addAllToLeftLabel; + protected String addAllToRightLabel; + protected String selectAllLabel; + protected String leftUpLabel; + protected String leftDownLabel; + protected String rightUpLabel; + protected String rightDownLabel; - public String getAddAllToLeftLabel() { - return addAllToLeftLabel; - } + public Component getBean(ValueStack stack, HttpServletRequest req, HttpServletResponse res) { + return new OptionTransferSelect(stack, req, res); + } + + protected void populateParams() { + super.populateParams(); + + OptionTransferSelect optionTransferSelect = (OptionTransferSelect) component; + optionTransferSelect.setAllowAddToLeft(allowAddToLeft); + optionTransferSelect.setAllowAddToRight(allowAddToRight); + optionTransferSelect.setAllowAddAllToLeft(allowAddAllToLeft); + optionTransferSelect.setAllowAddAllToRight(allowAddAllToRight); + optionTransferSelect.setAllowSelectAll(allowSelectAll); + optionTransferSelect.setAllowUpDownOnLeft(allowUpDownOnLeft); + optionTransferSelect.setAllowUpDownOnRight(allowUpDownOnRight); + + optionTransferSelect.setAddToLeftLabel(addToLeftLabel); + optionTransferSelect.setAddToRightLabel(addToRightLabel); + optionTransferSelect.setAddAllToLeftLabel(addAllToLeftLabel); + optionTransferSelect.setAddAllToRightLabel(addAllToRightLabel); + optionTransferSelect.setSelectAllLabel(selectAllLabel); + optionTransferSelect.setLeftUpLabel(leftUpLabel); + optionTransferSelect.setLeftDownLabel(leftDownLabel); + optionTransferSelect.setRightUpLabel(rightUpLabel); + optionTransferSelect.setRightDownLabel(rightDownLabel); + + optionTransferSelect.setButtonCssClass(buttonCssClass); + optionTransferSelect.setButtonCssStyle(buttonCssStyle); + + optionTransferSelect.setLeftTitle(leftTitle); + optionTransferSelect.setRightTitle(rightTitle); + } - public void setAddAllToLeftLabel(String addAllToLeftLabel) { - this.addAllToLeftLabel = addAllToLeftLabel; - } + public String getAddAllToLeftLabel() { + return addAllToLeftLabel; + } - public String getAddAllToRightLabel() { - return addAllToRightLabel; - } + public void setAddAllToLeftLabel(String addAllToLeftLabel) { + this.addAllToLeftLabel = addAllToLeftLabel; + } - public void setAddAllToRightLabel(String addAllToRightLabel) { - this.addAllToRightLabel = addAllToRightLabel; - } + public String getAddAllToRightLabel() { + return addAllToRightLabel; + } - public String getAddToLeftLabel() { - return addToLeftLabel; - } + public void setAddAllToRightLabel(String addAllToRightLabel) { + this.addAllToRightLabel = addAllToRightLabel; + } - public void setAddToLeftLabel(String addToLeftLabel) { - this.addToLeftLabel = addToLeftLabel; - } + public String getAddToLeftLabel() { + return addToLeftLabel; + } - public String getAddToRightLabel() { - return addToRightLabel; - } + public void setAddToLeftLabel(String addToLeftLabel) { + this.addToLeftLabel = addToLeftLabel; + } - public void setAddToRightLabel(String addToRightLabel) { - this.addToRightLabel = addToRightLabel; - } + public String getAddToRightLabel() { + return addToRightLabel; + } - public String getAllowAddAllToLeft() { - return allowAddAllToLeft; - } + public void setAddToRightLabel(String addToRightLabel) { + this.addToRightLabel = addToRightLabel; + } - public void setAllowAddAllToLeft(String allowAddAllToLeft) { - this.allowAddAllToLeft = allowAddAllToLeft; - } + public String getAllowAddAllToLeft() { + return allowAddAllToLeft; + } - public String getAllowAddAllToRight() { - return allowAddAllToRight; - } + public void setAllowAddAllToLeft(String allowAddAllToLeft) { + this.allowAddAllToLeft = allowAddAllToLeft; + } - public void setAllowAddAllToRight(String allowAddAllToRight) { - this.allowAddAllToRight = allowAddAllToRight; - } + public String getAllowAddAllToRight() { + return allowAddAllToRight; + } - public String getAllowAddToLeft() { - return allowAddToLeft; - } + public void setAllowAddAllToRight(String allowAddAllToRight) { + this.allowAddAllToRight = allowAddAllToRight; + } - public void setAllowAddToLeft(String allowAddToLeft) { - this.allowAddToLeft = allowAddToLeft; - } + public String getAllowAddToLeft() { + return allowAddToLeft; + } - public String getAllowAddToRight() { - return allowAddToRight; - } + public void setAllowAddToLeft(String allowAddToLeft) { + this.allowAddToLeft = allowAddToLeft; + } - public void setAllowAddToRight(String allowAddToRight) { - this.allowAddToRight = allowAddToRight; - } + public String getAllowAddToRight() { + return allowAddToRight; + } - public String getLeftTitle() { - return leftTitle; - } + public void setAllowAddToRight(String allowAddToRight) { + this.allowAddToRight = allowAddToRight; + } - public void setLeftTitle(String leftTitle) { - this.leftTitle = leftTitle; - } + public String getLeftTitle() { + return leftTitle; + } - public String getRightTitle() { - return rightTitle; - } + public void setLeftTitle(String leftTitle) { + this.leftTitle = leftTitle; + } - public void setRightTitle(String rightTitle) { - this.rightTitle = rightTitle; - } - - - public void setAllowSelectAll(String allowSelectAll) { - this.allowSelectAll = allowSelectAll; - } - - public String getAllowSelectAll() { - return this.allowSelectAll; - } - - public void setSelectAllLabel(String selectAllLabel) { - this.selectAllLabel = selectAllLabel; - } - - public String getSelectAllLabel() { - return this.selectAllLabel; - } - - public void setButtonCssClass(String buttonCssId) { - this.buttonCssClass = buttonCssId; - } - - public String getButtonCssClass() { - return buttonCssClass; - } - - public void setButtonCssStyle(String buttonCssStyle) { - this.buttonCssStyle = buttonCssStyle; - } - - public String getButtonCssStyle() { - return this.buttonCssStyle; - } + public String getRightTitle() { + return rightTitle; + } + + + public void setRightTitle(String rightTitle) { + this.rightTitle = rightTitle; + } + + + public void setAllowSelectAll(String allowSelectAll) { + this.allowSelectAll = allowSelectAll; + } + + public String getAllowSelectAll() { + return this.allowSelectAll; + } + + public void setSelectAllLabel(String selectAllLabel) { + this.selectAllLabel = selectAllLabel; + } + + public String getSelectAllLabel() { + return this.selectAllLabel; + } + + public void setButtonCssClass(String buttonCssId) { + this.buttonCssClass = buttonCssId; + } + + public String getButtonCssClass() { + return buttonCssClass; + } + + public void setButtonCssStyle(String buttonCssStyle) { + this.buttonCssStyle = buttonCssStyle; + } + + public String getButtonCssStyle() { + return this.buttonCssStyle; + } } diff --git a/core/src/main/java/org/apache/struts2/views/jsp/ui/PanelTag.java b/core/src/main/java/org/apache/struts2/views/jsp/ui/PanelTag.java index 67245f7aa..b50acf6dd 100644 --- a/core/src/main/java/org/apache/struts2/views/jsp/ui/PanelTag.java +++ b/core/src/main/java/org/apache/struts2/views/jsp/ui/PanelTag.java @@ -1,19 +1,22 @@ /* * $Id$ * - * Copyright 2006 The Apache Software Foundation. + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at + * http://www.apache.org/licenses/LICENSE-2.0 * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. */ package org.apache.struts2.views.jsp.ui; @@ -29,10 +32,10 @@ import com.opensymphony.xwork2.util.ValueStack; * @see Panel */ public class PanelTag extends DivTag { - - private static final long serialVersionUID = -1698805503599998611L; - - protected String tabName; + + private static final long serialVersionUID = -1698805503599998611L; + + protected String tabName; protected String subscribeTopicName; protected String remote; diff --git a/core/src/main/java/org/apache/struts2/views/jsp/ui/PasswordTag.java b/core/src/main/java/org/apache/struts2/views/jsp/ui/PasswordTag.java index f6ca252a8..26005494b 100644 --- a/core/src/main/java/org/apache/struts2/views/jsp/ui/PasswordTag.java +++ b/core/src/main/java/org/apache/struts2/views/jsp/ui/PasswordTag.java @@ -1,19 +1,22 @@ /* * $Id$ * - * Copyright 2006 The Apache Software Foundation. + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at + * http://www.apache.org/licenses/LICENSE-2.0 * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. */ package org.apache.struts2.views.jsp.ui; @@ -30,10 +33,10 @@ import com.opensymphony.xwork2.util.ValueStack; * @see Password */ public class PasswordTag extends TextFieldTag { - - private static final long serialVersionUID = 6802043323617377573L; - - protected String showPassword; + + private static final long serialVersionUID = 6802043323617377573L; + + protected String showPassword; public Component getBean(ValueStack stack, HttpServletRequest req, HttpServletResponse res) { return new Password(stack, req, res); diff --git a/core/src/main/java/org/apache/struts2/views/jsp/ui/RadioTag.java b/core/src/main/java/org/apache/struts2/views/jsp/ui/RadioTag.java index fdc1fe9a3..bd0bfa12f 100644 --- a/core/src/main/java/org/apache/struts2/views/jsp/ui/RadioTag.java +++ b/core/src/main/java/org/apache/struts2/views/jsp/ui/RadioTag.java @@ -1,19 +1,22 @@ /* * $Id$ * - * Copyright 2006 The Apache Software Foundation. + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at + * http://www.apache.org/licenses/LICENSE-2.0 * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. */ package org.apache.struts2.views.jsp.ui; @@ -30,10 +33,10 @@ import com.opensymphony.xwork2.util.ValueStack; * @see Radio */ public class RadioTag extends AbstractRequiredListTag { - - private static final long serialVersionUID = -6497403399521333624L; - public Component getBean(ValueStack stack, HttpServletRequest req, HttpServletResponse res) { + private static final long serialVersionUID = -6497403399521333624L; + + public Component getBean(ValueStack stack, HttpServletRequest req, HttpServletResponse res) { return new Radio(stack, req, res); } } diff --git a/core/src/main/java/org/apache/struts2/views/jsp/ui/ResetTag.java b/core/src/main/java/org/apache/struts2/views/jsp/ui/ResetTag.java index af5459444..ccd995276 100644 --- a/core/src/main/java/org/apache/struts2/views/jsp/ui/ResetTag.java +++ b/core/src/main/java/org/apache/struts2/views/jsp/ui/ResetTag.java @@ -1,19 +1,22 @@ /* * $Id$ * - * Copyright 2006 The Apache Software Foundation. + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at + * http://www.apache.org/licenses/LICENSE-2.0 * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. */ package org.apache.struts2.views.jsp.ui; @@ -29,10 +32,10 @@ import com.opensymphony.xwork2.util.ValueStack; * @see org.apache.struts2.components.Reset */ public class ResetTag extends AbstractUITag { - - private static final long serialVersionUID = 4742704832277392108L; - - protected String action; + + private static final long serialVersionUID = 4742704832277392108L; + + protected String action; protected String method; protected String align; protected String type; diff --git a/core/src/main/java/org/apache/struts2/views/jsp/ui/SelectTag.java b/core/src/main/java/org/apache/struts2/views/jsp/ui/SelectTag.java index 878865cfe..9c0542e54 100644 --- a/core/src/main/java/org/apache/struts2/views/jsp/ui/SelectTag.java +++ b/core/src/main/java/org/apache/struts2/views/jsp/ui/SelectTag.java @@ -1,19 +1,22 @@ /* * $Id$ * - * Copyright 2006 The Apache Software Foundation. + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at + * http://www.apache.org/licenses/LICENSE-2.0 * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. */ package org.apache.struts2.views.jsp.ui; @@ -30,10 +33,10 @@ import com.opensymphony.xwork2.util.ValueStack; * @see Select */ public class SelectTag extends AbstractRequiredListTag { - - private static final long serialVersionUID = 6121715260335609618L; - - protected String emptyOption; + + private static final long serialVersionUID = 6121715260335609618L; + + protected String emptyOption; protected String headerKey; protected String headerValue; protected String multiple; diff --git a/core/src/main/java/org/apache/struts2/views/jsp/ui/SubmitTag.java b/core/src/main/java/org/apache/struts2/views/jsp/ui/SubmitTag.java index da73a87b6..3a3a715fd 100644 --- a/core/src/main/java/org/apache/struts2/views/jsp/ui/SubmitTag.java +++ b/core/src/main/java/org/apache/struts2/views/jsp/ui/SubmitTag.java @@ -1,19 +1,22 @@ /* * $Id$ * - * Copyright 2006 The Apache Software Foundation. + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at + * http://www.apache.org/licenses/LICENSE-2.0 * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. */ package org.apache.struts2.views.jsp.ui; @@ -29,10 +32,10 @@ import com.opensymphony.xwork2.util.ValueStack; * @see Submit */ public class SubmitTag extends AbstractUITag { - - private static final long serialVersionUID = 2179281109958301343L; - - protected String action; + + private static final long serialVersionUID = 2179281109958301343L; + + protected String action; protected String method; protected String align; protected String resultDivId; diff --git a/core/src/main/java/org/apache/struts2/views/jsp/ui/TabbedPanelTag.java b/core/src/main/java/org/apache/struts2/views/jsp/ui/TabbedPanelTag.java index eb8e65d2a..c02218682 100644 --- a/core/src/main/java/org/apache/struts2/views/jsp/ui/TabbedPanelTag.java +++ b/core/src/main/java/org/apache/struts2/views/jsp/ui/TabbedPanelTag.java @@ -1,19 +1,22 @@ /* * $Id$ * - * Copyright 2006 The Apache Software Foundation. + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at + * http://www.apache.org/licenses/LICENSE-2.0 * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. */ package org.apache.struts2.views.jsp.ui; @@ -32,10 +35,10 @@ import com.opensymphony.xwork2.util.ValueStack; * @see TabbedPanel */ public class TabbedPanelTag extends AbstractClosingTag { - - private static final long serialVersionUID = -4719930205515386252L; - public Component getBean(ValueStack stack, HttpServletRequest req, HttpServletResponse res) { + private static final long serialVersionUID = -4719930205515386252L; + + public Component getBean(ValueStack stack, HttpServletRequest req, HttpServletResponse res) { return new TabbedPanel(stack, req, res); } diff --git a/core/src/main/java/org/apache/struts2/views/jsp/ui/TextFieldTag.java b/core/src/main/java/org/apache/struts2/views/jsp/ui/TextFieldTag.java index fcd69372f..f995fafad 100644 --- a/core/src/main/java/org/apache/struts2/views/jsp/ui/TextFieldTag.java +++ b/core/src/main/java/org/apache/struts2/views/jsp/ui/TextFieldTag.java @@ -1,19 +1,22 @@ /* * $Id$ * - * Copyright 2006 The Apache Software Foundation. + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at + * http://www.apache.org/licenses/LICENSE-2.0 * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. */ package org.apache.struts2.views.jsp.ui; @@ -29,10 +32,10 @@ import com.opensymphony.xwork2.util.ValueStack; * @see TextField */ public class TextFieldTag extends AbstractUITag { - - private static final long serialVersionUID = 5811285953670562288L; - protected String maxlength; + private static final long serialVersionUID = 5811285953670562288L; + + protected String maxlength; protected String readonly; protected String size; diff --git a/core/src/main/java/org/apache/struts2/views/jsp/ui/TextareaTag.java b/core/src/main/java/org/apache/struts2/views/jsp/ui/TextareaTag.java index 7ad223913..a8217018c 100644 --- a/core/src/main/java/org/apache/struts2/views/jsp/ui/TextareaTag.java +++ b/core/src/main/java/org/apache/struts2/views/jsp/ui/TextareaTag.java @@ -1,19 +1,22 @@ /* * $Id$ * - * Copyright 2006 The Apache Software Foundation. + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at + * http://www.apache.org/licenses/LICENSE-2.0 * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. */ package org.apache.struts2.views.jsp.ui; @@ -30,10 +33,10 @@ import com.opensymphony.xwork2.util.ValueStack; * @see TextArea */ public class TextareaTag extends AbstractUITag { - - private static final long serialVersionUID = -4107122506712927927L; - - protected String cols; + + private static final long serialVersionUID = -4107122506712927927L; + + protected String cols; protected String readonly; protected String rows; protected String wrap; diff --git a/core/src/main/java/org/apache/struts2/views/jsp/ui/TimePickerTag.java b/core/src/main/java/org/apache/struts2/views/jsp/ui/TimePickerTag.java index 5d6e4af90..256904d17 100644 --- a/core/src/main/java/org/apache/struts2/views/jsp/ui/TimePickerTag.java +++ b/core/src/main/java/org/apache/struts2/views/jsp/ui/TimePickerTag.java @@ -1,19 +1,22 @@ /* * $Id$ * - * Copyright 2006 The Apache Software Foundation. + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at + * http://www.apache.org/licenses/LICENSE-2.0 * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. */ package org.apache.struts2.views.jsp.ui; @@ -30,40 +33,40 @@ import com.opensymphony.xwork2.util.ValueStack; */ public class TimePickerTag extends TextFieldTag { - private static final long serialVersionUID = 3527737048468381376L; - - protected String format; - protected String timeIconPath; - protected String templatePath; - protected String templateCssPath; + private static final long serialVersionUID = 3527737048468381376L; - public Component getBean(ValueStack stack, HttpServletRequest req, HttpServletResponse res) { - return new TimePicker(stack, req, res); - } - - protected void populateParams() { - super.populateParams(); - - final TimePicker timePicker = (TimePicker) component; - timePicker.setFormat(format); - timePicker.setTimeIconPath(timeIconPath); - timePicker.setTemplatePath(templatePath); - timePicker.setTemplateCssPath(templateCssPath); - } - - public void setFormat(String format) { + protected String format; + protected String timeIconPath; + protected String templatePath; + protected String templateCssPath; + + public Component getBean(ValueStack stack, HttpServletRequest req, HttpServletResponse res) { + return new TimePicker(stack, req, res); + } + + protected void populateParams() { + super.populateParams(); + + final TimePicker timePicker = (TimePicker) component; + timePicker.setFormat(format); + timePicker.setTimeIconPath(timeIconPath); + timePicker.setTemplatePath(templatePath); + timePicker.setTemplateCssPath(templateCssPath); + } + + public void setFormat(String format) { this.format = format; } - + public void setTimeIconPath(String timeIconPath) { - this.timeIconPath = timeIconPath; + this.timeIconPath = timeIconPath; } - + public void setTemplatePath(String templatePath) { - this.templatePath = templatePath; + this.templatePath = templatePath; } - + public void setTemplateCssPath(String templateCssPath) { - this.templateCssPath = templateCssPath; + this.templateCssPath = templateCssPath; } } diff --git a/core/src/main/java/org/apache/struts2/views/jsp/ui/TokenTag.java b/core/src/main/java/org/apache/struts2/views/jsp/ui/TokenTag.java index e3fdd9851..b8e8bdc25 100644 --- a/core/src/main/java/org/apache/struts2/views/jsp/ui/TokenTag.java +++ b/core/src/main/java/org/apache/struts2/views/jsp/ui/TokenTag.java @@ -1,19 +1,22 @@ /* * $Id$ * - * Copyright 2006 The Apache Software Foundation. + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at + * http://www.apache.org/licenses/LICENSE-2.0 * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. */ package org.apache.struts2.views.jsp.ui; @@ -30,10 +33,10 @@ import com.opensymphony.xwork2.util.ValueStack; * @see Token */ public class TokenTag extends AbstractUITag { - - private static final long serialVersionUID = 722480798151703457L; - public Component getBean(ValueStack stack, HttpServletRequest req, HttpServletResponse res) { + private static final long serialVersionUID = 722480798151703457L; + + public Component getBean(ValueStack stack, HttpServletRequest req, HttpServletResponse res) { return new Token(stack, req, res); } } diff --git a/core/src/main/java/org/apache/struts2/views/jsp/ui/TreeNodeTag.java b/core/src/main/java/org/apache/struts2/views/jsp/ui/TreeNodeTag.java index 4020dcb1d..ef62d07fb 100644 --- a/core/src/main/java/org/apache/struts2/views/jsp/ui/TreeNodeTag.java +++ b/core/src/main/java/org/apache/struts2/views/jsp/ui/TreeNodeTag.java @@ -1,19 +1,22 @@ /* * $Id$ * - * Copyright 2006 The Apache Software Foundation. + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at + * http://www.apache.org/licenses/LICENSE-2.0 * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. */ package org.apache.struts2.views.jsp.ui; @@ -29,9 +32,9 @@ import com.opensymphony.xwork2.util.ValueStack; * @see TreeNode */ public class TreeNodeTag extends AbstractClosingTag { - - private static final long serialVersionUID = 7340746943017900803L; - + + private static final long serialVersionUID = 7340746943017900803L; + public Component getBean(ValueStack stack, HttpServletRequest req, HttpServletResponse res) { return new TreeNode(stack,req,res); @@ -41,7 +44,7 @@ public class TreeNodeTag extends AbstractClosingTag { this.label = label; } - // NOTE: not necessary, label property is inherited, will be populated + // NOTE: not necessary, label property is inherited, will be populated // by super-class /*protected void populateParams() { if (label != null) { diff --git a/core/src/main/java/org/apache/struts2/views/jsp/ui/TreeTag.java b/core/src/main/java/org/apache/struts2/views/jsp/ui/TreeTag.java index be672bdc7..769d0f165 100644 --- a/core/src/main/java/org/apache/struts2/views/jsp/ui/TreeTag.java +++ b/core/src/main/java/org/apache/struts2/views/jsp/ui/TreeTag.java @@ -1,19 +1,22 @@ /* * $Id$ * - * Copyright 2006 The Apache Software Foundation. + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at + * http://www.apache.org/licenses/LICENSE-2.0 * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. */ package org.apache.struts2.views.jsp.ui; @@ -29,36 +32,36 @@ import com.opensymphony.xwork2.util.ValueStack; * @see Tree */ public class TreeTag extends AbstractClosingTag { - - private static final long serialVersionUID = 2735218501058548013L; - - private String toggle; + + private static final long serialVersionUID = 2735218501058548013L; + + private String toggle; private String treeSelectedTopic; private String treeExpandedTopic; - private String treeCollapsedTopic; + private String treeCollapsedTopic; private String rootNode; private String childCollectionProperty; private String nodeTitleProperty; private String nodeIdProperty; private String showRootGrid; - - private String showGrid; - private String blankIconSrc; - private String gridIconSrcL; - private String gridIconSrcV; - private String gridIconSrcP; - private String gridIconSrcC; - private String gridIconSrcX; - private String gridIconSrcY; - private String expandIconSrcPlus; - private String expandIconSrcMinus; - private String iconWidth; - private String iconHeight; - private String toggleDuration; - private String templateCssPath; - - public Component getBean(ValueStack stack, HttpServletRequest req, HttpServletResponse res) { + private String showGrid; + private String blankIconSrc; + private String gridIconSrcL; + private String gridIconSrcV; + private String gridIconSrcP; + private String gridIconSrcC; + private String gridIconSrcX; + private String gridIconSrcY; + private String expandIconSrcPlus; + private String expandIconSrcMinus; + private String iconWidth; + private String iconHeight; + private String toggleDuration; + private String templateCssPath; + + + public Component getBean(ValueStack stack, HttpServletRequest req, HttpServletResponse res) { return new Tree(stack,req,res); } @@ -67,52 +70,52 @@ public class TreeTag extends AbstractClosingTag { Tree tree = (Tree) component; if (childCollectionProperty != null) - tree.setChildCollectionProperty(childCollectionProperty); + tree.setChildCollectionProperty(childCollectionProperty); if (nodeIdProperty != null) - tree.setNodeIdProperty(nodeIdProperty); + tree.setNodeIdProperty(nodeIdProperty); if (nodeTitleProperty != null) - tree.setNodeTitleProperty(nodeTitleProperty); + tree.setNodeTitleProperty(nodeTitleProperty); if (rootNode != null) - tree.setRootNode(rootNode); + tree.setRootNode(rootNode); if (toggle != null) - tree.setToggle(toggle); + tree.setToggle(toggle); if (treeCollapsedTopic != null) - tree.setTreeCollapsedTopic(treeCollapsedTopic); + tree.setTreeCollapsedTopic(treeCollapsedTopic); if (treeExpandedTopic != null) - tree.setTreeExpandedTopic(treeExpandedTopic); + tree.setTreeExpandedTopic(treeExpandedTopic); if (treeSelectedTopic != null) - tree.setTreeSelectedTopic(treeSelectedTopic); + tree.setTreeSelectedTopic(treeSelectedTopic); if (showRootGrid != null) - tree.setShowRootGrid(showRootGrid); - + tree.setShowRootGrid(showRootGrid); + if (showGrid != null) - tree.setShowGrid(showGrid); + tree.setShowGrid(showGrid); if (blankIconSrc != null) - tree.setBlankIconSrc(blankIconSrc); + tree.setBlankIconSrc(blankIconSrc); if (gridIconSrcL != null) - tree.setGridIconSrcL(gridIconSrcC); - if (gridIconSrcV != null) - tree.setGridIconSrcV(gridIconSrcV); + tree.setGridIconSrcL(gridIconSrcC); + if (gridIconSrcV != null) + tree.setGridIconSrcV(gridIconSrcV); if (gridIconSrcP != null) - tree.setGridIconSrcP(gridIconSrcP); + tree.setGridIconSrcP(gridIconSrcP); if (gridIconSrcC != null) - tree.setGridIconSrcC(gridIconSrcC); + tree.setGridIconSrcC(gridIconSrcC); if (gridIconSrcX != null) - tree.setGridIconSrcX(gridIconSrcX); + tree.setGridIconSrcX(gridIconSrcX); if (gridIconSrcY != null) - tree.setGridIconSrcY(gridIconSrcY); - if (expandIconSrcPlus != null) - tree.setExpandIconSrcPlus(expandIconSrcPlus); - if (expandIconSrcMinus != null) - tree.setExpandIconSrcMinus(expandIconSrcMinus); - if (iconWidth != null) - tree.setIconWidth(iconWidth); - if (iconHeight != null) - tree.setIconHeight(iconHeight); - if (toggleDuration != null) - tree.setToggleDuration(toggleDuration); - if (templateCssPath != null) - tree.setTemplateCssPath(templateCssPath); + tree.setGridIconSrcY(gridIconSrcY); + if (expandIconSrcPlus != null) + tree.setExpandIconSrcPlus(expandIconSrcPlus); + if (expandIconSrcMinus != null) + tree.setExpandIconSrcMinus(expandIconSrcMinus); + if (iconWidth != null) + tree.setIconWidth(iconWidth); + if (iconHeight != null) + tree.setIconHeight(iconHeight); + if (toggleDuration != null) + tree.setToggleDuration(toggleDuration); + if (templateCssPath != null) + tree.setTemplateCssPath(templateCssPath); } public String getToggle() { @@ -178,125 +181,125 @@ public class TreeTag extends AbstractClosingTag { public void setNodeIdProperty(String nodeIdProperty) { this.nodeIdProperty = nodeIdProperty; } - + public String getShowRootGrid() { - return showRootGrid; + return showRootGrid; } - + public void setShowRootGrid(String showRootGrid) { - this.showRootGrid = showRootGrid; + this.showRootGrid = showRootGrid; } - + public String getBlankIconSrc() { - return blankIconSrc; - } + return blankIconSrc; + } - public void setBlankIconSrc(String blankIconSrc) { - this.blankIconSrc = blankIconSrc; - } + public void setBlankIconSrc(String blankIconSrc) { + this.blankIconSrc = blankIconSrc; + } - public String getExpandIconSrcMinus() { - return expandIconSrcMinus; - } + public String getExpandIconSrcMinus() { + return expandIconSrcMinus; + } - public void setExpandIconSrcMinus(String expandIconSrcMinus) { - this.expandIconSrcMinus = expandIconSrcMinus; - } + public void setExpandIconSrcMinus(String expandIconSrcMinus) { + this.expandIconSrcMinus = expandIconSrcMinus; + } - public String getExpandIconSrcPlus() { - return expandIconSrcPlus; - } + public String getExpandIconSrcPlus() { + return expandIconSrcPlus; + } - public void setExpandIconSrcPlus(String expandIconSrcPlus) { - this.expandIconSrcPlus = expandIconSrcPlus; - } + public void setExpandIconSrcPlus(String expandIconSrcPlus) { + this.expandIconSrcPlus = expandIconSrcPlus; + } - public String getGridIconSrcC() { - return gridIconSrcC; - } + public String getGridIconSrcC() { + return gridIconSrcC; + } - public void setGridIconSrcC(String gridIconSrcC) { - this.gridIconSrcC = gridIconSrcC; - } + public void setGridIconSrcC(String gridIconSrcC) { + this.gridIconSrcC = gridIconSrcC; + } - public String getGridIconSrcL() { - return gridIconSrcL; - } + public String getGridIconSrcL() { + return gridIconSrcL; + } - public void setGridIconSrcL(String gridIconSrcL) { - this.gridIconSrcL = gridIconSrcL; - } + public void setGridIconSrcL(String gridIconSrcL) { + this.gridIconSrcL = gridIconSrcL; + } - public String getGridIconSrcP() { - return gridIconSrcP; - } + public String getGridIconSrcP() { + return gridIconSrcP; + } - public void setGridIconSrcP(String gridIconSrcP) { - this.gridIconSrcP = gridIconSrcP; - } + public void setGridIconSrcP(String gridIconSrcP) { + this.gridIconSrcP = gridIconSrcP; + } - public String getGridIconSrcV() { - return gridIconSrcV; - } + public String getGridIconSrcV() { + return gridIconSrcV; + } - public void setGridIconSrcV(String gridIconSrcV) { - this.gridIconSrcV = gridIconSrcV; - } + public void setGridIconSrcV(String gridIconSrcV) { + this.gridIconSrcV = gridIconSrcV; + } - public String getGridIconSrcX() { - return gridIconSrcX; - } + public String getGridIconSrcX() { + return gridIconSrcX; + } - public void setGridIconSrcX(String gridIconSrcX) { - this.gridIconSrcX = gridIconSrcX; - } + public void setGridIconSrcX(String gridIconSrcX) { + this.gridIconSrcX = gridIconSrcX; + } - public String getGridIconSrcY() { - return gridIconSrcY; - } + public String getGridIconSrcY() { + return gridIconSrcY; + } - public void setGridIconSrcY(String gridIconSrcY) { - this.gridIconSrcY = gridIconSrcY; - } + public void setGridIconSrcY(String gridIconSrcY) { + this.gridIconSrcY = gridIconSrcY; + } - public String getIconHeight() { - return iconHeight; - } + public String getIconHeight() { + return iconHeight; + } - public void setIconHeight(String iconHeight) { - this.iconHeight = iconHeight; - } + public void setIconHeight(String iconHeight) { + this.iconHeight = iconHeight; + } - public String getIconWidth() { - return iconWidth; - } + public String getIconWidth() { + return iconWidth; + } - public void setIconWidth(String iconWidth) { - this.iconWidth = iconWidth; - } + public void setIconWidth(String iconWidth) { + this.iconWidth = iconWidth; + } - public String getTemplateCssPath() { - return templateCssPath; - } + public String getTemplateCssPath() { + return templateCssPath; + } - public void setTemplateCssPath(String templateCssPath) { - this.templateCssPath = templateCssPath; - } + public void setTemplateCssPath(String templateCssPath) { + this.templateCssPath = templateCssPath; + } - public String getToggleDuration() { - return toggleDuration; - } + public String getToggleDuration() { + return toggleDuration; + } - public void setToggleDuration(String toggleDuration) { - this.toggleDuration = toggleDuration; - } + public void setToggleDuration(String toggleDuration) { + this.toggleDuration = toggleDuration; + } - public String getShowGrid() { - return showGrid; - } + public String getShowGrid() { + return showGrid; + } - public void setShowGrid(String showGrid) { - this.showGrid = showGrid; - } + public void setShowGrid(String showGrid) { + this.showGrid = showGrid; + } } diff --git a/core/src/main/java/org/apache/struts2/views/jsp/ui/UpDownSelectTag.java b/core/src/main/java/org/apache/struts2/views/jsp/ui/UpDownSelectTag.java index 3879901ff..091dc86a0 100644 --- a/core/src/main/java/org/apache/struts2/views/jsp/ui/UpDownSelectTag.java +++ b/core/src/main/java/org/apache/struts2/views/jsp/ui/UpDownSelectTag.java @@ -1,19 +1,22 @@ /* * $Id$ * - * Copyright 2006 The Apache Software Foundation. + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at + * http://www.apache.org/licenses/LICENSE-2.0 * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. */ package org.apache.struts2.views.jsp.ui; @@ -30,91 +33,91 @@ import com.opensymphony.xwork2.util.ValueStack; */ public class UpDownSelectTag extends SelectTag { - private static final long serialVersionUID = -8136573053799541353L; - - protected String allowMoveUp; - protected String allowMoveDown; - protected String allowSelectAll; - - protected String moveUpLabel; - protected String moveDownLabel; - protected String selectAllLabel; - - - public Component getBean(ValueStack stack, HttpServletRequest req, HttpServletResponse res) { - return new UpDownSelect(stack, req, res); - } - - protected void populateParams() { - super.populateParams(); - - UpDownSelect c = (UpDownSelect) component; - - c.setAllowMoveUp(allowMoveUp); - c.setAllowMoveDown(allowMoveDown); - c.setAllowSelectAll(allowSelectAll); - - c.setMoveUpLabel(moveUpLabel); - c.setMoveDownLabel(moveDownLabel); - c.setSelectAllLabel(selectAllLabel); - - } - - - public String getAllowMoveUp() { - return allowMoveUp; - } - - public void setAllowMoveUp(String allowMoveUp) { - this.allowMoveUp = allowMoveUp; - } - - - - public String getAllowMoveDown() { - return allowMoveDown; - } - - public void setAllowMoveDown(String allowMoveDown) { - this.allowMoveDown = allowMoveDown; - } - - - - public String getAllowSelectAll() { - return allowSelectAll; - } - - public void setAllowSelectAll(String allowSelectAll) { - this.allowSelectAll = allowSelectAll; - } - - - public String getMoveUpLabel() { - return moveUpLabel; - } - - public void setMoveUpLabel(String moveUpLabel) { - this.moveUpLabel = moveUpLabel; - } - - - - public String getMoveDownLabel() { - return moveDownLabel; - } - - public void setMoveDownLabel(String moveDownLabel) { - this.moveDownLabel = moveDownLabel; - } - + private static final long serialVersionUID = -8136573053799541353L; - - public String getSelectAllLabel() { - return selectAllLabel; - } - - public void setSelectAllLabel(String selectAllLabel) { - this.selectAllLabel = selectAllLabel; - } + protected String allowMoveUp; + protected String allowMoveDown; + protected String allowSelectAll; + + protected String moveUpLabel; + protected String moveDownLabel; + protected String selectAllLabel; + + + public Component getBean(ValueStack stack, HttpServletRequest req, HttpServletResponse res) { + return new UpDownSelect(stack, req, res); + } + + protected void populateParams() { + super.populateParams(); + + UpDownSelect c = (UpDownSelect) component; + + c.setAllowMoveUp(allowMoveUp); + c.setAllowMoveDown(allowMoveDown); + c.setAllowSelectAll(allowSelectAll); + + c.setMoveUpLabel(moveUpLabel); + c.setMoveDownLabel(moveDownLabel); + c.setSelectAllLabel(selectAllLabel); + + } + + + public String getAllowMoveUp() { + return allowMoveUp; + } + + public void setAllowMoveUp(String allowMoveUp) { + this.allowMoveUp = allowMoveUp; + } + + + + public String getAllowMoveDown() { + return allowMoveDown; + } + + public void setAllowMoveDown(String allowMoveDown) { + this.allowMoveDown = allowMoveDown; + } + + + + public String getAllowSelectAll() { + return allowSelectAll; + } + + public void setAllowSelectAll(String allowSelectAll) { + this.allowSelectAll = allowSelectAll; + } + + + public String getMoveUpLabel() { + return moveUpLabel; + } + + public void setMoveUpLabel(String moveUpLabel) { + this.moveUpLabel = moveUpLabel; + } + + + + public String getMoveDownLabel() { + return moveDownLabel; + } + + public void setMoveDownLabel(String moveDownLabel) { + this.moveDownLabel = moveDownLabel; + } + + + + public String getSelectAllLabel() { + return selectAllLabel; + } + + public void setSelectAllLabel(String selectAllLabel) { + this.selectAllLabel = selectAllLabel; + } } diff --git a/core/src/main/java/org/apache/struts2/views/jsp/ui/table/WebTableTag.java b/core/src/main/java/org/apache/struts2/views/jsp/ui/table/WebTableTag.java index 6234723f1..7bfb0feff 100644 --- a/core/src/main/java/org/apache/struts2/views/jsp/ui/table/WebTableTag.java +++ b/core/src/main/java/org/apache/struts2/views/jsp/ui/table/WebTableTag.java @@ -1,19 +1,22 @@ /* * $Id$ * - * Copyright 2006 The Apache Software Foundation. + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at + * http://www.apache.org/licenses/LICENSE-2.0 * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. */ package org.apache.struts2.views.jsp.ui.table; @@ -32,9 +35,9 @@ import com.opensymphony.xwork2.util.ValueStack; */ public class WebTableTag extends ComponentTag { - private static final long serialVersionUID = 2978932111492397942L; - - protected String sortOrder; + private static final long serialVersionUID = 2978932111492397942L; + + protected String sortOrder; protected String modelName; protected boolean sortable; protected int sortColumn; diff --git a/core/src/main/java/org/apache/struts2/views/util/ContextUtil.java b/core/src/main/java/org/apache/struts2/views/util/ContextUtil.java index e3cf24072..35a236a73 100644 --- a/core/src/main/java/org/apache/struts2/views/util/ContextUtil.java +++ b/core/src/main/java/org/apache/struts2/views/util/ContextUtil.java @@ -1,19 +1,22 @@ /* * $Id$ * - * Copyright 2006 The Apache Software Foundation. + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at + * http://www.apache.org/licenses/LICENSE-2.0 * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. */ package org.apache.struts2.views.util; @@ -34,7 +37,7 @@ import com.opensymphony.xwork2.util.ValueStack; /** * Value Stack's Context related Utilities. - * + * */ public class ContextUtil { public static final String REQUEST = "request"; @@ -66,7 +69,7 @@ public class ContextUtil { } return map; } - + /** * Return true if either Configuration's altSyntax is on or the stack context's useAltSyntax is on * @param context stack's context diff --git a/core/src/main/java/org/apache/struts2/views/util/ResourceUtil.java b/core/src/main/java/org/apache/struts2/views/util/ResourceUtil.java index a0f8fd1bc..14af31eb6 100644 --- a/core/src/main/java/org/apache/struts2/views/util/ResourceUtil.java +++ b/core/src/main/java/org/apache/struts2/views/util/ResourceUtil.java @@ -1,27 +1,22 @@ /* * $Id$ * - * Copyright 2006 The Apache Software Foundation. + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at + * http://www.apache.org/licenses/LICENSE-2.0 * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.apache.struts2.views.util; - -import javax.servlet.http.HttpServletRequest; - -import org.apache.struts2.RequestUtils; - -/** + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. */ public class ResourceUtil { public static String getResourceBase(HttpServletRequest req) { diff --git a/core/src/main/java/org/apache/struts2/views/util/UrlHelper.java b/core/src/main/java/org/apache/struts2/views/util/UrlHelper.java index 75f81cf79..e0e40a5aa 100644 --- a/core/src/main/java/org/apache/struts2/views/util/UrlHelper.java +++ b/core/src/main/java/org/apache/struts2/views/util/UrlHelper.java @@ -1,20 +1,24 @@ /* * $Id$ * - * Copyright 2006 The Apache Software Foundation. + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at + * http://www.apache.org/licenses/LICENSE-2.0 * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. */ + package org.apache.struts2.views.util; import java.io.UnsupportedEncodingException; @@ -62,9 +66,9 @@ public class UrlHelper { public static String buildUrl(String action, HttpServletRequest request, HttpServletResponse response, Map params) { return buildUrl(action, request, response, params, null, true, true); } - + public static String buildUrl(String action, HttpServletRequest request, HttpServletResponse response, Map params, String scheme, boolean includeContext, boolean encodeResult) { - return buildUrl(action, request, response, params, scheme, includeContext, encodeResult, false); + return buildUrl(action, request, response, params, scheme, includeContext, encodeResult, false); } public static String buildUrl(String action, HttpServletRequest request, HttpServletResponse response, Map params, String scheme, boolean includeContext, boolean encodeResult, boolean forceAddSchemeHostAndPort) { @@ -89,19 +93,19 @@ public class UrlHelper { // only append scheme if it is different to the current scheme *OR* // if we explicity want it to be appended by having forceAddSchemeHostAndPort = true if (forceAddSchemeHostAndPort) { - String reqScheme = request.getScheme(); - changedScheme = true; - link.append(scheme != null ? scheme : reqScheme); - link.append("://"); - link.append(request.getServerName()); - - if ((scheme.equals("http") && (httpPort != DEFAULT_HTTP_PORT)) || (scheme.equals("https") && httpsPort != DEFAULT_HTTPS_PORT)) + String reqScheme = request.getScheme(); + changedScheme = true; + link.append(scheme != null ? scheme : reqScheme); + link.append("://"); + link.append(request.getServerName()); + + if ((scheme.equals("http") && (httpPort != DEFAULT_HTTP_PORT)) || (scheme.equals("https") && httpsPort != DEFAULT_HTTPS_PORT)) { link.append(":"); link.append(scheme.equals("http") ? httpPort : httpsPort); } } - else if ( + else if ( (scheme != null) && !scheme.equals(request.getScheme())) { changedScheme = true; link.append(scheme); @@ -124,16 +128,16 @@ public class UrlHelper { link.append(contextPath); } } else if (changedScheme) { - + // (Applicable to Servlet 2.4 containers) // If the request was forwarded, the attribute below will be set with the original URL String uri = (String) request.getAttribute("javax.servlet.forward.request_uri"); - + // If the attribute wasn't found, default to the value in the request object if (uri == null) { uri = request.getRequestURI(); } - + link.append(uri.substring(0, uri.lastIndexOf('/') + 1)); } @@ -148,7 +152,7 @@ public class UrlHelper { if (requestURI == null) { requestURI = (String) request.getAttribute("javax.servlet.forward.request_uri"); } - + // If neither request attributes were found, default to the value in the request object if (requestURI == null) { requestURI = request.getRequestURI(); @@ -184,9 +188,9 @@ public class UrlHelper { } public static void buildParametersString(Map params, StringBuffer link) { - buildParametersString(params, link, AMP); + buildParametersString(params, link, AMP); } - + public static void buildParametersString(Map params, StringBuffer link, String paramSeparator) { if ((params != null) && (params.size() > 0)) { if (link.toString().indexOf("?") == -1) { @@ -251,10 +255,10 @@ public class UrlHelper { return translatedInput; } } - + public static String translateAndDecode(String input) { - String translatedInput = translateVariable(input); - String encoding = getEncodingFromConfiguration(); + String translatedInput = translateVariable(input); + String encoding = getEncodingFromConfiguration(); try { return URLDecoder.decode(translatedInput, encoding); @@ -263,15 +267,15 @@ public class UrlHelper { return translatedInput; } } - + private static String translateVariable(String input) { - ValueStack valueStack = ServletActionContext.getContext().getValueStack(); + ValueStack valueStack = ServletActionContext.getContext().getValueStack(); String output = TextParseUtil.translateVariables(input, valueStack); return output; } - + private static String getEncodingFromConfiguration() { - final String encoding; + final String encoding; if (Settings.isSet(StrutsConstants.STRUTS_I18N_ENCODING)) { encoding = Settings.get(StrutsConstants.STRUTS_I18N_ENCODING); } else { @@ -279,29 +283,29 @@ public class UrlHelper { } return encoding; } - + public static Map parseQueryString(String queryString) { - Map queryParams = new LinkedHashMap(); - if (queryString != null) { - String[] params = queryString.split("&"); - for (int a=0; a< params.length; a++) { - if (params[a].trim().length() > 0) { - String[] tmpParams = params[a].split("="); - String paramName = null; - String paramValue = ""; - if (tmpParams.length > 0) { - paramName = tmpParams[0]; - } - if (tmpParams.length > 1) { - paramValue = tmpParams[1]; - } - if (paramName != null) { - String translatedParamValue = translateAndDecode(paramValue); - queryParams.put(paramName, translatedParamValue); - } - } - } - } - return queryParams; + Map queryParams = new LinkedHashMap(); + if (queryString != null) { + String[] params = queryString.split("&"); + for (int a=0; a< params.length; a++) { + if (params[a].trim().length() > 0) { + String[] tmpParams = params[a].split("="); + String paramName = null; + String paramValue = ""; + if (tmpParams.length > 0) { + paramName = tmpParams[0]; + } + if (tmpParams.length > 1) { + paramValue = tmpParams[1]; + } + if (paramName != null) { + String translatedParamValue = translateAndDecode(paramValue); + queryParams.put(paramName, translatedParamValue); + } + } + } + } + return queryParams; } } diff --git a/core/src/main/java/org/apache/struts2/views/velocity/StrutsResourceLoader.java b/core/src/main/java/org/apache/struts2/views/velocity/StrutsResourceLoader.java index 59c909927..67f28db8d 100644 --- a/core/src/main/java/org/apache/struts2/views/velocity/StrutsResourceLoader.java +++ b/core/src/main/java/org/apache/struts2/views/velocity/StrutsResourceLoader.java @@ -1,19 +1,22 @@ /* * $Id$ * - * Copyright 2006 The Apache Software Foundation. + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at + * http://www.apache.org/licenses/LICENSE-2.0 * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. */ package org.apache.struts2.views.velocity; diff --git a/core/src/main/java/org/apache/struts2/views/velocity/StrutsVelocityContext.java b/core/src/main/java/org/apache/struts2/views/velocity/StrutsVelocityContext.java index e163c5337..930f51318 100644 --- a/core/src/main/java/org/apache/struts2/views/velocity/StrutsVelocityContext.java +++ b/core/src/main/java/org/apache/struts2/views/velocity/StrutsVelocityContext.java @@ -1,19 +1,22 @@ /* * $Id$ * - * Copyright 2006 The Apache Software Foundation. + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at + * http://www.apache.org/licenses/LICENSE-2.0 * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. */ package org.apache.struts2.views.velocity; diff --git a/core/src/main/java/org/apache/struts2/views/velocity/StrutsVelocityServlet.java b/core/src/main/java/org/apache/struts2/views/velocity/StrutsVelocityServlet.java index 7107561fe..979c1acb5 100644 --- a/core/src/main/java/org/apache/struts2/views/velocity/StrutsVelocityServlet.java +++ b/core/src/main/java/org/apache/struts2/views/velocity/StrutsVelocityServlet.java @@ -1,19 +1,22 @@ /* * $Id$ * - * Copyright 2006 The Apache Software Foundation. + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at + * http://www.apache.org/licenses/LICENSE-2.0 * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. */ package org.apache.struts2.views.velocity; diff --git a/core/src/main/java/org/apache/struts2/views/velocity/VelocityManager.java b/core/src/main/java/org/apache/struts2/views/velocity/VelocityManager.java index 62477a8b9..690052691 100644 --- a/core/src/main/java/org/apache/struts2/views/velocity/VelocityManager.java +++ b/core/src/main/java/org/apache/struts2/views/velocity/VelocityManager.java @@ -1,19 +1,22 @@ /* * $Id$ * - * Copyright 2006 The Apache Software Foundation. + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at + * http://www.apache.org/licenses/LICENSE-2.0 * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. */ package org.apache.struts2.views.velocity; @@ -127,7 +130,7 @@ public class VelocityManager { * Names of contexts that will be chained on every request */ private String[] chainedContextNames; - + private Properties velocityProperties; protected VelocityManager() { @@ -282,7 +285,7 @@ public class VelocityManager { // now apply our systemic defaults, then allow user to override applyDefaultConfiguration(context, properties); - + String defaultUserDirective = properties.getProperty("userdirective"); @@ -355,14 +358,14 @@ public class VelocityManager { } } } - + // overide with programmatically set properties if (this.velocityProperties != null) { - Iterator keys = this.velocityProperties.keySet().iterator(); - while (keys.hasNext()) { - String key = (String) keys.next(); - properties.setProperty(key, this.velocityProperties.getProperty(key)); - } + Iterator keys = this.velocityProperties.keySet().iterator(); + while (keys.hasNext()) { + String key = (String) keys.next(); + properties.setProperty(key, this.velocityProperties.getProperty(key)); + } } String userdirective = properties.getProperty("userdirective"); @@ -375,7 +378,7 @@ public class VelocityManager { properties.setProperty("userdirective", userdirective); - + // for debugging purposes, allows users to dump out the properties that have been configured if (log.isDebugEnabled()) { log.debug("Initializing Velocity with the following properties ..."); @@ -488,8 +491,8 @@ public class VelocityManager { Properties p = loadConfiguration(context); VelocityEngine velocityEngine = new VelocityEngine(); - - // Set the velocity attribute for the servlet context + + // Set the velocity attribute for the servlet context // if this is not set the webapp loader WILL NOT WORK velocityEngine.setApplicationAttribute(ServletContext.class.getName(), context); @@ -656,17 +659,17 @@ public class VelocityManager { return string; } - /** - * @return the velocityProperties - */ - public Properties getVelocityProperties() { - return velocityProperties; - } + /** + * @return the velocityProperties + */ + public Properties getVelocityProperties() { + return velocityProperties; + } - /** - * @param velocityProperties the velocityProperties to set - */ - public void setVelocityProperties(Properties velocityProperties) { - this.velocityProperties = velocityProperties; - } + /** + * @param velocityProperties the velocityProperties to set + */ + public void setVelocityProperties(Properties velocityProperties) { + this.velocityProperties = velocityProperties; + } } diff --git a/core/src/main/java/org/apache/struts2/views/velocity/components/AbstractDirective.java b/core/src/main/java/org/apache/struts2/views/velocity/components/AbstractDirective.java index 633e00297..327c43139 100644 --- a/core/src/main/java/org/apache/struts2/views/velocity/components/AbstractDirective.java +++ b/core/src/main/java/org/apache/struts2/views/velocity/components/AbstractDirective.java @@ -1,19 +1,22 @@ /* * $Id$ * - * Copyright 2006 The Apache Software Foundation. + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at + * http://www.apache.org/licenses/LICENSE-2.0 * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. */ package org.apache.struts2.views.velocity.components; diff --git a/core/src/main/java/org/apache/struts2/views/velocity/components/ActionDirective.java b/core/src/main/java/org/apache/struts2/views/velocity/components/ActionDirective.java index a0b4eb112..560af490d 100644 --- a/core/src/main/java/org/apache/struts2/views/velocity/components/ActionDirective.java +++ b/core/src/main/java/org/apache/struts2/views/velocity/components/ActionDirective.java @@ -1,19 +1,22 @@ /* * $Id$ * - * Copyright 2006 The Apache Software Foundation. + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at + * http://www.apache.org/licenses/LICENSE-2.0 * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. */ package org.apache.struts2.views.velocity.components; diff --git a/core/src/main/java/org/apache/struts2/views/velocity/components/ActionErrorDirective.java b/core/src/main/java/org/apache/struts2/views/velocity/components/ActionErrorDirective.java index 435e1c85f..710c035c9 100644 --- a/core/src/main/java/org/apache/struts2/views/velocity/components/ActionErrorDirective.java +++ b/core/src/main/java/org/apache/struts2/views/velocity/components/ActionErrorDirective.java @@ -1,19 +1,22 @@ /* * $Id$ * - * Copyright 2006 The Apache Software Foundation. + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at + * http://www.apache.org/licenses/LICENSE-2.0 * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. */ package org.apache.struts2.views.velocity.components; diff --git a/core/src/main/java/org/apache/struts2/views/velocity/components/ActionMessageDirective.java b/core/src/main/java/org/apache/struts2/views/velocity/components/ActionMessageDirective.java index 0e56e7433..f9545eb2d 100644 --- a/core/src/main/java/org/apache/struts2/views/velocity/components/ActionMessageDirective.java +++ b/core/src/main/java/org/apache/struts2/views/velocity/components/ActionMessageDirective.java @@ -1,19 +1,22 @@ /* * $Id$ * - * Copyright 2006 The Apache Software Foundation. + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at + * http://www.apache.org/licenses/LICENSE-2.0 * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. */ package org.apache.struts2.views.velocity.components; diff --git a/core/src/main/java/org/apache/struts2/views/velocity/components/AnchorDirective.java b/core/src/main/java/org/apache/struts2/views/velocity/components/AnchorDirective.java index fbf9db252..715bd5aba 100644 --- a/core/src/main/java/org/apache/struts2/views/velocity/components/AnchorDirective.java +++ b/core/src/main/java/org/apache/struts2/views/velocity/components/AnchorDirective.java @@ -1,19 +1,22 @@ /* * $Id$ * - * Copyright 2006 The Apache Software Foundation. + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at + * http://www.apache.org/licenses/LICENSE-2.0 * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. */ package org.apache.struts2.views.velocity.components; diff --git a/core/src/main/java/org/apache/struts2/views/velocity/components/BeanDirective.java b/core/src/main/java/org/apache/struts2/views/velocity/components/BeanDirective.java index 38ca4bdca..007f98605 100644 --- a/core/src/main/java/org/apache/struts2/views/velocity/components/BeanDirective.java +++ b/core/src/main/java/org/apache/struts2/views/velocity/components/BeanDirective.java @@ -1,19 +1,22 @@ /* * $Id$ * - * Copyright 2006 The Apache Software Foundation. + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at + * http://www.apache.org/licenses/LICENSE-2.0 * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. */ package org.apache.struts2.views.velocity.components; diff --git a/core/src/main/java/org/apache/struts2/views/velocity/components/CheckBoxDirective.java b/core/src/main/java/org/apache/struts2/views/velocity/components/CheckBoxDirective.java index 664857bb8..73427a115 100644 --- a/core/src/main/java/org/apache/struts2/views/velocity/components/CheckBoxDirective.java +++ b/core/src/main/java/org/apache/struts2/views/velocity/components/CheckBoxDirective.java @@ -1,19 +1,22 @@ /* * $Id$ * - * Copyright 2006 The Apache Software Foundation. + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at + * http://www.apache.org/licenses/LICENSE-2.0 * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. */ package org.apache.struts2.views.velocity.components; diff --git a/core/src/main/java/org/apache/struts2/views/velocity/components/CheckBoxListDirective.java b/core/src/main/java/org/apache/struts2/views/velocity/components/CheckBoxListDirective.java index 1fb6fb896..e5539a4ae 100644 --- a/core/src/main/java/org/apache/struts2/views/velocity/components/CheckBoxListDirective.java +++ b/core/src/main/java/org/apache/struts2/views/velocity/components/CheckBoxListDirective.java @@ -1,19 +1,22 @@ /* * $Id$ * - * Copyright 2006 The Apache Software Foundation. + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at + * http://www.apache.org/licenses/LICENSE-2.0 * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. */ package org.apache.struts2.views.velocity.components; diff --git a/core/src/main/java/org/apache/struts2/views/velocity/components/ComboBoxDirective.java b/core/src/main/java/org/apache/struts2/views/velocity/components/ComboBoxDirective.java index 124c4136f..69386e531 100644 --- a/core/src/main/java/org/apache/struts2/views/velocity/components/ComboBoxDirective.java +++ b/core/src/main/java/org/apache/struts2/views/velocity/components/ComboBoxDirective.java @@ -1,19 +1,22 @@ /* * $Id$ * - * Copyright 2006 The Apache Software Foundation. + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at + * http://www.apache.org/licenses/LICENSE-2.0 * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. */ package org.apache.struts2.views.velocity.components; diff --git a/core/src/main/java/org/apache/struts2/views/velocity/components/ComponentDirective.java b/core/src/main/java/org/apache/struts2/views/velocity/components/ComponentDirective.java index 3d295d727..0d1b3f7f5 100644 --- a/core/src/main/java/org/apache/struts2/views/velocity/components/ComponentDirective.java +++ b/core/src/main/java/org/apache/struts2/views/velocity/components/ComponentDirective.java @@ -1,19 +1,22 @@ /* * $Id$ * - * Copyright 2006 The Apache Software Foundation. + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at + * http://www.apache.org/licenses/LICENSE-2.0 * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. */ package org.apache.struts2.views.velocity.components; diff --git a/core/src/main/java/org/apache/struts2/views/velocity/components/DateDirective.java b/core/src/main/java/org/apache/struts2/views/velocity/components/DateDirective.java index 28ac7088e..4cd0516de 100644 --- a/core/src/main/java/org/apache/struts2/views/velocity/components/DateDirective.java +++ b/core/src/main/java/org/apache/struts2/views/velocity/components/DateDirective.java @@ -1,19 +1,22 @@ /* * $Id$ * - * Copyright 2006 The Apache Software Foundation. + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at + * http://www.apache.org/licenses/LICENSE-2.0 * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. */ package org.apache.struts2.views.velocity.components; diff --git a/core/src/main/java/org/apache/struts2/views/velocity/components/DatePickerDirective.java b/core/src/main/java/org/apache/struts2/views/velocity/components/DatePickerDirective.java index 77aa7e227..d25dda5ef 100644 --- a/core/src/main/java/org/apache/struts2/views/velocity/components/DatePickerDirective.java +++ b/core/src/main/java/org/apache/struts2/views/velocity/components/DatePickerDirective.java @@ -1,19 +1,22 @@ /* * $Id$ * - * Copyright 2006 The Apache Software Foundation. + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at + * http://www.apache.org/licenses/LICENSE-2.0 * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. */ package org.apache.struts2.views.velocity.components; diff --git a/core/src/main/java/org/apache/struts2/views/velocity/components/DivDirective.java b/core/src/main/java/org/apache/struts2/views/velocity/components/DivDirective.java index 0a8da4927..baadef4ea 100644 --- a/core/src/main/java/org/apache/struts2/views/velocity/components/DivDirective.java +++ b/core/src/main/java/org/apache/struts2/views/velocity/components/DivDirective.java @@ -1,19 +1,22 @@ /* * $Id$ * - * Copyright 2006 The Apache Software Foundation. + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at + * http://www.apache.org/licenses/LICENSE-2.0 * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. */ package org.apache.struts2.views.velocity.components; diff --git a/core/src/main/java/org/apache/struts2/views/velocity/components/DoubleSelectDirective.java b/core/src/main/java/org/apache/struts2/views/velocity/components/DoubleSelectDirective.java index 29015bebe..6dd32ce3c 100644 --- a/core/src/main/java/org/apache/struts2/views/velocity/components/DoubleSelectDirective.java +++ b/core/src/main/java/org/apache/struts2/views/velocity/components/DoubleSelectDirective.java @@ -1,19 +1,22 @@ /* * $Id$ * - * Copyright 2006 The Apache Software Foundation. + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at + * http://www.apache.org/licenses/LICENSE-2.0 * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. */ package org.apache.struts2.views.velocity.components; diff --git a/core/src/main/java/org/apache/struts2/views/velocity/components/FieldErrorDirective.java b/core/src/main/java/org/apache/struts2/views/velocity/components/FieldErrorDirective.java index 799f1a8c8..e4d68071b 100644 --- a/core/src/main/java/org/apache/struts2/views/velocity/components/FieldErrorDirective.java +++ b/core/src/main/java/org/apache/struts2/views/velocity/components/FieldErrorDirective.java @@ -1,19 +1,22 @@ /* * $Id$ * - * Copyright 2006 The Apache Software Foundation. + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at + * http://www.apache.org/licenses/LICENSE-2.0 * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. */ package org.apache.struts2.views.velocity.components; diff --git a/core/src/main/java/org/apache/struts2/views/velocity/components/FileDirective.java b/core/src/main/java/org/apache/struts2/views/velocity/components/FileDirective.java index b4b7f0ba9..d309cd7fc 100644 --- a/core/src/main/java/org/apache/struts2/views/velocity/components/FileDirective.java +++ b/core/src/main/java/org/apache/struts2/views/velocity/components/FileDirective.java @@ -1,19 +1,22 @@ /* * $Id$ * - * Copyright 2006 The Apache Software Foundation. + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at + * http://www.apache.org/licenses/LICENSE-2.0 * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. */ package org.apache.struts2.views.velocity.components; diff --git a/core/src/main/java/org/apache/struts2/views/velocity/components/FormDirective.java b/core/src/main/java/org/apache/struts2/views/velocity/components/FormDirective.java index 60361a787..4db7be3b1 100644 --- a/core/src/main/java/org/apache/struts2/views/velocity/components/FormDirective.java +++ b/core/src/main/java/org/apache/struts2/views/velocity/components/FormDirective.java @@ -1,19 +1,22 @@ /* * $Id$ * - * Copyright 2006 The Apache Software Foundation. + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at + * http://www.apache.org/licenses/LICENSE-2.0 * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. */ package org.apache.struts2.views.velocity.components; diff --git a/core/src/main/java/org/apache/struts2/views/velocity/components/HeadDirective.java b/core/src/main/java/org/apache/struts2/views/velocity/components/HeadDirective.java index 974d264f2..3b919902f 100644 --- a/core/src/main/java/org/apache/struts2/views/velocity/components/HeadDirective.java +++ b/core/src/main/java/org/apache/struts2/views/velocity/components/HeadDirective.java @@ -1,19 +1,22 @@ /* * $Id$ * - * Copyright 2006 The Apache Software Foundation. + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at + * http://www.apache.org/licenses/LICENSE-2.0 * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. */ package org.apache.struts2.views.velocity.components; diff --git a/core/src/main/java/org/apache/struts2/views/velocity/components/HiddenDirective.java b/core/src/main/java/org/apache/struts2/views/velocity/components/HiddenDirective.java index dd4a946f0..797e3a906 100644 --- a/core/src/main/java/org/apache/struts2/views/velocity/components/HiddenDirective.java +++ b/core/src/main/java/org/apache/struts2/views/velocity/components/HiddenDirective.java @@ -1,19 +1,22 @@ /* * $Id$ * - * Copyright 2006 The Apache Software Foundation. + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at + * http://www.apache.org/licenses/LICENSE-2.0 * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. */ package org.apache.struts2.views.velocity.components; diff --git a/core/src/main/java/org/apache/struts2/views/velocity/components/I18nDirective.java b/core/src/main/java/org/apache/struts2/views/velocity/components/I18nDirective.java index 922508fa9..2608456e1 100644 --- a/core/src/main/java/org/apache/struts2/views/velocity/components/I18nDirective.java +++ b/core/src/main/java/org/apache/struts2/views/velocity/components/I18nDirective.java @@ -1,19 +1,22 @@ /* * $Id$ * - * Copyright 2006 The Apache Software Foundation. + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at + * http://www.apache.org/licenses/LICENSE-2.0 * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. */ package org.apache.struts2.views.velocity.components; diff --git a/core/src/main/java/org/apache/struts2/views/velocity/components/IncludeDirective.java b/core/src/main/java/org/apache/struts2/views/velocity/components/IncludeDirective.java index 3219a0a92..01c40618f 100644 --- a/core/src/main/java/org/apache/struts2/views/velocity/components/IncludeDirective.java +++ b/core/src/main/java/org/apache/struts2/views/velocity/components/IncludeDirective.java @@ -1,19 +1,22 @@ /* * $Id$ * - * Copyright 2006 The Apache Software Foundation. + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at + * http://www.apache.org/licenses/LICENSE-2.0 * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. */ package org.apache.struts2.views.velocity.components; diff --git a/core/src/main/java/org/apache/struts2/views/velocity/components/LabelDirective.java b/core/src/main/java/org/apache/struts2/views/velocity/components/LabelDirective.java index 20c566579..5312e6f01 100644 --- a/core/src/main/java/org/apache/struts2/views/velocity/components/LabelDirective.java +++ b/core/src/main/java/org/apache/struts2/views/velocity/components/LabelDirective.java @@ -1,19 +1,22 @@ /* * $Id$ * - * Copyright 2006 The Apache Software Foundation. + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at + * http://www.apache.org/licenses/LICENSE-2.0 * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. */ package org.apache.struts2.views.velocity.components; diff --git a/core/src/main/java/org/apache/struts2/views/velocity/components/OptGroupDirective.java b/core/src/main/java/org/apache/struts2/views/velocity/components/OptGroupDirective.java index 36b4dae2d..cdb1c8e13 100644 --- a/core/src/main/java/org/apache/struts2/views/velocity/components/OptGroupDirective.java +++ b/core/src/main/java/org/apache/struts2/views/velocity/components/OptGroupDirective.java @@ -1,19 +1,22 @@ /* * $Id$ * - * Copyright 2006 The Apache Software Foundation. + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at + * http://www.apache.org/licenses/LICENSE-2.0 * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. */ package org.apache.struts2.views.velocity.components; @@ -31,11 +34,11 @@ import com.opensymphony.xwork2.util.ValueStack; */ public class OptGroupDirective extends AbstractDirective { - protected Component getBean(ValueStack stack, HttpServletRequest req, HttpServletResponse res) { - return new OptGroup(stack, req, res); - } + protected Component getBean(ValueStack stack, HttpServletRequest req, HttpServletResponse res) { + return new OptGroup(stack, req, res); + } - public String getBeanName() { - return "optgroup"; - } + public String getBeanName() { + return "optgroup"; + } } diff --git a/core/src/main/java/org/apache/struts2/views/velocity/components/OptionTransferSelectDirective.java b/core/src/main/java/org/apache/struts2/views/velocity/components/OptionTransferSelectDirective.java index 0ac1745aa..a6679da82 100644 --- a/core/src/main/java/org/apache/struts2/views/velocity/components/OptionTransferSelectDirective.java +++ b/core/src/main/java/org/apache/struts2/views/velocity/components/OptionTransferSelectDirective.java @@ -1,19 +1,22 @@ /* * $Id$ * - * Copyright 2006 The Apache Software Foundation. + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at + * http://www.apache.org/licenses/LICENSE-2.0 * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. */ package org.apache.struts2.views.velocity.components; @@ -30,12 +33,12 @@ import com.opensymphony.xwork2.util.ValueStack; */ public class OptionTransferSelectDirective extends AbstractDirective { - public String getBeanName() { - return "optiontransferselect"; - } + public String getBeanName() { + return "optiontransferselect"; + } - protected Component getBean(ValueStack stack, HttpServletRequest req, HttpServletResponse res) { - return new OptionTransferSelect(stack, req, res); - } + protected Component getBean(ValueStack stack, HttpServletRequest req, HttpServletResponse res) { + return new OptionTransferSelect(stack, req, res); + } } diff --git a/core/src/main/java/org/apache/struts2/views/velocity/components/PanelDirective.java b/core/src/main/java/org/apache/struts2/views/velocity/components/PanelDirective.java index f62239f87..34c7c32a8 100644 --- a/core/src/main/java/org/apache/struts2/views/velocity/components/PanelDirective.java +++ b/core/src/main/java/org/apache/struts2/views/velocity/components/PanelDirective.java @@ -1,19 +1,22 @@ /* * $Id$ * - * Copyright 2006 The Apache Software Foundation. + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at + * http://www.apache.org/licenses/LICENSE-2.0 * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. */ package org.apache.struts2.views.velocity.components; diff --git a/core/src/main/java/org/apache/struts2/views/velocity/components/ParamDirective.java b/core/src/main/java/org/apache/struts2/views/velocity/components/ParamDirective.java index 7c0ef6da1..2210adfb2 100644 --- a/core/src/main/java/org/apache/struts2/views/velocity/components/ParamDirective.java +++ b/core/src/main/java/org/apache/struts2/views/velocity/components/ParamDirective.java @@ -1,19 +1,22 @@ /* * $Id$ * - * Copyright 2006 The Apache Software Foundation. + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at + * http://www.apache.org/licenses/LICENSE-2.0 * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. */ package org.apache.struts2.views.velocity.components; diff --git a/core/src/main/java/org/apache/struts2/views/velocity/components/PasswordDirective.java b/core/src/main/java/org/apache/struts2/views/velocity/components/PasswordDirective.java index d9b396cda..e7e272818 100644 --- a/core/src/main/java/org/apache/struts2/views/velocity/components/PasswordDirective.java +++ b/core/src/main/java/org/apache/struts2/views/velocity/components/PasswordDirective.java @@ -1,19 +1,22 @@ /* * $Id$ * - * Copyright 2006 The Apache Software Foundation. + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at + * http://www.apache.org/licenses/LICENSE-2.0 * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. */ package org.apache.struts2.views.velocity.components; diff --git a/core/src/main/java/org/apache/struts2/views/velocity/components/PropertyDirective.java b/core/src/main/java/org/apache/struts2/views/velocity/components/PropertyDirective.java index 32913385d..c994606c7 100644 --- a/core/src/main/java/org/apache/struts2/views/velocity/components/PropertyDirective.java +++ b/core/src/main/java/org/apache/struts2/views/velocity/components/PropertyDirective.java @@ -1,19 +1,22 @@ /* * $Id$ * - * Copyright 2006 The Apache Software Foundation. + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at + * http://www.apache.org/licenses/LICENSE-2.0 * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. */ package org.apache.struts2.views.velocity.components; diff --git a/core/src/main/java/org/apache/struts2/views/velocity/components/PushDirective.java b/core/src/main/java/org/apache/struts2/views/velocity/components/PushDirective.java index 91d533967..c4ba20223 100644 --- a/core/src/main/java/org/apache/struts2/views/velocity/components/PushDirective.java +++ b/core/src/main/java/org/apache/struts2/views/velocity/components/PushDirective.java @@ -1,19 +1,22 @@ /* * $Id$ * - * Copyright 2006 The Apache Software Foundation. + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at + * http://www.apache.org/licenses/LICENSE-2.0 * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. */ package org.apache.struts2.views.velocity.components; diff --git a/core/src/main/java/org/apache/struts2/views/velocity/components/RadioDirective.java b/core/src/main/java/org/apache/struts2/views/velocity/components/RadioDirective.java index 14289cd31..1c7cf39fd 100644 --- a/core/src/main/java/org/apache/struts2/views/velocity/components/RadioDirective.java +++ b/core/src/main/java/org/apache/struts2/views/velocity/components/RadioDirective.java @@ -1,19 +1,22 @@ /* * $Id$ * - * Copyright 2006 The Apache Software Foundation. + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at + * http://www.apache.org/licenses/LICENSE-2.0 * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. */ package org.apache.struts2.views.velocity.components; diff --git a/core/src/main/java/org/apache/struts2/views/velocity/components/ResetDirective.java b/core/src/main/java/org/apache/struts2/views/velocity/components/ResetDirective.java index 73e62fac5..cdd504f55 100644 --- a/core/src/main/java/org/apache/struts2/views/velocity/components/ResetDirective.java +++ b/core/src/main/java/org/apache/struts2/views/velocity/components/ResetDirective.java @@ -1,19 +1,22 @@ /* * $Id$ * - * Copyright 2006 The Apache Software Foundation. + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at + * http://www.apache.org/licenses/LICENSE-2.0 * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. */ package org.apache.struts2.views.velocity.components; diff --git a/core/src/main/java/org/apache/struts2/views/velocity/components/SelectDirective.java b/core/src/main/java/org/apache/struts2/views/velocity/components/SelectDirective.java index cd57a2c67..545bb1f6b 100644 --- a/core/src/main/java/org/apache/struts2/views/velocity/components/SelectDirective.java +++ b/core/src/main/java/org/apache/struts2/views/velocity/components/SelectDirective.java @@ -1,19 +1,22 @@ /* * $Id$ * - * Copyright 2006 The Apache Software Foundation. + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at + * http://www.apache.org/licenses/LICENSE-2.0 * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. */ package org.apache.struts2.views.velocity.components; diff --git a/core/src/main/java/org/apache/struts2/views/velocity/components/SetDirective.java b/core/src/main/java/org/apache/struts2/views/velocity/components/SetDirective.java index 2e9ce6717..845b3c54a 100644 --- a/core/src/main/java/org/apache/struts2/views/velocity/components/SetDirective.java +++ b/core/src/main/java/org/apache/struts2/views/velocity/components/SetDirective.java @@ -1,19 +1,22 @@ /* * $Id$ * - * Copyright 2006 The Apache Software Foundation. + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at + * http://www.apache.org/licenses/LICENSE-2.0 * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. */ package org.apache.struts2.views.velocity.components; diff --git a/core/src/main/java/org/apache/struts2/views/velocity/components/SubmitDirective.java b/core/src/main/java/org/apache/struts2/views/velocity/components/SubmitDirective.java index 40b99c560..6ff6c45e0 100644 --- a/core/src/main/java/org/apache/struts2/views/velocity/components/SubmitDirective.java +++ b/core/src/main/java/org/apache/struts2/views/velocity/components/SubmitDirective.java @@ -1,19 +1,22 @@ /* * $Id$ * - * Copyright 2006 The Apache Software Foundation. + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at + * http://www.apache.org/licenses/LICENSE-2.0 * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. */ package org.apache.struts2.views.velocity.components; diff --git a/core/src/main/java/org/apache/struts2/views/velocity/components/TabbedPanelDirective.java b/core/src/main/java/org/apache/struts2/views/velocity/components/TabbedPanelDirective.java index 9a256a4c1..f1a925e5b 100644 --- a/core/src/main/java/org/apache/struts2/views/velocity/components/TabbedPanelDirective.java +++ b/core/src/main/java/org/apache/struts2/views/velocity/components/TabbedPanelDirective.java @@ -1,19 +1,22 @@ /* * $Id$ * - * Copyright 2006 The Apache Software Foundation. + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at + * http://www.apache.org/licenses/LICENSE-2.0 * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. */ package org.apache.struts2.views.velocity.components; diff --git a/core/src/main/java/org/apache/struts2/views/velocity/components/TextAreaDirective.java b/core/src/main/java/org/apache/struts2/views/velocity/components/TextAreaDirective.java index 8315da596..af22fd21f 100644 --- a/core/src/main/java/org/apache/struts2/views/velocity/components/TextAreaDirective.java +++ b/core/src/main/java/org/apache/struts2/views/velocity/components/TextAreaDirective.java @@ -1,19 +1,22 @@ /* * $Id$ * - * Copyright 2006 The Apache Software Foundation. + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at + * http://www.apache.org/licenses/LICENSE-2.0 * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. */ package org.apache.struts2.views.velocity.components; diff --git a/core/src/main/java/org/apache/struts2/views/velocity/components/TextDirective.java b/core/src/main/java/org/apache/struts2/views/velocity/components/TextDirective.java index a3def019b..77733381e 100644 --- a/core/src/main/java/org/apache/struts2/views/velocity/components/TextDirective.java +++ b/core/src/main/java/org/apache/struts2/views/velocity/components/TextDirective.java @@ -1,19 +1,22 @@ /* * $Id$ * - * Copyright 2006 The Apache Software Foundation. + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at + * http://www.apache.org/licenses/LICENSE-2.0 * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. */ package org.apache.struts2.views.velocity.components; diff --git a/core/src/main/java/org/apache/struts2/views/velocity/components/TextFieldDirective.java b/core/src/main/java/org/apache/struts2/views/velocity/components/TextFieldDirective.java index d1dcb028e..97c03187c 100644 --- a/core/src/main/java/org/apache/struts2/views/velocity/components/TextFieldDirective.java +++ b/core/src/main/java/org/apache/struts2/views/velocity/components/TextFieldDirective.java @@ -1,19 +1,22 @@ /* * $Id$ * - * Copyright 2006 The Apache Software Foundation. + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at + * http://www.apache.org/licenses/LICENSE-2.0 * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. */ package org.apache.struts2.views.velocity.components; diff --git a/core/src/main/java/org/apache/struts2/views/velocity/components/TokenDirective.java b/core/src/main/java/org/apache/struts2/views/velocity/components/TokenDirective.java index 0002eec2c..ce9bd6301 100644 --- a/core/src/main/java/org/apache/struts2/views/velocity/components/TokenDirective.java +++ b/core/src/main/java/org/apache/struts2/views/velocity/components/TokenDirective.java @@ -1,19 +1,22 @@ /* * $Id$ * - * Copyright 2006 The Apache Software Foundation. + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at + * http://www.apache.org/licenses/LICENSE-2.0 * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. */ package org.apache.struts2.views.velocity.components; diff --git a/core/src/main/java/org/apache/struts2/views/velocity/components/TreeDirective.java b/core/src/main/java/org/apache/struts2/views/velocity/components/TreeDirective.java index bdcfb1e8d..7e24b75b6 100644 --- a/core/src/main/java/org/apache/struts2/views/velocity/components/TreeDirective.java +++ b/core/src/main/java/org/apache/struts2/views/velocity/components/TreeDirective.java @@ -1,19 +1,22 @@ /* * $Id$ * - * Copyright 2006 The Apache Software Foundation. + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at + * http://www.apache.org/licenses/LICENSE-2.0 * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. */ package org.apache.struts2.views.velocity.components; diff --git a/core/src/main/java/org/apache/struts2/views/velocity/components/TreeNodeDirective.java b/core/src/main/java/org/apache/struts2/views/velocity/components/TreeNodeDirective.java index 3f6392c37..2092b37bb 100644 --- a/core/src/main/java/org/apache/struts2/views/velocity/components/TreeNodeDirective.java +++ b/core/src/main/java/org/apache/struts2/views/velocity/components/TreeNodeDirective.java @@ -1,19 +1,22 @@ /* * $Id$ * - * Copyright 2006 The Apache Software Foundation. + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at + * http://www.apache.org/licenses/LICENSE-2.0 * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. */ package org.apache.struts2.views.velocity.components; diff --git a/core/src/main/java/org/apache/struts2/views/velocity/components/URLDirective.java b/core/src/main/java/org/apache/struts2/views/velocity/components/URLDirective.java index bed53d87e..111af0225 100644 --- a/core/src/main/java/org/apache/struts2/views/velocity/components/URLDirective.java +++ b/core/src/main/java/org/apache/struts2/views/velocity/components/URLDirective.java @@ -1,19 +1,22 @@ /* * $Id$ * - * Copyright 2006 The Apache Software Foundation. + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at + * http://www.apache.org/licenses/LICENSE-2.0 * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. */ package org.apache.struts2.views.velocity.components; diff --git a/core/src/main/java/org/apache/struts2/views/velocity/components/UpDownSelectDirective.java b/core/src/main/java/org/apache/struts2/views/velocity/components/UpDownSelectDirective.java index d5cb969ea..d3872c17e 100644 --- a/core/src/main/java/org/apache/struts2/views/velocity/components/UpDownSelectDirective.java +++ b/core/src/main/java/org/apache/struts2/views/velocity/components/UpDownSelectDirective.java @@ -1,19 +1,22 @@ /* * $Id$ * - * Copyright 2006 The Apache Software Foundation. + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at + * http://www.apache.org/licenses/LICENSE-2.0 * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. */ package org.apache.struts2.views.velocity.components; @@ -27,15 +30,15 @@ import com.opensymphony.xwork2.util.ValueStack; /** * @see UpDownSelect - * + * */ public class UpDownSelectDirective extends AbstractDirective { - public String getBeanName() { - return "updownselect"; - } + public String getBeanName() { + return "updownselect"; + } - protected Component getBean(ValueStack stack, HttpServletRequest req, HttpServletResponse res) { - return new UpDownSelect(stack, req, res); - } + protected Component getBean(ValueStack stack, HttpServletRequest req, HttpServletResponse res) { + return new UpDownSelect(stack, req, res); + } } diff --git a/core/src/main/java/org/apache/struts2/views/velocity/components/WebTableDirective.java b/core/src/main/java/org/apache/struts2/views/velocity/components/WebTableDirective.java index e9570f453..2595341de 100644 --- a/core/src/main/java/org/apache/struts2/views/velocity/components/WebTableDirective.java +++ b/core/src/main/java/org/apache/struts2/views/velocity/components/WebTableDirective.java @@ -1,19 +1,22 @@ /* * $Id$ * - * Copyright 2006 The Apache Software Foundation. + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at + * http://www.apache.org/licenses/LICENSE-2.0 * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. */ package org.apache.struts2.views.velocity.components; diff --git a/core/src/main/java/org/apache/struts2/views/xslt/AbstractAdapterElement.java b/core/src/main/java/org/apache/struts2/views/xslt/AbstractAdapterElement.java index 5e5ed16c9..709894418 100644 --- a/core/src/main/java/org/apache/struts2/views/xslt/AbstractAdapterElement.java +++ b/core/src/main/java/org/apache/struts2/views/xslt/AbstractAdapterElement.java @@ -1,19 +1,22 @@ /* * $Id$ * - * Copyright 2006 The Apache Software Foundation. + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at + * http://www.apache.org/licenses/LICENSE-2.0 * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. */ package org.apache.struts2.views.xslt; diff --git a/core/src/main/java/org/apache/struts2/views/xslt/AbstractAdapterNode.java b/core/src/main/java/org/apache/struts2/views/xslt/AbstractAdapterNode.java index 5ce4f3cf8..0ad0545f2 100644 --- a/core/src/main/java/org/apache/struts2/views/xslt/AbstractAdapterNode.java +++ b/core/src/main/java/org/apache/struts2/views/xslt/AbstractAdapterNode.java @@ -1,19 +1,22 @@ /* * $Id$ * - * Copyright 2006 The Apache Software Foundation. + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at + * http://www.apache.org/licenses/LICENSE-2.0 * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. */ package org.apache.struts2.views.xslt; diff --git a/core/src/main/java/org/apache/struts2/views/xslt/AdapterFactory.java b/core/src/main/java/org/apache/struts2/views/xslt/AdapterFactory.java index f3cb037a4..133fd328c 100644 --- a/core/src/main/java/org/apache/struts2/views/xslt/AdapterFactory.java +++ b/core/src/main/java/org/apache/struts2/views/xslt/AdapterFactory.java @@ -1,19 +1,22 @@ /* * $Id$ * - * Copyright 2006 The Apache Software Foundation. + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at + * http://www.apache.org/licenses/LICENSE-2.0 * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. */ package org.apache.struts2.views.xslt; @@ -115,7 +118,7 @@ public class AdapterFactory { public Document adaptDocument(String propertyName, Object propertyValue) throws IllegalAccessException, InstantiationException { //if ( propertyValue instanceof Document ) - // return (Document)propertyValue; + // return (Document)propertyValue; return new SimpleAdapterDocument(this, null, propertyName, propertyValue); } diff --git a/core/src/main/java/org/apache/struts2/views/xslt/AdapterNode.java b/core/src/main/java/org/apache/struts2/views/xslt/AdapterNode.java index fa6c70fc8..c4afdaee4 100644 --- a/core/src/main/java/org/apache/struts2/views/xslt/AdapterNode.java +++ b/core/src/main/java/org/apache/struts2/views/xslt/AdapterNode.java @@ -1,19 +1,22 @@ /* * $Id$ * - * Copyright 2006 The Apache Software Foundation. + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at + * http://www.apache.org/licenses/LICENSE-2.0 * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. */ package org.apache.struts2.views.xslt; diff --git a/core/src/main/java/org/apache/struts2/views/xslt/ArrayAdapter.java b/core/src/main/java/org/apache/struts2/views/xslt/ArrayAdapter.java index a434d63a8..e35eb93a7 100644 --- a/core/src/main/java/org/apache/struts2/views/xslt/ArrayAdapter.java +++ b/core/src/main/java/org/apache/struts2/views/xslt/ArrayAdapter.java @@ -1,19 +1,22 @@ /* * $Id$ * - * Copyright 2006 The Apache Software Foundation. + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at + * http://www.apache.org/licenses/LICENSE-2.0 * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. */ package org.apache.struts2.views.xslt; diff --git a/core/src/main/java/org/apache/struts2/views/xslt/BeanAdapter.java b/core/src/main/java/org/apache/struts2/views/xslt/BeanAdapter.java index 822c84d0d..3eea86c2a 100644 --- a/core/src/main/java/org/apache/struts2/views/xslt/BeanAdapter.java +++ b/core/src/main/java/org/apache/struts2/views/xslt/BeanAdapter.java @@ -1,19 +1,22 @@ /* * $Id$ * - * Copyright 2006 The Apache Software Foundation. + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at + * http://www.apache.org/licenses/LICENSE-2.0 * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. */ package org.apache.struts2.views.xslt; @@ -42,8 +45,8 @@ import org.w3c.dom.NodeList; * public Person getMyPerson() { ... } * ... * class Person { - * public String getFirstName(); - * public String getLastName(); + * public String getFirstName(); + * public String getLastName(); * } * * diff --git a/core/src/main/java/org/apache/struts2/views/xslt/CollectionAdapter.java b/core/src/main/java/org/apache/struts2/views/xslt/CollectionAdapter.java index 4fa7dc843..af7f85ca7 100644 --- a/core/src/main/java/org/apache/struts2/views/xslt/CollectionAdapter.java +++ b/core/src/main/java/org/apache/struts2/views/xslt/CollectionAdapter.java @@ -1,19 +1,22 @@ /* * $Id$ * - * Copyright 2006 The Apache Software Foundation. + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at + * http://www.apache.org/licenses/LICENSE-2.0 * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. */ package org.apache.struts2.views.xslt; @@ -32,9 +35,9 @@ public class CollectionAdapter extends AbstractAdapterElement { private Log log = LogFactory.getLog(this.getClass()); - public CollectionAdapter() { } + public CollectionAdapter() { } - public CollectionAdapter(AdapterFactory rootAdapterFactory, AdapterNode parent, String propertyName, Object value) { + public CollectionAdapter(AdapterFactory rootAdapterFactory, AdapterNode parent, String propertyName, Object value) { setContext(rootAdapterFactory, parent, propertyName, value); } diff --git a/core/src/main/java/org/apache/struts2/views/xslt/MapAdapter.java b/core/src/main/java/org/apache/struts2/views/xslt/MapAdapter.java index 5c835940f..04b93b29e 100644 --- a/core/src/main/java/org/apache/struts2/views/xslt/MapAdapter.java +++ b/core/src/main/java/org/apache/struts2/views/xslt/MapAdapter.java @@ -1,19 +1,22 @@ /* * $Id$ * - * Copyright 2006 The Apache Software Foundation. + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at + * http://www.apache.org/licenses/LICENSE-2.0 * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. */ package org.apache.struts2.views.xslt; @@ -27,13 +30,13 @@ import org.w3c.dom.Node; * MapAdapter adapters a java.util.Map type to an XML DOM with the following * structure: *
    - * 	
    - * 		
    - * 			...
    - * 			...
    - * 		
    - * 		...
    - * 	
    + *  
    + *      
    + *          ...
    + *          ...
    + *      
    + *      ...
    + *  
      * 
    */ public class MapAdapter extends AbstractAdapterElement { diff --git a/core/src/main/java/org/apache/struts2/views/xslt/ProxyAttrAdapter.java b/core/src/main/java/org/apache/struts2/views/xslt/ProxyAttrAdapter.java index 1e0e4c6eb..ad0c66067 100644 --- a/core/src/main/java/org/apache/struts2/views/xslt/ProxyAttrAdapter.java +++ b/core/src/main/java/org/apache/struts2/views/xslt/ProxyAttrAdapter.java @@ -1,19 +1,22 @@ /* * $Id$ * - * Copyright 2006 The Apache Software Foundation. + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at + * http://www.apache.org/licenses/LICENSE-2.0 * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. */ package org.apache.struts2.views.xslt; diff --git a/core/src/main/java/org/apache/struts2/views/xslt/ProxyElementAdapter.java b/core/src/main/java/org/apache/struts2/views/xslt/ProxyElementAdapter.java index c3a073f51..ba02bbad6 100644 --- a/core/src/main/java/org/apache/struts2/views/xslt/ProxyElementAdapter.java +++ b/core/src/main/java/org/apache/struts2/views/xslt/ProxyElementAdapter.java @@ -1,19 +1,22 @@ /* * $Id$ * - * Copyright 2006 The Apache Software Foundation. + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at + * http://www.apache.org/licenses/LICENSE-2.0 * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. */ package org.apache.struts2.views.xslt; diff --git a/core/src/main/java/org/apache/struts2/views/xslt/ProxyNamedNodeMap.java b/core/src/main/java/org/apache/struts2/views/xslt/ProxyNamedNodeMap.java index fd3166b62..699fdfa61 100644 --- a/core/src/main/java/org/apache/struts2/views/xslt/ProxyNamedNodeMap.java +++ b/core/src/main/java/org/apache/struts2/views/xslt/ProxyNamedNodeMap.java @@ -1,19 +1,22 @@ /* * $Id$ * - * Copyright 2006 The Apache Software Foundation. + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at + * http://www.apache.org/licenses/LICENSE-2.0 * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. */ package org.apache.struts2.views.xslt; diff --git a/core/src/main/java/org/apache/struts2/views/xslt/ProxyNodeAdapter.java b/core/src/main/java/org/apache/struts2/views/xslt/ProxyNodeAdapter.java index 247c42aab..3f54951cd 100644 --- a/core/src/main/java/org/apache/struts2/views/xslt/ProxyNodeAdapter.java +++ b/core/src/main/java/org/apache/struts2/views/xslt/ProxyNodeAdapter.java @@ -1,19 +1,22 @@ /* * $Id$ * - * Copyright 2006 The Apache Software Foundation. + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at + * http://www.apache.org/licenses/LICENSE-2.0 * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. */ package org.apache.struts2.views.xslt; @@ -30,7 +33,7 @@ import org.w3c.dom.Node; * are implemented by the abstract adapter node to work with the parent adapter. */ public abstract class ProxyNodeAdapter extends AbstractAdapterNode { - + private Log log = LogFactory.getLog(this.getClass()); public ProxyNodeAdapter(AdapterFactory factory, AdapterNode parent, Node value) { @@ -63,7 +66,7 @@ public abstract class ProxyNodeAdapter extends AbstractAdapterNode { //protected NodeList wrap( NodeList nl ) { } //protected Node unwrap( Node child ) { - // return ((ProxyNodeAdapter)child).node(); + // return ((ProxyNodeAdapter)child).node(); //} // Proxied Node methods diff --git a/core/src/main/java/org/apache/struts2/views/xslt/ProxyTextNodeAdapter.java b/core/src/main/java/org/apache/struts2/views/xslt/ProxyTextNodeAdapter.java index 0fc9cccb8..f9f726ce3 100644 --- a/core/src/main/java/org/apache/struts2/views/xslt/ProxyTextNodeAdapter.java +++ b/core/src/main/java/org/apache/struts2/views/xslt/ProxyTextNodeAdapter.java @@ -1,19 +1,22 @@ /* * $Id$ * - * Copyright 2006 The Apache Software Foundation. + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at + * http://www.apache.org/licenses/LICENSE-2.0 * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. */ package org.apache.struts2.views.xslt; diff --git a/core/src/main/java/org/apache/struts2/views/xslt/ServletURIResolver.java b/core/src/main/java/org/apache/struts2/views/xslt/ServletURIResolver.java index c295d4f74..b18b513c2 100644 --- a/core/src/main/java/org/apache/struts2/views/xslt/ServletURIResolver.java +++ b/core/src/main/java/org/apache/struts2/views/xslt/ServletURIResolver.java @@ -1,19 +1,22 @@ /* * $Id$ * - * Copyright 2006 The Apache Software Foundation. + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at + * http://www.apache.org/licenses/LICENSE-2.0 * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. */ package org.apache.struts2.views.xslt; diff --git a/core/src/main/java/org/apache/struts2/views/xslt/SimpleAdapterDocument.java b/core/src/main/java/org/apache/struts2/views/xslt/SimpleAdapterDocument.java index 3879b304e..e1a6775ba 100644 --- a/core/src/main/java/org/apache/struts2/views/xslt/SimpleAdapterDocument.java +++ b/core/src/main/java/org/apache/struts2/views/xslt/SimpleAdapterDocument.java @@ -1,19 +1,22 @@ /* * $Id$ * - * Copyright 2006 The Apache Software Foundation. + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at + * http://www.apache.org/licenses/LICENSE-2.0 * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. */ package org.apache.struts2.views.xslt; diff --git a/core/src/main/java/org/apache/struts2/views/xslt/SimpleNodeList.java b/core/src/main/java/org/apache/struts2/views/xslt/SimpleNodeList.java index ba4993159..845db5a9d 100644 --- a/core/src/main/java/org/apache/struts2/views/xslt/SimpleNodeList.java +++ b/core/src/main/java/org/apache/struts2/views/xslt/SimpleNodeList.java @@ -1,19 +1,22 @@ /* * $Id$ * - * Copyright 2006 The Apache Software Foundation. + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at + * http://www.apache.org/licenses/LICENSE-2.0 * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. */ package org.apache.struts2.views.xslt; diff --git a/core/src/main/java/org/apache/struts2/views/xslt/SimpleTextNode.java b/core/src/main/java/org/apache/struts2/views/xslt/SimpleTextNode.java index 152d9332b..a19e491b8 100644 --- a/core/src/main/java/org/apache/struts2/views/xslt/SimpleTextNode.java +++ b/core/src/main/java/org/apache/struts2/views/xslt/SimpleTextNode.java @@ -1,19 +1,22 @@ /* * $Id$ * - * Copyright 2006 The Apache Software Foundation. + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at + * http://www.apache.org/licenses/LICENSE-2.0 * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. */ package org.apache.struts2.views.xslt; @@ -24,7 +27,7 @@ import org.w3c.dom.Text; /** - * + * */ public class SimpleTextNode extends AbstractAdapterNode implements Node, Text { diff --git a/core/src/main/java/org/apache/struts2/views/xslt/StringAdapter.java b/core/src/main/java/org/apache/struts2/views/xslt/StringAdapter.java index fe3a5eb52..13497b773 100644 --- a/core/src/main/java/org/apache/struts2/views/xslt/StringAdapter.java +++ b/core/src/main/java/org/apache/struts2/views/xslt/StringAdapter.java @@ -1,19 +1,22 @@ /* * $Id$ * - * Copyright 2006 The Apache Software Foundation. + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at + * http://www.apache.org/licenses/LICENSE-2.0 * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. */ package org.apache.struts2.views.xslt; diff --git a/core/src/main/java/org/apache/struts2/views/xslt/XSLTResult.java b/core/src/main/java/org/apache/struts2/views/xslt/XSLTResult.java index b0ee149cb..be0cb241f 100644 --- a/core/src/main/java/org/apache/struts2/views/xslt/XSLTResult.java +++ b/core/src/main/java/org/apache/struts2/views/xslt/XSLTResult.java @@ -1,19 +1,22 @@ /* * $Id$ * - * Copyright 2006 The Apache Software Foundation. + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at + * http://www.apache.org/licenses/LICENSE-2.0 * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. */ package org.apache.struts2.views.xslt; @@ -51,7 +54,7 @@ import com.opensymphony.xwork2.util.ValueStack; /** * * - * XSLTResult uses XSLT to transform action object to XML. Recent version has + * XSLTResult uses XSLT to transform action object to XML. Recent version has * been specifically modified to deal with Xalan flaws. When using Xalan you may * notice that even though you have very minimal stylesheet like this one *
    @@ -70,7 +73,7 @@ import com.opensymphony.xwork2.util.ValueStack;
      * them all. It's becouse current Xalan eagerly and extensively converts
      * everything to it's internal DTM model before further processing.
      * 

    - * + * *

    * Thet's why there's a loop eliminator added that works by indexing every * object-property combination during processing. If it notices that some @@ -112,7 +115,7 @@ import com.opensymphony.xwork2.util.ValueStack; * Sometimes the object mesh is still very dense and you may notice that even * though you have relatively simple stylesheet execution takes a tremendous * amount of time. To help you to deal with that obstacle of Xalan you may - * attach regexp filters to elements paths (xpath). + * attach regexp filters to elements paths (xpath). *

    * *

    @@ -155,7 +158,7 @@ import com.opensymphony.xwork2.util.ValueStack; * *

  • location (default) - the location to go to after execution.
  • * - *
  • parse - true by default. If set to false, the location param will + *
  • parse - true by default. If set to false, the location param will * not be parsed for Ognl expressions.
  • * *
  • matchingPattern - Pattern that matches only desired elements, by @@ -201,10 +204,10 @@ public class XSLTResult implements Result { templatesCache = new HashMap(); noCache = Settings.get("struts.xslt.nocache").trim().equalsIgnoreCase("true"); } - + public XSLTResult(String stylesheetLocation) { - this(); - setStylesheetLocation(stylesheetLocation); + this(); + setStylesheetLocation(stylesheetLocation); } /** @@ -343,5 +346,5 @@ public class XSLTResult implements Result { protected Source getDOMSourceForStack(Object action) throws IllegalAccessException, InstantiationException { return new DOMSource(getAdapterFactory().adaptDocument("result", action) ); - } + } } diff --git a/core/src/test/java/org/apache/struts2/ExecutionCountTestAction.java b/core/src/test/java/org/apache/struts2/ExecutionCountTestAction.java index 7b4b8f7fb..9665b64ae 100644 --- a/core/src/test/java/org/apache/struts2/ExecutionCountTestAction.java +++ b/core/src/test/java/org/apache/struts2/ExecutionCountTestAction.java @@ -1,19 +1,22 @@ /* * $Id$ * - * Copyright 2006 The Apache Software Foundation. + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at + * http://www.apache.org/licenses/LICENSE-2.0 * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. */ package org.apache.struts2; @@ -28,10 +31,10 @@ import com.opensymphony.xwork2.ActionSupport; */ public class ExecutionCountTestAction extends ActionSupport { - private static final long serialVersionUID = -2954211394678430609L; + private static final long serialVersionUID = -2954211394678430609L; - private static final Log LOG = LogFactory.getLog(ExecutionCountTestAction.class); + private static final Log LOG = LogFactory.getLog(ExecutionCountTestAction.class); private int executionCount = 0; diff --git a/core/src/test/java/org/apache/struts2/RequestUtilsTest.java b/core/src/test/java/org/apache/struts2/RequestUtilsTest.java index 6ab4480de..df6063cb3 100644 --- a/core/src/test/java/org/apache/struts2/RequestUtilsTest.java +++ b/core/src/test/java/org/apache/struts2/RequestUtilsTest.java @@ -1,19 +1,22 @@ /* * $Id$ * - * Copyright 2006 The Apache Software Foundation. + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at + * http://www.apache.org/licenses/LICENSE-2.0 * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. */ package org.apache.struts2; diff --git a/core/src/test/java/org/apache/struts2/ServletActionContextTest.java b/core/src/test/java/org/apache/struts2/ServletActionContextTest.java index d3f1b90fc..812d9aeab 100644 --- a/core/src/test/java/org/apache/struts2/ServletActionContextTest.java +++ b/core/src/test/java/org/apache/struts2/ServletActionContextTest.java @@ -1,19 +1,22 @@ /* * $Id$ * - * Copyright 2006 The Apache Software Foundation. + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at + * http://www.apache.org/licenses/LICENSE-2.0 * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. */ package org.apache.struts2; diff --git a/core/src/test/java/org/apache/struts2/TestAction.java b/core/src/test/java/org/apache/struts2/TestAction.java index ac4394397..c672c4474 100644 --- a/core/src/test/java/org/apache/struts2/TestAction.java +++ b/core/src/test/java/org/apache/struts2/TestAction.java @@ -1,19 +1,22 @@ /* * $Id$ * - * Copyright 2006 The Apache Software Foundation. + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at + * http://www.apache.org/licenses/LICENSE-2.0 * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. */ package org.apache.struts2; @@ -31,9 +34,9 @@ import com.opensymphony.xwork2.ActionSupport; */ public class TestAction extends ActionSupport { - private static final long serialVersionUID = -8891365561914451494L; - - private Collection collection; + private static final long serialVersionUID = -8891365561914451494L; + + private Collection collection; private Collection collection2; private Map map; private String foo; @@ -109,21 +112,21 @@ public class TestAction extends ActionSupport { } public void setList3(List list) { - this.list3 = list; + this.list3 = list; } - + public List getList3() { - return this.list3; + return this.list3; } - + public Collection getCollection2() { - return this.collection2; + return this.collection2; } - + public void setCollection2(Collection collection) { - this.collection2 = collection; + this.collection2 = collection; } - + public String execute() throws Exception { if (result == null) { result = Action.SUCCESS; @@ -135,5 +138,5 @@ public class TestAction extends ActionSupport { public String doInput() throws Exception { return INPUT; } - + } diff --git a/core/src/test/java/org/apache/struts2/TestActionTagResult.java b/core/src/test/java/org/apache/struts2/TestActionTagResult.java index b5bbe7c3b..d38e77598 100644 --- a/core/src/test/java/org/apache/struts2/TestActionTagResult.java +++ b/core/src/test/java/org/apache/struts2/TestActionTagResult.java @@ -1,19 +1,22 @@ /* * $Id$ * - * Copyright 2006 The Apache Software Foundation. + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at + * http://www.apache.org/licenses/LICENSE-2.0 * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. */ package org.apache.struts2; @@ -22,19 +25,19 @@ import com.opensymphony.xwork2.Result; public class TestActionTagResult implements Result { - private static final long serialVersionUID = 5245516954875657626L; - - private boolean _isExecuted; - - public void execute(ActionInvocation invocation) throws Exception { - _isExecuted = true; - } - - public boolean isExecuted() { - return _isExecuted; - } + private static final long serialVersionUID = 5245516954875657626L; - public void reset() { - _isExecuted = false; - } + private boolean _isExecuted; + + public void execute(ActionInvocation invocation) throws Exception { + _isExecuted = true; + } + + public boolean isExecuted() { + return _isExecuted; + } + + public void reset() { + _isExecuted = false; + } } diff --git a/core/src/test/java/org/apache/struts2/TestConfigurationProvider.java b/core/src/test/java/org/apache/struts2/TestConfigurationProvider.java index d3a4aae26..a641711f2 100644 --- a/core/src/test/java/org/apache/struts2/TestConfigurationProvider.java +++ b/core/src/test/java/org/apache/struts2/TestConfigurationProvider.java @@ -1,19 +1,22 @@ /* * $Id$ * - * Copyright 2006 The Apache Software Foundation. + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at + * http://www.apache.org/licenses/LICENSE-2.0 * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. */ package org.apache.struts2; diff --git a/core/src/test/java/org/apache/struts2/TestResult.java b/core/src/test/java/org/apache/struts2/TestResult.java index fb7e23183..538a288fc 100644 --- a/core/src/test/java/org/apache/struts2/TestResult.java +++ b/core/src/test/java/org/apache/struts2/TestResult.java @@ -1,19 +1,22 @@ /* * $Id$ * - * Copyright 2006 The Apache Software Foundation. + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at + * http://www.apache.org/licenses/LICENSE-2.0 * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. */ package org.apache.struts2; @@ -37,10 +40,10 @@ import com.opensymphony.xwork2.util.ValueStack; */ public class TestResult implements Result { - private static final long serialVersionUID = -4429258122011663164L; + private static final long serialVersionUID = -4429258122011663164L; - private static final Log LOG = LogFactory.getLog(TestResult.class); + private static final Log LOG = LogFactory.getLog(TestResult.class); private List expectedValues = new ArrayList(); diff --git a/core/src/test/java/org/apache/struts2/components/ComponentTest.java b/core/src/test/java/org/apache/struts2/components/ComponentTest.java index e911c7133..a4b207926 100644 --- a/core/src/test/java/org/apache/struts2/components/ComponentTest.java +++ b/core/src/test/java/org/apache/struts2/components/ComponentTest.java @@ -1,19 +1,22 @@ /* * $Id$ * - * Copyright 2006 The Apache Software Foundation. + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at + * http://www.apache.org/licenses/LICENSE-2.0 * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. */ package org.apache.struts2.components; @@ -46,462 +49,462 @@ import com.opensymphony.xwork2.util.LocalizedTextUtil; /** * Test case for method findAncestor(Class) in Component and some commons * test cases for Component in general. - * + * */ public class ComponentTest extends AbstractTagTest { - public void testFindAncestorTest() throws Exception { - Property property = new Property(stack); - Form form = new Form(stack, request, response); - ActionComponent actionComponent = new ActionComponent(stack, request, response); - Anchor anchor = new Anchor(stack, request, response); - Form form2 = new Form(stack, request, response); - TextField textField = new TextField(stack, request, response); - - - Stack stack = property.getComponentStack(); - Iterator i = stack.iterator(); + public void testFindAncestorTest() throws Exception { + Property property = new Property(stack); + Form form = new Form(stack, request, response); + ActionComponent actionComponent = new ActionComponent(stack, request, response); + Anchor anchor = new Anchor(stack, request, response); + Form form2 = new Form(stack, request, response); + TextField textField = new TextField(stack, request, response); - - try { - // component stack - assertEquals(property.getComponentStack().size(), 6); - assertEquals(i.next(), property); - assertEquals(i.next(), form); - assertEquals(i.next(), actionComponent); - assertEquals(i.next(), anchor); - assertEquals(i.next(), form2); - assertEquals(i.next(), textField); - - - // property - assertNull(property.findAncestor(Component.class)); - - // form - assertEquals(form.findAncestor(Component.class), property); - assertEquals(form.findAncestor(Property.class), property); - - // action - assertEquals(actionComponent.findAncestor(Component.class), form); - assertEquals(actionComponent.findAncestor(Property.class), property); - assertEquals(actionComponent.findAncestor(Form.class), form); - - // anchor - assertEquals(anchor.findAncestor(Component.class), actionComponent); - assertEquals(anchor.findAncestor(ActionComponent.class), actionComponent); - assertEquals(anchor.findAncestor(Form.class), form); - assertEquals(anchor.findAncestor(Property.class), property); - - // form2 - assertEquals(form2.findAncestor(Component.class), anchor); - assertEquals(form2.findAncestor(Anchor.class), anchor); - assertEquals(form2.findAncestor(ActionComponent.class), actionComponent); - assertEquals(form2.findAncestor(Form.class), form); - assertEquals(form2.findAncestor(Property.class), property); - - // textField - assertEquals(textField.findAncestor(Component.class), form2); - assertEquals(textField.findAncestor(Form.class), form2); - assertEquals(textField.findAncestor(Anchor.class), anchor); - assertEquals(textField.findAncestor(ActionComponent.class), actionComponent); - assertEquals(textField.findAncestor(Property.class), property); - } - finally { - property.getComponentStack().pop(); - property.getComponentStack().pop(); - property.getComponentStack().pop(); - property.getComponentStack().pop(); - property.getComponentStack().pop(); - } + + Stack stack = property.getComponentStack(); + Iterator i = stack.iterator(); + + + try { + // component stack + assertEquals(property.getComponentStack().size(), 6); + assertEquals(i.next(), property); + assertEquals(i.next(), form); + assertEquals(i.next(), actionComponent); + assertEquals(i.next(), anchor); + assertEquals(i.next(), form2); + assertEquals(i.next(), textField); + + + // property + assertNull(property.findAncestor(Component.class)); + + // form + assertEquals(form.findAncestor(Component.class), property); + assertEquals(form.findAncestor(Property.class), property); + + // action + assertEquals(actionComponent.findAncestor(Component.class), form); + assertEquals(actionComponent.findAncestor(Property.class), property); + assertEquals(actionComponent.findAncestor(Form.class), form); + + // anchor + assertEquals(anchor.findAncestor(Component.class), actionComponent); + assertEquals(anchor.findAncestor(ActionComponent.class), actionComponent); + assertEquals(anchor.findAncestor(Form.class), form); + assertEquals(anchor.findAncestor(Property.class), property); + + // form2 + assertEquals(form2.findAncestor(Component.class), anchor); + assertEquals(form2.findAncestor(Anchor.class), anchor); + assertEquals(form2.findAncestor(ActionComponent.class), actionComponent); + assertEquals(form2.findAncestor(Form.class), form); + assertEquals(form2.findAncestor(Property.class), property); + + // textField + assertEquals(textField.findAncestor(Component.class), form2); + assertEquals(textField.findAncestor(Form.class), form2); + assertEquals(textField.findAncestor(Anchor.class), anchor); + assertEquals(textField.findAncestor(ActionComponent.class), actionComponent); + assertEquals(textField.findAncestor(Property.class), property); + } + finally { + property.getComponentStack().pop(); + property.getComponentStack().pop(); + property.getComponentStack().pop(); + property.getComponentStack().pop(); + property.getComponentStack().pop(); + } } - - // Action Component - /* - public void testActionComponentDisposeItselfFromComponentStack() throws Exception { - ConfigurationManager.clearConfigurationProviders(); + + // Action Component + /* + public void testActionComponentDisposeItselfFromComponentStack() throws Exception { + ConfigurationManager.clearConfigurationProviders(); ConfigurationManager.addConfigurationProvider(new TestConfigurationProvider()); ConfigurationManager.getConfiguration().reload(); ActionContext actionContext = new ActionContext(context); actionContext.setValueStack(stack); ActionContext.setContext(actionContext); - - request.setupGetServletPath(TestConfigurationProvider.TEST_NAMESPACE + "/" + "foo.action"); - try { - TextFieldTag t = new TextFieldTag(); - t.setName("textFieldName"); - t.setPageContext(pageContext); - t.doStartTag(); - - ActionTag tag = new ActionTag(); - tag.setPageContext(pageContext); - tag.setName(TestConfigurationProvider.TEST_NAMESPACE_ACTION); - tag.setId(TestConfigurationProvider.TEST_NAMESPACE_ACTION); - tag.doStartTag(); - assertEquals(tag.getComponent().getComponentStack().peek(), tag.getComponent()); - tag.doEndTag(); - assertEquals(t.getComponent().getComponentStack().peek(), t.getComponent()); - - t.doEndTag(); - } - catch(Exception e) { - e.printStackTrace(); - fail(e.toString()); - } - } - */ - - - // AppendInterator - public void testAppendIteratorDisposeItselfFromComponentStack() throws Exception { - TextFieldTag t = new TextFieldTag(); - t.setPageContext(pageContext); - t.setName("textFieldName"); - - AppendIteratorTag tag = new AppendIteratorTag(); - tag.setPageContext(pageContext); - - try { - t.doStartTag(); - tag.doStartTag(); - assertEquals(tag.getComponent().getComponentStack().peek(), tag.getComponent()); - tag.doEndTag(); - assertEquals(t.getComponent().getComponentStack().peek(), t.getComponent()); - t.doEndTag(); - } - catch(Exception e) { - e.printStackTrace(); - fail(e.toString()); - } - } - - - // Bean - public void testBeanComponentDisposeItselfFromComponentStack() throws Exception { - TextFieldTag t = new TextFieldTag(); - t.setPageContext(pageContext); - t.setName("textFieldName"); - - BeanTag tag = new BeanTag(); - tag.setName("org.apache.struts2.util.Counter"); - tag.setPageContext(pageContext); - - try { - t.doStartTag(); - tag.doStartTag(); - assertEquals(tag.getComponent().getComponentStack().peek(), tag.getComponent()); - tag.doEndTag(); - assertEquals(t.getComponent().getComponentStack().peek(), t.getComponent()); - t.doEndTag(); - } - catch(Exception e) { - e.printStackTrace(); - fail(); - } - } - - - // ElseIf - public void testElseIfComponentDisposeItselfFromComponentStack() throws Exception { - TextFieldTag t = new TextFieldTag(); - t.setPageContext(pageContext); - t.setName("textFieldName"); - - ElseIfTag tag = new ElseIfTag(); - tag.setPageContext(pageContext); - - try { - t.doStartTag(); - tag.doStartTag(); - assertEquals(tag.getComponent().getComponentStack().peek(), tag.getComponent()); - tag.doEndTag(); - assertEquals(t.getComponent().getComponentStack().peek(), t.getComponent()); - t.doEndTag(); - } - catch(Exception e) { - e.printStackTrace(); - fail(e.toString()); - } - } - - - // Else - public void testElseComponentDisposeItselfFromComponentStack() throws Exception { - TextFieldTag t = new TextFieldTag(); - t.setPageContext(pageContext); - t.setName("textFieldName"); - - ElseTag tag = new ElseTag(); - tag.setPageContext(pageContext); - - try { - t.doStartTag(); - tag.doStartTag(); - assertEquals(tag.getComponent().getComponentStack().peek(), tag.getComponent()); - tag.doEndTag(); - assertEquals(t.getComponent().getComponentStack().peek(), t.getComponent()); - t.doEndTag(); - } - catch(Exception e) { - e.printStackTrace(); - fail(e.toString()); - } - } - - - // If - public void testIfComponentDisposeItselfFromComponentStack() throws Exception { - TextFieldTag t = new TextFieldTag(); - t.setPageContext(pageContext); - t.setName("textFieldName"); - - IfTag tag = new IfTag(); - tag.setTest("false"); - tag.setPageContext(pageContext); - - try { - t.doStartTag(); - tag.doStartTag(); - assertEquals(tag.getComponent().getComponentStack().peek(), tag.getComponent()); - tag.doEndTag(); - assertEquals(t.getComponent().getComponentStack().peek(), t.getComponent()); - t.doEndTag(); - } - catch(Exception e) { - e.printStackTrace(); - fail(e.toString()); - } - } - - - // Iterator - public void testIteratorComponentDisposeItselfFromComponentStack() throws Exception { - TextFieldTag t = new TextFieldTag(); - t.setPageContext(pageContext); - t.setName("textFieldName"); - - IteratorTag tag = new IteratorTag(); - tag.setValue("{1,2}"); - tag.setPageContext(pageContext); - - try { - t.doStartTag(); - tag.doStartTag(); - assertEquals(tag.getComponent().getComponentStack().peek(), tag.getComponent()); - int endIt = tag.doAfterBody(); - while(TagSupport.EVAL_BODY_AGAIN == endIt) { - assertEquals(tag.getComponent().getComponentStack().peek(), tag.getComponent()); - endIt = tag.doAfterBody(); - } - tag.doEndTag(); - assertEquals(t.getComponent().getComponentStack().peek(), t.getComponent()); - t.doEndTag(); - } - catch(Exception e) { - e.printStackTrace(); - fail(e.toString()); - } - } - - - // MergeIterator - public void testMergeIteratorComponentDisposeItselfFromComponentStack() throws Exception { - TextFieldTag t = new TextFieldTag(); - t.setPageContext(pageContext); - t.setName("textFieldName"); - - MergeIteratorTag tag = new MergeIteratorTag(); - tag.setPageContext(pageContext); - - try { - t.doStartTag(); - tag.doStartTag(); - assertEquals(tag.getComponent().getComponentStack().peek(), tag.getComponent()); - tag.doEndTag(); - assertEquals(t.getComponent().getComponentStack().peek(), t.getComponent()); - t.doEndTag(); - } - catch(Exception e) { - e.printStackTrace(); - fail(e.toString()); - } - } - - - // Property - public void testPropertyComponentDisposeItselfFromComponentStack() throws Exception { - TextFieldTag t = new TextFieldTag(); - t.setPageContext(pageContext); - t.setName("textFieldName"); - - PropertyTag tag = new PropertyTag(); - tag.setPageContext(pageContext); - - try { - t.doStartTag(); - tag.doStartTag(); - assertEquals(tag.getComponent().getComponentStack().peek(), tag.getComponent()); - tag.doEndTag(); - assertEquals(t.getComponent().getComponentStack().peek(), t.getComponent()); - t.doEndTag(); - } - catch(Exception e) { - e.printStackTrace(); - fail(e.toString()); - } - } - - - // Push - public void testPushComponentDisposeItselfFromComponentStack() throws Exception { - TextFieldTag t = new TextFieldTag(); - t.setPageContext(pageContext); - t.setName("textFieldName"); - - PushTag tag = new PushTag(); - tag.setValue("'aaaa'"); - tag.setPageContext(pageContext); - - try { - t.doStartTag(); - tag.doStartTag(); - assertEquals(tag.getComponent().getComponentStack().peek(), tag.getComponent()); - tag.doEndTag(); - assertEquals(t.getComponent().getComponentStack().peek(), t.getComponent()); - t.doEndTag(); - } - catch(Exception e) { - e.printStackTrace(); - fail(e.toString()); - } - } - - - // Set - public void testSetComponentDisposeItselfFromComponentStack() throws Exception { - TextFieldTag t = new TextFieldTag(); - t.setPageContext(pageContext); - t.setName("textFieldName"); - - SetTag tag = new SetTag(); - tag.setName("name"); - tag.setValue("'value'"); - tag.setPageContext(pageContext); - - try { - t.doStartTag(); - tag.doStartTag(); - assertEquals(tag.getComponent().getComponentStack().peek(), tag.getComponent()); - tag.doEndTag(); - assertEquals(t.getComponent().getComponentStack().peek(), t.getComponent()); - t.doEndTag(); - } - catch(Exception e) { - e.printStackTrace(); - fail(e.toString()); - } - } - - - // Text - public void testTextComponentDisposeItselfFromComponentStack() throws Exception { - TextFieldTag t = new TextFieldTag(); - t.setPageContext(pageContext); - t.setName("textFieldName"); - - TextTag tag = new TextTag(); - tag.setName("some.i18n.key"); - tag.setPageContext(pageContext); - - try { - t.doStartTag(); - tag.doStartTag(); - assertEquals(tag.getComponent().getComponentStack().peek(), tag.getComponent()); - tag.doEndTag(); - assertEquals(t.getComponent().getComponentStack().peek(), t.getComponent()); - t.doEndTag(); - } - catch(Exception e) { - e.printStackTrace(); - fail(e.toString()); - } - } - - - public void testI18nComponentDisposeItselfFromComponentStack() throws Exception { - stack.getContext().put(ActionContext.LOCALE, Locale.getDefault()); - - TextFieldTag t = new TextFieldTag(); - t.setPageContext(pageContext); - t.setName("textFieldName"); - - LocalizedTextUtil.addDefaultResourceBundle("org.apache.struts2.components.temp"); - - I18nTag tag = new I18nTag(); - tag.setName("org.apache.struts2.components.tempo"); - tag.setPageContext(pageContext); - - try { - t.doStartTag(); - tag.doStartTag(); - assertEquals(tag.getComponent().getComponentStack().peek(), tag.getComponent()); - tag.doEndTag(); - assertEquals(t.getComponent().getComponentStack().peek(), t.getComponent()); - t.doEndTag(); - } - catch(Exception e) { - e.printStackTrace(); - fail(e.toString()); - } - } - - // URL - public void testURLComponentDisposeItselfFromComponentStack() throws Exception { - TextFieldTag t = new TextFieldTag(); - t.setPageContext(pageContext); - t.setName("textFieldName"); - - URLTag tag = new URLTag(); - tag.setPageContext(pageContext); - - try { - t.doStartTag(); - tag.doStartTag(); - assertEquals(tag.getComponent().getComponentStack().peek(), tag.getComponent()); - tag.doEndTag(); - assertEquals(t.getComponent().getComponentStack().peek(), t.getComponent()); - t.doEndTag(); - } - catch(Exception e) { - e.printStackTrace(); - fail(e.toString()); - } - } - - - // updownselect - public void testUpDownSelectDisposeItselfFromComponentStack() throws Exception { - TextFieldTag t = new TextFieldTag(); - t.setPageContext(pageContext); - t.setName("textFieldName"); - - UpDownSelectTag tag = new UpDownSelectTag(); - tag.setId("myId"); - tag.setPageContext(pageContext); - tag.setName("updownselectName"); - tag.setList("{}"); - - try { - t.doStartTag(); - tag.doStartTag(); - assertEquals(tag.getComponent().getComponentStack().peek(), tag.getComponent()); - tag.doEndTag(); - assertEquals(t.getComponent().getComponentStack().peek(), t.getComponent()); - t.doEndTag(); - } - catch(Exception e) { - e.printStackTrace(); - fail(e.toString()); - } - } + + request.setupGetServletPath(TestConfigurationProvider.TEST_NAMESPACE + "/" + "foo.action"); + try { + TextFieldTag t = new TextFieldTag(); + t.setName("textFieldName"); + t.setPageContext(pageContext); + t.doStartTag(); + + ActionTag tag = new ActionTag(); + tag.setPageContext(pageContext); + tag.setName(TestConfigurationProvider.TEST_NAMESPACE_ACTION); + tag.setId(TestConfigurationProvider.TEST_NAMESPACE_ACTION); + tag.doStartTag(); + assertEquals(tag.getComponent().getComponentStack().peek(), tag.getComponent()); + tag.doEndTag(); + assertEquals(t.getComponent().getComponentStack().peek(), t.getComponent()); + + t.doEndTag(); + } + catch(Exception e) { + e.printStackTrace(); + fail(e.toString()); + } + } + */ + + + // AppendInterator + public void testAppendIteratorDisposeItselfFromComponentStack() throws Exception { + TextFieldTag t = new TextFieldTag(); + t.setPageContext(pageContext); + t.setName("textFieldName"); + + AppendIteratorTag tag = new AppendIteratorTag(); + tag.setPageContext(pageContext); + + try { + t.doStartTag(); + tag.doStartTag(); + assertEquals(tag.getComponent().getComponentStack().peek(), tag.getComponent()); + tag.doEndTag(); + assertEquals(t.getComponent().getComponentStack().peek(), t.getComponent()); + t.doEndTag(); + } + catch(Exception e) { + e.printStackTrace(); + fail(e.toString()); + } + } + + + // Bean + public void testBeanComponentDisposeItselfFromComponentStack() throws Exception { + TextFieldTag t = new TextFieldTag(); + t.setPageContext(pageContext); + t.setName("textFieldName"); + + BeanTag tag = new BeanTag(); + tag.setName("org.apache.struts2.util.Counter"); + tag.setPageContext(pageContext); + + try { + t.doStartTag(); + tag.doStartTag(); + assertEquals(tag.getComponent().getComponentStack().peek(), tag.getComponent()); + tag.doEndTag(); + assertEquals(t.getComponent().getComponentStack().peek(), t.getComponent()); + t.doEndTag(); + } + catch(Exception e) { + e.printStackTrace(); + fail(); + } + } + + + // ElseIf + public void testElseIfComponentDisposeItselfFromComponentStack() throws Exception { + TextFieldTag t = new TextFieldTag(); + t.setPageContext(pageContext); + t.setName("textFieldName"); + + ElseIfTag tag = new ElseIfTag(); + tag.setPageContext(pageContext); + + try { + t.doStartTag(); + tag.doStartTag(); + assertEquals(tag.getComponent().getComponentStack().peek(), tag.getComponent()); + tag.doEndTag(); + assertEquals(t.getComponent().getComponentStack().peek(), t.getComponent()); + t.doEndTag(); + } + catch(Exception e) { + e.printStackTrace(); + fail(e.toString()); + } + } + + + // Else + public void testElseComponentDisposeItselfFromComponentStack() throws Exception { + TextFieldTag t = new TextFieldTag(); + t.setPageContext(pageContext); + t.setName("textFieldName"); + + ElseTag tag = new ElseTag(); + tag.setPageContext(pageContext); + + try { + t.doStartTag(); + tag.doStartTag(); + assertEquals(tag.getComponent().getComponentStack().peek(), tag.getComponent()); + tag.doEndTag(); + assertEquals(t.getComponent().getComponentStack().peek(), t.getComponent()); + t.doEndTag(); + } + catch(Exception e) { + e.printStackTrace(); + fail(e.toString()); + } + } + + + // If + public void testIfComponentDisposeItselfFromComponentStack() throws Exception { + TextFieldTag t = new TextFieldTag(); + t.setPageContext(pageContext); + t.setName("textFieldName"); + + IfTag tag = new IfTag(); + tag.setTest("false"); + tag.setPageContext(pageContext); + + try { + t.doStartTag(); + tag.doStartTag(); + assertEquals(tag.getComponent().getComponentStack().peek(), tag.getComponent()); + tag.doEndTag(); + assertEquals(t.getComponent().getComponentStack().peek(), t.getComponent()); + t.doEndTag(); + } + catch(Exception e) { + e.printStackTrace(); + fail(e.toString()); + } + } + + + // Iterator + public void testIteratorComponentDisposeItselfFromComponentStack() throws Exception { + TextFieldTag t = new TextFieldTag(); + t.setPageContext(pageContext); + t.setName("textFieldName"); + + IteratorTag tag = new IteratorTag(); + tag.setValue("{1,2}"); + tag.setPageContext(pageContext); + + try { + t.doStartTag(); + tag.doStartTag(); + assertEquals(tag.getComponent().getComponentStack().peek(), tag.getComponent()); + int endIt = tag.doAfterBody(); + while(TagSupport.EVAL_BODY_AGAIN == endIt) { + assertEquals(tag.getComponent().getComponentStack().peek(), tag.getComponent()); + endIt = tag.doAfterBody(); + } + tag.doEndTag(); + assertEquals(t.getComponent().getComponentStack().peek(), t.getComponent()); + t.doEndTag(); + } + catch(Exception e) { + e.printStackTrace(); + fail(e.toString()); + } + } + + + // MergeIterator + public void testMergeIteratorComponentDisposeItselfFromComponentStack() throws Exception { + TextFieldTag t = new TextFieldTag(); + t.setPageContext(pageContext); + t.setName("textFieldName"); + + MergeIteratorTag tag = new MergeIteratorTag(); + tag.setPageContext(pageContext); + + try { + t.doStartTag(); + tag.doStartTag(); + assertEquals(tag.getComponent().getComponentStack().peek(), tag.getComponent()); + tag.doEndTag(); + assertEquals(t.getComponent().getComponentStack().peek(), t.getComponent()); + t.doEndTag(); + } + catch(Exception e) { + e.printStackTrace(); + fail(e.toString()); + } + } + + + // Property + public void testPropertyComponentDisposeItselfFromComponentStack() throws Exception { + TextFieldTag t = new TextFieldTag(); + t.setPageContext(pageContext); + t.setName("textFieldName"); + + PropertyTag tag = new PropertyTag(); + tag.setPageContext(pageContext); + + try { + t.doStartTag(); + tag.doStartTag(); + assertEquals(tag.getComponent().getComponentStack().peek(), tag.getComponent()); + tag.doEndTag(); + assertEquals(t.getComponent().getComponentStack().peek(), t.getComponent()); + t.doEndTag(); + } + catch(Exception e) { + e.printStackTrace(); + fail(e.toString()); + } + } + + + // Push + public void testPushComponentDisposeItselfFromComponentStack() throws Exception { + TextFieldTag t = new TextFieldTag(); + t.setPageContext(pageContext); + t.setName("textFieldName"); + + PushTag tag = new PushTag(); + tag.setValue("'aaaa'"); + tag.setPageContext(pageContext); + + try { + t.doStartTag(); + tag.doStartTag(); + assertEquals(tag.getComponent().getComponentStack().peek(), tag.getComponent()); + tag.doEndTag(); + assertEquals(t.getComponent().getComponentStack().peek(), t.getComponent()); + t.doEndTag(); + } + catch(Exception e) { + e.printStackTrace(); + fail(e.toString()); + } + } + + + // Set + public void testSetComponentDisposeItselfFromComponentStack() throws Exception { + TextFieldTag t = new TextFieldTag(); + t.setPageContext(pageContext); + t.setName("textFieldName"); + + SetTag tag = new SetTag(); + tag.setName("name"); + tag.setValue("'value'"); + tag.setPageContext(pageContext); + + try { + t.doStartTag(); + tag.doStartTag(); + assertEquals(tag.getComponent().getComponentStack().peek(), tag.getComponent()); + tag.doEndTag(); + assertEquals(t.getComponent().getComponentStack().peek(), t.getComponent()); + t.doEndTag(); + } + catch(Exception e) { + e.printStackTrace(); + fail(e.toString()); + } + } + + + // Text + public void testTextComponentDisposeItselfFromComponentStack() throws Exception { + TextFieldTag t = new TextFieldTag(); + t.setPageContext(pageContext); + t.setName("textFieldName"); + + TextTag tag = new TextTag(); + tag.setName("some.i18n.key"); + tag.setPageContext(pageContext); + + try { + t.doStartTag(); + tag.doStartTag(); + assertEquals(tag.getComponent().getComponentStack().peek(), tag.getComponent()); + tag.doEndTag(); + assertEquals(t.getComponent().getComponentStack().peek(), t.getComponent()); + t.doEndTag(); + } + catch(Exception e) { + e.printStackTrace(); + fail(e.toString()); + } + } + + + public void testI18nComponentDisposeItselfFromComponentStack() throws Exception { + stack.getContext().put(ActionContext.LOCALE, Locale.getDefault()); + + TextFieldTag t = new TextFieldTag(); + t.setPageContext(pageContext); + t.setName("textFieldName"); + + LocalizedTextUtil.addDefaultResourceBundle("org.apache.struts2.components.temp"); + + I18nTag tag = new I18nTag(); + tag.setName("org.apache.struts2.components.tempo"); + tag.setPageContext(pageContext); + + try { + t.doStartTag(); + tag.doStartTag(); + assertEquals(tag.getComponent().getComponentStack().peek(), tag.getComponent()); + tag.doEndTag(); + assertEquals(t.getComponent().getComponentStack().peek(), t.getComponent()); + t.doEndTag(); + } + catch(Exception e) { + e.printStackTrace(); + fail(e.toString()); + } + } + + // URL + public void testURLComponentDisposeItselfFromComponentStack() throws Exception { + TextFieldTag t = new TextFieldTag(); + t.setPageContext(pageContext); + t.setName("textFieldName"); + + URLTag tag = new URLTag(); + tag.setPageContext(pageContext); + + try { + t.doStartTag(); + tag.doStartTag(); + assertEquals(tag.getComponent().getComponentStack().peek(), tag.getComponent()); + tag.doEndTag(); + assertEquals(t.getComponent().getComponentStack().peek(), t.getComponent()); + t.doEndTag(); + } + catch(Exception e) { + e.printStackTrace(); + fail(e.toString()); + } + } + + + // updownselect + public void testUpDownSelectDisposeItselfFromComponentStack() throws Exception { + TextFieldTag t = new TextFieldTag(); + t.setPageContext(pageContext); + t.setName("textFieldName"); + + UpDownSelectTag tag = new UpDownSelectTag(); + tag.setId("myId"); + tag.setPageContext(pageContext); + tag.setName("updownselectName"); + tag.setList("{}"); + + try { + t.doStartTag(); + tag.doStartTag(); + assertEquals(tag.getComponent().getComponentStack().peek(), tag.getComponent()); + tag.doEndTag(); + assertEquals(t.getComponent().getComponentStack().peek(), t.getComponent()); + t.doEndTag(); + } + catch(Exception e) { + e.printStackTrace(); + fail(e.toString()); + } + } } diff --git a/core/src/test/java/org/apache/struts2/components/FormButtonTest.java b/core/src/test/java/org/apache/struts2/components/FormButtonTest.java index 47f6a1f2a..5dde9fef4 100644 --- a/core/src/test/java/org/apache/struts2/components/FormButtonTest.java +++ b/core/src/test/java/org/apache/struts2/components/FormButtonTest.java @@ -1,19 +1,22 @@ /* * $Id$ * - * Copyright 2006 The Apache Software Foundation. + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at + * http://www.apache.org/licenses/LICENSE-2.0 * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. */ package org.apache.struts2.components; @@ -25,97 +28,97 @@ import com.opensymphony.xwork2.util.ValueStack; import com.opensymphony.xwork2.util.ValueStackFactory; /** - * + * * @version $Date$ $Id$ */ public class FormButtonTest extends StrutsTestCase { - - public void testPopulateComponentHtmlId1() throws Exception { - MockHttpServletRequest req = new MockHttpServletRequest(); - MockHttpServletResponse res = new MockHttpServletResponse(); - ValueStack stack = ValueStackFactory.getFactory().createValueStack(); - - Form form = new Form(stack, req, res); - form.getParameters().put("id", "formId"); - - Submit submit = new Submit(stack, req, res); - submit.setId("submitId"); - - submit.populateComponentHtmlId(form); - - assertEquals("submitId", submit.getParameters().get("id")); - } - - public void testPopulateComponentHtmlId2() throws Exception { - MockHttpServletRequest req = new MockHttpServletRequest(); - MockHttpServletResponse res = new MockHttpServletResponse(); - ValueStack stack = ValueStackFactory.getFactory().createValueStack(); - - Form form = new Form(stack, req, res); - form.getParameters().put("id", "formId"); - - Submit submit = new Submit(stack, req, res); - submit.setName("submitName"); - - submit.populateComponentHtmlId(form); - - assertEquals("formId_submitName", submit.getParameters().get("id")); - } - - public void testPopulateComponentHtmlId3() throws Exception { - MockHttpServletRequest req = new MockHttpServletRequest(); - MockHttpServletResponse res = new MockHttpServletResponse(); - ValueStack stack = ValueStackFactory.getFactory().createValueStack(); - - Form form = new Form(stack, req, res); - form.getParameters().put("id", "formId"); - - Submit submit = new Submit(stack, req, res); - submit.setAction("submitAction"); - submit.setMethod("submitMethod"); - - submit.populateComponentHtmlId(form); - - assertEquals("formId_submitAction_submitMethod", submit.getParameters().get("id")); - } - - public void testPopulateComponentHtmlId4() throws Exception { - MockHttpServletRequest req = new MockHttpServletRequest(); - MockHttpServletResponse res = new MockHttpServletResponse(); - ValueStack stack = ValueStackFactory.getFactory().createValueStack(); - - Submit submit = new Submit(stack, req, res); - submit.setId("submitId"); - - submit.populateComponentHtmlId(null); - - assertEquals("submitId", submit.getParameters().get("id")); - } - - public void testPopulateComponentHtmlId5() throws Exception { - MockHttpServletRequest req = new MockHttpServletRequest(); - MockHttpServletResponse res = new MockHttpServletResponse(); - ValueStack stack = ValueStackFactory.getFactory().createValueStack(); - - Submit submit = new Submit(stack, req, res); - submit.setName("submitName"); - - submit.populateComponentHtmlId(null); - - assertEquals("submitName", submit.getParameters().get("id")); - } - - public void testPopulateComponentHtmlId6() throws Exception { - MockHttpServletRequest req = new MockHttpServletRequest(); - MockHttpServletResponse res = new MockHttpServletResponse(); - ValueStack stack = ValueStackFactory.getFactory().createValueStack(); - - Submit submit = new Submit(stack, req, res); - submit.setAction("submitAction"); - submit.setMethod("submitMethod"); - - submit.populateComponentHtmlId(null); - - assertEquals("submitAction_submitMethod", submit.getParameters().get("id")); - } + + public void testPopulateComponentHtmlId1() throws Exception { + MockHttpServletRequest req = new MockHttpServletRequest(); + MockHttpServletResponse res = new MockHttpServletResponse(); + ValueStack stack = ValueStackFactory.getFactory().createValueStack(); + + Form form = new Form(stack, req, res); + form.getParameters().put("id", "formId"); + + Submit submit = new Submit(stack, req, res); + submit.setId("submitId"); + + submit.populateComponentHtmlId(form); + + assertEquals("submitId", submit.getParameters().get("id")); + } + + public void testPopulateComponentHtmlId2() throws Exception { + MockHttpServletRequest req = new MockHttpServletRequest(); + MockHttpServletResponse res = new MockHttpServletResponse(); + ValueStack stack = ValueStackFactory.getFactory().createValueStack(); + + Form form = new Form(stack, req, res); + form.getParameters().put("id", "formId"); + + Submit submit = new Submit(stack, req, res); + submit.setName("submitName"); + + submit.populateComponentHtmlId(form); + + assertEquals("formId_submitName", submit.getParameters().get("id")); + } + + public void testPopulateComponentHtmlId3() throws Exception { + MockHttpServletRequest req = new MockHttpServletRequest(); + MockHttpServletResponse res = new MockHttpServletResponse(); + ValueStack stack = ValueStackFactory.getFactory().createValueStack(); + + Form form = new Form(stack, req, res); + form.getParameters().put("id", "formId"); + + Submit submit = new Submit(stack, req, res); + submit.setAction("submitAction"); + submit.setMethod("submitMethod"); + + submit.populateComponentHtmlId(form); + + assertEquals("formId_submitAction_submitMethod", submit.getParameters().get("id")); + } + + public void testPopulateComponentHtmlId4() throws Exception { + MockHttpServletRequest req = new MockHttpServletRequest(); + MockHttpServletResponse res = new MockHttpServletResponse(); + ValueStack stack = ValueStackFactory.getFactory().createValueStack(); + + Submit submit = new Submit(stack, req, res); + submit.setId("submitId"); + + submit.populateComponentHtmlId(null); + + assertEquals("submitId", submit.getParameters().get("id")); + } + + public void testPopulateComponentHtmlId5() throws Exception { + MockHttpServletRequest req = new MockHttpServletRequest(); + MockHttpServletResponse res = new MockHttpServletResponse(); + ValueStack stack = ValueStackFactory.getFactory().createValueStack(); + + Submit submit = new Submit(stack, req, res); + submit.setName("submitName"); + + submit.populateComponentHtmlId(null); + + assertEquals("submitName", submit.getParameters().get("id")); + } + + public void testPopulateComponentHtmlId6() throws Exception { + MockHttpServletRequest req = new MockHttpServletRequest(); + MockHttpServletResponse res = new MockHttpServletResponse(); + ValueStack stack = ValueStackFactory.getFactory().createValueStack(); + + Submit submit = new Submit(stack, req, res); + submit.setAction("submitAction"); + submit.setMethod("submitMethod"); + + submit.populateComponentHtmlId(null); + + assertEquals("submitAction_submitMethod", submit.getParameters().get("id")); + } } diff --git a/core/src/test/java/org/apache/struts2/components/FormTest.java b/core/src/test/java/org/apache/struts2/components/FormTest.java index f39387e7f..95e50010a 100644 --- a/core/src/test/java/org/apache/struts2/components/FormTest.java +++ b/core/src/test/java/org/apache/struts2/components/FormTest.java @@ -1,19 +1,22 @@ /* * $Id$ * - * Copyright 2006 The Apache Software Foundation. + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at + * http://www.apache.org/licenses/LICENSE-2.0 * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. */ package org.apache.struts2.components; diff --git a/core/src/test/java/org/apache/struts2/components/PropertyTest.java b/core/src/test/java/org/apache/struts2/components/PropertyTest.java index 000f9b265..f6bb2b7f7 100644 --- a/core/src/test/java/org/apache/struts2/components/PropertyTest.java +++ b/core/src/test/java/org/apache/struts2/components/PropertyTest.java @@ -1,19 +1,22 @@ /* * $Id$ * - * Copyright 2006 The Apache Software Foundation. + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at + * http://www.apache.org/licenses/LICENSE-2.0 * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. */ package org.apache.struts2.components; @@ -28,7 +31,7 @@ import org.apache.struts2.util.StrutsTypeConverter; import com.opensymphony.xwork2.util.ValueStack; import com.opensymphony.xwork2.util.ValueStackFactory; import com.opensymphony.xwork2.util.XWorkConverter; - + /** * */ @@ -41,7 +44,7 @@ public class PropertyTest extends TestCase { property.setValue("foo"); assertPropertyOutput("foo-value", property); } - + public void testDefaultShouldBeOutputIfBeanNotAvailable() { final ValueStack stack = ValueStackFactory.getFactory().createValueStack(); final Property property = new Property(stack); @@ -49,7 +52,7 @@ public class PropertyTest extends TestCase { property.setValue("foo"); assertPropertyOutput("default", property); } - + public void testDefaultShouldBeOutputIfPropertyIsNull() { final ValueStack stack = ValueStackFactory.getFactory().createValueStack(); stack.push(new FooBar(null, "bar-value")); @@ -58,7 +61,7 @@ public class PropertyTest extends TestCase { property.setValue("foo"); assertPropertyOutput("default", property); } - + public void testTopValueShouldReturnTopOfValueStack() { final ValueStack stack = ValueStackFactory.getFactory().createValueStack(); stack.push(new FooBar("foo-value", "bar-value")); @@ -67,62 +70,62 @@ public class PropertyTest extends TestCase { property.setValue("top"); assertPropertyOutput("foo-value/bar-value", property); } - + public void testTypeConverterShouldBeUsed() { final ValueStack stack = ValueStackFactory.getFactory().createValueStack(); Ognl.setTypeConverter(stack.getContext(), new TestDefaultConverter()); - + stack.push(new FooBar("foo-value", "bar-value")); final Property property = new Property(stack); property.setDefault("default"); property.setValue("top"); assertPropertyOutput("*foo-value + bar-value*", property); } - + public void testTypeConverterReturningNullShouldLeadToDisplayOfDefaultValue() { final ValueStack stack = ValueStackFactory.getFactory().createValueStack(); Ognl.setTypeConverter(stack.getContext(), new TestDefaultConverter()); - + stack.push(new FooBar("foo-value", null)); final Property property = new Property(stack); property.setDefault("default"); property.setValue("top"); assertPropertyOutput("default", property); } - + private static void assertPropertyOutput(String expectedOutput, Property property) { final StringWriter out = new StringWriter(); assertTrue(property.start(out)); assertEquals(expectedOutput, out.getBuffer().toString()); } - + private final class FooBar { private String foo; private String bar; - + public FooBar(String foo, String bar) { this.foo = foo; this.bar = bar; } - + public String getFoo() { return foo; } - + public String getBar() { return bar; } - + public String toString() { return foo + "/" + bar; } } - + private final class FooBarConverter extends StrutsTypeConverter { public Object convertFromString(Map context, String[] values, Class toClass) { return null; } - + public String convertToString(Map context, Object o) { FooBar fooBar = (FooBar) o; if (fooBar.getBar() == null) { @@ -132,7 +135,7 @@ public class PropertyTest extends TestCase { } } } - + /** a simple hack to simply register a custom converter in our test */ private final class TestDefaultConverter extends XWorkConverter { protected TestDefaultConverter() { diff --git a/core/src/test/java/org/apache/struts2/components/UIBeanTest.java b/core/src/test/java/org/apache/struts2/components/UIBeanTest.java index 80d8ca4bc..20096c146 100644 --- a/core/src/test/java/org/apache/struts2/components/UIBeanTest.java +++ b/core/src/test/java/org/apache/struts2/components/UIBeanTest.java @@ -1,19 +1,22 @@ /* * $Id$ * - * Copyright 2006 The Apache Software Foundation. + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at + * http://www.apache.org/licenses/LICENSE-2.0 * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. */ package org.apache.struts2.components; @@ -25,40 +28,40 @@ import com.opensymphony.xwork2.util.ValueStack; import com.opensymphony.xwork2.util.ValueStackFactory; /** - * + * * @version $Date$ $Id$ */ public class UIBeanTest extends StrutsTestCase { - - public void testPopulateComponentHtmlId1() throws Exception { - ValueStack stack = ValueStackFactory.getFactory().createValueStack(); - MockHttpServletRequest req = new MockHttpServletRequest(); - MockHttpServletResponse res = new MockHttpServletResponse(); - - Form form = new Form(stack, req, res); - form.getParameters().put("id", "formId"); - - TextField txtFld = new TextField(stack, req, res); - txtFld.setId("txtFldId"); - - txtFld.populateComponentHtmlId(form); - - assertEquals("txtFldId", txtFld.getParameters().get("id")); - } - - public void testPopulateComponentHtmlId2() throws Exception { - ValueStack stack = ValueStackFactory.getFactory().createValueStack(); - MockHttpServletRequest req = new MockHttpServletRequest(); - MockHttpServletResponse res = new MockHttpServletResponse(); - - Form form = new Form(stack, req, res); - form.getParameters().put("id", "formId"); - - TextField txtFld = new TextField(stack, req, res); - txtFld.setName("txtFldName"); - - txtFld.populateComponentHtmlId(form); - - assertEquals("formId_txtFldName", txtFld.getParameters().get("id")); - } + + public void testPopulateComponentHtmlId1() throws Exception { + ValueStack stack = ValueStackFactory.getFactory().createValueStack(); + MockHttpServletRequest req = new MockHttpServletRequest(); + MockHttpServletResponse res = new MockHttpServletResponse(); + + Form form = new Form(stack, req, res); + form.getParameters().put("id", "formId"); + + TextField txtFld = new TextField(stack, req, res); + txtFld.setId("txtFldId"); + + txtFld.populateComponentHtmlId(form); + + assertEquals("txtFldId", txtFld.getParameters().get("id")); + } + + public void testPopulateComponentHtmlId2() throws Exception { + ValueStack stack = ValueStackFactory.getFactory().createValueStack(); + MockHttpServletRequest req = new MockHttpServletRequest(); + MockHttpServletResponse res = new MockHttpServletResponse(); + + Form form = new Form(stack, req, res); + form.getParameters().put("id", "formId"); + + TextField txtFld = new TextField(stack, req, res); + txtFld.setName("txtFldName"); + + txtFld.populateComponentHtmlId(form); + + assertEquals("formId_txtFldName", txtFld.getParameters().get("id")); + } } diff --git a/core/src/test/java/org/apache/struts2/components/UIComponentTest.java b/core/src/test/java/org/apache/struts2/components/UIComponentTest.java index b30647ebe..1910cf739 100644 --- a/core/src/test/java/org/apache/struts2/components/UIComponentTest.java +++ b/core/src/test/java/org/apache/struts2/components/UIComponentTest.java @@ -1,19 +1,22 @@ /* * $Id$ * - * Copyright 2006 The Apache Software Foundation. + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at + * http://www.apache.org/licenses/LICENSE-2.0 * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. */ package org.apache.struts2.components; @@ -93,7 +96,7 @@ public class UIComponentTest extends AbstractUITagTest { } } - // Anchor + // Anchor public void testAnchorComponentDisposeItselfFromComponentStack() throws Exception { TextFieldTag t = new TextFieldTag(); diff --git a/core/src/test/java/org/apache/struts2/components/template/BaseTemplateEngineTest.java b/core/src/test/java/org/apache/struts2/components/template/BaseTemplateEngineTest.java index a58dc91c5..cc3b2e581 100644 --- a/core/src/test/java/org/apache/struts2/components/template/BaseTemplateEngineTest.java +++ b/core/src/test/java/org/apache/struts2/components/template/BaseTemplateEngineTest.java @@ -1,19 +1,22 @@ /* * $Id$ * - * Copyright 2006 The Apache Software Foundation. + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at + * http://www.apache.org/licenses/LICENSE-2.0 * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. */ package org.apache.struts2.components.template; @@ -29,55 +32,55 @@ import junit.framework.TestCase; public class BaseTemplateEngineTest extends TestCase { public void testGetThemePropsThroughFileSystem() throws Exception { - - URL dummyResourceUrl = getClass().getResource("dummy.properties"); - File dummyResourceFile = new File(dummyResourceUrl.getFile()); - String themePropertiesDir = dummyResourceFile.getParent(); - - System.out.println("dummy resource url="+dummyResourceUrl); - System.out.println("resource file="+dummyResourceFile); - System.out.println("theme properties dir="+themePropertiesDir); - - assertTrue(dummyResourceFile.exists()); - assertNotNull(themePropertiesDir); - - Template template = new Template(themePropertiesDir, "theme1", "template1"); - - TemplateEngine templateEngine = new InnerBaseTemplateEngine("themeThroughFileSystem.properties"); - Map propertiesMap = templateEngine.getThemeProps(template); - - assertNotNull(propertiesMap); - assertTrue(propertiesMap.size() > 0); - - } - - public void testGetThemePropsThroughClasspath() throws Exception { - - Template template = new Template("org/apache/struts2/components/template", "theme1", "template2"); - TemplateEngine templateEngine = new InnerBaseTemplateEngine("themeThroughClassPath.properties"); - Map propertiesMap = templateEngine.getThemeProps(template); - - assertNotNull(propertiesMap); - assertTrue(propertiesMap.size() > 0); - } - - public class InnerBaseTemplateEngine extends BaseTemplateEngine { - - private String themePropertiesFileName; - - public InnerBaseTemplateEngine(String themePropertiesFileName) { - this.themePropertiesFileName = themePropertiesFileName; - } - - protected String getSuffix() { - return "ftl"; - } - public void renderTemplate(TemplateRenderingContext templateContext) throws Exception { - } - - protected String getThemePropertiesFileName() { - return this.themePropertiesFileName; - } - } + URL dummyResourceUrl = getClass().getResource("dummy.properties"); + File dummyResourceFile = new File(dummyResourceUrl.getFile()); + String themePropertiesDir = dummyResourceFile.getParent(); + + System.out.println("dummy resource url="+dummyResourceUrl); + System.out.println("resource file="+dummyResourceFile); + System.out.println("theme properties dir="+themePropertiesDir); + + assertTrue(dummyResourceFile.exists()); + assertNotNull(themePropertiesDir); + + Template template = new Template(themePropertiesDir, "theme1", "template1"); + + TemplateEngine templateEngine = new InnerBaseTemplateEngine("themeThroughFileSystem.properties"); + Map propertiesMap = templateEngine.getThemeProps(template); + + assertNotNull(propertiesMap); + assertTrue(propertiesMap.size() > 0); + + } + + public void testGetThemePropsThroughClasspath() throws Exception { + + Template template = new Template("org/apache/struts2/components/template", "theme1", "template2"); + TemplateEngine templateEngine = new InnerBaseTemplateEngine("themeThroughClassPath.properties"); + Map propertiesMap = templateEngine.getThemeProps(template); + + assertNotNull(propertiesMap); + assertTrue(propertiesMap.size() > 0); + } + + public class InnerBaseTemplateEngine extends BaseTemplateEngine { + + private String themePropertiesFileName; + + public InnerBaseTemplateEngine(String themePropertiesFileName) { + this.themePropertiesFileName = themePropertiesFileName; + } + + protected String getSuffix() { + return "ftl"; + } + + public void renderTemplate(TemplateRenderingContext templateContext) throws Exception { + } + + protected String getThemePropertiesFileName() { + return this.themePropertiesFileName; + } + } } diff --git a/core/src/test/java/org/apache/struts2/config/ClasspathConfigurationProviderTest.java b/core/src/test/java/org/apache/struts2/config/ClasspathConfigurationProviderTest.java index 1394d2024..3c7bd404d 100644 --- a/core/src/test/java/org/apache/struts2/config/ClasspathConfigurationProviderTest.java +++ b/core/src/test/java/org/apache/struts2/config/ClasspathConfigurationProviderTest.java @@ -1,19 +1,22 @@ /* - * $Id: DefaultSettings.java 439747 2006-09-03 09:22:46Z mrdon $ + * $Id: $ * - * Copyright 2006 The Apache Software Foundation. + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at + * http://www.apache.org/licenses/LICENSE-2.0 * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. */ package org.apache.struts2.config; @@ -35,7 +38,7 @@ public class ClasspathConfigurationProviderTest extends TestCase { ClasspathConfigurationProvider provider; Configuration config; - + public void setUp() { provider = new ClasspathConfigurationProvider(new String[]{"org.apache.struts2.config"}); config = new DefaultConfiguration(); @@ -48,7 +51,7 @@ public class ClasspathConfigurationProviderTest extends TestCase { config.addPackageConfig("custom-package", customPackage); provider.init(config); } - + public void testFoundRootPackages() { assertEquals(5, config.getPackageConfigs().size()); PackageConfig pkg = config.getPackageConfig("org.apache.struts2.config"); @@ -58,7 +61,7 @@ public class ClasspathConfigurationProviderTest extends TestCase { assertEquals(1, configs.size()); assertNotNull(configs.get("customParentPackage")); } - + public void testParentPackage() { PackageConfig pkg = config.getPackageConfig("org.apache.struts2.config"); assertEquals(2, pkg.getParents().size()); @@ -67,7 +70,7 @@ public class ClasspathConfigurationProviderTest extends TestCase { assertNotNull(config); assertEquals("/custom", pkg.getNamespace()); } - + public void testCustomNamespace() { PackageConfig pkg = config.getPackageConfig("org.apache.struts2.config.CustomNamespaceAction"); Map configs = pkg.getAllActionConfigs(); @@ -77,7 +80,7 @@ public class ClasspathConfigurationProviderTest extends TestCase { assertEquals("/mynamespace", pkg.getNamespace()); assertNotNull(configs.get("customParentPackage")); } - + public void testResultAnnotations() { PackageConfig pkg = config.getPackageConfig("org.apache.struts2.config.cltest"); assertEquals("/cltest", pkg.getNamespace()); @@ -85,7 +88,7 @@ public class ClasspathConfigurationProviderTest extends TestCase { assertNotNull(acfg); assertEquals(3, acfg.getResults().size()); } - + public void testDynamicResults() { PackageConfig pkg = config.getPackageConfig("org.apache.struts2.config.cltest"); ActionConfig config = pkg.getActionConfigs().get("twoResult"); diff --git a/core/src/test/java/org/apache/struts2/config/CustomNamespaceAction.java b/core/src/test/java/org/apache/struts2/config/CustomNamespaceAction.java index 6b5c99843..7bff1a5f8 100644 --- a/core/src/test/java/org/apache/struts2/config/CustomNamespaceAction.java +++ b/core/src/test/java/org/apache/struts2/config/CustomNamespaceAction.java @@ -1,19 +1,22 @@ /* - * $Id: DefaultSettings.java 439747 2006-09-03 09:22:46Z mrdon $ + * $Id: $ * - * Copyright 2006 The Apache Software Foundation. + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at + * http://www.apache.org/licenses/LICENSE-2.0 * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. */ package org.apache.struts2.config; diff --git a/core/src/test/java/org/apache/struts2/config/CustomParentPackageAction.java b/core/src/test/java/org/apache/struts2/config/CustomParentPackageAction.java index f96eff60c..0628322d1 100644 --- a/core/src/test/java/org/apache/struts2/config/CustomParentPackageAction.java +++ b/core/src/test/java/org/apache/struts2/config/CustomParentPackageAction.java @@ -1,19 +1,22 @@ /* - * $Id: DefaultSettings.java 439747 2006-09-03 09:22:46Z mrdon $ + * $Id: $ * - * Copyright 2006 The Apache Software Foundation. + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at + * http://www.apache.org/licenses/LICENSE-2.0 * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. */ package org.apache.struts2.config; diff --git a/core/src/test/java/org/apache/struts2/config/SettingsTest.java b/core/src/test/java/org/apache/struts2/config/SettingsTest.java index 62d687b3d..7d19dd6c6 100644 --- a/core/src/test/java/org/apache/struts2/config/SettingsTest.java +++ b/core/src/test/java/org/apache/struts2/config/SettingsTest.java @@ -1,19 +1,22 @@ /* * $Id$ * - * Copyright 2006 The Apache Software Foundation. + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at + * http://www.apache.org/licenses/LICENSE-2.0 * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. */ package org.apache.struts2.config; @@ -56,7 +59,7 @@ public class SettingsTest extends StrutsTestCase { public void testReplaceDefaultMessages() { Locale.setDefault(Locale.US); // force to US locale as we also have _de and _da properties - + LocalizedTextUtil.clearDefaultResourceBundles(); LocalizedTextUtil.addDefaultResourceBundle("org/apache/struts2/struts-messages"); assertEquals("The form has already been processed or no token was supplied, please try again.", LocalizedTextUtil.findDefaultText("struts.messages.invalid.token", Locale.getDefault())); @@ -68,7 +71,7 @@ public class SettingsTest extends StrutsTestCase { public void testSetSettings() { Settings.setInstance(new TestSettings()); - + String keyName = "a.long.property.key.name"; assertEquals(keyName, Settings.get(keyName)); assertEquals(2, getKeyCount()); @@ -79,7 +82,7 @@ public class SettingsTest extends StrutsTestCase { Iterator keyNames = Settings.list(); while (keyNames.hasNext()) { - keyNames.next(); + keyNames.next(); count++; } diff --git a/core/src/test/java/org/apache/struts2/config/TestSettings.java b/core/src/test/java/org/apache/struts2/config/TestSettings.java index fc971774e..e0955dffc 100644 --- a/core/src/test/java/org/apache/struts2/config/TestSettings.java +++ b/core/src/test/java/org/apache/struts2/config/TestSettings.java @@ -1,19 +1,22 @@ /* * $Id$ * - * Copyright 2006 The Apache Software Foundation. + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at + * http://www.apache.org/licenses/LICENSE-2.0 * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. */ package org.apache.struts2.config; diff --git a/core/src/test/java/org/apache/struts2/config/cltest/OneResultAction.java b/core/src/test/java/org/apache/struts2/config/cltest/OneResultAction.java index e5d50ee50..fdd06f4c3 100644 --- a/core/src/test/java/org/apache/struts2/config/cltest/OneResultAction.java +++ b/core/src/test/java/org/apache/struts2/config/cltest/OneResultAction.java @@ -1,19 +1,22 @@ /* - * $Id: DefaultSettings.java 439747 2006-09-03 09:22:46Z mrdon $ + * $Id: $ * - * Copyright 2006 The Apache Software Foundation. + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at + * http://www.apache.org/licenses/LICENSE-2.0 * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. */ package org.apache.struts2.config.cltest; diff --git a/core/src/test/java/org/apache/struts2/config/cltest/TwoResultAction.java b/core/src/test/java/org/apache/struts2/config/cltest/TwoResultAction.java index d138f890a..2a2138445 100644 --- a/core/src/test/java/org/apache/struts2/config/cltest/TwoResultAction.java +++ b/core/src/test/java/org/apache/struts2/config/cltest/TwoResultAction.java @@ -1,19 +1,22 @@ /* - * $Id: DefaultSettings.java 439747 2006-09-03 09:22:46Z mrdon $ + * $Id: $ * - * Copyright 2006 The Apache Software Foundation. + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at + * http://www.apache.org/licenses/LICENSE-2.0 * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. */ package org.apache.struts2.config.cltest; diff --git a/core/src/test/java/org/apache/struts2/dispatcher/ActionContextCleanUpTest.java b/core/src/test/java/org/apache/struts2/dispatcher/ActionContextCleanUpTest.java index 37c1d2a04..0bf5ade72 100644 --- a/core/src/test/java/org/apache/struts2/dispatcher/ActionContextCleanUpTest.java +++ b/core/src/test/java/org/apache/struts2/dispatcher/ActionContextCleanUpTest.java @@ -1,19 +1,22 @@ /* - * $Id: FilterDispatcherTest.java 449367 2006-09-24 06:49:04Z mrdon $ + * $Id: $ * - * Copyright 2006 The Apache Software Foundation. + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at + * http://www.apache.org/licenses/LICENSE-2.0 * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. */ package org.apache.struts2.dispatcher; @@ -42,164 +45,164 @@ import junit.framework.TestCase; * @version $Date$ $Id$ */ public class ActionContextCleanUpTest extends TestCase { - - - protected MockFilterConfig filterConfig; - protected MockHttpServletRequest request; - protected MockHttpServletResponse response; - protected MockFilterChain filterChain; - protected MockFilterChain filterChain2; - protected MockServletContext servletContext; - - protected Counter counter; - protected Map _tmpStore; - protected InnerDispatcher _dispatcher; - protected InnerDispatcher _dispatcher2; - protected ActionContextCleanUp cleanUp; - protected ActionContextCleanUp cleanUp2; - - - @Override - protected void tearDown() throws Exception { - filterConfig = null; - request = null; - response = null; - filterChain = null; - filterChain2 = null; - servletContext = null; - counter = null; - _tmpStore = null; - _dispatcher = null; - _dispatcher2 = null; - cleanUp = null; - cleanUp2 = null; - } - - @Override - protected void setUp() throws Exception { - Dispatcher.setInstance(null); - - counter = new Counter(); - _tmpStore = new LinkedHashMap(); - - filterConfig = new MockFilterConfig(); - request = new MockHttpServletRequest(); - response = new MockHttpServletResponse(); - servletContext = new MockServletContext(); - _dispatcher = new InnerDispatcher(servletContext) { - @Override - public String toString() { - return "dispatcher"; - } - }; - _dispatcher2 = new InnerDispatcher(servletContext){ - @Override - public String toString() { - return "dispatcher2"; - } - }; - - - filterChain = new MockFilterChain() { - @Override - public void doFilter(ServletRequest request, ServletResponse response) throws IOException, ServletException { - _tmpStore.put("counter"+(counter.count++), (Integer) request.getAttribute("__cleanup_recursion_counter")); - } - }; - - cleanUp = new ActionContextCleanUp() { - @Override - protected Dispatcher createDispatcher() { - return _dispatcher; - } - }; - - cleanUp2 = new ActionContextCleanUp() { - @Override - protected Dispatcher createDispatcher() { - return _dispatcher2; - } - }; - - filterChain2 = new MockFilterChain() { - @Override - public void doFilter(ServletRequest request, ServletResponse response) throws IOException, ServletException { - _tmpStore.put("counter"+(counter.count++), (Integer) request.getAttribute("__cleanup_recursion_counter")); - cleanUp2.doFilter(request, response, filterChain); - } - }; - } - - - public void testSingle() throws Exception { - assertFalse(_dispatcher.prepare); - assertFalse(_dispatcher.wrapRequest); - assertNull(request.getAttribute("__cleanup_recursion_counter")); - - cleanUp.init(filterConfig); - cleanUp.doFilter(request, response, filterChain); - cleanUp.destroy(); - - assertEquals(_tmpStore.size(), 1); - assertEquals(_tmpStore.get("counter0"), new Integer(1)); - - assertTrue(_dispatcher.prepare); - assertTrue(_dispatcher.wrapRequest); - assertEquals(request.getAttribute("__cleanup_recursion_counter"), new Integer("0")); - } - - public void testMultiple() throws Exception { - assertFalse(_dispatcher.prepare); - assertFalse(_dispatcher.wrapRequest); - assertFalse(_dispatcher2.prepare); - assertFalse(_dispatcher2.wrapRequest); - assertNull(request.getAttribute("__cleanup_recursion_counter")); - - cleanUp.init(filterConfig); - cleanUp2.init(filterConfig); - cleanUp.doFilter(request, response, filterChain2); - cleanUp2.destroy(); - cleanUp.destroy(); - - assertEquals(_tmpStore.size(), 2); - assertEquals(_tmpStore.get("counter0"), new Integer(1)); - assertEquals(_tmpStore.get("counter1"), new Integer(2)); - - assertFalse(_dispatcher2.prepare); - assertFalse(_dispatcher2.wrapRequest); - assertTrue(_dispatcher.prepare); - assertTrue(_dispatcher.wrapRequest); - assertEquals(request.getAttribute("__cleanup_recursion_counter"), new Integer("0")); - } - - - class InnerDispatcher extends Dispatcher { - public boolean prepare = false; - public boolean wrapRequest = false; - public boolean service = false; - - public InnerDispatcher(ServletContext servletContext) { - super(servletContext); - } - - @Override - public void prepare(HttpServletRequest request, HttpServletResponse response) { - prepare = true; - } - - @Override - public HttpServletRequest wrapRequest(HttpServletRequest request, ServletContext servletContext) throws IOException { - wrapRequest = true; - return request; - } - - @Override - public void serviceAction(HttpServletRequest request, HttpServletResponse response, ServletContext context, ActionMapping mapping) throws ServletException { - service = true; - } - } - - class Counter { - public int count=0; - } + + + protected MockFilterConfig filterConfig; + protected MockHttpServletRequest request; + protected MockHttpServletResponse response; + protected MockFilterChain filterChain; + protected MockFilterChain filterChain2; + protected MockServletContext servletContext; + + protected Counter counter; + protected Map _tmpStore; + protected InnerDispatcher _dispatcher; + protected InnerDispatcher _dispatcher2; + protected ActionContextCleanUp cleanUp; + protected ActionContextCleanUp cleanUp2; + + + @Override + protected void tearDown() throws Exception { + filterConfig = null; + request = null; + response = null; + filterChain = null; + filterChain2 = null; + servletContext = null; + counter = null; + _tmpStore = null; + _dispatcher = null; + _dispatcher2 = null; + cleanUp = null; + cleanUp2 = null; + } + + @Override + protected void setUp() throws Exception { + Dispatcher.setInstance(null); + + counter = new Counter(); + _tmpStore = new LinkedHashMap(); + + filterConfig = new MockFilterConfig(); + request = new MockHttpServletRequest(); + response = new MockHttpServletResponse(); + servletContext = new MockServletContext(); + _dispatcher = new InnerDispatcher(servletContext) { + @Override + public String toString() { + return "dispatcher"; + } + }; + _dispatcher2 = new InnerDispatcher(servletContext){ + @Override + public String toString() { + return "dispatcher2"; + } + }; + + + filterChain = new MockFilterChain() { + @Override + public void doFilter(ServletRequest request, ServletResponse response) throws IOException, ServletException { + _tmpStore.put("counter"+(counter.count++), (Integer) request.getAttribute("__cleanup_recursion_counter")); + } + }; + + cleanUp = new ActionContextCleanUp() { + @Override + protected Dispatcher createDispatcher() { + return _dispatcher; + } + }; + + cleanUp2 = new ActionContextCleanUp() { + @Override + protected Dispatcher createDispatcher() { + return _dispatcher2; + } + }; + + filterChain2 = new MockFilterChain() { + @Override + public void doFilter(ServletRequest request, ServletResponse response) throws IOException, ServletException { + _tmpStore.put("counter"+(counter.count++), (Integer) request.getAttribute("__cleanup_recursion_counter")); + cleanUp2.doFilter(request, response, filterChain); + } + }; + } + + + public void testSingle() throws Exception { + assertFalse(_dispatcher.prepare); + assertFalse(_dispatcher.wrapRequest); + assertNull(request.getAttribute("__cleanup_recursion_counter")); + + cleanUp.init(filterConfig); + cleanUp.doFilter(request, response, filterChain); + cleanUp.destroy(); + + assertEquals(_tmpStore.size(), 1); + assertEquals(_tmpStore.get("counter0"), new Integer(1)); + + assertTrue(_dispatcher.prepare); + assertTrue(_dispatcher.wrapRequest); + assertEquals(request.getAttribute("__cleanup_recursion_counter"), new Integer("0")); + } + + public void testMultiple() throws Exception { + assertFalse(_dispatcher.prepare); + assertFalse(_dispatcher.wrapRequest); + assertFalse(_dispatcher2.prepare); + assertFalse(_dispatcher2.wrapRequest); + assertNull(request.getAttribute("__cleanup_recursion_counter")); + + cleanUp.init(filterConfig); + cleanUp2.init(filterConfig); + cleanUp.doFilter(request, response, filterChain2); + cleanUp2.destroy(); + cleanUp.destroy(); + + assertEquals(_tmpStore.size(), 2); + assertEquals(_tmpStore.get("counter0"), new Integer(1)); + assertEquals(_tmpStore.get("counter1"), new Integer(2)); + + assertFalse(_dispatcher2.prepare); + assertFalse(_dispatcher2.wrapRequest); + assertTrue(_dispatcher.prepare); + assertTrue(_dispatcher.wrapRequest); + assertEquals(request.getAttribute("__cleanup_recursion_counter"), new Integer("0")); + } + + + class InnerDispatcher extends Dispatcher { + public boolean prepare = false; + public boolean wrapRequest = false; + public boolean service = false; + + public InnerDispatcher(ServletContext servletContext) { + super(servletContext); + } + + @Override + public void prepare(HttpServletRequest request, HttpServletResponse response) { + prepare = true; + } + + @Override + public HttpServletRequest wrapRequest(HttpServletRequest request, ServletContext servletContext) throws IOException { + wrapRequest = true; + return request; + } + + @Override + public void serviceAction(HttpServletRequest request, HttpServletResponse response, ServletContext context, ActionMapping mapping) throws ServletException { + service = true; + } + } + + class Counter { + public int count=0; + } } diff --git a/core/src/test/java/org/apache/struts2/dispatcher/DispatcherTest.java b/core/src/test/java/org/apache/struts2/dispatcher/DispatcherTest.java index 5e490b20a..5e1540ac6 100644 --- a/core/src/test/java/org/apache/struts2/dispatcher/DispatcherTest.java +++ b/core/src/test/java/org/apache/struts2/dispatcher/DispatcherTest.java @@ -1,19 +1,22 @@ /* * $Id$ * - * Copyright 2006 The Apache Software Foundation. + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at + * http://www.apache.org/licenses/LICENSE-2.0 * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. */ package org.apache.struts2.dispatcher; @@ -32,49 +35,49 @@ import com.opensymphony.xwork2.util.LocalizedTextUtil; /** * Test case for Dispatcher. - * + * */ public class DispatcherTest extends StrutsTestCase { - public void testDefaultResurceBundlePropertyLoaded() throws Exception { + public void testDefaultResurceBundlePropertyLoaded() throws Exception { Locale.setDefault(Locale.US); // force to US locale as we also have _de and _da properties - - // some i18n messages from xwork-messages.properties - assertEquals( - LocalizedTextUtil.findDefaultText("xwork.error.action.execution", Locale.US), - "Error during Action invocation"); - - // some i18n messages from struts-messages.properties - assertEquals( - LocalizedTextUtil.findDefaultText("struts.messages.error.uploading", Locale.US, - new Object[] { "some error messages" }), - "Error uploading: some error messages"); - } - - public void testPrepareSetEncodingProperly() throws Exception { - HttpServletRequest req = new MockHttpServletRequest(); - HttpServletResponse res = new MockHttpServletResponse(); - - Settings.set(StrutsConstants.STRUTS_I18N_ENCODING, "utf-8"); - - - Dispatcher du = Dispatcher.getInstance(); - du.prepare(req, res); - - assertEquals(req.getCharacterEncoding(), "utf-8"); - } - - public void testPrepareSetEncodingPropertyWithMultipartRequest() throws Exception { - MockHttpServletRequest req = new MockHttpServletRequest(); - MockHttpServletResponse res = new MockHttpServletResponse(); - - req.setContentType("multipart/form-data"); - Settings.set(StrutsConstants.STRUTS_I18N_ENCODING, "utf-8"); - - - Dispatcher du = Dispatcher.getInstance(); - du.prepare(req, res); - - assertEquals(req.getCharacterEncoding(), "utf-8"); - } + + // some i18n messages from xwork-messages.properties + assertEquals( + LocalizedTextUtil.findDefaultText("xwork.error.action.execution", Locale.US), + "Error during Action invocation"); + + // some i18n messages from struts-messages.properties + assertEquals( + LocalizedTextUtil.findDefaultText("struts.messages.error.uploading", Locale.US, + new Object[] { "some error messages" }), + "Error uploading: some error messages"); + } + + public void testPrepareSetEncodingProperly() throws Exception { + HttpServletRequest req = new MockHttpServletRequest(); + HttpServletResponse res = new MockHttpServletResponse(); + + Settings.set(StrutsConstants.STRUTS_I18N_ENCODING, "utf-8"); + + + Dispatcher du = Dispatcher.getInstance(); + du.prepare(req, res); + + assertEquals(req.getCharacterEncoding(), "utf-8"); + } + + public void testPrepareSetEncodingPropertyWithMultipartRequest() throws Exception { + MockHttpServletRequest req = new MockHttpServletRequest(); + MockHttpServletResponse res = new MockHttpServletResponse(); + + req.setContentType("multipart/form-data"); + Settings.set(StrutsConstants.STRUTS_I18N_ENCODING, "utf-8"); + + + Dispatcher du = Dispatcher.getInstance(); + du.prepare(req, res); + + assertEquals(req.getCharacterEncoding(), "utf-8"); + } } diff --git a/core/src/test/java/org/apache/struts2/dispatcher/FilterDispatcherTest.java b/core/src/test/java/org/apache/struts2/dispatcher/FilterDispatcherTest.java index a9ba07743..1c51d7ec6 100644 --- a/core/src/test/java/org/apache/struts2/dispatcher/FilterDispatcherTest.java +++ b/core/src/test/java/org/apache/struts2/dispatcher/FilterDispatcherTest.java @@ -1,19 +1,22 @@ /* * $Id$ * - * Copyright 2006 The Apache Software Foundation. + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at + * http://www.apache.org/licenses/LICENSE-2.0 * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. */ package org.apache.struts2.dispatcher; @@ -53,7 +56,7 @@ public class FilterDispatcherTest extends StrutsTestCase { public void testParsePackages() throws Exception { - + FilterDispatcher filterDispatcher = new FilterDispatcher(); String[] result1 = filterDispatcher.parse("foo.bar.package1 foo.bar.package2 foo.bar.package3"); String[] result2 = filterDispatcher.parse("foo.bar.package1\tfoo.bar.package2\tfoo.bar.package3"); @@ -130,155 +133,155 @@ public class FilterDispatcherTest extends StrutsTestCase { filterDispatcher.destroy(); assertTrue(((InnerInitailizableDestroyableObjectFactory) ObjectFactory.getObjectFactory()).destroyable); } - + public void testIfActionMapperIsNullDontServiceAction() throws Exception { - try { - MockServletContext servletContext = new MockServletContext(); - MockFilterConfig filterConfig = new MockFilterConfig(servletContext); - MockHttpServletRequest req = new MockHttpServletRequest(servletContext); - MockHttpServletResponse res = new MockHttpServletResponse(); - MockFilterChain chain = new MockFilterChain(); - final NoOpDispatcher _dispatcher = new NoOpDispatcher(servletContext); - Dispatcher.setInstance(null); + try { + MockServletContext servletContext = new MockServletContext(); + MockFilterConfig filterConfig = new MockFilterConfig(servletContext); + MockHttpServletRequest req = new MockHttpServletRequest(servletContext); + MockHttpServletResponse res = new MockHttpServletResponse(); + MockFilterChain chain = new MockFilterChain(); + final NoOpDispatcher _dispatcher = new NoOpDispatcher(servletContext); + Dispatcher.setInstance(null); - ConfigurationManager confManager = new ConfigurationManager(); - confManager.setConfiguration(new DefaultConfiguration()); - _dispatcher.setConfigurationManager(confManager); - - - ObjectFactory.setObjectFactory(new InnerObjectFactory()); - - Map settings = new HashMap(); - settings.put(StrutsConstants.STRUTS_MAPPER_CLASS, "org.apache.struts2.dispatcher.FilterDispatcherTest$NullActionMapper"); - Settings.setInstance(new InnerConfiguration(settings)); - - FilterDispatcher filter = new FilterDispatcher() { - protected Dispatcher createDispatcher() { - return _dispatcher; - } - }; - filter.init(filterConfig); - filter.doFilter(req, res, chain); - - assertFalse(_dispatcher.serviceRequest); - } - finally { - Settings.reset(); - } + ConfigurationManager confManager = new ConfigurationManager(); + confManager.setConfiguration(new DefaultConfiguration()); + _dispatcher.setConfigurationManager(confManager); + + + ObjectFactory.setObjectFactory(new InnerObjectFactory()); + + Map settings = new HashMap(); + settings.put(StrutsConstants.STRUTS_MAPPER_CLASS, "org.apache.struts2.dispatcher.FilterDispatcherTest$NullActionMapper"); + Settings.setInstance(new InnerConfiguration(settings)); + + FilterDispatcher filter = new FilterDispatcher() { + protected Dispatcher createDispatcher() { + return _dispatcher; + } + }; + filter.init(filterConfig); + filter.doFilter(req, res, chain); + + assertFalse(_dispatcher.serviceRequest); + } + finally { + Settings.reset(); + } } - - public void testCharacterEncodingSetBeforeRequestWrappingAndActionService() throws Exception { - try { - MockServletContext servletContext = new MockServletContext(); - MockFilterConfig filterConfig = new MockFilterConfig(servletContext); - MockHttpServletRequest req = new MockHttpServletRequest(servletContext); - MockHttpServletResponse res = new MockHttpServletResponse(); - MockFilterChain chain = new MockFilterChain(); - final InnerDispatcher _dispatcher = new InnerDispatcher(servletContext); - Dispatcher.setInstance(null); - ConfigurationManager confManager = new ConfigurationManager(); - confManager.setConfiguration(new DefaultConfiguration()); - _dispatcher.setConfigurationManager(confManager); - - - ObjectFactory.setObjectFactory(new InnerObjectFactory()); - - Map settings = new HashMap(); - settings.put(StrutsConstants.STRUTS_I18N_ENCODING, "UTF-16_DUMMY"); - settings.put(StrutsConstants.STRUTS_MAPPER_CLASS, "org.apache.struts2.dispatcher.FilterDispatcherTest$InnerActionMapper"); - Settings.setInstance(new InnerConfiguration(settings)); - - FilterDispatcher filter = new FilterDispatcher() { - protected Dispatcher createDispatcher() { - return _dispatcher; - } - }; - filter.init(filterConfig); - filter.doFilter(req, res, chain); - - assertTrue(_dispatcher.wrappedRequest); - assertTrue(_dispatcher.serviceRequest); - } - finally { - Settings.reset(); - } + public void testCharacterEncodingSetBeforeRequestWrappingAndActionService() throws Exception { + try { + MockServletContext servletContext = new MockServletContext(); + MockFilterConfig filterConfig = new MockFilterConfig(servletContext); + MockHttpServletRequest req = new MockHttpServletRequest(servletContext); + MockHttpServletResponse res = new MockHttpServletResponse(); + MockFilterChain chain = new MockFilterChain(); + final InnerDispatcher _dispatcher = new InnerDispatcher(servletContext); + Dispatcher.setInstance(null); + + ConfigurationManager confManager = new ConfigurationManager(); + confManager.setConfiguration(new DefaultConfiguration()); + _dispatcher.setConfigurationManager(confManager); + + + ObjectFactory.setObjectFactory(new InnerObjectFactory()); + + Map settings = new HashMap(); + settings.put(StrutsConstants.STRUTS_I18N_ENCODING, "UTF-16_DUMMY"); + settings.put(StrutsConstants.STRUTS_MAPPER_CLASS, "org.apache.struts2.dispatcher.FilterDispatcherTest$InnerActionMapper"); + Settings.setInstance(new InnerConfiguration(settings)); + + FilterDispatcher filter = new FilterDispatcher() { + protected Dispatcher createDispatcher() { + return _dispatcher; + } + }; + filter.init(filterConfig); + filter.doFilter(req, res, chain); + + assertTrue(_dispatcher.wrappedRequest); + assertTrue(_dispatcher.serviceRequest); + } + finally { + Settings.reset(); + } } // === inner class ======== public static class InnerObjectFactory extends ObjectFactory { - + } - + public static class NoOpDispatcher extends Dispatcher { - protected boolean wrappedRequest = false; - protected boolean serviceRequest = false; + protected boolean wrappedRequest = false; + protected boolean serviceRequest = false; - public NoOpDispatcher(ServletContext servletContext) { - super(servletContext); - } + public NoOpDispatcher(ServletContext servletContext) { + super(servletContext); + } - public HttpServletRequest wrapRequest(HttpServletRequest request, ServletContext servletContext) throws IOException { - wrappedRequest = true; - return request; - } - - public void serviceAction(HttpServletRequest request, HttpServletResponse response, ServletContext context, ActionMapping mapping) throws ServletException { - serviceRequest = true; - } + public HttpServletRequest wrapRequest(HttpServletRequest request, ServletContext servletContext) throws IOException { + wrappedRequest = true; + return request; + } + + public void serviceAction(HttpServletRequest request, HttpServletResponse response, ServletContext context, ActionMapping mapping) throws ServletException { + serviceRequest = true; + } } - + public static class InnerDispatcher extends Dispatcher { - - protected boolean wrappedRequest = false; - protected boolean serviceRequest = false; - public InnerDispatcher(ServletContext servletContext) { - super(servletContext); - } + protected boolean wrappedRequest = false; + protected boolean serviceRequest = false; - public HttpServletRequest wrapRequest(HttpServletRequest request, ServletContext servletContext) throws IOException { - wrappedRequest = true; - // if we set the chracter encoding AFTER we do wrap request, we will get - // a failing test - assertNotNull(request.getCharacterEncoding()); - assertEquals(request.getCharacterEncoding(), "UTF-16_DUMMY"); - - return request; - } - - public void serviceAction(HttpServletRequest request, HttpServletResponse response, ServletContext context, ActionMapping mapping) throws ServletException { - serviceRequest = true; - // if we set the chracter encoding AFTER we do wrap request, we will get - // a failing test - assertNotNull(request.getCharacterEncoding()); - assertEquals(request.getCharacterEncoding(), "UTF-16_DUMMY"); - } + public InnerDispatcher(ServletContext servletContext) { + super(servletContext); + } + + public HttpServletRequest wrapRequest(HttpServletRequest request, ServletContext servletContext) throws IOException { + wrappedRequest = true; + // if we set the chracter encoding AFTER we do wrap request, we will get + // a failing test + assertNotNull(request.getCharacterEncoding()); + assertEquals(request.getCharacterEncoding(), "UTF-16_DUMMY"); + + return request; + } + + public void serviceAction(HttpServletRequest request, HttpServletResponse response, ServletContext context, ActionMapping mapping) throws ServletException { + serviceRequest = true; + // if we set the chracter encoding AFTER we do wrap request, we will get + // a failing test + assertNotNull(request.getCharacterEncoding()); + assertEquals(request.getCharacterEncoding(), "UTF-16_DUMMY"); + } } - + public static class InnerActionMapper implements ActionMapper { - public ActionMapping getMapping(HttpServletRequest request, ConfigurationManager config) { - return new ActionMapping(); - } + public ActionMapping getMapping(HttpServletRequest request, ConfigurationManager config) { + return new ActionMapping(); + } - public String getUriFromActionMapping(ActionMapping mapping) { - return null; - } + public String getUriFromActionMapping(ActionMapping mapping) { + return null; + } } - + public static class NullActionMapper implements ActionMapper { - public ActionMapping getMapping(HttpServletRequest request, ConfigurationManager config) { - return null; - } + public ActionMapping getMapping(HttpServletRequest request, ConfigurationManager config) { + return null; + } - public String getUriFromActionMapping(ActionMapping mapping) { - return null; - } + public String getUriFromActionMapping(ActionMapping mapping) { + return null; + } } - - + + public static class InnerConfiguration extends Settings { Map m; diff --git a/core/src/test/java/org/apache/struts2/dispatcher/FilterTest.java b/core/src/test/java/org/apache/struts2/dispatcher/FilterTest.java index ee5af186c..1d27e5062 100644 --- a/core/src/test/java/org/apache/struts2/dispatcher/FilterTest.java +++ b/core/src/test/java/org/apache/struts2/dispatcher/FilterTest.java @@ -1,19 +1,22 @@ /* - * $Id: FilterDispatcherTest.java 449367 2006-09-24 06:49:04Z mrdon $ + * $Id: $ * - * Copyright 2006 The Apache Software Foundation. + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at + * http://www.apache.org/licenses/LICENSE-2.0 * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. */ package org.apache.struts2.dispatcher; @@ -43,302 +46,302 @@ import com.opensymphony.xwork2.config.ConfigurationManager; /** - * + * * @version $Date$ $Id$ */ -public class FilterTest extends TestCase { - - protected MockFilterConfig filterConfig; - protected MockHttpServletRequest request; - protected MockHttpServletResponse response; - protected MockFilterChain filterChain; - protected MockFilterChain filterChain2; - protected MockServletContext servletContext; - - protected InnerDispatcher _dispatcher1; - protected InnerDispatcher _dispatcher2; - protected ActionContextCleanUp cleanUp; - protected FilterDispatcher filterDispatcher; - - protected int cleanUpFilterCreateDispatcherCount = 0; // number of times clean up filter create a dispatcher - protected int filterDispatcherCreateDispatcherCount = 0; // number of times FilterDispatcher create a dispatcher - - - @Override - protected void tearDown() throws Exception { - filterConfig = null; - request = null; - response = null; - filterChain = null; - filterChain2 = null; - servletContext = null; - _dispatcher1 = null; - _dispatcher2 = null; - cleanUp = null; - filterDispatcher = null; - } - - @Override - protected void setUp() throws Exception { - Dispatcher.setInstance(null); - - filterConfig = new MockFilterConfig(); - request = new MockHttpServletRequest(); - response = new MockHttpServletResponse(); - servletContext = new MockServletContext(); - - _dispatcher1 = new InnerDispatcher(servletContext){ - @Override - public String toString() { - return "dispatcher1"; - } - }; - _dispatcher2 = new InnerDispatcher(servletContext){ - @Override - public String toString() { - return "dispatcher2"; - } - }; - filterChain = new MockFilterChain() { - @Override - public void doFilter(ServletRequest req, ServletResponse res) throws IOException, ServletException { - filterDispatcher.doFilter(req, res, filterChain2); - } - }; - filterChain2 = new MockFilterChain() { - @Override - public void doFilter(ServletRequest req, ServletResponse res) throws IOException, ServletException { - } - }; - - - cleanUp = new ActionContextCleanUp() { - @Override - protected Dispatcher createDispatcher() { - cleanUpFilterCreateDispatcherCount++; - return _dispatcher1; - } - - @Override - public String toString() { - return "cleanUp"; - } - }; - - filterDispatcher = new FilterDispatcher() { - @Override - protected Dispatcher createDispatcher() { - filterDispatcherCreateDispatcherCount++; - return _dispatcher2; - } - - @Override - public String toString() { - return "filterDispatcher"; - } - }; - } - - - public void testUsingFilterDispatcherOnly() throws Exception { - ObjectFactory oldObjecFactory = ObjectFactory.getObjectFactory(); - try { - ObjectFactory.setObjectFactory(new InnerObjectFactory()); - Settings.set(StrutsConstants.STRUTS_MAPPER_CLASS, "org.apache.struts2.dispatcher.FilterTest$InnerMapper"); - - assertEquals(cleanUpFilterCreateDispatcherCount, 0); - assertEquals(filterDispatcherCreateDispatcherCount, 0); - assertFalse(_dispatcher1.prepare); - assertFalse(_dispatcher1.wrapRequest); - assertFalse(_dispatcher1.service); - assertFalse(_dispatcher2.prepare); - assertFalse(_dispatcher2.wrapRequest); - assertFalse(_dispatcher2.service); - - filterDispatcher.init(filterConfig); - filterDispatcher.doFilter(request, response, filterChain2); - filterDispatcher.destroy(); - - // we are using FilterDispatcher only, so cleanUp filter's Dispatcher should not be created. - assertEquals(cleanUpFilterCreateDispatcherCount, 0); - assertEquals(filterDispatcherCreateDispatcherCount, 1); - assertFalse(_dispatcher1.prepare); - assertFalse(_dispatcher1.wrapRequest); - assertFalse(_dispatcher1.service); - assertTrue(_dispatcher2.prepare); - assertTrue(_dispatcher2.wrapRequest); - assertTrue(_dispatcher2.service); - assertTrue(Dispatcher.getInstance() == null); - } - finally { - ObjectFactory.setObjectFactory(oldObjecFactory); - } - } - - public void testUsingFilterDispatcherOnly_Multiple() throws Exception { - ObjectFactory oldObjecFactory = ObjectFactory.getObjectFactory(); - try { - ObjectFactory.setObjectFactory(new InnerObjectFactory()); - Settings.set(StrutsConstants.STRUTS_MAPPER_CLASS, "org.apache.struts2.dispatcher.FilterTest$InnerMapper"); - - assertEquals(cleanUpFilterCreateDispatcherCount, 0); - assertEquals(filterDispatcherCreateDispatcherCount, 0); - assertFalse(_dispatcher1.prepare); - assertFalse(_dispatcher1.wrapRequest); - assertFalse(_dispatcher1.service); - assertFalse(_dispatcher2.prepare); - assertFalse(_dispatcher2.wrapRequest); - assertFalse(_dispatcher2.service); - - filterDispatcher.init(filterConfig); - filterDispatcher.doFilter(request, response, filterChain2); - filterDispatcher.doFilter(request, response, filterChain2); - filterDispatcher.destroy(); - - assertEquals(cleanUpFilterCreateDispatcherCount, 0); - // We should create dispatcher once, although filter.doFilter(...) is called many times. - assertEquals(filterDispatcherCreateDispatcherCount, 1); - assertFalse(_dispatcher1.prepare); - assertFalse(_dispatcher1.wrapRequest); - assertFalse(_dispatcher1.service); - assertTrue(_dispatcher2.prepare); - assertTrue(_dispatcher2.wrapRequest); - assertTrue(_dispatcher2.service); - assertTrue(Dispatcher.getInstance() == null); - } - finally { - ObjectFactory.setObjectFactory(oldObjecFactory); - } - } - - public void testUsingCleanUpAndFilterDispatcher() throws Exception { - ObjectFactory oldObjecFactory = ObjectFactory.getObjectFactory(); - try { - ObjectFactory.setObjectFactory(new InnerObjectFactory()); - Settings.set(StrutsConstants.STRUTS_MAPPER_CLASS, "org.apache.struts2.dispatcher.FilterTest$InnerMapper"); - - assertEquals(cleanUpFilterCreateDispatcherCount, 0); - assertEquals(filterDispatcherCreateDispatcherCount, 0); - assertFalse(_dispatcher1.prepare); - assertFalse(_dispatcher1.wrapRequest); - assertFalse(_dispatcher1.service); - assertFalse(_dispatcher2.prepare); - assertFalse(_dispatcher2.wrapRequest); - assertFalse(_dispatcher2.service); - - cleanUp.init(filterConfig); - filterDispatcher.init(filterConfig); - cleanUp.doFilter(request, response, filterChain); - filterDispatcher.destroy(); - cleanUp.destroy(); - - assertEquals(cleanUpFilterCreateDispatcherCount, 1); - assertEquals(filterDispatcherCreateDispatcherCount, 1); - assertTrue(_dispatcher1.prepare); - assertTrue(_dispatcher1.wrapRequest); - assertTrue(_dispatcher1.service); - assertFalse(_dispatcher2.prepare); - assertFalse(_dispatcher2.wrapRequest); - assertFalse(_dispatcher2.service); - assertTrue(Dispatcher.getInstance() == null); - } - finally { - ObjectFactory.setObjectFactory(oldObjecFactory); - } - } - - - public void testUsingCleanUpAndFilterDispatcher_Multiple() throws Exception { - ObjectFactory oldObjecFactory = ObjectFactory.getObjectFactory(); - try { - ObjectFactory.setObjectFactory(new InnerObjectFactory()); - Settings.set(StrutsConstants.STRUTS_MAPPER_CLASS, "org.apache.struts2.dispatcher.FilterTest$InnerMapper"); - - assertEquals(cleanUpFilterCreateDispatcherCount, 0); - assertEquals(filterDispatcherCreateDispatcherCount, 0); - assertFalse(_dispatcher1.prepare); - assertFalse(_dispatcher1.wrapRequest); - assertFalse(_dispatcher1.service); - assertFalse(_dispatcher2.prepare); - assertFalse(_dispatcher2.wrapRequest); - assertFalse(_dispatcher2.service); - - cleanUp.init(filterConfig); - filterDispatcher.init(filterConfig); - cleanUp.doFilter(request, response, filterChain); - cleanUp.doFilter(request, response, filterChain); - filterDispatcher.destroy(); - cleanUp.destroy(); - - assertEquals(cleanUpFilterCreateDispatcherCount, 1); - assertEquals(filterDispatcherCreateDispatcherCount, 1); - assertTrue(_dispatcher1.prepare); - assertTrue(_dispatcher1.wrapRequest); - assertTrue(_dispatcher1.service); - assertFalse(_dispatcher2.prepare); - assertFalse(_dispatcher2.wrapRequest); - assertFalse(_dispatcher2.service); - assertTrue(Dispatcher.getInstance() == null); - } - finally { - ObjectFactory.setObjectFactory(oldObjecFactory); - } - } - - - class InnerDispatcher extends Dispatcher { - public boolean prepare = false; - public boolean wrapRequest = false; - public boolean service = false; - - public InnerDispatcher(ServletContext servletContext) { - super(servletContext); - } - - @Override - public void prepare(HttpServletRequest request, HttpServletResponse response) { - prepare = true; - } - - @Override - public HttpServletRequest wrapRequest(HttpServletRequest request, ServletContext servletContext) throws IOException { - wrapRequest = true; - return request; - } - - @Override - public void serviceAction(HttpServletRequest request, HttpServletResponse response, ServletContext context, ActionMapping mapping) throws ServletException { - service = true; - } - } - - class NullInnerMapper implements ActionMapper { - public ActionMapping getMapping(HttpServletRequest request, ConfigurationManager configManager) { - return null; - } +public class FilterTest extends TestCase { - public String getUriFromActionMapping(ActionMapping mapping) { - return null; - } - } - - public static class InnerMapper implements ActionMapper { - - public InnerMapper() {} - - public ActionMapping getMapping(HttpServletRequest request, ConfigurationManager configManager) { - return new ActionMapping(); - } + protected MockFilterConfig filterConfig; + protected MockHttpServletRequest request; + protected MockHttpServletResponse response; + protected MockFilterChain filterChain; + protected MockFilterChain filterChain2; + protected MockServletContext servletContext; - public String getUriFromActionMapping(ActionMapping mapping) { - return ""; - } - } - - class InnerObjectFactory extends ObjectFactory { - public InnerObjectFactory() { - super(); - } - } + protected InnerDispatcher _dispatcher1; + protected InnerDispatcher _dispatcher2; + protected ActionContextCleanUp cleanUp; + protected FilterDispatcher filterDispatcher; + + protected int cleanUpFilterCreateDispatcherCount = 0; // number of times clean up filter create a dispatcher + protected int filterDispatcherCreateDispatcherCount = 0; // number of times FilterDispatcher create a dispatcher + + + @Override + protected void tearDown() throws Exception { + filterConfig = null; + request = null; + response = null; + filterChain = null; + filterChain2 = null; + servletContext = null; + _dispatcher1 = null; + _dispatcher2 = null; + cleanUp = null; + filterDispatcher = null; + } + + @Override + protected void setUp() throws Exception { + Dispatcher.setInstance(null); + + filterConfig = new MockFilterConfig(); + request = new MockHttpServletRequest(); + response = new MockHttpServletResponse(); + servletContext = new MockServletContext(); + + _dispatcher1 = new InnerDispatcher(servletContext){ + @Override + public String toString() { + return "dispatcher1"; + } + }; + _dispatcher2 = new InnerDispatcher(servletContext){ + @Override + public String toString() { + return "dispatcher2"; + } + }; + filterChain = new MockFilterChain() { + @Override + public void doFilter(ServletRequest req, ServletResponse res) throws IOException, ServletException { + filterDispatcher.doFilter(req, res, filterChain2); + } + }; + filterChain2 = new MockFilterChain() { + @Override + public void doFilter(ServletRequest req, ServletResponse res) throws IOException, ServletException { + } + }; + + + cleanUp = new ActionContextCleanUp() { + @Override + protected Dispatcher createDispatcher() { + cleanUpFilterCreateDispatcherCount++; + return _dispatcher1; + } + + @Override + public String toString() { + return "cleanUp"; + } + }; + + filterDispatcher = new FilterDispatcher() { + @Override + protected Dispatcher createDispatcher() { + filterDispatcherCreateDispatcherCount++; + return _dispatcher2; + } + + @Override + public String toString() { + return "filterDispatcher"; + } + }; + } + + + public void testUsingFilterDispatcherOnly() throws Exception { + ObjectFactory oldObjecFactory = ObjectFactory.getObjectFactory(); + try { + ObjectFactory.setObjectFactory(new InnerObjectFactory()); + Settings.set(StrutsConstants.STRUTS_MAPPER_CLASS, "org.apache.struts2.dispatcher.FilterTest$InnerMapper"); + + assertEquals(cleanUpFilterCreateDispatcherCount, 0); + assertEquals(filterDispatcherCreateDispatcherCount, 0); + assertFalse(_dispatcher1.prepare); + assertFalse(_dispatcher1.wrapRequest); + assertFalse(_dispatcher1.service); + assertFalse(_dispatcher2.prepare); + assertFalse(_dispatcher2.wrapRequest); + assertFalse(_dispatcher2.service); + + filterDispatcher.init(filterConfig); + filterDispatcher.doFilter(request, response, filterChain2); + filterDispatcher.destroy(); + + // we are using FilterDispatcher only, so cleanUp filter's Dispatcher should not be created. + assertEquals(cleanUpFilterCreateDispatcherCount, 0); + assertEquals(filterDispatcherCreateDispatcherCount, 1); + assertFalse(_dispatcher1.prepare); + assertFalse(_dispatcher1.wrapRequest); + assertFalse(_dispatcher1.service); + assertTrue(_dispatcher2.prepare); + assertTrue(_dispatcher2.wrapRequest); + assertTrue(_dispatcher2.service); + assertTrue(Dispatcher.getInstance() == null); + } + finally { + ObjectFactory.setObjectFactory(oldObjecFactory); + } + } + + public void testUsingFilterDispatcherOnly_Multiple() throws Exception { + ObjectFactory oldObjecFactory = ObjectFactory.getObjectFactory(); + try { + ObjectFactory.setObjectFactory(new InnerObjectFactory()); + Settings.set(StrutsConstants.STRUTS_MAPPER_CLASS, "org.apache.struts2.dispatcher.FilterTest$InnerMapper"); + + assertEquals(cleanUpFilterCreateDispatcherCount, 0); + assertEquals(filterDispatcherCreateDispatcherCount, 0); + assertFalse(_dispatcher1.prepare); + assertFalse(_dispatcher1.wrapRequest); + assertFalse(_dispatcher1.service); + assertFalse(_dispatcher2.prepare); + assertFalse(_dispatcher2.wrapRequest); + assertFalse(_dispatcher2.service); + + filterDispatcher.init(filterConfig); + filterDispatcher.doFilter(request, response, filterChain2); + filterDispatcher.doFilter(request, response, filterChain2); + filterDispatcher.destroy(); + + assertEquals(cleanUpFilterCreateDispatcherCount, 0); + // We should create dispatcher once, although filter.doFilter(...) is called many times. + assertEquals(filterDispatcherCreateDispatcherCount, 1); + assertFalse(_dispatcher1.prepare); + assertFalse(_dispatcher1.wrapRequest); + assertFalse(_dispatcher1.service); + assertTrue(_dispatcher2.prepare); + assertTrue(_dispatcher2.wrapRequest); + assertTrue(_dispatcher2.service); + assertTrue(Dispatcher.getInstance() == null); + } + finally { + ObjectFactory.setObjectFactory(oldObjecFactory); + } + } + + public void testUsingCleanUpAndFilterDispatcher() throws Exception { + ObjectFactory oldObjecFactory = ObjectFactory.getObjectFactory(); + try { + ObjectFactory.setObjectFactory(new InnerObjectFactory()); + Settings.set(StrutsConstants.STRUTS_MAPPER_CLASS, "org.apache.struts2.dispatcher.FilterTest$InnerMapper"); + + assertEquals(cleanUpFilterCreateDispatcherCount, 0); + assertEquals(filterDispatcherCreateDispatcherCount, 0); + assertFalse(_dispatcher1.prepare); + assertFalse(_dispatcher1.wrapRequest); + assertFalse(_dispatcher1.service); + assertFalse(_dispatcher2.prepare); + assertFalse(_dispatcher2.wrapRequest); + assertFalse(_dispatcher2.service); + + cleanUp.init(filterConfig); + filterDispatcher.init(filterConfig); + cleanUp.doFilter(request, response, filterChain); + filterDispatcher.destroy(); + cleanUp.destroy(); + + assertEquals(cleanUpFilterCreateDispatcherCount, 1); + assertEquals(filterDispatcherCreateDispatcherCount, 1); + assertTrue(_dispatcher1.prepare); + assertTrue(_dispatcher1.wrapRequest); + assertTrue(_dispatcher1.service); + assertFalse(_dispatcher2.prepare); + assertFalse(_dispatcher2.wrapRequest); + assertFalse(_dispatcher2.service); + assertTrue(Dispatcher.getInstance() == null); + } + finally { + ObjectFactory.setObjectFactory(oldObjecFactory); + } + } + + + public void testUsingCleanUpAndFilterDispatcher_Multiple() throws Exception { + ObjectFactory oldObjecFactory = ObjectFactory.getObjectFactory(); + try { + ObjectFactory.setObjectFactory(new InnerObjectFactory()); + Settings.set(StrutsConstants.STRUTS_MAPPER_CLASS, "org.apache.struts2.dispatcher.FilterTest$InnerMapper"); + + assertEquals(cleanUpFilterCreateDispatcherCount, 0); + assertEquals(filterDispatcherCreateDispatcherCount, 0); + assertFalse(_dispatcher1.prepare); + assertFalse(_dispatcher1.wrapRequest); + assertFalse(_dispatcher1.service); + assertFalse(_dispatcher2.prepare); + assertFalse(_dispatcher2.wrapRequest); + assertFalse(_dispatcher2.service); + + cleanUp.init(filterConfig); + filterDispatcher.init(filterConfig); + cleanUp.doFilter(request, response, filterChain); + cleanUp.doFilter(request, response, filterChain); + filterDispatcher.destroy(); + cleanUp.destroy(); + + assertEquals(cleanUpFilterCreateDispatcherCount, 1); + assertEquals(filterDispatcherCreateDispatcherCount, 1); + assertTrue(_dispatcher1.prepare); + assertTrue(_dispatcher1.wrapRequest); + assertTrue(_dispatcher1.service); + assertFalse(_dispatcher2.prepare); + assertFalse(_dispatcher2.wrapRequest); + assertFalse(_dispatcher2.service); + assertTrue(Dispatcher.getInstance() == null); + } + finally { + ObjectFactory.setObjectFactory(oldObjecFactory); + } + } + + + class InnerDispatcher extends Dispatcher { + public boolean prepare = false; + public boolean wrapRequest = false; + public boolean service = false; + + public InnerDispatcher(ServletContext servletContext) { + super(servletContext); + } + + @Override + public void prepare(HttpServletRequest request, HttpServletResponse response) { + prepare = true; + } + + @Override + public HttpServletRequest wrapRequest(HttpServletRequest request, ServletContext servletContext) throws IOException { + wrapRequest = true; + return request; + } + + @Override + public void serviceAction(HttpServletRequest request, HttpServletResponse response, ServletContext context, ActionMapping mapping) throws ServletException { + service = true; + } + } + + class NullInnerMapper implements ActionMapper { + public ActionMapping getMapping(HttpServletRequest request, ConfigurationManager configManager) { + return null; + } + + public String getUriFromActionMapping(ActionMapping mapping) { + return null; + } + } + + public static class InnerMapper implements ActionMapper { + + public InnerMapper() {} + + public ActionMapping getMapping(HttpServletRequest request, ConfigurationManager configManager) { + return new ActionMapping(); + } + + public String getUriFromActionMapping(ActionMapping mapping) { + return ""; + } + } + + class InnerObjectFactory extends ObjectFactory { + public InnerObjectFactory() { + super(); + } + } } diff --git a/core/src/test/java/org/apache/struts2/dispatcher/HttpHeaderResultTest.java b/core/src/test/java/org/apache/struts2/dispatcher/HttpHeaderResultTest.java index 098e5982f..ffe64fdda 100644 --- a/core/src/test/java/org/apache/struts2/dispatcher/HttpHeaderResultTest.java +++ b/core/src/test/java/org/apache/struts2/dispatcher/HttpHeaderResultTest.java @@ -1,19 +1,22 @@ /* * $Id$ * - * Copyright 2006 The Apache Software Foundation. + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at + * http://www.apache.org/licenses/LICENSE-2.0 * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. */ package org.apache.struts2.dispatcher; diff --git a/core/src/test/java/org/apache/struts2/dispatcher/NullActionMapper.java b/core/src/test/java/org/apache/struts2/dispatcher/NullActionMapper.java index bbdf620e3..b8cfc9a24 100644 --- a/core/src/test/java/org/apache/struts2/dispatcher/NullActionMapper.java +++ b/core/src/test/java/org/apache/struts2/dispatcher/NullActionMapper.java @@ -1,19 +1,22 @@ /* * $Id$ * - * Copyright 2006 The Apache Software Foundation. + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at + * http://www.apache.org/licenses/LICENSE-2.0 * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. */ package org.apache.struts2.dispatcher; @@ -30,19 +33,19 @@ import com.opensymphony.xwork2.config.ConfigurationManager; */ public class NullActionMapper implements ActionMapper { - private static ActionMapping _actionMapping; - - public NullActionMapper() {} - - public static void setActionMapping(ActionMapping actionMappingToBeRetrned) { - _actionMapping = actionMappingToBeRetrned; - } - - public ActionMapping getMapping(HttpServletRequest request, ConfigurationManager config) { - return _actionMapping; - } + private static ActionMapping _actionMapping; - public String getUriFromActionMapping(ActionMapping mapping) { - throw new UnsupportedOperationException("operation not supported"); - } + public NullActionMapper() {} + + public static void setActionMapping(ActionMapping actionMappingToBeRetrned) { + _actionMapping = actionMappingToBeRetrned; + } + + public ActionMapping getMapping(HttpServletRequest request, ConfigurationManager config) { + return _actionMapping; + } + + public String getUriFromActionMapping(ActionMapping mapping) { + throw new UnsupportedOperationException("operation not supported"); + } } diff --git a/core/src/test/java/org/apache/struts2/dispatcher/PlainTextResultTest.java b/core/src/test/java/org/apache/struts2/dispatcher/PlainTextResultTest.java index 70be164a7..a7435b348 100644 --- a/core/src/test/java/org/apache/struts2/dispatcher/PlainTextResultTest.java +++ b/core/src/test/java/org/apache/struts2/dispatcher/PlainTextResultTest.java @@ -1,19 +1,22 @@ /* * $Id$ * - * Copyright 2006 The Apache Software Foundation. + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at + * http://www.apache.org/licenses/LICENSE-2.0 * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. */ package org.apache.struts2.dispatcher; @@ -36,119 +39,119 @@ import com.opensymphony.xwork2.util.ValueStack; /** * Test case for PlainTextResult. - * + * */ public class PlainTextResultTest extends TestCase { - - ValueStack stack; - MockActionInvocation invocation; - ActionContext context; - StrutsMockHttpServletResponse response; - PrintWriter writer; - StringWriter stringWriter; - StrutsMockServletContext servletContext; - - public void testPlainText() throws Exception { - PlainTextResult result = new PlainTextResult(); - result.setLocation("/someJspFile.jsp"); - - response.setExpectedContentType("text/plain"); - response.setExpectedHeader("Content-Disposition", "inline"); - InputStream jspResourceInputStream = - ClassLoaderUtil.getResourceAsStream( - "org/apache/struts2/dispatcher/someJspFile.jsp", - PlainTextResultTest.class); - - - try { - servletContext.setResourceAsStream(jspResourceInputStream); - result.execute(invocation); - - String r = AbstractUITagTest.normalize(stringWriter.getBuffer().toString(), true); - String e = AbstractUITagTest.normalize( - readAsString("org/apache/struts2/dispatcher/someJspFile.jsp"), true); - assertEquals(r, e); - } - finally { - jspResourceInputStream.close(); - } - } - - public void testPlainTextWithEncoding() throws Exception { - PlainTextResult result = new PlainTextResult(); - result.setLocation("/someJspFile.jsp"); - result.setCharSet("UTF-8"); - - response.setExpectedContentType("text/plain; charset=UTF-8"); - response.setExpectedHeader("Content-Disposition", "inline"); - InputStream jspResourceInputStream = - ClassLoaderUtil.getResourceAsStream( - "org/apache/struts2/dispatcher/someJspFile.jsp", - PlainTextResultTest.class); - - - try { - servletContext.setResourceAsStream(jspResourceInputStream); - result.execute(invocation); - - String r = AbstractUITagTest.normalize(stringWriter.getBuffer().toString(), true); - String e = AbstractUITagTest.normalize( - readAsString("org/apache/struts2/dispatcher/someJspFile.jsp"), true); - assertEquals(r, e); - } - finally { - jspResourceInputStream.close(); - } - } - - protected String readAsString(String resource) throws Exception { - InputStream is = null; - try { - is = ClassLoaderUtil.getResourceAsStream(resource, PlainTextResultTest.class); - int sizeRead = 0; - byte[] buffer = new byte[1024]; - StringBuffer stringBuffer = new StringBuffer(); - while((sizeRead = is.read(buffer)) != -1) { - stringBuffer.append(new String(buffer, 0, sizeRead)); - } - return stringBuffer.toString(); - } - finally { - if (is != null) - is.close(); - } - - } - - - protected void setUp() throws Exception { - super.setUp(); - - stringWriter = new StringWriter(); - writer = new PrintWriter(stringWriter); - response = new StrutsMockHttpServletResponse(); - response.setWriter(writer); - servletContext = new StrutsMockServletContext(); - stack = ValueStackFactory.getFactory().createValueStack(); - context = new ActionContext(stack.getContext()); - context.put(StrutsStatics.HTTP_RESPONSE, response); - context.put(StrutsStatics.SERVLET_CONTEXT, servletContext); - invocation = new MockActionInvocation(); - invocation.setStack(stack); - invocation.setInvocationContext(context); - } - - - protected void tearDown() throws Exception { - stack = null; - invocation = null; - context = null; - response = null; - writer = null; - stringWriter = null; - servletContext = null; - - super.tearDown(); - } + ValueStack stack; + MockActionInvocation invocation; + ActionContext context; + StrutsMockHttpServletResponse response; + PrintWriter writer; + StringWriter stringWriter; + StrutsMockServletContext servletContext; + + + public void testPlainText() throws Exception { + PlainTextResult result = new PlainTextResult(); + result.setLocation("/someJspFile.jsp"); + + response.setExpectedContentType("text/plain"); + response.setExpectedHeader("Content-Disposition", "inline"); + InputStream jspResourceInputStream = + ClassLoaderUtil.getResourceAsStream( + "org/apache/struts2/dispatcher/someJspFile.jsp", + PlainTextResultTest.class); + + + try { + servletContext.setResourceAsStream(jspResourceInputStream); + result.execute(invocation); + + String r = AbstractUITagTest.normalize(stringWriter.getBuffer().toString(), true); + String e = AbstractUITagTest.normalize( + readAsString("org/apache/struts2/dispatcher/someJspFile.jsp"), true); + assertEquals(r, e); + } + finally { + jspResourceInputStream.close(); + } + } + + public void testPlainTextWithEncoding() throws Exception { + PlainTextResult result = new PlainTextResult(); + result.setLocation("/someJspFile.jsp"); + result.setCharSet("UTF-8"); + + response.setExpectedContentType("text/plain; charset=UTF-8"); + response.setExpectedHeader("Content-Disposition", "inline"); + InputStream jspResourceInputStream = + ClassLoaderUtil.getResourceAsStream( + "org/apache/struts2/dispatcher/someJspFile.jsp", + PlainTextResultTest.class); + + + try { + servletContext.setResourceAsStream(jspResourceInputStream); + result.execute(invocation); + + String r = AbstractUITagTest.normalize(stringWriter.getBuffer().toString(), true); + String e = AbstractUITagTest.normalize( + readAsString("org/apache/struts2/dispatcher/someJspFile.jsp"), true); + assertEquals(r, e); + } + finally { + jspResourceInputStream.close(); + } + } + + protected String readAsString(String resource) throws Exception { + InputStream is = null; + try { + is = ClassLoaderUtil.getResourceAsStream(resource, PlainTextResultTest.class); + int sizeRead = 0; + byte[] buffer = new byte[1024]; + StringBuffer stringBuffer = new StringBuffer(); + while((sizeRead = is.read(buffer)) != -1) { + stringBuffer.append(new String(buffer, 0, sizeRead)); + } + return stringBuffer.toString(); + } + finally { + if (is != null) + is.close(); + } + + } + + + protected void setUp() throws Exception { + super.setUp(); + + stringWriter = new StringWriter(); + writer = new PrintWriter(stringWriter); + response = new StrutsMockHttpServletResponse(); + response.setWriter(writer); + servletContext = new StrutsMockServletContext(); + stack = ValueStackFactory.getFactory().createValueStack(); + context = new ActionContext(stack.getContext()); + context.put(StrutsStatics.HTTP_RESPONSE, response); + context.put(StrutsStatics.SERVLET_CONTEXT, servletContext); + invocation = new MockActionInvocation(); + invocation.setStack(stack); + invocation.setInvocationContext(context); + } + + + protected void tearDown() throws Exception { + stack = null; + invocation = null; + context = null; + response = null; + writer = null; + stringWriter = null; + servletContext = null; + + super.tearDown(); + } } diff --git a/core/src/test/java/org/apache/struts2/dispatcher/ServletActionRedirectResultTest.java b/core/src/test/java/org/apache/struts2/dispatcher/ServletActionRedirectResultTest.java index 9db513fbc..e0d69e2ae 100644 --- a/core/src/test/java/org/apache/struts2/dispatcher/ServletActionRedirectResultTest.java +++ b/core/src/test/java/org/apache/struts2/dispatcher/ServletActionRedirectResultTest.java @@ -1,19 +1,22 @@ /* * $Id$ * - * Copyright 2006 The Apache Software Foundation. + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at + * http://www.apache.org/licenses/LICENSE-2.0 * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. */ package org.apache.struts2.dispatcher; @@ -39,121 +42,121 @@ import com.opensymphony.xwork2.util.ValueStack; * @version $Date$ $Id$ */ public class ServletActionRedirectResultTest extends StrutsTestCase { - - public void testIncludeParameterInResultWithConditionParseOn() throws Exception { - - ResultConfig resultConfig = new ResultConfig(); - resultConfig.addParam("actionName", "someActionName"); - resultConfig.addParam("namespace", "someNamespace"); - resultConfig.addParam("encode", "true"); - resultConfig.addParam("parse", "true"); - resultConfig.addParam("location", "someLocation"); - resultConfig.addParam("prependServletContext", "true"); - resultConfig.addParam("method", "someMethod"); - resultConfig.addParam("param1", "${#value1}"); - resultConfig.addParam("param2", "${#value2}"); - resultConfig.addParam("param3", "${#value3}"); - - - - ActionContext context = ActionContext.getContext(); - ValueStack stack = context.getValueStack(); - context.getContextMap().put("value1", "value 1"); - context.getContextMap().put("value2", "value 2"); - context.getContextMap().put("value3", "value 3"); - MockHttpServletRequest req = new MockHttpServletRequest(); - MockHttpServletResponse res = new MockHttpServletResponse(); - context.put(ServletActionContext.HTTP_REQUEST, req); - context.put(ServletActionContext.HTTP_RESPONSE, res); - - - Map results= new HashMap(); - results.put("myResult", resultConfig); - - ActionConfig actionConfig = new ActionConfig(); - actionConfig.setResults(results); - - ServletActionRedirectResult result = new ServletActionRedirectResult(); - result.setActionName("myAction"); - result.setNamespace("/myNamespace"); - result.setParse(true); - result.setEncode(false); - result.setPrependServletContext(false); - - IMocksControl control = EasyMock.createControl(); - ActionProxy mockActionProxy = control.createMock(ActionProxy.class); - ActionInvocation mockInvocation = control.createMock(ActionInvocation.class); - mockInvocation.getProxy(); - control.andReturn(mockActionProxy); - mockInvocation.getResultCode(); - control.andReturn("myResult"); - mockActionProxy.getConfig(); - control.andReturn(actionConfig); - mockInvocation.getInvocationContext(); - control.andReturn(context); - mockInvocation.getStack(); - control.andReturn(stack); - control.anyTimes(); - - control.replay(); - - result.execute(mockInvocation); - assertEquals("/myNamespace/myAction.action?param2=value+2¶m1=value+1¶m3=value+3", res.getRedirectedUrl()); - - control.verify(); - } - - public void testIncludeParameterInResult() throws Exception { - - ResultConfig resultConfig = new ResultConfig(); - resultConfig.addParam("actionName", "someActionName"); - resultConfig.addParam("namespace", "someNamespace"); - resultConfig.addParam("encode", "true"); - resultConfig.addParam("parse", "true"); - resultConfig.addParam("location", "someLocation"); - resultConfig.addParam("prependServletContext", "true"); - resultConfig.addParam("method", "someMethod"); - resultConfig.addParam("param1", "value 1"); - resultConfig.addParam("param2", "value 2"); - resultConfig.addParam("param3", "value 3"); - - ActionContext context = ActionContext.getContext(); - MockHttpServletRequest req = new MockHttpServletRequest(); - MockHttpServletResponse res = new MockHttpServletResponse(); - context.put(ServletActionContext.HTTP_REQUEST, req); - context.put(ServletActionContext.HTTP_RESPONSE, res); - - - Map results= new HashMap(); - results.put("myResult", resultConfig); - - ActionConfig actionConfig = new ActionConfig(); - actionConfig.setResults(results); - - ServletActionRedirectResult result = new ServletActionRedirectResult(); - result.setActionName("myAction"); - result.setNamespace("/myNamespace"); - result.setParse(false); - result.setEncode(false); - result.setPrependServletContext(false); - - IMocksControl control = EasyMock.createControl(); - ActionProxy mockActionProxy = control.createMock(ActionProxy.class); - ActionInvocation mockInvocation = control.createMock(ActionInvocation.class); - mockInvocation.getProxy(); - control.andReturn(mockActionProxy); - mockInvocation.getResultCode(); - control.andReturn("myResult"); - mockActionProxy.getConfig(); - control.andReturn(actionConfig); - mockInvocation.getInvocationContext(); - control.andReturn(context); - - control.replay(); - - result.execute(mockInvocation); - assertEquals("/myNamespace/myAction.action?param2=value+2¶m1=value+1¶m3=value+3", res.getRedirectedUrl()); - - control.verify(); - } + + public void testIncludeParameterInResultWithConditionParseOn() throws Exception { + + ResultConfig resultConfig = new ResultConfig(); + resultConfig.addParam("actionName", "someActionName"); + resultConfig.addParam("namespace", "someNamespace"); + resultConfig.addParam("encode", "true"); + resultConfig.addParam("parse", "true"); + resultConfig.addParam("location", "someLocation"); + resultConfig.addParam("prependServletContext", "true"); + resultConfig.addParam("method", "someMethod"); + resultConfig.addParam("param1", "${#value1}"); + resultConfig.addParam("param2", "${#value2}"); + resultConfig.addParam("param3", "${#value3}"); + + + + ActionContext context = ActionContext.getContext(); + ValueStack stack = context.getValueStack(); + context.getContextMap().put("value1", "value 1"); + context.getContextMap().put("value2", "value 2"); + context.getContextMap().put("value3", "value 3"); + MockHttpServletRequest req = new MockHttpServletRequest(); + MockHttpServletResponse res = new MockHttpServletResponse(); + context.put(ServletActionContext.HTTP_REQUEST, req); + context.put(ServletActionContext.HTTP_RESPONSE, res); + + + Map results= new HashMap(); + results.put("myResult", resultConfig); + + ActionConfig actionConfig = new ActionConfig(); + actionConfig.setResults(results); + + ServletActionRedirectResult result = new ServletActionRedirectResult(); + result.setActionName("myAction"); + result.setNamespace("/myNamespace"); + result.setParse(true); + result.setEncode(false); + result.setPrependServletContext(false); + + IMocksControl control = EasyMock.createControl(); + ActionProxy mockActionProxy = control.createMock(ActionProxy.class); + ActionInvocation mockInvocation = control.createMock(ActionInvocation.class); + mockInvocation.getProxy(); + control.andReturn(mockActionProxy); + mockInvocation.getResultCode(); + control.andReturn("myResult"); + mockActionProxy.getConfig(); + control.andReturn(actionConfig); + mockInvocation.getInvocationContext(); + control.andReturn(context); + mockInvocation.getStack(); + control.andReturn(stack); + control.anyTimes(); + + control.replay(); + + result.execute(mockInvocation); + assertEquals("/myNamespace/myAction.action?param2=value+2¶m1=value+1¶m3=value+3", res.getRedirectedUrl()); + + control.verify(); + } + + public void testIncludeParameterInResult() throws Exception { + + ResultConfig resultConfig = new ResultConfig(); + resultConfig.addParam("actionName", "someActionName"); + resultConfig.addParam("namespace", "someNamespace"); + resultConfig.addParam("encode", "true"); + resultConfig.addParam("parse", "true"); + resultConfig.addParam("location", "someLocation"); + resultConfig.addParam("prependServletContext", "true"); + resultConfig.addParam("method", "someMethod"); + resultConfig.addParam("param1", "value 1"); + resultConfig.addParam("param2", "value 2"); + resultConfig.addParam("param3", "value 3"); + + ActionContext context = ActionContext.getContext(); + MockHttpServletRequest req = new MockHttpServletRequest(); + MockHttpServletResponse res = new MockHttpServletResponse(); + context.put(ServletActionContext.HTTP_REQUEST, req); + context.put(ServletActionContext.HTTP_RESPONSE, res); + + + Map results= new HashMap(); + results.put("myResult", resultConfig); + + ActionConfig actionConfig = new ActionConfig(); + actionConfig.setResults(results); + + ServletActionRedirectResult result = new ServletActionRedirectResult(); + result.setActionName("myAction"); + result.setNamespace("/myNamespace"); + result.setParse(false); + result.setEncode(false); + result.setPrependServletContext(false); + + IMocksControl control = EasyMock.createControl(); + ActionProxy mockActionProxy = control.createMock(ActionProxy.class); + ActionInvocation mockInvocation = control.createMock(ActionInvocation.class); + mockInvocation.getProxy(); + control.andReturn(mockActionProxy); + mockInvocation.getResultCode(); + control.andReturn("myResult"); + mockActionProxy.getConfig(); + control.andReturn(actionConfig); + mockInvocation.getInvocationContext(); + control.andReturn(context); + + control.replay(); + + result.execute(mockInvocation); + assertEquals("/myNamespace/myAction.action?param2=value+2¶m1=value+1¶m3=value+3", res.getRedirectedUrl()); + + control.verify(); + } } diff --git a/core/src/test/java/org/apache/struts2/dispatcher/ServletDispatchedTestAssertInterceptor.java b/core/src/test/java/org/apache/struts2/dispatcher/ServletDispatchedTestAssertInterceptor.java index e5aa35171..058096831 100644 --- a/core/src/test/java/org/apache/struts2/dispatcher/ServletDispatchedTestAssertInterceptor.java +++ b/core/src/test/java/org/apache/struts2/dispatcher/ServletDispatchedTestAssertInterceptor.java @@ -1,19 +1,22 @@ /* * $Id$ * - * Copyright 2006 The Apache Software Foundation. + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at + * http://www.apache.org/licenses/LICENSE-2.0 * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. */ package org.apache.struts2.dispatcher; @@ -28,10 +31,10 @@ import com.opensymphony.xwork2.interceptor.Interceptor; /** */ public class ServletDispatchedTestAssertInterceptor implements Interceptor { - - private static final long serialVersionUID = 1980347231443329805L; - public ServletDispatchedTestAssertInterceptor() { + private static final long serialVersionUID = 1980347231443329805L; + + public ServletDispatchedTestAssertInterceptor() { super(); } diff --git a/core/src/test/java/org/apache/struts2/dispatcher/ServletDispatcherResultTest.java b/core/src/test/java/org/apache/struts2/dispatcher/ServletDispatcherResultTest.java index 8e4f59bae..12e90d9fd 100644 --- a/core/src/test/java/org/apache/struts2/dispatcher/ServletDispatcherResultTest.java +++ b/core/src/test/java/org/apache/struts2/dispatcher/ServletDispatcherResultTest.java @@ -1,19 +1,22 @@ /* * $Id$ * - * Copyright 2006 The Apache Software Foundation. + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at + * http://www.apache.org/licenses/LICENSE-2.0 * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. */ package org.apache.struts2.dispatcher; diff --git a/core/src/test/java/org/apache/struts2/dispatcher/ServletRedirectResultTest.java b/core/src/test/java/org/apache/struts2/dispatcher/ServletRedirectResultTest.java index a9f9c7638..4a30a77ff 100644 --- a/core/src/test/java/org/apache/struts2/dispatcher/ServletRedirectResultTest.java +++ b/core/src/test/java/org/apache/struts2/dispatcher/ServletRedirectResultTest.java @@ -1,19 +1,22 @@ /* * $Id$ * - * Copyright 2006 The Apache Software Foundation. + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at + * http://www.apache.org/licenses/LICENSE-2.0 * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. */ package org.apache.struts2.dispatcher; @@ -104,7 +107,7 @@ public class ServletRedirectResultTest extends StrutsTestCase implements StrutsS du.setConfigurationManager(cm); du.getConfigurationManager().getConfiguration(). addPackageConfig("foo", new PackageConfig("foo", "/namespace", false, null)); - + view = new ServletRedirectResult(); diff --git a/core/src/test/java/org/apache/struts2/dispatcher/SessionMapTest.java b/core/src/test/java/org/apache/struts2/dispatcher/SessionMapTest.java index e32c0c625..25ec99d59 100644 --- a/core/src/test/java/org/apache/struts2/dispatcher/SessionMapTest.java +++ b/core/src/test/java/org/apache/struts2/dispatcher/SessionMapTest.java @@ -1,19 +1,22 @@ /* * $Id$ * - * Copyright 2006 The Apache Software Foundation. + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at + * http://www.apache.org/licenses/LICENSE-2.0 * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. */ package org.apache.struts2.dispatcher; @@ -44,29 +47,29 @@ public class SessionMapTest extends TestCase { public void testClearInvalidatesTheSession() throws Exception { - List attributeNames = new ArrayList(); - attributeNames.add("test"); - attributeNames.add("anotherTest"); - Enumeration attributeNamesEnum = Collections.enumeration(attributeNames); - + List attributeNames = new ArrayList(); + attributeNames.add("test"); + attributeNames.add("anotherTest"); + Enumeration attributeNamesEnum = Collections.enumeration(attributeNames); + MockSessionMap sessionMap = new MockSessionMap((HttpServletRequest) requestMock.proxy()); - sessionMock.expect("setAttribute", - new Constraint[] { - new IsEqual("test"), new IsEqual("test value") - }); - sessionMock.expect("setAttribute", - new Constraint[] { - new IsEqual("anotherTest"), new IsEqual("another test value") - }); + sessionMock.expect("setAttribute", + new Constraint[] { + new IsEqual("test"), new IsEqual("test value") + }); + sessionMock.expect("setAttribute", + new Constraint[] { + new IsEqual("anotherTest"), new IsEqual("another test value") + }); sessionMock.expectAndReturn("getAttributeNames", attributeNamesEnum); - sessionMock.expect("removeAttribute", - new Constraint[]{ - new IsEqual("test") - }); - sessionMock.expect("removeAttribute", - new Constraint[]{ - new IsEqual("anotherTest") - }); + sessionMock.expect("removeAttribute", + new Constraint[]{ + new IsEqual("test") + }); + sessionMock.expect("removeAttribute", + new Constraint[]{ + new IsEqual("anotherTest") + }); sessionMap.put("test", "test value"); sessionMap.put("anotherTest", "another test value"); sessionMap.clear(); @@ -161,10 +164,10 @@ public class SessionMapTest extends TestCase { * putting new data into the map. */ private class MockSessionMap extends SessionMap { - - private static final long serialVersionUID = 8783604360786273764L; - - private Map map = new HashMap(); + + private static final long serialVersionUID = 8783604360786273764L; + + private Map map = new HashMap(); public MockSessionMap(HttpServletRequest request) { super(request); @@ -180,10 +183,10 @@ public class SessionMapTest extends TestCase { return originalValue; } - + public void clear() { - super.clear(); - map.clear(); + super.clear(); + map.clear(); } } } diff --git a/core/src/test/java/org/apache/struts2/dispatcher/StreamResultTest.java b/core/src/test/java/org/apache/struts2/dispatcher/StreamResultTest.java index 66475aca1..87c9f6f65 100644 --- a/core/src/test/java/org/apache/struts2/dispatcher/StreamResultTest.java +++ b/core/src/test/java/org/apache/struts2/dispatcher/StreamResultTest.java @@ -1,19 +1,22 @@ /* * $Id$ * - * Copyright 2006 The Apache Software Foundation. + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at + * http://www.apache.org/licenses/LICENSE-2.0 * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. */ package org.apache.struts2.dispatcher; @@ -111,9 +114,9 @@ public class StreamResultTest extends TestCase { } public void testStreamResultParse1() throws Exception { - /////////////////// + /////////////////// result.setParse(true); - // ${...} conditionalParse of Result, returns String, + // ${...} conditionalParse of Result, returns String, // which gets evaluated to the stack, that's how it works. // We use ${streamForImageAsString} that returns "streamForImage" // which is a property that returns an InputStream object. @@ -135,13 +138,13 @@ public class StreamResultTest extends TestCase { assertEquals(contentLength, response.getContentLength()); assertEquals("filename=\"logo.png\"", response.getHeader("Content-disposition")); } - + public void testStreamResultParse2() throws Exception { - /////////////////// + /////////////////// result.setParse(true); // This time we dun use ${...}, so streamForImage will // be evaluated to the stack, which should reaturn an - // InputStream object, cause there's such a property in + // InputStream object, cause there's such a property in // the action object itself. result.setInputName("streamForImage"); result.setBufferSize(128); @@ -180,8 +183,8 @@ public class StreamResultTest extends TestCase { ActionContext.getContext().put(ServletActionContext.HTTP_RESPONSE, response); } - - + + protected void tearDown() { response = null; @@ -194,7 +197,7 @@ public class StreamResultTest extends TestCase { public class MyImageAction implements Action { public InputStream getStreamForImage() throws Exception { - // just use src/test/log4j.properties as test file + // just use src/test/log4j.properties as test file URL url = ClassLoaderUtil.getResource("log4j.properties", StreamResultTest.class); File file = new File(new URI(url.toString())); FileInputStream fis = new FileInputStream(file); @@ -210,9 +213,9 @@ public class StreamResultTest extends TestCase { File file = new File(new URI(url.toString())); return file.length(); } - + public String getStreamForImageAsString() { - return "streamForImage"; + return "streamForImage"; } } diff --git a/core/src/test/java/org/apache/struts2/dispatcher/StrutsResultSupportTest.java b/core/src/test/java/org/apache/struts2/dispatcher/StrutsResultSupportTest.java index a370a58e4..af6d9d6c5 100644 --- a/core/src/test/java/org/apache/struts2/dispatcher/StrutsResultSupportTest.java +++ b/core/src/test/java/org/apache/struts2/dispatcher/StrutsResultSupportTest.java @@ -1,19 +1,22 @@ /* * $Id$ * - * Copyright 2006 The Apache Software Foundation. + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at + * http://www.apache.org/licenses/LICENSE-2.0 * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. */ package org.apache.struts2.dispatcher; @@ -30,91 +33,91 @@ import com.opensymphony.xwork2.util.ValueStackFactory; */ public class StrutsResultSupportTest extends StrutsTestCase { - - public void testParse() throws Exception { - ValueStack stack = ValueStackFactory.getFactory().createValueStack(); - stack.push(new ActionSupport() { - public String getMyLocation() { - return "ThisIsMyLocation"; - } - }); - - ActionInvocation mockActionInvocation = EasyMock.createNiceMock(ActionInvocation.class); - mockActionInvocation.getStack(); - EasyMock.expectLastCall().andReturn(stack); - EasyMock.replay(mockActionInvocation); - - InternalStrutsResultSupport result = new InternalStrutsResultSupport(); - result.setParse(true); - result.setEncode(false); - result.setLocation("/pages/myJsp.jsp?location=${myLocation}"); - - result.execute(mockActionInvocation); - - assertNotNull(result.getInternalLocation()); - assertEquals("/pages/myJsp.jsp?location=ThisIsMyLocation", result.getInternalLocation()); - EasyMock.verify(mockActionInvocation); - } - - public void testParseAndEncode() throws Exception { - ValueStack stack = ValueStackFactory.getFactory().createValueStack(); - stack.push(new ActionSupport() { - public String getMyLocation() { - return "/myPage?param=value¶m1=value1"; - } - }); - - ActionInvocation mockActionInvocation = EasyMock.createNiceMock(ActionInvocation.class); - mockActionInvocation.getStack(); - EasyMock.expectLastCall().andReturn(stack); - EasyMock.replay(mockActionInvocation); - - InternalStrutsResultSupport result = new InternalStrutsResultSupport(); - result.setParse(true); - result.setEncode(true); - result.setLocation("/pages/myJsp.jsp?location=${myLocation}"); - - result.execute(mockActionInvocation); - - assertNotNull(result.getInternalLocation()); - assertEquals("/pages/myJsp.jsp?location=%2FmyPage%3Fparam%3Dvalue%26param1%3Dvalue1", result.getInternalLocation()); - EasyMock.verify(mockActionInvocation); - } - - - public void testNoParseAndEncode() throws Exception { - ValueStack stack = ValueStackFactory.getFactory().createValueStack(); - stack.push(new ActionSupport() { - public String getMyLocation() { - return "myLocation.jsp"; - } - }); - - ActionInvocation mockActionInvocation = EasyMock.createNiceMock(ActionInvocation.class); - EasyMock.replay(mockActionInvocation); - - InternalStrutsResultSupport result = new InternalStrutsResultSupport(); - result.setParse(false); - result.setEncode(false); // don't really need this, as encode is only valid when parse is true. - result.setLocation("/pages/myJsp.jsp?location=${myLocation}"); - - result.execute(mockActionInvocation); - - assertNotNull(result.getInternalLocation()); - assertEquals("/pages/myJsp.jsp?location=${myLocation}", result.getInternalLocation()); - EasyMock.verify(mockActionInvocation); - } - - - public static class InternalStrutsResultSupport extends StrutsResultSupport { - private String _internalLocation = null; - - protected void doExecute(String finalLocation, ActionInvocation invocation) throws Exception { - _internalLocation = finalLocation; - } - - public String getInternalLocation() { - return _internalLocation; - } - } + + public void testParse() throws Exception { + ValueStack stack = ValueStackFactory.getFactory().createValueStack(); + stack.push(new ActionSupport() { + public String getMyLocation() { + return "ThisIsMyLocation"; + } + }); + + ActionInvocation mockActionInvocation = EasyMock.createNiceMock(ActionInvocation.class); + mockActionInvocation.getStack(); + EasyMock.expectLastCall().andReturn(stack); + EasyMock.replay(mockActionInvocation); + + InternalStrutsResultSupport result = new InternalStrutsResultSupport(); + result.setParse(true); + result.setEncode(false); + result.setLocation("/pages/myJsp.jsp?location=${myLocation}"); + + result.execute(mockActionInvocation); + + assertNotNull(result.getInternalLocation()); + assertEquals("/pages/myJsp.jsp?location=ThisIsMyLocation", result.getInternalLocation()); + EasyMock.verify(mockActionInvocation); + } + + public void testParseAndEncode() throws Exception { + ValueStack stack = ValueStackFactory.getFactory().createValueStack(); + stack.push(new ActionSupport() { + public String getMyLocation() { + return "/myPage?param=value¶m1=value1"; + } + }); + + ActionInvocation mockActionInvocation = EasyMock.createNiceMock(ActionInvocation.class); + mockActionInvocation.getStack(); + EasyMock.expectLastCall().andReturn(stack); + EasyMock.replay(mockActionInvocation); + + InternalStrutsResultSupport result = new InternalStrutsResultSupport(); + result.setParse(true); + result.setEncode(true); + result.setLocation("/pages/myJsp.jsp?location=${myLocation}"); + + result.execute(mockActionInvocation); + + assertNotNull(result.getInternalLocation()); + assertEquals("/pages/myJsp.jsp?location=%2FmyPage%3Fparam%3Dvalue%26param1%3Dvalue1", result.getInternalLocation()); + EasyMock.verify(mockActionInvocation); + } + + + public void testNoParseAndEncode() throws Exception { + ValueStack stack = ValueStackFactory.getFactory().createValueStack(); + stack.push(new ActionSupport() { + public String getMyLocation() { + return "myLocation.jsp"; + } + }); + + ActionInvocation mockActionInvocation = EasyMock.createNiceMock(ActionInvocation.class); + EasyMock.replay(mockActionInvocation); + + InternalStrutsResultSupport result = new InternalStrutsResultSupport(); + result.setParse(false); + result.setEncode(false); // don't really need this, as encode is only valid when parse is true. + result.setLocation("/pages/myJsp.jsp?location=${myLocation}"); + + result.execute(mockActionInvocation); + + assertNotNull(result.getInternalLocation()); + assertEquals("/pages/myJsp.jsp?location=${myLocation}", result.getInternalLocation()); + EasyMock.verify(mockActionInvocation); + } + + + public static class InternalStrutsResultSupport extends StrutsResultSupport { + private String _internalLocation = null; + + protected void doExecute(String finalLocation, ActionInvocation invocation) throws Exception { + _internalLocation = finalLocation; + } + + public String getInternalLocation() { + return _internalLocation; + } + } } diff --git a/core/src/test/java/org/apache/struts2/dispatcher/VelocityResultTest.java b/core/src/test/java/org/apache/struts2/dispatcher/VelocityResultTest.java index bbc18c079..e1f736c9c 100644 --- a/core/src/test/java/org/apache/struts2/dispatcher/VelocityResultTest.java +++ b/core/src/test/java/org/apache/struts2/dispatcher/VelocityResultTest.java @@ -1,19 +1,22 @@ /* * $Id$ * - * Copyright 2006 The Apache Software Foundation. + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at + * http://www.apache.org/licenses/LICENSE-2.0 * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. */ package org.apache.struts2.dispatcher; @@ -33,7 +36,7 @@ import com.opensymphony.xwork2.util.ValueStackFactory; /** - * + * */ public class VelocityResultTest extends TestCase { @@ -116,10 +119,10 @@ public class VelocityResultTest extends TestCase { } class TestResult extends StrutsResultSupport { - - private static final long serialVersionUID = -1512206785088317315L; - - public String finalLocation; + + private static final long serialVersionUID = -1512206785088317315L; + + public String finalLocation; protected void doExecute(String finalLocation, ActionInvocation invocation) throws Exception { this.finalLocation = finalLocation; diff --git a/core/src/test/java/org/apache/struts2/dispatcher/mapper/CompositeActionMapperTest.java b/core/src/test/java/org/apache/struts2/dispatcher/mapper/CompositeActionMapperTest.java index 773e73c8a..6a6f7e282 100644 --- a/core/src/test/java/org/apache/struts2/dispatcher/mapper/CompositeActionMapperTest.java +++ b/core/src/test/java/org/apache/struts2/dispatcher/mapper/CompositeActionMapperTest.java @@ -1,19 +1,22 @@ /* - * $Id: ActionMapper.java 449367 2006-09-24 06:49:04Z mrdon $ + * $Id: $ * - * Copyright 2006 The Apache Software Foundation. + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at + * http://www.apache.org/licenses/LICENSE-2.0 * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. */ package org.apache.struts2.dispatcher.mapper; @@ -34,314 +37,314 @@ import com.opensymphony.xwork2.config.ConfigurationManager; import junit.framework.TestCase; /** - * + * * @version $Date$ $Id$ */ public class CompositeActionMapperTest extends TestCase { - - /** - * Test with empty settings (settings with no entries of interest) - * - * @throws Exception - */ - public void testGetOrderActionMapperEntries1() throws Exception { - CompositeActionMapper compositeActionMapper = new CompositeActionMapper(); - List result = - compositeActionMapper.getOrderedActionMapperEntries(); - - assertEquals(result.size(), 0); - } - - /** - * Test with a normal settings. - * - * @throws Exception - */ - public void testGetOrderActionMapperEntries2() throws Exception { - CompositeActionMapper compositeActionMapper = new CompositeActionMapper(); - - Settings old = Settings.getInstance(); - try { - Settings.setInstance(new InnerSettings()); - Settings.set(StrutsConstants.STRUTS_MAPPER_COMPOSITE+"1", InnerActionMapper1.class.getName()); - Settings.set(StrutsConstants.STRUTS_MAPPER_COMPOSITE+"2", InnerActionMapper2.class.getName()); - Settings.set(StrutsConstants.STRUTS_MAPPER_COMPOSITE+"3", InnerActionMapper3.class.getName()); - - List result = - compositeActionMapper.getOrderedActionMapperEntries(); - - assertEquals(result.size(), 3); - - IndividualActionMapperEntry e = null; - Iterator i = result.iterator(); - - // 1 - e = i.next(); - - assertEquals(e.order, new Integer(1)); - assertEquals(e.propertyName, StrutsConstants.STRUTS_MAPPER_COMPOSITE+"1"); - assertEquals(e.propertyValue, InnerActionMapper1.class.getName()); - assertEquals(e.actionMapper.getClass(), InnerActionMapper1.class); - - // 2 - e = i.next(); - - assertEquals(e.order, new Integer(2)); - assertEquals(e.propertyName, StrutsConstants.STRUTS_MAPPER_COMPOSITE+"2"); - assertEquals(e.propertyValue, InnerActionMapper2.class.getName()); - assertEquals(e.actionMapper.getClass(), InnerActionMapper2.class); - - // 3 - e = i.next(); - assertEquals(e.order, new Integer(3)); - assertEquals(e.propertyName, StrutsConstants.STRUTS_MAPPER_COMPOSITE+"3"); - assertEquals(e.propertyValue, InnerActionMapper3.class.getName()); - assertEquals(e.actionMapper.getClass(), InnerActionMapper3.class); - } - finally { - Settings.setInstance(old); - } - } - - /** - * Test with settings where entries are out-of-order, it needs to be able to retrieve them - * back in proper order. - * - * @throws Exception - */ - public void testGetOrderActionMapperEntries3() throws Exception { - CompositeActionMapper compositeActionMapper = new CompositeActionMapper(); - - Settings old = Settings.getInstance(); - try { - Settings.setInstance(new InnerSettings()); - Settings.set(StrutsConstants.STRUTS_MAPPER_COMPOSITE+"3", InnerActionMapper3.class.getName()); - Settings.set(StrutsConstants.STRUTS_MAPPER_COMPOSITE+"2", InnerActionMapper2.class.getName()); - Settings.set(StrutsConstants.STRUTS_MAPPER_COMPOSITE+"1", InnerActionMapper1.class.getName()); - - List result = - compositeActionMapper.getOrderedActionMapperEntries(); - - assertEquals(result.size(), 3); - - IndividualActionMapperEntry e = null; - Iterator i = result.iterator(); - - // 1 - e = i.next(); - - assertEquals(e.order, new Integer(1)); - assertEquals(e.propertyName, StrutsConstants.STRUTS_MAPPER_COMPOSITE+"1"); - assertEquals(e.propertyValue, InnerActionMapper1.class.getName()); - assertEquals(e.actionMapper.getClass(), InnerActionMapper1.class); - - // 2 - e = i.next(); - - assertEquals(e.order, new Integer(2)); - assertEquals(e.propertyName, StrutsConstants.STRUTS_MAPPER_COMPOSITE+"2"); - assertEquals(e.propertyValue, InnerActionMapper2.class.getName()); - assertEquals(e.actionMapper.getClass(), InnerActionMapper2.class); - - // 3 - e = i.next(); - assertEquals(e.order, new Integer(3)); - assertEquals(e.propertyName, StrutsConstants.STRUTS_MAPPER_COMPOSITE+"3"); - assertEquals(e.propertyValue, InnerActionMapper3.class.getName()); - assertEquals(e.actionMapper.getClass(), InnerActionMapper3.class); - } - finally { - Settings.setInstance(old); - } - } - - /** - * Test with a bad entry - * - * @throws Exception - */ - public void testGetOrderActionMapperEntries4() throws Exception { - CompositeActionMapper compositeActionMapper = new CompositeActionMapper(); - - Settings old = Settings.getInstance(); - try { - Settings.setInstance(new InnerSettings()); - Settings.set(StrutsConstants.STRUTS_MAPPER_COMPOSITE+"1", InnerActionMapper1.class.getName()); - Settings.set(StrutsConstants.STRUTS_MAPPER_COMPOSITE+"NotANumber", InnerActionMapper2.class.getName()); - Settings.set(StrutsConstants.STRUTS_MAPPER_COMPOSITE+"3", InnerActionMapper3.class.getName()); - - List result = - compositeActionMapper.getOrderedActionMapperEntries(); - - assertEquals(result.size(), 2); - - IndividualActionMapperEntry e = null; - Iterator i = result.iterator(); - - // 1 - e = i.next(); - - assertEquals(e.order, new Integer(1)); - assertEquals(e.propertyName, StrutsConstants.STRUTS_MAPPER_COMPOSITE+"1"); - assertEquals(e.propertyValue, InnerActionMapper1.class.getName()); - assertEquals(e.actionMapper.getClass(), InnerActionMapper1.class); - - // 2 - e = i.next(); - assertEquals(e.order, new Integer(3)); - assertEquals(e.propertyName, StrutsConstants.STRUTS_MAPPER_COMPOSITE+"3"); - assertEquals(e.propertyValue, InnerActionMapper3.class.getName()); - assertEquals(e.actionMapper.getClass(), InnerActionMapper3.class); - } - finally { - Settings.setInstance(old); - } - } - - /** - * Test with an entry where the action mapper class is bogus. - * @throws Exception - */ - public void testGetOrderActionMapperEntries5() throws Exception { - CompositeActionMapper compositeActionMapper = new CompositeActionMapper(); - - Settings old = Settings.getInstance(); - try { - Settings.setInstance(new InnerSettings()); - Settings.set(StrutsConstants.STRUTS_MAPPER_COMPOSITE+"1", InnerActionMapper1.class.getName()); - Settings.set(StrutsConstants.STRUTS_MAPPER_COMPOSITE+"2", "bogus.class.name"); - Settings.set(StrutsConstants.STRUTS_MAPPER_COMPOSITE+"3", InnerActionMapper3.class.getName()); - - List result = - compositeActionMapper.getOrderedActionMapperEntries(); - - assertEquals(result.size(), 2); - - IndividualActionMapperEntry e = null; - Iterator i = result.iterator(); - - // 1 - e = i.next(); - - assertEquals(e.order, new Integer(1)); - assertEquals(e.propertyName, StrutsConstants.STRUTS_MAPPER_COMPOSITE+"1"); - assertEquals(e.propertyValue, InnerActionMapper1.class.getName()); - assertEquals(e.actionMapper.getClass(), InnerActionMapper1.class); - - - // 2 - e = i.next(); - assertEquals(e.order, new Integer(3)); - assertEquals(e.propertyName, StrutsConstants.STRUTS_MAPPER_COMPOSITE+"3"); - assertEquals(e.propertyValue, InnerActionMapper3.class.getName()); - assertEquals(e.actionMapper.getClass(), InnerActionMapper3.class); - } - finally { - Settings.setInstance(old); - } - } - - - - public void testGetActionMappingAndUri1() throws Exception { - CompositeActionMapper compositeActionMapper = new CompositeActionMapper(); - - Settings old = Settings.getInstance(); - try { - Settings.setInstance(new InnerSettings()); - Settings.set(StrutsConstants.STRUTS_MAPPER_COMPOSITE+"1", InnerActionMapper1.class.getName()); - Settings.set(StrutsConstants.STRUTS_MAPPER_COMPOSITE+"2", InnerActionMapper2.class.getName()); - Settings.set(StrutsConstants.STRUTS_MAPPER_COMPOSITE+"3", InnerActionMapper3.class.getName()); - - - ActionMapping actionMapping = compositeActionMapper.getMapping(new MockHttpServletRequest(), new ConfigurationManager()); - String uri = compositeActionMapper.getUriFromActionMapping(new ActionMapping()); - - assertNotNull(actionMapping); - assertNotNull(uri); - assertTrue(actionMapping == InnerActionMapper3.actionMapping); - assertTrue(uri == InnerActionMapper3.uri); - } - finally { - Settings.setInstance(old); - } - } - - public void testGetActionMappingAndUri2() throws Exception { - CompositeActionMapper compositeActionMapper = new CompositeActionMapper(); - - Settings old = Settings.getInstance(); - try { - Settings.setInstance(new InnerSettings()); - Settings.set(StrutsConstants.STRUTS_MAPPER_COMPOSITE+"1", InnerActionMapper1.class.getName()); - Settings.set(StrutsConstants.STRUTS_MAPPER_COMPOSITE+"2", InnerActionMapper2.class.getName()); - - - ActionMapping actionMapping = compositeActionMapper.getMapping(new MockHttpServletRequest(), new ConfigurationManager()); - String uri = compositeActionMapper.getUriFromActionMapping(new ActionMapping()); - - assertNull(actionMapping); - assertNull(uri); - } - finally { - Settings.setInstance(old); - } - } - - - public static class InnerActionMapper1 implements ActionMapper { - public static ActionMapping actionMapping = new ActionMapping(); - public static String uri="uri1"; - - public ActionMapping getMapping(HttpServletRequest request, ConfigurationManager configManager) { - return null; - } - public String getUriFromActionMapping(ActionMapping mapping) { - return null; - } - } - public static class InnerActionMapper2 implements ActionMapper { - public static ActionMapping actionMapping = new ActionMapping(); - public static String uri="uri2"; - - public ActionMapping getMapping(HttpServletRequest request, ConfigurationManager configManager) { - return null; - } - public String getUriFromActionMapping(ActionMapping mapping) { - return null; - } - } - public static class InnerActionMapper3 implements ActionMapper { - public static ActionMapping actionMapping = new ActionMapping(); - public static String uri = "uri3"; - - public ActionMapping getMapping(HttpServletRequest request, ConfigurationManager configManager) { - return actionMapping; - } - public String getUriFromActionMapping(ActionMapping mapping) { - return uri; - } - } - - class InnerSettings extends Settings { - private Map _impl = new LinkedHashMap(); - - @Override - public boolean isSetImpl(String name) { - return _impl.containsKey(name); - } - @Override - public void setImpl(String name, String value) throws IllegalArgumentException, UnsupportedOperationException { - _impl.put(name, value); - } - @Override - public String getImpl(String name) throws IllegalArgumentException { - return (String) _impl.get(name); - } - @Override - public Iterator listImpl() { - return _impl.keySet().iterator(); - } - } - + + /** + * Test with empty settings (settings with no entries of interest) + * + * @throws Exception + */ + public void testGetOrderActionMapperEntries1() throws Exception { + CompositeActionMapper compositeActionMapper = new CompositeActionMapper(); + List result = + compositeActionMapper.getOrderedActionMapperEntries(); + + assertEquals(result.size(), 0); + } + + /** + * Test with a normal settings. + * + * @throws Exception + */ + public void testGetOrderActionMapperEntries2() throws Exception { + CompositeActionMapper compositeActionMapper = new CompositeActionMapper(); + + Settings old = Settings.getInstance(); + try { + Settings.setInstance(new InnerSettings()); + Settings.set(StrutsConstants.STRUTS_MAPPER_COMPOSITE+"1", InnerActionMapper1.class.getName()); + Settings.set(StrutsConstants.STRUTS_MAPPER_COMPOSITE+"2", InnerActionMapper2.class.getName()); + Settings.set(StrutsConstants.STRUTS_MAPPER_COMPOSITE+"3", InnerActionMapper3.class.getName()); + + List result = + compositeActionMapper.getOrderedActionMapperEntries(); + + assertEquals(result.size(), 3); + + IndividualActionMapperEntry e = null; + Iterator i = result.iterator(); + + // 1 + e = i.next(); + + assertEquals(e.order, new Integer(1)); + assertEquals(e.propertyName, StrutsConstants.STRUTS_MAPPER_COMPOSITE+"1"); + assertEquals(e.propertyValue, InnerActionMapper1.class.getName()); + assertEquals(e.actionMapper.getClass(), InnerActionMapper1.class); + + // 2 + e = i.next(); + + assertEquals(e.order, new Integer(2)); + assertEquals(e.propertyName, StrutsConstants.STRUTS_MAPPER_COMPOSITE+"2"); + assertEquals(e.propertyValue, InnerActionMapper2.class.getName()); + assertEquals(e.actionMapper.getClass(), InnerActionMapper2.class); + + // 3 + e = i.next(); + assertEquals(e.order, new Integer(3)); + assertEquals(e.propertyName, StrutsConstants.STRUTS_MAPPER_COMPOSITE+"3"); + assertEquals(e.propertyValue, InnerActionMapper3.class.getName()); + assertEquals(e.actionMapper.getClass(), InnerActionMapper3.class); + } + finally { + Settings.setInstance(old); + } + } + + /** + * Test with settings where entries are out-of-order, it needs to be able to retrieve them + * back in proper order. + * + * @throws Exception + */ + public void testGetOrderActionMapperEntries3() throws Exception { + CompositeActionMapper compositeActionMapper = new CompositeActionMapper(); + + Settings old = Settings.getInstance(); + try { + Settings.setInstance(new InnerSettings()); + Settings.set(StrutsConstants.STRUTS_MAPPER_COMPOSITE+"3", InnerActionMapper3.class.getName()); + Settings.set(StrutsConstants.STRUTS_MAPPER_COMPOSITE+"2", InnerActionMapper2.class.getName()); + Settings.set(StrutsConstants.STRUTS_MAPPER_COMPOSITE+"1", InnerActionMapper1.class.getName()); + + List result = + compositeActionMapper.getOrderedActionMapperEntries(); + + assertEquals(result.size(), 3); + + IndividualActionMapperEntry e = null; + Iterator i = result.iterator(); + + // 1 + e = i.next(); + + assertEquals(e.order, new Integer(1)); + assertEquals(e.propertyName, StrutsConstants.STRUTS_MAPPER_COMPOSITE+"1"); + assertEquals(e.propertyValue, InnerActionMapper1.class.getName()); + assertEquals(e.actionMapper.getClass(), InnerActionMapper1.class); + + // 2 + e = i.next(); + + assertEquals(e.order, new Integer(2)); + assertEquals(e.propertyName, StrutsConstants.STRUTS_MAPPER_COMPOSITE+"2"); + assertEquals(e.propertyValue, InnerActionMapper2.class.getName()); + assertEquals(e.actionMapper.getClass(), InnerActionMapper2.class); + + // 3 + e = i.next(); + assertEquals(e.order, new Integer(3)); + assertEquals(e.propertyName, StrutsConstants.STRUTS_MAPPER_COMPOSITE+"3"); + assertEquals(e.propertyValue, InnerActionMapper3.class.getName()); + assertEquals(e.actionMapper.getClass(), InnerActionMapper3.class); + } + finally { + Settings.setInstance(old); + } + } + + /** + * Test with a bad entry + * + * @throws Exception + */ + public void testGetOrderActionMapperEntries4() throws Exception { + CompositeActionMapper compositeActionMapper = new CompositeActionMapper(); + + Settings old = Settings.getInstance(); + try { + Settings.setInstance(new InnerSettings()); + Settings.set(StrutsConstants.STRUTS_MAPPER_COMPOSITE+"1", InnerActionMapper1.class.getName()); + Settings.set(StrutsConstants.STRUTS_MAPPER_COMPOSITE+"NotANumber", InnerActionMapper2.class.getName()); + Settings.set(StrutsConstants.STRUTS_MAPPER_COMPOSITE+"3", InnerActionMapper3.class.getName()); + + List result = + compositeActionMapper.getOrderedActionMapperEntries(); + + assertEquals(result.size(), 2); + + IndividualActionMapperEntry e = null; + Iterator i = result.iterator(); + + // 1 + e = i.next(); + + assertEquals(e.order, new Integer(1)); + assertEquals(e.propertyName, StrutsConstants.STRUTS_MAPPER_COMPOSITE+"1"); + assertEquals(e.propertyValue, InnerActionMapper1.class.getName()); + assertEquals(e.actionMapper.getClass(), InnerActionMapper1.class); + + // 2 + e = i.next(); + assertEquals(e.order, new Integer(3)); + assertEquals(e.propertyName, StrutsConstants.STRUTS_MAPPER_COMPOSITE+"3"); + assertEquals(e.propertyValue, InnerActionMapper3.class.getName()); + assertEquals(e.actionMapper.getClass(), InnerActionMapper3.class); + } + finally { + Settings.setInstance(old); + } + } + + /** + * Test with an entry where the action mapper class is bogus. + * @throws Exception + */ + public void testGetOrderActionMapperEntries5() throws Exception { + CompositeActionMapper compositeActionMapper = new CompositeActionMapper(); + + Settings old = Settings.getInstance(); + try { + Settings.setInstance(new InnerSettings()); + Settings.set(StrutsConstants.STRUTS_MAPPER_COMPOSITE+"1", InnerActionMapper1.class.getName()); + Settings.set(StrutsConstants.STRUTS_MAPPER_COMPOSITE+"2", "bogus.class.name"); + Settings.set(StrutsConstants.STRUTS_MAPPER_COMPOSITE+"3", InnerActionMapper3.class.getName()); + + List result = + compositeActionMapper.getOrderedActionMapperEntries(); + + assertEquals(result.size(), 2); + + IndividualActionMapperEntry e = null; + Iterator i = result.iterator(); + + // 1 + e = i.next(); + + assertEquals(e.order, new Integer(1)); + assertEquals(e.propertyName, StrutsConstants.STRUTS_MAPPER_COMPOSITE+"1"); + assertEquals(e.propertyValue, InnerActionMapper1.class.getName()); + assertEquals(e.actionMapper.getClass(), InnerActionMapper1.class); + + + // 2 + e = i.next(); + assertEquals(e.order, new Integer(3)); + assertEquals(e.propertyName, StrutsConstants.STRUTS_MAPPER_COMPOSITE+"3"); + assertEquals(e.propertyValue, InnerActionMapper3.class.getName()); + assertEquals(e.actionMapper.getClass(), InnerActionMapper3.class); + } + finally { + Settings.setInstance(old); + } + } + + + + public void testGetActionMappingAndUri1() throws Exception { + CompositeActionMapper compositeActionMapper = new CompositeActionMapper(); + + Settings old = Settings.getInstance(); + try { + Settings.setInstance(new InnerSettings()); + Settings.set(StrutsConstants.STRUTS_MAPPER_COMPOSITE+"1", InnerActionMapper1.class.getName()); + Settings.set(StrutsConstants.STRUTS_MAPPER_COMPOSITE+"2", InnerActionMapper2.class.getName()); + Settings.set(StrutsConstants.STRUTS_MAPPER_COMPOSITE+"3", InnerActionMapper3.class.getName()); + + + ActionMapping actionMapping = compositeActionMapper.getMapping(new MockHttpServletRequest(), new ConfigurationManager()); + String uri = compositeActionMapper.getUriFromActionMapping(new ActionMapping()); + + assertNotNull(actionMapping); + assertNotNull(uri); + assertTrue(actionMapping == InnerActionMapper3.actionMapping); + assertTrue(uri == InnerActionMapper3.uri); + } + finally { + Settings.setInstance(old); + } + } + + public void testGetActionMappingAndUri2() throws Exception { + CompositeActionMapper compositeActionMapper = new CompositeActionMapper(); + + Settings old = Settings.getInstance(); + try { + Settings.setInstance(new InnerSettings()); + Settings.set(StrutsConstants.STRUTS_MAPPER_COMPOSITE+"1", InnerActionMapper1.class.getName()); + Settings.set(StrutsConstants.STRUTS_MAPPER_COMPOSITE+"2", InnerActionMapper2.class.getName()); + + + ActionMapping actionMapping = compositeActionMapper.getMapping(new MockHttpServletRequest(), new ConfigurationManager()); + String uri = compositeActionMapper.getUriFromActionMapping(new ActionMapping()); + + assertNull(actionMapping); + assertNull(uri); + } + finally { + Settings.setInstance(old); + } + } + + + public static class InnerActionMapper1 implements ActionMapper { + public static ActionMapping actionMapping = new ActionMapping(); + public static String uri="uri1"; + + public ActionMapping getMapping(HttpServletRequest request, ConfigurationManager configManager) { + return null; + } + public String getUriFromActionMapping(ActionMapping mapping) { + return null; + } + } + public static class InnerActionMapper2 implements ActionMapper { + public static ActionMapping actionMapping = new ActionMapping(); + public static String uri="uri2"; + + public ActionMapping getMapping(HttpServletRequest request, ConfigurationManager configManager) { + return null; + } + public String getUriFromActionMapping(ActionMapping mapping) { + return null; + } + } + public static class InnerActionMapper3 implements ActionMapper { + public static ActionMapping actionMapping = new ActionMapping(); + public static String uri = "uri3"; + + public ActionMapping getMapping(HttpServletRequest request, ConfigurationManager configManager) { + return actionMapping; + } + public String getUriFromActionMapping(ActionMapping mapping) { + return uri; + } + } + + class InnerSettings extends Settings { + private Map _impl = new LinkedHashMap(); + + @Override + public boolean isSetImpl(String name) { + return _impl.containsKey(name); + } + @Override + public void setImpl(String name, String value) throws IllegalArgumentException, UnsupportedOperationException { + _impl.put(name, value); + } + @Override + public String getImpl(String name) throws IllegalArgumentException { + return (String) _impl.get(name); + } + @Override + public Iterator listImpl() { + return _impl.keySet().iterator(); + } + } + } diff --git a/core/src/test/java/org/apache/struts2/dispatcher/mapper/DefaultActionMapperTest.java b/core/src/test/java/org/apache/struts2/dispatcher/mapper/DefaultActionMapperTest.java index 762d9d835..f49218891 100644 --- a/core/src/test/java/org/apache/struts2/dispatcher/mapper/DefaultActionMapperTest.java +++ b/core/src/test/java/org/apache/struts2/dispatcher/mapper/DefaultActionMapperTest.java @@ -1,19 +1,22 @@ /* * $Id$ * - * Copyright 2006 The Apache Software Foundation. + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at + * http://www.apache.org/licenses/LICENSE-2.0 * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. */ package org.apache.struts2.dispatcher.mapper; @@ -48,7 +51,7 @@ public class DefaultActionMapperTest extends StrutsTestCase { req = new MockHttpServletRequest(); req.setupGetParameterMap(new HashMap()); req.setupGetContextPath("/my/namespace"); - + config = new DefaultConfiguration(); PackageConfig pkg = new PackageConfig("myns", "/my/namespace", false, null); PackageConfig pkg2 = new PackageConfig("my", "/my", false, null); @@ -90,9 +93,9 @@ public class DefaultActionMapperTest extends StrutsTestCase { assertEquals("actionName", mapping.getName()); assertEquals("add", mapping.getMethod()); } - + public void testGetMappingWithSlashedName() throws Exception { - + String old = Settings.get(StrutsConstants.STRUTS_ENABLE_SLASHES_IN_ACTION_NAMES); Settings.set(StrutsConstants.STRUTS_ENABLE_SLASHES_IN_ACTION_NAMES, "true"); try { @@ -112,7 +115,7 @@ public class DefaultActionMapperTest extends StrutsTestCase { } } - + public void testGetMappingWithUnknownNamespace() throws Exception { setUp(); req.setupGetRequestURI("/bo/foo/actionName.action"); @@ -174,7 +177,7 @@ public class DefaultActionMapperTest extends StrutsTestCase { org.apache.struts2.config.Settings.set(StrutsConstants.STRUTS_ACTION_EXTENSION, old); } } - + // ============================= // === test name & namespace === // ============================= @@ -208,7 +211,7 @@ public class DefaultActionMapperTest extends StrutsTestCase { assertEquals(actionMapping.getName(), "someAction"); assertEquals(actionMapping.getNamespace(), "/my"); } - + public void testParseNameAndNamespace_NoSlashes() throws Exception { String old = Settings.get(StrutsConstants.STRUTS_ENABLE_SLASHES_IN_ACTION_NAMES); Settings.set(StrutsConstants.STRUTS_ENABLE_SLASHES_IN_ACTION_NAMES, "false"); @@ -225,7 +228,7 @@ public class DefaultActionMapperTest extends StrutsTestCase { Settings.set(StrutsConstants.STRUTS_ENABLE_SLASHES_IN_ACTION_NAMES, old); } } - + public void testParseNameAndNamespace_AllowSlashes() throws Exception { String old = Settings.get(StrutsConstants.STRUTS_ENABLE_SLASHES_IN_ACTION_NAMES); Settings.set(StrutsConstants.STRUTS_ENABLE_SLASHES_IN_ACTION_NAMES, "true"); @@ -297,15 +300,15 @@ public class DefaultActionMapperTest extends StrutsTestCase { // TODO: need to test location but there's noaccess to the property/method, unless we use reflection } - + public void testDropExtension() throws Exception { DefaultActionMapper mapper = new DefaultActionMapper(); String name = mapper.dropExtension("foo.action"); assertTrue("Name not right: "+name, "foo".equals(name)); - + name = mapper.dropExtension("foo.action.action"); assertTrue("Name not right: "+name, "foo.action".equals(name)); - + } public void testGetUriFromActionMapper1() throws Exception { @@ -416,7 +419,7 @@ public class DefaultActionMapperTest extends StrutsTestCase { assertEquals("/myActionName.action?test=bla", uri); } - + public void testGetUriFromActionMapper11() throws Exception { DefaultActionMapper mapper = new DefaultActionMapper(); ActionMapping actionMapping = new ActionMapping(); @@ -426,7 +429,7 @@ public class DefaultActionMapperTest extends StrutsTestCase { assertEquals("/myActionName.action", uri); } - + public void testGetUriFromActionMapper12() throws Exception { DefaultActionMapper mapper = new DefaultActionMapper(); ActionMapping actionMapping = new ActionMapping(); diff --git a/core/src/test/java/org/apache/struts2/dispatcher/mapper/Restful2ActionMapperTest.java b/core/src/test/java/org/apache/struts2/dispatcher/mapper/Restful2ActionMapperTest.java index 8d44cb85d..2fa6587e9 100644 --- a/core/src/test/java/org/apache/struts2/dispatcher/mapper/Restful2ActionMapperTest.java +++ b/core/src/test/java/org/apache/struts2/dispatcher/mapper/Restful2ActionMapperTest.java @@ -1,19 +1,22 @@ /* - * $Id: RestfulActionMapper.java 449367 2006-09-24 06:49:04Z mrdon $ + * $Id: $ * - * Copyright 2006 The Apache Software Foundation. + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at + * http://www.apache.org/licenses/LICENSE-2.0 * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. */ package org.apache.struts2.dispatcher.mapper; diff --git a/core/src/test/java/org/apache/struts2/dispatcher/mapper/RestfulActionMapperTest.java b/core/src/test/java/org/apache/struts2/dispatcher/mapper/RestfulActionMapperTest.java index 6e95c2d82..9c64d08aa 100644 --- a/core/src/test/java/org/apache/struts2/dispatcher/mapper/RestfulActionMapperTest.java +++ b/core/src/test/java/org/apache/struts2/dispatcher/mapper/RestfulActionMapperTest.java @@ -1,19 +1,22 @@ /* * $Id$ * - * Copyright 2006 The Apache Software Foundation. + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at + * http://www.apache.org/licenses/LICENSE-2.0 * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. */ package org.apache.struts2.dispatcher.mapper; diff --git a/core/src/test/java/org/apache/struts2/impl/MessagesTest.java b/core/src/test/java/org/apache/struts2/impl/MessagesTest.java index d92b5dd74..fe4f9d887 100644 --- a/core/src/test/java/org/apache/struts2/impl/MessagesTest.java +++ b/core/src/test/java/org/apache/struts2/impl/MessagesTest.java @@ -1,3 +1,23 @@ +/* + * $Id$ + * + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ // Copyright 2006 Google Inc. All Rights Reserved. package org.apache.struts2.impl; diff --git a/core/src/test/java/org/apache/struts2/impl/RequestContextTest.java b/core/src/test/java/org/apache/struts2/impl/RequestContextTest.java index ec8cc9a0e..4ac9393a8 100644 --- a/core/src/test/java/org/apache/struts2/impl/RequestContextTest.java +++ b/core/src/test/java/org/apache/struts2/impl/RequestContextTest.java @@ -1,3 +1,23 @@ +/* + * $Id$ + * + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ // Copyright 2006 Google Inc. All Rights Reserved. package org.apache.struts2.impl; diff --git a/core/src/test/java/org/apache/struts2/interceptor/CreateSessionInterceptorTest.java b/core/src/test/java/org/apache/struts2/interceptor/CreateSessionInterceptorTest.java index d8602d538..f39aedbd0 100644 --- a/core/src/test/java/org/apache/struts2/interceptor/CreateSessionInterceptorTest.java +++ b/core/src/test/java/org/apache/struts2/interceptor/CreateSessionInterceptorTest.java @@ -1,19 +1,22 @@ /* * $Id$ * - * Copyright 2006 The Apache Software Foundation. + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at + * http://www.apache.org/licenses/LICENSE-2.0 * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. */ package org.apache.struts2.interceptor; @@ -29,20 +32,20 @@ import com.opensymphony.xwork2.mock.MockActionInvocation; /** * Test case for CreateSessionInterceptor. - * + * */ public class CreateSessionInterceptorTest extends StrutsTestCase { - public void testCreateSession() throws Exception { - Mock httpServletRequestMock = new Mock(HttpServletRequest.class); - httpServletRequestMock.expects(new InvokeOnceMatcher()).method("getSession").with(new IsEqual(Boolean.TRUE)); - HttpServletRequest request = (HttpServletRequest) httpServletRequestMock.proxy(); + public void testCreateSession() throws Exception { + Mock httpServletRequestMock = new Mock(HttpServletRequest.class); + httpServletRequestMock.expects(new InvokeOnceMatcher()).method("getSession").with(new IsEqual(Boolean.TRUE)); + HttpServletRequest request = (HttpServletRequest) httpServletRequestMock.proxy(); - ServletActionContext.setRequest(request); + ServletActionContext.setRequest(request); - CreateSessionInterceptor interceptor = new CreateSessionInterceptor(); - interceptor.intercept(new MockActionInvocation()); + CreateSessionInterceptor interceptor = new CreateSessionInterceptor(); + interceptor.intercept(new MockActionInvocation()); - httpServletRequestMock.verify(); - } + httpServletRequestMock.verify(); + } } diff --git a/core/src/test/java/org/apache/struts2/interceptor/ExecuteAndWaitDelayAction.java b/core/src/test/java/org/apache/struts2/interceptor/ExecuteAndWaitDelayAction.java index 0dde3ab18..06ce3ca26 100644 --- a/core/src/test/java/org/apache/struts2/interceptor/ExecuteAndWaitDelayAction.java +++ b/core/src/test/java/org/apache/struts2/interceptor/ExecuteAndWaitDelayAction.java @@ -1,19 +1,22 @@ /* * $Id$ * - * Copyright 2006 The Apache Software Foundation. + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at + * http://www.apache.org/licenses/LICENSE-2.0 * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. */ package org.apache.struts2.interceptor; diff --git a/core/src/test/java/org/apache/struts2/interceptor/ExecuteAndWaitInterceptorTest.java b/core/src/test/java/org/apache/struts2/interceptor/ExecuteAndWaitInterceptorTest.java index 19d71de77..af40001dd 100644 --- a/core/src/test/java/org/apache/struts2/interceptor/ExecuteAndWaitInterceptorTest.java +++ b/core/src/test/java/org/apache/struts2/interceptor/ExecuteAndWaitInterceptorTest.java @@ -1,19 +1,22 @@ /* * $Id$ * - * Copyright 2006 The Apache Software Foundation. + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at + * http://www.apache.org/licenses/LICENSE-2.0 * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. */ package org.apache.struts2.interceptor; diff --git a/core/src/test/java/org/apache/struts2/interceptor/FileUploadInterceptorTest.java b/core/src/test/java/org/apache/struts2/interceptor/FileUploadInterceptorTest.java index 9f121807b..61f81c03c 100644 --- a/core/src/test/java/org/apache/struts2/interceptor/FileUploadInterceptorTest.java +++ b/core/src/test/java/org/apache/struts2/interceptor/FileUploadInterceptorTest.java @@ -1,19 +1,22 @@ /* * $Id$ * - * Copyright 2006 The Apache Software Foundation. + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at + * http://www.apache.org/licenses/LICENSE-2.0 * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. */ package org.apache.struts2.interceptor; @@ -242,9 +245,9 @@ public class FileUploadInterceptorTest extends StrutsTestCase { private class MyFileupAction extends ActionSupport { - private static final long serialVersionUID = 6255238895447968889L; - - // no methods + private static final long serialVersionUID = 6255238895447968889L; + + // no methods } diff --git a/core/src/test/java/org/apache/struts2/interceptor/MessageStoreInterceptorTest.java b/core/src/test/java/org/apache/struts2/interceptor/MessageStoreInterceptorTest.java index 4b3ba7b75..49bea8397 100644 --- a/core/src/test/java/org/apache/struts2/interceptor/MessageStoreInterceptorTest.java +++ b/core/src/test/java/org/apache/struts2/interceptor/MessageStoreInterceptorTest.java @@ -1,19 +1,22 @@ /* * $Id$ * - * Copyright 2006 The Apache Software Foundation. + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at + * http://www.apache.org/licenses/LICENSE-2.0 * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. */ package org.apache.struts2.interceptor; @@ -34,211 +37,211 @@ import com.opensymphony.xwork2.ActionSupport; /** * Test case for MessageStoreInterceptor. - * + * * @version $Date$ $Id$ */ public class MessageStoreInterceptorTest extends StrutsTestCase { - public void testStoreMessage() throws Exception { - MessageStoreInterceptor interceptor = new MessageStoreInterceptor(); - interceptor.setAllowRequestParameterSwitch(true); - interceptor.setOperationMode(MessageStoreInterceptor.STORE_MODE); - - - Map paramMap = new LinkedHashMap(); - Map sessionMap = new LinkedHashMap(); - - ActionSupport action = new ActionSupport(); - action.addActionError("some action error 1"); - action.addActionError("some action error 2"); - action.addActionMessage("some action message 1"); - action.addActionMessage("some action message 2"); - action.addFieldError("field1", "some field error 1"); - action.addFieldError("field2", "some field error 2"); - - ActionContext actionContext = new ActionContext(new HashMap()); - actionContext.put(ActionContext.PARAMETERS, paramMap); - actionContext.put(ActionContext.SESSION, sessionMap); - - // Mock (ActionInvocation) - ActionInvocation mockActionInvocation = EasyMock.createControl().createMock(ActionInvocation.class); - mockActionInvocation.getInvocationContext(); - EasyMock.expectLastCall().andReturn(actionContext); - EasyMock.expectLastCall().anyTimes(); - - mockActionInvocation.invoke(); - EasyMock.expectLastCall().andReturn(Action.SUCCESS); - - mockActionInvocation.getAction(); - EasyMock.expectLastCall().andReturn(action); - - - EasyMock.replay(mockActionInvocation); - - interceptor.init(); - interceptor.intercept(mockActionInvocation); - interceptor.destroy(); - - assertEquals(sessionMap.size(), 3); - assertTrue(sessionMap.containsKey(MessageStoreInterceptor.actionErrorsSessionKey)); - assertTrue(sessionMap.containsKey(MessageStoreInterceptor.actionMessagesSessionKey)); - assertTrue(sessionMap.containsKey(MessageStoreInterceptor.fieldErrorsSessionKey)); - - List actionErrors = (List) sessionMap.get(MessageStoreInterceptor.actionErrorsSessionKey); - List actionMessages = (List) sessionMap.get(MessageStoreInterceptor.actionMessagesSessionKey); - Map fieldErrors = (Map) sessionMap.get(MessageStoreInterceptor.fieldErrorsSessionKey); - - assertEquals(actionErrors.size(), 2); - assertEquals(actionMessages.size(), 2); - assertEquals(fieldErrors.size(), 2); - - assertTrue(actionErrors.contains("some action error 1")); - assertTrue(actionErrors.contains("some action error 2")); - assertTrue(actionMessages.contains("some action message 1")); - assertTrue(actionMessages.contains("some action message 2")); - assertTrue(fieldErrors.containsKey("field1")); - assertTrue(fieldErrors.containsKey("field2")); - assertEquals(((List)fieldErrors.get("field1")).size(), 1); - assertEquals(((List)fieldErrors.get("field2")).size(), 1); - assertEquals(((List)fieldErrors.get("field1")).get(0), "some field error 1"); - assertEquals(((List)fieldErrors.get("field2")).get(0), "some field error 2"); - - EasyMock.verify(mockActionInvocation); - } - - public void testRetrieveMessage() throws Exception { - MessageStoreInterceptor interceptor = new MessageStoreInterceptor(); - interceptor.setOperationMode(MessageStoreInterceptor.RETRIEVE_MODE); - interceptor.setAllowRequestParameterSwitch(true); - - - ActionSupport action = new ActionSupport(); - - ActionInvocation mockActionInvocation = EasyMock.createControl().createMock(ActionInvocation.class); - mockActionInvocation.invoke(); - EasyMock.expectLastCall().andReturn(Action.SUCCESS); - - Map paramsMap = new LinkedHashMap(); - Map sessionMap = new LinkedHashMap(); - - List actionErrors = new ArrayList(); - List actionMessages = new ArrayList(); - Map fieldErrors = new LinkedHashMap(); - - actionErrors.add("some action error 1"); - actionErrors.add("some action error 2"); - actionMessages.add("some action messages 1"); - actionMessages.add("some action messages 2"); - List field1Errors = new ArrayList(); - field1Errors.add("some field error 1"); - List field2Errors = new ArrayList(); - field2Errors.add("some field error 2"); - fieldErrors.put("field1", field1Errors); - fieldErrors.put("field2", field2Errors); - - sessionMap.put(MessageStoreInterceptor.actionErrorsSessionKey, actionErrors); - sessionMap.put(MessageStoreInterceptor.actionMessagesSessionKey, actionMessages); - sessionMap.put(MessageStoreInterceptor.fieldErrorsSessionKey, fieldErrors); - - - ActionContext actionContext = new ActionContext(new HashMap()); - actionContext.put(ActionContext.PARAMETERS, paramsMap); - actionContext.put(ActionContext.SESSION, sessionMap); - - mockActionInvocation.getInvocationContext(); - EasyMock.expectLastCall().andReturn(actionContext); - EasyMock.expectLastCall().anyTimes(); - - mockActionInvocation.getAction(); - EasyMock.expectLastCall().andReturn(action); - - EasyMock.replay(mockActionInvocation); - - interceptor.init(); - interceptor.intercept(mockActionInvocation); - interceptor.destroy(); - - assertEquals(action.getActionErrors().size(), 2); - assertEquals(action.getActionMessages().size(), 2); - assertEquals(action.getFieldErrors().size(), 2); - assertTrue(action.getActionErrors().contains("some action error 1")); - assertTrue(action.getActionErrors().contains("some action error 2")); - assertTrue(action.getActionMessages().contains("some action messages 1")); - assertTrue(action.getActionMessages().contains("some action messages 2")); - assertEquals(((List)action.getFieldErrors().get("field1")).size(), 1); - assertEquals(((List)action.getFieldErrors().get("field2")).size(), 1); - assertEquals(((List)action.getFieldErrors().get("field1")).get(0), "some field error 1"); - assertEquals(((List)action.getFieldErrors().get("field2")).get(0), "some field error 2"); - - EasyMock.verify(mockActionInvocation); - } - - public void testRequestOperationMode1() throws Exception { - - Map paramMap = new LinkedHashMap(); - paramMap.put("operationMode", new String[] { MessageStoreInterceptor.RETRIEVE_MODE }); - - ActionContext actionContext = new ActionContext(new HashMap()); - actionContext.put(ActionContext.PARAMETERS, paramMap); - - ActionInvocation mockActionInvocation = EasyMock.createControl().createMock(ActionInvocation.class); - mockActionInvocation.getInvocationContext(); - EasyMock.expectLastCall().andReturn(actionContext); - EasyMock.expectLastCall().anyTimes(); - - EasyMock.replay(mockActionInvocation); - - MessageStoreInterceptor interceptor = new MessageStoreInterceptor(); - String operationMode = interceptor.getRequestOperationMode(mockActionInvocation); - - assertEquals(operationMode, MessageStoreInterceptor.RETRIEVE_MODE); - - EasyMock.verify(mockActionInvocation); - } - - public void testRequestOperationMode2() throws Exception { - - Map paramMap = new LinkedHashMap(); - paramMap.put("operationMode", new String[] { MessageStoreInterceptor.STORE_MODE }); - - ActionContext actionContext = new ActionContext(new HashMap()); - actionContext.put(ActionContext.PARAMETERS, paramMap); - - ActionInvocation mockActionInvocation = EasyMock.createControl().createMock(ActionInvocation.class); - mockActionInvocation.getInvocationContext(); - EasyMock.expectLastCall().andReturn(actionContext); - EasyMock.expectLastCall().anyTimes(); - - EasyMock.replay(mockActionInvocation); - - MessageStoreInterceptor interceptor = new MessageStoreInterceptor(); - String operationMode = interceptor.getRequestOperationMode(mockActionInvocation); - - assertEquals(operationMode, MessageStoreInterceptor.STORE_MODE); - - EasyMock.verify(mockActionInvocation); - } - - public void testRequestOperationMode3() throws Exception { - - Map paramMap = new LinkedHashMap(); - - ActionContext actionContext = new ActionContext(new HashMap()); - actionContext.put(ActionContext.PARAMETERS, paramMap); - - ActionInvocation mockActionInvocation = EasyMock.createControl().createMock(ActionInvocation.class); - mockActionInvocation.getInvocationContext(); - EasyMock.expectLastCall().andReturn(actionContext); - EasyMock.expectLastCall().anyTimes(); - - EasyMock.replay(mockActionInvocation); - - MessageStoreInterceptor interceptor = new MessageStoreInterceptor(); - String operationMode = interceptor.getRequestOperationMode(mockActionInvocation); - - assertEquals(operationMode, MessageStoreInterceptor.NONE); - - EasyMock.verify(mockActionInvocation); - - } + public void testStoreMessage() throws Exception { + MessageStoreInterceptor interceptor = new MessageStoreInterceptor(); + interceptor.setAllowRequestParameterSwitch(true); + interceptor.setOperationMode(MessageStoreInterceptor.STORE_MODE); + + + Map paramMap = new LinkedHashMap(); + Map sessionMap = new LinkedHashMap(); + + ActionSupport action = new ActionSupport(); + action.addActionError("some action error 1"); + action.addActionError("some action error 2"); + action.addActionMessage("some action message 1"); + action.addActionMessage("some action message 2"); + action.addFieldError("field1", "some field error 1"); + action.addFieldError("field2", "some field error 2"); + + ActionContext actionContext = new ActionContext(new HashMap()); + actionContext.put(ActionContext.PARAMETERS, paramMap); + actionContext.put(ActionContext.SESSION, sessionMap); + + // Mock (ActionInvocation) + ActionInvocation mockActionInvocation = EasyMock.createControl().createMock(ActionInvocation.class); + mockActionInvocation.getInvocationContext(); + EasyMock.expectLastCall().andReturn(actionContext); + EasyMock.expectLastCall().anyTimes(); + + mockActionInvocation.invoke(); + EasyMock.expectLastCall().andReturn(Action.SUCCESS); + + mockActionInvocation.getAction(); + EasyMock.expectLastCall().andReturn(action); + + + EasyMock.replay(mockActionInvocation); + + interceptor.init(); + interceptor.intercept(mockActionInvocation); + interceptor.destroy(); + + assertEquals(sessionMap.size(), 3); + assertTrue(sessionMap.containsKey(MessageStoreInterceptor.actionErrorsSessionKey)); + assertTrue(sessionMap.containsKey(MessageStoreInterceptor.actionMessagesSessionKey)); + assertTrue(sessionMap.containsKey(MessageStoreInterceptor.fieldErrorsSessionKey)); + + List actionErrors = (List) sessionMap.get(MessageStoreInterceptor.actionErrorsSessionKey); + List actionMessages = (List) sessionMap.get(MessageStoreInterceptor.actionMessagesSessionKey); + Map fieldErrors = (Map) sessionMap.get(MessageStoreInterceptor.fieldErrorsSessionKey); + + assertEquals(actionErrors.size(), 2); + assertEquals(actionMessages.size(), 2); + assertEquals(fieldErrors.size(), 2); + + assertTrue(actionErrors.contains("some action error 1")); + assertTrue(actionErrors.contains("some action error 2")); + assertTrue(actionMessages.contains("some action message 1")); + assertTrue(actionMessages.contains("some action message 2")); + assertTrue(fieldErrors.containsKey("field1")); + assertTrue(fieldErrors.containsKey("field2")); + assertEquals(((List)fieldErrors.get("field1")).size(), 1); + assertEquals(((List)fieldErrors.get("field2")).size(), 1); + assertEquals(((List)fieldErrors.get("field1")).get(0), "some field error 1"); + assertEquals(((List)fieldErrors.get("field2")).get(0), "some field error 2"); + + EasyMock.verify(mockActionInvocation); + } + + public void testRetrieveMessage() throws Exception { + MessageStoreInterceptor interceptor = new MessageStoreInterceptor(); + interceptor.setOperationMode(MessageStoreInterceptor.RETRIEVE_MODE); + interceptor.setAllowRequestParameterSwitch(true); + + + ActionSupport action = new ActionSupport(); + + ActionInvocation mockActionInvocation = EasyMock.createControl().createMock(ActionInvocation.class); + mockActionInvocation.invoke(); + EasyMock.expectLastCall().andReturn(Action.SUCCESS); + + Map paramsMap = new LinkedHashMap(); + Map sessionMap = new LinkedHashMap(); + + List actionErrors = new ArrayList(); + List actionMessages = new ArrayList(); + Map fieldErrors = new LinkedHashMap(); + + actionErrors.add("some action error 1"); + actionErrors.add("some action error 2"); + actionMessages.add("some action messages 1"); + actionMessages.add("some action messages 2"); + List field1Errors = new ArrayList(); + field1Errors.add("some field error 1"); + List field2Errors = new ArrayList(); + field2Errors.add("some field error 2"); + fieldErrors.put("field1", field1Errors); + fieldErrors.put("field2", field2Errors); + + sessionMap.put(MessageStoreInterceptor.actionErrorsSessionKey, actionErrors); + sessionMap.put(MessageStoreInterceptor.actionMessagesSessionKey, actionMessages); + sessionMap.put(MessageStoreInterceptor.fieldErrorsSessionKey, fieldErrors); + + + ActionContext actionContext = new ActionContext(new HashMap()); + actionContext.put(ActionContext.PARAMETERS, paramsMap); + actionContext.put(ActionContext.SESSION, sessionMap); + + mockActionInvocation.getInvocationContext(); + EasyMock.expectLastCall().andReturn(actionContext); + EasyMock.expectLastCall().anyTimes(); + + mockActionInvocation.getAction(); + EasyMock.expectLastCall().andReturn(action); + + EasyMock.replay(mockActionInvocation); + + interceptor.init(); + interceptor.intercept(mockActionInvocation); + interceptor.destroy(); + + assertEquals(action.getActionErrors().size(), 2); + assertEquals(action.getActionMessages().size(), 2); + assertEquals(action.getFieldErrors().size(), 2); + assertTrue(action.getActionErrors().contains("some action error 1")); + assertTrue(action.getActionErrors().contains("some action error 2")); + assertTrue(action.getActionMessages().contains("some action messages 1")); + assertTrue(action.getActionMessages().contains("some action messages 2")); + assertEquals(((List)action.getFieldErrors().get("field1")).size(), 1); + assertEquals(((List)action.getFieldErrors().get("field2")).size(), 1); + assertEquals(((List)action.getFieldErrors().get("field1")).get(0), "some field error 1"); + assertEquals(((List)action.getFieldErrors().get("field2")).get(0), "some field error 2"); + + EasyMock.verify(mockActionInvocation); + } + + public void testRequestOperationMode1() throws Exception { + + Map paramMap = new LinkedHashMap(); + paramMap.put("operationMode", new String[] { MessageStoreInterceptor.RETRIEVE_MODE }); + + ActionContext actionContext = new ActionContext(new HashMap()); + actionContext.put(ActionContext.PARAMETERS, paramMap); + + ActionInvocation mockActionInvocation = EasyMock.createControl().createMock(ActionInvocation.class); + mockActionInvocation.getInvocationContext(); + EasyMock.expectLastCall().andReturn(actionContext); + EasyMock.expectLastCall().anyTimes(); + + EasyMock.replay(mockActionInvocation); + + MessageStoreInterceptor interceptor = new MessageStoreInterceptor(); + String operationMode = interceptor.getRequestOperationMode(mockActionInvocation); + + assertEquals(operationMode, MessageStoreInterceptor.RETRIEVE_MODE); + + EasyMock.verify(mockActionInvocation); + } + + public void testRequestOperationMode2() throws Exception { + + Map paramMap = new LinkedHashMap(); + paramMap.put("operationMode", new String[] { MessageStoreInterceptor.STORE_MODE }); + + ActionContext actionContext = new ActionContext(new HashMap()); + actionContext.put(ActionContext.PARAMETERS, paramMap); + + ActionInvocation mockActionInvocation = EasyMock.createControl().createMock(ActionInvocation.class); + mockActionInvocation.getInvocationContext(); + EasyMock.expectLastCall().andReturn(actionContext); + EasyMock.expectLastCall().anyTimes(); + + EasyMock.replay(mockActionInvocation); + + MessageStoreInterceptor interceptor = new MessageStoreInterceptor(); + String operationMode = interceptor.getRequestOperationMode(mockActionInvocation); + + assertEquals(operationMode, MessageStoreInterceptor.STORE_MODE); + + EasyMock.verify(mockActionInvocation); + } + + public void testRequestOperationMode3() throws Exception { + + Map paramMap = new LinkedHashMap(); + + ActionContext actionContext = new ActionContext(new HashMap()); + actionContext.put(ActionContext.PARAMETERS, paramMap); + + ActionInvocation mockActionInvocation = EasyMock.createControl().createMock(ActionInvocation.class); + mockActionInvocation.getInvocationContext(); + EasyMock.expectLastCall().andReturn(actionContext); + EasyMock.expectLastCall().anyTimes(); + + EasyMock.replay(mockActionInvocation); + + MessageStoreInterceptor interceptor = new MessageStoreInterceptor(); + String operationMode = interceptor.getRequestOperationMode(mockActionInvocation); + + assertEquals(operationMode, MessageStoreInterceptor.NONE); + + EasyMock.verify(mockActionInvocation); + + } } diff --git a/core/src/test/java/org/apache/struts2/interceptor/RolesInterceptorTest.java b/core/src/test/java/org/apache/struts2/interceptor/RolesInterceptorTest.java index 7bbcfafc3..1db55fcf9 100644 --- a/core/src/test/java/org/apache/struts2/interceptor/RolesInterceptorTest.java +++ b/core/src/test/java/org/apache/struts2/interceptor/RolesInterceptorTest.java @@ -1,19 +1,22 @@ /* - * $Id: FileUploadInterceptorTest.java 441909 2006-09-10 05:28:16Z mrdon $ + * $Id: $ * - * Copyright 2006 The Apache Software Foundation. + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at + * http://www.apache.org/licenses/LICENSE-2.0 * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. */ package org.apache.struts2.interceptor; @@ -27,30 +30,30 @@ import com.mockobjects.servlet.MockHttpServletResponse; public class RolesInterceptorTest extends StrutsTestCase { private RolesInterceptor interceptor = new RolesInterceptor(); - + public void setUp() throws Exception { super.setUp(); interceptor = new RolesInterceptor(); } - + public void testStringToList() { List list = interceptor.stringToList("foo"); assertNotNull(list); assertEquals(1, list.size()); - + list = interceptor.stringToList("foo,bar"); assertEquals(2, list.size()); assertEquals("foo", (String)list.get(0)); - + list = interceptor.stringToList("foo, bar"); assertEquals(2, list.size()); assertEquals("bar", (String)list.get(1)); - + list = interceptor.stringToList("foo , bar"); assertEquals(2, list.size()); assertEquals("bar", (String)list.get(1)); } - + public void testIsAllowed() throws Exception { MockHttpServletRequest request = new MockHttpServletRequest() { public boolean isUserInRole(String role) { @@ -59,21 +62,21 @@ public class RolesInterceptorTest extends StrutsTestCase { }; interceptor.setAllowedRoles("admin"); assertTrue(interceptor.isAllowed(request, null)); - + interceptor.setAllowedRoles("bar, admin"); assertTrue(interceptor.isAllowed(request, null)); - + interceptor.setAllowedRoles(null); assertTrue(interceptor.isAllowed(request, null)); - + interceptor.setDisallowedRoles("bar"); assertTrue(interceptor.isAllowed(request, null)); - + interceptor.setDisallowedRoles("bar, admin"); assertTrue(!interceptor.isAllowed(request, null)); - + } - + public void testHandleRejection() throws Exception { MockHttpServletResponse response = new MockHttpServletResponse(); response.setExpectedError(response.SC_FORBIDDEN); diff --git a/core/src/test/java/org/apache/struts2/interceptor/ServletConfigInterceptorTest.java b/core/src/test/java/org/apache/struts2/interceptor/ServletConfigInterceptorTest.java index 2127aaad6..9fd4f6f35 100644 --- a/core/src/test/java/org/apache/struts2/interceptor/ServletConfigInterceptorTest.java +++ b/core/src/test/java/org/apache/struts2/interceptor/ServletConfigInterceptorTest.java @@ -1,19 +1,22 @@ /* * $Id$ * - * Copyright 2006 The Apache Software Foundation. + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at + * http://www.apache.org/licenses/LICENSE-2.0 * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. */ package org.apache.struts2.interceptor; diff --git a/core/src/test/java/org/apache/struts2/interceptor/StrutsConversionErrorInterceptorTest.java b/core/src/test/java/org/apache/struts2/interceptor/StrutsConversionErrorInterceptorTest.java index 734f77c01..efd07b23f 100644 --- a/core/src/test/java/org/apache/struts2/interceptor/StrutsConversionErrorInterceptorTest.java +++ b/core/src/test/java/org/apache/struts2/interceptor/StrutsConversionErrorInterceptorTest.java @@ -1,19 +1,22 @@ /* * $Id$ * - * Copyright 2006 The Apache Software Foundation. + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at + * http://www.apache.org/licenses/LICENSE-2.0 * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. */ package org.apache.struts2.interceptor; diff --git a/core/src/test/java/org/apache/struts2/interceptor/TokenInterceptorTest.java b/core/src/test/java/org/apache/struts2/interceptor/TokenInterceptorTest.java index ad17bfe37..9003ea0a1 100644 --- a/core/src/test/java/org/apache/struts2/interceptor/TokenInterceptorTest.java +++ b/core/src/test/java/org/apache/struts2/interceptor/TokenInterceptorTest.java @@ -1,19 +1,22 @@ /* * $Id$ * - * Copyright 2006 The Apache Software Foundation. + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at + * http://www.apache.org/licenses/LICENSE-2.0 * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. */ package org.apache.struts2.interceptor; diff --git a/core/src/test/java/org/apache/struts2/interceptor/TokenSessionStoreInterceptorTest.java b/core/src/test/java/org/apache/struts2/interceptor/TokenSessionStoreInterceptorTest.java index b4e3fa83b..5d0f71bdc 100644 --- a/core/src/test/java/org/apache/struts2/interceptor/TokenSessionStoreInterceptorTest.java +++ b/core/src/test/java/org/apache/struts2/interceptor/TokenSessionStoreInterceptorTest.java @@ -1,19 +1,22 @@ /* * $Id$ * - * Copyright 2006 The Apache Software Foundation. + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at + * http://www.apache.org/licenses/LICENSE-2.0 * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. */ package org.apache.struts2.interceptor; diff --git a/core/src/test/java/org/apache/struts2/portlet/PortletApplicationMapTest.java b/core/src/test/java/org/apache/struts2/portlet/PortletApplicationMapTest.java index 3bcc618a6..558041881 100644 --- a/core/src/test/java/org/apache/struts2/portlet/PortletApplicationMapTest.java +++ b/core/src/test/java/org/apache/struts2/portlet/PortletApplicationMapTest.java @@ -1,19 +1,22 @@ /* * $Id$ * - * Copyright 2006 The Apache Software Foundation. + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at + * http://www.apache.org/licenses/LICENSE-2.0 * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. */ package org.apache.struts2.portlet; @@ -149,7 +152,7 @@ public class PortletApplicationMapTest extends MockObjectTestCase { } public void testClear() { - + mockPortletContext.expects(once()).method("removeAttribute").with(eq("key1")); mockPortletContext.expects(once()).method("removeAttribute").with(eq("key2")); diff --git a/core/src/test/java/org/apache/struts2/portlet/PortletRequestMapTest.java b/core/src/test/java/org/apache/struts2/portlet/PortletRequestMapTest.java index d1547536e..ff9127f79 100644 --- a/core/src/test/java/org/apache/struts2/portlet/PortletRequestMapTest.java +++ b/core/src/test/java/org/apache/struts2/portlet/PortletRequestMapTest.java @@ -1,19 +1,22 @@ /* * $Id$ * - * Copyright 2006 The Apache Software Foundation. + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at + * http://www.apache.org/licenses/LICENSE-2.0 * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. */ package org.apache.struts2.portlet; @@ -35,14 +38,14 @@ import org.jmock.core.Constraint; /** * PortletRequestMapTest. Insert description. - * + * */ public class PortletRequestMapTest extends MockObjectTestCase { public void testSetAttribute() { - + } - + public void testGet() { Mock mockRequest = mock(PortletRequest.class, "testGet"); mockRequest.expects(once()).method("getAttribute").with(eq("testAttribute")).will(returnValue("testValue")); @@ -51,7 +54,7 @@ public class PortletRequestMapTest extends MockObjectTestCase { mockRequest.verify(); assertEquals("testValue", value); } - + public void testPut() { Mock mockRequest = mock(PortletRequest.class, "testPut"); Object value = new String("testValue"); @@ -63,49 +66,49 @@ public class PortletRequestMapTest extends MockObjectTestCase { mockRequest.verify(); assertEquals(obj, value); } - + public void testClear() { Mock mockRequest = mock(PortletRequest.class, "testClear"); mockRequest.expects(once()).method("removeAttribute").with(eq("a")); mockRequest.expects(once()).method("removeAttribute").with(eq("b")); - + ArrayList dummy = new ArrayList(); dummy.add("a"); dummy.add("b"); - + mockRequest.expects(once()).method("getAttributeNames").will(returnValue(Collections.enumeration(dummy))); - + PortletRequestMap map = new PortletRequestMap((PortletRequest)mockRequest.proxy()); map.clear(); mockRequest.verify(); } - + public void testRemove() { Mock mockRequest = mock(PortletRequest.class); - + PortletRequest req = (PortletRequest)mockRequest.proxy(); - - + + mockRequest.expects(once()).method("getAttribute").with(eq("dummyKey")).will(returnValue("dummyValue")); - + mockRequest.expects(once()).method("removeAttribute").with(eq("dummyKey")); - + PortletRequestMap map = new PortletRequestMap(req); Object ret = map.remove("dummyKey"); assertEquals("dummyValue", ret); } - + public void testEntrySet() { Mock mockRequest = mock(PortletRequest.class); - + PortletRequest req = (PortletRequest)mockRequest.proxy(); - + Enumeration names = new Enumeration() { List keys = Arrays.asList(new Object[]{"key1", "key2"}); Iterator it = keys.iterator(); - + public boolean hasMoreElements() { return it.hasNext(); } @@ -113,16 +116,16 @@ public class PortletRequestMapTest extends MockObjectTestCase { public Object nextElement() { return it.next(); } - + }; - + mockRequest.stubs().method("getAttributeNames").will(returnValue(names)); mockRequest.stubs().method("getAttribute").with(eq("key1")).will(returnValue("value1")); mockRequest.stubs().method("getAttribute").with(eq("key2")).will(returnValue("value2")); - + PortletRequestMap map = new PortletRequestMap(req); Set entries = map.entrySet(); - + assertEquals(2, entries.size()); Iterator it = entries.iterator(); Map.Entry entry = (Map.Entry)it.next(); @@ -131,7 +134,7 @@ public class PortletRequestMapTest extends MockObjectTestCase { entry = (Map.Entry)it.next(); assertEquals("key1", entry.getKey()); assertEquals("value1", entry.getValue()); - + } - + } diff --git a/core/src/test/java/org/apache/struts2/portlet/PortletSessionMapTest.java b/core/src/test/java/org/apache/struts2/portlet/PortletSessionMapTest.java index 3674d9363..16e901913 100644 --- a/core/src/test/java/org/apache/struts2/portlet/PortletSessionMapTest.java +++ b/core/src/test/java/org/apache/struts2/portlet/PortletSessionMapTest.java @@ -1,19 +1,22 @@ /* * $Id$ * - * Copyright 2006 The Apache Software Foundation. + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at + * http://www.apache.org/licenses/LICENSE-2.0 * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. */ package org.apache.struts2.portlet; @@ -34,18 +37,18 @@ import org.jmock.core.Constraint; /** * PortletSessionMapTest. Insert description. - * + * */ public class PortletSessionMapTest extends MockObjectTestCase { public void testPut() { - + Mock mockSession = mock(PortletSession.class); Mock mockRequest = mock(PortletRequest.class); - + PortletRequest req = (PortletRequest)mockRequest.proxy(); PortletSession session = (PortletSession)mockSession.proxy(); - + mockRequest.expects(once()).method("getPortletSession").will(returnValue(session)); Constraint[] params = new Constraint[]{eq("testAttribute1"), eq("testValue1")}; mockSession.expects(once()).method("setAttribute").with(params); @@ -53,74 +56,74 @@ public class PortletSessionMapTest extends MockObjectTestCase { params = new Constraint[]{eq("testAttribute2"), eq("testValue2")}; mockSession.expects(once()).method("setAttribute").with(params); mockSession.expects(once()).method("getAttribute").with(eq("testAttribute2")).will(returnValue("testValue2")); - + PortletSessionMap map = new PortletSessionMap(req); map.put("testAttribute1", "testValue1"); map.put("testAttribute2", "testValue2"); - + } - + public void testGet() { Mock mockSession = mock(PortletSession.class); Mock mockRequest = mock(PortletRequest.class); - + PortletRequest req = (PortletRequest)mockRequest.proxy(); PortletSession session = (PortletSession)mockSession.proxy(); - + mockRequest.expects(once()).method("getPortletSession").will(returnValue(session)); mockSession.expects(once()).method("getAttribute").with(eq("testAttribute1")).will(returnValue("testValue1")); mockSession.expects(once()).method("getAttribute").with(eq("testAttribute2")).will(returnValue("testValue2")); - + PortletSessionMap map = new PortletSessionMap(req); Object val1 = map.get("testAttribute1"); Object val2 = map.get("testAttribute2"); assertEquals("testValue1", val1); assertEquals("testValue2", val2); } - + public void testClear() { Mock mockSession = mock(PortletSession.class); Mock mockRequest = mock(PortletRequest.class); - + PortletRequest req = (PortletRequest)mockRequest.proxy(); PortletSession session = (PortletSession)mockSession.proxy(); - + mockRequest.expects(once()).method("getPortletSession").will(returnValue(session)); mockSession.expects(once()).method("invalidate"); - + PortletSessionMap map = new PortletSessionMap(req); map.clear(); } - + public void testRemove() { Mock mockSession = mock(PortletSession.class); Mock mockRequest = mock(PortletRequest.class); - + PortletRequest req = (PortletRequest)mockRequest.proxy(); PortletSession session = (PortletSession)mockSession.proxy(); - - + + mockRequest.expects(once()).method("getPortletSession").will(returnValue(session)); mockSession.stubs().method("getAttribute").with(eq("dummyKey")).will(returnValue("dummyValue")); mockSession.expects(once()).method("removeAttribute").with(eq("dummyKey")); - + PortletSessionMap map = new PortletSessionMap(req); Object ret = map.remove("dummyKey"); assertEquals("dummyValue", ret); } - + public void testEntrySet() { Mock mockSession = mock(PortletSession.class); Mock mockRequest = mock(PortletRequest.class); - + PortletRequest req = (PortletRequest)mockRequest.proxy(); PortletSession session = (PortletSession)mockSession.proxy(); - + Enumeration names = new Enumeration() { List keys = Arrays.asList(new Object[]{"key1", "key2"}); Iterator it = keys.iterator(); - + public boolean hasMoreElements() { return it.hasNext(); } @@ -128,18 +131,18 @@ public class PortletSessionMapTest extends MockObjectTestCase { public Object nextElement() { return it.next(); } - + }; - + mockSession.stubs().method("getAttributeNames").will(returnValue(names)); mockSession.stubs().method("getAttribute").with(eq("key1")).will(returnValue("value1")); mockSession.stubs().method("getAttribute").with(eq("key2")).will(returnValue("value2")); - + mockRequest.expects(once()).method("getPortletSession").will(returnValue(session)); - + PortletSessionMap map = new PortletSessionMap(req); Set entries = map.entrySet(); - + assertEquals(2, entries.size()); Iterator it = entries.iterator(); Map.Entry entry = (Map.Entry)it.next(); @@ -148,7 +151,7 @@ public class PortletSessionMapTest extends MockObjectTestCase { entry = (Map.Entry)it.next(); assertEquals("key1", entry.getKey()); assertEquals("value1", entry.getValue()); - + } - + } diff --git a/core/src/test/java/org/apache/struts2/portlet/context/PortletActionContextTest.java b/core/src/test/java/org/apache/struts2/portlet/context/PortletActionContextTest.java index bb15f6849..6431988c5 100644 --- a/core/src/test/java/org/apache/struts2/portlet/context/PortletActionContextTest.java +++ b/core/src/test/java/org/apache/struts2/portlet/context/PortletActionContextTest.java @@ -1,19 +1,22 @@ /* * $Id$ * - * Copyright 2006 The Apache Software Foundation. + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at + * http://www.apache.org/licenses/LICENSE-2.0 * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. */ package org.apache.struts2.portlet.context; @@ -37,23 +40,23 @@ import com.opensymphony.xwork2.ActionContext; /** */ public class PortletActionContextTest extends MockObjectTestCase { - + Mock mockRenderRequest; Mock mockRenderResponse; Mock mockPortletConfig; Mock mockActionRequest; Mock mockActionResponse; - + RenderRequest renderRequest; RenderResponse renderResponse; - + ActionRequest actionRequest; ActionResponse actionResponse; - + PortletConfig portletConfig; - + Map context = new HashMap(); - + public void setUp() throws Exception { super.setUp(); mockRenderRequest = mock(RenderRequest.class); @@ -61,42 +64,42 @@ public class PortletActionContextTest extends MockObjectTestCase { mockActionRequest = mock(ActionRequest.class); mockActionResponse = mock(ActionResponse.class); mockPortletConfig = mock(PortletConfig.class); - + renderRequest = (RenderRequest)mockRenderRequest.proxy(); renderResponse = (RenderResponse)mockRenderResponse.proxy(); actionRequest = (ActionRequest)mockActionRequest.proxy(); actionResponse = (ActionResponse)mockActionResponse.proxy(); portletConfig = (PortletConfig)mockPortletConfig.proxy(); - - + + ActionContext.setContext(new ActionContext(context)); } - + public void testGetPhase() { context.put(PortletActionConstants.PHASE, PortletActionConstants.RENDER_PHASE); - + assertEquals(PortletActionConstants.RENDER_PHASE, PortletActionContext.getPhase()); } - + public void testIsRender() { context.put(PortletActionConstants.PHASE, PortletActionConstants.RENDER_PHASE); - + assertTrue(PortletActionContext.isRender()); assertFalse(PortletActionContext.isEvent()); } - + public void testIsEvent() { context.put(PortletActionConstants.PHASE, PortletActionConstants.EVENT_PHASE); - + assertTrue(PortletActionContext.isEvent()); assertFalse(PortletActionContext.isRender()); } - + public void testGetPortletConfig() { context.put(PortletActionConstants.PORTLET_CONFIG, portletConfig); assertSame(portletConfig, PortletActionContext.getPortletConfig()); } - + public void testGetRenderRequestAndResponse() { context.put(PortletActionConstants.REQUEST, renderRequest); context.put(PortletActionConstants.RESPONSE, renderResponse); @@ -106,7 +109,7 @@ public class PortletActionContextTest extends MockObjectTestCase { assertSame(renderRequest, PortletActionContext.getRequest()); assertSame(renderResponse, PortletActionContext.getResponse()); } - + public void testGetRenderRequestAndResponseInEventPhase() { context.put(PortletActionConstants.REQUEST, renderRequest); context.put(PortletActionConstants.RESPONSE, renderResponse); @@ -126,7 +129,7 @@ public class PortletActionContextTest extends MockObjectTestCase { assertTrue(true); } } - + public void testGetActionRequestAndResponse() { context.put(PortletActionConstants.REQUEST, actionRequest); context.put(PortletActionConstants.RESPONSE, actionResponse); @@ -136,7 +139,7 @@ public class PortletActionContextTest extends MockObjectTestCase { assertSame(actionRequest, PortletActionContext.getRequest()); assertSame(actionResponse, PortletActionContext.getResponse()); } - + public void testGetActionRequestAndResponseInRenderPhase() { context.put(PortletActionConstants.REQUEST, actionRequest); context.put(PortletActionConstants.RESPONSE, actionResponse); @@ -156,22 +159,22 @@ public class PortletActionContextTest extends MockObjectTestCase { assertTrue(true); } } - + public void testGetNamespace() { context.put(PortletActionConstants.PORTLET_NAMESPACE, "testNamespace"); assertEquals("testNamespace", PortletActionContext.getPortletNamespace()); } - + public void testGetDefaultActionForMode() { context.put(PortletActionConstants.DEFAULT_ACTION_FOR_MODE, "testAction"); assertEquals("testAction", PortletActionContext.getDefaultActionForMode()); } - + public void tearDown() throws Exception { ActionContext.setContext(null); super.tearDown(); } - + public static void main(String[] args) { TestRunner.run(PortletActionContextTest.class); } diff --git a/core/src/test/java/org/apache/struts2/portlet/context/PreparatorServletTest.java b/core/src/test/java/org/apache/struts2/portlet/context/PreparatorServletTest.java index eb2af32d9..6aa21eb78 100644 --- a/core/src/test/java/org/apache/struts2/portlet/context/PreparatorServletTest.java +++ b/core/src/test/java/org/apache/struts2/portlet/context/PreparatorServletTest.java @@ -1,19 +1,22 @@ /* * $Id$ * - * Copyright 2006 The Apache Software Foundation. + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at + * http://www.apache.org/licenses/LICENSE-2.0 * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. */ package org.apache.struts2.portlet.context; @@ -27,9 +30,9 @@ import org.apache.struts2.StrutsTestCase; import org.easymock.MockControl; /** - * + * * Test for the {@link PreparatorServletTest} - * + * */ public class PreparatorServletTest extends StrutsTestCase { @@ -42,22 +45,22 @@ public class PreparatorServletTest extends StrutsTestCase { MockControl mockResponse = MockControl.createNiceControl(HttpServletResponse.class); MockControl mockContext = MockControl.createNiceControl(ServletContext.class); MockControl mockConfig = MockControl.createNiceControl(ServletConfig.class); - + HttpServletRequest req = (HttpServletRequest)mockRequest.getMock(); HttpServletResponse res = (HttpServletResponse)mockResponse.getMock(); ServletContext context = (ServletContext)mockContext.getMock(); ServletConfig config = (ServletConfig)mockConfig.getMock(); - + mockConfig.expectAndDefaultReturn(config.getServletContext(), context); mockConfig.replay(); - + PreparatorServlet servlet = new PreparatorServlet(); servlet.init(config); servlet.service(req, res); assertSame(req, ServletActionContext.getRequest()); assertSame(res, ServletActionContext.getResponse()); assertSame(context, ServletActionContext.getServletContext()); - + mockConfig.verify(); } diff --git a/core/src/test/java/org/apache/struts2/portlet/context/ServletContextHolderListenerTest.java b/core/src/test/java/org/apache/struts2/portlet/context/ServletContextHolderListenerTest.java index d64c2ddf1..23ad49897 100644 --- a/core/src/test/java/org/apache/struts2/portlet/context/ServletContextHolderListenerTest.java +++ b/core/src/test/java/org/apache/struts2/portlet/context/ServletContextHolderListenerTest.java @@ -1,19 +1,22 @@ /* * $Id$ * - * Copyright 2006 The Apache Software Foundation. + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at + * http://www.apache.org/licenses/LICENSE-2.0 * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. */ package org.apache.struts2.portlet.context; @@ -35,7 +38,7 @@ public class ServletContextHolderListenerTest extends TestCase { ServletContextHolderListener listener = new ServletContextHolderListener(); listener.contextInitialized(event); assertSame(ServletContextHolderListener.getServletContext(), context); - + listener.contextDestroyed(event); assertNull(ServletContextHolderListener.getServletContext()); } diff --git a/core/src/test/java/org/apache/struts2/portlet/dispatcher/Jsr168DispatcherTest.java b/core/src/test/java/org/apache/struts2/portlet/dispatcher/Jsr168DispatcherTest.java index e41899731..b9647a871 100644 --- a/core/src/test/java/org/apache/struts2/portlet/dispatcher/Jsr168DispatcherTest.java +++ b/core/src/test/java/org/apache/struts2/portlet/dispatcher/Jsr168DispatcherTest.java @@ -1,19 +1,22 @@ /* * $Id$ * - * Copyright 2006 The Apache Software Foundation. + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at + * http://www.apache.org/licenses/LICENSE-2.0 * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. */ package org.apache.struts2.portlet.dispatcher; @@ -54,10 +57,10 @@ import com.opensymphony.xwork2.util.ValueStackFactory; /** * Jsr168DispatcherTest. Insert description. - * + * */ public class Jsr168DispatcherTest extends MockObjectTestCase implements PortletActionConstants { - + Jsr168Dispatcher dispatcher = null; Mock mockConfig = null; Mock mockCtx = null; @@ -67,11 +70,11 @@ public class Jsr168DispatcherTest extends MockObjectTestCase implements PortletA Mock mockActionProxy = null; Mock mockAction = null; Mock mockInvocation = null; - + public void setUp() { dispatcher = new Jsr168Dispatcher(); } - + private void initPortletConfig(final Map initParams, final Map attributes) { mockConfig = mock(PortletConfig.class); mockCtx = mock(PortletContext.class); @@ -82,7 +85,7 @@ public class Jsr168DispatcherTest extends MockObjectTestCase implements PortletA mockConfig.stubs().method("getPortletContext").will(returnValue(mockCtx.proxy())); mockCtx.stubs().method("getInitParameterNames").will(returnValue(Collections.enumeration(initParams.keySet()))); setupStub(initParams, mockCtx, "getInitParameter"); - + mockConfig.stubs().method("getResourceBundle").will(returnValue(new ListResourceBundle() { protected Object[][] getContents() { return new String[][]{{"javax.portlet.title", "MyTitle"}}; @@ -97,13 +100,13 @@ public class Jsr168DispatcherTest extends MockObjectTestCase implements PortletA mockAction = mock(Action.class); mockActionProxy = mock(ActionProxy.class); mockInvocation = mock(ActionInvocation.class); - + mockActionFactory.expects(once()).method("createActionProxy").with(new Constraint[]{isA(Configuration.class), eq(namespace), eq(actionName), isA(Map.class)}).will(returnValue(mockActionProxy.proxy())); mockActionProxy.stubs().method("getAction").will(returnValue(mockAction.proxy())); mockActionProxy.expects(once()).method("execute").will(returnValue(result)); mockActionProxy.expects(once()).method("getInvocation").will(returnValue(mockInvocation.proxy())); mockInvocation.stubs().method("getStack").will(returnValue(stack)); - + } public void testRender_ok() { @@ -119,11 +122,11 @@ public class Jsr168DispatcherTest extends MockObjectTestCase implements PortletA requestParams.put(PortletActionConstants.ACTION_PARAM, new String[]{"/view/testAction"}); requestParams.put(EVENT_ACTION, new String[]{"true"}); requestParams.put(PortletActionConstants.MODE_PARAM, new String[]{mode.toString()}); - + Map sessionMap = new HashMap(); - - - + + + Map initParams = new HashMap(); initParams.put("viewNamespace", "/view"); @@ -153,11 +156,11 @@ public class Jsr168DispatcherTest extends MockObjectTestCase implements PortletA PortletMode mode = PortletMode.VIEW; Map initParams = new HashMap(); initParams.put("viewNamespace", "/view"); - + Map requestParams = new HashMap(); requestParams.put(PortletActionConstants.ACTION_PARAM, new String[]{"/view/testAction"}); requestParams.put(PortletActionConstants.MODE_PARAM, new String[]{mode.toString()}); - + initPortletConfig(initParams, new HashMap()); initRequest(requestParams, new HashMap(), new HashMap(), new HashMap(), PortletMode.VIEW, WindowState.NORMAL, true, null); setupActionFactory("/view", "testAction", "success", ValueStackFactory.getFactory().createValueStack()); @@ -184,7 +187,7 @@ public class Jsr168DispatcherTest extends MockObjectTestCase implements PortletA fail("Error occured"); } } - + /** * Initialize the mock request (and as a result, the mock session) * @param requestParams The request parameters @@ -197,28 +200,28 @@ public class Jsr168DispatcherTest extends MockObjectTestCase implements PortletA * @param locale The locale. If null, the request will return Locale.getDefault() */ private void initRequest(Map requestParams, Map requestAttributes, Map sessionParams, Map renderParams, PortletMode mode, WindowState state, boolean isEvent, Locale locale) { - mockRequest = isEvent ? mock(ActionRequest.class) : mock(RenderRequest.class); - mockSession = mock(PortletSession.class); - mockSession.stubs().method(ANYTHING); - mockRequest.stubs().method(ANYTHING); - setupStub(sessionParams, mockSession, "getAttribute"); - mockSession.stubs().method("getAttributeNames").will(returnValue(Collections.enumeration(sessionParams.keySet()))); - setupParamStub(requestParams, mockRequest, "getParameter"); - setupStub(requestAttributes, mockRequest, "getAttribute"); - mockRequest.stubs().method("getAttributeNames").will(returnValue(Collections.enumeration(requestAttributes.keySet()))); - mockRequest.stubs().method("getParameterMap").will(returnValue(requestParams)); - mockRequest.stubs().method("getParameterNames").will(returnValue(Collections.enumeration(requestParams.keySet()))); - mockRequest.stubs().method("getPortletSession").will(returnValue(mockSession.proxy())); - if(locale != null) { - mockRequest.stubs().method("getLocale").will(returnValue(locale)); - } - else { - mockRequest.stubs().method("getLocale").will(returnValue(Locale.getDefault())); - } - mockRequest.stubs().method("getPortletMode").will(returnValue(mode)); - mockRequest.stubs().method("getWindowState").will(returnValue(state)); + mockRequest = isEvent ? mock(ActionRequest.class) : mock(RenderRequest.class); + mockSession = mock(PortletSession.class); + mockSession.stubs().method(ANYTHING); + mockRequest.stubs().method(ANYTHING); + setupStub(sessionParams, mockSession, "getAttribute"); + mockSession.stubs().method("getAttributeNames").will(returnValue(Collections.enumeration(sessionParams.keySet()))); + setupParamStub(requestParams, mockRequest, "getParameter"); + setupStub(requestAttributes, mockRequest, "getAttribute"); + mockRequest.stubs().method("getAttributeNames").will(returnValue(Collections.enumeration(requestAttributes.keySet()))); + mockRequest.stubs().method("getParameterMap").will(returnValue(requestParams)); + mockRequest.stubs().method("getParameterNames").will(returnValue(Collections.enumeration(requestParams.keySet()))); + mockRequest.stubs().method("getPortletSession").will(returnValue(mockSession.proxy())); + if(locale != null) { + mockRequest.stubs().method("getLocale").will(returnValue(locale)); + } + else { + mockRequest.stubs().method("getLocale").will(returnValue(Locale.getDefault())); + } + mockRequest.stubs().method("getPortletMode").will(returnValue(mode)); + mockRequest.stubs().method("getWindowState").will(returnValue(state)); } - + /** * @param requestParams * @param mockRequest2 @@ -233,26 +236,26 @@ public class Jsr168DispatcherTest extends MockObjectTestCase implements PortletA newMap.put(key, val[0]); } setupStub(newMap, mockRequest, method); - + } /** * Set up stubs for the mock. - * @param map The map containing the key and values. The key is the + * @param map The map containing the key and values. The key is the * expected parameter to method, and value is the value that should be returned from * the stub. * @param mock The mock to initialize. * @param method The name of the method to stub. */ private void setupStub(Map map, Mock mock, String method) { - Iterator it = map.keySet().iterator(); - while(it.hasNext()) { - Object key = it.next(); - Object val = map.get(key); - mock.stubs().method(method).with(eq(key)).will(returnValue(val)); - } + Iterator it = map.keySet().iterator(); + while(it.hasNext()) { + Object key = it.next(); + Object val = map.get(key); + mock.stubs().method(method).with(eq(key)).will(returnValue(val)); + } } - + public void testModeChangeUsingPortletWidgets() { final Mock mockResponse = mock(RenderResponse.class); mockResponse.stubs().method(ANYTHING); @@ -262,9 +265,9 @@ public class Jsr168DispatcherTest extends MockObjectTestCase implements PortletA requestParams.put(PortletActionConstants.ACTION_PARAM, new String[]{"/view/testAction"}); requestParams.put(EVENT_ACTION, new String[]{"false"}); requestParams.put(PortletActionConstants.MODE_PARAM, new String[]{PortletMode.VIEW.toString()}); - + Map sessionMap = new HashMap(); - + Map initParams = new HashMap(); initParams.put("viewNamespace", "/view"); initParams.put("editNamespace", "/edit"); @@ -288,9 +291,9 @@ public class Jsr168DispatcherTest extends MockObjectTestCase implements PortletA fail("Error occured"); } } - + public static void main(String[] args) { - TestRunner.run(Jsr168DispatcherTest.class); + TestRunner.run(Jsr168DispatcherTest.class); } } diff --git a/core/src/test/java/org/apache/struts2/portlet/result/PortletResultTest.java b/core/src/test/java/org/apache/struts2/portlet/result/PortletResultTest.java index fb6ca2e96..5aa9feae4 100644 --- a/core/src/test/java/org/apache/struts2/portlet/result/PortletResultTest.java +++ b/core/src/test/java/org/apache/struts2/portlet/result/PortletResultTest.java @@ -1,19 +1,22 @@ /* * $Id$ * - * Copyright 2006 The Apache Software Foundation. + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at + * http://www.apache.org/licenses/LICENSE-2.0 * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. */ package org.apache.struts2.portlet.result; @@ -41,50 +44,50 @@ import com.opensymphony.xwork2.ActionInvocation; /** * PortletResultTest. Insert description. - * + * */ public class PortletResultTest extends MockObjectTestCase { - + Mock mockInvocation = null; Mock mockConfig = null; Mock mockCtx = null; - + public void setUp() throws Exception { super.setUp(); mockInvocation = mock(ActionInvocation.class); mockConfig = mock(PortletConfig.class); mockCtx = mock(PortletContext.class); - + mockConfig.stubs().method(ANYTHING); mockConfig.stubs().method("getPortletContext").will(returnValue(mockCtx.proxy())); - + Map paramMap = new HashMap(); Map sessionMap = new HashMap(); - + Map context = new HashMap(); context.put(ActionContext.SESSION, sessionMap); context.put(ActionContext.PARAMETERS, paramMap); context.put(PortletActionConstants.PORTLET_CONFIG, mockConfig.proxy()); - + ActionContext.setContext(new ActionContext(context)); - + mockInvocation.stubs().method("getInvocationContext").will(returnValue(ActionContext.getContext())); - + } - + public void testDoExecute_render() { Mock mockRequest = mock(RenderRequest.class); Mock mockResponse = mock(RenderResponse.class); Mock mockRd = mock(PortletRequestDispatcher.class); Mock mockPrep = mock(PortletRequestDispatcher.class); - + RenderRequest req = (RenderRequest)mockRequest.proxy(); RenderResponse res = (RenderResponse)mockResponse.proxy(); PortletRequestDispatcher rd = (PortletRequestDispatcher)mockRd.proxy(); PortletConfig cfg = (PortletConfig)mockConfig.proxy(); PortletContext ctx = (PortletContext)mockCtx.proxy(); ActionInvocation inv = (ActionInvocation)mockInvocation.proxy(); - + Constraint[] params = new Constraint[]{same(req), same(res)}; mockRd.expects(once()).method("include").with(params); mockPrep.expects(once()).method("include").with(params); @@ -92,15 +95,15 @@ public class PortletResultTest extends MockObjectTestCase { mockCtx.expects(once()).method("getNamedDispatcher").with(eq("preparator")).will(returnValue(mockPrep.proxy())); mockResponse.expects(once()).method("setContentType").with(eq("text/html")); mockConfig.expects(once()).method("getPortletContext").will(returnValue(ctx)); - + mockRequest.stubs().method("getPortletMode").will(returnValue(PortletMode.VIEW)); - + ActionContext ctxMap = ActionContext.getContext(); ctxMap.put(PortletActionConstants.RESPONSE, res); ctxMap.put(PortletActionConstants.REQUEST, req); ctxMap.put(PortletActionConstants.PORTLET_CONFIG, cfg); ctxMap.put(PortletActionConstants.PHASE, PortletActionConstants.RENDER_PHASE); - + PortletResult result = new PortletResult(); try { result.doExecute("/WEB-INF/pages/testPage.jsp", inv); @@ -109,25 +112,25 @@ public class PortletResultTest extends MockObjectTestCase { e.printStackTrace(); fail("Error occured!"); } - + } - + public void testDoExecute_event_locationIsAction() { - + Mock mockRequest = mock(ActionRequest.class); Mock mockResponse = mock(ActionResponse.class); - + Constraint[] params = new Constraint[]{eq(PortletActionConstants.ACTION_PARAM), eq("testView")}; mockResponse.expects(once()).method("setRenderParameter").with(params); params = new Constraint[]{eq(PortletActionConstants.MODE_PARAM), eq(PortletMode.VIEW.toString())}; mockResponse.expects(once()).method("setRenderParameter").with(params); mockRequest.stubs().method("getPortletMode").will(returnValue(PortletMode.VIEW)); ActionContext ctx = ActionContext.getContext(); - + ctx.put(PortletActionConstants.REQUEST, mockRequest.proxy()); ctx.put(PortletActionConstants.RESPONSE, mockResponse.proxy()); ctx.put(PortletActionConstants.PHASE, PortletActionConstants.EVENT_PHASE); - + PortletResult result = new PortletResult(); try { result.doExecute("testView.action", (ActionInvocation)mockInvocation.proxy()); @@ -136,13 +139,13 @@ public class PortletResultTest extends MockObjectTestCase { e.printStackTrace(); fail("Error occured!"); } - + } - + public void testDoExecute_event_locationIsJsp() { Mock mockRequest = mock(ActionRequest.class); Mock mockResponse = mock(ActionResponse.class); - + Constraint[] params = new Constraint[]{eq(PortletActionConstants.ACTION_PARAM), eq("renderDirect")}; mockResponse.expects(once()).method("setRenderParameter").with(params); params = new Constraint[]{eq("location"), eq("/WEB-INF/pages/testJsp.jsp")}; @@ -150,13 +153,13 @@ public class PortletResultTest extends MockObjectTestCase { params = new Constraint[]{eq(PortletActionConstants.MODE_PARAM), eq(PortletMode.VIEW.toString())}; mockResponse.expects(once()).method("setRenderParameter").with(params); mockRequest.stubs().method("getPortletMode").will(returnValue(PortletMode.VIEW)); - + ActionContext ctx = ActionContext.getContext(); - + ctx.put(PortletActionConstants.REQUEST, mockRequest.proxy()); ctx.put(PortletActionConstants.RESPONSE, mockResponse.proxy()); ctx.put(PortletActionConstants.PHASE, PortletActionConstants.EVENT_PHASE); - + PortletResult result = new PortletResult(); try { result.doExecute("/WEB-INF/pages/testJsp.jsp", (ActionInvocation)mockInvocation.proxy()); @@ -166,11 +169,11 @@ public class PortletResultTest extends MockObjectTestCase { fail("Error occured!"); } } - + public void testDoExecute_event_locationHasQueryParams() { Mock mockRequest = mock(ActionRequest.class); Mock mockResponse = mock(ActionResponse.class); - + Constraint[] params = new Constraint[]{eq(PortletActionConstants.ACTION_PARAM), eq("testView")}; mockResponse.expects(once()).method("setRenderParameter").with(params); params = new Constraint[]{eq("testParam1"), eq("testValue1")}; @@ -180,13 +183,13 @@ public class PortletResultTest extends MockObjectTestCase { params = new Constraint[]{eq(PortletActionConstants.MODE_PARAM), eq(PortletMode.VIEW.toString())}; mockResponse.expects(once()).method("setRenderParameter").with(params); mockRequest.stubs().method("getPortletMode").will(returnValue(PortletMode.VIEW)); - + ActionContext ctx = ActionContext.getContext(); - + ctx.put(PortletActionConstants.REQUEST, mockRequest.proxy()); ctx.put(PortletActionConstants.RESPONSE, mockResponse.proxy()); ctx.put(PortletActionConstants.PHASE, PortletActionConstants.EVENT_PHASE); - + PortletResult result = new PortletResult(); try { result.doExecute("testView.action?testParam1=testValue1&testParam2=testValue2", (ActionInvocation)mockInvocation.proxy()); @@ -196,50 +199,50 @@ public class PortletResultTest extends MockObjectTestCase { fail("Error occured!"); } } - + public void testTitleAndContentType() throws Exception { Mock mockRequest = mock(RenderRequest.class); Mock mockResponse = mock(RenderResponse.class); Mock mockRd = mock(PortletRequestDispatcher.class); Mock mockPrep = mock(PortletRequestDispatcher.class); - + RenderRequest req = (RenderRequest)mockRequest.proxy(); RenderResponse res = (RenderResponse)mockResponse.proxy(); PortletRequestDispatcher rd = (PortletRequestDispatcher)mockRd.proxy(); PortletConfig cfg = (PortletConfig)mockConfig.proxy(); PortletContext ctx = (PortletContext)mockCtx.proxy(); - + Constraint[] params = new Constraint[]{same(req), same(res)}; mockRd.expects(once()).method("include").with(params); mockPrep.expects(once()).method("include").with(params); mockCtx.expects(once()).method("getRequestDispatcher").with(eq("/WEB-INF/pages/testPage.jsp")).will(returnValue(rd)); mockCtx.expects(once()).method("getNamedDispatcher").with(eq("preparator")).will(returnValue(mockPrep.proxy())); mockConfig.expects(once()).method("getPortletContext").will(returnValue(ctx)); - + mockRequest.stubs().method("getPortletMode").will(returnValue(PortletMode.VIEW)); - + ActionContext ctxMap = ActionContext.getContext(); ctxMap.put(PortletActionConstants.RESPONSE, res); ctxMap.put(PortletActionConstants.REQUEST, req); ctxMap.put(PortletActionConstants.PORTLET_CONFIG, cfg); ctxMap.put(PortletActionConstants.PHASE, PortletActionConstants.RENDER_PHASE); - + mockResponse.expects(atLeastOnce()).method("setTitle").with(eq("testTitle")); mockResponse.expects(atLeastOnce()).method("setContentType").with(eq("testContentType")); - + PortletResult result = new PortletResult(); result.setTitle("testTitle"); result.setContentType("testContentType"); result.doExecute("/WEB-INF/pages/testPage.jsp", (ActionInvocation)mockInvocation.proxy()); } - + public void tearDown() throws Exception { super.tearDown(); ActionContext.setContext(null); } - + public static void main(String[] args) { TestRunner.run(PortletResultTest.class); } - + } diff --git a/core/src/test/java/org/apache/struts2/portlet/util/PortletUrlHelperTest.java b/core/src/test/java/org/apache/struts2/portlet/util/PortletUrlHelperTest.java index d5c4947a9..32af41967 100644 --- a/core/src/test/java/org/apache/struts2/portlet/util/PortletUrlHelperTest.java +++ b/core/src/test/java/org/apache/struts2/portlet/util/PortletUrlHelperTest.java @@ -1,19 +1,22 @@ /* * $Id$ * - * Copyright 2006 The Apache Software Foundation. + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at + * http://www.apache.org/licenses/LICENSE-2.0 * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. */ package org.apache.struts2.portlet.util; diff --git a/core/src/test/java/org/apache/struts2/portlet/util/StrutsUtilTest.java b/core/src/test/java/org/apache/struts2/portlet/util/StrutsUtilTest.java index 0bcf9da8d..c22ae0ec6 100644 --- a/core/src/test/java/org/apache/struts2/portlet/util/StrutsUtilTest.java +++ b/core/src/test/java/org/apache/struts2/portlet/util/StrutsUtilTest.java @@ -1,19 +1,22 @@ /* * $Id$ * - * Copyright 2006 The Apache Software Foundation. + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at + * http://www.apache.org/licenses/LICENSE-2.0 * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. */ package org.apache.struts2.portlet.util; @@ -37,204 +40,204 @@ import com.opensymphony.xwork2.util.ValueStackFactory; /** * Test case for StrutsUtil. - * + * */ public class StrutsUtilTest extends StrutsTestCase { - - protected ValueStack stack = null; - protected InternalMockHttpServletRequest request = null; - protected MockHttpServletResponse response = null; - protected StrutsUtil strutsUtil = null; - - public void testBeanMethod() throws Exception { - Object o = strutsUtil.bean("org.apache.struts2.TestAction"); - assertNotNull(o); - assertTrue(o instanceof TestAction); - } - - public void testIsTrueMethod() throws Exception { - stack.push(new Object() { - public String getMyString() { - return "myString"; - } - public boolean getMyBoolean(boolean bool) { - return bool; - } - }); - assertTrue(strutsUtil.isTrue("myString == 'myString'")); - assertFalse(strutsUtil.isTrue("myString == 'myOtherString'")); - assertTrue(strutsUtil.isTrue("getMyBoolean(true)")); - assertFalse(strutsUtil.isTrue("getMyBoolean(false)")); - } - - public void testFindStringMethod() throws Exception { - stack.push(new Object() { - public String getMyString() { - return "myString"; - } - public boolean getMyBoolean(boolean bool) { - return bool; - } - }); - - assertEquals(strutsUtil.findString("myString"), "myString"); - assertNull(strutsUtil.findString("myOtherString")); - assertEquals(strutsUtil.findString("getMyBoolean(true)"), "true"); - } - - public void testIncludeMethod() throws Exception { - strutsUtil.include("/some/includedJspFile.jsp"); - - // with include, this must have been created and should not be null - assertNotNull(request.getDispatcher()); - // this must be true, indicating we actaully ask container to do an include - assertTrue(request.getDispatcher().included); - } - - - public void testUrlEncodeMethod() throws Exception { - assertEquals( - strutsUtil.urlEncode("http://www.opensymphony.com/action2/index.jsp?param1=value1"), - "http%3A%2F%2Fwww.opensymphony.com%2Faction2%2Findex.jsp%3Fparam1%3Dvalue1"); - } - - public void testBuildUrlMethod() throws Exception { - request.setContextPath("/myContextPath"); - assertEquals(strutsUtil.buildUrl("/someUrl?param1=value1"), "/myContextPath/someUrl?param1=value1"); - } - - - public void testFindValueMethod() throws Exception { - stack.push(new Object() { - public String getMyString() { - return "myString"; - } - public boolean getMyBoolean(boolean bool) { - return bool; - } - }); - Object obj1 = strutsUtil.findValue("myString", "java.lang.String"); - Object obj2 = strutsUtil.findValue("getMyBoolean(true)", "java.lang.Boolean"); - - assertNotNull(obj1); - assertNotNull(obj2); - assertTrue(obj1 instanceof String); - assertTrue(obj2 instanceof Boolean); - assertEquals(obj1, "myString"); - assertEquals(obj2, Boolean.TRUE); - } - - - public void testGetTextMethod() throws Exception { - // this should be in xwork-messages.properties (included by default - // by LocalizedTextUtil - assertNotNull(strutsUtil.getText("xwork.error.action.execution")); - assertEquals(strutsUtil.getText("xwork.error.action.execution"), "Error during Action invocation"); - } - - - public void testGetContextMethod() throws Exception { - request.setContextPath("/myContext"); - assertEquals(strutsUtil.getContext(), "/myContext"); - } - - - public void testMakeSelectListMethod() throws Exception { - String[] selectedList = new String[] { "Car", "Airplane", "Bus" }; - List list = new ArrayList(); - list.add("Lorry"); - list.add("Car"); - list.add("Helicopter"); - - stack.getContext().put("mySelectedList", selectedList); - stack.getContext().put("myList", list); - - List listMade = strutsUtil.makeSelectList("#mySelectedList", "#myList", null, null); - - assertEquals(listMade.size(), 3); - assertEquals(((ListEntry)listMade.get(0)).getKey(), "Lorry"); - assertEquals(((ListEntry)listMade.get(0)).getValue(), "Lorry"); - assertEquals(((ListEntry)listMade.get(0)).getIsSelected(), false); - assertEquals(((ListEntry)listMade.get(1)).getKey(), "Car"); - assertEquals(((ListEntry)listMade.get(1)).getValue(), "Car"); - assertEquals(((ListEntry)listMade.get(1)).getIsSelected(), true); - assertEquals(((ListEntry)listMade.get(2)).getKey(), "Helicopter"); - assertEquals(((ListEntry)listMade.get(2)).getValue(), "Helicopter"); - assertEquals(((ListEntry)listMade.get(2)).getIsSelected(), false); - } - - - public void testHtmlEncode() throws Exception { - assertEquals( - strutsUtil.htmlEncode("some titlesome content"), - "<html><head><title>some title</title><body>some content</body></html>"); - } - + protected ValueStack stack = null; + protected InternalMockHttpServletRequest request = null; + protected MockHttpServletResponse response = null; + protected StrutsUtil strutsUtil = null; + + public void testBeanMethod() throws Exception { + Object o = strutsUtil.bean("org.apache.struts2.TestAction"); + assertNotNull(o); + assertTrue(o instanceof TestAction); + } + + public void testIsTrueMethod() throws Exception { + stack.push(new Object() { + public String getMyString() { + return "myString"; + } + public boolean getMyBoolean(boolean bool) { + return bool; + } + }); + assertTrue(strutsUtil.isTrue("myString == 'myString'")); + assertFalse(strutsUtil.isTrue("myString == 'myOtherString'")); + assertTrue(strutsUtil.isTrue("getMyBoolean(true)")); + assertFalse(strutsUtil.isTrue("getMyBoolean(false)")); + } + + public void testFindStringMethod() throws Exception { + stack.push(new Object() { + public String getMyString() { + return "myString"; + } + public boolean getMyBoolean(boolean bool) { + return bool; + } + }); + + assertEquals(strutsUtil.findString("myString"), "myString"); + assertNull(strutsUtil.findString("myOtherString")); + assertEquals(strutsUtil.findString("getMyBoolean(true)"), "true"); + } + + public void testIncludeMethod() throws Exception { + strutsUtil.include("/some/includedJspFile.jsp"); + + // with include, this must have been created and should not be null + assertNotNull(request.getDispatcher()); + // this must be true, indicating we actaully ask container to do an include + assertTrue(request.getDispatcher().included); + } + + + public void testUrlEncodeMethod() throws Exception { + assertEquals( + strutsUtil.urlEncode("http://www.opensymphony.com/action2/index.jsp?param1=value1"), + "http%3A%2F%2Fwww.opensymphony.com%2Faction2%2Findex.jsp%3Fparam1%3Dvalue1"); + } + + public void testBuildUrlMethod() throws Exception { + request.setContextPath("/myContextPath"); + assertEquals(strutsUtil.buildUrl("/someUrl?param1=value1"), "/myContextPath/someUrl?param1=value1"); + } + + + public void testFindValueMethod() throws Exception { + stack.push(new Object() { + public String getMyString() { + return "myString"; + } + public boolean getMyBoolean(boolean bool) { + return bool; + } + }); + Object obj1 = strutsUtil.findValue("myString", "java.lang.String"); + Object obj2 = strutsUtil.findValue("getMyBoolean(true)", "java.lang.Boolean"); + + assertNotNull(obj1); + assertNotNull(obj2); + assertTrue(obj1 instanceof String); + assertTrue(obj2 instanceof Boolean); + assertEquals(obj1, "myString"); + assertEquals(obj2, Boolean.TRUE); + } + + + + public void testGetTextMethod() throws Exception { + // this should be in xwork-messages.properties (included by default + // by LocalizedTextUtil + assertNotNull(strutsUtil.getText("xwork.error.action.execution")); + assertEquals(strutsUtil.getText("xwork.error.action.execution"), "Error during Action invocation"); + } + + + public void testGetContextMethod() throws Exception { + request.setContextPath("/myContext"); + assertEquals(strutsUtil.getContext(), "/myContext"); + } + + + public void testMakeSelectListMethod() throws Exception { + String[] selectedList = new String[] { "Car", "Airplane", "Bus" }; + List list = new ArrayList(); + list.add("Lorry"); + list.add("Car"); + list.add("Helicopter"); + + stack.getContext().put("mySelectedList", selectedList); + stack.getContext().put("myList", list); + + List listMade = strutsUtil.makeSelectList("#mySelectedList", "#myList", null, null); + + assertEquals(listMade.size(), 3); + assertEquals(((ListEntry)listMade.get(0)).getKey(), "Lorry"); + assertEquals(((ListEntry)listMade.get(0)).getValue(), "Lorry"); + assertEquals(((ListEntry)listMade.get(0)).getIsSelected(), false); + assertEquals(((ListEntry)listMade.get(1)).getKey(), "Car"); + assertEquals(((ListEntry)listMade.get(1)).getValue(), "Car"); + assertEquals(((ListEntry)listMade.get(1)).getIsSelected(), true); + assertEquals(((ListEntry)listMade.get(2)).getKey(), "Helicopter"); + assertEquals(((ListEntry)listMade.get(2)).getValue(), "Helicopter"); + assertEquals(((ListEntry)listMade.get(2)).getIsSelected(), false); + } + + + public void testHtmlEncode() throws Exception { + assertEquals( + strutsUtil.htmlEncode("some titlesome content"), + "<html><head><title>some title</title><body>some content</body></html>"); + } + + + public void testToInt() throws Exception { + assertEquals(strutsUtil.toInt(11l), 11); + } + + + public void testToLong() throws Exception { + assertEquals(strutsUtil.toLong(11), 11l); + } + + + public void testToString() throws Exception { + assertEquals(strutsUtil.toString(1), "1"); + assertEquals(strutsUtil.toString(11l), "11"); + } + + + // === Junit Hook + + protected void setUp() throws Exception { + super.setUp(); + stack = ValueStackFactory.getFactory().createValueStack(); + request = new InternalMockHttpServletRequest(); + response = new MockHttpServletResponse(); + strutsUtil = new StrutsUtil(stack, request, response); + } + + protected void tearDown() throws Exception { + stack = null; + request = null; + response = null; + strutsUtil = null; + super.tearDown(); + } + + + + // === internal class to assist in testing + + class InternalMockHttpServletRequest extends MockHttpServletRequest { + InternalMockRequestDispatcher dispatcher = null; + public RequestDispatcher getRequestDispatcher(String path) { + dispatcher = new InternalMockRequestDispatcher(path); + return dispatcher; + } + + public InternalMockRequestDispatcher getDispatcher() { + return dispatcher; + } + } + + class InternalMockRequestDispatcher extends MockRequestDispatcher { + private String url; + boolean included = false; + public InternalMockRequestDispatcher(String url) { + super(url); + this.url = url; + } + public void include(ServletRequest servletRequest, ServletResponse servletResponse) { + if (servletResponse instanceof MockHttpServletResponse) { + ((MockHttpServletResponse) servletResponse).setIncludedUrl(this.url); + } + included = true; + } + } - public void testToInt() throws Exception { - assertEquals(strutsUtil.toInt(11l), 11); - } - - - public void testToLong() throws Exception { - assertEquals(strutsUtil.toLong(11), 11l); - } - - - public void testToString() throws Exception { - assertEquals(strutsUtil.toString(1), "1"); - assertEquals(strutsUtil.toString(11l), "11"); - } - - - // === Junit Hook - - protected void setUp() throws Exception { - super.setUp(); - stack = ValueStackFactory.getFactory().createValueStack(); - request = new InternalMockHttpServletRequest(); - response = new MockHttpServletResponse(); - strutsUtil = new StrutsUtil(stack, request, response); - } - - protected void tearDown() throws Exception { - stack = null; - request = null; - response = null; - strutsUtil = null; - super.tearDown(); - } - - - - // === internal class to assist in testing - - class InternalMockHttpServletRequest extends MockHttpServletRequest { - InternalMockRequestDispatcher dispatcher = null; - public RequestDispatcher getRequestDispatcher(String path) { - dispatcher = new InternalMockRequestDispatcher(path); - return dispatcher; - } - - public InternalMockRequestDispatcher getDispatcher() { - return dispatcher; - } - } - - class InternalMockRequestDispatcher extends MockRequestDispatcher { - private String url; - boolean included = false; - public InternalMockRequestDispatcher(String url) { - super(url); - this.url = url; - } - public void include(ServletRequest servletRequest, ServletResponse servletResponse) { - if (servletResponse instanceof MockHttpServletResponse) { - ((MockHttpServletResponse) servletResponse).setIncludedUrl(this.url); - } - included = true; - } - } - } diff --git a/core/src/test/java/org/apache/struts2/spring/StrutsSpringObjectFactoryTest.java b/core/src/test/java/org/apache/struts2/spring/StrutsSpringObjectFactoryTest.java index 63d1c5c39..807b3e57d 100644 --- a/core/src/test/java/org/apache/struts2/spring/StrutsSpringObjectFactoryTest.java +++ b/core/src/test/java/org/apache/struts2/spring/StrutsSpringObjectFactoryTest.java @@ -1,19 +1,22 @@ /* * $Id$ * - * Copyright 2006 The Apache Software Foundation. + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at + * http://www.apache.org/licenses/LICENSE-2.0 * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. */ package org.apache.struts2.spring; @@ -39,7 +42,7 @@ public class StrutsSpringObjectFactoryTest extends StrutsTestCase { StrutsSpringObjectFactory fac = new StrutsSpringObjectFactory(); ServletContext msc = (ServletContext) new MockServletContext(); fac.init(msc); - + assertEquals(AutowireCapableBeanFactory.AUTOWIRE_BY_NAME, fac.getAutowireStrategy()); } diff --git a/core/src/test/java/org/apache/struts2/util/ContainUtilTest.java b/core/src/test/java/org/apache/struts2/util/ContainUtilTest.java index 2275a4785..112d730e3 100644 --- a/core/src/test/java/org/apache/struts2/util/ContainUtilTest.java +++ b/core/src/test/java/org/apache/struts2/util/ContainUtilTest.java @@ -1,19 +1,22 @@ /* - * $Id: ContainUtil.java 418521 2006-07-01 23:36:50Z mrdon $ + * $Id: $ * - * Copyright 2006 The Apache Software Foundation. + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at + * http://www.apache.org/licenses/LICENSE-2.0 * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. */ package org.apache.struts2.util; @@ -25,94 +28,94 @@ import java.util.Set; import junit.framework.TestCase; /** - * + * * @version $Date$ $Id$ */ public class ContainUtilTest extends TestCase { - public void testNull() throws Exception { - assertFalse(ContainUtil.contains(null, null)); - assertFalse(ContainUtil.contains(new Object(), null)); - assertFalse(ContainUtil.contains(null, new Object())); - } - - public void testSimpleList() throws Exception { - List l = new ArrayList(); - l.add("one"); - l.add("two"); - - assertFalse(ContainUtil.contains(l, "three")); - assertTrue(ContainUtil.contains(l, "one")); - assertTrue(ContainUtil.contains(l, "two")); - } - - public void testSimpleSet() throws Exception { - Set s = new LinkedHashSet(); - s.add("one"); - s.add("two"); - - assertFalse(ContainUtil.contains(s, "thre")); - assertTrue(ContainUtil.contains(s, "one")); - assertTrue(ContainUtil.contains(s, "two")); - } - - public void testComplexList() throws Exception { - List l = new ArrayList(); - l.add(new MyObject("tm_jee", 20)); - l.add(new MyObject("jenny", 22)); - - assertFalse(ContainUtil.contains(l, new MyObject("paul", 50))); - assertFalse(ContainUtil.contains(l, new MyObject("tm_jee", 44))); - assertTrue(ContainUtil.contains(l, new MyObject("tm_jee", 20))); - assertTrue(ContainUtil.contains(l, new MyObject("jenny", 22))); - } - - public void testComplexMap() throws Exception { - Set s = new LinkedHashSet(); - s.add(new MyObject("tm_jee", 20)); - s.add(new MyObject("jenny", 22)); - - assertFalse(ContainUtil.contains(s, new MyObject("paul", 50))); - assertFalse(ContainUtil.contains(s, new MyObject("tm_jee", 44))); - assertTrue(ContainUtil.contains(s, new MyObject("tm_jee", 20))); - assertTrue(ContainUtil.contains(s, new MyObject("jenny", 22))); - } - - public void testObject() throws Exception { - assertFalse(ContainUtil.contains("aaa", "bbb")); - assertFalse(ContainUtil.contains(new MyObject("tm_jee", 22), new MyObject("tmjee", 22))); - assertTrue(ContainUtil.contains("apple", "apple")); - assertTrue(ContainUtil.contains(new MyObject("tm_jee", 22), new MyObject("tm_jee", 22))); - } + public void testNull() throws Exception { + assertFalse(ContainUtil.contains(null, null)); + assertFalse(ContainUtil.contains(new Object(), null)); + assertFalse(ContainUtil.contains(null, new Object())); + } + + public void testSimpleList() throws Exception { + List l = new ArrayList(); + l.add("one"); + l.add("two"); + + assertFalse(ContainUtil.contains(l, "three")); + assertTrue(ContainUtil.contains(l, "one")); + assertTrue(ContainUtil.contains(l, "two")); + } + + public void testSimpleSet() throws Exception { + Set s = new LinkedHashSet(); + s.add("one"); + s.add("two"); + + assertFalse(ContainUtil.contains(s, "thre")); + assertTrue(ContainUtil.contains(s, "one")); + assertTrue(ContainUtil.contains(s, "two")); + } + + public void testComplexList() throws Exception { + List l = new ArrayList(); + l.add(new MyObject("tm_jee", 20)); + l.add(new MyObject("jenny", 22)); + + assertFalse(ContainUtil.contains(l, new MyObject("paul", 50))); + assertFalse(ContainUtil.contains(l, new MyObject("tm_jee", 44))); + assertTrue(ContainUtil.contains(l, new MyObject("tm_jee", 20))); + assertTrue(ContainUtil.contains(l, new MyObject("jenny", 22))); + } + + public void testComplexMap() throws Exception { + Set s = new LinkedHashSet(); + s.add(new MyObject("tm_jee", 20)); + s.add(new MyObject("jenny", 22)); + + assertFalse(ContainUtil.contains(s, new MyObject("paul", 50))); + assertFalse(ContainUtil.contains(s, new MyObject("tm_jee", 44))); + assertTrue(ContainUtil.contains(s, new MyObject("tm_jee", 20))); + assertTrue(ContainUtil.contains(s, new MyObject("jenny", 22))); + } + + public void testObject() throws Exception { + assertFalse(ContainUtil.contains("aaa", "bbb")); + assertFalse(ContainUtil.contains(new MyObject("tm_jee", 22), new MyObject("tmjee", 22))); + assertTrue(ContainUtil.contains("apple", "apple")); + assertTrue(ContainUtil.contains(new MyObject("tm_jee", 22), new MyObject("tm_jee", 22))); + } - public static class MyObject { - private String name; - private Integer age; - - public MyObject(String name, Integer age) { - this.name = name; - this.age = age; - } - - @Override - public int hashCode() { - return this.name.hashCode(); - } - - @Override - public boolean equals(Object obj) { - if (obj == null) { return false; } - if (! (obj instanceof MyObject)) { return false; } - MyObject tmp = (MyObject) obj; - if ( - tmp.name.equals(this.name) && - tmp.age.equals(this.age) - ) { - return true; - } - return false; - - } - } + public static class MyObject { + private String name; + private Integer age; + + public MyObject(String name, Integer age) { + this.name = name; + this.age = age; + } + + @Override + public int hashCode() { + return this.name.hashCode(); + } + + @Override + public boolean equals(Object obj) { + if (obj == null) { return false; } + if (! (obj instanceof MyObject)) { return false; } + MyObject tmp = (MyObject) obj; + if ( + tmp.name.equals(this.name) && + tmp.age.equals(this.age) + ) { + return true; + } + return false; + + } + } } diff --git a/core/src/test/java/org/apache/struts2/util/CounterTest.java b/core/src/test/java/org/apache/struts2/util/CounterTest.java index 4295e9191..ce77d7402 100644 --- a/core/src/test/java/org/apache/struts2/util/CounterTest.java +++ b/core/src/test/java/org/apache/struts2/util/CounterTest.java @@ -1,19 +1,22 @@ /* * $Id$ * - * Copyright 2006 The Apache Software Foundation. + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at + * http://www.apache.org/licenses/LICENSE-2.0 * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. */ package org.apache.struts2.util; diff --git a/core/src/test/java/org/apache/struts2/util/InvocationSessionStoreTest.java b/core/src/test/java/org/apache/struts2/util/InvocationSessionStoreTest.java index f07f12c5c..35f32408f 100644 --- a/core/src/test/java/org/apache/struts2/util/InvocationSessionStoreTest.java +++ b/core/src/test/java/org/apache/struts2/util/InvocationSessionStoreTest.java @@ -1,19 +1,22 @@ /* * $Id$ * - * Copyright 2006 The Apache Software Foundation. + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at + * http://www.apache.org/licenses/LICENSE-2.0 * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. */ package org.apache.struts2.util; diff --git a/core/src/test/java/org/apache/struts2/util/PrefixTrieTest.java b/core/src/test/java/org/apache/struts2/util/PrefixTrieTest.java index ec98c01c2..4f2b9ae2d 100644 --- a/core/src/test/java/org/apache/struts2/util/PrefixTrieTest.java +++ b/core/src/test/java/org/apache/struts2/util/PrefixTrieTest.java @@ -1,19 +1,22 @@ /* * $Id$ * - * Copyright 2006 The Apache Software Foundation. + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at + * http://www.apache.org/licenses/LICENSE-2.0 * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. */ package org.apache.struts2.util; @@ -32,7 +35,7 @@ public class PrefixTrieTest extends TestCase { assertSame(foo, trie.get("foo:bar")); assertSame(a, trie.get("a:bar")); assertNull(trie.get("tee:bar")); - assertNull(trie.get("foobar")); + assertNull(trie.get("foobar")); } } diff --git a/core/src/test/java/org/apache/struts2/util/StrutsTypeConverterTest.java b/core/src/test/java/org/apache/struts2/util/StrutsTypeConverterTest.java index 5010c5a9b..91cebe95f 100644 --- a/core/src/test/java/org/apache/struts2/util/StrutsTypeConverterTest.java +++ b/core/src/test/java/org/apache/struts2/util/StrutsTypeConverterTest.java @@ -1,19 +1,22 @@ /* * $Id$ * - * Copyright 2006 The Apache Software Foundation. + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at + * http://www.apache.org/licenses/LICENSE-2.0 * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. */ package org.apache.struts2.util; @@ -26,82 +29,82 @@ import junit.framework.TestCase; /** * Test case for Struts Type Converter. - * + * */ public class StrutsTypeConverterTest extends TestCase { - /** - * Typically form Struts -> html - * - * @throws Exception - */ - public void testConvertToString() throws Exception { - InternalStrutsTypeConverter strutsTypeConverter = new InternalStrutsTypeConverter(); - strutsTypeConverter.convertValue(new HashMap(), "", String.class); - assertTrue(strutsTypeConverter.isConvertToString); - assertEquals(strutsTypeConverter.objToBeConverted, ""); - } - - /** - * Typically form html -> Struts - * - * @throws Exception - */ - public void testConvertFromString() throws Exception { - InternalStrutsTypeConverter strutsTypeConverter = new InternalStrutsTypeConverter(); - strutsTypeConverter.convertValue(new HashMap(), "12/12/1997", Date.class); - assertTrue(strutsTypeConverter.isConvertFromString); - assertTrue(strutsTypeConverter.objToBeConverted instanceof String[]); - assertEquals(((String[])strutsTypeConverter.objToBeConverted).length, 1); - } - - /** - * Typically from html -> Struts (in array due to the nature of html, param - * being able to have many values). - * - * @throws Exception - */ - public void testConvertFromStringInArrayForm() throws Exception { - InternalStrutsTypeConverter strutsTypeConverter = new InternalStrutsTypeConverter(); - strutsTypeConverter.convertValue(new HashMap(), new String[] { "12/12/1997", "1/1/1977" }, Date.class); - assertTrue(strutsTypeConverter.isConvertFromString); - assertTrue(strutsTypeConverter.objToBeConverted instanceof String[]); - assertEquals(((String[])strutsTypeConverter.objToBeConverted).length, 2); - } - - - public void testFallbackConversion() throws Exception { - InternalStrutsTypeConverter strutsTypeConverter = new InternalStrutsTypeConverter(); - strutsTypeConverter.convertValue(new HashMap(), new Object(), Date.class); - assertTrue(strutsTypeConverter.fallbackConversion); - } - - // === internal class for testing - class InternalStrutsTypeConverter extends StrutsTypeConverter { + /** + * Typically form Struts -> html + * + * @throws Exception + */ + public void testConvertToString() throws Exception { + InternalStrutsTypeConverter strutsTypeConverter = new InternalStrutsTypeConverter(); + strutsTypeConverter.convertValue(new HashMap(), "", String.class); + assertTrue(strutsTypeConverter.isConvertToString); + assertEquals(strutsTypeConverter.objToBeConverted, ""); + } - boolean isConvertFromString = false; - boolean isConvertToString = false; - boolean fallbackConversion = false; - - Object objToBeConverted; - - public Object convertFromString(Map context, String[] values, Class toClass) { - isConvertFromString = true; - objToBeConverted = values; - return null; - } + /** + * Typically form html -> Struts + * + * @throws Exception + */ + public void testConvertFromString() throws Exception { + InternalStrutsTypeConverter strutsTypeConverter = new InternalStrutsTypeConverter(); + strutsTypeConverter.convertValue(new HashMap(), "12/12/1997", Date.class); + assertTrue(strutsTypeConverter.isConvertFromString); + assertTrue(strutsTypeConverter.objToBeConverted instanceof String[]); + assertEquals(((String[])strutsTypeConverter.objToBeConverted).length, 1); + } + + /** + * Typically from html -> Struts (in array due to the nature of html, param + * being able to have many values). + * + * @throws Exception + */ + public void testConvertFromStringInArrayForm() throws Exception { + InternalStrutsTypeConverter strutsTypeConverter = new InternalStrutsTypeConverter(); + strutsTypeConverter.convertValue(new HashMap(), new String[] { "12/12/1997", "1/1/1977" }, Date.class); + assertTrue(strutsTypeConverter.isConvertFromString); + assertTrue(strutsTypeConverter.objToBeConverted instanceof String[]); + assertEquals(((String[])strutsTypeConverter.objToBeConverted).length, 2); + } + + + public void testFallbackConversion() throws Exception { + InternalStrutsTypeConverter strutsTypeConverter = new InternalStrutsTypeConverter(); + strutsTypeConverter.convertValue(new HashMap(), new Object(), Date.class); + assertTrue(strutsTypeConverter.fallbackConversion); + } + + // === internal class for testing + class InternalStrutsTypeConverter extends StrutsTypeConverter { + + boolean isConvertFromString = false; + boolean isConvertToString = false; + boolean fallbackConversion = false; + + Object objToBeConverted; + + public Object convertFromString(Map context, String[] values, Class toClass) { + isConvertFromString = true; + objToBeConverted = values; + return null; + } + + public String convertToString(Map context, Object o) { + isConvertToString = true; + objToBeConverted = o; + return null; + } + + protected Object performFallbackConversion(Map context, Object o, Class toClass) { + fallbackConversion = true; + return null; + } + + } - public String convertToString(Map context, Object o) { - isConvertToString = true; - objToBeConverted = o; - return null; - } - - protected Object performFallbackConversion(Map context, Object o, Class toClass) { - fallbackConversion = true; - return null; - } - - } - } diff --git a/core/src/test/java/org/apache/struts2/util/TokenHelperTest.java b/core/src/test/java/org/apache/struts2/util/TokenHelperTest.java index c9f0d815d..3ba29f0d1 100644 --- a/core/src/test/java/org/apache/struts2/util/TokenHelperTest.java +++ b/core/src/test/java/org/apache/struts2/util/TokenHelperTest.java @@ -1,19 +1,22 @@ /* * $Id$ * - * Copyright 2006 The Apache Software Foundation. + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at + * http://www.apache.org/licenses/LICENSE-2.0 * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. */ package org.apache.struts2.util; diff --git a/core/src/test/java/org/apache/struts2/views/TemplateEngineManagerTest.java b/core/src/test/java/org/apache/struts2/views/TemplateEngineManagerTest.java index 6c87ea20b..12417b8db 100644 --- a/core/src/test/java/org/apache/struts2/views/TemplateEngineManagerTest.java +++ b/core/src/test/java/org/apache/struts2/views/TemplateEngineManagerTest.java @@ -1,19 +1,22 @@ /* * $Id$ * - * Copyright 2006 The Apache Software Foundation. + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at + * http://www.apache.org/licenses/LICENSE-2.0 * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. */ package org.apache.struts2.views; diff --git a/core/src/test/java/org/apache/struts2/views/freemarker/FreemarkerManagerTest.java b/core/src/test/java/org/apache/struts2/views/freemarker/FreemarkerManagerTest.java index b9ed84e19..cefcb9b1c 100644 --- a/core/src/test/java/org/apache/struts2/views/freemarker/FreemarkerManagerTest.java +++ b/core/src/test/java/org/apache/struts2/views/freemarker/FreemarkerManagerTest.java @@ -1,19 +1,22 @@ /* * $Id$ * - * Copyright 2006 The Apache Software Foundation. + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at + * http://www.apache.org/licenses/LICENSE-2.0 * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. */ package org.apache.struts2.views.freemarker; @@ -23,16 +26,16 @@ import org.apache.struts2.config.Settings; import org.apache.struts2.views.jsp.StrutsMockServletContext; /** - * Test case for FreemarkerManager - * + * Test case for FreemarkerManager + * */ public class FreemarkerManagerTest extends StrutsTestCase { - - public void testIfStrutsEncodingIsSetProperty() throws Exception { - Settings.set(StrutsConstants.STRUTS_I18N_ENCODING, "UTF-8"); - StrutsMockServletContext servletContext = new StrutsMockServletContext(); - servletContext.setAttribute(FreemarkerManager.CONFIG_SERVLET_CONTEXT_KEY, null); - freemarker.template.Configuration conf = FreemarkerManager.getInstance().getConfiguration(servletContext); - assertEquals(conf.getDefaultEncoding(), "UTF-8"); - } + + public void testIfStrutsEncodingIsSetProperty() throws Exception { + Settings.set(StrutsConstants.STRUTS_I18N_ENCODING, "UTF-8"); + StrutsMockServletContext servletContext = new StrutsMockServletContext(); + servletContext.setAttribute(FreemarkerManager.CONFIG_SERVLET_CONTEXT_KEY, null); + freemarker.template.Configuration conf = FreemarkerManager.getInstance().getConfiguration(servletContext); + assertEquals(conf.getDefaultEncoding(), "UTF-8"); + } } diff --git a/core/src/test/java/org/apache/struts2/views/freemarker/FreemarkerTest.java b/core/src/test/java/org/apache/struts2/views/freemarker/FreemarkerTest.java index b4137bbed..ec146abcc 100644 --- a/core/src/test/java/org/apache/struts2/views/freemarker/FreemarkerTest.java +++ b/core/src/test/java/org/apache/struts2/views/freemarker/FreemarkerTest.java @@ -1,19 +1,22 @@ /* * $Id$ * - * Copyright 2006 The Apache Software Foundation. + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at + * http://www.apache.org/licenses/LICENSE-2.0 * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. */ package org.apache.struts2.views.freemarker; diff --git a/core/src/test/java/org/apache/struts2/views/freemarker/TestAction.java b/core/src/test/java/org/apache/struts2/views/freemarker/TestAction.java index e3ee49333..c938ced16 100644 --- a/core/src/test/java/org/apache/struts2/views/freemarker/TestAction.java +++ b/core/src/test/java/org/apache/struts2/views/freemarker/TestAction.java @@ -1,19 +1,22 @@ /* * $Id$ * - * Copyright 2006 The Apache Software Foundation. + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at + * http://www.apache.org/licenses/LICENSE-2.0 * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. */ package org.apache.struts2.views.freemarker; @@ -27,7 +30,7 @@ import com.opensymphony.xwork2.ActionSupport; */ public class TestAction extends ActionSupport { - private static final long serialVersionUID = -762413863731432302L; + private static final long serialVersionUID = -762413863731432302L; public TestAction() { super(); diff --git a/core/src/test/java/org/apache/struts2/views/freemarker/TestBean.java b/core/src/test/java/org/apache/struts2/views/freemarker/TestBean.java index 64da713b2..95e0add54 100644 --- a/core/src/test/java/org/apache/struts2/views/freemarker/TestBean.java +++ b/core/src/test/java/org/apache/struts2/views/freemarker/TestBean.java @@ -1,19 +1,22 @@ /* * $Id$ * - * Copyright 2006 The Apache Software Foundation. + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at + * http://www.apache.org/licenses/LICENSE-2.0 * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. */ package org.apache.struts2.views.freemarker; diff --git a/core/src/test/java/org/apache/struts2/views/jsp/AbstractTagTest.java b/core/src/test/java/org/apache/struts2/views/jsp/AbstractTagTest.java index d8e622b31..5efeb09a9 100644 --- a/core/src/test/java/org/apache/struts2/views/jsp/AbstractTagTest.java +++ b/core/src/test/java/org/apache/struts2/views/jsp/AbstractTagTest.java @@ -1,19 +1,22 @@ /* * $Id$ * - * Copyright 2006 The Apache Software Foundation. + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at + * http://www.apache.org/licenses/LICENSE-2.0 * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. */ package org.apache.struts2.views.jsp; diff --git a/core/src/test/java/org/apache/struts2/views/jsp/AbstractUITagTest.java b/core/src/test/java/org/apache/struts2/views/jsp/AbstractUITagTest.java index 77bda4a5e..86b179cde 100644 --- a/core/src/test/java/org/apache/struts2/views/jsp/AbstractUITagTest.java +++ b/core/src/test/java/org/apache/struts2/views/jsp/AbstractUITagTest.java @@ -1,19 +1,22 @@ /* * $Id$ * - * Copyright 2006 The Apache Software Foundation. + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at + * http://www.apache.org/licenses/LICENSE-2.0 * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. */ package org.apache.struts2.views.jsp; diff --git a/core/src/test/java/org/apache/struts2/views/jsp/ActionTagTest.java b/core/src/test/java/org/apache/struts2/views/jsp/ActionTagTest.java index 8e142c992..64d79b993 100644 --- a/core/src/test/java/org/apache/struts2/views/jsp/ActionTagTest.java +++ b/core/src/test/java/org/apache/struts2/views/jsp/ActionTagTest.java @@ -1,19 +1,22 @@ /* * $Id$ * - * Copyright 2006 The Apache Software Foundation. + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at + * http://www.apache.org/licenses/LICENSE-2.0 * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. */ package org.apache.struts2.views.jsp; diff --git a/core/src/test/java/org/apache/struts2/views/jsp/AnchorTagTest.java b/core/src/test/java/org/apache/struts2/views/jsp/AnchorTagTest.java index d9a5bae00..814c66228 100644 --- a/core/src/test/java/org/apache/struts2/views/jsp/AnchorTagTest.java +++ b/core/src/test/java/org/apache/struts2/views/jsp/AnchorTagTest.java @@ -1,19 +1,22 @@ /* * $Id$ * - * Copyright 2006 The Apache Software Foundation. + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at + * http://www.apache.org/licenses/LICENSE-2.0 * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. */ package org.apache.struts2.views.jsp; diff --git a/core/src/test/java/org/apache/struts2/views/jsp/AppendIteratorTagTest.java b/core/src/test/java/org/apache/struts2/views/jsp/AppendIteratorTagTest.java index 3a25869e5..702306b5e 100644 --- a/core/src/test/java/org/apache/struts2/views/jsp/AppendIteratorTagTest.java +++ b/core/src/test/java/org/apache/struts2/views/jsp/AppendIteratorTagTest.java @@ -1,19 +1,22 @@ /* * $Id$ * - * Copyright 2006 The Apache Software Foundation. + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at + * http://www.apache.org/licenses/LICENSE-2.0 * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. */ package org.apache.struts2.views.jsp; @@ -31,148 +34,148 @@ import com.opensymphony.xwork2.ActionSupport; */ public class AppendIteratorTagTest extends AbstractTagTest { - - public void testAppendingIteratorUsingArrayAsSource() throws Exception { - AppendIteratorTag tag = new AppendIteratorTag(); - tag.setPageContext(pageContext); - tag.setId("myAppendedIterator"); - - ParamTag iterator1ParamTag = new ParamTag(); - iterator1ParamTag.setPageContext(pageContext); - iterator1ParamTag.setValue("%{myArr1}"); - - ParamTag iterator2ParamTag = new ParamTag(); - iterator2ParamTag.setPageContext(pageContext); - iterator2ParamTag.setValue("%{myArr2}"); - - ParamTag iterator3ParamTag = new ParamTag(); - iterator3ParamTag.setPageContext(pageContext); - iterator3ParamTag.setValue("%{myArr3}"); - - - tag.doStartTag(); - iterator1ParamTag.doStartTag(); - iterator1ParamTag.doEndTag(); - iterator2ParamTag.doStartTag(); - iterator2ParamTag.doEndTag(); - iterator3ParamTag.doStartTag(); - iterator3ParamTag.doEndTag(); - tag.doEndTag(); - - Iterator appendedIterator = (Iterator) stack.findValue("#myAppendedIterator"); - - assertNotNull(appendedIterator); - assertTrue(appendedIterator.hasNext()); - assertEquals(appendedIterator.next(), "1"); - assertTrue(appendedIterator.hasNext()); - assertEquals(appendedIterator.next(), "2"); - assertTrue(appendedIterator.hasNext()); - assertEquals(appendedIterator.next(), "3"); - assertTrue(appendedIterator.hasNext()); - assertEquals(appendedIterator.next(), "a"); - assertTrue(appendedIterator.hasNext()); - assertEquals(appendedIterator.next(), "b"); - assertTrue(appendedIterator.hasNext()); - assertEquals(appendedIterator.next(), "c"); - assertTrue(appendedIterator.hasNext()); - assertEquals(appendedIterator.next(), "A"); - assertTrue(appendedIterator.hasNext()); - assertEquals(appendedIterator.next(), "B"); - assertTrue(appendedIterator.hasNext()); - assertEquals(appendedIterator.next(), "C"); - assertFalse(appendedIterator.hasNext()); - } - - public void testAppendingIteratorsUsingListAsSource() throws Exception { - AppendIteratorTag tag = new AppendIteratorTag(); - tag.setPageContext(pageContext); - tag.setId("myAppendedIterator"); - - ParamTag iterator1ParamTag = new ParamTag(); - iterator1ParamTag.setPageContext(pageContext); - iterator1ParamTag.setValue("%{myList1}"); - - ParamTag iterator2ParamTag = new ParamTag(); - iterator2ParamTag.setPageContext(pageContext); - iterator2ParamTag.setValue("%{myList2}"); - - ParamTag iterator3ParamTag = new ParamTag(); - iterator3ParamTag.setPageContext(pageContext); - iterator3ParamTag.setValue("%{myList3}"); - - - tag.doStartTag(); - iterator1ParamTag.doStartTag(); - iterator1ParamTag.doEndTag(); - iterator2ParamTag.doStartTag(); - iterator2ParamTag.doEndTag(); - iterator3ParamTag.doStartTag(); - iterator3ParamTag.doEndTag(); - tag.doEndTag(); - - Iterator appendedIterator = (Iterator) stack.findValue("#myAppendedIterator"); - - assertNotNull(appendedIterator); - assertTrue(appendedIterator.hasNext()); - assertEquals(appendedIterator.next(), "1"); - assertTrue(appendedIterator.hasNext()); - assertEquals(appendedIterator.next(), "2"); - assertTrue(appendedIterator.hasNext()); - assertEquals(appendedIterator.next(), "3"); - assertTrue(appendedIterator.hasNext()); - assertEquals(appendedIterator.next(), "a"); - assertTrue(appendedIterator.hasNext()); - assertEquals(appendedIterator.next(), "b"); - assertTrue(appendedIterator.hasNext()); - assertEquals(appendedIterator.next(), "c"); - assertTrue(appendedIterator.hasNext()); - assertEquals(appendedIterator.next(), "A"); - assertTrue(appendedIterator.hasNext()); - assertEquals(appendedIterator.next(), "B"); - assertTrue(appendedIterator.hasNext()); - assertEquals(appendedIterator.next(), "C"); - assertFalse(appendedIterator.hasNext()); - } - - - public Action getAction() { - return new ActionSupport() { - public List getMyList1() { - List l = new ArrayList(); - l.add("1"); - l.add("2"); - l.add("3"); - return l; - } - - public List getMyList2() { - List l = new ArrayList(); - l.add("a"); - l.add("b"); - l.add("c"); - return l; - } - - public List getMyList3() { - List l = new ArrayList(0); - l.add("A"); - l.add("B"); - l.add("C"); - return l; - } - - public String[] getMyArr1() { - return new String[] { "1", "2", "3" }; - } - - public String[] getMyArr2() { - return new String[] { "a", "b", "c" }; - } - - public String[] getMyArr3() { - return new String[] { "A", "B", "C" }; - } - }; - } + public void testAppendingIteratorUsingArrayAsSource() throws Exception { + AppendIteratorTag tag = new AppendIteratorTag(); + tag.setPageContext(pageContext); + tag.setId("myAppendedIterator"); + + ParamTag iterator1ParamTag = new ParamTag(); + iterator1ParamTag.setPageContext(pageContext); + iterator1ParamTag.setValue("%{myArr1}"); + + ParamTag iterator2ParamTag = new ParamTag(); + iterator2ParamTag.setPageContext(pageContext); + iterator2ParamTag.setValue("%{myArr2}"); + + ParamTag iterator3ParamTag = new ParamTag(); + iterator3ParamTag.setPageContext(pageContext); + iterator3ParamTag.setValue("%{myArr3}"); + + + tag.doStartTag(); + iterator1ParamTag.doStartTag(); + iterator1ParamTag.doEndTag(); + iterator2ParamTag.doStartTag(); + iterator2ParamTag.doEndTag(); + iterator3ParamTag.doStartTag(); + iterator3ParamTag.doEndTag(); + tag.doEndTag(); + + Iterator appendedIterator = (Iterator) stack.findValue("#myAppendedIterator"); + + assertNotNull(appendedIterator); + assertTrue(appendedIterator.hasNext()); + assertEquals(appendedIterator.next(), "1"); + assertTrue(appendedIterator.hasNext()); + assertEquals(appendedIterator.next(), "2"); + assertTrue(appendedIterator.hasNext()); + assertEquals(appendedIterator.next(), "3"); + assertTrue(appendedIterator.hasNext()); + assertEquals(appendedIterator.next(), "a"); + assertTrue(appendedIterator.hasNext()); + assertEquals(appendedIterator.next(), "b"); + assertTrue(appendedIterator.hasNext()); + assertEquals(appendedIterator.next(), "c"); + assertTrue(appendedIterator.hasNext()); + assertEquals(appendedIterator.next(), "A"); + assertTrue(appendedIterator.hasNext()); + assertEquals(appendedIterator.next(), "B"); + assertTrue(appendedIterator.hasNext()); + assertEquals(appendedIterator.next(), "C"); + assertFalse(appendedIterator.hasNext()); + } + + public void testAppendingIteratorsUsingListAsSource() throws Exception { + AppendIteratorTag tag = new AppendIteratorTag(); + tag.setPageContext(pageContext); + tag.setId("myAppendedIterator"); + + ParamTag iterator1ParamTag = new ParamTag(); + iterator1ParamTag.setPageContext(pageContext); + iterator1ParamTag.setValue("%{myList1}"); + + ParamTag iterator2ParamTag = new ParamTag(); + iterator2ParamTag.setPageContext(pageContext); + iterator2ParamTag.setValue("%{myList2}"); + + ParamTag iterator3ParamTag = new ParamTag(); + iterator3ParamTag.setPageContext(pageContext); + iterator3ParamTag.setValue("%{myList3}"); + + + tag.doStartTag(); + iterator1ParamTag.doStartTag(); + iterator1ParamTag.doEndTag(); + iterator2ParamTag.doStartTag(); + iterator2ParamTag.doEndTag(); + iterator3ParamTag.doStartTag(); + iterator3ParamTag.doEndTag(); + tag.doEndTag(); + + Iterator appendedIterator = (Iterator) stack.findValue("#myAppendedIterator"); + + assertNotNull(appendedIterator); + assertTrue(appendedIterator.hasNext()); + assertEquals(appendedIterator.next(), "1"); + assertTrue(appendedIterator.hasNext()); + assertEquals(appendedIterator.next(), "2"); + assertTrue(appendedIterator.hasNext()); + assertEquals(appendedIterator.next(), "3"); + assertTrue(appendedIterator.hasNext()); + assertEquals(appendedIterator.next(), "a"); + assertTrue(appendedIterator.hasNext()); + assertEquals(appendedIterator.next(), "b"); + assertTrue(appendedIterator.hasNext()); + assertEquals(appendedIterator.next(), "c"); + assertTrue(appendedIterator.hasNext()); + assertEquals(appendedIterator.next(), "A"); + assertTrue(appendedIterator.hasNext()); + assertEquals(appendedIterator.next(), "B"); + assertTrue(appendedIterator.hasNext()); + assertEquals(appendedIterator.next(), "C"); + assertFalse(appendedIterator.hasNext()); + } + + + + public Action getAction() { + return new ActionSupport() { + public List getMyList1() { + List l = new ArrayList(); + l.add("1"); + l.add("2"); + l.add("3"); + return l; + } + + public List getMyList2() { + List l = new ArrayList(); + l.add("a"); + l.add("b"); + l.add("c"); + return l; + } + + public List getMyList3() { + List l = new ArrayList(0); + l.add("A"); + l.add("B"); + l.add("C"); + return l; + } + + public String[] getMyArr1() { + return new String[] { "1", "2", "3" }; + } + + public String[] getMyArr2() { + return new String[] { "a", "b", "c" }; + } + + public String[] getMyArr3() { + return new String[] { "A", "B", "C" }; + } + }; + } } diff --git a/core/src/test/java/org/apache/struts2/views/jsp/BeanTagTest.java b/core/src/test/java/org/apache/struts2/views/jsp/BeanTagTest.java index a5811a3ea..e2f17885d 100644 --- a/core/src/test/java/org/apache/struts2/views/jsp/BeanTagTest.java +++ b/core/src/test/java/org/apache/struts2/views/jsp/BeanTagTest.java @@ -1,19 +1,22 @@ /* * $Id$ * - * Copyright 2006 The Apache Software Foundation. + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at + * http://www.apache.org/licenses/LICENSE-2.0 * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. */ package org.apache.struts2.views.jsp; @@ -34,7 +37,7 @@ public class BeanTagTest extends AbstractUITagTest { tag.component.addParameter("result", "success"); assertEquals("success", stack.findValue("result")); - // TestAction from bean tag, Action from execution and DefaultTextProvider + // TestAction from bean tag, Action from execution and DefaultTextProvider assertEquals(3, stack.size()); tag.doEndTag(); assertEquals(2, stack.size()); diff --git a/core/src/test/java/org/apache/struts2/views/jsp/ElseIfTagTest.java b/core/src/test/java/org/apache/struts2/views/jsp/ElseIfTagTest.java index 704440bb2..1b9848aa6 100644 --- a/core/src/test/java/org/apache/struts2/views/jsp/ElseIfTagTest.java +++ b/core/src/test/java/org/apache/struts2/views/jsp/ElseIfTagTest.java @@ -1,19 +1,22 @@ /* * $Id$ * - * Copyright 2006 The Apache Software Foundation. + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at + * http://www.apache.org/licenses/LICENSE-2.0 * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. */ package org.apache.struts2.views.jsp; @@ -30,85 +33,85 @@ import com.opensymphony.xwork2.util.ValueStack; import com.opensymphony.xwork2.util.ValueStackFactory; /** - * + * */ public class ElseIfTagTest extends TestCase { - protected MockPageContext pageContext; - protected MockJspWriter jspWriter; - protected ValueStack stack; - - - public void testIfIsFalseElseIfIsTrue() throws Exception { - stack.getContext().put(If.ANSWER, Boolean.FALSE); - - ElseIfTag tag = new ElseIfTag(); - tag.setPageContext(pageContext); - tag.setTest("true"); - - int result = tag.doStartTag(); - tag.doEndTag(); - - assertEquals(result, TagSupport.EVAL_BODY_INCLUDE); - } - - public void testIfIsFalseElseIfIsFalse() throws Exception { - stack.getContext().put(If.ANSWER, Boolean.FALSE); - - ElseIfTag tag = new ElseIfTag(); - tag.setPageContext(pageContext); - tag.setTest("false"); - - int result = tag.doStartTag(); - tag.doEndTag(); - - assertEquals(result, TagSupport.SKIP_BODY); - } - - public void testIfIsTrueElseIfIsTrue() throws Exception { - stack.getContext().put(If.ANSWER, Boolean.TRUE); - - ElseIfTag tag = new ElseIfTag(); - tag.setPageContext(pageContext); - tag.setTest("true"); - - int result = tag.doStartTag(); - tag.doEndTag(); - - assertEquals(result, TagSupport.SKIP_BODY); - } - - public void testIfIsTrueElseIfIsFalse() throws Exception { - stack.getContext().put(If.ANSWER, Boolean.TRUE); - - ElseIfTag tag = new ElseIfTag(); - tag.setPageContext(pageContext); - tag.setTest("false"); - - int result = tag.doStartTag(); - tag.doEndTag(); - - assertEquals(result, TagSupport.SKIP_BODY); - } - - - protected void setUp() throws Exception { - stack = ValueStackFactory.getFactory().createValueStack(); - - jspWriter = new MockJspWriter(); - - StrutsMockHttpServletRequest request = new StrutsMockHttpServletRequest(); - - StrutsMockServletContext servletContext = new StrutsMockServletContext(); - servletContext.setServletInfo("not-weblogic"); - - pageContext = new MockPageContext(); - pageContext.setJspWriter(jspWriter); - pageContext.setRequest(request); - pageContext.setServletContext(servletContext); - - request.setAttribute(ServletActionContext.STRUTS_VALUESTACK_KEY, stack); - } - - + protected MockPageContext pageContext; + protected MockJspWriter jspWriter; + protected ValueStack stack; + + + public void testIfIsFalseElseIfIsTrue() throws Exception { + stack.getContext().put(If.ANSWER, Boolean.FALSE); + + ElseIfTag tag = new ElseIfTag(); + tag.setPageContext(pageContext); + tag.setTest("true"); + + int result = tag.doStartTag(); + tag.doEndTag(); + + assertEquals(result, TagSupport.EVAL_BODY_INCLUDE); + } + + public void testIfIsFalseElseIfIsFalse() throws Exception { + stack.getContext().put(If.ANSWER, Boolean.FALSE); + + ElseIfTag tag = new ElseIfTag(); + tag.setPageContext(pageContext); + tag.setTest("false"); + + int result = tag.doStartTag(); + tag.doEndTag(); + + assertEquals(result, TagSupport.SKIP_BODY); + } + + public void testIfIsTrueElseIfIsTrue() throws Exception { + stack.getContext().put(If.ANSWER, Boolean.TRUE); + + ElseIfTag tag = new ElseIfTag(); + tag.setPageContext(pageContext); + tag.setTest("true"); + + int result = tag.doStartTag(); + tag.doEndTag(); + + assertEquals(result, TagSupport.SKIP_BODY); + } + + public void testIfIsTrueElseIfIsFalse() throws Exception { + stack.getContext().put(If.ANSWER, Boolean.TRUE); + + ElseIfTag tag = new ElseIfTag(); + tag.setPageContext(pageContext); + tag.setTest("false"); + + int result = tag.doStartTag(); + tag.doEndTag(); + + assertEquals(result, TagSupport.SKIP_BODY); + } + + + protected void setUp() throws Exception { + stack = ValueStackFactory.getFactory().createValueStack(); + + jspWriter = new MockJspWriter(); + + StrutsMockHttpServletRequest request = new StrutsMockHttpServletRequest(); + + StrutsMockServletContext servletContext = new StrutsMockServletContext(); + servletContext.setServletInfo("not-weblogic"); + + pageContext = new MockPageContext(); + pageContext.setJspWriter(jspWriter); + pageContext.setRequest(request); + pageContext.setServletContext(servletContext); + + request.setAttribute(ServletActionContext.STRUTS_VALUESTACK_KEY, stack); + } + + } diff --git a/core/src/test/java/org/apache/struts2/views/jsp/ElseTagTest.java b/core/src/test/java/org/apache/struts2/views/jsp/ElseTagTest.java index 51f236eaf..5d63dc38b 100644 --- a/core/src/test/java/org/apache/struts2/views/jsp/ElseTagTest.java +++ b/core/src/test/java/org/apache/struts2/views/jsp/ElseTagTest.java @@ -1,19 +1,22 @@ /* * $Id$ * - * Copyright 2006 The Apache Software Foundation. + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at + * http://www.apache.org/licenses/LICENSE-2.0 * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. */ package org.apache.struts2.views.jsp; @@ -40,12 +43,12 @@ public class ElseTagTest extends StrutsTestCase { public void testTestFalse() { - stack.getContext().put(If.ANSWER, new Boolean(false)); + stack.getContext().put(If.ANSWER, new Boolean(false)); int result = 0; try { - elseTag.setPageContext(pageContext); + elseTag.setPageContext(pageContext); result = elseTag.doStartTag(); elseTag.doEndTag(); } catch (JspException e) { @@ -71,7 +74,7 @@ public class ElseTagTest extends StrutsTestCase { } public void testTestTrue() { - stack.getContext().put(If.ANSWER, new Boolean(true)); + stack.getContext().put(If.ANSWER, new Boolean(true)); elseTag.setPageContext(pageContext); int result = 0; @@ -93,14 +96,14 @@ public class ElseTagTest extends StrutsTestCase { // create the mock http servlet request StrutsMockHttpServletRequest request = new StrutsMockHttpServletRequest(); - + // NOTE: in Struts Tag library, TagUtil gets stack from request, which will be set // when request going through the FilterDispatcher --> DispatcherUtil etc. route request.setAttribute(ServletActionContext.STRUTS_VALUESTACK_KEY, stack); StrutsMockServletContext servletContext = new StrutsMockServletContext(); servletContext.setServletInfo("not-weblogic"); - + // create the mock page context pageContext = new StrutsMockPageContext(); pageContext.setRequest(request); diff --git a/core/src/test/java/org/apache/struts2/views/jsp/IfTagTest.java b/core/src/test/java/org/apache/struts2/views/jsp/IfTagTest.java index 5848f066b..bbb3aa6a8 100644 --- a/core/src/test/java/org/apache/struts2/views/jsp/IfTagTest.java +++ b/core/src/test/java/org/apache/struts2/views/jsp/IfTagTest.java @@ -1,19 +1,22 @@ /* * $Id$ * - * Copyright 2006 The Apache Software Foundation. + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at + * http://www.apache.org/licenses/LICENSE-2.0 * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. */ package org.apache.struts2.views.jsp; @@ -152,169 +155,169 @@ public class IfTagTest extends TestCase { fail(); } } - - + + public void testIfElse1() throws Exception { - IfTag ifTag = new IfTag(); - ifTag.setPageContext(pageContext); - ifTag.setTest("true"); - - ElseTag elseTag = new ElseTag(); - elseTag.setPageContext(pageContext); - - int r1 = ifTag.doStartTag(); - ifTag.doEndTag(); - int r2 = elseTag.doStartTag(); - elseTag.doEndTag(); - - assertEquals(TagSupport.EVAL_BODY_INCLUDE, r1); - assertEquals(TagSupport.SKIP_BODY, r2); + IfTag ifTag = new IfTag(); + ifTag.setPageContext(pageContext); + ifTag.setTest("true"); + + ElseTag elseTag = new ElseTag(); + elseTag.setPageContext(pageContext); + + int r1 = ifTag.doStartTag(); + ifTag.doEndTag(); + int r2 = elseTag.doStartTag(); + elseTag.doEndTag(); + + assertEquals(TagSupport.EVAL_BODY_INCLUDE, r1); + assertEquals(TagSupport.SKIP_BODY, r2); } - + public void testIfElse2() throws Exception { - IfTag ifTag = new IfTag(); - ifTag.setPageContext(pageContext); - ifTag.setTest("false"); - - ElseTag elseTag = new ElseTag(); - elseTag.setPageContext(pageContext); - - int r1 = ifTag.doStartTag(); - ifTag.doEndTag(); - int r2 = elseTag.doStartTag(); - elseTag.doEndTag(); - - assertEquals(TagSupport.SKIP_BODY, r1); - assertEquals(TagSupport.EVAL_BODY_INCLUDE, r2); + IfTag ifTag = new IfTag(); + ifTag.setPageContext(pageContext); + ifTag.setTest("false"); + + ElseTag elseTag = new ElseTag(); + elseTag.setPageContext(pageContext); + + int r1 = ifTag.doStartTag(); + ifTag.doEndTag(); + int r2 = elseTag.doStartTag(); + elseTag.doEndTag(); + + assertEquals(TagSupport.SKIP_BODY, r1); + assertEquals(TagSupport.EVAL_BODY_INCLUDE, r2); } - + public void testIfElseIf() throws Exception { - IfTag ifTag = new IfTag(); - ifTag.setPageContext(pageContext); - ifTag.setTest("false"); - - ElseIfTag elseIfTag1 = new ElseIfTag(); - elseIfTag1.setPageContext(pageContext); - elseIfTag1.setTest("false"); - - ElseIfTag elseIfTag2 = new ElseIfTag(); - elseIfTag2.setPageContext(pageContext); - elseIfTag2.setTest("true"); - - ElseIfTag elseIfTag3 = new ElseIfTag(); - elseIfTag3.setPageContext(pageContext); - elseIfTag3.setTest("true"); - - int r1 = ifTag.doStartTag(); - ifTag.doEndTag(); - int r2 = elseIfTag1.doStartTag(); - elseIfTag1.doEndTag(); - int r3 = elseIfTag2.doStartTag(); - elseIfTag2.doEndTag(); - int r4 = elseIfTag3.doStartTag(); - elseIfTag3.doEndTag(); - - assertEquals(TagSupport.SKIP_BODY, r1); - assertEquals(TagSupport.SKIP_BODY, r2); - assertEquals(TagSupport.EVAL_BODY_INCLUDE, r3); - assertEquals(TagSupport.SKIP_BODY, r4); + IfTag ifTag = new IfTag(); + ifTag.setPageContext(pageContext); + ifTag.setTest("false"); + + ElseIfTag elseIfTag1 = new ElseIfTag(); + elseIfTag1.setPageContext(pageContext); + elseIfTag1.setTest("false"); + + ElseIfTag elseIfTag2 = new ElseIfTag(); + elseIfTag2.setPageContext(pageContext); + elseIfTag2.setTest("true"); + + ElseIfTag elseIfTag3 = new ElseIfTag(); + elseIfTag3.setPageContext(pageContext); + elseIfTag3.setTest("true"); + + int r1 = ifTag.doStartTag(); + ifTag.doEndTag(); + int r2 = elseIfTag1.doStartTag(); + elseIfTag1.doEndTag(); + int r3 = elseIfTag2.doStartTag(); + elseIfTag2.doEndTag(); + int r4 = elseIfTag3.doStartTag(); + elseIfTag3.doEndTag(); + + assertEquals(TagSupport.SKIP_BODY, r1); + assertEquals(TagSupport.SKIP_BODY, r2); + assertEquals(TagSupport.EVAL_BODY_INCLUDE, r3); + assertEquals(TagSupport.SKIP_BODY, r4); } - + public void testIfElseIfElse() throws Exception { - IfTag ifTag = new IfTag(); - ifTag.setPageContext(pageContext); - ifTag.setTest("false"); - - ElseIfTag elseIfTag1 = new ElseIfTag(); - elseIfTag1.setPageContext(pageContext); - elseIfTag1.setTest("false"); - - ElseIfTag elseIfTag2 = new ElseIfTag(); - elseIfTag2.setPageContext(pageContext); - elseIfTag2.setTest("false"); - - ElseIfTag elseIfTag3 = new ElseIfTag(); - elseIfTag3.setPageContext(pageContext); - elseIfTag3.setTest("false"); - - ElseTag elseTag = new ElseTag(); - elseTag.setPageContext(pageContext); - - int r1 = ifTag.doStartTag(); - ifTag.doEndTag(); - int r2 = elseIfTag1.doStartTag(); - elseIfTag1.doEndTag(); - int r3 = elseIfTag2.doStartTag(); - elseIfTag2.doEndTag(); - int r4 = elseIfTag3.doStartTag(); - elseIfTag3.doEndTag(); - int r5 = elseTag.doStartTag(); - elseTag.doEndTag(); - - assertEquals(TagSupport.SKIP_BODY, r1); - assertEquals(TagSupport.SKIP_BODY, r2); - assertEquals(TagSupport.SKIP_BODY, r3); - assertEquals(TagSupport.SKIP_BODY, r4); - assertEquals(TagSupport.EVAL_BODY_INCLUDE, r5); + IfTag ifTag = new IfTag(); + ifTag.setPageContext(pageContext); + ifTag.setTest("false"); + + ElseIfTag elseIfTag1 = new ElseIfTag(); + elseIfTag1.setPageContext(pageContext); + elseIfTag1.setTest("false"); + + ElseIfTag elseIfTag2 = new ElseIfTag(); + elseIfTag2.setPageContext(pageContext); + elseIfTag2.setTest("false"); + + ElseIfTag elseIfTag3 = new ElseIfTag(); + elseIfTag3.setPageContext(pageContext); + elseIfTag3.setTest("false"); + + ElseTag elseTag = new ElseTag(); + elseTag.setPageContext(pageContext); + + int r1 = ifTag.doStartTag(); + ifTag.doEndTag(); + int r2 = elseIfTag1.doStartTag(); + elseIfTag1.doEndTag(); + int r3 = elseIfTag2.doStartTag(); + elseIfTag2.doEndTag(); + int r4 = elseIfTag3.doStartTag(); + elseIfTag3.doEndTag(); + int r5 = elseTag.doStartTag(); + elseTag.doEndTag(); + + assertEquals(TagSupport.SKIP_BODY, r1); + assertEquals(TagSupport.SKIP_BODY, r2); + assertEquals(TagSupport.SKIP_BODY, r3); + assertEquals(TagSupport.SKIP_BODY, r4); + assertEquals(TagSupport.EVAL_BODY_INCLUDE, r5); } - - + + public void testNestedIfElse1() throws Exception { - IfTag ifTag = new IfTag(); - ifTag.setPageContext(pageContext); - ifTag.setTest("true"); - - IfTag nestedIfTag = new IfTag(); - nestedIfTag.setPageContext(pageContext); - nestedIfTag.setTest("true"); - - ElseTag elseTag = new ElseTag(); - elseTag.setPageContext(pageContext); - - int r1 = ifTag.doStartTag(); - int r2 = nestedIfTag.doStartTag(); - int r3 = nestedIfTag.doEndTag(); - int r4 = ifTag.doEndTag(); - int r5 = elseTag.doStartTag(); - int r6 = elseTag.doEndTag(); - - assertEquals(TagSupport.EVAL_BODY_INCLUDE, r1); - assertEquals(TagSupport.EVAL_BODY_INCLUDE, r2); - assertEquals(TagSupport.EVAL_PAGE, r3); - assertEquals(TagSupport.EVAL_PAGE, r4); - assertEquals(TagSupport.SKIP_BODY, r5); - assertEquals(TagSupport.EVAL_PAGE, r6); + IfTag ifTag = new IfTag(); + ifTag.setPageContext(pageContext); + ifTag.setTest("true"); + + IfTag nestedIfTag = new IfTag(); + nestedIfTag.setPageContext(pageContext); + nestedIfTag.setTest("true"); + + ElseTag elseTag = new ElseTag(); + elseTag.setPageContext(pageContext); + + int r1 = ifTag.doStartTag(); + int r2 = nestedIfTag.doStartTag(); + int r3 = nestedIfTag.doEndTag(); + int r4 = ifTag.doEndTag(); + int r5 = elseTag.doStartTag(); + int r6 = elseTag.doEndTag(); + + assertEquals(TagSupport.EVAL_BODY_INCLUDE, r1); + assertEquals(TagSupport.EVAL_BODY_INCLUDE, r2); + assertEquals(TagSupport.EVAL_PAGE, r3); + assertEquals(TagSupport.EVAL_PAGE, r4); + assertEquals(TagSupport.SKIP_BODY, r5); + assertEquals(TagSupport.EVAL_PAGE, r6); } - + public void testNestedIfElse2() throws Exception { - IfTag ifTag = new IfTag(); - ifTag.setPageContext(pageContext); - ifTag.setTest("true"); - - IfTag nestedIfTag = new IfTag(); - nestedIfTag.setPageContext(pageContext); - nestedIfTag.setTest("false"); - - ElseTag elseTag = new ElseTag(); - elseTag.setPageContext(pageContext); - - int r1 = ifTag.doStartTag(); - int r2 = nestedIfTag.doStartTag(); - int r3 = nestedIfTag.doEndTag(); - int r4 = ifTag.doEndTag(); - int r5 = elseTag.doStartTag(); - int r6 = elseTag.doEndTag(); - - assertEquals(TagSupport.EVAL_BODY_INCLUDE, r1); - assertEquals(TagSupport.SKIP_BODY, r2); - assertEquals(TagSupport.EVAL_PAGE, r3); - assertEquals(TagSupport.EVAL_PAGE, r4); - assertEquals(TagSupport.SKIP_BODY, r5); - assertEquals(TagSupport.EVAL_PAGE, r6); + IfTag ifTag = new IfTag(); + ifTag.setPageContext(pageContext); + ifTag.setTest("true"); + + IfTag nestedIfTag = new IfTag(); + nestedIfTag.setPageContext(pageContext); + nestedIfTag.setTest("false"); + + ElseTag elseTag = new ElseTag(); + elseTag.setPageContext(pageContext); + + int r1 = ifTag.doStartTag(); + int r2 = nestedIfTag.doStartTag(); + int r3 = nestedIfTag.doEndTag(); + int r4 = ifTag.doEndTag(); + int r5 = elseTag.doStartTag(); + int r6 = elseTag.doEndTag(); + + assertEquals(TagSupport.EVAL_BODY_INCLUDE, r1); + assertEquals(TagSupport.SKIP_BODY, r2); + assertEquals(TagSupport.EVAL_PAGE, r3); + assertEquals(TagSupport.EVAL_PAGE, r4); + assertEquals(TagSupport.SKIP_BODY, r5); + assertEquals(TagSupport.EVAL_PAGE, r6); } - - - + + + protected void setUp() throws Exception { // create the needed objects @@ -330,7 +333,7 @@ public class IfTagTest extends TestCase { pageContext = new MockPageContext(); pageContext.setRequest(request); pageContext.setJspWriter(new MockJspWriter()); - + // associate the tag with the mock page request tag.setPageContext(pageContext); } diff --git a/core/src/test/java/org/apache/struts2/views/jsp/IncludeTagTest.java b/core/src/test/java/org/apache/struts2/views/jsp/IncludeTagTest.java index 02065b707..4b47a237d 100644 --- a/core/src/test/java/org/apache/struts2/views/jsp/IncludeTagTest.java +++ b/core/src/test/java/org/apache/struts2/views/jsp/IncludeTagTest.java @@ -1,19 +1,22 @@ /* * $Id$ * - * Copyright 2006 The Apache Software Foundation. + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at + * http://www.apache.org/licenses/LICENSE-2.0 * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. */ package org.apache.struts2.views.jsp; diff --git a/core/src/test/java/org/apache/struts2/views/jsp/IteratorGeneratorTagTest.java b/core/src/test/java/org/apache/struts2/views/jsp/IteratorGeneratorTagTest.java index a61babbaf..1ab1ef6a7 100644 --- a/core/src/test/java/org/apache/struts2/views/jsp/IteratorGeneratorTagTest.java +++ b/core/src/test/java/org/apache/struts2/views/jsp/IteratorGeneratorTagTest.java @@ -1,19 +1,22 @@ /* * $Id$ * - * Copyright 2006 The Apache Software Foundation. + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at + * http://www.apache.org/licenses/LICENSE-2.0 * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. */ package org.apache.struts2.views.jsp; @@ -27,181 +30,181 @@ import com.opensymphony.xwork2.ActionSupport; /** * Test case for IteratorGeneratorTag. - * + * */ public class IteratorGeneratorTagTest extends AbstractTagTest { - public void testGeneratorBasic() throws Exception { - IteratorGeneratorTag tag = new IteratorGeneratorTag(); - - tag.setPageContext(pageContext); - tag.setVal("%{'aaa,bbb,ccc,ddd,eee'}"); - tag.doStartTag(); - Object topOfStack = stack.findValue("top"); - - - assertTrue(topOfStack instanceof Iterator); - // 1 - assertTrue(((Iterator)topOfStack).hasNext()); - assertEquals(((Iterator)topOfStack).next(), "aaa"); - // 2 - assertTrue(((Iterator)topOfStack).hasNext()); - assertEquals(((Iterator)topOfStack).next(), "bbb"); - // 3 - assertTrue(((Iterator)topOfStack).hasNext()); - assertEquals(((Iterator)topOfStack).next(), "ccc"); - // 4 - assertTrue(((Iterator)topOfStack).hasNext()); - assertEquals(((Iterator)topOfStack).next(), "ddd"); - // 5 - assertTrue(((Iterator)topOfStack).hasNext()); - assertEquals(((Iterator)topOfStack).next(),"eee"); - - assertFalse(((Iterator)topOfStack).hasNext()); - - tag.doEndTag(); - Object afterTopOfStack = stack.findValue("top"); - - - assertNotSame(afterTopOfStack, topOfStack); - } - - public void testGeneratorWithSeparator() throws Exception { - IteratorGeneratorTag tag = new IteratorGeneratorTag(); - - tag.setPageContext(pageContext); - tag.setVal("%{'aaa|bbb|ccc|ddd|eee'}"); - tag.setSeparator("|"); - tag.doStartTag(); - Object topOfStack = stack.findValue("top"); - tag.doEndTag(); - Object afterTopOfStack = stack.findValue("top"); - - assertTrue(topOfStack instanceof Iterator); - // 1 - assertTrue(((Iterator)topOfStack).hasNext()); - assertEquals(((Iterator)topOfStack).next(), "aaa"); - // 2 - assertTrue(((Iterator)topOfStack).hasNext()); - assertEquals(((Iterator)topOfStack).next(), "bbb"); - // 3 - assertTrue(((Iterator)topOfStack).hasNext()); - assertEquals(((Iterator)topOfStack).next(), "ccc"); - // 4 - assertTrue(((Iterator)topOfStack).hasNext()); - assertEquals(((Iterator)topOfStack).next(), "ddd"); - // 5 - assertTrue(((Iterator)topOfStack).hasNext()); - assertEquals(((Iterator)topOfStack).next(), "eee"); - - assertFalse(((Iterator)topOfStack).hasNext()); - assertNotSame(afterTopOfStack, topOfStack); - } - - public void testGeneratorWithConverter() throws Exception { - IteratorGeneratorTag tag = new IteratorGeneratorTag(); - - tag.setPageContext(pageContext); - tag.setVal("%{'aaa, bbb, ccc, ddd, eee'}"); - tag.setConverter("myConverter"); - tag.doStartTag(); - Object topOfStack = stack.findValue("top"); - tag.doEndTag(); - Object afterTopOfStack = stack.findValue("top"); - - assertTrue(topOfStack instanceof Iterator); - // 1. - assertTrue(((Iterator)topOfStack).hasNext()); - assertEquals(((Iterator)topOfStack).next(), "myConverter-aaa"); - // 2 - assertTrue(((Iterator)topOfStack).hasNext()); - assertEquals(((Iterator)topOfStack).next(), "myConverter-bbb"); - // 3 - assertTrue(((Iterator)topOfStack).hasNext()); - assertEquals(((Iterator)topOfStack).next(), "myConverter-ccc"); - // 4. - assertTrue(((Iterator)topOfStack).hasNext()); - assertEquals(((Iterator)topOfStack).next(), "myConverter-ddd"); - // 5. - assertTrue(((Iterator)topOfStack).hasNext()); - assertEquals(((Iterator)topOfStack).next(), "myConverter-eee"); - - assertFalse(((Iterator)topOfStack).hasNext()); - assertNotSame(afterTopOfStack, topOfStack); - } - - public void testGeneratorWithId() throws Exception { - IteratorGeneratorTag tag = new IteratorGeneratorTag(); - tag.setPageContext(pageContext); - tag.setVal("%{'aaa,bbb,ccc,ddd,eee'}"); - tag.setId("myPageContextAttId"); - tag.doStartTag(); - tag.doEndTag(); - - Object pageContextIterator = pageContext.getAttribute("myPageContextAttId"); - - assertTrue(pageContextIterator instanceof Iterator); - // 1 - assertTrue(((Iterator)pageContextIterator).hasNext()); - assertEquals(((Iterator)pageContextIterator).next(), "aaa"); - // 2. - assertTrue(((Iterator)pageContextIterator).hasNext()); - assertEquals(((Iterator)pageContextIterator).next(), "bbb"); - // 3. - assertTrue(((Iterator)pageContextIterator).hasNext()); - assertEquals(((Iterator)pageContextIterator).next(), "ccc"); - // 4 - assertTrue(((Iterator)pageContextIterator).hasNext()); - assertEquals(((Iterator)pageContextIterator).next(), "ddd"); - // 5 - assertTrue(((Iterator)pageContextIterator).hasNext()); - assertEquals(((Iterator)pageContextIterator).next(), "eee"); - - assertFalse(((Iterator)pageContextIterator).hasNext()); - } - - public void testGeneratorWithCount() throws Exception { - IteratorGeneratorTag tag = new IteratorGeneratorTag(); - - tag.setPageContext(pageContext); - tag.setVal("%{'aaa,bbb,ccc,ddd,eee'}"); - tag.setCount("myCount"); - tag.doStartTag(); - Object topOfStack = stack.findValue("top"); - tag.doEndTag(); - Object afterTopOfStack = stack.findValue("top"); - - - assertTrue(topOfStack instanceof Iterator); - // 1 - assertTrue(((Iterator)topOfStack).hasNext()); - assertEquals(((Iterator)topOfStack).next(), "aaa"); - // 2 - assertTrue(((Iterator)topOfStack).hasNext()); - assertEquals(((Iterator)topOfStack).next(), "bbb"); - // 3. - assertTrue(((Iterator)topOfStack).hasNext()); - assertEquals(((Iterator)topOfStack).next(), "ccc"); - - assertFalse(((Iterator)topOfStack).hasNext()); - assertNotSame(topOfStack, afterTopOfStack); - } - - - public Action getAction() { - return new ActionSupport() { - public Converter getMyConverter() { - return new Converter() { - public Object convert(String value) throws Exception { - return "myConverter-"+value; - } - }; - } - - public int getMyCount() { - return 3; - } - }; - } + public void testGeneratorBasic() throws Exception { + IteratorGeneratorTag tag = new IteratorGeneratorTag(); + + tag.setPageContext(pageContext); + tag.setVal("%{'aaa,bbb,ccc,ddd,eee'}"); + tag.doStartTag(); + Object topOfStack = stack.findValue("top"); + + + assertTrue(topOfStack instanceof Iterator); + // 1 + assertTrue(((Iterator)topOfStack).hasNext()); + assertEquals(((Iterator)topOfStack).next(), "aaa"); + // 2 + assertTrue(((Iterator)topOfStack).hasNext()); + assertEquals(((Iterator)topOfStack).next(), "bbb"); + // 3 + assertTrue(((Iterator)topOfStack).hasNext()); + assertEquals(((Iterator)topOfStack).next(), "ccc"); + // 4 + assertTrue(((Iterator)topOfStack).hasNext()); + assertEquals(((Iterator)topOfStack).next(), "ddd"); + // 5 + assertTrue(((Iterator)topOfStack).hasNext()); + assertEquals(((Iterator)topOfStack).next(),"eee"); + + assertFalse(((Iterator)topOfStack).hasNext()); + + tag.doEndTag(); + Object afterTopOfStack = stack.findValue("top"); + + + assertNotSame(afterTopOfStack, topOfStack); + } + + public void testGeneratorWithSeparator() throws Exception { + IteratorGeneratorTag tag = new IteratorGeneratorTag(); + + tag.setPageContext(pageContext); + tag.setVal("%{'aaa|bbb|ccc|ddd|eee'}"); + tag.setSeparator("|"); + tag.doStartTag(); + Object topOfStack = stack.findValue("top"); + tag.doEndTag(); + Object afterTopOfStack = stack.findValue("top"); + + assertTrue(topOfStack instanceof Iterator); + // 1 + assertTrue(((Iterator)topOfStack).hasNext()); + assertEquals(((Iterator)topOfStack).next(), "aaa"); + // 2 + assertTrue(((Iterator)topOfStack).hasNext()); + assertEquals(((Iterator)topOfStack).next(), "bbb"); + // 3 + assertTrue(((Iterator)topOfStack).hasNext()); + assertEquals(((Iterator)topOfStack).next(), "ccc"); + // 4 + assertTrue(((Iterator)topOfStack).hasNext()); + assertEquals(((Iterator)topOfStack).next(), "ddd"); + // 5 + assertTrue(((Iterator)topOfStack).hasNext()); + assertEquals(((Iterator)topOfStack).next(), "eee"); + + assertFalse(((Iterator)topOfStack).hasNext()); + assertNotSame(afterTopOfStack, topOfStack); + } + + public void testGeneratorWithConverter() throws Exception { + IteratorGeneratorTag tag = new IteratorGeneratorTag(); + + tag.setPageContext(pageContext); + tag.setVal("%{'aaa, bbb, ccc, ddd, eee'}"); + tag.setConverter("myConverter"); + tag.doStartTag(); + Object topOfStack = stack.findValue("top"); + tag.doEndTag(); + Object afterTopOfStack = stack.findValue("top"); + + assertTrue(topOfStack instanceof Iterator); + // 1. + assertTrue(((Iterator)topOfStack).hasNext()); + assertEquals(((Iterator)topOfStack).next(), "myConverter-aaa"); + // 2 + assertTrue(((Iterator)topOfStack).hasNext()); + assertEquals(((Iterator)topOfStack).next(), "myConverter-bbb"); + // 3 + assertTrue(((Iterator)topOfStack).hasNext()); + assertEquals(((Iterator)topOfStack).next(), "myConverter-ccc"); + // 4. + assertTrue(((Iterator)topOfStack).hasNext()); + assertEquals(((Iterator)topOfStack).next(), "myConverter-ddd"); + // 5. + assertTrue(((Iterator)topOfStack).hasNext()); + assertEquals(((Iterator)topOfStack).next(), "myConverter-eee"); + + assertFalse(((Iterator)topOfStack).hasNext()); + assertNotSame(afterTopOfStack, topOfStack); + } + + public void testGeneratorWithId() throws Exception { + IteratorGeneratorTag tag = new IteratorGeneratorTag(); + tag.setPageContext(pageContext); + tag.setVal("%{'aaa,bbb,ccc,ddd,eee'}"); + tag.setId("myPageContextAttId"); + tag.doStartTag(); + tag.doEndTag(); + + Object pageContextIterator = pageContext.getAttribute("myPageContextAttId"); + + assertTrue(pageContextIterator instanceof Iterator); + // 1 + assertTrue(((Iterator)pageContextIterator).hasNext()); + assertEquals(((Iterator)pageContextIterator).next(), "aaa"); + // 2. + assertTrue(((Iterator)pageContextIterator).hasNext()); + assertEquals(((Iterator)pageContextIterator).next(), "bbb"); + // 3. + assertTrue(((Iterator)pageContextIterator).hasNext()); + assertEquals(((Iterator)pageContextIterator).next(), "ccc"); + // 4 + assertTrue(((Iterator)pageContextIterator).hasNext()); + assertEquals(((Iterator)pageContextIterator).next(), "ddd"); + // 5 + assertTrue(((Iterator)pageContextIterator).hasNext()); + assertEquals(((Iterator)pageContextIterator).next(), "eee"); + + assertFalse(((Iterator)pageContextIterator).hasNext()); + } + + public void testGeneratorWithCount() throws Exception { + IteratorGeneratorTag tag = new IteratorGeneratorTag(); + + tag.setPageContext(pageContext); + tag.setVal("%{'aaa,bbb,ccc,ddd,eee'}"); + tag.setCount("myCount"); + tag.doStartTag(); + Object topOfStack = stack.findValue("top"); + tag.doEndTag(); + Object afterTopOfStack = stack.findValue("top"); + + + assertTrue(topOfStack instanceof Iterator); + // 1 + assertTrue(((Iterator)topOfStack).hasNext()); + assertEquals(((Iterator)topOfStack).next(), "aaa"); + // 2 + assertTrue(((Iterator)topOfStack).hasNext()); + assertEquals(((Iterator)topOfStack).next(), "bbb"); + // 3. + assertTrue(((Iterator)topOfStack).hasNext()); + assertEquals(((Iterator)topOfStack).next(), "ccc"); + + assertFalse(((Iterator)topOfStack).hasNext()); + assertNotSame(topOfStack, afterTopOfStack); + } + + + public Action getAction() { + return new ActionSupport() { + public Converter getMyConverter() { + return new Converter() { + public Object convert(String value) throws Exception { + return "myConverter-"+value; + } + }; + } + + public int getMyCount() { + return 3; + } + }; + } } diff --git a/core/src/test/java/org/apache/struts2/views/jsp/IteratorTagTest.java b/core/src/test/java/org/apache/struts2/views/jsp/IteratorTagTest.java index cde39494c..c03480236 100644 --- a/core/src/test/java/org/apache/struts2/views/jsp/IteratorTagTest.java +++ b/core/src/test/java/org/apache/struts2/views/jsp/IteratorTagTest.java @@ -1,19 +1,22 @@ /* * $Id$ * - * Copyright 2006 The Apache Software Foundation. + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at + * http://www.apache.org/licenses/LICENSE-2.0 * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. */ package org.apache.struts2.views.jsp; @@ -31,74 +34,74 @@ import com.mockobjects.servlet.MockJspWriter; /** - * Test Case for Iterator Tag - * + * Test Case for Iterator Tag + * */ public class IteratorTagTest extends AbstractUITagTest { IteratorTag tag; - - public void testIteratingWithIdSpecified() throws Exception { - List list = new ArrayList(); - list.add("one"); - list.add("two"); - list.add("three"); - list.add("four"); - list.add("five"); - - Foo foo = new Foo(); - foo.setList(list); - - stack.push(foo); - - tag.setValue("list"); - tag.setId("myId"); - - // one - int result = tag.doStartTag(); - assertEquals(result, TagSupport.EVAL_BODY_INCLUDE); - assertEquals(stack.peek(), "one"); - assertEquals(stack.getContext().get("myId"), "one"); - - tag.doInitBody(); - - // two - result = tag.doAfterBody(); - assertEquals(result, TagSupport.EVAL_BODY_AGAIN); - assertEquals(stack.peek(), "two"); - assertEquals(stack.getContext().get("myId"), "two"); - - - // three - result = tag.doAfterBody(); - assertEquals(result, TagSupport.EVAL_BODY_AGAIN); - assertEquals(stack.peek(), "three"); - assertEquals(stack.getContext().get("myId"), "three"); - - - // four - result = tag.doAfterBody(); - assertEquals(result, TagSupport.EVAL_BODY_AGAIN); - assertEquals(stack.peek(), "four"); - assertEquals(stack.getContext().get("myId"), "four"); - - - // five - result = tag.doAfterBody(); - assertEquals(result, TagSupport.EVAL_BODY_AGAIN); - assertEquals(stack.peek(), "five"); - assertEquals(stack.getContext().get("myId"), "five"); - - - result = tag.doAfterBody(); - assertEquals(result, TagSupport.SKIP_BODY); - - result = tag.doEndTag(); - assertEquals(result, TagSupport.EVAL_PAGE); + public void testIteratingWithIdSpecified() throws Exception { + List list = new ArrayList(); + list.add("one"); + list.add("two"); + list.add("three"); + list.add("four"); + list.add("five"); + + Foo foo = new Foo(); + foo.setList(list); + + stack.push(foo); + + tag.setValue("list"); + tag.setId("myId"); + + // one + int result = tag.doStartTag(); + assertEquals(result, TagSupport.EVAL_BODY_INCLUDE); + assertEquals(stack.peek(), "one"); + assertEquals(stack.getContext().get("myId"), "one"); + + + tag.doInitBody(); + + // two + result = tag.doAfterBody(); + assertEquals(result, TagSupport.EVAL_BODY_AGAIN); + assertEquals(stack.peek(), "two"); + assertEquals(stack.getContext().get("myId"), "two"); + + + // three + result = tag.doAfterBody(); + assertEquals(result, TagSupport.EVAL_BODY_AGAIN); + assertEquals(stack.peek(), "three"); + assertEquals(stack.getContext().get("myId"), "three"); + + + // four + result = tag.doAfterBody(); + assertEquals(result, TagSupport.EVAL_BODY_AGAIN); + assertEquals(stack.peek(), "four"); + assertEquals(stack.getContext().get("myId"), "four"); + + + // five + result = tag.doAfterBody(); + assertEquals(result, TagSupport.EVAL_BODY_AGAIN); + assertEquals(stack.peek(), "five"); + assertEquals(stack.getContext().get("myId"), "five"); + + + result = tag.doAfterBody(); + assertEquals(result, TagSupport.SKIP_BODY); + + result = tag.doEndTag(); + assertEquals(result, TagSupport.EVAL_PAGE); } - + public void testArrayIterator() { Foo foo = new Foo(); diff --git a/core/src/test/java/org/apache/struts2/views/jsp/MergeIteratorTagTest.java b/core/src/test/java/org/apache/struts2/views/jsp/MergeIteratorTagTest.java index c88bf5d23..fcf5140ed 100644 --- a/core/src/test/java/org/apache/struts2/views/jsp/MergeIteratorTagTest.java +++ b/core/src/test/java/org/apache/struts2/views/jsp/MergeIteratorTagTest.java @@ -1,19 +1,22 @@ /* * $Id$ * - * Copyright 2006 The Apache Software Foundation. + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at + * http://www.apache.org/licenses/LICENSE-2.0 * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. */ package org.apache.struts2.views.jsp; @@ -28,153 +31,153 @@ import com.opensymphony.xwork2.ActionSupport; /** * Test case for MergeIteratorTag. - * + * */ public class MergeIteratorTagTest extends AbstractTagTest { - public void testMergingIteratorWithArrayAsSource() throws Exception { - MergeIteratorTag tag = new MergeIteratorTag(); - tag.setPageContext(pageContext); - tag.setId("myMergedIterator"); - - ParamTag iterator1ParamTag = new ParamTag(); - iterator1ParamTag.setPageContext(pageContext); - iterator1ParamTag.setValue("myArr1"); - - ParamTag iterator2ParamTag = new ParamTag(); - iterator2ParamTag.setPageContext(pageContext); - iterator2ParamTag.setValue("myArr2"); - - ParamTag iterator3ParamTag = new ParamTag(); - iterator3ParamTag.setPageContext(pageContext); - iterator3ParamTag.setValue("myArr3"); - - - tag.doStartTag(); - iterator1ParamTag.doStartTag(); - iterator1ParamTag.doEndTag(); - iterator2ParamTag.doStartTag(); - iterator2ParamTag.doEndTag(); - iterator3ParamTag.doStartTag(); - iterator3ParamTag.doEndTag(); - tag.doEndTag(); - - Iterator mergedIterator = (Iterator) stack.findValue("#myMergedIterator"); // if not iterator, let CCE surface - - assertNotNull(mergedIterator); - assertTrue(mergedIterator.hasNext()); - assertEquals(mergedIterator.next(), "1"); - assertTrue(mergedIterator.hasNext()); - assertEquals(mergedIterator.next(), "a"); - assertTrue(mergedIterator.hasNext()); - assertEquals(mergedIterator.next(), "A"); - assertTrue(mergedIterator.hasNext()); - assertEquals(mergedIterator.next(), "2"); - assertTrue(mergedIterator.hasNext()); - assertEquals(mergedIterator.next(), "b"); - assertTrue(mergedIterator.hasNext()); - assertEquals(mergedIterator.next(), "B"); - assertTrue(mergedIterator.hasNext()); - assertEquals(mergedIterator.next(), "3"); - assertTrue(mergedIterator.hasNext()); - assertEquals(mergedIterator.next(), "c"); - assertTrue(mergedIterator.hasNext()); - assertEquals(mergedIterator.next(), "C"); - assertFalse(mergedIterator.hasNext()); - } - + public void testMergingIteratorWithArrayAsSource() throws Exception { + MergeIteratorTag tag = new MergeIteratorTag(); + tag.setPageContext(pageContext); + tag.setId("myMergedIterator"); - public void testMergingIteratorsWithListAsSource() throws Exception { - MergeIteratorTag tag = new MergeIteratorTag(); - tag.setPageContext(pageContext); - tag.setId("myMergedIterator"); - - ParamTag iterator1ParamTag = new ParamTag(); - iterator1ParamTag.setPageContext(pageContext); - iterator1ParamTag.setValue("myList1"); - - ParamTag iterator2ParamTag = new ParamTag(); - iterator2ParamTag.setPageContext(pageContext); - iterator2ParamTag.setValue("myList2"); - - ParamTag iterator3ParamTag = new ParamTag(); - iterator3ParamTag.setPageContext(pageContext); - iterator3ParamTag.setValue("myList3"); - - - tag.doStartTag(); - iterator1ParamTag.doStartTag(); - iterator1ParamTag.doEndTag(); - iterator2ParamTag.doStartTag(); - iterator2ParamTag.doEndTag(); - iterator3ParamTag.doStartTag(); - iterator3ParamTag.doEndTag(); - tag.doEndTag(); - - Iterator mergedIterator = (Iterator) stack.findValue("#myMergedIterator"); // if not iterator, let CCE surface - - assertNotNull(mergedIterator); - assertTrue(mergedIterator.hasNext()); - assertEquals(mergedIterator.next(), "1"); - assertTrue(mergedIterator.hasNext()); - assertEquals(mergedIterator.next(), "a"); - assertTrue(mergedIterator.hasNext()); - assertEquals(mergedIterator.next(), "A"); - assertTrue(mergedIterator.hasNext()); - assertEquals(mergedIterator.next(), "2"); - assertTrue(mergedIterator.hasNext()); - assertEquals(mergedIterator.next(), "b"); - assertTrue(mergedIterator.hasNext()); - assertEquals(mergedIterator.next(), "B"); - assertTrue(mergedIterator.hasNext()); - assertEquals(mergedIterator.next(), "3"); - assertTrue(mergedIterator.hasNext()); - assertEquals(mergedIterator.next(), "c"); - assertTrue(mergedIterator.hasNext()); - assertEquals(mergedIterator.next(), "C"); - assertFalse(mergedIterator.hasNext()); - } - - - - - public Action getAction() { - return new ActionSupport() { - public List getMyList1() { - List l = new ArrayList(); - l.add("1"); - l.add("2"); - l.add("3"); - return l; - } - - public List getMyList2() { - List l = new ArrayList(); - l.add("a"); - l.add("b"); - l.add("c"); - return l; - } - - public List getMyList3() { - List l = new ArrayList(); - l.add("A"); - l.add("B"); - l.add("C"); - return l; - } - - public String[] getMyArr1() { - return new String[] { "1", "2", "3" }; - } - - public String[] getMyArr2() { - return new String[] { "a", "b", "c" }; - } - - public String[] getMyArr3() { - return new String[] {"A", "B", "C"}; - } - }; - } + ParamTag iterator1ParamTag = new ParamTag(); + iterator1ParamTag.setPageContext(pageContext); + iterator1ParamTag.setValue("myArr1"); + + ParamTag iterator2ParamTag = new ParamTag(); + iterator2ParamTag.setPageContext(pageContext); + iterator2ParamTag.setValue("myArr2"); + + ParamTag iterator3ParamTag = new ParamTag(); + iterator3ParamTag.setPageContext(pageContext); + iterator3ParamTag.setValue("myArr3"); + + + tag.doStartTag(); + iterator1ParamTag.doStartTag(); + iterator1ParamTag.doEndTag(); + iterator2ParamTag.doStartTag(); + iterator2ParamTag.doEndTag(); + iterator3ParamTag.doStartTag(); + iterator3ParamTag.doEndTag(); + tag.doEndTag(); + + Iterator mergedIterator = (Iterator) stack.findValue("#myMergedIterator"); // if not iterator, let CCE surface + + assertNotNull(mergedIterator); + assertTrue(mergedIterator.hasNext()); + assertEquals(mergedIterator.next(), "1"); + assertTrue(mergedIterator.hasNext()); + assertEquals(mergedIterator.next(), "a"); + assertTrue(mergedIterator.hasNext()); + assertEquals(mergedIterator.next(), "A"); + assertTrue(mergedIterator.hasNext()); + assertEquals(mergedIterator.next(), "2"); + assertTrue(mergedIterator.hasNext()); + assertEquals(mergedIterator.next(), "b"); + assertTrue(mergedIterator.hasNext()); + assertEquals(mergedIterator.next(), "B"); + assertTrue(mergedIterator.hasNext()); + assertEquals(mergedIterator.next(), "3"); + assertTrue(mergedIterator.hasNext()); + assertEquals(mergedIterator.next(), "c"); + assertTrue(mergedIterator.hasNext()); + assertEquals(mergedIterator.next(), "C"); + assertFalse(mergedIterator.hasNext()); + } + + + public void testMergingIteratorsWithListAsSource() throws Exception { + MergeIteratorTag tag = new MergeIteratorTag(); + tag.setPageContext(pageContext); + tag.setId("myMergedIterator"); + + ParamTag iterator1ParamTag = new ParamTag(); + iterator1ParamTag.setPageContext(pageContext); + iterator1ParamTag.setValue("myList1"); + + ParamTag iterator2ParamTag = new ParamTag(); + iterator2ParamTag.setPageContext(pageContext); + iterator2ParamTag.setValue("myList2"); + + ParamTag iterator3ParamTag = new ParamTag(); + iterator3ParamTag.setPageContext(pageContext); + iterator3ParamTag.setValue("myList3"); + + + tag.doStartTag(); + iterator1ParamTag.doStartTag(); + iterator1ParamTag.doEndTag(); + iterator2ParamTag.doStartTag(); + iterator2ParamTag.doEndTag(); + iterator3ParamTag.doStartTag(); + iterator3ParamTag.doEndTag(); + tag.doEndTag(); + + Iterator mergedIterator = (Iterator) stack.findValue("#myMergedIterator"); // if not iterator, let CCE surface + + assertNotNull(mergedIterator); + assertTrue(mergedIterator.hasNext()); + assertEquals(mergedIterator.next(), "1"); + assertTrue(mergedIterator.hasNext()); + assertEquals(mergedIterator.next(), "a"); + assertTrue(mergedIterator.hasNext()); + assertEquals(mergedIterator.next(), "A"); + assertTrue(mergedIterator.hasNext()); + assertEquals(mergedIterator.next(), "2"); + assertTrue(mergedIterator.hasNext()); + assertEquals(mergedIterator.next(), "b"); + assertTrue(mergedIterator.hasNext()); + assertEquals(mergedIterator.next(), "B"); + assertTrue(mergedIterator.hasNext()); + assertEquals(mergedIterator.next(), "3"); + assertTrue(mergedIterator.hasNext()); + assertEquals(mergedIterator.next(), "c"); + assertTrue(mergedIterator.hasNext()); + assertEquals(mergedIterator.next(), "C"); + assertFalse(mergedIterator.hasNext()); + } + + + + + public Action getAction() { + return new ActionSupport() { + public List getMyList1() { + List l = new ArrayList(); + l.add("1"); + l.add("2"); + l.add("3"); + return l; + } + + public List getMyList2() { + List l = new ArrayList(); + l.add("a"); + l.add("b"); + l.add("c"); + return l; + } + + public List getMyList3() { + List l = new ArrayList(); + l.add("A"); + l.add("B"); + l.add("C"); + return l; + } + + public String[] getMyArr1() { + return new String[] { "1", "2", "3" }; + } + + public String[] getMyArr2() { + return new String[] { "a", "b", "c" }; + } + + public String[] getMyArr3() { + return new String[] {"A", "B", "C"}; + } + }; + } } diff --git a/core/src/test/java/org/apache/struts2/views/jsp/PortletUrlTagTest.java b/core/src/test/java/org/apache/struts2/views/jsp/PortletUrlTagTest.java index 225fe840b..780078dfc 100644 --- a/core/src/test/java/org/apache/struts2/views/jsp/PortletUrlTagTest.java +++ b/core/src/test/java/org/apache/struts2/views/jsp/PortletUrlTagTest.java @@ -1,19 +1,22 @@ /* * $Id$ * - * Copyright 2006 The Apache Software Foundation. + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at + * http://www.apache.org/licenses/LICENSE-2.0 * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. */ package org.apache.struts2.views.jsp; @@ -53,87 +56,87 @@ import com.opensymphony.xwork2.util.ValueStackFactory; */ public class PortletUrlTagTest extends MockObjectTestCase { - URLTag tag = new URLTag(); + URLTag tag = new URLTag(); - Mock mockHttpReq = null; + Mock mockHttpReq = null; - Mock mockHttpRes = null; + Mock mockHttpRes = null; - Mock mockPortletReq = null; + Mock mockPortletReq = null; - Mock mockPortletRes = null; + Mock mockPortletRes = null; - Mock mockPageCtx = null; + Mock mockPageCtx = null; - Mock mockPortletUrl = null; - - MockJspWriter mockJspWriter = null; + Mock mockPortletUrl = null; - ValueStack stack = null; + MockJspWriter mockJspWriter = null; - public static void main(String[] args) { - TestRunner.run(PortletUrlTagTest.class); - } + ValueStack stack = null; - public void setUp() throws Exception { - super.setUp(); - - Settings.reset(); - Dispatcher.setInstance(new Dispatcher(null)); - - mockPortletApiAvailable(); - - stack = ValueStackFactory.getFactory().createValueStack(); - - - mockHttpReq = mock(HttpServletRequest.class); - mockHttpRes = mock(HttpServletResponse.class); - mockPortletReq = mock(RenderRequest.class); - mockPortletRes = mock(RenderResponse.class); - mockPageCtx = mock(PageContext.class); - mockPortletUrl = mock(PortletURL.class); - mockJspWriter = new MockJspWriter(); - - mockPageCtx.stubs().method("getRequest").will( - returnValue((HttpServletRequest) mockHttpReq.proxy())); - mockPageCtx.stubs().method("getResponse").will( - returnValue((HttpServletResponse) mockHttpRes.proxy())); - mockPageCtx.stubs().method("getOut").will(returnValue(mockJspWriter)); - - mockHttpReq.stubs().method("getScheme").will(returnValue("http")); - mockHttpReq.stubs().method("getAttribute").with( - eq("struts.valueStack")).will(returnValue(stack)); - mockHttpReq.stubs().method("getAttribute").with( - eq("javax.portlet.response")).will( - returnValue((PortletResponse) mockPortletRes.proxy())); - mockHttpReq.stubs().method("getAttribute").with( - eq("javax.portlet.request")).will( - returnValue((PortletRequest) mockPortletReq.proxy())); - - mockPortletReq.stubs().method("getPortletMode").will(returnValue(PortletMode.VIEW)); - mockPortletReq.stubs().method("getWindowState").will(returnValue(WindowState.NORMAL)); - mockPortletReq.stubs().method("getContextPath").will(returnValue("/contextPath")); - - tag.setPageContext((PageContext) mockPageCtx.proxy()); - - Map modeMap = new HashMap(); - modeMap.put(PortletMode.VIEW, "/view"); - modeMap.put(PortletMode.HELP, "/help"); - modeMap.put(PortletMode.EDIT, "/edit"); - Map sessionMap = new HashMap(); - Map contextMap = new HashMap(); - contextMap.put(ActionContext.SESSION, sessionMap); - contextMap.put(PortletActionConstants.REQUEST, mockPortletReq.proxy()); - contextMap.put(PortletActionConstants.RESPONSE, mockPortletRes.proxy()); - contextMap.put(PortletActionConstants.PHASE, PortletActionConstants.RENDER_PHASE); - contextMap.put(PortletActionConstants.MODE_NAMESPACE_MAP, modeMap); - ActionContext ctx = new ActionContext(contextMap); - ctx.setValueStack(stack); - ActionContext.setContext(ctx); + public static void main(String[] args) { + TestRunner.run(PortletUrlTagTest.class); } - /** - * + public void setUp() throws Exception { + super.setUp(); + + Settings.reset(); + Dispatcher.setInstance(new Dispatcher(null)); + + mockPortletApiAvailable(); + + stack = ValueStackFactory.getFactory().createValueStack(); + + + mockHttpReq = mock(HttpServletRequest.class); + mockHttpRes = mock(HttpServletResponse.class); + mockPortletReq = mock(RenderRequest.class); + mockPortletRes = mock(RenderResponse.class); + mockPageCtx = mock(PageContext.class); + mockPortletUrl = mock(PortletURL.class); + mockJspWriter = new MockJspWriter(); + + mockPageCtx.stubs().method("getRequest").will( + returnValue((HttpServletRequest) mockHttpReq.proxy())); + mockPageCtx.stubs().method("getResponse").will( + returnValue((HttpServletResponse) mockHttpRes.proxy())); + mockPageCtx.stubs().method("getOut").will(returnValue(mockJspWriter)); + + mockHttpReq.stubs().method("getScheme").will(returnValue("http")); + mockHttpReq.stubs().method("getAttribute").with( + eq("struts.valueStack")).will(returnValue(stack)); + mockHttpReq.stubs().method("getAttribute").with( + eq("javax.portlet.response")).will( + returnValue((PortletResponse) mockPortletRes.proxy())); + mockHttpReq.stubs().method("getAttribute").with( + eq("javax.portlet.request")).will( + returnValue((PortletRequest) mockPortletReq.proxy())); + + mockPortletReq.stubs().method("getPortletMode").will(returnValue(PortletMode.VIEW)); + mockPortletReq.stubs().method("getWindowState").will(returnValue(WindowState.NORMAL)); + mockPortletReq.stubs().method("getContextPath").will(returnValue("/contextPath")); + + tag.setPageContext((PageContext) mockPageCtx.proxy()); + + Map modeMap = new HashMap(); + modeMap.put(PortletMode.VIEW, "/view"); + modeMap.put(PortletMode.HELP, "/help"); + modeMap.put(PortletMode.EDIT, "/edit"); + Map sessionMap = new HashMap(); + Map contextMap = new HashMap(); + contextMap.put(ActionContext.SESSION, sessionMap); + contextMap.put(PortletActionConstants.REQUEST, mockPortletReq.proxy()); + contextMap.put(PortletActionConstants.RESPONSE, mockPortletRes.proxy()); + contextMap.put(PortletActionConstants.PHASE, PortletActionConstants.RENDER_PHASE); + contextMap.put(PortletActionConstants.MODE_NAMESPACE_MAP, modeMap); + ActionContext ctx = new ActionContext(contextMap); + ctx.setValueStack(stack); + ActionContext.setContext(ctx); + } + + /** + * */ private void mockPortletApiAvailable() { try { @@ -142,219 +145,219 @@ public class PortletUrlTagTest extends MockObjectTestCase { field.set(null, Boolean.TRUE); } catch(Exception e) { - + } - + } public void testEnsureParamsAreStringArrays() { - Map params = new HashMap(); - params.put("param1", "Test1"); - params.put("param2", new String[] { "Test2" }); + Map params = new HashMap(); + params.put("param1", "Test1"); + params.put("param2", new String[] { "Test2" }); - Map result = PortletUrlHelper.ensureParamsAreStringArrays(params); - assertEquals(2, result.size()); - assertTrue(result.get("param1") instanceof String[]); - } + Map result = PortletUrlHelper.ensureParamsAreStringArrays(params); + assertEquals(2, result.size()); + assertTrue(result.get("param1") instanceof String[]); + } - public void testSetWindowState() throws Exception { + public void testSetWindowState() throws Exception { - PortletMode mode = PortletMode.VIEW; - - mockHttpReq.stubs().method("getQueryString").will(returnValue("")); + PortletMode mode = PortletMode.VIEW; - mockPortletRes.expects(once()).method("createRenderURL").will( - returnValue((PortletURL) mockPortletUrl.proxy())); - - Map paramMap = new HashMap(); - paramMap.put(PortletActionConstants.ACTION_PARAM, new String[]{"/view/testAction"}); - paramMap.put(PortletActionConstants.MODE_PARAM, new String[]{mode.toString()}); - - mockPortletUrl.expects(once()).method("setParameters").with(new ParamMapConstraint(paramMap)); - mockPortletUrl.expects(once()).method("setWindowState").with(eq(WindowState.MAXIMIZED)); - mockPortletUrl.expects(once()).method("setPortletMode").with(eq(PortletMode.VIEW)); - - tag.setAction("testAction"); - tag.setWindowState("maximized"); - tag.doStartTag(); - tag.doEndTag(); + mockHttpReq.stubs().method("getQueryString").will(returnValue("")); - } - - public void testSetPortletMode() throws Exception { - - PortletMode mode = PortletMode.HELP; - - mockHttpReq.stubs().method("getQueryString").will(returnValue("")); + mockPortletRes.expects(once()).method("createRenderURL").will( + returnValue((PortletURL) mockPortletUrl.proxy())); - mockPortletRes.expects(once()).method("createRenderURL").will( - returnValue((PortletURL) mockPortletUrl.proxy())); - - Map paramMap = new HashMap(); - paramMap.put(PortletActionConstants.ACTION_PARAM, new String[]{"/help/testAction"}); - paramMap.put(PortletActionConstants.MODE_PARAM, new String[]{mode.toString()}); - - mockPortletUrl.expects(once()).method("setParameters").with(new ParamMapConstraint(paramMap)); - mockPortletUrl.expects(once()).method("setPortletMode").with(eq(PortletMode.HELP)); - mockPortletUrl.expects(once()).method("setWindowState").with(eq(WindowState.NORMAL)); - - tag.setAction("testAction"); - tag.setPortletMode("help"); - tag.doStartTag(); - tag.doEndTag(); - } - - public void testUrlWithQueryParams() throws Exception { - - PortletMode mode = PortletMode.VIEW; - - mockHttpReq.stubs().method("getQueryString").will(returnValue("")); + Map paramMap = new HashMap(); + paramMap.put(PortletActionConstants.ACTION_PARAM, new String[]{"/view/testAction"}); + paramMap.put(PortletActionConstants.MODE_PARAM, new String[]{mode.toString()}); - mockPortletRes.expects(once()).method("createRenderURL").will( - returnValue((PortletURL) mockPortletUrl.proxy())); - - Map paramMap = new HashMap(); - paramMap.put(PortletActionConstants.ACTION_PARAM, new String[]{"/view/testAction"}); - paramMap.put("testParam1", new String[]{"testValue1"}); - paramMap.put(PortletActionConstants.MODE_PARAM, new String[]{mode.toString()}); - - mockPortletUrl.expects(once()).method("setParameters").with(new ParamMapConstraint(paramMap)); - mockPortletUrl.expects(once()).method("setPortletMode").with(eq(PortletMode.VIEW)); - mockPortletUrl.expects(once()).method("setWindowState").with(eq(WindowState.NORMAL)); - - tag.setAction("testAction?testParam1=testValue1"); - tag.doStartTag(); - tag.doEndTag(); - } - - public void testActionUrl() throws Exception { - - PortletMode mode = PortletMode.VIEW; - - mockHttpReq.stubs().method("getQueryString").will(returnValue("")); + mockPortletUrl.expects(once()).method("setParameters").with(new ParamMapConstraint(paramMap)); + mockPortletUrl.expects(once()).method("setWindowState").with(eq(WindowState.MAXIMIZED)); + mockPortletUrl.expects(once()).method("setPortletMode").with(eq(PortletMode.VIEW)); - mockPortletRes.expects(once()).method("createActionURL").will( - returnValue((PortletURL) mockPortletUrl.proxy())); - - Map paramMap = new HashMap(); - paramMap.put(PortletActionConstants.ACTION_PARAM, new String[]{"/view/testAction"}); - paramMap.put(PortletActionConstants.MODE_PARAM, new String[]{mode.toString()}); - - mockPortletUrl.expects(once()).method("setParameters").with(new ParamMapConstraint(paramMap)); - mockPortletUrl.expects(once()).method("setPortletMode").with(eq(PortletMode.VIEW)); - mockPortletUrl.expects(once()).method("setWindowState").with(eq(WindowState.NORMAL)); - - tag.setAction("testAction"); - tag.setPortletUrlType("action"); - tag.doStartTag(); - tag.doEndTag(); - } - - public void testResourceUrl() throws Exception { - mockHttpReq.stubs().method("getQueryString").will(returnValue("")); - mockPortletRes.expects(once()).method("encodeURL").will(returnValue("/contextPath/image.gif")); - mockJspWriter.setExpectedData("/contextPath/image.gif"); - tag.setValue("image.gif"); - tag.doStartTag(); - tag.doEndTag(); - mockJspWriter.verify(); - } - - public void testResourceUrlWithNestedParam() throws Exception { - mockHttpReq.stubs().method("getQueryString").will(returnValue("")); - mockPortletRes.expects(once()).method("encodeURL").with(eq("/contextPath/image.gif?testParam1=testValue1")).will(returnValue("/contextPath/image.gif?testParam1=testValue1")); - mockJspWriter.setExpectedData("/contextPath/image.gif?testParam1=testValue1"); - - ParamTag paramTag = new ParamTag(); - paramTag.setPageContext((PageContext)mockPageCtx.proxy()); - paramTag.setParent(tag); - paramTag.setName("testParam1"); - paramTag.setValue("'testValue1'"); - tag.setValue("image.gif"); - tag.doStartTag(); - paramTag.doStartTag(); - paramTag.doEndTag(); - tag.doEndTag(); - mockJspWriter.verify(); - } - - public void testResourceUrlWithTwoNestedParam() throws Exception { - mockHttpReq.stubs().method("getQueryString").will(returnValue("")); - mockPortletRes.expects(once()).method("encodeURL").with(eq("/contextPath/image.gif?testParam1=testValue1&testParam2=testValue2")).will(returnValue("/contextPath/image.gif?testParam1=testValue1&testParam2=testValue2")); - mockJspWriter.setExpectedData("/contextPath/image.gif?testParam1=testValue1&testParam2=testValue2"); - - ParamTag paramTag = new ParamTag(); - paramTag.setPageContext((PageContext)mockPageCtx.proxy()); - paramTag.setParent(tag); - paramTag.setName("testParam1"); - paramTag.setValue("'testValue1'"); - ParamTag paramTag2 = new ParamTag(); - paramTag2.setPageContext((PageContext)mockPageCtx.proxy()); - paramTag2.setParent(tag); - paramTag2.setName("testParam2"); - paramTag2.setValue("'testValue2'"); - tag.setValue("image.gif"); - tag.doStartTag(); - paramTag.doStartTag(); - paramTag.doEndTag(); - paramTag2.doStartTag(); - paramTag2.doEndTag(); - tag.doEndTag(); - mockJspWriter.verify(); - } + tag.setAction("testAction"); + tag.setWindowState("maximized"); + tag.doStartTag(); + tag.doEndTag(); - private static class ParamMapConstraint implements Constraint { + } - private Map myExpectedMap = null; - private Map myActualMap = null; - - public ParamMapConstraint(Map expectedMap) { - if(expectedMap == null) { - throw new IllegalArgumentException("Use an isNull constraint instead!"); - } - myExpectedMap = expectedMap; - } + public void testSetPortletMode() throws Exception { - /* (non-Javadoc) - * @see org.jmock.core.Constraint#eval(java.lang.Object) - */ - public boolean eval(Object val) { - myActualMap = (Map)val; - boolean result = false; - if(val != null) { - if(myExpectedMap.size() == myActualMap.size()) { - Iterator keys = myExpectedMap.keySet().iterator(); - boolean allSame = true; - while(keys.hasNext()) { - Object key = keys.next(); - if(!myActualMap.containsKey(key)) { - allSame = false; - break; - } - else { - String[] expected = (String[])myExpectedMap.get(key); - String[] actual = (String[])myActualMap.get(key); - if(!Arrays.equals(expected, actual)) { - allSame = false; - break; - } - } - } - result = allSame; - } - } - return result; - } + PortletMode mode = PortletMode.HELP; - /* (non-Javadoc) - * @see org.jmock.core.SelfDescribing#describeTo(java.lang.StringBuffer) - */ - public StringBuffer describeTo(StringBuffer sb) { - return sb.append(myExpectedMap); - } - - + mockHttpReq.stubs().method("getQueryString").will(returnValue("")); - } + mockPortletRes.expects(once()).method("createRenderURL").will( + returnValue((PortletURL) mockPortletUrl.proxy())); + + Map paramMap = new HashMap(); + paramMap.put(PortletActionConstants.ACTION_PARAM, new String[]{"/help/testAction"}); + paramMap.put(PortletActionConstants.MODE_PARAM, new String[]{mode.toString()}); + + mockPortletUrl.expects(once()).method("setParameters").with(new ParamMapConstraint(paramMap)); + mockPortletUrl.expects(once()).method("setPortletMode").with(eq(PortletMode.HELP)); + mockPortletUrl.expects(once()).method("setWindowState").with(eq(WindowState.NORMAL)); + + tag.setAction("testAction"); + tag.setPortletMode("help"); + tag.doStartTag(); + tag.doEndTag(); + } + + public void testUrlWithQueryParams() throws Exception { + + PortletMode mode = PortletMode.VIEW; + + mockHttpReq.stubs().method("getQueryString").will(returnValue("")); + + mockPortletRes.expects(once()).method("createRenderURL").will( + returnValue((PortletURL) mockPortletUrl.proxy())); + + Map paramMap = new HashMap(); + paramMap.put(PortletActionConstants.ACTION_PARAM, new String[]{"/view/testAction"}); + paramMap.put("testParam1", new String[]{"testValue1"}); + paramMap.put(PortletActionConstants.MODE_PARAM, new String[]{mode.toString()}); + + mockPortletUrl.expects(once()).method("setParameters").with(new ParamMapConstraint(paramMap)); + mockPortletUrl.expects(once()).method("setPortletMode").with(eq(PortletMode.VIEW)); + mockPortletUrl.expects(once()).method("setWindowState").with(eq(WindowState.NORMAL)); + + tag.setAction("testAction?testParam1=testValue1"); + tag.doStartTag(); + tag.doEndTag(); + } + + public void testActionUrl() throws Exception { + + PortletMode mode = PortletMode.VIEW; + + mockHttpReq.stubs().method("getQueryString").will(returnValue("")); + + mockPortletRes.expects(once()).method("createActionURL").will( + returnValue((PortletURL) mockPortletUrl.proxy())); + + Map paramMap = new HashMap(); + paramMap.put(PortletActionConstants.ACTION_PARAM, new String[]{"/view/testAction"}); + paramMap.put(PortletActionConstants.MODE_PARAM, new String[]{mode.toString()}); + + mockPortletUrl.expects(once()).method("setParameters").with(new ParamMapConstraint(paramMap)); + mockPortletUrl.expects(once()).method("setPortletMode").with(eq(PortletMode.VIEW)); + mockPortletUrl.expects(once()).method("setWindowState").with(eq(WindowState.NORMAL)); + + tag.setAction("testAction"); + tag.setPortletUrlType("action"); + tag.doStartTag(); + tag.doEndTag(); + } + + public void testResourceUrl() throws Exception { + mockHttpReq.stubs().method("getQueryString").will(returnValue("")); + mockPortletRes.expects(once()).method("encodeURL").will(returnValue("/contextPath/image.gif")); + mockJspWriter.setExpectedData("/contextPath/image.gif"); + tag.setValue("image.gif"); + tag.doStartTag(); + tag.doEndTag(); + mockJspWriter.verify(); + } + + public void testResourceUrlWithNestedParam() throws Exception { + mockHttpReq.stubs().method("getQueryString").will(returnValue("")); + mockPortletRes.expects(once()).method("encodeURL").with(eq("/contextPath/image.gif?testParam1=testValue1")).will(returnValue("/contextPath/image.gif?testParam1=testValue1")); + mockJspWriter.setExpectedData("/contextPath/image.gif?testParam1=testValue1"); + + ParamTag paramTag = new ParamTag(); + paramTag.setPageContext((PageContext)mockPageCtx.proxy()); + paramTag.setParent(tag); + paramTag.setName("testParam1"); + paramTag.setValue("'testValue1'"); + tag.setValue("image.gif"); + tag.doStartTag(); + paramTag.doStartTag(); + paramTag.doEndTag(); + tag.doEndTag(); + mockJspWriter.verify(); + } + + public void testResourceUrlWithTwoNestedParam() throws Exception { + mockHttpReq.stubs().method("getQueryString").will(returnValue("")); + mockPortletRes.expects(once()).method("encodeURL").with(eq("/contextPath/image.gif?testParam1=testValue1&testParam2=testValue2")).will(returnValue("/contextPath/image.gif?testParam1=testValue1&testParam2=testValue2")); + mockJspWriter.setExpectedData("/contextPath/image.gif?testParam1=testValue1&testParam2=testValue2"); + + ParamTag paramTag = new ParamTag(); + paramTag.setPageContext((PageContext)mockPageCtx.proxy()); + paramTag.setParent(tag); + paramTag.setName("testParam1"); + paramTag.setValue("'testValue1'"); + ParamTag paramTag2 = new ParamTag(); + paramTag2.setPageContext((PageContext)mockPageCtx.proxy()); + paramTag2.setParent(tag); + paramTag2.setName("testParam2"); + paramTag2.setValue("'testValue2'"); + tag.setValue("image.gif"); + tag.doStartTag(); + paramTag.doStartTag(); + paramTag.doEndTag(); + paramTag2.doStartTag(); + paramTag2.doEndTag(); + tag.doEndTag(); + mockJspWriter.verify(); + } + + private static class ParamMapConstraint implements Constraint { + + private Map myExpectedMap = null; + private Map myActualMap = null; + + public ParamMapConstraint(Map expectedMap) { + if(expectedMap == null) { + throw new IllegalArgumentException("Use an isNull constraint instead!"); + } + myExpectedMap = expectedMap; + } + + /* (non-Javadoc) + * @see org.jmock.core.Constraint#eval(java.lang.Object) + */ + public boolean eval(Object val) { + myActualMap = (Map)val; + boolean result = false; + if(val != null) { + if(myExpectedMap.size() == myActualMap.size()) { + Iterator keys = myExpectedMap.keySet().iterator(); + boolean allSame = true; + while(keys.hasNext()) { + Object key = keys.next(); + if(!myActualMap.containsKey(key)) { + allSame = false; + break; + } + else { + String[] expected = (String[])myExpectedMap.get(key); + String[] actual = (String[])myActualMap.get(key); + if(!Arrays.equals(expected, actual)) { + allSame = false; + break; + } + } + } + result = allSame; + } + } + return result; + } + + /* (non-Javadoc) + * @see org.jmock.core.SelfDescribing#describeTo(java.lang.StringBuffer) + */ + public StringBuffer describeTo(StringBuffer sb) { + return sb.append(myExpectedMap); + } + + + + } } diff --git a/core/src/test/java/org/apache/struts2/views/jsp/PropertyTagTest.java b/core/src/test/java/org/apache/struts2/views/jsp/PropertyTagTest.java index d92ecfe4c..d577ec650 100644 --- a/core/src/test/java/org/apache/struts2/views/jsp/PropertyTagTest.java +++ b/core/src/test/java/org/apache/struts2/views/jsp/PropertyTagTest.java @@ -1,19 +1,22 @@ /* * $Id$ * - * Copyright 2006 The Apache Software Foundation. + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at + * http://www.apache.org/licenses/LICENSE-2.0 * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. */ package org.apache.struts2.views.jsp; @@ -33,7 +36,7 @@ import com.opensymphony.xwork2.util.ValueStackFactory; /** * PropertyTag test case. - * + * */ public class PropertyTagTest extends StrutsTestCase { diff --git a/core/src/test/java/org/apache/struts2/views/jsp/PushTagTest.java b/core/src/test/java/org/apache/struts2/views/jsp/PushTagTest.java index ee27b054b..be65716be 100644 --- a/core/src/test/java/org/apache/struts2/views/jsp/PushTagTest.java +++ b/core/src/test/java/org/apache/struts2/views/jsp/PushTagTest.java @@ -1,19 +1,22 @@ /* * $Id$ * - * Copyright 2006 The Apache Software Foundation. + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at + * http://www.apache.org/licenses/LICENSE-2.0 * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. */ package org.apache.struts2.views.jsp; diff --git a/core/src/test/java/org/apache/struts2/views/jsp/SetTagTest.java b/core/src/test/java/org/apache/struts2/views/jsp/SetTagTest.java index 4ab11ca33..5bb28e713 100644 --- a/core/src/test/java/org/apache/struts2/views/jsp/SetTagTest.java +++ b/core/src/test/java/org/apache/struts2/views/jsp/SetTagTest.java @@ -1,19 +1,22 @@ /* * $Id$ * - * Copyright 2006 The Apache Software Foundation. + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at + * http://www.apache.org/licenses/LICENSE-2.0 * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. */ package org.apache.struts2.views.jsp; diff --git a/core/src/test/java/org/apache/struts2/views/jsp/SortIteratorTagTest.java b/core/src/test/java/org/apache/struts2/views/jsp/SortIteratorTagTest.java index ef89b31fb..7cdd4a3e4 100644 --- a/core/src/test/java/org/apache/struts2/views/jsp/SortIteratorTagTest.java +++ b/core/src/test/java/org/apache/struts2/views/jsp/SortIteratorTagTest.java @@ -1,19 +1,22 @@ /* * $Id$ * - * Copyright 2006 The Apache Software Foundation. + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at + * http://www.apache.org/licenses/LICENSE-2.0 * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. */ package org.apache.struts2.views.jsp; @@ -69,8 +72,8 @@ public class SortIteratorTagTest extends AbstractTagTest { } public void testSortWithIdIteratorAvailableInStackTop() throws Exception { - - SortIteratorTag tag = new SortIteratorTag(); + + SortIteratorTag tag = new SortIteratorTag(); tag.setId("myId"); tag.setComparator("comparator"); @@ -98,14 +101,14 @@ public class SortIteratorTagTest extends AbstractTagTest { // 5 assertTrue(sortedIterator.hasNext()); assertEquals(sortedIterator.next(), new Integer(5)); - + assertFalse(sortedIterator.hasNext()); } tag.doEndTag(); } - - + + public void testSortWithIdIteratorAvailableInPageContext() throws Exception { SortIteratorTag tag = new SortIteratorTag(); @@ -135,7 +138,7 @@ public class SortIteratorTagTest extends AbstractTagTest { // 5 assertTrue(sortedIterator.hasNext()); assertEquals(sortedIterator.next(), new Integer(5)); - + assertFalse(sortedIterator.hasNext()); } diff --git a/core/src/test/java/org/apache/struts2/views/jsp/StrutsMockBodyContent.java b/core/src/test/java/org/apache/struts2/views/jsp/StrutsMockBodyContent.java index 9f94c3356..faade53e2 100644 --- a/core/src/test/java/org/apache/struts2/views/jsp/StrutsMockBodyContent.java +++ b/core/src/test/java/org/apache/struts2/views/jsp/StrutsMockBodyContent.java @@ -1,19 +1,22 @@ /* * $Id$ * - * Copyright 2006 The Apache Software Foundation. + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at + * http://www.apache.org/licenses/LICENSE-2.0 * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. */ package org.apache.struts2.views.jsp; diff --git a/core/src/test/java/org/apache/struts2/views/jsp/StrutsMockHttpServletRequest.java b/core/src/test/java/org/apache/struts2/views/jsp/StrutsMockHttpServletRequest.java index 56a155c8b..04cc397d3 100644 --- a/core/src/test/java/org/apache/struts2/views/jsp/StrutsMockHttpServletRequest.java +++ b/core/src/test/java/org/apache/struts2/views/jsp/StrutsMockHttpServletRequest.java @@ -1,19 +1,22 @@ /* * $Id$ * - * Copyright 2006 The Apache Software Foundation. + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at + * http://www.apache.org/licenses/LICENSE-2.0 * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. */ package org.apache.struts2.views.jsp; diff --git a/core/src/test/java/org/apache/struts2/views/jsp/StrutsMockHttpServletResponse.java b/core/src/test/java/org/apache/struts2/views/jsp/StrutsMockHttpServletResponse.java index e7d069a02..9ee5762c1 100644 --- a/core/src/test/java/org/apache/struts2/views/jsp/StrutsMockHttpServletResponse.java +++ b/core/src/test/java/org/apache/struts2/views/jsp/StrutsMockHttpServletResponse.java @@ -1,19 +1,22 @@ /* * $Id$ * - * Copyright 2006 The Apache Software Foundation. + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at + * http://www.apache.org/licenses/LICENSE-2.0 * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. */ package org.apache.struts2.views.jsp; @@ -32,7 +35,7 @@ import com.mockobjects.servlet.MockHttpServletResponse; public class StrutsMockHttpServletResponse extends MockHttpServletResponse { private Locale locale; private PrintWriter writer; - + public Locale getLocale() { return locale; } @@ -42,14 +45,14 @@ public class StrutsMockHttpServletResponse extends MockHttpServletResponse { } public PrintWriter getWriter() throws IOException { - if (writer == null) - return new PrintWriter(new ByteArrayOutputStream()); - else - return writer; + if (writer == null) + return new PrintWriter(new ByteArrayOutputStream()); + else + return writer; } - + public void setWriter(PrintWriter writer) { - this.writer = writer; + this.writer = writer; } public String encodeURL(String s) { diff --git a/core/src/test/java/org/apache/struts2/views/jsp/StrutsMockHttpSession.java b/core/src/test/java/org/apache/struts2/views/jsp/StrutsMockHttpSession.java index 5ba045456..f7753af0e 100644 --- a/core/src/test/java/org/apache/struts2/views/jsp/StrutsMockHttpSession.java +++ b/core/src/test/java/org/apache/struts2/views/jsp/StrutsMockHttpSession.java @@ -1,19 +1,22 @@ /* * $Id$ * - * Copyright 2006 The Apache Software Foundation. + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at + * http://www.apache.org/licenses/LICENSE-2.0 * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. */ package org.apache.struts2.views.jsp; diff --git a/core/src/test/java/org/apache/struts2/views/jsp/StrutsMockJspWriter.java b/core/src/test/java/org/apache/struts2/views/jsp/StrutsMockJspWriter.java index a8f644c9a..a24949251 100644 --- a/core/src/test/java/org/apache/struts2/views/jsp/StrutsMockJspWriter.java +++ b/core/src/test/java/org/apache/struts2/views/jsp/StrutsMockJspWriter.java @@ -1,19 +1,22 @@ /* * $Id$ * - * Copyright 2006 The Apache Software Foundation. + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at + * http://www.apache.org/licenses/LICENSE-2.0 * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. */ package org.apache.struts2.views.jsp; diff --git a/core/src/test/java/org/apache/struts2/views/jsp/StrutsMockPageContext.java b/core/src/test/java/org/apache/struts2/views/jsp/StrutsMockPageContext.java index cfbd71f42..5e70ecdd6 100644 --- a/core/src/test/java/org/apache/struts2/views/jsp/StrutsMockPageContext.java +++ b/core/src/test/java/org/apache/struts2/views/jsp/StrutsMockPageContext.java @@ -1,19 +1,22 @@ /* * $Id$ * - * Copyright 2006 The Apache Software Foundation. + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at + * http://www.apache.org/licenses/LICENSE-2.0 * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. */ package org.apache.struts2.views.jsp; diff --git a/core/src/test/java/org/apache/struts2/views/jsp/StrutsMockServletContext.java b/core/src/test/java/org/apache/struts2/views/jsp/StrutsMockServletContext.java index bf07f5b49..5c94d3e4c 100644 --- a/core/src/test/java/org/apache/struts2/views/jsp/StrutsMockServletContext.java +++ b/core/src/test/java/org/apache/struts2/views/jsp/StrutsMockServletContext.java @@ -1,19 +1,22 @@ /* * $Id$ * - * Copyright 2006 The Apache Software Foundation. + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at + * http://www.apache.org/licenses/LICENSE-2.0 * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. */ package org.apache.struts2.views.jsp; @@ -81,14 +84,14 @@ public class StrutsMockServletContext implements ServletContext { } public InputStream getResourceAsStream(String s) { - if (resourceAsStream != null) { - return resourceAsStream; - } + if (resourceAsStream != null) { + return resourceAsStream; + } return null; } - + public void setResourceAsStream(InputStream is) { - this.resourceAsStream = is; + this.resourceAsStream = is; } public RequestDispatcher getRequestDispatcher(String s) { diff --git a/core/src/test/java/org/apache/struts2/views/jsp/SubsetIteratorTagTest.java b/core/src/test/java/org/apache/struts2/views/jsp/SubsetIteratorTagTest.java index 1cfd4ae94..4d0b093e0 100644 --- a/core/src/test/java/org/apache/struts2/views/jsp/SubsetIteratorTagTest.java +++ b/core/src/test/java/org/apache/struts2/views/jsp/SubsetIteratorTagTest.java @@ -1,19 +1,22 @@ /* * $Id$ * - * Copyright 2006 The Apache Software Foundation. + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at + * http://www.apache.org/licenses/LICENSE-2.0 * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. */ package org.apache.struts2.views.jsp; @@ -30,247 +33,247 @@ import com.opensymphony.xwork2.ActionSupport; /** * Test case for SubsetIteratorTag. - * + * */ public class SubsetIteratorTagTest extends AbstractTagTest { - - public void testBasic() throws Exception { - { // List as Source - SubsetIteratorTag tag = new SubsetIteratorTag(); - tag.setPageContext(pageContext); - tag.setSource("myList"); - - tag.doStartTag(); - Iterator subsetIterator = (Iterator) stack.findValue("top"); - tag.doEndTag(); - - assertEquals(subsetIterator.next(), new Integer(1)); - assertEquals(subsetIterator.next(), new Integer(2)); - assertEquals(subsetIterator.next(), new Integer(3)); - assertEquals(subsetIterator.next(), new Integer(4)); - assertEquals(subsetIterator.next(), new Integer(5)); - } - - { // Array as Source - SubsetIteratorTag tag = new SubsetIteratorTag(); - tag.setPageContext(pageContext); - tag.setSource("myArray"); - - tag.doStartTag(); - Iterator subsetIterator = (Iterator) stack.findValue("top"); - tag.doEndTag(); - - assertEquals(subsetIterator.next(), new Integer(1)); - assertEquals(subsetIterator.next(), new Integer(2)); - assertEquals(subsetIterator.next(), new Integer(3)); - assertEquals(subsetIterator.next(), new Integer(4)); - assertEquals(subsetIterator.next(), new Integer(5)); - } - } - - public void testWithStartAttribute() throws Exception { - { // List as source - SubsetIteratorTag tag = new SubsetIteratorTag(); - tag.setPageContext(pageContext); - tag.setSource("myList"); - tag.setStart("3"); - - tag.doStartTag(); - Iterator subsetIterator = (Iterator) stack.findValue("top"); - tag.doEndTag(); - - assertEquals(subsetIterator.next(), new Integer(4)); - assertEquals(subsetIterator.next(), new Integer(5)); - } - - { // Array as source - SubsetIteratorTag tag = new SubsetIteratorTag(); - tag.setPageContext(pageContext); - tag.setSource("myArray"); - tag.setStart("3"); - - tag.doStartTag(); - Iterator subsetIterator = (Iterator) stack.findValue("top"); - tag.doEndTag(); - - assertEquals(subsetIterator.next(), new Integer(4)); - assertEquals(subsetIterator.next(), new Integer(5)); - } - } - - public void testWithCountAttribute() throws Exception { - { // List as source - SubsetIteratorTag tag = new SubsetIteratorTag(); - tag.setPageContext(pageContext); - tag.setSource("myList"); - tag.setCount("3"); - - tag.doStartTag(); - Iterator subsetIterator = (Iterator) stack.findValue("top"); - tag.doEndTag(); - - assertEquals(subsetIterator.next(), new Integer(1)); - assertEquals(subsetIterator.next(), new Integer(2)); - assertEquals(subsetIterator.next(), new Integer(3)); - } - - { // array as source - SubsetIteratorTag tag = new SubsetIteratorTag(); - tag.setPageContext(pageContext); - tag.setSource("myArray"); - tag.setCount("3"); - - tag.doStartTag(); - Iterator subsetIterator = (Iterator) stack.findValue("top"); - tag.doEndTag(); - - assertEquals(subsetIterator.next(), new Integer(1)); - assertEquals(subsetIterator.next(), new Integer(2)); - assertEquals(subsetIterator.next(), new Integer(3)); - } - } - - public void testWIthStartAndCountAttribute() throws Exception { - { // List as source - SubsetIteratorTag tag = new SubsetIteratorTag(); - tag.setPageContext(pageContext); - tag.setSource("myList"); - tag.setStart("3"); - tag.setCount("3"); - - tag.doStartTag(); - Iterator subsetIterator = (Iterator) stack.findValue("top"); - tag.doEndTag(); - - assertEquals(subsetIterator.next(), new Integer("4")); - assertEquals(subsetIterator.next(), new Integer("5")); - } - - { // Array as source - SubsetIteratorTag tag = new SubsetIteratorTag(); - tag.setPageContext(pageContext); - tag.setSource("myArray"); - tag.setStart("3"); - tag.setCount("3"); - - tag.doStartTag(); - Iterator subsetIterator = (Iterator) stack.findValue("top"); - tag.doEndTag(); - - assertEquals(subsetIterator.next(), new Integer("4")); - assertEquals(subsetIterator.next(), new Integer("5")); - } - } - - public void testWithId() throws Exception { - { // List as Source - SubsetIteratorTag tag = new SubsetIteratorTag(); - tag.setPageContext(pageContext); - tag.setSource("myList"); - tag.setId("myPageContextId1"); - - tag.doStartTag(); - Iterator subsetIterator1 = (Iterator) stack.findValue("top"); - tag.doEndTag(); - - Iterator subsetIterator2 = (Iterator) pageContext.getAttribute("myPageContextId1"); - - assertNotNull(subsetIterator1); - assertNotNull(subsetIterator2); - assertEquals(subsetIterator1, subsetIterator2); - assertEquals(subsetIterator2.next(), new Integer(1)); - assertEquals(subsetIterator2.next(), new Integer(2)); - assertEquals(subsetIterator2.next(), new Integer(3)); - assertEquals(subsetIterator2.next(), new Integer(4)); - assertEquals(subsetIterator2.next(), new Integer(5)); - } - - { // Array as source - SubsetIteratorTag tag = new SubsetIteratorTag(); - tag.setPageContext(pageContext); - tag.setSource("myArray"); - tag.setId("myPageContextId2"); - - tag.doStartTag(); - Iterator subsetIterator1 = (Iterator) stack.findValue("top"); - tag.doEndTag(); - - Iterator subsetIterator2 = (Iterator) pageContext.getAttribute("myPageContextId2"); - - assertNotNull(subsetIterator1); - assertNotNull(subsetIterator2); - assertEquals(subsetIterator1, subsetIterator2); - assertEquals(subsetIterator2.next(), new Integer(1)); - assertEquals(subsetIterator2.next(), new Integer(2)); - assertEquals(subsetIterator2.next(), new Integer(3)); - assertEquals(subsetIterator2.next(), new Integer(4)); - assertEquals(subsetIterator2.next(), new Integer(5)); - } - } - - public void testWithDecider() throws Exception { - { // List as source - SubsetIteratorTag tag = new SubsetIteratorTag(); - tag.setPageContext(pageContext); - tag.setSource("myList"); - tag.setDecider("myDecider"); - - tag.doStartTag(); - Iterator subsetIterator = (Iterator) stack.findValue("top"); - tag.doEndTag(); - - assertEquals(subsetIterator.next(), new Integer(2)); - assertEquals(subsetIterator.next(), new Integer(4)); - } - - { // Array As source - SubsetIteratorTag tag = new SubsetIteratorTag(); - tag.setPageContext(pageContext); - tag.setSource("myList"); - tag.setDecider("myDecider"); - - tag.doStartTag(); - Iterator subsetIterator = (Iterator) stack.findValue("top"); - tag.doEndTag(); - - assertEquals(subsetIterator.next(), new Integer(2)); - assertEquals(subsetIterator.next(), new Integer(4)); - } - } - - - - public Action getAction() { - return new ActionSupport() { - public List getMyList() { - List l = new ArrayList(); - l.add(new Integer(1)); - l.add(new Integer(2)); - l.add(new Integer(3)); - l.add(new Integer(4)); - l.add(new Integer(5)); - return l; - } - - public Integer[] getMyArray() { - Integer[] integers = new Integer[5]; - integers[0] = new Integer(1); - integers[1] = new Integer(2); - integers[2] = new Integer(3); - integers[3] = new Integer(4); - integers[4] = new Integer(5); - return integers; - } - - public Decider getMyDecider() { - return new Decider() { - public boolean decide(Object element) throws Exception { - int integer = ((Integer)element).intValue(); - return (((integer % 2) == 0)?true:false); - } - }; - } - }; - } + + public void testBasic() throws Exception { + { // List as Source + SubsetIteratorTag tag = new SubsetIteratorTag(); + tag.setPageContext(pageContext); + tag.setSource("myList"); + + tag.doStartTag(); + Iterator subsetIterator = (Iterator) stack.findValue("top"); + tag.doEndTag(); + + assertEquals(subsetIterator.next(), new Integer(1)); + assertEquals(subsetIterator.next(), new Integer(2)); + assertEquals(subsetIterator.next(), new Integer(3)); + assertEquals(subsetIterator.next(), new Integer(4)); + assertEquals(subsetIterator.next(), new Integer(5)); + } + + { // Array as Source + SubsetIteratorTag tag = new SubsetIteratorTag(); + tag.setPageContext(pageContext); + tag.setSource("myArray"); + + tag.doStartTag(); + Iterator subsetIterator = (Iterator) stack.findValue("top"); + tag.doEndTag(); + + assertEquals(subsetIterator.next(), new Integer(1)); + assertEquals(subsetIterator.next(), new Integer(2)); + assertEquals(subsetIterator.next(), new Integer(3)); + assertEquals(subsetIterator.next(), new Integer(4)); + assertEquals(subsetIterator.next(), new Integer(5)); + } + } + + public void testWithStartAttribute() throws Exception { + { // List as source + SubsetIteratorTag tag = new SubsetIteratorTag(); + tag.setPageContext(pageContext); + tag.setSource("myList"); + tag.setStart("3"); + + tag.doStartTag(); + Iterator subsetIterator = (Iterator) stack.findValue("top"); + tag.doEndTag(); + + assertEquals(subsetIterator.next(), new Integer(4)); + assertEquals(subsetIterator.next(), new Integer(5)); + } + + { // Array as source + SubsetIteratorTag tag = new SubsetIteratorTag(); + tag.setPageContext(pageContext); + tag.setSource("myArray"); + tag.setStart("3"); + + tag.doStartTag(); + Iterator subsetIterator = (Iterator) stack.findValue("top"); + tag.doEndTag(); + + assertEquals(subsetIterator.next(), new Integer(4)); + assertEquals(subsetIterator.next(), new Integer(5)); + } + } + + public void testWithCountAttribute() throws Exception { + { // List as source + SubsetIteratorTag tag = new SubsetIteratorTag(); + tag.setPageContext(pageContext); + tag.setSource("myList"); + tag.setCount("3"); + + tag.doStartTag(); + Iterator subsetIterator = (Iterator) stack.findValue("top"); + tag.doEndTag(); + + assertEquals(subsetIterator.next(), new Integer(1)); + assertEquals(subsetIterator.next(), new Integer(2)); + assertEquals(subsetIterator.next(), new Integer(3)); + } + + { // array as source + SubsetIteratorTag tag = new SubsetIteratorTag(); + tag.setPageContext(pageContext); + tag.setSource("myArray"); + tag.setCount("3"); + + tag.doStartTag(); + Iterator subsetIterator = (Iterator) stack.findValue("top"); + tag.doEndTag(); + + assertEquals(subsetIterator.next(), new Integer(1)); + assertEquals(subsetIterator.next(), new Integer(2)); + assertEquals(subsetIterator.next(), new Integer(3)); + } + } + + public void testWIthStartAndCountAttribute() throws Exception { + { // List as source + SubsetIteratorTag tag = new SubsetIteratorTag(); + tag.setPageContext(pageContext); + tag.setSource("myList"); + tag.setStart("3"); + tag.setCount("3"); + + tag.doStartTag(); + Iterator subsetIterator = (Iterator) stack.findValue("top"); + tag.doEndTag(); + + assertEquals(subsetIterator.next(), new Integer("4")); + assertEquals(subsetIterator.next(), new Integer("5")); + } + + { // Array as source + SubsetIteratorTag tag = new SubsetIteratorTag(); + tag.setPageContext(pageContext); + tag.setSource("myArray"); + tag.setStart("3"); + tag.setCount("3"); + + tag.doStartTag(); + Iterator subsetIterator = (Iterator) stack.findValue("top"); + tag.doEndTag(); + + assertEquals(subsetIterator.next(), new Integer("4")); + assertEquals(subsetIterator.next(), new Integer("5")); + } + } + + public void testWithId() throws Exception { + { // List as Source + SubsetIteratorTag tag = new SubsetIteratorTag(); + tag.setPageContext(pageContext); + tag.setSource("myList"); + tag.setId("myPageContextId1"); + + tag.doStartTag(); + Iterator subsetIterator1 = (Iterator) stack.findValue("top"); + tag.doEndTag(); + + Iterator subsetIterator2 = (Iterator) pageContext.getAttribute("myPageContextId1"); + + assertNotNull(subsetIterator1); + assertNotNull(subsetIterator2); + assertEquals(subsetIterator1, subsetIterator2); + assertEquals(subsetIterator2.next(), new Integer(1)); + assertEquals(subsetIterator2.next(), new Integer(2)); + assertEquals(subsetIterator2.next(), new Integer(3)); + assertEquals(subsetIterator2.next(), new Integer(4)); + assertEquals(subsetIterator2.next(), new Integer(5)); + } + + { // Array as source + SubsetIteratorTag tag = new SubsetIteratorTag(); + tag.setPageContext(pageContext); + tag.setSource("myArray"); + tag.setId("myPageContextId2"); + + tag.doStartTag(); + Iterator subsetIterator1 = (Iterator) stack.findValue("top"); + tag.doEndTag(); + + Iterator subsetIterator2 = (Iterator) pageContext.getAttribute("myPageContextId2"); + + assertNotNull(subsetIterator1); + assertNotNull(subsetIterator2); + assertEquals(subsetIterator1, subsetIterator2); + assertEquals(subsetIterator2.next(), new Integer(1)); + assertEquals(subsetIterator2.next(), new Integer(2)); + assertEquals(subsetIterator2.next(), new Integer(3)); + assertEquals(subsetIterator2.next(), new Integer(4)); + assertEquals(subsetIterator2.next(), new Integer(5)); + } + } + + public void testWithDecider() throws Exception { + { // List as source + SubsetIteratorTag tag = new SubsetIteratorTag(); + tag.setPageContext(pageContext); + tag.setSource("myList"); + tag.setDecider("myDecider"); + + tag.doStartTag(); + Iterator subsetIterator = (Iterator) stack.findValue("top"); + tag.doEndTag(); + + assertEquals(subsetIterator.next(), new Integer(2)); + assertEquals(subsetIterator.next(), new Integer(4)); + } + + { // Array As source + SubsetIteratorTag tag = new SubsetIteratorTag(); + tag.setPageContext(pageContext); + tag.setSource("myList"); + tag.setDecider("myDecider"); + + tag.doStartTag(); + Iterator subsetIterator = (Iterator) stack.findValue("top"); + tag.doEndTag(); + + assertEquals(subsetIterator.next(), new Integer(2)); + assertEquals(subsetIterator.next(), new Integer(4)); + } + } + + + + public Action getAction() { + return new ActionSupport() { + public List getMyList() { + List l = new ArrayList(); + l.add(new Integer(1)); + l.add(new Integer(2)); + l.add(new Integer(3)); + l.add(new Integer(4)); + l.add(new Integer(5)); + return l; + } + + public Integer[] getMyArray() { + Integer[] integers = new Integer[5]; + integers[0] = new Integer(1); + integers[1] = new Integer(2); + integers[2] = new Integer(3); + integers[3] = new Integer(4); + integers[4] = new Integer(5); + return integers; + } + + public Decider getMyDecider() { + return new Decider() { + public boolean decide(Object element) throws Exception { + int integer = ((Integer)element).intValue(); + return (((integer % 2) == 0)?true:false); + } + }; + } + }; + } } diff --git a/core/src/test/java/org/apache/struts2/views/jsp/TextTagTest.java b/core/src/test/java/org/apache/struts2/views/jsp/TextTagTest.java index d9af1f091..240c62379 100644 --- a/core/src/test/java/org/apache/struts2/views/jsp/TextTagTest.java +++ b/core/src/test/java/org/apache/struts2/views/jsp/TextTagTest.java @@ -1,19 +1,22 @@ /* * $Id$ * - * Copyright 2006 The Apache Software Foundation. + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at + * http://www.apache.org/licenses/LICENSE-2.0 * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. */ package org.apache.struts2.views.jsp; @@ -56,21 +59,21 @@ public class TextTagTest extends AbstractTagTest { return action; } - + public void testDefaultMessageOk() throws Exception { - // NOTE: - // simulate the condition - // My Default Message - - StrutsMockBodyContent mockBodyContent = new StrutsMockBodyContent(new MockJspWriter()); - mockBodyContent.setString("Sample Of Default Message"); - tag.setBodyContent(mockBodyContent); - tag.setName("some.invalid.key.so.we.should.get.the.default.message"); - int startStatus = tag.doStartTag(); - tag.doEndTag(); - - assertEquals(startStatus, BodyTag.EVAL_BODY_BUFFERED); - assertEquals("Sample Of Default Message", writer.toString()); + // NOTE: + // simulate the condition + // My Default Message + + StrutsMockBodyContent mockBodyContent = new StrutsMockBodyContent(new MockJspWriter()); + mockBodyContent.setString("Sample Of Default Message"); + tag.setBodyContent(mockBodyContent); + tag.setName("some.invalid.key.so.we.should.get.the.default.message"); + int startStatus = tag.doStartTag(); + tag.doEndTag(); + + assertEquals(startStatus, BodyTag.EVAL_BODY_BUFFERED); + assertEquals("Sample Of Default Message", writer.toString()); } public void testExpressionsEvaluated() throws Exception { diff --git a/core/src/test/java/org/apache/struts2/views/jsp/URLTagTest.java b/core/src/test/java/org/apache/struts2/views/jsp/URLTagTest.java index 887d55464..d1513c2c5 100644 --- a/core/src/test/java/org/apache/struts2/views/jsp/URLTagTest.java +++ b/core/src/test/java/org/apache/struts2/views/jsp/URLTagTest.java @@ -1,19 +1,22 @@ /* * $Id$ * - * Copyright 2006 The Apache Software Foundation. + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at + * http://www.apache.org/licenses/LICENSE-2.0 * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. */ package org.apache.struts2.views.jsp; @@ -31,177 +34,177 @@ import org.apache.struts2.components.URL; public class URLTagTest extends AbstractUITagTest { private URLTag tag; - - + + /** - * To test priority of parameter passed in to url component though - * various way + * To test priority of parameter passed in to url component though + * various way * - current request url * - tag's value attribute * - tag's nested param tag - * - * id1 - * === - * - found in current request url - * - found in tag's value attribute - * - found in tag's param tag - * CONCLUSION: tag's param tag takes precedence (paramId1) - * - * id2 - * === - * - found in current request url - * - found in tag's value attribute - * CONCLUSION: tag's value attribute take precedence (tagId2) - * - * urlParam1 - * ========= - * - found in current request url - * CONCLUSION: param in current request url will be used (urlValue1) - * - * urlParam2 - * ========= - * - found in current request url - * CONCLUSION: param in current request url will be used. (urlValue2) - * - * tagId - * ===== - * - found in tag's value attribute - * CONCLUSION: param in tag's value attribute wil; be used. (tagValue) - * - * param1 - * ====== - * - found in nested param tag - * CONCLUSION: param in nested param tag will be used. (param1value) - * - * param2 - * ====== - * - found in nested param tag - * CONCLUSION: param in nested param tag will be used. (param2value) - */ + * + * id1 + * === + * - found in current request url + * - found in tag's value attribute + * - found in tag's param tag + * CONCLUSION: tag's param tag takes precedence (paramId1) + * + * id2 + * === + * - found in current request url + * - found in tag's value attribute + * CONCLUSION: tag's value attribute take precedence (tagId2) + * + * urlParam1 + * ========= + * - found in current request url + * CONCLUSION: param in current request url will be used (urlValue1) + * + * urlParam2 + * ========= + * - found in current request url + * CONCLUSION: param in current request url will be used. (urlValue2) + * + * tagId + * ===== + * - found in tag's value attribute + * CONCLUSION: param in tag's value attribute wil; be used. (tagValue) + * + * param1 + * ====== + * - found in nested param tag + * CONCLUSION: param in nested param tag will be used. (param1value) + * + * param2 + * ====== + * - found in nested param tag + * CONCLUSION: param in nested param tag will be used. (param2value) + */ public void testParametersPriority() throws Exception { - request.setQueryString("id1=urlId1&id2=urlId2&urlParam1=urlValue1&urlParam2=urlValue2"); - - tag.setValue("testAction.action?id1=tagId1&id2=tagId2&tagId=tagValue"); - - ParamTag param1 = new ParamTag(); - param1.setPageContext(pageContext); - param1.setName("param1"); - param1.setValue("%{'param1value'}"); - - ParamTag param2 = new ParamTag(); - param2.setPageContext(pageContext); - param2.setName("param2"); - param2.setValue("%{'param2value'}"); - - ParamTag param3 = new ParamTag(); - param3.setPageContext(pageContext); - param3.setName("id1"); - param3.setValue("%{'paramId1'}"); - - - tag.doStartTag(); - param1.doStartTag(); - param1.doEndTag(); - param2.doStartTag(); - param2.doEndTag(); - param3.doStartTag(); - param3.doEndTag(); - - URL url = (URL) tag.getComponent(); - Map parameters = url.getParameters(); - - - assertNotNull(parameters); - assertEquals(parameters.size(), 7); - assertEquals(parameters.get("id1"), "paramId1"); - assertEquals(parameters.get("id2"), "tagId2"); - assertEquals(parameters.get("urlParam1"), "urlValue1"); - assertEquals(parameters.get("urlParam2"), "urlValue2"); - assertEquals(parameters.get("tagId"), "tagValue"); - assertEquals(parameters.get("param1"), "param1value"); - assertEquals(parameters.get("param2"), "param2value"); + request.setQueryString("id1=urlId1&id2=urlId2&urlParam1=urlValue1&urlParam2=urlValue2"); + + tag.setValue("testAction.action?id1=tagId1&id2=tagId2&tagId=tagValue"); + + ParamTag param1 = new ParamTag(); + param1.setPageContext(pageContext); + param1.setName("param1"); + param1.setValue("%{'param1value'}"); + + ParamTag param2 = new ParamTag(); + param2.setPageContext(pageContext); + param2.setName("param2"); + param2.setValue("%{'param2value'}"); + + ParamTag param3 = new ParamTag(); + param3.setPageContext(pageContext); + param3.setName("id1"); + param3.setValue("%{'paramId1'}"); + + + tag.doStartTag(); + param1.doStartTag(); + param1.doEndTag(); + param2.doStartTag(); + param2.doEndTag(); + param3.doStartTag(); + param3.doEndTag(); + + URL url = (URL) tag.getComponent(); + Map parameters = url.getParameters(); + + + assertNotNull(parameters); + assertEquals(parameters.size(), 7); + assertEquals(parameters.get("id1"), "paramId1"); + assertEquals(parameters.get("id2"), "tagId2"); + assertEquals(parameters.get("urlParam1"), "urlValue1"); + assertEquals(parameters.get("urlParam2"), "urlValue2"); + assertEquals(parameters.get("tagId"), "tagValue"); + assertEquals(parameters.get("param1"), "param1value"); + assertEquals(parameters.get("param2"), "param2value"); } - - + + /** - * To test priority of parameter passed in to url component though + * To test priority of parameter passed in to url component though * various way, with includeParams="NONE" * - current request url * - tag's value attribute * - tag's nested param tag - * + * * In this case only parameters from the tag itself is taken into account. - * Those from request will not count, only those in tag's value attribute + * Those from request will not count, only those in tag's value attribute * and nested param tag. - * + * * @throws Exception */ public void testParametersPriorityWithIncludeParamsAsNONE() throws Exception { - request.setQueryString("id1=urlId1&id2=urlId2&urlParam1=urlValue1&urlParam2=urlValue2"); - - tag.setValue("testAction.action?id1=tagId1&id2=tagId2&tagId=tagValue"); - tag.setIncludeParams("NONE"); - - ParamTag param1 = new ParamTag(); - param1.setPageContext(pageContext); - param1.setName("param1"); - param1.setValue("%{'param1value'}"); - - ParamTag param2 = new ParamTag(); - param2.setPageContext(pageContext); - param2.setName("param2"); - param2.setValue("%{'param2value'}"); - - ParamTag param3 = new ParamTag(); - param3.setPageContext(pageContext); - param3.setName("id1"); - param3.setValue("%{'paramId1'}"); - - - tag.doStartTag(); - param1.doStartTag(); - param1.doEndTag(); - param2.doStartTag(); - param2.doEndTag(); - param3.doStartTag(); - param3.doEndTag(); - - URL url = (URL) tag.getComponent(); - Map parameters = url.getParameters(); - - assertEquals(parameters.size(), 5); - assertEquals(parameters.get("id1"), "paramId1"); - assertEquals(parameters.get("id2"), "tagId2"); - assertEquals(parameters.get("tagId"), "tagValue"); - assertEquals(parameters.get("param1"), "param1value"); - assertEquals(parameters.get("param2"), "param2value"); + request.setQueryString("id1=urlId1&id2=urlId2&urlParam1=urlValue1&urlParam2=urlValue2"); + + tag.setValue("testAction.action?id1=tagId1&id2=tagId2&tagId=tagValue"); + tag.setIncludeParams("NONE"); + + ParamTag param1 = new ParamTag(); + param1.setPageContext(pageContext); + param1.setName("param1"); + param1.setValue("%{'param1value'}"); + + ParamTag param2 = new ParamTag(); + param2.setPageContext(pageContext); + param2.setName("param2"); + param2.setValue("%{'param2value'}"); + + ParamTag param3 = new ParamTag(); + param3.setPageContext(pageContext); + param3.setName("id1"); + param3.setValue("%{'paramId1'}"); + + + tag.doStartTag(); + param1.doStartTag(); + param1.doEndTag(); + param2.doStartTag(); + param2.doEndTag(); + param3.doStartTag(); + param3.doEndTag(); + + URL url = (URL) tag.getComponent(); + Map parameters = url.getParameters(); + + assertEquals(parameters.size(), 5); + assertEquals(parameters.get("id1"), "paramId1"); + assertEquals(parameters.get("id2"), "tagId2"); + assertEquals(parameters.get("tagId"), "tagValue"); + assertEquals(parameters.get("param1"), "param1value"); + assertEquals(parameters.get("param2"), "param2value"); } public void testIncludeParamsDefaultToGET() throws Exception { - request.setQueryString("one=oneVal&two=twoVal&three=threeVal"); - - // request parameter map should not have any effect, as includeParams - // default to GET, which get its param from request.getQueryString() - Map tmp = new HashMap(); - tmp.put("one", "aaa"); - tmp.put("two", "bbb"); - tmp.put("three", "ccc"); - request.setParameterMap(tmp); - - tag.setValue("TestAction.acton"); - - tag.doStartTag(); - - URL url = (URL) tag.getComponent(); - Map parameters = url.getParameters(); - - tag.doEndTag(); - - assertEquals(parameters.get("one"), "oneVal"); - assertEquals(parameters.get("two"), "twoVal"); - assertEquals(parameters.get("three"), "threeVal"); + request.setQueryString("one=oneVal&two=twoVal&three=threeVal"); + + // request parameter map should not have any effect, as includeParams + // default to GET, which get its param from request.getQueryString() + Map tmp = new HashMap(); + tmp.put("one", "aaa"); + tmp.put("two", "bbb"); + tmp.put("three", "ccc"); + request.setParameterMap(tmp); + + tag.setValue("TestAction.acton"); + + tag.doStartTag(); + + URL url = (URL) tag.getComponent(); + Map parameters = url.getParameters(); + + tag.doEndTag(); + + assertEquals(parameters.get("one"), "oneVal"); + assertEquals(parameters.get("two"), "twoVal"); + assertEquals(parameters.get("three"), "threeVal"); } - + public void testActionURL() throws Exception { tag.setValue("TestAction.action"); @@ -258,50 +261,50 @@ public class URLTagTest extends AbstractUITagTest { tag.doEndTag(); assertEquals("list-members.action#test", writer.toString()); } - + public void testParamPrecedence() throws Exception { - request.setRequestURI("/context/someAction.action"); - request.setQueryString("id=22&name=John"); - - URLTag urlTag = new URLTag(); - urlTag.setPageContext(pageContext); - urlTag.setIncludeParams("get"); - urlTag.setEncode("%{false}"); - - ParamTag paramTag = new ParamTag(); - paramTag.setPageContext(pageContext); - paramTag.setName("id"); - paramTag.setValue("%{'33'}"); - - urlTag.doStartTag(); - paramTag.doStartTag(); - paramTag.doEndTag(); - urlTag.doEndTag(); - - assertEquals(writer.getBuffer().toString(), "/context/someAction.action?name=John&id=33"); + request.setRequestURI("/context/someAction.action"); + request.setQueryString("id=22&name=John"); + + URLTag urlTag = new URLTag(); + urlTag.setPageContext(pageContext); + urlTag.setIncludeParams("get"); + urlTag.setEncode("%{false}"); + + ParamTag paramTag = new ParamTag(); + paramTag.setPageContext(pageContext); + paramTag.setName("id"); + paramTag.setValue("%{'33'}"); + + urlTag.doStartTag(); + paramTag.doStartTag(); + paramTag.doEndTag(); + urlTag.doEndTag(); + + assertEquals(writer.getBuffer().toString(), "/context/someAction.action?name=John&id=33"); } public void testParamPrecedenceWithAnchor() throws Exception { - request.setRequestURI("/context/someAction.action"); - request.setQueryString("id=22&name=John"); + request.setRequestURI("/context/someAction.action"); + request.setQueryString("id=22&name=John"); - URLTag urlTag = new URLTag(); - urlTag.setPageContext(pageContext); - urlTag.setIncludeParams("get"); - urlTag.setEncode("%{false}"); + URLTag urlTag = new URLTag(); + urlTag.setPageContext(pageContext); + urlTag.setIncludeParams("get"); + urlTag.setEncode("%{false}"); urlTag.setAnchor("testAnchor"); ParamTag paramTag = new ParamTag(); - paramTag.setPageContext(pageContext); - paramTag.setName("id"); - paramTag.setValue("%{'33'}"); + paramTag.setPageContext(pageContext); + paramTag.setName("id"); + paramTag.setValue("%{'33'}"); - urlTag.doStartTag(); - paramTag.doStartTag(); - paramTag.doEndTag(); - urlTag.doEndTag(); + urlTag.doStartTag(); + paramTag.doStartTag(); + paramTag.doEndTag(); + urlTag.doEndTag(); - assertEquals(writer.getBuffer().toString(), "/context/someAction.action?name=John&id=33#testAnchor"); + assertEquals(writer.getBuffer().toString(), "/context/someAction.action?name=John&id=33#testAnchor"); } public void testPutId() throws Exception { @@ -313,7 +316,7 @@ public class URLTagTest extends AbstractUITagTest { assertEquals("", writer.toString()); assertEquals("/public/about", stack.findString("myId")); // is in stack now } - + public void testUsingValueOnly() throws Exception { tag.setValue("/public/about/team.jsp"); tag.doStartTag(); diff --git a/core/src/test/java/org/apache/struts2/views/jsp/ui/ActionErrorTagTest.java b/core/src/test/java/org/apache/struts2/views/jsp/ui/ActionErrorTagTest.java index 1c4dfd238..23dbbcc83 100644 --- a/core/src/test/java/org/apache/struts2/views/jsp/ui/ActionErrorTagTest.java +++ b/core/src/test/java/org/apache/struts2/views/jsp/ui/ActionErrorTagTest.java @@ -1,19 +1,22 @@ /* * $Id$ * - * Copyright 2006 The Apache Software Foundation. + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at + * http://www.apache.org/licenses/LICENSE-2.0 * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. */ package org.apache.struts2.views.jsp.ui; @@ -29,65 +32,65 @@ import com.opensymphony.xwork2.ActionSupport; /** * ActionErrorTag test case. - * + * */ public class ActionErrorTagTest extends AbstractUITagTest { - - boolean shouldActionHaveError = false; - - public void testNoActionErrors() throws Exception { - ActionErrorTag tag = new ActionErrorTag(); - ((InternalActionSupport)action).setHasActionErrors(false); - tag.setPageContext(pageContext); - tag.doStartTag(); - tag.doEndTag(); - - //assertEquals("", writer.toString()); - verify(ActionErrorTagTest.class.getResource("actionerror-1.txt")); - } - - public void testHaveActionErrors() throws Exception { - - ActionErrorTag tag = new ActionErrorTag(); - ((InternalActionSupport)action).setHasActionErrors(true); - tag.setPageContext(pageContext); - tag.doStartTag(); - tag.doEndTag(); - verify(ActionErrorTagTest.class.getResource("actionerror-2.txt")); - } - - - public Action getAction() { - return new InternalActionSupport(); - } - - - public class InternalActionSupport extends ActionSupport { - - private static final long serialVersionUID = -4777466640658557661L; - - private boolean yesActionErrors; - - public void setHasActionErrors(boolean aYesActionErrors) { - yesActionErrors = aYesActionErrors; - } - - public boolean hasActionErrors() { - return yesActionErrors; - } - - public Collection getActionErrors() { - if (yesActionErrors) { - List errors = new ArrayList(); - errors.add("action error number 1"); - errors.add("action error number 2"); - errors.add("action error number 3"); - return errors; - } - else { - return Collections.EMPTY_LIST; - } - } - } + boolean shouldActionHaveError = false; + + public void testNoActionErrors() throws Exception { + ActionErrorTag tag = new ActionErrorTag(); + ((InternalActionSupport)action).setHasActionErrors(false); + tag.setPageContext(pageContext); + tag.doStartTag(); + tag.doEndTag(); + + //assertEquals("", writer.toString()); + verify(ActionErrorTagTest.class.getResource("actionerror-1.txt")); + } + + public void testHaveActionErrors() throws Exception { + + ActionErrorTag tag = new ActionErrorTag(); + ((InternalActionSupport)action).setHasActionErrors(true); + tag.setPageContext(pageContext); + tag.doStartTag(); + tag.doEndTag(); + + verify(ActionErrorTagTest.class.getResource("actionerror-2.txt")); + } + + + public Action getAction() { + return new InternalActionSupport(); + } + + + public class InternalActionSupport extends ActionSupport { + + private static final long serialVersionUID = -4777466640658557661L; + + private boolean yesActionErrors; + + public void setHasActionErrors(boolean aYesActionErrors) { + yesActionErrors = aYesActionErrors; + } + + public boolean hasActionErrors() { + return yesActionErrors; + } + + public Collection getActionErrors() { + if (yesActionErrors) { + List errors = new ArrayList(); + errors.add("action error number 1"); + errors.add("action error number 2"); + errors.add("action error number 3"); + return errors; + } + else { + return Collections.EMPTY_LIST; + } + } + } } diff --git a/core/src/test/java/org/apache/struts2/views/jsp/ui/ActionMessageTagTest.java b/core/src/test/java/org/apache/struts2/views/jsp/ui/ActionMessageTagTest.java index 8bfe7ed93..98635e540 100644 --- a/core/src/test/java/org/apache/struts2/views/jsp/ui/ActionMessageTagTest.java +++ b/core/src/test/java/org/apache/struts2/views/jsp/ui/ActionMessageTagTest.java @@ -1,19 +1,22 @@ /* * $Id$ * - * Copyright 2006 The Apache Software Foundation. + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at + * http://www.apache.org/licenses/LICENSE-2.0 * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. */ package org.apache.struts2.views.jsp.ui; @@ -29,68 +32,66 @@ import com.opensymphony.xwork2.ActionSupport; /** * ActionMessageTag test case. - * + * */ public class ActionMessageTagTest extends AbstractUITagTest { - public void testNoActionMessages() throws Exception { - - ActionMessageTag tag = new ActionMessageTag(); - ((InternalActionSupport)action).setHasActionMessage(false); - tag.setPageContext(pageContext); - tag.doStartTag(); - tag.doEndTag(); - - verify(ActionMessageTagTest.class.getResource("actionmessage-1.txt")); - } - - public void testYesActionMessages() throws Exception { - - ActionMessageTag tag = new ActionMessageTag(); - ((InternalActionSupport)action).setHasActionMessage(true); - tag.setPageContext(pageContext); - tag.doStartTag(); - tag.doEndTag(); - - verify(ActionMessageTagTest.class.getResource("actionmessage-2.txt")); - } - - public Action getAction() { - return new InternalActionSupport(); - } + public void testNoActionMessages() throws Exception { - /** - * Internal ActionSupport class for testing, can be in state with - * or without action messages. - * - * @author tm_jee - * @version $Date$ $Id$ - */ - public class InternalActionSupport extends ActionSupport { - - private static final long serialVersionUID = -3230043189352453629L; - - private boolean canHaveActionMessage; - - public void setHasActionMessage(boolean canHaveActionMessage) { - this.canHaveActionMessage = canHaveActionMessage; - } - - public Collection getActionMessages() { - if (canHaveActionMessage) { - List messages = new ArrayList(); - messages.add("action message number 1"); - messages.add("action message number 2"); - messages.add("action message number 3"); - return messages; - } - else { - return Collections.EMPTY_LIST; - } - } - - public boolean hasActionMessages() { - return canHaveActionMessage; - } - } + ActionMessageTag tag = new ActionMessageTag(); + ((InternalActionSupport)action).setHasActionMessage(false); + tag.setPageContext(pageContext); + tag.doStartTag(); + tag.doEndTag(); + + verify(ActionMessageTagTest.class.getResource("actionmessage-1.txt")); + } + + public void testYesActionMessages() throws Exception { + + ActionMessageTag tag = new ActionMessageTag(); + ((InternalActionSupport)action).setHasActionMessage(true); + tag.setPageContext(pageContext); + tag.doStartTag(); + tag.doEndTag(); + + verify(ActionMessageTagTest.class.getResource("actionmessage-2.txt")); + } + + public Action getAction() { + return new InternalActionSupport(); + } + + /** + * Internal ActionSupport class for testing, can be in state with + * or without action messages. + * + */ + public class InternalActionSupport extends ActionSupport { + + private static final long serialVersionUID = -3230043189352453629L; + + private boolean canHaveActionMessage; + + public void setHasActionMessage(boolean canHaveActionMessage) { + this.canHaveActionMessage = canHaveActionMessage; + } + + public Collection getActionMessages() { + if (canHaveActionMessage) { + List messages = new ArrayList(); + messages.add("action message number 1"); + messages.add("action message number 2"); + messages.add("action message number 3"); + return messages; + } + else { + return Collections.EMPTY_LIST; + } + } + + public boolean hasActionMessages() { + return canHaveActionMessage; + } + } } diff --git a/core/src/test/java/org/apache/struts2/views/jsp/ui/AnchorTest.java b/core/src/test/java/org/apache/struts2/views/jsp/ui/AnchorTest.java index 06b058f2f..d0f0787d9 100644 --- a/core/src/test/java/org/apache/struts2/views/jsp/ui/AnchorTest.java +++ b/core/src/test/java/org/apache/struts2/views/jsp/ui/AnchorTest.java @@ -1,19 +1,22 @@ /* * $Id$ * - * Copyright 2006 The Apache Software Foundation. + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at + * http://www.apache.org/licenses/LICENSE-2.0 * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. */ package org.apache.struts2.views.jsp.ui; diff --git a/core/src/test/java/org/apache/struts2/views/jsp/ui/Category.java b/core/src/test/java/org/apache/struts2/views/jsp/ui/Category.java index e767bfc89..37ef934da 100644 --- a/core/src/test/java/org/apache/struts2/views/jsp/ui/Category.java +++ b/core/src/test/java/org/apache/struts2/views/jsp/ui/Category.java @@ -1,19 +1,22 @@ /* * $Id$ * - * Copyright 2006 The Apache Software Foundation. + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at + * http://www.apache.org/licenses/LICENSE-2.0 * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. */ package org.apache.struts2.views.jsp.ui; @@ -26,7 +29,7 @@ import java.util.Map; * Used by Tree Component Test. Copied from showcase. */ public class Category { - private static Map catMap = new HashMap(); + private static Map catMap = new HashMap(); static { new Category(1, "Root", diff --git a/core/src/test/java/org/apache/struts2/views/jsp/ui/CheckboxListTest.java b/core/src/test/java/org/apache/struts2/views/jsp/ui/CheckboxListTest.java index 8cb0b8945..d7d8bcbbe 100644 --- a/core/src/test/java/org/apache/struts2/views/jsp/ui/CheckboxListTest.java +++ b/core/src/test/java/org/apache/struts2/views/jsp/ui/CheckboxListTest.java @@ -1,19 +1,22 @@ /* * $Id$ * - * Copyright 2006 The Apache Software Foundation. + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at + * http://www.apache.org/licenses/LICENSE-2.0 * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. */ package org.apache.struts2.views.jsp.ui; diff --git a/core/src/test/java/org/apache/struts2/views/jsp/ui/CheckboxTest.java b/core/src/test/java/org/apache/struts2/views/jsp/ui/CheckboxTest.java index 26e98a686..a77c81fae 100644 --- a/core/src/test/java/org/apache/struts2/views/jsp/ui/CheckboxTest.java +++ b/core/src/test/java/org/apache/struts2/views/jsp/ui/CheckboxTest.java @@ -1,19 +1,22 @@ /* * $Id$ * - * Copyright 2006 The Apache Software Foundation. + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at + * http://www.apache.org/licenses/LICENSE-2.0 * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. */ package org.apache.struts2.views.jsp.ui; diff --git a/core/src/test/java/org/apache/struts2/views/jsp/ui/ComboBoxTest.java b/core/src/test/java/org/apache/struts2/views/jsp/ui/ComboBoxTest.java index fc9372027..cf1077f43 100644 --- a/core/src/test/java/org/apache/struts2/views/jsp/ui/ComboBoxTest.java +++ b/core/src/test/java/org/apache/struts2/views/jsp/ui/ComboBoxTest.java @@ -1,19 +1,22 @@ /* * $Id$ * - * Copyright 2006 The Apache Software Foundation. + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at + * http://www.apache.org/licenses/LICENSE-2.0 * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. */ package org.apache.struts2.views.jsp.ui; @@ -82,58 +85,58 @@ public class ComboBoxTest extends AbstractUITagTest { verify(ComboBoxTag.class.getResource("ComboBox-1.txt")); } - + public void testWithEmptyOptionAndHeader() throws Exception { - TestAction testAction = (TestAction) action; - testAction.setFoo("banana"); - - List l = new ArrayList(); - l.add("apple"); - l.add("banana"); - l.add("pineaple"); - l.add("grapes"); - testAction.setCollection(l); - - ComboBoxTag tag = new ComboBoxTag(); - tag.setPageContext(pageContext); - tag.setLabel("My Favourite Fruit"); - tag.setName("myFavouriteFruit"); - tag.setEmptyOption("true"); - tag.setHeaderKey("-1"); - tag.setHeaderValue("--- Please Select ---"); - tag.setList("collection"); - tag.setValue("%{foo}"); - - tag.doStartTag(); - tag.doEndTag(); - - verify(ComboBoxTag.class.getResource("ComboBox-2.txt")); + TestAction testAction = (TestAction) action; + testAction.setFoo("banana"); + + List l = new ArrayList(); + l.add("apple"); + l.add("banana"); + l.add("pineaple"); + l.add("grapes"); + testAction.setCollection(l); + + ComboBoxTag tag = new ComboBoxTag(); + tag.setPageContext(pageContext); + tag.setLabel("My Favourite Fruit"); + tag.setName("myFavouriteFruit"); + tag.setEmptyOption("true"); + tag.setHeaderKey("-1"); + tag.setHeaderValue("--- Please Select ---"); + tag.setList("collection"); + tag.setValue("%{foo}"); + + tag.doStartTag(); + tag.doEndTag(); + + verify(ComboBoxTag.class.getResource("ComboBox-2.txt")); } - + public void testWithMap() throws Exception { - TestAction testAction = (TestAction) action; - testAction.setFoo("banana"); - - Map m = new LinkedHashMap(); - m.put("apple", "apple"); - m.put("banana", "banana"); - m.put("pineaple", "pineaple"); - m.put("grapes", "grapes"); - testAction.setMap(m); - - ComboBoxTag tag = new ComboBoxTag(); - tag.setPageContext(pageContext); - tag.setLabel("My Favourite Fruit"); - tag.setName("myFavouriteFruit"); - tag.setHeaderKey("-1"); - tag.setHeaderValue("--- Please Select ---"); - tag.setEmptyOption("true"); - tag.setList("map"); - tag.setValue("%{foo}"); - - tag.doStartTag(); - tag.doEndTag(); - - verify(ComboBoxTag.class.getResource("ComboBox-3.txt")); + TestAction testAction = (TestAction) action; + testAction.setFoo("banana"); + + Map m = new LinkedHashMap(); + m.put("apple", "apple"); + m.put("banana", "banana"); + m.put("pineaple", "pineaple"); + m.put("grapes", "grapes"); + testAction.setMap(m); + + ComboBoxTag tag = new ComboBoxTag(); + tag.setPageContext(pageContext); + tag.setLabel("My Favourite Fruit"); + tag.setName("myFavouriteFruit"); + tag.setHeaderKey("-1"); + tag.setHeaderValue("--- Please Select ---"); + tag.setEmptyOption("true"); + tag.setList("map"); + tag.setValue("%{foo}"); + + tag.doStartTag(); + tag.doEndTag(); + + verify(ComboBoxTag.class.getResource("ComboBox-3.txt")); } } diff --git a/core/src/test/java/org/apache/struts2/views/jsp/ui/ComponentTest.java b/core/src/test/java/org/apache/struts2/views/jsp/ui/ComponentTest.java index 3307cd643..56c4561ed 100644 --- a/core/src/test/java/org/apache/struts2/views/jsp/ui/ComponentTest.java +++ b/core/src/test/java/org/apache/struts2/views/jsp/ui/ComponentTest.java @@ -1,19 +1,22 @@ /* * $Id$ * - * Copyright 2006 The Apache Software Foundation. + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at + * http://www.apache.org/licenses/LICENSE-2.0 * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. */ package org.apache.struts2.views.jsp.ui; @@ -25,45 +28,45 @@ import org.apache.struts2.views.jsp.AbstractUITagTest; */ public class ComponentTest extends AbstractUITagTest { - /** - * Test that id attribute is evaludated against the Ognl Stack. - * @throws Exception - */ - public void testIdIsEvaluatedAgainstStack1() throws Exception { - TestAction testAction = (TestAction) action; - testAction.setFoo("myFooValue"); - - TextFieldTag tag = new TextFieldTag(); - tag.setPageContext(pageContext); + /** + * Test that id attribute is evaludated against the Ognl Stack. + * @throws Exception + */ + public void testIdIsEvaluatedAgainstStack1() throws Exception { + TestAction testAction = (TestAction) action; + testAction.setFoo("myFooValue"); + + TextFieldTag tag = new TextFieldTag(); + tag.setPageContext(pageContext); tag.setLabel("mylabel"); tag.setName("myname"); tag.setValue("foo"); tag.setId("%{foo}"); - + tag.doStartTag(); tag.doEndTag(); verify(ComponentTag.class.getResource("Component-2.txt")); - } - - public void testIdIsEvaludatedAgainstStack2() throws Exception { - TestAction testAction = (TestAction) action; - testAction.setFoo("myFooValue"); - - TextFieldTag tag = new TextFieldTag(); - tag.setPageContext(pageContext); + } + + public void testIdIsEvaludatedAgainstStack2() throws Exception { + TestAction testAction = (TestAction) action; + testAction.setFoo("myFooValue"); + + TextFieldTag tag = new TextFieldTag(); + tag.setPageContext(pageContext); tag.setLabel("mylabel"); tag.setName("myname"); tag.setValue("foo"); tag.setId("foo"); - + tag.doStartTag(); tag.doEndTag(); verify(ComponentTag.class.getResource("Component-3.txt")); - } - - + } + + /** * Note -- this test uses empty.vm, so it's basically clear */ diff --git a/core/src/test/java/org/apache/struts2/views/jsp/ui/DatePickerTagTest.java b/core/src/test/java/org/apache/struts2/views/jsp/ui/DatePickerTagTest.java index 56daea855..29c873e01 100644 --- a/core/src/test/java/org/apache/struts2/views/jsp/ui/DatePickerTagTest.java +++ b/core/src/test/java/org/apache/struts2/views/jsp/ui/DatePickerTagTest.java @@ -1,19 +1,22 @@ /* * $Id$ * - * Copyright 2006 The Apache Software Foundation. + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at + * http://www.apache.org/licenses/LICENSE-2.0 * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. */ package org.apache.struts2.views.jsp.ui; @@ -55,7 +58,7 @@ public class DatePickerTagTest extends AbstractUITagTest { assertTrue("Should contain format", writer.toString().indexOf("#yyyy/#MM/#dd #hh:#mm:#ss") > -1); } - // NOTE: Switching to Dojo's DatePicker, i18n is not supported, + // NOTE: Switching to Dojo's DatePicker, i18n is not supported, // Commenting out this test case /*public void testLanguage() throws Exception { tag.setLanguage("da"); @@ -65,7 +68,7 @@ public class DatePickerTagTest extends AbstractUITagTest { assertTrue("Should contain danish language", writer.toString().indexOf("/struts/jscalendar/lang/calendar-da.js") > -1); }*/ - + // NOTE: Switching to Dojo's DatePicker, showing time is not supported. // Commenting this test case /*public void testShowstime() throws Exception { diff --git a/core/src/test/java/org/apache/struts2/views/jsp/ui/DateTagTest.java b/core/src/test/java/org/apache/struts2/views/jsp/ui/DateTagTest.java index c980de4b5..29d3906dc 100644 --- a/core/src/test/java/org/apache/struts2/views/jsp/ui/DateTagTest.java +++ b/core/src/test/java/org/apache/struts2/views/jsp/ui/DateTagTest.java @@ -1,19 +1,22 @@ /* * $Id$ * - * Copyright 2006 The Apache Software Foundation. + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at + * http://www.apache.org/licenses/LICENSE-2.0 * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. */ package org.apache.struts2.views.jsp.ui; diff --git a/core/src/test/java/org/apache/struts2/views/jsp/ui/DivTest.java b/core/src/test/java/org/apache/struts2/views/jsp/ui/DivTest.java index 9cb9f6160..6e1f94ec1 100644 --- a/core/src/test/java/org/apache/struts2/views/jsp/ui/DivTest.java +++ b/core/src/test/java/org/apache/struts2/views/jsp/ui/DivTest.java @@ -1,19 +1,22 @@ /* * $Id$ * - * Copyright 2006 The Apache Software Foundation. + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at + * http://www.apache.org/licenses/LICENSE-2.0 * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. */ package org.apache.struts2.views.jsp.ui; diff --git a/core/src/test/java/org/apache/struts2/views/jsp/ui/DoubleSelectTest.java b/core/src/test/java/org/apache/struts2/views/jsp/ui/DoubleSelectTest.java index d2920a013..f48da5af2 100644 --- a/core/src/test/java/org/apache/struts2/views/jsp/ui/DoubleSelectTest.java +++ b/core/src/test/java/org/apache/struts2/views/jsp/ui/DoubleSelectTest.java @@ -1,19 +1,22 @@ /* * $Id$ * - * Copyright 2006 The Apache Software Foundation. + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at + * http://www.apache.org/licenses/LICENSE-2.0 * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. */ package org.apache.struts2.views.jsp.ui; @@ -26,7 +29,7 @@ import org.apache.struts2.views.jsp.AbstractUITagTest; /** * Test case for DoubleSelectTag. - * + * */ public class DoubleSelectTest extends AbstractUITagTest { @@ -87,10 +90,10 @@ public class DoubleSelectTest extends AbstractUITagTest { verify(SelectTag.class.getResource("DoubleSelect-1.txt")); } - + public void testDoubleWithDefaultSelectedValues() throws Exception { - - TestAction testAction = (TestAction) action; + + TestAction testAction = (TestAction) action; Region antwerp = new Region("Antwerp", "AN"); Region gent = new Region("Gent", "GN"); @@ -126,7 +129,7 @@ public class DoubleSelectTest extends AbstractUITagTest { tag.setValue("'FR'"); tag.setDoubleValue("'BOR'"); - + tag.setList("list2"); tag.setDoubleList("regions"); @@ -147,11 +150,11 @@ public class DoubleSelectTest extends AbstractUITagTest { tag.doEndTag(); verify(SelectTag.class.getResource("DoubleSelect-2.txt")); - - + + } - - + + public void testGenericSimple() throws Exception { DoubleSelectTag tag = new DoubleSelectTag(); prepareTagGeneric(tag); diff --git a/core/src/test/java/org/apache/struts2/views/jsp/ui/FieldErrorTagTest.java b/core/src/test/java/org/apache/struts2/views/jsp/ui/FieldErrorTagTest.java index 690a49011..33e438bad 100644 --- a/core/src/test/java/org/apache/struts2/views/jsp/ui/FieldErrorTagTest.java +++ b/core/src/test/java/org/apache/struts2/views/jsp/ui/FieldErrorTagTest.java @@ -1,19 +1,22 @@ /* * $Id$ * - * Copyright 2006 The Apache Software Foundation. + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at + * http://www.apache.org/licenses/LICENSE-2.0 * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. */ package org.apache.struts2.views.jsp.ui; @@ -31,212 +34,212 @@ import com.opensymphony.xwork2.ActionSupport; /** * FieldError Tag Test Case. - * + * */ public class FieldErrorTagTest extends AbstractUITagTest { - - public void testWithoutParamsWithFieldErrors() throws Exception { - FieldErrorTag tag = new FieldErrorTag(); - ((InternalAction)action).setHaveFieldErrors(true); - tag.setPageContext(pageContext); - tag.doStartTag(); - tag.doEndTag(); - - verify(FieldErrorTagTest.class.getResource("fielderror-1.txt")); - } - - public void testWithoutParamsWithoutFieldErrors() throws Exception { - FieldErrorTag tag = new FieldErrorTag(); - ((InternalAction)action).setHaveFieldErrors(false); - tag.setPageContext(pageContext); - tag.doStartTag(); - tag.doEndTag(); - - verify(FieldErrorTagTest.class.getResource("fielderror-2.txt")); - } - - public void testWithParamsWithFieldErrors1() throws Exception { - FieldErrorTag tag = new FieldErrorTag(); - ((InternalAction)action).setHaveFieldErrors(true); - tag.setPageContext(pageContext); - tag.doStartTag(); - ParamTag pTag1 = new ParamTag(); - pTag1.setPageContext(pageContext); - pTag1.setValue("%{'field1'}"); - pTag1.doStartTag(); - pTag1.doEndTag(); - - ParamTag pTag2 = new ParamTag(); - pTag2.setPageContext(pageContext); - pTag2.setValue("%{'field3'}"); - pTag2.doStartTag(); - pTag2.doEndTag(); - - tag.doEndTag(); - - verify(FieldErrorTagTest.class.getResource("fielderror-3.txt")); - } - - public void testWithParamsWithFieldErrors2() throws Exception { - FieldErrorTag tag = new FieldErrorTag(); - ((InternalAction)action).setHaveFieldErrors(true); - tag.setPageContext(pageContext); - tag.doStartTag(); - ParamTag pTag1 = new ParamTag(); - pTag1.setPageContext(pageContext); - pTag1.setValue("%{'field1'}"); - pTag1.doStartTag(); - pTag1.doEndTag(); - - ParamTag pTag2 = new ParamTag(); - pTag2.setPageContext(pageContext); - pTag2.setValue("%{'field2'}"); - pTag2.doStartTag(); - pTag2.doEndTag(); - - tag.doEndTag(); - - verify(FieldErrorTagTest.class.getResource("fielderror-4.txt")); - } - - - public void testWithParamsWithFieldErrors3() throws Exception { - FieldErrorTag tag = new FieldErrorTag(); - ((InternalAction)action).setHaveFieldErrors(true); - tag.setPageContext(pageContext); - tag.doStartTag(); - ParamTag pTag1 = new ParamTag(); - pTag1.setPageContext(pageContext); - pTag1.setValue("%{'field2'}"); - pTag1.doStartTag(); - pTag1.doEndTag(); - - tag.doEndTag(); - - verify(FieldErrorTagTest.class.getResource("fielderror-5.txt")); - } - - public void testWithParamsWithoutFieldErrors1() throws Exception { - FieldErrorTag tag = new FieldErrorTag(); - ((InternalAction)action).setHaveFieldErrors(false); - tag.setPageContext(pageContext); - tag.doStartTag(); - ParamTag pTag1 = new ParamTag(); - pTag1.setPageContext(pageContext); - pTag1.setValue("%{'field1'}"); - pTag1.doStartTag(); - pTag1.doEndTag(); - - ParamTag pTag2 = new ParamTag(); - pTag2.setPageContext(pageContext); - pTag2.setValue("%{'field3'}"); - pTag2.doStartTag(); - pTag2.doEndTag(); - tag.doEndTag(); - - verify(FieldErrorTagTest.class.getResource("fielderror-2.txt")); - } - - public void testWithParamsWithoutFieldErrors2() throws Exception { - FieldErrorTag tag = new FieldErrorTag(); - ((InternalAction)action).setHaveFieldErrors(false); - tag.setPageContext(pageContext); - tag.doStartTag(); - ParamTag pTag1 = new ParamTag(); - pTag1.setPageContext(pageContext); - pTag1.setValue("%{'field1'}"); - pTag1.doStartTag(); - pTag1.doEndTag(); - - ParamTag pTag2 = new ParamTag(); - pTag2.setPageContext(pageContext); - pTag2.setValue("%{'field3'}"); - pTag2.doStartTag(); - pTag2.doEndTag(); - tag.doEndTag(); - - verify(FieldErrorTagTest.class.getResource("fielderror-2.txt")); - } - - - public void testWithParamsWithoutFieldErrors3() throws Exception { - FieldErrorTag tag = new FieldErrorTag(); - ((InternalAction)action).setHaveFieldErrors(false); - tag.setPageContext(pageContext); - tag.doStartTag(); - ParamTag pTag1 = new ParamTag(); - pTag1.setPageContext(pageContext); - pTag1.setValue("%{'field2'}"); - pTag1.doStartTag(); - pTag1.doEndTag(); - - tag.doEndTag(); - - verify(FieldErrorTagTest.class.getResource("fielderror-2.txt")); - } - - public void testWithNullFieldErrors() throws Exception { - FieldErrorTag tag = new FieldErrorTag(); - ((InternalAction)action).setHaveFieldErrors(false); - ((InternalAction)action).setReturnNullForFieldErrors(true); - tag.setPageContext(pageContext); - tag.doStartTag(); - ParamTag pTag1 = new ParamTag(); - pTag1.setPageContext(pageContext); - pTag1.setValue("%{'field2'}"); - pTag1.doStartTag(); - pTag1.doEndTag(); - - tag.doEndTag(); - - verify(FieldErrorTagTest.class.getResource("fielderror-2.txt")); - } - - - public Action getAction() { - return new InternalAction(); - } - - - public class InternalAction extends ActionSupport { - - private boolean haveFieldErrors = false; - private boolean returnNullForFieldErrors = false; - - public void setHaveFieldErrors(boolean haveFieldErrors) { - this.haveFieldErrors = haveFieldErrors; - } - - public void setReturnNullForFieldErrors(boolean returnNullForFieldErrors) { - this.returnNullForFieldErrors = returnNullForFieldErrors; - } - - public Map getFieldErrors() { - if (haveFieldErrors) { - List err1 = new ArrayList(); - err1.add("field error message number 1"); - List err2 = new ArrayList(); - err2.add("field error message number 2"); - List err3 = new ArrayList(); - err3.add("field error message number 3"); - Map fieldErrors = new LinkedHashMap(); - fieldErrors.put("field1", err1); - fieldErrors.put("field2", err2); - fieldErrors.put("field3", err3); - return fieldErrors; - } - else if (returnNullForFieldErrors) { - return null; - } - else { - return Collections.EMPTY_MAP; - } - } - - public boolean hasFieldErrors() { - return haveFieldErrors; - } - } + + public void testWithoutParamsWithFieldErrors() throws Exception { + FieldErrorTag tag = new FieldErrorTag(); + ((InternalAction)action).setHaveFieldErrors(true); + tag.setPageContext(pageContext); + tag.doStartTag(); + tag.doEndTag(); + + verify(FieldErrorTagTest.class.getResource("fielderror-1.txt")); + } + + public void testWithoutParamsWithoutFieldErrors() throws Exception { + FieldErrorTag tag = new FieldErrorTag(); + ((InternalAction)action).setHaveFieldErrors(false); + tag.setPageContext(pageContext); + tag.doStartTag(); + tag.doEndTag(); + + verify(FieldErrorTagTest.class.getResource("fielderror-2.txt")); + } + + public void testWithParamsWithFieldErrors1() throws Exception { + FieldErrorTag tag = new FieldErrorTag(); + ((InternalAction)action).setHaveFieldErrors(true); + tag.setPageContext(pageContext); + tag.doStartTag(); + ParamTag pTag1 = new ParamTag(); + pTag1.setPageContext(pageContext); + pTag1.setValue("%{'field1'}"); + pTag1.doStartTag(); + pTag1.doEndTag(); + + ParamTag pTag2 = new ParamTag(); + pTag2.setPageContext(pageContext); + pTag2.setValue("%{'field3'}"); + pTag2.doStartTag(); + pTag2.doEndTag(); + + tag.doEndTag(); + + verify(FieldErrorTagTest.class.getResource("fielderror-3.txt")); + } + + public void testWithParamsWithFieldErrors2() throws Exception { + FieldErrorTag tag = new FieldErrorTag(); + ((InternalAction)action).setHaveFieldErrors(true); + tag.setPageContext(pageContext); + tag.doStartTag(); + ParamTag pTag1 = new ParamTag(); + pTag1.setPageContext(pageContext); + pTag1.setValue("%{'field1'}"); + pTag1.doStartTag(); + pTag1.doEndTag(); + + ParamTag pTag2 = new ParamTag(); + pTag2.setPageContext(pageContext); + pTag2.setValue("%{'field2'}"); + pTag2.doStartTag(); + pTag2.doEndTag(); + + tag.doEndTag(); + + verify(FieldErrorTagTest.class.getResource("fielderror-4.txt")); + } + + + public void testWithParamsWithFieldErrors3() throws Exception { + FieldErrorTag tag = new FieldErrorTag(); + ((InternalAction)action).setHaveFieldErrors(true); + tag.setPageContext(pageContext); + tag.doStartTag(); + ParamTag pTag1 = new ParamTag(); + pTag1.setPageContext(pageContext); + pTag1.setValue("%{'field2'}"); + pTag1.doStartTag(); + pTag1.doEndTag(); + + tag.doEndTag(); + + verify(FieldErrorTagTest.class.getResource("fielderror-5.txt")); + } + + public void testWithParamsWithoutFieldErrors1() throws Exception { + FieldErrorTag tag = new FieldErrorTag(); + ((InternalAction)action).setHaveFieldErrors(false); + tag.setPageContext(pageContext); + tag.doStartTag(); + ParamTag pTag1 = new ParamTag(); + pTag1.setPageContext(pageContext); + pTag1.setValue("%{'field1'}"); + pTag1.doStartTag(); + pTag1.doEndTag(); + + ParamTag pTag2 = new ParamTag(); + pTag2.setPageContext(pageContext); + pTag2.setValue("%{'field3'}"); + pTag2.doStartTag(); + pTag2.doEndTag(); + tag.doEndTag(); + + verify(FieldErrorTagTest.class.getResource("fielderror-2.txt")); + } + + public void testWithParamsWithoutFieldErrors2() throws Exception { + FieldErrorTag tag = new FieldErrorTag(); + ((InternalAction)action).setHaveFieldErrors(false); + tag.setPageContext(pageContext); + tag.doStartTag(); + ParamTag pTag1 = new ParamTag(); + pTag1.setPageContext(pageContext); + pTag1.setValue("%{'field1'}"); + pTag1.doStartTag(); + pTag1.doEndTag(); + + ParamTag pTag2 = new ParamTag(); + pTag2.setPageContext(pageContext); + pTag2.setValue("%{'field3'}"); + pTag2.doStartTag(); + pTag2.doEndTag(); + tag.doEndTag(); + + verify(FieldErrorTagTest.class.getResource("fielderror-2.txt")); + } + + + public void testWithParamsWithoutFieldErrors3() throws Exception { + FieldErrorTag tag = new FieldErrorTag(); + ((InternalAction)action).setHaveFieldErrors(false); + tag.setPageContext(pageContext); + tag.doStartTag(); + ParamTag pTag1 = new ParamTag(); + pTag1.setPageContext(pageContext); + pTag1.setValue("%{'field2'}"); + pTag1.doStartTag(); + pTag1.doEndTag(); + + tag.doEndTag(); + + verify(FieldErrorTagTest.class.getResource("fielderror-2.txt")); + } + + public void testWithNullFieldErrors() throws Exception { + FieldErrorTag tag = new FieldErrorTag(); + ((InternalAction)action).setHaveFieldErrors(false); + ((InternalAction)action).setReturnNullForFieldErrors(true); + tag.setPageContext(pageContext); + tag.doStartTag(); + ParamTag pTag1 = new ParamTag(); + pTag1.setPageContext(pageContext); + pTag1.setValue("%{'field2'}"); + pTag1.doStartTag(); + pTag1.doEndTag(); + + tag.doEndTag(); + + verify(FieldErrorTagTest.class.getResource("fielderror-2.txt")); + } + + + public Action getAction() { + return new InternalAction(); + } + + + public class InternalAction extends ActionSupport { + + private boolean haveFieldErrors = false; + private boolean returnNullForFieldErrors = false; + + public void setHaveFieldErrors(boolean haveFieldErrors) { + this.haveFieldErrors = haveFieldErrors; + } + + public void setReturnNullForFieldErrors(boolean returnNullForFieldErrors) { + this.returnNullForFieldErrors = returnNullForFieldErrors; + } + + public Map getFieldErrors() { + if (haveFieldErrors) { + List err1 = new ArrayList(); + err1.add("field error message number 1"); + List err2 = new ArrayList(); + err2.add("field error message number 2"); + List err3 = new ArrayList(); + err3.add("field error message number 3"); + Map fieldErrors = new LinkedHashMap(); + fieldErrors.put("field1", err1); + fieldErrors.put("field2", err2); + fieldErrors.put("field3", err3); + return fieldErrors; + } + else if (returnNullForFieldErrors) { + return null; + } + else { + return Collections.EMPTY_MAP; + } + } + + public boolean hasFieldErrors() { + return haveFieldErrors; + } + } } diff --git a/core/src/test/java/org/apache/struts2/views/jsp/ui/FileTest.java b/core/src/test/java/org/apache/struts2/views/jsp/ui/FileTest.java index 89d8431fe..572a30705 100644 --- a/core/src/test/java/org/apache/struts2/views/jsp/ui/FileTest.java +++ b/core/src/test/java/org/apache/struts2/views/jsp/ui/FileTest.java @@ -1,19 +1,22 @@ /* * $Id$ * - * Copyright 2006 The Apache Software Foundation. + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at + * http://www.apache.org/licenses/LICENSE-2.0 * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. */ package org.apache.struts2.views.jsp.ui; diff --git a/core/src/test/java/org/apache/struts2/views/jsp/ui/FormTagTest.java b/core/src/test/java/org/apache/struts2/views/jsp/ui/FormTagTest.java index 25bc18814..b080aaf92 100644 --- a/core/src/test/java/org/apache/struts2/views/jsp/ui/FormTagTest.java +++ b/core/src/test/java/org/apache/struts2/views/jsp/ui/FormTagTest.java @@ -1,19 +1,22 @@ /* * $Id$ * - * Copyright 2006 The Apache Software Foundation. + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at + * http://www.apache.org/licenses/LICENSE-2.0 * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. */ package org.apache.struts2.views.jsp.ui; diff --git a/core/src/test/java/org/apache/struts2/views/jsp/ui/HeadTagTest.java b/core/src/test/java/org/apache/struts2/views/jsp/ui/HeadTagTest.java index fc92f2cdd..ac74218a2 100644 --- a/core/src/test/java/org/apache/struts2/views/jsp/ui/HeadTagTest.java +++ b/core/src/test/java/org/apache/struts2/views/jsp/ui/HeadTagTest.java @@ -1,19 +1,22 @@ /* * $Id$ * - * Copyright 2006 The Apache Software Foundation. + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at + * http://www.apache.org/licenses/LICENSE-2.0 * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. */ package org.apache.struts2.views.jsp.ui; @@ -42,7 +45,7 @@ public class HeadTagTest extends AbstractUITagTest { tag.doStartTag(); tag.doEndTag(); tag.setCalendarcss(null); // null = should use calendar-blue.css - + verify(HeadTagTest.class.getResource("HeadTagTest-1.txt")); } diff --git a/core/src/test/java/org/apache/struts2/views/jsp/ui/HiddenTest.java b/core/src/test/java/org/apache/struts2/views/jsp/ui/HiddenTest.java index f30fec905..0d16385d6 100644 --- a/core/src/test/java/org/apache/struts2/views/jsp/ui/HiddenTest.java +++ b/core/src/test/java/org/apache/struts2/views/jsp/ui/HiddenTest.java @@ -1,19 +1,22 @@ /* * $Id$ * - * Copyright 2006 The Apache Software Foundation. + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at + * http://www.apache.org/licenses/LICENSE-2.0 * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. */ package org.apache.struts2.views.jsp.ui; diff --git a/core/src/test/java/org/apache/struts2/views/jsp/ui/JspTemplateTest.java b/core/src/test/java/org/apache/struts2/views/jsp/ui/JspTemplateTest.java index c5efac776..32c4e26ac 100644 --- a/core/src/test/java/org/apache/struts2/views/jsp/ui/JspTemplateTest.java +++ b/core/src/test/java/org/apache/struts2/views/jsp/ui/JspTemplateTest.java @@ -1,19 +1,22 @@ /* * $Id$ * - * Copyright 2006 The Apache Software Foundation. + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at + * http://www.apache.org/licenses/LICENSE-2.0 * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. */ package org.apache.struts2.views.jsp.ui; diff --git a/core/src/test/java/org/apache/struts2/views/jsp/ui/LabelTest.java b/core/src/test/java/org/apache/struts2/views/jsp/ui/LabelTest.java index ef51f9efc..ebcca0b7b 100644 --- a/core/src/test/java/org/apache/struts2/views/jsp/ui/LabelTest.java +++ b/core/src/test/java/org/apache/struts2/views/jsp/ui/LabelTest.java @@ -1,19 +1,22 @@ /* * $Id$ * - * Copyright 2006 The Apache Software Foundation. + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at + * http://www.apache.org/licenses/LICENSE-2.0 * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. */ package org.apache.struts2.views.jsp.ui; diff --git a/core/src/test/java/org/apache/struts2/views/jsp/ui/MockTag.java b/core/src/test/java/org/apache/struts2/views/jsp/ui/MockTag.java index 25d7d8b48..5439f75c3 100644 --- a/core/src/test/java/org/apache/struts2/views/jsp/ui/MockTag.java +++ b/core/src/test/java/org/apache/struts2/views/jsp/ui/MockTag.java @@ -1,19 +1,22 @@ /* * $Id$ * - * Copyright 2006 The Apache Software Foundation. + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at + * http://www.apache.org/licenses/LICENSE-2.0 * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. */ package org.apache.struts2.views.jsp.ui; @@ -29,9 +32,9 @@ import javax.servlet.jsp.tagext.BodyTagSupport; */ public class MockTag extends BodyTagSupport { - private static final long serialVersionUID = 2694367759647164641L; - - private static String s; + private static final long serialVersionUID = 2694367759647164641L; + + private static String s; private static Integer i; private static Double d; private static Long l; diff --git a/core/src/test/java/org/apache/struts2/views/jsp/ui/OptGroupTest.java b/core/src/test/java/org/apache/struts2/views/jsp/ui/OptGroupTest.java index b0c062d2f..cf30864f7 100644 --- a/core/src/test/java/org/apache/struts2/views/jsp/ui/OptGroupTest.java +++ b/core/src/test/java/org/apache/struts2/views/jsp/ui/OptGroupTest.java @@ -1,120 +1,123 @@ /* * $Id$ * - * Copyright 2006 The Apache Software Foundation. + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at + * http://www.apache.org/licenses/LICENSE-2.0 * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. */ package org.apache.struts2.views.jsp.ui; import org.apache.struts2.views.jsp.AbstractUITagTest; /** - * + * */ public class OptGroupTest extends AbstractUITagTest { - - - public void testOptGroupSimple() throws Exception { - SelectTag selectTag = new SelectTag(); - selectTag.setName("mySelection"); - selectTag.setLabel("My Selection"); - selectTag.setList("%{#{'ONE':'one','TWO':'two','THREE':'three'}}"); - - OptGroupTag optGroupTag1 = new OptGroupTag(); - optGroupTag1.setLabel("My Label 1"); - optGroupTag1.setList("%{#{'AAA':'aaa','BBB':'bbb','CCC':'ccc'}}"); - - OptGroupTag optGroupTag2 = new OptGroupTag(); - optGroupTag2.setLabel("My Label 2"); - optGroupTag2.setList("%{#{'DDD':'ddd','EEE':'eee','FFF':'fff'}}"); - - selectTag.setPageContext(pageContext); - selectTag.doStartTag(); - optGroupTag1.setPageContext(pageContext); - optGroupTag1.doStartTag(); - optGroupTag1.doEndTag(); - optGroupTag2.setPageContext(pageContext); - optGroupTag2.doStartTag(); - optGroupTag2.doEndTag(); - selectTag.doEndTag(); - - - //System.out.println(writer.toString()); - verify(SelectTag.class.getResource("OptGroup-1.txt")); - } - - - public void testOptGroupWithSingleSelect() throws Exception { - - SelectTag selectTag = new SelectTag(); - selectTag.setName("mySelection"); - selectTag.setLabel("My Selection"); - selectTag.setList("%{#{'ONE':'one','TWO':'two','THREE':'three'}}"); - selectTag.setValue("%{'EEE'}"); - - OptGroupTag optGroupTag1 = new OptGroupTag(); - optGroupTag1.setLabel("My Label 1"); - optGroupTag1.setList("%{#{'AAA':'aaa','BBB':'bbb','CCC':'ccc'}}"); - - OptGroupTag optGroupTag2 = new OptGroupTag(); - optGroupTag2.setLabel("My Label 2"); - optGroupTag2.setList("%{#{'DDD':'ddd','EEE':'eee','FFF':'fff'}}"); - - selectTag.setPageContext(pageContext); - selectTag.doStartTag(); - optGroupTag1.setPageContext(pageContext); - optGroupTag1.doStartTag(); - optGroupTag1.doEndTag(); - optGroupTag2.setPageContext(pageContext); - optGroupTag2.doStartTag(); - optGroupTag2.doEndTag(); - selectTag.doEndTag(); - - - //System.out.println(writer.toString()); - verify(SelectTag.class.getResource("OptGroup-2.txt")); - } - - - public void testOptGroupWithMultipleSelect() throws Exception { - SelectTag selectTag = new SelectTag(); - selectTag.setMultiple("true"); - selectTag.setName("mySelection"); - selectTag.setLabel("My Selection"); - selectTag.setList("%{#{'ONE':'one','TWO':'two','THREE':'three'}}"); - selectTag.setValue("%{{'EEE','BBB','TWO'}}"); - - OptGroupTag optGroupTag1 = new OptGroupTag(); - optGroupTag1.setLabel("My Label 1"); - optGroupTag1.setList("%{#{'AAA':'aaa','BBB':'bbb','CCC':'ccc'}}"); - - OptGroupTag optGroupTag2 = new OptGroupTag(); - optGroupTag2.setLabel("My Label 2"); - optGroupTag2.setList("%{#{'DDD':'ddd','EEE':'eee','FFF':'fff'}}"); - - selectTag.setPageContext(pageContext); - selectTag.doStartTag(); - optGroupTag1.setPageContext(pageContext); - optGroupTag1.doStartTag(); - optGroupTag1.doEndTag(); - optGroupTag2.setPageContext(pageContext); - optGroupTag2.doStartTag(); - optGroupTag2.doEndTag(); - selectTag.doEndTag(); - - - //System.out.println(writer.toString()); - verify(SelectTag.class.getResource("OptGroup-3.txt")); - } + + + public void testOptGroupSimple() throws Exception { + SelectTag selectTag = new SelectTag(); + selectTag.setName("mySelection"); + selectTag.setLabel("My Selection"); + selectTag.setList("%{#{'ONE':'one','TWO':'two','THREE':'three'}}"); + + OptGroupTag optGroupTag1 = new OptGroupTag(); + optGroupTag1.setLabel("My Label 1"); + optGroupTag1.setList("%{#{'AAA':'aaa','BBB':'bbb','CCC':'ccc'}}"); + + OptGroupTag optGroupTag2 = new OptGroupTag(); + optGroupTag2.setLabel("My Label 2"); + optGroupTag2.setList("%{#{'DDD':'ddd','EEE':'eee','FFF':'fff'}}"); + + selectTag.setPageContext(pageContext); + selectTag.doStartTag(); + optGroupTag1.setPageContext(pageContext); + optGroupTag1.doStartTag(); + optGroupTag1.doEndTag(); + optGroupTag2.setPageContext(pageContext); + optGroupTag2.doStartTag(); + optGroupTag2.doEndTag(); + selectTag.doEndTag(); + + + //System.out.println(writer.toString()); + verify(SelectTag.class.getResource("OptGroup-1.txt")); + } + + + public void testOptGroupWithSingleSelect() throws Exception { + + SelectTag selectTag = new SelectTag(); + selectTag.setName("mySelection"); + selectTag.setLabel("My Selection"); + selectTag.setList("%{#{'ONE':'one','TWO':'two','THREE':'three'}}"); + selectTag.setValue("%{'EEE'}"); + + OptGroupTag optGroupTag1 = new OptGroupTag(); + optGroupTag1.setLabel("My Label 1"); + optGroupTag1.setList("%{#{'AAA':'aaa','BBB':'bbb','CCC':'ccc'}}"); + + OptGroupTag optGroupTag2 = new OptGroupTag(); + optGroupTag2.setLabel("My Label 2"); + optGroupTag2.setList("%{#{'DDD':'ddd','EEE':'eee','FFF':'fff'}}"); + + selectTag.setPageContext(pageContext); + selectTag.doStartTag(); + optGroupTag1.setPageContext(pageContext); + optGroupTag1.doStartTag(); + optGroupTag1.doEndTag(); + optGroupTag2.setPageContext(pageContext); + optGroupTag2.doStartTag(); + optGroupTag2.doEndTag(); + selectTag.doEndTag(); + + + //System.out.println(writer.toString()); + verify(SelectTag.class.getResource("OptGroup-2.txt")); + } + + + public void testOptGroupWithMultipleSelect() throws Exception { + SelectTag selectTag = new SelectTag(); + selectTag.setMultiple("true"); + selectTag.setName("mySelection"); + selectTag.setLabel("My Selection"); + selectTag.setList("%{#{'ONE':'one','TWO':'two','THREE':'three'}}"); + selectTag.setValue("%{{'EEE','BBB','TWO'}}"); + + OptGroupTag optGroupTag1 = new OptGroupTag(); + optGroupTag1.setLabel("My Label 1"); + optGroupTag1.setList("%{#{'AAA':'aaa','BBB':'bbb','CCC':'ccc'}}"); + + OptGroupTag optGroupTag2 = new OptGroupTag(); + optGroupTag2.setLabel("My Label 2"); + optGroupTag2.setList("%{#{'DDD':'ddd','EEE':'eee','FFF':'fff'}}"); + + selectTag.setPageContext(pageContext); + selectTag.doStartTag(); + optGroupTag1.setPageContext(pageContext); + optGroupTag1.doStartTag(); + optGroupTag1.doEndTag(); + optGroupTag2.setPageContext(pageContext); + optGroupTag2.doStartTag(); + optGroupTag2.doEndTag(); + selectTag.doEndTag(); + + + //System.out.println(writer.toString()); + verify(SelectTag.class.getResource("OptGroup-3.txt")); + } } diff --git a/core/src/test/java/org/apache/struts2/views/jsp/ui/OptionTransferSelectTagTest.java b/core/src/test/java/org/apache/struts2/views/jsp/ui/OptionTransferSelectTagTest.java index 2384fe6d6..1a1af11ff 100644 --- a/core/src/test/java/org/apache/struts2/views/jsp/ui/OptionTransferSelectTagTest.java +++ b/core/src/test/java/org/apache/struts2/views/jsp/ui/OptionTransferSelectTagTest.java @@ -1,19 +1,22 @@ /* * $Id$ * - * Copyright 2006 The Apache Software Foundation. + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at + * http://www.apache.org/licenses/LICENSE-2.0 * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. */ package org.apache.struts2.views.jsp.ui; @@ -24,497 +27,497 @@ import org.apache.struts2.TestAction; import org.apache.struts2.views.jsp.AbstractUITagTest; /** - * + * */ public class OptionTransferSelectTagTest extends AbstractUITagTest { - public void testWithAllSelected() throws Exception { - List left = new ArrayList(); - left.add("Left1"); - left.add("Left2"); - - List right = new ArrayList(); - right.add("Right1"); - right.add("Right2"); - - TestAction testaction = (TestAction) action; - testaction.setCollection(left); - testaction.setList2(right); - - OptionTransferSelectTag tag = new OptionTransferSelectTag(); - tag.setPageContext(pageContext); - - tag.setName("collection"); - tag.setId("id"); - tag.setList("collection"); - tag.setSize("20"); - tag.setMultiple("true"); - tag.setEmptyOption("true"); - - tag.setDoubleName("list2"); - tag.setDoubleList("list2"); - tag.setDoubleId("doubleId"); - tag.setDoubleSize("20"); - tag.setMultiple("true"); - tag.setDoubleEmptyOption("true"); - - tag.setAllowAddAllToLeft("true"); - tag.setAllowAddAllToRight("true"); - tag.setAllowAddToLeft("true"); - tag.setAllowAddToRight("true"); - tag.setAllowSelectAll("true"); - - tag.setAddAllToLeftLabel("All Left"); - tag.setAddAllToRightLabel("All Right"); - tag.setAddToLeftLabel("Left"); - tag.setAddToRightLabel("Right"); - tag.setSelectAllLabel("Select All"); - - tag.setLeftTitle("Title Left"); - tag.setRightTitle("Title Right"); - - tag.setButtonCssClass("buttonCssClass"); - tag.setButtonCssStyle("buttonCssStyle"); - - tag.setHeaderKey("Header Key"); - tag.setHeaderValue("Header Value"); - - tag.setDoubleHeaderKey("Double Header Key"); - tag.setDoubleHeaderValue("Double Header Value"); - - tag.doStartTag(); - tag.doEndTag(); - - //System.out.println(writer.toString()); - verify(OptionTransferSelectTagTest.class.getResource("optiontransferselect-1.txt")); - } - - public void testWithPartialSelectedOnBothSides() throws Exception { - List left = new ArrayList(); - left.add("Left2"); - - List right = new ArrayList(); - right.add("Right2"); - - List leftVal = new ArrayList(); - leftVal.add("Left1"); - leftVal.add("Left2"); - leftVal.add("Left3"); - - List rightVal = new ArrayList(); - rightVal.add("Right1"); - rightVal.add("Right2"); - rightVal.add("Right3"); - - - TestAction testaction = (TestAction) action; - testaction.setCollection(left); - testaction.setList2(right); - testaction.setCollection2(leftVal); - testaction.setList3(rightVal); - - - OptionTransferSelectTag tag = new OptionTransferSelectTag(); - tag.setPageContext(pageContext); - - tag.setName("collection"); - tag.setId("id"); - tag.setList("collection2"); - tag.setSize("20"); - tag.setMultiple("true"); - tag.setEmptyOption("true"); - - tag.setDoubleName("list2"); - tag.setDoubleList("list3"); - tag.setDoubleId("doubleId"); - tag.setDoubleSize("20"); - tag.setMultiple("true"); - tag.setDoubleEmptyOption("true"); - - tag.setAllowAddAllToLeft("true"); - tag.setAllowAddAllToRight("true"); - tag.setAllowAddToLeft("true"); - tag.setAllowAddToRight("true"); - tag.setAllowSelectAll("true"); - - tag.setAddAllToLeftLabel("All Left"); - tag.setAddAllToRightLabel("All Right"); - tag.setAddToLeftLabel("Left"); - tag.setAddToRightLabel("Right"); - tag.setSelectAllLabel("Select All"); - - tag.setLeftTitle("Title Left"); - tag.setRightTitle("Title Right"); - - tag.setButtonCssClass("buttonCssClass"); - tag.setButtonCssStyle("buttonCssStyle"); - - tag.setHeaderKey("Header Key"); - tag.setHeaderValue("Header Value"); - - tag.setDoubleHeaderKey("Double Header Key"); - tag.setDoubleHeaderValue("Double Header Value"); - - tag.doStartTag(); - tag.doEndTag(); - - //System.out.println(writer.toString()); - verify(OptionTransferSelectTagTest.class.getResource("optiontransferselect-2.txt")); - } - - public void testWithoutHeaderOnBothSides() throws Exception { - List left = new ArrayList(); - left.add("Left2"); - - List right = new ArrayList(); - right.add("Right2"); - - List leftVal = new ArrayList(); - leftVal.add("Left1"); - leftVal.add("Left2"); - leftVal.add("Left3"); - - List rightVal = new ArrayList(); - rightVal.add("Right1"); - rightVal.add("Right2"); - rightVal.add("Right3"); - - - TestAction testaction = (TestAction) action; - testaction.setCollection(left); - testaction.setList2(right); - testaction.setCollection2(leftVal); - testaction.setList3(rightVal); - - - OptionTransferSelectTag tag = new OptionTransferSelectTag(); - tag.setPageContext(pageContext); - - tag.setName("collection"); - tag.setId("id"); - tag.setList("collection2"); - tag.setSize("20"); - tag.setMultiple("true"); - tag.setEmptyOption("true"); - - tag.setDoubleName("list2"); - tag.setDoubleList("list3"); - tag.setDoubleId("doubleId"); - tag.setDoubleSize("20"); - tag.setMultiple("true"); - tag.setDoubleEmptyOption("true"); - - tag.setAllowAddAllToLeft("true"); - tag.setAllowAddAllToRight("true"); - tag.setAllowAddToLeft("true"); - tag.setAllowAddToRight("true"); - tag.setAllowSelectAll("true"); - - tag.setAddAllToLeftLabel("All Left"); - tag.setAddAllToRightLabel("All Right"); - tag.setAddToLeftLabel("Left"); - tag.setAddToRightLabel("Right"); - tag.setSelectAllLabel("Select All"); - - tag.setLeftTitle("Title Left"); - tag.setRightTitle("Title Right"); - - tag.setButtonCssClass("buttonCssClass"); - tag.setButtonCssStyle("buttonCssStyle"); - - tag.doStartTag(); - tag.doEndTag(); - - //System.out.println(writer.toString()); - verify(OptionTransferSelectTagTest.class.getResource("optiontransferselect-3.txt")); - } - - public void testWithoutHeaderOnOneSide() throws Exception { - List left = new ArrayList(); - left.add("Left2"); - - List right = new ArrayList(); - right.add("Right2"); - - List leftVal = new ArrayList(); - leftVal.add("Left1"); - leftVal.add("Left2"); - leftVal.add("Left3"); - - List rightVal = new ArrayList(); - rightVal.add("Right1"); - rightVal.add("Right2"); - rightVal.add("Right3"); - - - TestAction testaction = (TestAction) action; - testaction.setCollection(left); - testaction.setList2(right); - testaction.setCollection2(leftVal); - testaction.setList3(rightVal); - - - OptionTransferSelectTag tag = new OptionTransferSelectTag(); - tag.setPageContext(pageContext); - - tag.setName("collection"); - tag.setId("id"); - tag.setList("collection2"); - tag.setSize("20"); - tag.setMultiple("true"); - tag.setEmptyOption("true"); - - tag.setDoubleName("list2"); - tag.setDoubleList("list3"); - tag.setDoubleId("doubleId"); - tag.setDoubleSize("20"); - tag.setMultiple("true"); - tag.setDoubleEmptyOption("true"); - - tag.setAllowAddAllToLeft("true"); - tag.setAllowAddAllToRight("true"); - tag.setAllowAddToLeft("true"); - tag.setAllowAddToRight("true"); - tag.setAllowSelectAll("true"); - - tag.setAddAllToLeftLabel("All Left"); - tag.setAddAllToRightLabel("All Right"); - tag.setAddToLeftLabel("Left"); - tag.setAddToRightLabel("Right"); - tag.setSelectAllLabel("Select All"); - - tag.setLeftTitle("Title Left"); - tag.setRightTitle("Title Right"); - - tag.setButtonCssClass("buttonCssClass"); - tag.setButtonCssStyle("buttonCssStyle"); - - tag.setHeaderKey("Header Key"); - tag.setHeaderValue("Header Value"); - - tag.doStartTag(); - tag.doEndTag(); - - //System.out.println(writer.toString()); - verify(OptionTransferSelectTagTest.class.getResource("optiontransferselect-4.txt")); - } - - public void testWithoutEmptyOptionOnBothSides() throws Exception { - List left = new ArrayList(); - left.add("Left2"); - - List right = new ArrayList(); - right.add("Right2"); - - List leftVal = new ArrayList(); - leftVal.add("Left1"); - leftVal.add("Left2"); - leftVal.add("Left3"); - - List rightVal = new ArrayList(); - rightVal.add("Right1"); - rightVal.add("Right2"); - rightVal.add("Right3"); - - - TestAction testaction = (TestAction) action; - testaction.setCollection(left); - testaction.setList2(right); - testaction.setCollection2(leftVal); - testaction.setList3(rightVal); - - - OptionTransferSelectTag tag = new OptionTransferSelectTag(); - tag.setPageContext(pageContext); - - tag.setName("collection"); - tag.setId("id"); - tag.setList("collection2"); - tag.setSize("20"); - tag.setMultiple("true"); - tag.setEmptyOption("false"); - - tag.setDoubleName("list2"); - tag.setDoubleList("list3"); - tag.setDoubleId("doubleId"); - tag.setDoubleSize("20"); - tag.setMultiple("true"); - tag.setDoubleEmptyOption("false"); - - tag.setAllowAddAllToLeft("true"); - tag.setAllowAddAllToRight("true"); - tag.setAllowAddToLeft("true"); - tag.setAllowAddToRight("true"); - tag.setAllowSelectAll("true"); - - tag.setAddAllToLeftLabel("All Left"); - tag.setAddAllToRightLabel("All Right"); - tag.setAddToLeftLabel("Left"); - tag.setAddToRightLabel("Right"); - tag.setSelectAllLabel("Select All"); - - tag.setLeftTitle("Title Left"); - tag.setRightTitle("Title Right"); - - tag.setButtonCssClass("buttonCssClass"); - tag.setButtonCssStyle("buttonCssStyle"); - - tag.setHeaderKey("Header Key"); - tag.setHeaderValue("Header Value"); - - tag.setDoubleHeaderKey("Double Header Key"); - tag.setDoubleHeaderValue("Double Header Value"); - - tag.doStartTag(); - tag.doEndTag(); - - //System.out.println(writer.toString()); - verify(OptionTransferSelectTagTest.class.getResource("optiontransferselect-5.txt")); - } - - public void testWithoutEmptyOptionOnOneSide() throws Exception { - List left = new ArrayList(); - left.add("Left2"); - - List right = new ArrayList(); - right.add("Right2"); - - List leftVal = new ArrayList(); - leftVal.add("Left1"); - leftVal.add("Left2"); - leftVal.add("Left3"); - - List rightVal = new ArrayList(); - rightVal.add("Right1"); - rightVal.add("Right2"); - rightVal.add("Right3"); - - - TestAction testaction = (TestAction) action; - testaction.setCollection(left); - testaction.setList2(right); - testaction.setCollection2(leftVal); - testaction.setList3(rightVal); - - - OptionTransferSelectTag tag = new OptionTransferSelectTag(); - tag.setPageContext(pageContext); - - tag.setName("collection"); - tag.setId("id"); - tag.setList("collection2"); - tag.setSize("20"); - tag.setMultiple("true"); - tag.setEmptyOption("true"); - - tag.setDoubleName("list2"); - tag.setDoubleList("list3"); - tag.setDoubleId("doubleId"); - tag.setDoubleSize("20"); - tag.setMultiple("true"); - tag.setDoubleEmptyOption("false"); - - tag.setAllowAddAllToLeft("true"); - tag.setAllowAddAllToRight("true"); - tag.setAllowAddToLeft("true"); - tag.setAllowAddToRight("true"); - tag.setAllowSelectAll("true"); - - tag.setAddAllToLeftLabel("All Left"); - tag.setAddAllToRightLabel("All Right"); - tag.setAddToLeftLabel("Left"); - tag.setAddToRightLabel("Right"); - tag.setSelectAllLabel("Select All"); - - tag.setLeftTitle("Title Left"); - tag.setRightTitle("Title Right"); - - tag.setButtonCssClass("buttonCssClass"); - tag.setButtonCssStyle("buttonCssStyle"); - - tag.setHeaderKey("Header Key"); - tag.setHeaderValue("Header Value"); - - tag.setDoubleHeaderKey("Double Header Key"); - tag.setDoubleHeaderValue("Double Header Value"); - - tag.doStartTag(); - tag.doEndTag(); - - //System.out.println(writer.toString()); - verify(OptionTransferSelectTagTest.class.getResource("optiontransferselect-6.txt")); - } - - public void testDisableSomeButtons() throws Exception { - List left = new ArrayList(); - left.add("Left2"); - - List right = new ArrayList(); - right.add("Right2"); - - List leftVal = new ArrayList(); - leftVal.add("Left1"); - leftVal.add("Left2"); - leftVal.add("Left3"); - - List rightVal = new ArrayList(); - rightVal.add("Right1"); - rightVal.add("Right2"); - rightVal.add("Right3"); - - - TestAction testaction = (TestAction) action; - testaction.setCollection(left); - testaction.setList2(right); - testaction.setCollection2(leftVal); - testaction.setList3(rightVal); - - - OptionTransferSelectTag tag = new OptionTransferSelectTag(); - tag.setPageContext(pageContext); - - tag.setName("collection"); - tag.setId("id"); - tag.setList("collection2"); - tag.setSize("20"); - tag.setMultiple("true"); - tag.setEmptyOption("true"); - - tag.setDoubleName("list2"); - tag.setDoubleList("list3"); - tag.setDoubleId("doubleId"); - tag.setDoubleSize("20"); - tag.setMultiple("true"); - tag.setDoubleEmptyOption("true"); - - tag.setAllowAddAllToLeft("false"); - tag.setAllowAddAllToRight("false"); - tag.setAllowAddToLeft("true"); - tag.setAllowAddToRight("true"); - tag.setAllowSelectAll("false"); - - tag.setAddAllToLeftLabel("All Left"); - tag.setAddAllToRightLabel("All Right"); - tag.setAddToLeftLabel("Left"); - tag.setAddToRightLabel("Right"); - tag.setSelectAllLabel("Select All"); - - tag.setLeftTitle("Title Left"); - tag.setRightTitle("Title Right"); - - tag.setButtonCssClass("buttonCssClass"); - tag.setButtonCssStyle("buttonCssStyle"); - - tag.setHeaderKey("Header Key"); - tag.setHeaderValue("Header Value"); - - tag.setDoubleHeaderKey("Double Header Key"); - tag.setDoubleHeaderValue("Double Header Value"); - - tag.doStartTag(); - tag.doEndTag(); - - //System.out.println(writer.toString()); - verify(OptionTransferSelectTagTest.class.getResource("optiontransferselect-7.txt")); - } + public void testWithAllSelected() throws Exception { + List left = new ArrayList(); + left.add("Left1"); + left.add("Left2"); + + List right = new ArrayList(); + right.add("Right1"); + right.add("Right2"); + + TestAction testaction = (TestAction) action; + testaction.setCollection(left); + testaction.setList2(right); + + OptionTransferSelectTag tag = new OptionTransferSelectTag(); + tag.setPageContext(pageContext); + + tag.setName("collection"); + tag.setId("id"); + tag.setList("collection"); + tag.setSize("20"); + tag.setMultiple("true"); + tag.setEmptyOption("true"); + + tag.setDoubleName("list2"); + tag.setDoubleList("list2"); + tag.setDoubleId("doubleId"); + tag.setDoubleSize("20"); + tag.setMultiple("true"); + tag.setDoubleEmptyOption("true"); + + tag.setAllowAddAllToLeft("true"); + tag.setAllowAddAllToRight("true"); + tag.setAllowAddToLeft("true"); + tag.setAllowAddToRight("true"); + tag.setAllowSelectAll("true"); + + tag.setAddAllToLeftLabel("All Left"); + tag.setAddAllToRightLabel("All Right"); + tag.setAddToLeftLabel("Left"); + tag.setAddToRightLabel("Right"); + tag.setSelectAllLabel("Select All"); + + tag.setLeftTitle("Title Left"); + tag.setRightTitle("Title Right"); + + tag.setButtonCssClass("buttonCssClass"); + tag.setButtonCssStyle("buttonCssStyle"); + + tag.setHeaderKey("Header Key"); + tag.setHeaderValue("Header Value"); + + tag.setDoubleHeaderKey("Double Header Key"); + tag.setDoubleHeaderValue("Double Header Value"); + + tag.doStartTag(); + tag.doEndTag(); + + //System.out.println(writer.toString()); + verify(OptionTransferSelectTagTest.class.getResource("optiontransferselect-1.txt")); + } + + public void testWithPartialSelectedOnBothSides() throws Exception { + List left = new ArrayList(); + left.add("Left2"); + + List right = new ArrayList(); + right.add("Right2"); + + List leftVal = new ArrayList(); + leftVal.add("Left1"); + leftVal.add("Left2"); + leftVal.add("Left3"); + + List rightVal = new ArrayList(); + rightVal.add("Right1"); + rightVal.add("Right2"); + rightVal.add("Right3"); + + + TestAction testaction = (TestAction) action; + testaction.setCollection(left); + testaction.setList2(right); + testaction.setCollection2(leftVal); + testaction.setList3(rightVal); + + + OptionTransferSelectTag tag = new OptionTransferSelectTag(); + tag.setPageContext(pageContext); + + tag.setName("collection"); + tag.setId("id"); + tag.setList("collection2"); + tag.setSize("20"); + tag.setMultiple("true"); + tag.setEmptyOption("true"); + + tag.setDoubleName("list2"); + tag.setDoubleList("list3"); + tag.setDoubleId("doubleId"); + tag.setDoubleSize("20"); + tag.setMultiple("true"); + tag.setDoubleEmptyOption("true"); + + tag.setAllowAddAllToLeft("true"); + tag.setAllowAddAllToRight("true"); + tag.setAllowAddToLeft("true"); + tag.setAllowAddToRight("true"); + tag.setAllowSelectAll("true"); + + tag.setAddAllToLeftLabel("All Left"); + tag.setAddAllToRightLabel("All Right"); + tag.setAddToLeftLabel("Left"); + tag.setAddToRightLabel("Right"); + tag.setSelectAllLabel("Select All"); + + tag.setLeftTitle("Title Left"); + tag.setRightTitle("Title Right"); + + tag.setButtonCssClass("buttonCssClass"); + tag.setButtonCssStyle("buttonCssStyle"); + + tag.setHeaderKey("Header Key"); + tag.setHeaderValue("Header Value"); + + tag.setDoubleHeaderKey("Double Header Key"); + tag.setDoubleHeaderValue("Double Header Value"); + + tag.doStartTag(); + tag.doEndTag(); + + //System.out.println(writer.toString()); + verify(OptionTransferSelectTagTest.class.getResource("optiontransferselect-2.txt")); + } + + public void testWithoutHeaderOnBothSides() throws Exception { + List left = new ArrayList(); + left.add("Left2"); + + List right = new ArrayList(); + right.add("Right2"); + + List leftVal = new ArrayList(); + leftVal.add("Left1"); + leftVal.add("Left2"); + leftVal.add("Left3"); + + List rightVal = new ArrayList(); + rightVal.add("Right1"); + rightVal.add("Right2"); + rightVal.add("Right3"); + + + TestAction testaction = (TestAction) action; + testaction.setCollection(left); + testaction.setList2(right); + testaction.setCollection2(leftVal); + testaction.setList3(rightVal); + + + OptionTransferSelectTag tag = new OptionTransferSelectTag(); + tag.setPageContext(pageContext); + + tag.setName("collection"); + tag.setId("id"); + tag.setList("collection2"); + tag.setSize("20"); + tag.setMultiple("true"); + tag.setEmptyOption("true"); + + tag.setDoubleName("list2"); + tag.setDoubleList("list3"); + tag.setDoubleId("doubleId"); + tag.setDoubleSize("20"); + tag.setMultiple("true"); + tag.setDoubleEmptyOption("true"); + + tag.setAllowAddAllToLeft("true"); + tag.setAllowAddAllToRight("true"); + tag.setAllowAddToLeft("true"); + tag.setAllowAddToRight("true"); + tag.setAllowSelectAll("true"); + + tag.setAddAllToLeftLabel("All Left"); + tag.setAddAllToRightLabel("All Right"); + tag.setAddToLeftLabel("Left"); + tag.setAddToRightLabel("Right"); + tag.setSelectAllLabel("Select All"); + + tag.setLeftTitle("Title Left"); + tag.setRightTitle("Title Right"); + + tag.setButtonCssClass("buttonCssClass"); + tag.setButtonCssStyle("buttonCssStyle"); + + tag.doStartTag(); + tag.doEndTag(); + + //System.out.println(writer.toString()); + verify(OptionTransferSelectTagTest.class.getResource("optiontransferselect-3.txt")); + } + + public void testWithoutHeaderOnOneSide() throws Exception { + List left = new ArrayList(); + left.add("Left2"); + + List right = new ArrayList(); + right.add("Right2"); + + List leftVal = new ArrayList(); + leftVal.add("Left1"); + leftVal.add("Left2"); + leftVal.add("Left3"); + + List rightVal = new ArrayList(); + rightVal.add("Right1"); + rightVal.add("Right2"); + rightVal.add("Right3"); + + + TestAction testaction = (TestAction) action; + testaction.setCollection(left); + testaction.setList2(right); + testaction.setCollection2(leftVal); + testaction.setList3(rightVal); + + + OptionTransferSelectTag tag = new OptionTransferSelectTag(); + tag.setPageContext(pageContext); + + tag.setName("collection"); + tag.setId("id"); + tag.setList("collection2"); + tag.setSize("20"); + tag.setMultiple("true"); + tag.setEmptyOption("true"); + + tag.setDoubleName("list2"); + tag.setDoubleList("list3"); + tag.setDoubleId("doubleId"); + tag.setDoubleSize("20"); + tag.setMultiple("true"); + tag.setDoubleEmptyOption("true"); + + tag.setAllowAddAllToLeft("true"); + tag.setAllowAddAllToRight("true"); + tag.setAllowAddToLeft("true"); + tag.setAllowAddToRight("true"); + tag.setAllowSelectAll("true"); + + tag.setAddAllToLeftLabel("All Left"); + tag.setAddAllToRightLabel("All Right"); + tag.setAddToLeftLabel("Left"); + tag.setAddToRightLabel("Right"); + tag.setSelectAllLabel("Select All"); + + tag.setLeftTitle("Title Left"); + tag.setRightTitle("Title Right"); + + tag.setButtonCssClass("buttonCssClass"); + tag.setButtonCssStyle("buttonCssStyle"); + + tag.setHeaderKey("Header Key"); + tag.setHeaderValue("Header Value"); + + tag.doStartTag(); + tag.doEndTag(); + + //System.out.println(writer.toString()); + verify(OptionTransferSelectTagTest.class.getResource("optiontransferselect-4.txt")); + } + + public void testWithoutEmptyOptionOnBothSides() throws Exception { + List left = new ArrayList(); + left.add("Left2"); + + List right = new ArrayList(); + right.add("Right2"); + + List leftVal = new ArrayList(); + leftVal.add("Left1"); + leftVal.add("Left2"); + leftVal.add("Left3"); + + List rightVal = new ArrayList(); + rightVal.add("Right1"); + rightVal.add("Right2"); + rightVal.add("Right3"); + + + TestAction testaction = (TestAction) action; + testaction.setCollection(left); + testaction.setList2(right); + testaction.setCollection2(leftVal); + testaction.setList3(rightVal); + + + OptionTransferSelectTag tag = new OptionTransferSelectTag(); + tag.setPageContext(pageContext); + + tag.setName("collection"); + tag.setId("id"); + tag.setList("collection2"); + tag.setSize("20"); + tag.setMultiple("true"); + tag.setEmptyOption("false"); + + tag.setDoubleName("list2"); + tag.setDoubleList("list3"); + tag.setDoubleId("doubleId"); + tag.setDoubleSize("20"); + tag.setMultiple("true"); + tag.setDoubleEmptyOption("false"); + + tag.setAllowAddAllToLeft("true"); + tag.setAllowAddAllToRight("true"); + tag.setAllowAddToLeft("true"); + tag.setAllowAddToRight("true"); + tag.setAllowSelectAll("true"); + + tag.setAddAllToLeftLabel("All Left"); + tag.setAddAllToRightLabel("All Right"); + tag.setAddToLeftLabel("Left"); + tag.setAddToRightLabel("Right"); + tag.setSelectAllLabel("Select All"); + + tag.setLeftTitle("Title Left"); + tag.setRightTitle("Title Right"); + + tag.setButtonCssClass("buttonCssClass"); + tag.setButtonCssStyle("buttonCssStyle"); + + tag.setHeaderKey("Header Key"); + tag.setHeaderValue("Header Value"); + + tag.setDoubleHeaderKey("Double Header Key"); + tag.setDoubleHeaderValue("Double Header Value"); + + tag.doStartTag(); + tag.doEndTag(); + + //System.out.println(writer.toString()); + verify(OptionTransferSelectTagTest.class.getResource("optiontransferselect-5.txt")); + } + + public void testWithoutEmptyOptionOnOneSide() throws Exception { + List left = new ArrayList(); + left.add("Left2"); + + List right = new ArrayList(); + right.add("Right2"); + + List leftVal = new ArrayList(); + leftVal.add("Left1"); + leftVal.add("Left2"); + leftVal.add("Left3"); + + List rightVal = new ArrayList(); + rightVal.add("Right1"); + rightVal.add("Right2"); + rightVal.add("Right3"); + + + TestAction testaction = (TestAction) action; + testaction.setCollection(left); + testaction.setList2(right); + testaction.setCollection2(leftVal); + testaction.setList3(rightVal); + + + OptionTransferSelectTag tag = new OptionTransferSelectTag(); + tag.setPageContext(pageContext); + + tag.setName("collection"); + tag.setId("id"); + tag.setList("collection2"); + tag.setSize("20"); + tag.setMultiple("true"); + tag.setEmptyOption("true"); + + tag.setDoubleName("list2"); + tag.setDoubleList("list3"); + tag.setDoubleId("doubleId"); + tag.setDoubleSize("20"); + tag.setMultiple("true"); + tag.setDoubleEmptyOption("false"); + + tag.setAllowAddAllToLeft("true"); + tag.setAllowAddAllToRight("true"); + tag.setAllowAddToLeft("true"); + tag.setAllowAddToRight("true"); + tag.setAllowSelectAll("true"); + + tag.setAddAllToLeftLabel("All Left"); + tag.setAddAllToRightLabel("All Right"); + tag.setAddToLeftLabel("Left"); + tag.setAddToRightLabel("Right"); + tag.setSelectAllLabel("Select All"); + + tag.setLeftTitle("Title Left"); + tag.setRightTitle("Title Right"); + + tag.setButtonCssClass("buttonCssClass"); + tag.setButtonCssStyle("buttonCssStyle"); + + tag.setHeaderKey("Header Key"); + tag.setHeaderValue("Header Value"); + + tag.setDoubleHeaderKey("Double Header Key"); + tag.setDoubleHeaderValue("Double Header Value"); + + tag.doStartTag(); + tag.doEndTag(); + + //System.out.println(writer.toString()); + verify(OptionTransferSelectTagTest.class.getResource("optiontransferselect-6.txt")); + } + + public void testDisableSomeButtons() throws Exception { + List left = new ArrayList(); + left.add("Left2"); + + List right = new ArrayList(); + right.add("Right2"); + + List leftVal = new ArrayList(); + leftVal.add("Left1"); + leftVal.add("Left2"); + leftVal.add("Left3"); + + List rightVal = new ArrayList(); + rightVal.add("Right1"); + rightVal.add("Right2"); + rightVal.add("Right3"); + + + TestAction testaction = (TestAction) action; + testaction.setCollection(left); + testaction.setList2(right); + testaction.setCollection2(leftVal); + testaction.setList3(rightVal); + + + OptionTransferSelectTag tag = new OptionTransferSelectTag(); + tag.setPageContext(pageContext); + + tag.setName("collection"); + tag.setId("id"); + tag.setList("collection2"); + tag.setSize("20"); + tag.setMultiple("true"); + tag.setEmptyOption("true"); + + tag.setDoubleName("list2"); + tag.setDoubleList("list3"); + tag.setDoubleId("doubleId"); + tag.setDoubleSize("20"); + tag.setMultiple("true"); + tag.setDoubleEmptyOption("true"); + + tag.setAllowAddAllToLeft("false"); + tag.setAllowAddAllToRight("false"); + tag.setAllowAddToLeft("true"); + tag.setAllowAddToRight("true"); + tag.setAllowSelectAll("false"); + + tag.setAddAllToLeftLabel("All Left"); + tag.setAddAllToRightLabel("All Right"); + tag.setAddToLeftLabel("Left"); + tag.setAddToRightLabel("Right"); + tag.setSelectAllLabel("Select All"); + + tag.setLeftTitle("Title Left"); + tag.setRightTitle("Title Right"); + + tag.setButtonCssClass("buttonCssClass"); + tag.setButtonCssStyle("buttonCssStyle"); + + tag.setHeaderKey("Header Key"); + tag.setHeaderValue("Header Value"); + + tag.setDoubleHeaderKey("Double Header Key"); + tag.setDoubleHeaderValue("Double Header Value"); + + tag.doStartTag(); + tag.doEndTag(); + + //System.out.println(writer.toString()); + verify(OptionTransferSelectTagTest.class.getResource("optiontransferselect-7.txt")); + } } diff --git a/core/src/test/java/org/apache/struts2/views/jsp/ui/PasswordTest.java b/core/src/test/java/org/apache/struts2/views/jsp/ui/PasswordTest.java index 66d33d3e1..dd9148c3b 100644 --- a/core/src/test/java/org/apache/struts2/views/jsp/ui/PasswordTest.java +++ b/core/src/test/java/org/apache/struts2/views/jsp/ui/PasswordTest.java @@ -1,19 +1,22 @@ /* * $Id$ * - * Copyright 2006 The Apache Software Foundation. + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at + * http://www.apache.org/licenses/LICENSE-2.0 * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. */ package org.apache.struts2.views.jsp.ui; diff --git a/core/src/test/java/org/apache/struts2/views/jsp/ui/RadioTest.java b/core/src/test/java/org/apache/struts2/views/jsp/ui/RadioTest.java index 541c8b37f..3c6cb6b4c 100644 --- a/core/src/test/java/org/apache/struts2/views/jsp/ui/RadioTest.java +++ b/core/src/test/java/org/apache/struts2/views/jsp/ui/RadioTest.java @@ -1,19 +1,22 @@ /* * $Id$ * - * Copyright 2006 The Apache Software Foundation. + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at + * http://www.apache.org/licenses/LICENSE-2.0 * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. */ package org.apache.struts2.views.jsp.ui; @@ -27,28 +30,28 @@ import org.apache.struts2.views.jsp.AbstractUITagTest; /** */ public class RadioTest extends AbstractUITagTest { - - public void testMapWithBooleanAsKey() throws Exception { - TestAction testAction = (TestAction) action; - - HashMap map = new LinkedHashMap(); - map.put(Boolean.TRUE, "male"); - map.put(Boolean.FALSE, "female"); - testAction.setMap(map); - - RadioTag tag = new RadioTag(); - tag.setPageContext(pageContext); - tag.setLabel("mylabel"); - tag.setName("myname"); - tag.setValue("%{'true'}"); - tag.setList("map"); - - tag.doStartTag(); - tag.doEndTag(); - - verify(RadioTag.class.getResource("Radio-3.txt")); - } - + + public void testMapWithBooleanAsKey() throws Exception { + TestAction testAction = (TestAction) action; + + HashMap map = new LinkedHashMap(); + map.put(Boolean.TRUE, "male"); + map.put(Boolean.FALSE, "female"); + testAction.setMap(map); + + RadioTag tag = new RadioTag(); + tag.setPageContext(pageContext); + tag.setLabel("mylabel"); + tag.setName("myname"); + tag.setValue("%{'true'}"); + tag.setList("map"); + + tag.doStartTag(); + tag.doEndTag(); + + verify(RadioTag.class.getResource("Radio-3.txt")); + } + public void testMapChecked() throws Exception { TestAction testAction = (TestAction) action; diff --git a/core/src/test/java/org/apache/struts2/views/jsp/ui/ResetTest.java b/core/src/test/java/org/apache/struts2/views/jsp/ui/ResetTest.java index df333e294..e1d8677d1 100644 --- a/core/src/test/java/org/apache/struts2/views/jsp/ui/ResetTest.java +++ b/core/src/test/java/org/apache/struts2/views/jsp/ui/ResetTest.java @@ -1,19 +1,22 @@ /* * $Id$ * - * Copyright 2006 The Apache Software Foundation. + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at + * http://www.apache.org/licenses/LICENSE-2.0 * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. */ package org.apache.struts2.views.jsp.ui; diff --git a/core/src/test/java/org/apache/struts2/views/jsp/ui/SelectTest.java b/core/src/test/java/org/apache/struts2/views/jsp/ui/SelectTest.java index 43f996579..8472c23cc 100644 --- a/core/src/test/java/org/apache/struts2/views/jsp/ui/SelectTest.java +++ b/core/src/test/java/org/apache/struts2/views/jsp/ui/SelectTest.java @@ -1,19 +1,22 @@ /* * $Id$ * - * Copyright 2006 The Apache Software Foundation. + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at + * http://www.apache.org/licenses/LICENSE-2.0 * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. */ package org.apache.struts2.views.jsp.ui; @@ -29,23 +32,23 @@ import org.apache.struts2.views.jsp.AbstractUITagTest; /** */ public class SelectTest extends AbstractUITagTest { - - - public void testHeaderCanBePreselected() throws Exception { - SelectTag tag = new SelectTag(); - tag.setPageContext(pageContext); - tag.setLabel("myLabel"); - tag.setList("#{1:'Cat',2:'Dog'}"); - tag.setName("myPet"); - tag.setHeaderKey("-1"); - tag.setHeaderValue("--- Please Select ---"); - tag.setValue("%{'-1'}"); - - tag.doStartTag(); - tag.doEndTag(); - - verify(SelectTag.class.getResource("Select-8.txt")); - } + + + public void testHeaderCanBePreselected() throws Exception { + SelectTag tag = new SelectTag(); + tag.setPageContext(pageContext); + tag.setLabel("myLabel"); + tag.setList("#{1:'Cat',2:'Dog'}"); + tag.setName("myPet"); + tag.setHeaderKey("-1"); + tag.setHeaderValue("--- Please Select ---"); + tag.setValue("%{'-1'}"); + + tag.doStartTag(); + tag.doEndTag(); + + verify(SelectTag.class.getResource("Select-8.txt")); + } /** * Tests WW-455: Select tag template does not work properly for Object like BigDecimal. @@ -106,44 +109,44 @@ public class SelectTest extends AbstractUITagTest { return bigDecimal; } } - + public void testNullList() throws Exception { - TestAction testAction = (TestAction) action; - testAction.setList2(null); - - SelectTag tag = new SelectTag(); - tag.setName("collection"); - tag.setList("list2"); - tag.setLabel("tmjee_name"); - - tag.setPageContext(pageContext); - try { - tag.doStartTag(); - tag.doEndTag(); - fail("exception should have been thrown value of select tag is null"); - } - catch(Exception e) { - assertTrue(true); - } + TestAction testAction = (TestAction) action; + testAction.setList2(null); + + SelectTag tag = new SelectTag(); + tag.setName("collection"); + tag.setList("list2"); + tag.setLabel("tmjee_name"); + + tag.setPageContext(pageContext); + try { + tag.doStartTag(); + tag.doEndTag(); + fail("exception should have been thrown value of select tag is null"); + } + catch(Exception e) { + assertTrue(true); + } } - + public void testEmptyList() throws Exception { - TestAction testAction = (TestAction) action; - testAction.setList2(new ArrayList()); - - SelectTag tag = new SelectTag(); - tag.setName("collection"); - tag.setList("list2"); - tag.setLabel("tmjee_name"); - - tag.setPageContext(pageContext); - tag.doStartTag(); - tag.doEndTag(); - - verify(SelectTag.class.getResource("Select-4.txt")); + TestAction testAction = (TestAction) action; + testAction.setList2(new ArrayList()); + + SelectTag tag = new SelectTag(); + tag.setName("collection"); + tag.setList("list2"); + tag.setLabel("tmjee_name"); + + tag.setPageContext(pageContext); + tag.doStartTag(); + tag.doEndTag(); + + verify(SelectTag.class.getResource("Select-4.txt")); } - + public void testMultiple() throws Exception { TestAction testAction = (TestAction) action; Collection collection = new ArrayList(2); @@ -253,37 +256,37 @@ public class SelectTest extends AbstractUITagTest { prepareTagGeneric(tag); verifyGenericProperties(tag, "ajax", new String[]{"value"}); } - + public void testMultipleOn() throws Exception { - SelectTag tag = new SelectTag(); - tag.setPageContext(pageContext); - tag.setLabel("media1"); - tag.setId("myId"); - tag.setEmptyOption("true"); - tag.setName("myName"); - tag.setMultiple("true"); - tag.setList("{'aaa','bbb'}"); - - tag.doStartTag(); - tag.doEndTag(); - - verify(SelectTag.class.getResource("Select-5.txt")); + SelectTag tag = new SelectTag(); + tag.setPageContext(pageContext); + tag.setLabel("media1"); + tag.setId("myId"); + tag.setEmptyOption("true"); + tag.setName("myName"); + tag.setMultiple("true"); + tag.setList("{'aaa','bbb'}"); + + tag.doStartTag(); + tag.doEndTag(); + + verify(SelectTag.class.getResource("Select-5.txt")); } - + public void testMultipleOff() throws Exception { - SelectTag tag = new SelectTag(); - tag.setPageContext(pageContext); - tag.setLabel("media2"); - tag.setId("myId"); - tag.setEmptyOption("true"); - tag.setName("myName"); - tag.setMultiple("false"); - tag.setList("{'aaa','bbb'}"); - - tag.doStartTag(); - tag.doEndTag(); - - verify(SelectTag.class.getResource("Select-6.txt")); + SelectTag tag = new SelectTag(); + tag.setPageContext(pageContext); + tag.setLabel("media2"); + tag.setId("myId"); + tag.setEmptyOption("true"); + tag.setName("myName"); + tag.setMultiple("false"); + tag.setList("{'aaa','bbb'}"); + + tag.doStartTag(); + tag.doEndTag(); + + verify(SelectTag.class.getResource("Select-6.txt")); } private void prepareTagGeneric(SelectTag tag) { @@ -297,5 +300,5 @@ public class SelectTest extends AbstractUITagTest { tag.setList("collection"); } - + } diff --git a/core/src/test/java/org/apache/struts2/views/jsp/ui/StrutsBodyContent.java b/core/src/test/java/org/apache/struts2/views/jsp/ui/StrutsBodyContent.java index 6a9968fa4..1591e6498 100644 --- a/core/src/test/java/org/apache/struts2/views/jsp/ui/StrutsBodyContent.java +++ b/core/src/test/java/org/apache/struts2/views/jsp/ui/StrutsBodyContent.java @@ -1,19 +1,22 @@ /* * $Id$ * - * Copyright 2006 The Apache Software Foundation. + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at + * http://www.apache.org/licenses/LICENSE-2.0 * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. */ package org.apache.struts2.views.jsp.ui; diff --git a/core/src/test/java/org/apache/struts2/views/jsp/ui/SubmitAjaxTest.java b/core/src/test/java/org/apache/struts2/views/jsp/ui/SubmitAjaxTest.java index 91d1e2f45..7cde10ff4 100644 --- a/core/src/test/java/org/apache/struts2/views/jsp/ui/SubmitAjaxTest.java +++ b/core/src/test/java/org/apache/struts2/views/jsp/ui/SubmitAjaxTest.java @@ -1,19 +1,22 @@ /* * $Id$ * - * Copyright 2006 The Apache Software Foundation. + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at + * http://www.apache.org/licenses/LICENSE-2.0 * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. */ package org.apache.struts2.views.jsp.ui; @@ -23,8 +26,8 @@ import org.apache.struts2.views.jsp.AbstractUITagTest; * Test Submit component in "ajax" theme. */ public class SubmitAjaxTest extends AbstractUITagTest { - - public void testSimple() throws Exception { + + public void testSimple() throws Exception { SubmitTag tag = new SubmitTag(); tag.setPageContext(pageContext); diff --git a/core/src/test/java/org/apache/struts2/views/jsp/ui/SubmitTest.java b/core/src/test/java/org/apache/struts2/views/jsp/ui/SubmitTest.java index 9f32765f1..aac9fb967 100644 --- a/core/src/test/java/org/apache/struts2/views/jsp/ui/SubmitTest.java +++ b/core/src/test/java/org/apache/struts2/views/jsp/ui/SubmitTest.java @@ -1,19 +1,22 @@ /* * $Id$ * - * Copyright 2006 The Apache Software Foundation. + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at + * http://www.apache.org/licenses/LICENSE-2.0 * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. */ package org.apache.struts2.views.jsp.ui; diff --git a/core/src/test/java/org/apache/struts2/views/jsp/ui/TestAction1.java b/core/src/test/java/org/apache/struts2/views/jsp/ui/TestAction1.java index 7ebcacbb4..8d3d1ebb4 100644 --- a/core/src/test/java/org/apache/struts2/views/jsp/ui/TestAction1.java +++ b/core/src/test/java/org/apache/struts2/views/jsp/ui/TestAction1.java @@ -1,19 +1,22 @@ /* * $Id$ * - * Copyright 2006 The Apache Software Foundation. + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at + * http://www.apache.org/licenses/LICENSE-2.0 * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. */ package org.apache.struts2.views.jsp.ui; @@ -25,5 +28,5 @@ import com.opensymphony.xwork2.ActionSupport; */ public class TestAction1 extends ActionSupport { - private static final long serialVersionUID = 2545551979978561327L; + private static final long serialVersionUID = 2545551979978561327L; } diff --git a/core/src/test/java/org/apache/struts2/views/jsp/ui/TextareaTest.java b/core/src/test/java/org/apache/struts2/views/jsp/ui/TextareaTest.java index df79971fb..64bde301f 100644 --- a/core/src/test/java/org/apache/struts2/views/jsp/ui/TextareaTest.java +++ b/core/src/test/java/org/apache/struts2/views/jsp/ui/TextareaTest.java @@ -1,19 +1,22 @@ /* * $Id$ * - * Copyright 2006 The Apache Software Foundation. + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at + * http://www.apache.org/licenses/LICENSE-2.0 * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. */ package org.apache.struts2.views.jsp.ui; diff --git a/core/src/test/java/org/apache/struts2/views/jsp/ui/TextfieldTest.java b/core/src/test/java/org/apache/struts2/views/jsp/ui/TextfieldTest.java index 5796b1e36..ade694751 100644 --- a/core/src/test/java/org/apache/struts2/views/jsp/ui/TextfieldTest.java +++ b/core/src/test/java/org/apache/struts2/views/jsp/ui/TextfieldTest.java @@ -1,19 +1,22 @@ /* * $Id$ * - * Copyright 2006 The Apache Software Foundation. + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at + * http://www.apache.org/licenses/LICENSE-2.0 * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. */ package org.apache.struts2.views.jsp.ui; diff --git a/core/src/test/java/org/apache/struts2/views/jsp/ui/TokenTagTest.java b/core/src/test/java/org/apache/struts2/views/jsp/ui/TokenTagTest.java index 500519e6e..eec986767 100644 --- a/core/src/test/java/org/apache/struts2/views/jsp/ui/TokenTagTest.java +++ b/core/src/test/java/org/apache/struts2/views/jsp/ui/TokenTagTest.java @@ -1,19 +1,22 @@ /* * $Id$ * - * Copyright 2006 The Apache Software Foundation. + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at + * http://www.apache.org/licenses/LICENSE-2.0 * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. */ package org.apache.struts2.views.jsp.ui; diff --git a/core/src/test/java/org/apache/struts2/views/jsp/ui/TooltipTest.java b/core/src/test/java/org/apache/struts2/views/jsp/ui/TooltipTest.java index 0e1b9fff1..f51496bf5 100644 --- a/core/src/test/java/org/apache/struts2/views/jsp/ui/TooltipTest.java +++ b/core/src/test/java/org/apache/struts2/views/jsp/ui/TooltipTest.java @@ -1,19 +1,22 @@ /* * $Id$ * - * Copyright 2006 The Apache Software Foundation. + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at + * http://www.apache.org/licenses/LICENSE-2.0 * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. */ package org.apache.struts2.views.jsp.ui; @@ -78,7 +81,7 @@ public class TooltipTest extends AbstractUITagTest { formTag.setAction("testAction"); formTag.setTooltipConfig( - "#{" + + "#{" + "'tooltipIcon':'/struts/tooltip/myTooltip.gif', " + "'tooltipDelay':'500', " + "'jsTooltipEnabled':'true' "+ @@ -113,7 +116,7 @@ public class TooltipTest extends AbstractUITagTest { formTag.setAction("testAction"); formTag.setTooltipConfig( - "#{" + + "#{" + "'tooltipIcon':'/struts/tooltip/myTooltip.gif', " + "'tooltipDelay':'500', " + "'jsTooltipEnabled':'true' "+ @@ -128,7 +131,7 @@ public class TooltipTest extends AbstractUITagTest { tag.setTooltip("myTooltip"); tag.setTooltipConfig( - "#{" + + "#{" + "'tooltipIcon':'/struts/tooltip/myTooltip2.gif', " + "'tooltipDelay':'5000' " + "}" @@ -158,7 +161,7 @@ public class TooltipTest extends AbstractUITagTest { formParamTag.setPageContext(pageContext); formParamTag.setName("tooltipConfig"); formParamTag.setValue( - "#{" + + "#{" + "'tooltipIcon':'/struts/tooltip/myTooltip.gif', " + "'tooltipDelay':'500', " + "'jsTooltipEnabled':'true' "+ @@ -176,7 +179,7 @@ public class TooltipTest extends AbstractUITagTest { textFieldParamTag.setPageContext(pageContext); textFieldParamTag.setName("tooltipConfig"); textFieldParamTag.setValue( - "#{" + + "#{" + "'tooltipIcon':'/struts/tooltip/myTooltip2.gif', " + "'tooltipDelay':'5000' "+ "}" @@ -242,7 +245,7 @@ public class TooltipTest extends AbstractUITagTest { textFieldParamTag.doEndTag(); tag.doEndTag(); formTag.doEndTag(); - + System.out.println(writer.toString()); verify(TooltipTest.class.getResource("tooltip-3.txt")); diff --git a/core/src/test/java/org/apache/struts2/views/jsp/ui/TreeTest.java b/core/src/test/java/org/apache/struts2/views/jsp/ui/TreeTest.java index e1563b11b..5a95337ac 100644 --- a/core/src/test/java/org/apache/struts2/views/jsp/ui/TreeTest.java +++ b/core/src/test/java/org/apache/struts2/views/jsp/ui/TreeTest.java @@ -1,19 +1,22 @@ /* * $Id$ * - * Copyright 2006 The Apache Software Foundation. + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at + * http://www.apache.org/licenses/LICENSE-2.0 * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. */ package org.apache.struts2.views.jsp.ui; @@ -26,108 +29,108 @@ import com.opensymphony.xwork2.ActionSupport; * Test case for Tree component. */ public class TreeTest extends AbstractUITagTest{ - - public void testStaticTree() throws Exception { - // Root - TreeTag tag = new TreeTag(); - tag.setShowRootGrid("false"); - tag.setShowGrid("false"); - tag.setTemplateCssPath("/struts/tree.css"); - tag.setTheme("ajax"); - tag.setPageContext(pageContext); - tag.setId("rootId"); - tag.setLabel("Root"); - tag.doStartTag(); - - // Child 1 - TreeNodeTag nodeTag1 = new TreeNodeTag(); - nodeTag1.setTheme("ajax"); - nodeTag1.setPageContext(pageContext); - nodeTag1.setId("child1"); - nodeTag1.setLabel("Child 1"); - nodeTag1.doStartTag(); - nodeTag1.doEndTag(); - - // Child 2 - TreeNodeTag nodeTag2 = new TreeNodeTag(); - nodeTag2.setTheme("ajax"); - nodeTag2.setPageContext(pageContext); - nodeTag2.setId("child2"); - nodeTag2.setLabel("Child 2"); - nodeTag2.doStartTag(); - - // Grand Child 1 - TreeNodeTag gNodeTag1 = new TreeNodeTag(); - gNodeTag1.setTheme("ajax"); - gNodeTag1.setPageContext(pageContext); - gNodeTag1.setId("gChild1"); - gNodeTag1.setLabel("Grand Child 1"); - gNodeTag1.doStartTag(); - gNodeTag1.doEndTag(); - - // Grand Child 2 - TreeNodeTag gNodeTag2 = new TreeNodeTag(); - gNodeTag2.setTheme("ajax"); - gNodeTag2.setPageContext(pageContext); - gNodeTag2.setId("gChild2"); - gNodeTag2.setLabel("Grand Child 2"); - gNodeTag2.doStartTag(); - gNodeTag2.doEndTag(); - - // Grand Child 3 - TreeNodeTag gNodeTag3= new TreeNodeTag(); - gNodeTag3.setTheme("ajax"); - gNodeTag3.setPageContext(pageContext); - gNodeTag3.setId("gChild3"); - gNodeTag3.setLabel("Grand Child 3"); - gNodeTag3.doStartTag(); - gNodeTag3.doEndTag(); - - nodeTag2.doEndTag(); - - - // Child 3 - TreeNodeTag nodeTag3 = new TreeNodeTag(); - nodeTag3.setTheme("ajax"); - nodeTag3.setPageContext(pageContext); - nodeTag3.setId("child3"); - nodeTag3.setLabel("Child 4"); - nodeTag3.doStartTag(); - nodeTag3.doEndTag(); - - tag.doEndTag(); - - //System.out.println(writer.toString()); - verify(TreeTest.class.getResource("tree-1.txt")); - } - - - - public void testDynamicTree() throws Exception { - - TreeTag tag = new TreeTag(); - tag.setPageContext(pageContext); - tag.setTheme("ajax"); - tag.setId("myTree"); - tag.setRootNode("%{myTreeRoot}"); - tag.setNodeIdProperty("id"); - tag.setNodeTitleProperty("name"); - tag.setChildCollectionProperty("children"); - tag.doStartTag(); - tag.doEndTag(); - - //System.out.println(writer.toString()); - verify(TreeTest.class.getResource("tree-2.txt")); - } - - - public Action getAction() { - return new InternalActionSupport(); - } - - public static class InternalActionSupport extends ActionSupport { - public Category getMyTreeRoot() { - return Category.getById(1); - } - } + + public void testStaticTree() throws Exception { + // Root + TreeTag tag = new TreeTag(); + tag.setShowRootGrid("false"); + tag.setShowGrid("false"); + tag.setTemplateCssPath("/struts/tree.css"); + tag.setTheme("ajax"); + tag.setPageContext(pageContext); + tag.setId("rootId"); + tag.setLabel("Root"); + tag.doStartTag(); + + // Child 1 + TreeNodeTag nodeTag1 = new TreeNodeTag(); + nodeTag1.setTheme("ajax"); + nodeTag1.setPageContext(pageContext); + nodeTag1.setId("child1"); + nodeTag1.setLabel("Child 1"); + nodeTag1.doStartTag(); + nodeTag1.doEndTag(); + + // Child 2 + TreeNodeTag nodeTag2 = new TreeNodeTag(); + nodeTag2.setTheme("ajax"); + nodeTag2.setPageContext(pageContext); + nodeTag2.setId("child2"); + nodeTag2.setLabel("Child 2"); + nodeTag2.doStartTag(); + + // Grand Child 1 + TreeNodeTag gNodeTag1 = new TreeNodeTag(); + gNodeTag1.setTheme("ajax"); + gNodeTag1.setPageContext(pageContext); + gNodeTag1.setId("gChild1"); + gNodeTag1.setLabel("Grand Child 1"); + gNodeTag1.doStartTag(); + gNodeTag1.doEndTag(); + + // Grand Child 2 + TreeNodeTag gNodeTag2 = new TreeNodeTag(); + gNodeTag2.setTheme("ajax"); + gNodeTag2.setPageContext(pageContext); + gNodeTag2.setId("gChild2"); + gNodeTag2.setLabel("Grand Child 2"); + gNodeTag2.doStartTag(); + gNodeTag2.doEndTag(); + + // Grand Child 3 + TreeNodeTag gNodeTag3= new TreeNodeTag(); + gNodeTag3.setTheme("ajax"); + gNodeTag3.setPageContext(pageContext); + gNodeTag3.setId("gChild3"); + gNodeTag3.setLabel("Grand Child 3"); + gNodeTag3.doStartTag(); + gNodeTag3.doEndTag(); + + nodeTag2.doEndTag(); + + + // Child 3 + TreeNodeTag nodeTag3 = new TreeNodeTag(); + nodeTag3.setTheme("ajax"); + nodeTag3.setPageContext(pageContext); + nodeTag3.setId("child3"); + nodeTag3.setLabel("Child 4"); + nodeTag3.doStartTag(); + nodeTag3.doEndTag(); + + tag.doEndTag(); + + //System.out.println(writer.toString()); + verify(TreeTest.class.getResource("tree-1.txt")); + } + + + + public void testDynamicTree() throws Exception { + + TreeTag tag = new TreeTag(); + tag.setPageContext(pageContext); + tag.setTheme("ajax"); + tag.setId("myTree"); + tag.setRootNode("%{myTreeRoot}"); + tag.setNodeIdProperty("id"); + tag.setNodeTitleProperty("name"); + tag.setChildCollectionProperty("children"); + tag.doStartTag(); + tag.doEndTag(); + + //System.out.println(writer.toString()); + verify(TreeTest.class.getResource("tree-2.txt")); + } + + + public Action getAction() { + return new InternalActionSupport(); + } + + public static class InternalActionSupport extends ActionSupport { + public Category getMyTreeRoot() { + return Category.getById(1); + } + } } diff --git a/core/src/test/java/org/apache/struts2/views/jsp/ui/UpDownSelectTagTest.java b/core/src/test/java/org/apache/struts2/views/jsp/ui/UpDownSelectTagTest.java index b3cad78c0..c6934941e 100644 --- a/core/src/test/java/org/apache/struts2/views/jsp/ui/UpDownSelectTagTest.java +++ b/core/src/test/java/org/apache/struts2/views/jsp/ui/UpDownSelectTagTest.java @@ -1,19 +1,22 @@ /* * $Id$ * - * Copyright 2006 The Apache Software Foundation. + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at + * http://www.apache.org/licenses/LICENSE-2.0 * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. */ package org.apache.struts2.views.jsp.ui; @@ -28,193 +31,193 @@ import com.opensymphony.xwork2.Action; import com.opensymphony.xwork2.ActionSupport; /** - * Test case for UpDownSelectTag - * + * Test case for UpDownSelectTag + * */ public class UpDownSelectTagTest extends AbstractUITagTest { - public void testWithAllSelected() throws Exception { - - UpDownSelectTag tag = new UpDownSelectTag(); - tag.setPageContext(pageContext); - tag.setId("myId"); - tag.setName("myName"); - tag.setList("myMap"); - tag.setValue("myAllSelectedMapIds"); - tag.setEmptyOption("true"); - - tag.doStartTag(); - tag.doEndTag(); - - verify(UpDownSelectTagTest.class.getResource("updownselecttag-1.txt")); - } - - public void testWithPartialSelected() throws Exception { - - UpDownSelectTag tag = new UpDownSelectTag(); - tag.setPageContext(pageContext); - tag.setId("myId"); - tag.setName("myName"); - tag.setList("myMap"); - tag.setValue("mySelectedMapIds"); - tag.setEmptyOption("false"); - - tag.doStartTag(); - tag.doEndTag(); - - verify(UpDownSelectTagTest.class.getResource("updownselecttag-2.txt")); - } - - public void testWithHeaderAndEmptyOption() throws Exception { - - UpDownSelectTag tag = new UpDownSelectTag(); - tag.setPageContext(pageContext); - tag.setId("myId"); - tag.setName("myName"); - tag.setList("myMap"); - tag.setValue("mySelectedMapIds"); - tag.setEmptyOption("true"); - tag.setHeaderKey("-1"); - tag.setHeaderValue("--- Please Order ---"); - - tag.doStartTag(); - tag.doEndTag(); - - verify(UpDownSelectTagTest.class.getResource("updownselecttag-3.txt")); - } - - public void testWithHeaderOnly() throws Exception { - - UpDownSelectTag tag = new UpDownSelectTag(); - tag.setPageContext(pageContext); - tag.setId("myId"); - tag.setName("myName"); - tag.setList("myMap"); - tag.setValue("mySelectedMapIds"); - tag.setEmptyOption("false"); - tag.setHeaderKey("-1"); - tag.setHeaderValue("--- Please Order ---"); - - tag.doStartTag(); - tag.doEndTag(); - - verify(UpDownSelectTagTest.class.getResource("updownselecttag-4.txt")); - } - - public void testWithEmptyOptionOnly() throws Exception { - - UpDownSelectTag tag = new UpDownSelectTag(); - tag.setPageContext(pageContext); - tag.setId("myId"); - tag.setName("myName"); - tag.setList("myMap"); - tag.setValue("mySelectedMapIds"); - tag.setEmptyOption("true"); - - tag.doStartTag(); - tag.doEndTag(); - - verify(UpDownSelectTagTest.class.getResource("updownselecttag-5.txt")); - } - - - public void testDisableSomeSelectAllButton() throws Exception { - - UpDownSelectTag tag = new UpDownSelectTag(); - tag.setPageContext(pageContext); - tag.setId("myId"); - tag.setName("myName"); - tag.setList("myMap"); - tag.setValue("mySelectedMapIds"); - tag.setEmptyOption("true"); - tag.setAllowSelectAll("false"); - - tag.doStartTag(); - tag.doEndTag(); - - verify(UpDownSelectTagTest.class.getResource("updownselecttag-6.txt")); - } - - public void testDisableMoveUpButton() throws Exception { - UpDownSelectTag tag = new UpDownSelectTag(); - tag.setPageContext(pageContext); - tag.setId("myId"); - tag.setName("myName"); - tag.setList("myMap"); - tag.setValue("mySelectedMapIds"); - tag.setEmptyOption("true"); - tag.setAllowMoveUp("false"); - - tag.doStartTag(); - tag.doEndTag(); - - verify(UpDownSelectTagTest.class.getResource("updownselecttag-7.txt")); - } - - public void testDisableMoveDownButton() throws Exception { - UpDownSelectTag tag = new UpDownSelectTag(); - tag.setPageContext(pageContext); - tag.setId("myId"); - tag.setName("myName"); - tag.setList("myMap"); - tag.setValue("mySelectedMapIds"); - tag.setEmptyOption("true"); - tag.setAllowMoveDown("false"); - - tag.doStartTag(); - tag.doEndTag(); - - verify(UpDownSelectTagTest.class.getResource("updownselecttag-8.txt")); - } - - public void testChangeSelectAllButtonText() throws Exception { - UpDownSelectTag tag = new UpDownSelectTag(); - tag.setPageContext(pageContext); - tag.setId("myId"); - tag.setName("myName"); - tag.setList("myMap"); - tag.setValue("mySelectedMapIds"); - tag.setEmptyOption("true"); - tag.setSelectAllLabel("Select All"); - - tag.doStartTag(); - tag.doEndTag(); - - verify(UpDownSelectTagTest.class.getResource("updownselecttag-9.txt")); - } - - public void testChangeMoveUpButtonText() throws Exception { - UpDownSelectTag tag = new UpDownSelectTag(); - tag.setPageContext(pageContext); - tag.setId("myId"); - tag.setName("myName"); - tag.setList("myMap"); - tag.setValue("mySelectedMapIds"); - tag.setEmptyOption("true"); - tag.setMoveUpLabel("Move Up"); - - tag.doStartTag(); - tag.doEndTag(); - - verify(UpDownSelectTagTest.class.getResource("updownselecttag-10.txt")); - } - - public void testChangeMoveDownButtonText() throws Exception { - UpDownSelectTag tag = new UpDownSelectTag(); - tag.setPageContext(pageContext); - tag.setId("myId"); - tag.setName("myName"); - tag.setList("myMap"); - tag.setValue("mySelectedMapIds"); - tag.setEmptyOption("true"); - tag.setMoveDownLabel("Move Down"); - - tag.doStartTag(); - tag.doEndTag(); - - verify(UpDownSelectTagTest.class.getResource("updownselecttag-11.txt")); - } - + public void testWithAllSelected() throws Exception { + + UpDownSelectTag tag = new UpDownSelectTag(); + tag.setPageContext(pageContext); + tag.setId("myId"); + tag.setName("myName"); + tag.setList("myMap"); + tag.setValue("myAllSelectedMapIds"); + tag.setEmptyOption("true"); + + tag.doStartTag(); + tag.doEndTag(); + + verify(UpDownSelectTagTest.class.getResource("updownselecttag-1.txt")); + } + + public void testWithPartialSelected() throws Exception { + + UpDownSelectTag tag = new UpDownSelectTag(); + tag.setPageContext(pageContext); + tag.setId("myId"); + tag.setName("myName"); + tag.setList("myMap"); + tag.setValue("mySelectedMapIds"); + tag.setEmptyOption("false"); + + tag.doStartTag(); + tag.doEndTag(); + + verify(UpDownSelectTagTest.class.getResource("updownselecttag-2.txt")); + } + + public void testWithHeaderAndEmptyOption() throws Exception { + + UpDownSelectTag tag = new UpDownSelectTag(); + tag.setPageContext(pageContext); + tag.setId("myId"); + tag.setName("myName"); + tag.setList("myMap"); + tag.setValue("mySelectedMapIds"); + tag.setEmptyOption("true"); + tag.setHeaderKey("-1"); + tag.setHeaderValue("--- Please Order ---"); + + tag.doStartTag(); + tag.doEndTag(); + + verify(UpDownSelectTagTest.class.getResource("updownselecttag-3.txt")); + } + + public void testWithHeaderOnly() throws Exception { + + UpDownSelectTag tag = new UpDownSelectTag(); + tag.setPageContext(pageContext); + tag.setId("myId"); + tag.setName("myName"); + tag.setList("myMap"); + tag.setValue("mySelectedMapIds"); + tag.setEmptyOption("false"); + tag.setHeaderKey("-1"); + tag.setHeaderValue("--- Please Order ---"); + + tag.doStartTag(); + tag.doEndTag(); + + verify(UpDownSelectTagTest.class.getResource("updownselecttag-4.txt")); + } + + public void testWithEmptyOptionOnly() throws Exception { + + UpDownSelectTag tag = new UpDownSelectTag(); + tag.setPageContext(pageContext); + tag.setId("myId"); + tag.setName("myName"); + tag.setList("myMap"); + tag.setValue("mySelectedMapIds"); + tag.setEmptyOption("true"); + + tag.doStartTag(); + tag.doEndTag(); + + verify(UpDownSelectTagTest.class.getResource("updownselecttag-5.txt")); + } + + + public void testDisableSomeSelectAllButton() throws Exception { + + UpDownSelectTag tag = new UpDownSelectTag(); + tag.setPageContext(pageContext); + tag.setId("myId"); + tag.setName("myName"); + tag.setList("myMap"); + tag.setValue("mySelectedMapIds"); + tag.setEmptyOption("true"); + tag.setAllowSelectAll("false"); + + tag.doStartTag(); + tag.doEndTag(); + + verify(UpDownSelectTagTest.class.getResource("updownselecttag-6.txt")); + } + + public void testDisableMoveUpButton() throws Exception { + UpDownSelectTag tag = new UpDownSelectTag(); + tag.setPageContext(pageContext); + tag.setId("myId"); + tag.setName("myName"); + tag.setList("myMap"); + tag.setValue("mySelectedMapIds"); + tag.setEmptyOption("true"); + tag.setAllowMoveUp("false"); + + tag.doStartTag(); + tag.doEndTag(); + + verify(UpDownSelectTagTest.class.getResource("updownselecttag-7.txt")); + } + + public void testDisableMoveDownButton() throws Exception { + UpDownSelectTag tag = new UpDownSelectTag(); + tag.setPageContext(pageContext); + tag.setId("myId"); + tag.setName("myName"); + tag.setList("myMap"); + tag.setValue("mySelectedMapIds"); + tag.setEmptyOption("true"); + tag.setAllowMoveDown("false"); + + tag.doStartTag(); + tag.doEndTag(); + + verify(UpDownSelectTagTest.class.getResource("updownselecttag-8.txt")); + } + + public void testChangeSelectAllButtonText() throws Exception { + UpDownSelectTag tag = new UpDownSelectTag(); + tag.setPageContext(pageContext); + tag.setId("myId"); + tag.setName("myName"); + tag.setList("myMap"); + tag.setValue("mySelectedMapIds"); + tag.setEmptyOption("true"); + tag.setSelectAllLabel("Select All"); + + tag.doStartTag(); + tag.doEndTag(); + + verify(UpDownSelectTagTest.class.getResource("updownselecttag-9.txt")); + } + + public void testChangeMoveUpButtonText() throws Exception { + UpDownSelectTag tag = new UpDownSelectTag(); + tag.setPageContext(pageContext); + tag.setId("myId"); + tag.setName("myName"); + tag.setList("myMap"); + tag.setValue("mySelectedMapIds"); + tag.setEmptyOption("true"); + tag.setMoveUpLabel("Move Up"); + + tag.doStartTag(); + tag.doEndTag(); + + verify(UpDownSelectTagTest.class.getResource("updownselecttag-10.txt")); + } + + public void testChangeMoveDownButtonText() throws Exception { + UpDownSelectTag tag = new UpDownSelectTag(); + tag.setPageContext(pageContext); + tag.setId("myId"); + tag.setName("myName"); + tag.setList("myMap"); + tag.setValue("mySelectedMapIds"); + tag.setEmptyOption("true"); + tag.setMoveDownLabel("Move Down"); + + tag.doStartTag(); + tag.doEndTag(); + + verify(UpDownSelectTagTest.class.getResource("updownselecttag-11.txt")); + } + public void testGenericSimple() throws Exception { UpDownSelectTag tag = new UpDownSelectTag(); prepareTagGeneric(tag); @@ -238,35 +241,35 @@ public class UpDownSelectTagTest extends AbstractUITagTest { } - - // =============================== - public Action getAction() { - return new ActionSupport() { - - public Map getMyMap() { - Map _myMap = new LinkedHashMap(); - _myMap.put("england", "England"); - _myMap.put("america", "America"); - _myMap.put("australia", "Australia"); - _myMap.put("germany", "Germany"); - return _myMap; - } - - public List getMySelectedMapIds() { - List _mySelectedMapIds = new ArrayList(); - _mySelectedMapIds.add("america"); - _mySelectedMapIds.add("germany"); - return _mySelectedMapIds; - } - - public List getMyAllSelectedMapIds() { - List _mySelectedMapIds = new ArrayList(); - _mySelectedMapIds.add("england"); - _mySelectedMapIds.add("america"); - _mySelectedMapIds.add("australia"); - _mySelectedMapIds.add("germany"); - return _mySelectedMapIds; - } - }; - } + + // =============================== + public Action getAction() { + return new ActionSupport() { + + public Map getMyMap() { + Map _myMap = new LinkedHashMap(); + _myMap.put("england", "England"); + _myMap.put("america", "America"); + _myMap.put("australia", "Australia"); + _myMap.put("germany", "Germany"); + return _myMap; + } + + public List getMySelectedMapIds() { + List _mySelectedMapIds = new ArrayList(); + _mySelectedMapIds.add("america"); + _mySelectedMapIds.add("germany"); + return _mySelectedMapIds; + } + + public List getMyAllSelectedMapIds() { + List _mySelectedMapIds = new ArrayList(); + _mySelectedMapIds.add("england"); + _mySelectedMapIds.add("america"); + _mySelectedMapIds.add("australia"); + _mySelectedMapIds.add("germany"); + return _mySelectedMapIds; + } + }; + } } diff --git a/core/src/test/java/org/apache/struts2/views/jsp/ui/User.java b/core/src/test/java/org/apache/struts2/views/jsp/ui/User.java index 2f5d2fa32..3a07fec39 100644 --- a/core/src/test/java/org/apache/struts2/views/jsp/ui/User.java +++ b/core/src/test/java/org/apache/struts2/views/jsp/ui/User.java @@ -1,19 +1,22 @@ /* * $Id$ * - * Copyright 2006 The Apache Software Foundation. + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at + * http://www.apache.org/licenses/LICENSE-2.0 * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. */ package org.apache.struts2.views.jsp.ui; diff --git a/core/src/test/java/org/apache/struts2/views/util/ContextUtilTest.java b/core/src/test/java/org/apache/struts2/views/util/ContextUtilTest.java index 1bdab60ef..8a4a84033 100755 --- a/core/src/test/java/org/apache/struts2/views/util/ContextUtilTest.java +++ b/core/src/test/java/org/apache/struts2/views/util/ContextUtilTest.java @@ -1,19 +1,22 @@ /* * $Id$ * - * Copyright 2006 The Apache Software Foundation. + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at + * http://www.apache.org/licenses/LICENSE-2.0 * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. */ package org.apache.struts2.views.util; @@ -27,105 +30,105 @@ import com.opensymphony.xwork2.util.ValueStackFactory; /** * Test case for ContextUtil - * + * */ public class ContextUtilTest extends TestCase { public void testAltSyntaxMethod1() throws Exception { ValueStack stack = ValueStackFactory.getFactory().createValueStack(); stack.getContext().put("useAltSyntax", "true"); - + Settings.reset(); Settings.set(StrutsConstants.STRUTS_TAG_ALTSYNTAX, "true"); - + assertEquals(Settings.get(StrutsConstants.STRUTS_TAG_ALTSYNTAX), "true"); assertTrue(ContextUtil.isUseAltSyntax(stack.getContext())); } - + public void testAltSyntaxMethod2() throws Exception { ValueStack stack = ValueStackFactory.getFactory().createValueStack(); stack.getContext().put("useAltSyntax", "false"); - + Settings.reset(); Settings.set(StrutsConstants.STRUTS_TAG_ALTSYNTAX, "true"); - + assertEquals(Settings.get(StrutsConstants.STRUTS_TAG_ALTSYNTAX), "true"); assertTrue(ContextUtil.isUseAltSyntax(stack.getContext())); } - + public void testAltSyntaxMethod3() throws Exception { ValueStack stack = ValueStackFactory.getFactory().createValueStack(); stack.getContext().put("useAltSyntax", "true"); - + Settings.reset(); Settings.set(StrutsConstants.STRUTS_TAG_ALTSYNTAX, "false"); - + assertEquals(Settings.get(StrutsConstants.STRUTS_TAG_ALTSYNTAX), "false"); assertTrue(ContextUtil.isUseAltSyntax(stack.getContext())); } - + public void testAltSyntaxMethod4() throws Exception { ValueStack stack = ValueStackFactory.getFactory().createValueStack(); stack.getContext().put("useAltSyntax", "false"); - + Settings.reset(); Settings.set(StrutsConstants.STRUTS_TAG_ALTSYNTAX, "false"); - + assertEquals(Settings.get(StrutsConstants.STRUTS_TAG_ALTSYNTAX), "false"); assertFalse(ContextUtil.isUseAltSyntax(stack.getContext())); } - + //======================================================== - + public void testAltSyntaxMethod5() throws Exception { ValueStack stack = ValueStackFactory.getFactory().createValueStack(); stack.getContext().put("useAltSyntax", Boolean.TRUE); - + Settings.reset(); Settings.set(StrutsConstants.STRUTS_TAG_ALTSYNTAX, "true"); - + assertEquals(Settings.get(StrutsConstants.STRUTS_TAG_ALTSYNTAX), "true"); assertTrue(ContextUtil.isUseAltSyntax(stack.getContext())); } public void testAltSyntaxMethod6() throws Exception { ValueStack stack = ValueStackFactory.getFactory().createValueStack(); stack.getContext().put("useAltSyntax", Boolean.FALSE); - + Settings.reset(); Settings.set(StrutsConstants.STRUTS_TAG_ALTSYNTAX, "true"); - + assertEquals(Settings.get(StrutsConstants.STRUTS_TAG_ALTSYNTAX), "true"); assertTrue(ContextUtil.isUseAltSyntax(stack.getContext())); } public void testAltSyntaxMethod7() throws Exception { ValueStack stack = ValueStackFactory.getFactory().createValueStack(); stack.getContext().put("useAltSyntax", Boolean.TRUE); - + Settings.reset(); Settings.set(StrutsConstants.STRUTS_TAG_ALTSYNTAX, "false"); - + assertEquals(Settings.get(StrutsConstants.STRUTS_TAG_ALTSYNTAX), "false"); assertTrue(ContextUtil.isUseAltSyntax(stack.getContext())); } public void testAltSyntaxMethod8() throws Exception { ValueStack stack = ValueStackFactory.getFactory().createValueStack(); stack.getContext().put("useAltSyntax", Boolean.FALSE); - + Settings.reset(); Settings.set(StrutsConstants.STRUTS_TAG_ALTSYNTAX, "false"); - + assertEquals(Settings.get(StrutsConstants.STRUTS_TAG_ALTSYNTAX), "false"); assertFalse(ContextUtil.isUseAltSyntax(stack.getContext())); } - + // ========================================== public void testAltSyntaxMethod9() throws Exception { ValueStack stack = ValueStackFactory.getFactory().createValueStack(); stack.getContext().put("useAltSyntax", null); - + Settings.reset(); Settings.set(StrutsConstants.STRUTS_TAG_ALTSYNTAX, "true"); - + assertEquals(Settings.get(StrutsConstants.STRUTS_TAG_ALTSYNTAX), "true"); assertTrue(ContextUtil.isUseAltSyntax(stack.getContext())); } diff --git a/core/src/test/java/org/apache/struts2/views/util/ResourceUtilTest.java b/core/src/test/java/org/apache/struts2/views/util/ResourceUtilTest.java index 2ee6c0586..17e23e3fe 100644 --- a/core/src/test/java/org/apache/struts2/views/util/ResourceUtilTest.java +++ b/core/src/test/java/org/apache/struts2/views/util/ResourceUtilTest.java @@ -1,19 +1,22 @@ /* * $Id$ * - * Copyright 2006 The Apache Software Foundation. + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at + * http://www.apache.org/licenses/LICENSE-2.0 * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. */ package org.apache.struts2.views.util; /** diff --git a/core/src/test/java/org/apache/struts2/views/util/TextUtilTest.java b/core/src/test/java/org/apache/struts2/views/util/TextUtilTest.java index f90086d5c..e4c4bf6c8 100644 --- a/core/src/test/java/org/apache/struts2/views/util/TextUtilTest.java +++ b/core/src/test/java/org/apache/struts2/views/util/TextUtilTest.java @@ -1,19 +1,22 @@ /* * $Id$ * - * Copyright 2006 The Apache Software Foundation. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. */ package org.apache.struts2.views.util; diff --git a/core/src/test/java/org/apache/struts2/views/util/UrlHelperTest.java b/core/src/test/java/org/apache/struts2/views/util/UrlHelperTest.java index 62e2f8976..366632247 100644 --- a/core/src/test/java/org/apache/struts2/views/util/UrlHelperTest.java +++ b/core/src/test/java/org/apache/struts2/views/util/UrlHelperTest.java @@ -1,19 +1,22 @@ /* * $Id$ * - * Copyright 2006 The Apache Software Foundation. + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at + * http://www.apache.org/licenses/LICENSE-2.0 * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. */ package org.apache.struts2.views.util; @@ -34,61 +37,61 @@ import com.mockobjects.dynamic.Mock; /** * Test case for UrlHelper. - * + * */ public class UrlHelperTest extends StrutsTestCase { - - - - public void testForceAddSchemeHostAndPort() throws Exception { - String expectedUrl = "http://localhost/contextPath/path1/path2/myAction.action"; - - Mock mockHttpServletRequest = new Mock(HttpServletRequest.class); - mockHttpServletRequest.expectAndReturn("getScheme", "http"); - mockHttpServletRequest.expectAndReturn("getServerName", "localhost"); + + + + public void testForceAddSchemeHostAndPort() throws Exception { + String expectedUrl = "http://localhost/contextPath/path1/path2/myAction.action"; + + Mock mockHttpServletRequest = new Mock(HttpServletRequest.class); + mockHttpServletRequest.expectAndReturn("getScheme", "http"); + mockHttpServletRequest.expectAndReturn("getServerName", "localhost"); mockHttpServletRequest.expectAndReturn("getContextPath", "/contextPath"); Mock mockHttpServletResponse = new Mock(HttpServletResponse.class); mockHttpServletResponse.expectAndReturn("encodeURL", expectedUrl, expectedUrl); - - String result = UrlHelper.buildUrl("/path1/path2/myAction.action", (HttpServletRequest) mockHttpServletRequest.proxy(), (HttpServletResponse)mockHttpServletResponse.proxy(), null, "http", true, true, true); - assertEquals(expectedUrl, result); - mockHttpServletRequest.verify(); - } - - public void testDoNotForceAddSchemeHostAndPort() throws Exception { - String expectedUrl = "/contextPath/path1/path2/myAction.action"; - - Mock mockHttpServletRequest = new Mock(HttpServletRequest.class); - mockHttpServletRequest.expectAndReturn("getScheme", "http"); - mockHttpServletRequest.expectAndReturn("getServerName", "localhost"); + + String result = UrlHelper.buildUrl("/path1/path2/myAction.action", (HttpServletRequest) mockHttpServletRequest.proxy(), (HttpServletResponse)mockHttpServletResponse.proxy(), null, "http", true, true, true); + assertEquals(expectedUrl, result); + mockHttpServletRequest.verify(); + } + + public void testDoNotForceAddSchemeHostAndPort() throws Exception { + String expectedUrl = "/contextPath/path1/path2/myAction.action"; + + Mock mockHttpServletRequest = new Mock(HttpServletRequest.class); + mockHttpServletRequest.expectAndReturn("getScheme", "http"); + mockHttpServletRequest.expectAndReturn("getServerName", "localhost"); mockHttpServletRequest.expectAndReturn("getContextPath", "/contextPath"); Mock mockHttpServletResponse = new Mock(HttpServletResponse.class); mockHttpServletResponse.expectAndReturn("encodeURL", expectedUrl, expectedUrl); - - String result = UrlHelper.buildUrl("/path1/path2/myAction.action", (HttpServletRequest)mockHttpServletRequest.proxy(), (HttpServletResponse)mockHttpServletResponse.proxy(), null, "http", true, true, false); - - assertEquals(expectedUrl, result); - } - - - public void testBuildParametersStringWithUrlHavingSomeExistingParameters() throws Exception { - String expectedUrl = "http://localhost:8080/myContext/myPage.jsp?initParam=initValue&param1=value1&param2=value2"; - - Map parameters = new LinkedHashMap(); - parameters.put("param1", "value1"); - parameters.put("param2", "value2"); - - StringBuffer url = new StringBuffer("http://localhost:8080/myContext/myPage.jsp?initParam=initValue"); - - UrlHelper.buildParametersString(parameters, url); - - assertEquals( - expectedUrl, url.toString()); - } - - + + String result = UrlHelper.buildUrl("/path1/path2/myAction.action", (HttpServletRequest)mockHttpServletRequest.proxy(), (HttpServletResponse)mockHttpServletResponse.proxy(), null, "http", true, true, false); + + assertEquals(expectedUrl, result); + } + + + public void testBuildParametersStringWithUrlHavingSomeExistingParameters() throws Exception { + String expectedUrl = "http://localhost:8080/myContext/myPage.jsp?initParam=initValue&param1=value1&param2=value2"; + + Map parameters = new LinkedHashMap(); + parameters.put("param1", "value1"); + parameters.put("param2", "value2"); + + StringBuffer url = new StringBuffer("http://localhost:8080/myContext/myPage.jsp?initParam=initValue"); + + UrlHelper.buildParametersString(parameters, url); + + assertEquals( + expectedUrl, url.toString()); + } + + public void testBuildWithRootContext() { String expectedUrl = "/MyAction.action"; @@ -274,56 +277,56 @@ public class UrlHelperTest extends StrutsTestCase { String urlString = UrlHelper.buildUrl(actionName, (HttpServletRequest) mockHttpServletRequest.proxy(), (HttpServletResponse) mockHttpServletResponse.proxy(), params, "https", true, true); assertEquals(expectedString, urlString); } - - + + public void testParseQuery() throws Exception { - Map result = UrlHelper.parseQueryString("aaa=aaaval&bbb=bbbval&ccc="); - - assertEquals(result.get("aaa"), "aaaval"); - assertEquals(result.get("bbb"), "bbbval"); - assertEquals(result.get("ccc"), ""); + Map result = UrlHelper.parseQueryString("aaa=aaaval&bbb=bbbval&ccc="); + + assertEquals(result.get("aaa"), "aaaval"); + assertEquals(result.get("bbb"), "bbbval"); + assertEquals(result.get("ccc"), ""); } - + public void testParseEmptyQuery() throws Exception { - Map result = UrlHelper.parseQueryString(""); - - assertNotNull(result); - assertEquals(result.size(), 0); + Map result = UrlHelper.parseQueryString(""); + + assertNotNull(result); + assertEquals(result.size(), 0); } - + public void testParseNullQuery() throws Exception { - Map result = UrlHelper.parseQueryString(null); - - assertNotNull(result); - assertEquals(result.size(), 0); + Map result = UrlHelper.parseQueryString(null); + + assertNotNull(result); + assertEquals(result.size(), 0); } - - + + public void testTranslateAndEncode() throws Exception { - String defaultI18nEncoding = Settings.get(StrutsConstants.STRUTS_I18N_ENCODING); - try { - Settings.set(StrutsConstants.STRUTS_I18N_ENCODING, "UTF-8"); - String result = UrlHelper.translateAndEncode("\u65b0\u805e"); - String expectedResult = "%E6%96%B0%E8%81%9E"; - - assertEquals(result, expectedResult); - } - finally { - Settings.set(StrutsConstants.STRUTS_I18N_ENCODING, defaultI18nEncoding); - } + String defaultI18nEncoding = Settings.get(StrutsConstants.STRUTS_I18N_ENCODING); + try { + Settings.set(StrutsConstants.STRUTS_I18N_ENCODING, "UTF-8"); + String result = UrlHelper.translateAndEncode("\u65b0\u805e"); + String expectedResult = "%E6%96%B0%E8%81%9E"; + + assertEquals(result, expectedResult); + } + finally { + Settings.set(StrutsConstants.STRUTS_I18N_ENCODING, defaultI18nEncoding); + } } - + public void testTranslateAndDecode() throws Exception { - String defaultI18nEncoding = Settings.get(StrutsConstants.STRUTS_I18N_ENCODING); - try { - Settings.set(StrutsConstants.STRUTS_I18N_ENCODING, "UTF-8"); - String result = UrlHelper.translateAndDecode("%E6%96%B0%E8%81%9E"); - String expectedResult = "\u65b0\u805e"; - - assertEquals(result, expectedResult); - } - finally { - Settings.set(StrutsConstants.STRUTS_I18N_ENCODING, defaultI18nEncoding); - } + String defaultI18nEncoding = Settings.get(StrutsConstants.STRUTS_I18N_ENCODING); + try { + Settings.set(StrutsConstants.STRUTS_I18N_ENCODING, "UTF-8"); + String result = UrlHelper.translateAndDecode("%E6%96%B0%E8%81%9E"); + String expectedResult = "\u65b0\u805e"; + + assertEquals(result, expectedResult); + } + finally { + Settings.set(StrutsConstants.STRUTS_I18N_ENCODING, defaultI18nEncoding); + } } } diff --git a/core/src/test/java/org/apache/struts2/views/xslt/XSLTResultTest.java b/core/src/test/java/org/apache/struts2/views/xslt/XSLTResultTest.java index eca9b555f..4bd7e9337 100644 --- a/core/src/test/java/org/apache/struts2/views/xslt/XSLTResultTest.java +++ b/core/src/test/java/org/apache/struts2/views/xslt/XSLTResultTest.java @@ -1,19 +1,22 @@ /* * $Id$ * - * Copyright 2006 The Apache Software Foundation. + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at + * http://www.apache.org/licenses/LICENSE-2.0 * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. */ package org.apache.struts2.views.xslt; diff --git a/plugins/config-browser/src/main/java/org/apache/struts2/config_browser/ActionNamesAction.java b/plugins/config-browser/src/main/java/org/apache/struts2/config_browser/ActionNamesAction.java index e332ffb8f..e3cb5de5a 100644 --- a/plugins/config-browser/src/main/java/org/apache/struts2/config_browser/ActionNamesAction.java +++ b/plugins/config-browser/src/main/java/org/apache/struts2/config_browser/ActionNamesAction.java @@ -1,19 +1,22 @@ /* * $Id$ * - * Copyright 2006 The Apache Software Foundation. + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at + * http://www.apache.org/licenses/LICENSE-2.0 * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. */ package org.apache.struts2.config_browser; @@ -31,10 +34,10 @@ import com.opensymphony.xwork2.config.entities.ActionConfig; * */ public class ActionNamesAction extends ActionSupport { - - private static final long serialVersionUID = -5389385242431387840L; - - private Set actionNames; + + private static final long serialVersionUID = -5389385242431387840L; + + private Set actionNames; private String namespace = ""; private Set namespaces; private String extension; diff --git a/plugins/config-browser/src/main/java/org/apache/struts2/config_browser/ConfigurationHelper.java b/plugins/config-browser/src/main/java/org/apache/struts2/config_browser/ConfigurationHelper.java index 09f0b29e7..ffabe6516 100644 --- a/plugins/config-browser/src/main/java/org/apache/struts2/config_browser/ConfigurationHelper.java +++ b/plugins/config-browser/src/main/java/org/apache/struts2/config_browser/ConfigurationHelper.java @@ -1,19 +1,22 @@ /* * $Id$ * - * Copyright 2006 The Apache Software Foundation. + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at + * http://www.apache.org/licenses/LICENSE-2.0 * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. */ package org.apache.struts2.config_browser; diff --git a/plugins/config-browser/src/main/java/org/apache/struts2/config_browser/ListValidatorsAction.java b/plugins/config-browser/src/main/java/org/apache/struts2/config_browser/ListValidatorsAction.java index 8cafe365e..a99b6749a 100644 --- a/plugins/config-browser/src/main/java/org/apache/struts2/config_browser/ListValidatorsAction.java +++ b/plugins/config-browser/src/main/java/org/apache/struts2/config_browser/ListValidatorsAction.java @@ -1,19 +1,22 @@ /* * $Id$ * - * Copyright 2006 The Apache Software Foundation. + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at + * http://www.apache.org/licenses/LICENSE-2.0 * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. */ package org.apache.struts2.config_browser; @@ -31,10 +34,10 @@ import com.opensymphony.xwork2.validator.ActionValidatorManagerFactory; * */ public class ListValidatorsAction extends ActionSupport { - - private static final long serialVersionUID = 1L; - - private String clazz; + + private static final long serialVersionUID = 1L; + + private String clazz; private String context; List validators = Collections.EMPTY_LIST; diff --git a/plugins/config-browser/src/main/java/org/apache/struts2/config_browser/ShowConfigAction.java b/plugins/config-browser/src/main/java/org/apache/struts2/config_browser/ShowConfigAction.java index 94de49c80..beac072c2 100644 --- a/plugins/config-browser/src/main/java/org/apache/struts2/config_browser/ShowConfigAction.java +++ b/plugins/config-browser/src/main/java/org/apache/struts2/config_browser/ShowConfigAction.java @@ -1,19 +1,22 @@ /* * $Id$ * - * Copyright 2006 The Apache Software Foundation. + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at + * http://www.apache.org/licenses/LICENSE-2.0 * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. */ package org.apache.struts2.config_browser; @@ -33,10 +36,10 @@ import com.opensymphony.xwork2.config.entities.ActionConfig; * ShowConfigAction */ public class ShowConfigAction extends ActionNamesAction { - - private static final long serialVersionUID = -1630527489407671652L; - private static final PropertyDescriptor[] PDSAT = new PropertyDescriptor[0]; + private static final long serialVersionUID = -1630527489407671652L; + + private static final PropertyDescriptor[] PDSAT = new PropertyDescriptor[0]; private String namespace; private String actionName; diff --git a/plugins/config-browser/src/main/java/org/apache/struts2/config_browser/ShowValidatorAction.java b/plugins/config-browser/src/main/java/org/apache/struts2/config_browser/ShowValidatorAction.java index aa5386b8c..94252e508 100644 --- a/plugins/config-browser/src/main/java/org/apache/struts2/config_browser/ShowValidatorAction.java +++ b/plugins/config-browser/src/main/java/org/apache/struts2/config_browser/ShowValidatorAction.java @@ -1,19 +1,22 @@ /* * $Id$ * - * Copyright 2006 The Apache Software Foundation. + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at + * http://www.apache.org/licenses/LICENSE-2.0 * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. */ package org.apache.struts2.config_browser; diff --git a/plugins/jasperreports/src/main/java/org/apache/struts2/views/jasperreports/CompileReport.java b/plugins/jasperreports/src/main/java/org/apache/struts2/views/jasperreports/CompileReport.java index 522212dc2..b40d3ff69 100644 --- a/plugins/jasperreports/src/main/java/org/apache/struts2/views/jasperreports/CompileReport.java +++ b/plugins/jasperreports/src/main/java/org/apache/struts2/views/jasperreports/CompileReport.java @@ -1,19 +1,22 @@ /* * $Id$ * - * Copyright 2006 The Apache Software Foundation. + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at + * http://www.apache.org/licenses/LICENSE-2.0 * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. */ package org.apache.struts2.views.jasperreports; diff --git a/plugins/jasperreports/src/main/java/org/apache/struts2/views/jasperreports/JasperReportConstants.java b/plugins/jasperreports/src/main/java/org/apache/struts2/views/jasperreports/JasperReportConstants.java index 1c1e2fd51..8bbdffeb3 100644 --- a/plugins/jasperreports/src/main/java/org/apache/struts2/views/jasperreports/JasperReportConstants.java +++ b/plugins/jasperreports/src/main/java/org/apache/struts2/views/jasperreports/JasperReportConstants.java @@ -1,19 +1,22 @@ /* * $Id$ * - * Copyright 2006 The Apache Software Foundation. + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at + * http://www.apache.org/licenses/LICENSE-2.0 * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. */ package org.apache.struts2.views.jasperreports; diff --git a/plugins/jasperreports/src/main/java/org/apache/struts2/views/jasperreports/JasperReportsResult.java b/plugins/jasperreports/src/main/java/org/apache/struts2/views/jasperreports/JasperReportsResult.java index af51f92a2..4e5b636f4 100644 --- a/plugins/jasperreports/src/main/java/org/apache/struts2/views/jasperreports/JasperReportsResult.java +++ b/plugins/jasperreports/src/main/java/org/apache/struts2/views/jasperreports/JasperReportsResult.java @@ -1,19 +1,22 @@ /* * $Id$ * - * Copyright 2006 The Apache Software Foundation. + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at + * http://www.apache.org/licenses/LICENSE-2.0 * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. */ package org.apache.struts2.views.jasperreports; @@ -90,7 +93,7 @@ import com.opensymphony.xwork2.util.ValueStack; * *

    * This result follows the same rules from {@link StrutsResultSupport}. - * Specifically, all parameters will be parsed if the "parse" parameter is not + * Specifically, all parameters will be parsed if the "parse" parameter is not * set to false. *

    * @@ -114,11 +117,11 @@ import com.opensymphony.xwork2.util.ValueStack; * */ public class JasperReportsResult extends StrutsResultSupport implements JasperReportConstants { - - private static final long serialVersionUID = -2523174799621182907L; + + private static final long serialVersionUID = -2523174799621182907L; - private final static Log LOG = LogFactory.getLog(JasperReportsResult.class); + private final static Log LOG = LogFactory.getLog(JasperReportsResult.class); protected String dataSource; @@ -126,16 +129,16 @@ public class JasperReportsResult extends StrutsResultSupport implements JasperRe protected String documentName; protected String contentDisposition; protected String delimiter; - protected String imageServletUrl = "/images/"; - + protected String imageServletUrl = "/images/"; + public JasperReportsResult() { - super(); + super(); } - + public JasperReportsResult(String location) { - super(location); + super(location); } - + public String getImageServletUrl() { return imageServletUrl; } @@ -266,7 +269,7 @@ public class JasperReportsResult extends StrutsResultSupport implements JasperRe response.setContentType("text/html"); // IMAGES_MAPS seems to be only supported as "backward compatible" from JasperReports 1.1.0 - + Map imagesMap = new HashMap(); request.getSession(true).setAttribute("IMAGES_MAP", imagesMap); diff --git a/plugins/jasperreports/src/main/java/org/apache/struts2/views/jasperreports/ValueStackDataSource.java b/plugins/jasperreports/src/main/java/org/apache/struts2/views/jasperreports/ValueStackDataSource.java index 6f34fa02b..d5a703a85 100644 --- a/plugins/jasperreports/src/main/java/org/apache/struts2/views/jasperreports/ValueStackDataSource.java +++ b/plugins/jasperreports/src/main/java/org/apache/struts2/views/jasperreports/ValueStackDataSource.java @@ -1,19 +1,22 @@ /* * $Id$ * - * Copyright 2006 The Apache Software Foundation. + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at + * http://www.apache.org/licenses/LICENSE-2.0 * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. */ package org.apache.struts2.views.jasperreports; diff --git a/plugins/jasperreports/src/main/java/org/apache/struts2/views/jasperreports/ValueStackShadowMap.java b/plugins/jasperreports/src/main/java/org/apache/struts2/views/jasperreports/ValueStackShadowMap.java index 819d9df44..c1a94bdfe 100644 --- a/plugins/jasperreports/src/main/java/org/apache/struts2/views/jasperreports/ValueStackShadowMap.java +++ b/plugins/jasperreports/src/main/java/org/apache/struts2/views/jasperreports/ValueStackShadowMap.java @@ -1,19 +1,22 @@ /* * $Id$ * - * Copyright 2006 The Apache Software Foundation. + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at + * http://www.apache.org/licenses/LICENSE-2.0 * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. */ package org.apache.struts2.views.jasperreports; @@ -29,9 +32,9 @@ import java.util.Set; */ public class ValueStackShadowMap extends HashMap { - private static final long serialVersionUID = -167109778490907240L; + private static final long serialVersionUID = -167109778490907240L; - /** + /** * valueStack reference */ ValueStack valueStack; diff --git a/plugins/jfreechart/src/main/java/org/apache/struts2/dispatcher/ChartResult.java b/plugins/jfreechart/src/main/java/org/apache/struts2/dispatcher/ChartResult.java index 12be078f0..129c7a5a2 100644 --- a/plugins/jfreechart/src/main/java/org/apache/struts2/dispatcher/ChartResult.java +++ b/plugins/jfreechart/src/main/java/org/apache/struts2/dispatcher/ChartResult.java @@ -1,19 +1,22 @@ /* * $Id$ * - * Copyright 2006 The Apache Software Foundation. + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at + * http://www.apache.org/licenses/LICENSE-2.0 * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. */ package org.apache.struts2.dispatcher; @@ -35,21 +38,21 @@ import java.io.OutputStream; */ public class ChartResult implements Result { - private static final long serialVersionUID = -6484761870055986612L; - - JFreeChart chart; + private static final long serialVersionUID = -6484761870055986612L; + + JFreeChart chart; boolean chartSet = false; private int height; private int width; public ChartResult() { - super(); + super(); } - + public ChartResult(JFreeChart chart, int height, int width) { - setChart(chart); - this.height = height; - this.width = width; + setChart(chart); + this.height = height; + this.width = width; } /** diff --git a/plugins/jfreechart/src/test/java/org/apache/struts2/dispatcher/ChartResultTest.java b/plugins/jfreechart/src/test/java/org/apache/struts2/dispatcher/ChartResultTest.java index 5e6937be1..022d47859 100644 --- a/plugins/jfreechart/src/test/java/org/apache/struts2/dispatcher/ChartResultTest.java +++ b/plugins/jfreechart/src/test/java/org/apache/struts2/dispatcher/ChartResultTest.java @@ -1,19 +1,22 @@ /* * $Id$ * - * Copyright 2006 The Apache Software Foundation. + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at + * http://www.apache.org/licenses/LICENSE-2.0 * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. */ package org.apache.struts2.dispatcher; diff --git a/plugins/jsf/src/main/java/org/apache/struts2/jsf/ApplyRequestValuesInterceptor.java b/plugins/jsf/src/main/java/org/apache/struts2/jsf/ApplyRequestValuesInterceptor.java index 304b0f876..7b604dd5e 100644 --- a/plugins/jsf/src/main/java/org/apache/struts2/jsf/ApplyRequestValuesInterceptor.java +++ b/plugins/jsf/src/main/java/org/apache/struts2/jsf/ApplyRequestValuesInterceptor.java @@ -1,19 +1,22 @@ /* * $Id$ * - * Copyright 2006 The Apache Software Foundation. + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at + * http://www.apache.org/licenses/LICENSE-2.0 * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. */ package org.apache.struts2.jsf; @@ -30,7 +33,7 @@ public class ApplyRequestValuesInterceptor extends FacesInterceptor { /** * Apply Request Values (JSF.2.2.2) - * + * * @param viewId * The view id * @param facesContext diff --git a/plugins/jsf/src/main/java/org/apache/struts2/jsf/FacesInterceptor.java b/plugins/jsf/src/main/java/org/apache/struts2/jsf/FacesInterceptor.java index 210946727..e6ea9913f 100644 --- a/plugins/jsf/src/main/java/org/apache/struts2/jsf/FacesInterceptor.java +++ b/plugins/jsf/src/main/java/org/apache/struts2/jsf/FacesInterceptor.java @@ -1,19 +1,22 @@ /* * $Id$ * - * Copyright 2006 The Apache Software Foundation. + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at + * http://www.apache.org/licenses/LICENSE-2.0 * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. */ package org.apache.struts2.jsf; @@ -39,7 +42,7 @@ public class FacesInterceptor extends FacesSupport implements Interceptor { /** * Adapts the phase workflow to Action 2 - * + * * @param invocation * The action invocation * @return The string result code @@ -76,7 +79,7 @@ public class FacesInterceptor extends FacesSupport implements Interceptor { /** * Executes the specific phase. The phase id is constructed as a composite * of the namespace and action name. - * + * * @param viewId * The view id * @param facesContext @@ -95,7 +98,7 @@ public class FacesInterceptor extends FacesSupport implements Interceptor { /** * Determines whether to process this request with the JSF phases - * + * * @param ctx The current action context * @return True if it is a faces-enabled request */ diff --git a/plugins/jsf/src/main/java/org/apache/struts2/jsf/FacesRender.java b/plugins/jsf/src/main/java/org/apache/struts2/jsf/FacesRender.java index d38dd22e6..3499b7350 100755 --- a/plugins/jsf/src/main/java/org/apache/struts2/jsf/FacesRender.java +++ b/plugins/jsf/src/main/java/org/apache/struts2/jsf/FacesRender.java @@ -1,19 +1,22 @@ /* * $Id$ * - * Copyright 2006 The Apache Software Foundation. + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at + * http://www.apache.org/licenses/LICENSE-2.0 * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. */ package org.apache.struts2.jsf; @@ -31,9 +34,9 @@ import javax.faces.event.PhaseId; */ public class FacesRender extends FacesSupport { - /** + /** * Executes the render phase, borrowed from MyFaces - * + * * @param facesContext * The faces context * @throws FacesException diff --git a/plugins/jsf/src/main/java/org/apache/struts2/jsf/FacesResult.java b/plugins/jsf/src/main/java/org/apache/struts2/jsf/FacesResult.java index a0b4f0a07..4be7bbf0f 100644 --- a/plugins/jsf/src/main/java/org/apache/struts2/jsf/FacesResult.java +++ b/plugins/jsf/src/main/java/org/apache/struts2/jsf/FacesResult.java @@ -1,19 +1,22 @@ /* * $Id$ * - * Copyright 2006 The Apache Software Foundation. + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at + * http://www.apache.org/licenses/LICENSE-2.0 * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. */ package org.apache.struts2.jsf; @@ -34,17 +37,17 @@ public class FacesResult extends StrutsResultSupport implements Result { private static final long serialVersionUID = -3548970638740937804L; public FacesResult() { - super(); + super(); } - + public FacesResult(String location) { - super(location); + super(location); } /** * Checks to see if we need to build a new JSF ViewId from the Struts Result * config and then renders the result by delegating to the * FacesRender.render(). - * + * * @see org.apache.struts2.dispatcher.StrutsResultSupport#doExecute(java.lang.String, * com.opensymphony. */ @@ -57,7 +60,7 @@ public class FacesResult extends StrutsResultSupport implements Result { /** * Compares the Struts Result uri to the faces viewId. If they are different * use the Struts uri to build a new faces viewId. - * + * * @param finalLocation * The result uri * @param facesContext diff --git a/plugins/jsf/src/main/java/org/apache/struts2/jsf/FacesSetupInterceptor.java b/plugins/jsf/src/main/java/org/apache/struts2/jsf/FacesSetupInterceptor.java index 60be41194..9d58303aa 100644 --- a/plugins/jsf/src/main/java/org/apache/struts2/jsf/FacesSetupInterceptor.java +++ b/plugins/jsf/src/main/java/org/apache/struts2/jsf/FacesSetupInterceptor.java @@ -1,19 +1,22 @@ /* * $Id$ * - * Copyright 2006 The Apache Software Foundation. + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at + * http://www.apache.org/licenses/LICENSE-2.0 * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. */ package org.apache.struts2.jsf; @@ -57,7 +60,7 @@ import com.opensymphony.xwork2.interceptor.Interceptor; *

    *

    * Example struts.xml configuration: - * + * *
      *   <interceptor-ref name="jsfSetup">
      *       <param name="actionListener"></param>
    @@ -75,7 +78,7 @@ import com.opensymphony.xwork2.interceptor.Interceptor;
      *       <param name="viewHandler;">org.apache.shale.tiles.TilesViewHandler</param>
      *   </interceptor-ref>
      * 
    - * + * *

    *

    * Note: None of the parameters are required but all are shown in the example @@ -114,7 +117,7 @@ public class FacesSetupInterceptor extends FacesSupport implements Interceptor { /** * Sets the lifecycle id - * + * * @param id * The id */ @@ -204,7 +207,7 @@ public class FacesSetupInterceptor extends FacesSupport implements Interceptor { /** * Creates the faces context for other phases. - * + * * @param invocation * The action invocation */ @@ -247,7 +250,7 @@ public class FacesSetupInterceptor extends FacesSupport implements Interceptor { /** * Determines if this action mapping will be have a JSF view - * + * * @param inv * The action invocation * @return True if the JSF interceptors should fire @@ -278,7 +281,7 @@ public class FacesSetupInterceptor extends FacesSupport implements Interceptor { * creating the objects using constructor delegation, if the requested class * supports it. Classes will be imbedded from top to bottom in the list with * the last class listed being the one that will be returned. - * + * * @param interfaceClass * The Class type that is expected to be returned * @param classNamesIterator @@ -363,7 +366,7 @@ public class FacesSetupInterceptor extends FacesSupport implements Interceptor { * Takes a comma delimited string of class names and stores the names in an * ArrayList. The incoming String will be * cleaned of any whitespace characters before the class names are stored. - * + * * @param actionListener * A comma delimited string of class names */ @@ -383,7 +386,7 @@ public class FacesSetupInterceptor extends FacesSupport implements Interceptor { * A String to be used as the defaultRenderKitId for the jsf * application. The incoming String will be cleaned of * whitespace characters. - * + * * @param defaultRenderKitId * The defaultRenderKitId */ @@ -396,7 +399,7 @@ public class FacesSetupInterceptor extends FacesSupport implements Interceptor { * Takes a comma delimited string of local names and stores the names in an * ArrayList. The incoming String will be * cleaned of any whitespace characters before the class names are stored. - * + * * @param supportedLocale * A comma delimited string of local names */ @@ -416,7 +419,7 @@ public class FacesSetupInterceptor extends FacesSupport implements Interceptor { * Stores a String representation of the defaultLocale. The incoming * String will be cleaned of any whitespace characters before * the class names are stored. - * + * * @param defaultLocale * The default local */ @@ -427,7 +430,7 @@ public class FacesSetupInterceptor extends FacesSupport implements Interceptor { /** * Stores the messageBundle to be used to configure the jsf Application. - * + * * @param messageBundle * The messageBundle */ @@ -440,7 +443,7 @@ public class FacesSetupInterceptor extends FacesSupport implements Interceptor { * Takes a comma delimited string of class names and stores the names in an * ArrayList. The incoming String will be * cleaned of any whitespace characters before the class names are stored. - * + * * @param navigationHandlerName * A comma delimited string of class names */ @@ -460,7 +463,7 @@ public class FacesSetupInterceptor extends FacesSupport implements Interceptor { * Takes a comma delimited string of class names and stores the names in an * ArrayList. The incoming String will be * cleaned of any whitespace characters before the class names are stored. - * + * * @param propertyResolverName * A comma delimited string of class names */ @@ -480,7 +483,7 @@ public class FacesSetupInterceptor extends FacesSupport implements Interceptor { * Takes a comma delimited string of class names and stores the names in an * ArrayList. The incoming String will be * cleaned of any whitespace characters before the class names are stored. - * + * * @param stateManagerName * A comma delimited string of class names */ @@ -500,7 +503,7 @@ public class FacesSetupInterceptor extends FacesSupport implements Interceptor { * Takes a comma delimited string of class names and stores the names in an * ArrayList. The incoming String will be * cleaned of any whitespace characters before the class names are stored. - * + * * @param variableResolverName * A comma delimited string of class names */ @@ -520,7 +523,7 @@ public class FacesSetupInterceptor extends FacesSupport implements Interceptor { * Takes a comma delimited string of class names and stores the names in an * ArrayList. The incoming String will be * cleaned of any whitespace characters before the class names are stored. - * + * * @param viewHandlerName * A comma delimited string of class names */ @@ -539,7 +542,7 @@ public class FacesSetupInterceptor extends FacesSupport implements Interceptor { /** * Converts a locale string to Locale class. Accepts both '_' * and '-' as separators for locale components. - * + * * @param localeString * string representation of a locale * @return Locale instance, compatible with the string representation diff --git a/plugins/jsf/src/main/java/org/apache/struts2/jsf/FacesSupport.java b/plugins/jsf/src/main/java/org/apache/struts2/jsf/FacesSupport.java index 97c873e80..a769269e9 100644 --- a/plugins/jsf/src/main/java/org/apache/struts2/jsf/FacesSupport.java +++ b/plugins/jsf/src/main/java/org/apache/struts2/jsf/FacesSupport.java @@ -1,19 +1,22 @@ /* * $Id$ * - * Copyright 2006 The Apache Software Foundation. + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at + * http://www.apache.org/licenses/LICENSE-2.0 * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. */ package org.apache.struts2.jsf; @@ -33,10 +36,10 @@ import com.opensymphony.xwork2.ActionContext; */ public class FacesSupport { - private static final String LIFECYCLE_KEY = "lifecycle"; + private static final String LIFECYCLE_KEY = "lifecycle"; - /** Log instance for each class */ - protected Log log; + /** Log instance for each class */ + protected Log log; /** * Marker key for the ActionContext to dictate whether to treat the request @@ -49,122 +52,122 @@ public class FacesSupport { log = LogFactory.getLog(getClass()); } - /** - * Gets the shared lifecycle for this request - * - * @return The lifecycle - */ - private Lifecycle getLifecycle() { - return (Lifecycle) ActionContext.getContext().get(LIFECYCLE_KEY); - } + /** + * Gets the shared lifecycle for this request + * + * @return The lifecycle + */ + private Lifecycle getLifecycle() { + return (Lifecycle) ActionContext.getContext().get(LIFECYCLE_KEY); + } - /** - * Sets the lifecycle for this request - * - * @param lifecycle - * The lifecycle - */ - protected void setLifecycle(Lifecycle lifecycle) { - ActionContext.getContext().put(LIFECYCLE_KEY, lifecycle); - } + /** + * Sets the lifecycle for this request + * + * @param lifecycle + * The lifecycle + */ + protected void setLifecycle(Lifecycle lifecycle) { + ActionContext.getContext().put(LIFECYCLE_KEY, lifecycle); + } - /** - * Informs phase listeners before a phase is executed - * - * @param facesContext - * The current faces context - * @param phaseId - * The phase id about to be executed - */ - protected void informPhaseListenersBefore(FacesContext facesContext, - PhaseId phaseId) { - Lifecycle lifecycle = getLifecycle(); - PhaseListener[] phaseListeners = lifecycle.getPhaseListeners(); - for (int i = 0; i < phaseListeners.length; i++) { - PhaseListener phaseListener = phaseListeners[i]; - int listenerPhaseId = phaseListener.getPhaseId().getOrdinal(); - if (listenerPhaseId == PhaseId.ANY_PHASE.getOrdinal() - || listenerPhaseId == phaseId.getOrdinal()) { - phaseListener.beforePhase(new PhaseEvent(FacesContext - .getCurrentInstance(), phaseId, lifecycle)); - } - } + /** + * Informs phase listeners before a phase is executed + * + * @param facesContext + * The current faces context + * @param phaseId + * The phase id about to be executed + */ + protected void informPhaseListenersBefore(FacesContext facesContext, + PhaseId phaseId) { + Lifecycle lifecycle = getLifecycle(); + PhaseListener[] phaseListeners = lifecycle.getPhaseListeners(); + for (int i = 0; i < phaseListeners.length; i++) { + PhaseListener phaseListener = phaseListeners[i]; + int listenerPhaseId = phaseListener.getPhaseId().getOrdinal(); + if (listenerPhaseId == PhaseId.ANY_PHASE.getOrdinal() + || listenerPhaseId == phaseId.getOrdinal()) { + phaseListener.beforePhase(new PhaseEvent(FacesContext + .getCurrentInstance(), phaseId, lifecycle)); + } + } - } + } - /** - * Informs phase listeners after a phase is executed - * - * @param facesContext - * The current faces context - * @param phaseId - * The phase id that was executed - */ - protected void informPhaseListenersAfter(FacesContext facesContext, - PhaseId phaseId) { - Lifecycle lifecycle = getLifecycle(); - PhaseListener[] phaseListeners = lifecycle.getPhaseListeners(); - for (int i = 0; i < phaseListeners.length; i++) { - PhaseListener phaseListener = phaseListeners[i]; - int listenerPhaseId = phaseListener.getPhaseId().getOrdinal(); - if (listenerPhaseId == PhaseId.ANY_PHASE.getOrdinal() - || listenerPhaseId == phaseId.getOrdinal()) { - phaseListener.afterPhase(new PhaseEvent(FacesContext - .getCurrentInstance(), phaseId, lifecycle)); - } - } + /** + * Informs phase listeners after a phase is executed + * + * @param facesContext + * The current faces context + * @param phaseId + * The phase id that was executed + */ + protected void informPhaseListenersAfter(FacesContext facesContext, + PhaseId phaseId) { + Lifecycle lifecycle = getLifecycle(); + PhaseListener[] phaseListeners = lifecycle.getPhaseListeners(); + for (int i = 0; i < phaseListeners.length; i++) { + PhaseListener phaseListener = phaseListeners[i]; + int listenerPhaseId = phaseListener.getPhaseId().getOrdinal(); + if (listenerPhaseId == PhaseId.ANY_PHASE.getOrdinal() + || listenerPhaseId == phaseId.getOrdinal()) { + phaseListener.afterPhase(new PhaseEvent(FacesContext + .getCurrentInstance(), phaseId, lifecycle)); + } + } - } + } - /** - * Checks to see if the response has been completed. Mainly used for better - * debugging messages. - * - * @param facesContext - * The current faces context - * @param phase - * The phase id in execution - * @param before - * Whether the phase has been executed or not - * @return True if the response is complete - */ - protected boolean isResponseComplete(FacesContext facesContext, - String phase, boolean before) { - boolean flag = false; - if (facesContext.getResponseComplete()) { - if (log.isDebugEnabled()) - log - .debug("exiting from lifecycle.execute in " - + phase - + " because getResponseComplete is true from one of the " - + (before ? "before" : "after") + " listeners"); - flag = true; - } - return flag; - } + /** + * Checks to see if the response has been completed. Mainly used for better + * debugging messages. + * + * @param facesContext + * The current faces context + * @param phase + * The phase id in execution + * @param before + * Whether the phase has been executed or not + * @return True if the response is complete + */ + protected boolean isResponseComplete(FacesContext facesContext, + String phase, boolean before) { + boolean flag = false; + if (facesContext.getResponseComplete()) { + if (log.isDebugEnabled()) + log + .debug("exiting from lifecycle.execute in " + + phase + + " because getResponseComplete is true from one of the " + + (before ? "before" : "after") + " listeners"); + flag = true; + } + return flag; + } - /** - * Checks to see the render phase should be executed next. Mainly used for - * better debugging messages. - * - * @param facesContext - * The current faces context - * @param phase - * The phase id in execution - * @param before - * Whether the phase has been executed or not - * @return True if the response is complete - */ - protected boolean shouldRenderResponse(FacesContext facesContext, - String phase, boolean before) { - boolean flag = false; - if (facesContext.getRenderResponse()) { - if (log.isDebugEnabled()) - log.debug("exiting from lifecycle.execute in " + phase - + " because getRenderResponse is true from one of the " - + (before ? "before" : "after") + " listeners"); - flag = true; - } - return flag; - } + /** + * Checks to see the render phase should be executed next. Mainly used for + * better debugging messages. + * + * @param facesContext + * The current faces context + * @param phase + * The phase id in execution + * @param before + * Whether the phase has been executed or not + * @return True if the response is complete + */ + protected boolean shouldRenderResponse(FacesContext facesContext, + String phase, boolean before) { + boolean flag = false; + if (facesContext.getRenderResponse()) { + if (log.isDebugEnabled()) + log.debug("exiting from lifecycle.execute in " + phase + + " because getRenderResponse is true from one of the " + + (before ? "before" : "after") + " listeners"); + flag = true; + } + return flag; + } } diff --git a/plugins/jsf/src/main/java/org/apache/struts2/jsf/InvokeApplicationInterceptor.java b/plugins/jsf/src/main/java/org/apache/struts2/jsf/InvokeApplicationInterceptor.java index edb50eef3..b618de81d 100644 --- a/plugins/jsf/src/main/java/org/apache/struts2/jsf/InvokeApplicationInterceptor.java +++ b/plugins/jsf/src/main/java/org/apache/struts2/jsf/InvokeApplicationInterceptor.java @@ -1,19 +1,22 @@ /* * $Id$ * - * Copyright 2006 The Apache Software Foundation. + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at + * http://www.apache.org/licenses/LICENSE-2.0 * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. */ package org.apache.struts2.jsf; @@ -30,7 +33,7 @@ public class InvokeApplicationInterceptor extends FacesInterceptor { /** * Invoke Application (JSF.2.2.5) - * + * * @param viewId * The view id * @param facesContext diff --git a/plugins/jsf/src/main/java/org/apache/struts2/jsf/ProcessValidationsInterceptor.java b/plugins/jsf/src/main/java/org/apache/struts2/jsf/ProcessValidationsInterceptor.java index 64963d20c..16c6a93f1 100644 --- a/plugins/jsf/src/main/java/org/apache/struts2/jsf/ProcessValidationsInterceptor.java +++ b/plugins/jsf/src/main/java/org/apache/struts2/jsf/ProcessValidationsInterceptor.java @@ -1,19 +1,22 @@ /* * $Id$ * - * Copyright 2006 The Apache Software Foundation. + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at + * http://www.apache.org/licenses/LICENSE-2.0 * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. */ package org.apache.struts2.jsf; @@ -26,49 +29,49 @@ import javax.faces.event.PhaseId; */ public class ProcessValidationsInterceptor extends FacesInterceptor { - private static final long serialVersionUID = 8785236570688278147L; + private static final long serialVersionUID = 8785236570688278147L; - /** - * Process Validations (JSF.2.2.3) - * - * @param viewId - * The view id - * @param facesContext - * The faces context - * @return true, if response is complete - */ - protected boolean executePhase(String viewId, FacesContext facesContext) - throws FacesException { - boolean skipFurtherProcessing = false; - if (log.isTraceEnabled()) - log.trace("entering processValidations"); + /** + * Process Validations (JSF.2.2.3) + * + * @param viewId + * The view id + * @param facesContext + * The faces context + * @return true, if response is complete + */ + protected boolean executePhase(String viewId, FacesContext facesContext) + throws FacesException { + boolean skipFurtherProcessing = false; + if (log.isTraceEnabled()) + log.trace("entering processValidations"); - informPhaseListenersBefore(facesContext, PhaseId.PROCESS_VALIDATIONS); + informPhaseListenersBefore(facesContext, PhaseId.PROCESS_VALIDATIONS); try { - if (isResponseComplete(facesContext, "processValidations", true)) { - // have to return right away - return true; - } - if (shouldRenderResponse(facesContext, "processValidations", true)) { - skipFurtherProcessing = true; - } - - facesContext.getViewRoot().processValidators(facesContext); + if (isResponseComplete(facesContext, "processValidations", true)) { + // have to return right away + return true; + } + if (shouldRenderResponse(facesContext, "processValidations", true)) { + skipFurtherProcessing = true; + } + + facesContext.getViewRoot().processValidators(facesContext); } finally { informPhaseListenersAfter(facesContext, PhaseId.PROCESS_VALIDATIONS); } - if (isResponseComplete(facesContext, "processValidations", false) - || shouldRenderResponse(facesContext, "processValidations", - false)) { - // since this phase is completed we don't need to return right away - // even if the response is completed - skipFurtherProcessing = true; - } + if (isResponseComplete(facesContext, "processValidations", false) + || shouldRenderResponse(facesContext, "processValidations", + false)) { + // since this phase is completed we don't need to return right away + // even if the response is completed + skipFurtherProcessing = true; + } - if (!skipFurtherProcessing && log.isTraceEnabled()) - log.trace("exiting processValidations"); - return skipFurtherProcessing; - } + if (!skipFurtherProcessing && log.isTraceEnabled()) + log.trace("exiting processValidations"); + return skipFurtherProcessing; + } } diff --git a/plugins/jsf/src/main/java/org/apache/struts2/jsf/RestoreViewInterceptor.java b/plugins/jsf/src/main/java/org/apache/struts2/jsf/RestoreViewInterceptor.java index e77bfb1fb..91dfd5e0c 100644 --- a/plugins/jsf/src/main/java/org/apache/struts2/jsf/RestoreViewInterceptor.java +++ b/plugins/jsf/src/main/java/org/apache/struts2/jsf/RestoreViewInterceptor.java @@ -1,19 +1,22 @@ /* * $Id$ * - * Copyright 2006 The Apache Software Foundation. + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at + * http://www.apache.org/licenses/LICENSE-2.0 * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. */ package org.apache.struts2.jsf; @@ -41,7 +44,7 @@ public class RestoreViewInterceptor extends FacesInterceptor { /** * Restore View (JSF.2.2.1) - * + * * @param viewId * The view id * @param facesContext @@ -115,7 +118,7 @@ public class RestoreViewInterceptor extends FacesInterceptor { * the ValueBinding next time it needs to. I expect this to cause * more similar bugs. TODO : Completely remove or be SURE by default * it's not executed, and it has no more side-effects. - * + * * if (log.isTraceEnabled()) { //Note: DebugUtils Logger must also * be in trace level DebugUtils.traceView(viewCreated ? "Newly * created view" : "Restored view"); } @@ -200,7 +203,7 @@ public class RestoreViewInterceptor extends FacesInterceptor { /** * This is all a hack to work around a spec-bug which will be fixed in * JSF2.0 - * + * * @param parent * @return true if this component is bindingAware (e.g. aliasBean) */ diff --git a/plugins/jsf/src/main/java/org/apache/struts2/jsf/StrutsNavigationHandler.java b/plugins/jsf/src/main/java/org/apache/struts2/jsf/StrutsNavigationHandler.java index 4e8df70cd..dd2a1d43c 100644 --- a/plugins/jsf/src/main/java/org/apache/struts2/jsf/StrutsNavigationHandler.java +++ b/plugins/jsf/src/main/java/org/apache/struts2/jsf/StrutsNavigationHandler.java @@ -1,19 +1,22 @@ /* * $Id$ * - * Copyright 2006 The Apache Software Foundation. + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at + * http://www.apache.org/licenses/LICENSE-2.0 * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. */ package org.apache.struts2.jsf; @@ -32,30 +35,30 @@ import com.opensymphony.xwork2.config.entities.ResultConfig; * NavigationHandler is called. */ public class StrutsNavigationHandler extends NavigationHandler { - + private NavigationHandler parent; - + /** * Creates the handler - * + * * @param handler The old NavigationHandler to possibly delegate to */ public StrutsNavigationHandler(NavigationHandler handler) { this.parent = handler; } - /** - * Stores any outcomes as the result code, failing over to the old + /** + * Stores any outcomes as the result code, failing over to the old * NavigationHandler - * - * @param facesContext The faces context - * @param fromAction The action we are coming from - * @param outcome The String return code - */ - @Override - public void handleNavigation(FacesContext facesContext, String fromAction, String outcome) { - ActionContext ctx = ActionContext.getContext(); - if (outcome != null) { + * + * @param facesContext The faces context + * @param fromAction The action we are coming from + * @param outcome The String return code + */ + @Override + public void handleNavigation(FacesContext facesContext, String fromAction, String outcome) { + ActionContext ctx = ActionContext.getContext(); + if (outcome != null) { ActionConfig config = ctx.getActionInvocation().getProxy().getConfig(); Map results = config.getResults(); @@ -77,7 +80,7 @@ public class StrutsNavigationHandler extends NavigationHandler { // Failing over to parent handler parent.handleNavigation(facesContext, fromAction, outcome); } - } - } + } + } } diff --git a/plugins/jsf/src/main/java/org/apache/struts2/jsf/StrutsVariableResolver.java b/plugins/jsf/src/main/java/org/apache/struts2/jsf/StrutsVariableResolver.java index e513d1ba6..425acc57f 100644 --- a/plugins/jsf/src/main/java/org/apache/struts2/jsf/StrutsVariableResolver.java +++ b/plugins/jsf/src/main/java/org/apache/struts2/jsf/StrutsVariableResolver.java @@ -1,19 +1,22 @@ /* * $Id$ * - * Copyright 2006 The Apache Software Foundation. + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at + * http://www.apache.org/licenses/LICENSE-2.0 * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. */ package org.apache.struts2.jsf; @@ -39,7 +42,7 @@ public class StrutsVariableResolver extends VariableResolver { /** * Constructor - * + * * @param original * Original resolver to delegate to. */ @@ -56,7 +59,7 @@ public class StrutsVariableResolver extends VariableResolver { * name from the value stack. Otherwise it will delegate to the original jsf * resolver. *

    - * + * * @param name * Variable name to be resolved */ @@ -66,7 +69,7 @@ public class StrutsVariableResolver extends VariableResolver { if (STRUTS_VARIABLE_NAME.equals(name)) { return ActionContext.getContext().getActionInvocation().getAction(); } - + Object obj = ActionContext.getContext().getValueStack().findValue(name); if (obj != null) { return obj; diff --git a/plugins/jsf/src/main/java/org/apache/struts2/jsf/UpdateModelValuesInterceptor.java b/plugins/jsf/src/main/java/org/apache/struts2/jsf/UpdateModelValuesInterceptor.java index ea5e838dd..9640c9f5c 100644 --- a/plugins/jsf/src/main/java/org/apache/struts2/jsf/UpdateModelValuesInterceptor.java +++ b/plugins/jsf/src/main/java/org/apache/struts2/jsf/UpdateModelValuesInterceptor.java @@ -1,19 +1,22 @@ /* * $Id$ * - * Copyright 2006 The Apache Software Foundation. + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at + * http://www.apache.org/licenses/LICENSE-2.0 * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. */ package org.apache.struts2.jsf; @@ -30,7 +33,7 @@ public class UpdateModelValuesInterceptor extends FacesInterceptor { /** * Update Model Values (JSF.2.2.4) - * + * * @param viewId * The view id * @param facesContext diff --git a/plugins/pell-multipart/src/main/java/org/apache/struts2/dispatcher/multipart/PellMultiPartRequest.java b/plugins/pell-multipart/src/main/java/org/apache/struts2/dispatcher/multipart/PellMultiPartRequest.java index 0f14840c2..f89c469b2 100644 --- a/plugins/pell-multipart/src/main/java/org/apache/struts2/dispatcher/multipart/PellMultiPartRequest.java +++ b/plugins/pell-multipart/src/main/java/org/apache/struts2/dispatcher/multipart/PellMultiPartRequest.java @@ -1,19 +1,22 @@ /* * $Id$ * - * Copyright 2006 The Apache Software Foundation. + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at + * http://www.apache.org/licenses/LICENSE-2.0 * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. */ package org.apache.struts2.dispatcher.multipart; diff --git a/plugins/plexus/src/main/java/org/apache/struts2/plexus/PlexusFilter.java b/plugins/plexus/src/main/java/org/apache/struts2/plexus/PlexusFilter.java index fb4e060d2..c4ac104ee 100644 --- a/plugins/plexus/src/main/java/org/apache/struts2/plexus/PlexusFilter.java +++ b/plugins/plexus/src/main/java/org/apache/struts2/plexus/PlexusFilter.java @@ -1,19 +1,22 @@ /* * $Id$ * - * Copyright 2006 The Apache Software Foundation. + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at + * http://www.apache.org/licenses/LICENSE-2.0 * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. */ package org.apache.struts2.plexus; diff --git a/plugins/plexus/src/main/java/org/apache/struts2/plexus/PlexusLifecycleListener.java b/plugins/plexus/src/main/java/org/apache/struts2/plexus/PlexusLifecycleListener.java index 90aea4cb9..ad2eac3fc 100644 --- a/plugins/plexus/src/main/java/org/apache/struts2/plexus/PlexusLifecycleListener.java +++ b/plugins/plexus/src/main/java/org/apache/struts2/plexus/PlexusLifecycleListener.java @@ -1,19 +1,22 @@ /* * $Id$ * - * Copyright 2006 The Apache Software Foundation. + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at + * http://www.apache.org/licenses/LICENSE-2.0 * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. */ package org.apache.struts2.plexus; diff --git a/plugins/plexus/src/main/java/org/apache/struts2/plexus/PlexusObjectFactory.java b/plugins/plexus/src/main/java/org/apache/struts2/plexus/PlexusObjectFactory.java index 3fc478f52..5de63dde6 100644 --- a/plugins/plexus/src/main/java/org/apache/struts2/plexus/PlexusObjectFactory.java +++ b/plugins/plexus/src/main/java/org/apache/struts2/plexus/PlexusObjectFactory.java @@ -1,19 +1,22 @@ /* * $Id$ * - * Copyright 2006 The Apache Software Foundation. + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at + * http://www.apache.org/licenses/LICENSE-2.0 * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. */ package org.apache.struts2.plexus; @@ -259,7 +262,7 @@ public class PlexusObjectFactory extends ObjectFactory implements ObjectFactoryI /** * Looks up an object - * + * * @param role The role name * @param extraContext The extra context * @return The object @@ -272,7 +275,7 @@ public class PlexusObjectFactory extends ObjectFactory implements ObjectFactoryI /** * Looks up an object - * + * * @param role The role name * @param roleHint The role hint * @param extraContext The extra context diff --git a/plugins/plexus/src/main/java/org/apache/struts2/plexus/PlexusThreadLocal.java b/plugins/plexus/src/main/java/org/apache/struts2/plexus/PlexusThreadLocal.java index 196e7c16a..8f63e4a45 100644 --- a/plugins/plexus/src/main/java/org/apache/struts2/plexus/PlexusThreadLocal.java +++ b/plugins/plexus/src/main/java/org/apache/struts2/plexus/PlexusThreadLocal.java @@ -1,19 +1,22 @@ /* * $Id$ * - * Copyright 2006 The Apache Software Foundation. + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at + * http://www.apache.org/licenses/LICENSE-2.0 * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. */ package org.apache.struts2.plexus; diff --git a/plugins/plexus/src/main/java/org/apache/struts2/plexus/PlexusUtils.java b/plugins/plexus/src/main/java/org/apache/struts2/plexus/PlexusUtils.java index 45d3629cb..03506cebb 100644 --- a/plugins/plexus/src/main/java/org/apache/struts2/plexus/PlexusUtils.java +++ b/plugins/plexus/src/main/java/org/apache/struts2/plexus/PlexusUtils.java @@ -1,19 +1,22 @@ /* * $Id$ * - * Copyright 2006 The Apache Software Foundation. + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at + * http://www.apache.org/licenses/LICENSE-2.0 * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. */ package org.apache.struts2.plexus; @@ -34,7 +37,7 @@ public class PlexusUtils { /** * Configures the container with the configuration file - * + * * @param pc The plexus container * @param file The file path * @throws PlexusConfigurationResourceException If the plexus configuration can't be loaded diff --git a/plugins/quickstart/src/main/java/org/apache/struts2/Main.java b/plugins/quickstart/src/main/java/org/apache/struts2/Main.java index 4621c58a3..341c4ed7d 100644 --- a/plugins/quickstart/src/main/java/org/apache/struts2/Main.java +++ b/plugins/quickstart/src/main/java/org/apache/struts2/Main.java @@ -1,19 +1,22 @@ /* * $Id$ * - * Copyright 2006 The Apache Software Foundation. + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at + * http://www.apache.org/licenses/LICENSE-2.0 * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. */ package org.apache.struts2; diff --git a/plugins/quickstart/src/main/java/org/apache/struts2/quickstart/Configuration.java b/plugins/quickstart/src/main/java/org/apache/struts2/quickstart/Configuration.java index 2ce54cf44..f8a950e2b 100644 --- a/plugins/quickstart/src/main/java/org/apache/struts2/quickstart/Configuration.java +++ b/plugins/quickstart/src/main/java/org/apache/struts2/quickstart/Configuration.java @@ -1,19 +1,22 @@ /* * $Id$ * - * Copyright 2006 The Apache Software Foundation. + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at + * http://www.apache.org/licenses/LICENSE-2.0 * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. */ package org.apache.struts2.quickstart; @@ -42,9 +45,9 @@ import com.thoughtworks.xstream.XStream; */ public class Configuration implements Serializable { - private static final long serialVersionUID = 9159115401614443449L; + private static final long serialVersionUID = 9159115401614443449L; - String ideaConfig; + String ideaConfig; String extendsConfig; String resolver; Integer port; diff --git a/plugins/quickstart/src/main/java/org/apache/struts2/quickstart/JettyServer.java b/plugins/quickstart/src/main/java/org/apache/struts2/quickstart/JettyServer.java index 3f19c84ad..71de50d6a 100644 --- a/plugins/quickstart/src/main/java/org/apache/struts2/quickstart/JettyServer.java +++ b/plugins/quickstart/src/main/java/org/apache/struts2/quickstart/JettyServer.java @@ -1,19 +1,22 @@ /* * $Id$ * - * Copyright 2006 The Apache Software Foundation. + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at + * http://www.apache.org/licenses/LICENSE-2.0 * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. */ package org.apache.struts2.quickstart; diff --git a/plugins/quickstart/src/main/java/org/apache/struts2/quickstart/Mapping.java b/plugins/quickstart/src/main/java/org/apache/struts2/quickstart/Mapping.java index 1bc2e7b51..c03e397bb 100644 --- a/plugins/quickstart/src/main/java/org/apache/struts2/quickstart/Mapping.java +++ b/plugins/quickstart/src/main/java/org/apache/struts2/quickstart/Mapping.java @@ -1,19 +1,22 @@ /* * $Id$ * - * Copyright 2006 The Apache Software Foundation. + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at + * http://www.apache.org/licenses/LICENSE-2.0 * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. */ package org.apache.struts2.quickstart; diff --git a/plugins/quickstart/src/main/java/org/apache/struts2/quickstart/MultiDirClassLoader.java b/plugins/quickstart/src/main/java/org/apache/struts2/quickstart/MultiDirClassLoader.java index 98f709ed5..db3a1252e 100644 --- a/plugins/quickstart/src/main/java/org/apache/struts2/quickstart/MultiDirClassLoader.java +++ b/plugins/quickstart/src/main/java/org/apache/struts2/quickstart/MultiDirClassLoader.java @@ -1,19 +1,22 @@ /* * $Id$ * - * Copyright 2006 The Apache Software Foundation. + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at + * http://www.apache.org/licenses/LICENSE-2.0 * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. */ package org.apache.struts2.quickstart; diff --git a/plugins/quickstart/src/main/java/org/apache/struts2/quickstart/MultiDirResource.java b/plugins/quickstart/src/main/java/org/apache/struts2/quickstart/MultiDirResource.java index d2c871017..0c2949768 100644 --- a/plugins/quickstart/src/main/java/org/apache/struts2/quickstart/MultiDirResource.java +++ b/plugins/quickstart/src/main/java/org/apache/struts2/quickstart/MultiDirResource.java @@ -1,19 +1,22 @@ /* * $Id$ * - * Copyright 2006 The Apache Software Foundation. + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at + * http://www.apache.org/licenses/LICENSE-2.0 * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. */ package org.apache.struts2.quickstart; @@ -36,10 +39,10 @@ import org.mortbay.util.Resource; /** */ public class MultiDirResource extends Resource { - - private static final long serialVersionUID = -7571068340424106599L; - - MultiWebApplicationContext ctx; + + private static final long serialVersionUID = -7571068340424106599L; + + MultiWebApplicationContext ctx; File[] files; String uri; diff --git a/plugins/quickstart/src/main/java/org/apache/struts2/quickstart/MultiWebApplicationContext.java b/plugins/quickstart/src/main/java/org/apache/struts2/quickstart/MultiWebApplicationContext.java index d262b0ced..73d7dad3b 100644 --- a/plugins/quickstart/src/main/java/org/apache/struts2/quickstart/MultiWebApplicationContext.java +++ b/plugins/quickstart/src/main/java/org/apache/struts2/quickstart/MultiWebApplicationContext.java @@ -1,19 +1,22 @@ /* * $Id$ * - * Copyright 2006 The Apache Software Foundation. + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at + * http://www.apache.org/licenses/LICENSE-2.0 * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. */ package org.apache.struts2.quickstart; @@ -34,9 +37,9 @@ import org.mortbay.util.Resource; */ public class MultiWebApplicationContext extends WebApplicationContext { - private static final long serialVersionUID = -4732081314967099271L; + private static final long serialVersionUID = -4732081314967099271L; - private List pathPriority; + private List pathPriority; private Map paths; private Class resolver; diff --git a/plugins/quickstart/src/main/java/org/apache/struts2/quickstart/QuickStart.java b/plugins/quickstart/src/main/java/org/apache/struts2/quickstart/QuickStart.java index 38800bd0a..490f00455 100644 --- a/plugins/quickstart/src/main/java/org/apache/struts2/quickstart/QuickStart.java +++ b/plugins/quickstart/src/main/java/org/apache/struts2/quickstart/QuickStart.java @@ -1,19 +1,22 @@ /* * $Id$ * - * Copyright 2006 The Apache Software Foundation. + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at + * http://www.apache.org/licenses/LICENSE-2.0 * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. */ package org.apache.struts2.quickstart; diff --git a/plugins/sitegraph/src/main/java/org/apache/struts2/Main.java b/plugins/sitegraph/src/main/java/org/apache/struts2/Main.java index 3a51261ad..ddadfa4b6 100644 --- a/plugins/sitegraph/src/main/java/org/apache/struts2/Main.java +++ b/plugins/sitegraph/src/main/java/org/apache/struts2/Main.java @@ -1,19 +1,22 @@ /* * $Id$ * - * Copyright 2006 The Apache Software Foundation. + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at + * http://www.apache.org/licenses/LICENSE-2.0 * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. */ package org.apache.struts2; diff --git a/plugins/sitegraph/src/main/java/org/apache/struts2/sitegraph/entities/FileBasedView.java b/plugins/sitegraph/src/main/java/org/apache/struts2/sitegraph/entities/FileBasedView.java index b41aaee92..743cc9917 100644 --- a/plugins/sitegraph/src/main/java/org/apache/struts2/sitegraph/entities/FileBasedView.java +++ b/plugins/sitegraph/src/main/java/org/apache/struts2/sitegraph/entities/FileBasedView.java @@ -1,19 +1,22 @@ /* * $Id$ * - * Copyright 2006 The Apache Software Foundation. + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at + * http://www.apache.org/licenses/LICENSE-2.0 * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. */ package org.apache.struts2.sitegraph.entities; @@ -38,7 +41,7 @@ import org.apache.struts2.sitegraph.model.Link; public abstract class FileBasedView implements View { private String name; private String contents; - + private static final Log log = LogFactory.getLog(FileBasedView.class); public FileBasedView(File file) { @@ -83,7 +86,7 @@ public abstract class FileBasedView implements View { protected abstract Pattern getActionPattern(); protected abstract Pattern getFormPattern(); - + protected String readFile(File file) { try { BufferedReader in = new BufferedReader(new FileReader(file)); diff --git a/plugins/sitegraph/src/main/java/org/apache/struts2/sitegraph/entities/JspView.java b/plugins/sitegraph/src/main/java/org/apache/struts2/sitegraph/entities/JspView.java index d0dcc7235..004e4cff4 100644 --- a/plugins/sitegraph/src/main/java/org/apache/struts2/sitegraph/entities/JspView.java +++ b/plugins/sitegraph/src/main/java/org/apache/struts2/sitegraph/entities/JspView.java @@ -1,19 +1,22 @@ /* * $Id$ * - * Copyright 2006 The Apache Software Foundation. + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at + * http://www.apache.org/licenses/LICENSE-2.0 * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. */ package org.apache.struts2.sitegraph.entities; diff --git a/plugins/sitegraph/src/main/java/org/apache/struts2/sitegraph/entities/Target.java b/plugins/sitegraph/src/main/java/org/apache/struts2/sitegraph/entities/Target.java index 4d865bf0b..eb4d3dd98 100644 --- a/plugins/sitegraph/src/main/java/org/apache/struts2/sitegraph/entities/Target.java +++ b/plugins/sitegraph/src/main/java/org/apache/struts2/sitegraph/entities/Target.java @@ -1,19 +1,22 @@ /* * $Id$ * - * Copyright 2006 The Apache Software Foundation. + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at + * http://www.apache.org/licenses/LICENSE-2.0 * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. */ package org.apache.struts2.sitegraph.entities; diff --git a/plugins/sitegraph/src/main/java/org/apache/struts2/sitegraph/entities/VelocityView.java b/plugins/sitegraph/src/main/java/org/apache/struts2/sitegraph/entities/VelocityView.java index 0148b8b22..3cc0719e5 100644 --- a/plugins/sitegraph/src/main/java/org/apache/struts2/sitegraph/entities/VelocityView.java +++ b/plugins/sitegraph/src/main/java/org/apache/struts2/sitegraph/entities/VelocityView.java @@ -1,19 +1,22 @@ /* * $Id$ * - * Copyright 2006 The Apache Software Foundation. + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at + * http://www.apache.org/licenses/LICENSE-2.0 * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. */ package org.apache.struts2.sitegraph.entities; diff --git a/plugins/sitegraph/src/main/java/org/apache/struts2/sitegraph/entities/View.java b/plugins/sitegraph/src/main/java/org/apache/struts2/sitegraph/entities/View.java index 8d03a8102..1ca327064 100644 --- a/plugins/sitegraph/src/main/java/org/apache/struts2/sitegraph/entities/View.java +++ b/plugins/sitegraph/src/main/java/org/apache/struts2/sitegraph/entities/View.java @@ -1,19 +1,22 @@ /* * $Id$ * - * Copyright 2006 The Apache Software Foundation. + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at + * http://www.apache.org/licenses/LICENSE-2.0 * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. */ package org.apache.struts2.sitegraph.entities; diff --git a/plugins/sitegraph/src/main/java/org/apache/struts2/sitegraph/model/ActionNode.java b/plugins/sitegraph/src/main/java/org/apache/struts2/sitegraph/model/ActionNode.java index 64d396391..56bbf03b6 100644 --- a/plugins/sitegraph/src/main/java/org/apache/struts2/sitegraph/model/ActionNode.java +++ b/plugins/sitegraph/src/main/java/org/apache/struts2/sitegraph/model/ActionNode.java @@ -1,19 +1,22 @@ /* * $Id$ * - * Copyright 2006 The Apache Software Foundation. + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at + * http://www.apache.org/licenses/LICENSE-2.0 * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. */ package org.apache.struts2.sitegraph.model; diff --git a/plugins/sitegraph/src/main/java/org/apache/struts2/sitegraph/model/Graph.java b/plugins/sitegraph/src/main/java/org/apache/struts2/sitegraph/model/Graph.java index cd1eb1637..363150512 100644 --- a/plugins/sitegraph/src/main/java/org/apache/struts2/sitegraph/model/Graph.java +++ b/plugins/sitegraph/src/main/java/org/apache/struts2/sitegraph/model/Graph.java @@ -1,19 +1,22 @@ /* * $Id$ * - * Copyright 2006 The Apache Software Foundation. + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at + * http://www.apache.org/licenses/LICENSE-2.0 * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. */ package org.apache.struts2.sitegraph.model; diff --git a/plugins/sitegraph/src/main/java/org/apache/struts2/sitegraph/model/IndentWriter.java b/plugins/sitegraph/src/main/java/org/apache/struts2/sitegraph/model/IndentWriter.java index 58d07c4a5..bea43695a 100644 --- a/plugins/sitegraph/src/main/java/org/apache/struts2/sitegraph/model/IndentWriter.java +++ b/plugins/sitegraph/src/main/java/org/apache/struts2/sitegraph/model/IndentWriter.java @@ -1,19 +1,22 @@ /* * $Id$ * - * Copyright 2006 The Apache Software Foundation. + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at + * http://www.apache.org/licenses/LICENSE-2.0 * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. */ package org.apache.struts2.sitegraph.model; diff --git a/plugins/sitegraph/src/main/java/org/apache/struts2/sitegraph/model/Link.java b/plugins/sitegraph/src/main/java/org/apache/struts2/sitegraph/model/Link.java index 35d4a27f3..d60178c42 100644 --- a/plugins/sitegraph/src/main/java/org/apache/struts2/sitegraph/model/Link.java +++ b/plugins/sitegraph/src/main/java/org/apache/struts2/sitegraph/model/Link.java @@ -1,19 +1,22 @@ /* * $Id$ * - * Copyright 2006 The Apache Software Foundation. + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at + * http://www.apache.org/licenses/LICENSE-2.0 * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. */ package org.apache.struts2.sitegraph.model; diff --git a/plugins/sitegraph/src/main/java/org/apache/struts2/sitegraph/model/Render.java b/plugins/sitegraph/src/main/java/org/apache/struts2/sitegraph/model/Render.java index d07d6b643..7a3fe40c5 100644 --- a/plugins/sitegraph/src/main/java/org/apache/struts2/sitegraph/model/Render.java +++ b/plugins/sitegraph/src/main/java/org/apache/struts2/sitegraph/model/Render.java @@ -1,19 +1,22 @@ /* * $Id$ * - * Copyright 2006 The Apache Software Foundation. + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at + * http://www.apache.org/licenses/LICENSE-2.0 * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. */ package org.apache.struts2.sitegraph.model; diff --git a/plugins/sitegraph/src/main/java/org/apache/struts2/sitegraph/model/SiteGraphNode.java b/plugins/sitegraph/src/main/java/org/apache/struts2/sitegraph/model/SiteGraphNode.java index 43fac948d..7bb8c21b1 100644 --- a/plugins/sitegraph/src/main/java/org/apache/struts2/sitegraph/model/SiteGraphNode.java +++ b/plugins/sitegraph/src/main/java/org/apache/struts2/sitegraph/model/SiteGraphNode.java @@ -1,19 +1,22 @@ /* * $Id$ * - * Copyright 2006 The Apache Software Foundation. + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at + * http://www.apache.org/licenses/LICENSE-2.0 * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. */ package org.apache.struts2.sitegraph.model; diff --git a/plugins/sitegraph/src/main/java/org/apache/struts2/sitegraph/model/SubGraph.java b/plugins/sitegraph/src/main/java/org/apache/struts2/sitegraph/model/SubGraph.java index 25fc6cec7..b5ab30def 100644 --- a/plugins/sitegraph/src/main/java/org/apache/struts2/sitegraph/model/SubGraph.java +++ b/plugins/sitegraph/src/main/java/org/apache/struts2/sitegraph/model/SubGraph.java @@ -1,19 +1,22 @@ /* * $Id$ * - * Copyright 2006 The Apache Software Foundation. + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at + * http://www.apache.org/licenses/LICENSE-2.0 * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. */ package org.apache.struts2.sitegraph.model; diff --git a/plugins/sitegraph/src/main/java/org/apache/struts2/sitegraph/model/ViewNode.java b/plugins/sitegraph/src/main/java/org/apache/struts2/sitegraph/model/ViewNode.java index 26cc7dfde..c813d7191 100644 --- a/plugins/sitegraph/src/main/java/org/apache/struts2/sitegraph/model/ViewNode.java +++ b/plugins/sitegraph/src/main/java/org/apache/struts2/sitegraph/model/ViewNode.java @@ -1,19 +1,22 @@ /* * $Id$ * - * Copyright 2006 The Apache Software Foundation. + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at + * http://www.apache.org/licenses/LICENSE-2.0 * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. */ package org.apache.struts2.sitegraph.model; diff --git a/plugins/sitegraph/src/main/java/org/apache/struts2/sitegraph/renderers/DOTRenderer.java b/plugins/sitegraph/src/main/java/org/apache/struts2/sitegraph/renderers/DOTRenderer.java index f9d24d465..7ac69fa62 100644 --- a/plugins/sitegraph/src/main/java/org/apache/struts2/sitegraph/renderers/DOTRenderer.java +++ b/plugins/sitegraph/src/main/java/org/apache/struts2/sitegraph/renderers/DOTRenderer.java @@ -1,19 +1,22 @@ /* * $Id$ * - * Copyright 2006 The Apache Software Foundation. + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at + * http://www.apache.org/licenses/LICENSE-2.0 * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. */ package org.apache.struts2.sitegraph.renderers; diff --git a/plugins/sitegraph/src/test/java/org/apache/struts2/sitegraph/SiteGraphTest.java b/plugins/sitegraph/src/test/java/org/apache/struts2/sitegraph/SiteGraphTest.java index c1ef2897b..e5393c4d0 100644 --- a/plugins/sitegraph/src/test/java/org/apache/struts2/sitegraph/SiteGraphTest.java +++ b/plugins/sitegraph/src/test/java/org/apache/struts2/sitegraph/SiteGraphTest.java @@ -1,19 +1,22 @@ /* * $Id$ * - * Copyright 2006 The Apache Software Foundation. + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at + * http://www.apache.org/licenses/LICENSE-2.0 * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. */ package org.apache.struts2.sitegraph; @@ -34,7 +37,7 @@ public class SiteGraphTest extends StrutsTestCase { Dispatcher.getInstance().getConfigurationManager().clearConfigurationProviders(); // use the classloader rather than relying on the // working directory being an assumed value when - // running the test: so let's get this class's parent dir + // running the test: so let's get this class's parent dir URL url = ClassLoaderUtil.getResource("org/apache/struts2/sitegraph/struts.xml", SiteGraphTest.class); File file = new File(url.toString().substring(5)); String dir = file.getParent(); diff --git a/plugins/sitemesh/src/main/java/org/apache/struts2/sitemesh/FreeMarkerPageFilter.java b/plugins/sitemesh/src/main/java/org/apache/struts2/sitemesh/FreeMarkerPageFilter.java index aa48d2298..66b81e958 100644 --- a/plugins/sitemesh/src/main/java/org/apache/struts2/sitemesh/FreeMarkerPageFilter.java +++ b/plugins/sitemesh/src/main/java/org/apache/struts2/sitemesh/FreeMarkerPageFilter.java @@ -1,19 +1,22 @@ /* * $Id$ * - * Copyright 2006 The Apache Software Foundation. + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at + * http://www.apache.org/licenses/LICENSE-2.0 * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. */ package org.apache.struts2.sitemesh; @@ -43,9 +46,9 @@ import freemarker.template.Template; /** * Applies FreeMarker-based sitemesh decorators. - * + * * - * + * * The following variables are available to the decorating freemarker page :- *
      *
    • ${title} - content of <title> tag in the decorated page
    • @@ -96,9 +99,9 @@ import freemarker.template.Template; * tm_jee * * - * + * * - * + * * @version $Date$ $Id$ */ public class FreeMarkerPageFilter extends TemplatePageFilter { @@ -106,7 +109,7 @@ public class FreeMarkerPageFilter extends TemplatePageFilter { /** * Applies the decorator, using the relevent contexts - * + * * @param page The page * @param decorator The decorator * @param req The servlet request @@ -118,11 +121,11 @@ public class FreeMarkerPageFilter extends TemplatePageFilter { HttpServletRequest req, HttpServletResponse res, ServletContext servletContext, ActionContext ctx) throws ServletException, IOException { - - String timerKey = "FreemarkerPageFilter_applyDecorator: "; + + String timerKey = "FreemarkerPageFilter_applyDecorator: "; try { - UtilTimerStack.push(timerKey); - + UtilTimerStack.push(timerKey); + FreemarkerManager fmm = FreemarkerManager.getInstance(); // get the configuration and template @@ -150,10 +153,10 @@ public class FreeMarkerPageFilter extends TemplatePageFilter { throw new ServletException(msg, e); } finally { - UtilTimerStack.pop(timerKey); + UtilTimerStack.pop(timerKey); } } - + /** * Returns the locale used for the {@link Configuration#getTemplate(String, Locale)} call. The base implementation * simply returns the locale setting of the action (assuming the action implements {@link LocaleProvider}) or, if @@ -166,5 +169,5 @@ public class FreeMarkerPageFilter extends TemplatePageFilter { return configuration.getLocale(); } } - + } diff --git a/plugins/sitemesh/src/main/java/org/apache/struts2/sitemesh/TemplatePageFilter.java b/plugins/sitemesh/src/main/java/org/apache/struts2/sitemesh/TemplatePageFilter.java index 4a56d2078..cfc98e1c9 100644 --- a/plugins/sitemesh/src/main/java/org/apache/struts2/sitemesh/TemplatePageFilter.java +++ b/plugins/sitemesh/src/main/java/org/apache/struts2/sitemesh/TemplatePageFilter.java @@ -1,19 +1,22 @@ /* * $Id$ * - * Copyright 2006 The Apache Software Foundation. + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at + * http://www.apache.org/licenses/LICENSE-2.0 * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. */ package org.apache.struts2.sitemesh; @@ -44,10 +47,10 @@ import com.opensymphony.xwork2.util.OgnlValueStack; /** * An abstract template page filter that sets up the proper contexts for * template processing. - * + * */ public abstract class TemplatePageFilter extends PageFilter { - + private FilterConfig filterConfig; public void init(FilterConfig filterConfig) { @@ -57,7 +60,7 @@ public abstract class TemplatePageFilter extends PageFilter { /** * Applies the decorator, using the relevent contexts - * + * * @param page The page * @param decorator The decorator * @param req The servlet request @@ -69,11 +72,11 @@ public abstract class TemplatePageFilter extends PageFilter { HttpServletRequest req, HttpServletResponse res, ServletContext servletContext, ActionContext ctx) throws ServletException, IOException; - + /** * Applies the decorator, creating the relevent contexts and delegating to * the extended applyDecorator(). - * + * * @param page The page * @param decorator The decorator * @param req The servlet request @@ -82,7 +85,7 @@ public abstract class TemplatePageFilter extends PageFilter { protected void applyDecorator(Page page, Decorator decorator, HttpServletRequest req, HttpServletResponse res) throws ServletException, IOException { - + ServletContext servletContext = filterConfig.getServletContext(); ActionContext ctx = ServletActionContext.getActionContext(req); if (ctx == null) { @@ -102,7 +105,7 @@ public abstract class TemplatePageFilter extends PageFilter { applyDecorator(page, decorator, req, res, servletContext, ctx); } - + /** * Gets the L18N encoding of the system. The default is UTF-8. */ @@ -118,10 +121,10 @@ public abstract class TemplatePageFilter extends PageFilter { } static class DummyActionInvocation implements ActionInvocation { - - private static final long serialVersionUID = -4808072199157363028L; - - ActionSupport action; + + private static final long serialVersionUID = -4808072199157363028L; + + ActionSupport action; public DummyActionInvocation(ActionSupport action) { this.action = action; diff --git a/plugins/sitemesh/src/main/java/org/apache/struts2/sitemesh/VelocityPageFilter.java b/plugins/sitemesh/src/main/java/org/apache/struts2/sitemesh/VelocityPageFilter.java index 0272ba240..4226ce00b 100644 --- a/plugins/sitemesh/src/main/java/org/apache/struts2/sitemesh/VelocityPageFilter.java +++ b/plugins/sitemesh/src/main/java/org/apache/struts2/sitemesh/VelocityPageFilter.java @@ -1,19 +1,22 @@ /* * $Id$ * - * Copyright 2006 The Apache Software Foundation. + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at + * http://www.apache.org/licenses/LICENSE-2.0 * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. */ package org.apache.struts2.sitemesh; @@ -39,14 +42,14 @@ import com.opensymphony.xwork2.ActionContext; /** * Applies Velocity-based decorators - * + * */ public class VelocityPageFilter extends TemplatePageFilter { private static final Log LOG = LogFactory.getLog(VelocityPageFilter.class); /** * Applies the decorator, using the relevent contexts - * + * * @param page The page * @param decorator The decorator * @param req The servlet request diff --git a/plugins/tiles/src/main/java/org/apache/struts2/tiles/StrutsTilesListener.java b/plugins/tiles/src/main/java/org/apache/struts2/tiles/StrutsTilesListener.java index 3831d07d7..20b169a6b 100644 --- a/plugins/tiles/src/main/java/org/apache/struts2/tiles/StrutsTilesListener.java +++ b/plugins/tiles/src/main/java/org/apache/struts2/tiles/StrutsTilesListener.java @@ -1,19 +1,22 @@ /* - * $Id: StrutsSpringObjectFactory.java 439747 2006-09-03 09:22:46Z mrdon $ + * $Id: $ * - * Copyright 2006 The Apache Software Foundation. + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at + * http://www.apache.org/licenses/LICENSE-2.0 * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. */ package org.apache.struts2.tiles; diff --git a/plugins/tiles/src/main/java/org/apache/struts2/tiles/StrutsTilesUtilImpl.java b/plugins/tiles/src/main/java/org/apache/struts2/tiles/StrutsTilesUtilImpl.java index 00b8deb5d..1d6fc7a9f 100644 --- a/plugins/tiles/src/main/java/org/apache/struts2/tiles/StrutsTilesUtilImpl.java +++ b/plugins/tiles/src/main/java/org/apache/struts2/tiles/StrutsTilesUtilImpl.java @@ -1,19 +1,22 @@ /* - * $Id: StrutsSpringObjectFactory.java 439747 2006-09-03 09:22:46Z mrdon $ + * $Id: $ * - * Copyright 2006 The Apache Software Foundation. + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at + * http://www.apache.org/licenses/LICENSE-2.0 * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. */ package org.apache.struts2.tiles; @@ -75,7 +78,7 @@ public class StrutsTilesUtilImpl extends TilesUtilImpl { * @param b whether or not a flush should occur * @throws IOException * @throws ServletException - * @throws Exception + * @throws Exception */ public void doInclude(String string, PageContext pageContext, boolean b) throws Exception { if(string.endsWith(".ftl")) { diff --git a/plugins/tiles/src/main/java/org/apache/struts2/views/tiles/TilesResult.java b/plugins/tiles/src/main/java/org/apache/struts2/views/tiles/TilesResult.java index 9e1b73e31..ae9b6ba64 100644 --- a/plugins/tiles/src/main/java/org/apache/struts2/views/tiles/TilesResult.java +++ b/plugins/tiles/src/main/java/org/apache/struts2/views/tiles/TilesResult.java @@ -1,19 +1,22 @@ /* * $Id$ * - * Copyright 2006 The Apache Software Foundation. + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at + * http://www.apache.org/licenses/LICENSE-2.0 * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. */ package org.apache.struts2.views.tiles; @@ -77,19 +80,19 @@ import com.opensymphony.xwork2.LocaleProvider; */ public class TilesResult extends ServletDispatcherResult { - private static final long serialVersionUID = -3806939435493086243L; + private static final long serialVersionUID = -3806939435493086243L; - private static final Log log = LogFactory.getLog(TilesResult.class); + private static final Log log = LogFactory.getLog(TilesResult.class); protected ActionInvocation invocation; private DefinitionsFactory definitionsFactory; public TilesResult() { - super(); + super(); } - + public TilesResult(String location) { - super(location); + super(location); } /** * Dispatches to the given location. Does its forward via a RequestDispatcher. If the @@ -225,5 +228,5 @@ public class TilesResult extends ServletDispatcherResult { throws Exception { Object pathAttr = null; return (pathAttr != null ? pathAttr.toString() : definition.getPath()); - } + } }