├── .gitignore ├── CONTRIBUTING.md ├── LICENSE ├── README.md ├── archetype ├── archetype-build-file.properties ├── form-jsp-portlet │ ├── pom.xml │ └── src │ │ └── main │ │ └── resources │ │ ├── META-INF │ │ └── maven │ │ │ ├── archetype-metadata.xml │ │ │ └── archetype.xml │ │ └── archetype-resources │ │ ├── build.gradle │ │ ├── pom.xml │ │ └── src │ │ └── main │ │ ├── java │ │ └── portlet1 │ │ │ ├── controller │ │ │ └── UserController.java │ │ │ └── dto │ │ │ └── User.java │ │ ├── resources │ │ ├── content │ │ │ └── portlet1.properties │ │ └── log4j.properties │ │ └── webapp │ │ ├── WEB-INF │ │ ├── liferay-display.xml │ │ ├── liferay-plugin-package.properties │ │ ├── liferay-portlet.xml │ │ ├── portlet.xml │ │ ├── spring-context │ │ │ ├── portlet-application-context.xml │ │ │ └── portlet │ │ │ │ └── portlet1-context.xml │ │ ├── views │ │ │ ├── greeting.jspx │ │ │ └── user.jspx │ │ └── web.xml │ │ └── resources │ │ ├── css │ │ └── main.css │ │ └── images │ │ └── icon.png ├── form-thymeleaf-portlet │ ├── pom.xml │ └── src │ │ └── main │ │ └── resources │ │ ├── META-INF │ │ └── maven │ │ │ ├── archetype-metadata.xml │ │ │ └── archetype.xml │ │ └── archetype-resources │ │ ├── build.gradle │ │ ├── pom.xml │ │ └── src │ │ └── main │ │ ├── java │ │ └── portlet1 │ │ │ ├── controller │ │ │ └── UserController.java │ │ │ └── dto │ │ │ └── User.java │ │ ├── resources │ │ ├── content │ │ │ └── portlet1.properties │ │ └── log4j.properties │ │ └── webapp │ │ ├── WEB-INF │ │ ├── liferay-display.xml │ │ ├── liferay-plugin-package.properties │ │ ├── liferay-portlet.xml │ │ ├── portlet.xml │ │ ├── spring-context │ │ │ ├── portlet-application-context.xml │ │ │ └── portlet │ │ │ │ └── portlet1-context.xml │ │ ├── views │ │ │ ├── greeting.html │ │ │ └── user.html │ │ └── web.xml │ │ └── resources │ │ ├── css │ │ └── main.css │ │ └── images │ │ └── icon.png └── pom.xml ├── demo ├── applicant-jsp-portlet │ ├── pom.xml │ └── src │ │ └── main │ │ ├── java │ │ └── com │ │ │ └── liferay │ │ │ └── portletmvc4spring │ │ │ └── demo │ │ │ └── applicant │ │ │ └── jsp │ │ │ ├── controller │ │ │ ├── ApplicantController.java │ │ │ ├── AttachmentManager.java │ │ │ ├── HelpController.java │ │ │ ├── PreferencesController.java │ │ │ └── TermsController.java │ │ │ ├── dto │ │ │ ├── Applicant.java │ │ │ ├── Attachment.java │ │ │ ├── City.java │ │ │ ├── Preferences.java │ │ │ ├── Province.java │ │ │ └── TransientUpload.java │ │ │ ├── portlet │ │ │ └── ApplicantPortlet.java │ │ │ ├── service │ │ │ ├── CityService.java │ │ │ ├── ProvinceService.java │ │ │ └── mock │ │ │ │ ├── CityServiceMockImpl.java │ │ │ │ └── ProvinceServiceMockImpl.java │ │ │ └── servlet │ │ │ └── AttachmentSessionListener.java │ │ ├── resources │ │ ├── ValidationMessages.properties │ │ ├── content │ │ │ └── portlet1.properties │ │ └── log4j.properties │ │ └── webapp │ │ ├── WEB-INF │ │ ├── liferay-display.xml │ │ ├── liferay-plugin-package.properties │ │ ├── liferay-portlet.xml │ │ ├── portlet.xml │ │ ├── spring-context │ │ │ ├── portlet-application-context.xml │ │ │ └── portlet │ │ │ │ └── portlet1-context.xml │ │ ├── views │ │ │ ├── acceptance.jspx │ │ │ ├── applicant.jspx │ │ │ ├── confirmation.jspx │ │ │ ├── help.jspx │ │ │ ├── preferences.jspx │ │ │ └── terms.jspx │ │ └── web.xml │ │ ├── icon.png │ │ └── images │ │ ├── icon-delete.png │ │ └── icon-help.png ├── applicant-thymeleaf-portlet │ ├── pom.xml │ └── src │ │ └── main │ │ ├── java │ │ └── com │ │ │ └── liferay │ │ │ └── portletmvc4spring │ │ │ └── demo │ │ │ └── applicant │ │ │ └── thymeleaf │ │ │ ├── controller │ │ │ ├── ApplicantController.java │ │ │ ├── AttachmentManager.java │ │ │ ├── ControllerUtil.java │ │ │ ├── HelpController.java │ │ │ ├── PreferencesController.java │ │ │ └── TermsController.java │ │ │ ├── dto │ │ │ ├── Applicant.java │ │ │ ├── Attachment.java │ │ │ ├── City.java │ │ │ ├── Preferences.java │ │ │ ├── Province.java │ │ │ └── TransientUpload.java │ │ │ ├── portlet │ │ │ └── ApplicantPortlet.java │ │ │ ├── service │ │ │ ├── CityService.java │ │ │ ├── ProvinceService.java │ │ │ └── mock │ │ │ │ ├── CityServiceMockImpl.java │ │ │ │ └── ProvinceServiceMockImpl.java │ │ │ └── servlet │ │ │ └── AttachmentSessionListener.java │ │ ├── resources │ │ ├── ValidationMessages.properties │ │ ├── content │ │ │ └── portlet1.properties │ │ └── log4j.properties │ │ └── webapp │ │ ├── WEB-INF │ │ ├── liferay-display.xml │ │ ├── liferay-plugin-package.properties │ │ ├── liferay-portlet.xml │ │ ├── portlet.xml │ │ ├── spring-context │ │ │ ├── portlet-application-context.xml │ │ │ └── portlet │ │ │ │ └── portlet1-context.xml │ │ ├── views │ │ │ ├── acceptance.html │ │ │ ├── applicant.html │ │ │ ├── confirmation.html │ │ │ ├── help.html │ │ │ ├── preferences.html │ │ │ └── terms.html │ │ └── web.xml │ │ ├── icon.png │ │ └── images │ │ ├── icon-delete.png │ │ └── icon-help.png ├── applicant-webflow-portlet │ ├── pom.xml │ └── src │ │ └── main │ │ ├── java │ │ └── com │ │ │ └── liferay │ │ │ └── portletmvc4spring │ │ │ └── demo │ │ │ └── applicant │ │ │ └── webflow │ │ │ ├── actions │ │ │ ├── AutoFillAction.java │ │ │ ├── DeleteAction.java │ │ │ └── UploadAction.java │ │ │ ├── controller │ │ │ └── ApplicantController.java │ │ │ ├── dto │ │ │ ├── Applicant.java │ │ │ ├── Attachment.java │ │ │ ├── City.java │ │ │ ├── Province.java │ │ │ └── TransientUpload.java │ │ │ ├── handler │ │ │ └── ViewFlowHandler.java │ │ │ ├── portlet │ │ │ └── ApplicantPortlet.java │ │ │ ├── service │ │ │ ├── CityService.java │ │ │ ├── ProvinceService.java │ │ │ └── mock │ │ │ │ ├── CityServiceMockImpl.java │ │ │ │ └── ProvinceServiceMockImpl.java │ │ │ └── validators │ │ │ └── ApplicantValidator.java │ │ ├── resources │ │ ├── content │ │ │ └── portlet1.properties │ │ └── log4j.properties │ │ └── webapp │ │ ├── WEB-INF │ │ ├── flows │ │ │ ├── applicantFlow.xml │ │ │ ├── page1.jsp │ │ │ ├── page2.jsp │ │ │ └── page3.jsp │ │ ├── liferay-display.xml │ │ ├── liferay-plugin-package.properties │ │ ├── liferay-portlet.xml │ │ ├── portlet.xml │ │ ├── spring-context │ │ │ ├── portlet-application-context.xml │ │ │ └── portlet │ │ │ │ └── portlet1-context.xml │ │ └── web.xml │ │ └── images │ │ ├── icon-delete.png │ │ └── icon-help.png └── pom.xml ├── fix-versions.pl ├── framework ├── pom.xml └── src │ ├── main │ ├── asciidoc │ │ └── portletmvc4spring.adoc │ ├── java │ │ ├── com │ │ │ └── liferay │ │ │ │ └── portletmvc4spring │ │ │ │ ├── DispatcherPortlet.java │ │ │ │ ├── FrameworkPortlet.java │ │ │ │ ├── GenericPortletBean.java │ │ │ │ ├── HandlerAdapter.java │ │ │ │ ├── HandlerExceptionResolver.java │ │ │ │ ├── HandlerExecutionChain.java │ │ │ │ ├── HandlerInterceptor.java │ │ │ │ ├── HandlerMapping.java │ │ │ │ ├── ModelAndView.java │ │ │ │ ├── ModelAndViewDefiningException.java │ │ │ │ ├── NoHandlerFoundException.java │ │ │ │ ├── PortletJstlView.java │ │ │ │ ├── PortletLocaleContextResolver.java │ │ │ │ ├── PortletLocaleResolver.java │ │ │ │ ├── ViewRendererServlet.java │ │ │ │ ├── bind │ │ │ │ ├── MissingPortletRequestParameterException.java │ │ │ │ ├── PortletRequestBindingException.java │ │ │ │ ├── PortletRequestDataBinder.java │ │ │ │ ├── PortletRequestParameterPropertyValues.java │ │ │ │ ├── PortletRequestUtils.java │ │ │ │ ├── annotation │ │ │ │ │ ├── ActionMapping.java │ │ │ │ │ ├── EventMapping.java │ │ │ │ │ ├── RenderMapping.java │ │ │ │ │ ├── ResourceMapping.java │ │ │ │ │ ├── package-info.java │ │ │ │ │ └── support │ │ │ │ │ │ └── HandlerMethodResolver.java │ │ │ │ └── package-info.java │ │ │ │ ├── context │ │ │ │ ├── AbstractRefreshablePortletApplicationContext.java │ │ │ │ ├── ConfigurablePortletApplicationContext.java │ │ │ │ ├── PortletApplicationContext.java │ │ │ │ ├── PortletApplicationContextUtils.java │ │ │ │ ├── PortletApplicationObjectSupport.java │ │ │ │ ├── PortletConfigAware.java │ │ │ │ ├── PortletConfigPropertySource.java │ │ │ │ ├── PortletContextAware.java │ │ │ │ ├── PortletContextAwareProcessor.java │ │ │ │ ├── PortletContextPropertySource.java │ │ │ │ ├── PortletContextResource.java │ │ │ │ ├── PortletContextResourceLoader.java │ │ │ │ ├── PortletContextResourcePatternResolver.java │ │ │ │ ├── PortletContextScope.java │ │ │ │ ├── PortletRequestAttributes.java │ │ │ │ ├── PortletRequestHandledEvent.java │ │ │ │ ├── PortletSessionScope.java │ │ │ │ ├── PortletWebRequest.java │ │ │ │ ├── StandardPortletEnvironment.java │ │ │ │ ├── StaticPortletApplicationContext.java │ │ │ │ ├── XmlPortletApplicationContext.java │ │ │ │ └── package-info.java │ │ │ │ ├── handler │ │ │ │ ├── AbstractHandlerExceptionResolver.java │ │ │ │ ├── AbstractHandlerMapping.java │ │ │ │ ├── AbstractMapBasedHandlerMapping.java │ │ │ │ ├── HandlerInterceptorAdapter.java │ │ │ │ ├── ParameterHandlerMapping.java │ │ │ │ ├── ParameterMappingInterceptor.java │ │ │ │ ├── PortletContentGenerator.java │ │ │ │ ├── PortletModeHandlerMapping.java │ │ │ │ ├── PortletModeParameterHandlerMapping.java │ │ │ │ ├── PortletModeParameterLookupKey.java │ │ │ │ ├── PortletRequestMethodNotSupportedException.java │ │ │ │ ├── PortletSessionRequiredException.java │ │ │ │ ├── SimpleMappingExceptionResolver.java │ │ │ │ ├── SimplePortletHandlerAdapter.java │ │ │ │ ├── SimplePortletPostProcessor.java │ │ │ │ ├── UserRoleAuthorizationInterceptor.java │ │ │ │ ├── WebRequestHandlerInterceptorAdapter.java │ │ │ │ └── package-info.java │ │ │ │ ├── multipart │ │ │ │ ├── DefaultMultipartActionRequest.java │ │ │ │ ├── DefaultMultipartResourceRequest.java │ │ │ │ ├── MultipartActionRequest.java │ │ │ │ ├── MultipartResourceRequest.java │ │ │ │ ├── PortletMultipartResolver.java │ │ │ │ ├── StandardPortletMultipartResolver.java │ │ │ │ └── package-info.java │ │ │ │ ├── mvc │ │ │ │ ├── AbstractController.java │ │ │ │ ├── Controller.java │ │ │ │ ├── EventAwareController.java │ │ │ │ ├── ParameterizableViewController.java │ │ │ │ ├── PortletModeNameViewController.java │ │ │ │ ├── PortletWrappingController.java │ │ │ │ ├── ResourceAwareController.java │ │ │ │ ├── SimpleControllerHandlerAdapter.java │ │ │ │ ├── annotation │ │ │ │ │ ├── AnnotationMethodHandlerExceptionResolver.java │ │ │ │ │ ├── DefaultAnnotationHandlerMapping.java │ │ │ │ │ ├── PortletAnnotationMappingUtils.java │ │ │ │ │ └── package-info.java │ │ │ │ ├── method │ │ │ │ │ ├── AbstractPortletHandlerMethodAdapter.java │ │ │ │ │ └── annotation │ │ │ │ │ │ ├── PortletCookieValueMethodArgumentResolver.java │ │ │ │ │ │ ├── PortletInvocableHandlerMethod.java │ │ │ │ │ │ ├── PortletModelAndViewMethodReturnValueHandler.java │ │ │ │ │ │ ├── PortletModelAndViewResolver.java │ │ │ │ │ │ ├── PortletModelAndViewResolverMethodReturnValueHandler.java │ │ │ │ │ │ ├── PortletModelAttributeMethodProcessor.java │ │ │ │ │ │ ├── PortletRequestDataBinderFactory.java │ │ │ │ │ │ ├── PortletRequestMappingHandlerAdapter.java │ │ │ │ │ │ ├── PortletRequestMethodArgumentResolver.java │ │ │ │ │ │ ├── PortletResponseMethodArgumentResolver.java │ │ │ │ │ │ └── RequestResponseBodyAdviceChain.java │ │ │ │ └── package-info.java │ │ │ │ ├── package-info.java │ │ │ │ ├── support │ │ │ │ └── PortletRequestContextUtils.java │ │ │ │ └── util │ │ │ │ ├── PortletContainer.java │ │ │ │ ├── PortletUtils.java │ │ │ │ └── package-info.java │ │ └── overview.html │ └── resources │ │ ├── META-INF │ │ └── LICENSE │ │ └── com │ │ └── liferay │ │ └── portletmvc4spring │ │ └── DispatcherPortlet.properties │ └── test │ ├── java │ └── com │ │ └── liferay │ │ ├── portletmvc4spring │ │ ├── ComplexPortletApplicationContext.java │ │ ├── DispatcherPortletTests.java │ │ ├── GenericPortletBeanTests.java │ │ ├── bind │ │ │ ├── PortletRequestDataBinderTests.java │ │ │ ├── PortletRequestParameterPropertyValuesTests.java │ │ │ └── PortletRequestUtilsTests.java │ │ ├── context │ │ │ ├── AbstractXmlWebApplicationContextTests.java │ │ │ ├── PortletApplicationContextScopeTests.java │ │ │ ├── PortletConfigAwareBean.java │ │ │ ├── PortletContextAwareBean.java │ │ │ ├── PortletContextAwareProcessorTests.java │ │ │ ├── PortletRequestAttributesTests.java │ │ │ ├── PortletWebRequestTests.java │ │ │ └── XmlPortletApplicationContextTests.java │ │ ├── handler │ │ │ ├── ParameterHandlerMappingTests.java │ │ │ ├── ParameterMappingInterceptorTests.java │ │ │ ├── PortletModeHandlerMappingTests.java │ │ │ ├── PortletModeParameterHandlerMappingTests.java │ │ │ ├── SimpleMappingExceptionResolverTests.java │ │ │ └── UserRoleAuthorizationInterceptorTests.java │ │ ├── mvc │ │ │ ├── ParameterizableViewControllerTests.java │ │ │ ├── PortletModeNameViewControllerTests.java │ │ │ ├── PortletWrappingControllerTests.java │ │ │ └── annotation │ │ │ │ ├── AnnotationMethodHandlerExceptionResolverTests.java │ │ │ │ ├── Portlet20AnnotationControllerTests.java │ │ │ │ └── PortletAnnotationControllerTests.java │ │ └── util │ │ │ └── PortletUtilsTests.java │ │ └── spring │ │ ├── beans │ │ └── factory │ │ │ └── xml │ │ │ ├── AbstractBeanFactoryTests.java │ │ │ └── AbstractListableBeanFactoryTests.java │ │ ├── context │ │ ├── ACATester.java │ │ ├── AbstractApplicationContextTests.java │ │ ├── BeanThatBroadcasts.java │ │ ├── BeanThatListens.java │ │ ├── LifecycleContextBean.java │ │ └── TestListener.java │ │ └── tests │ │ ├── Assume.java │ │ ├── TestGroup.java │ │ └── sample │ │ └── beans │ │ ├── AgeHolder.java │ │ ├── Colour.java │ │ ├── DerivedTestBean.java │ │ ├── INestedTestBean.java │ │ ├── IOther.java │ │ ├── ITestBean.java │ │ ├── IndexedTestBean.java │ │ ├── LifecycleBean.java │ │ ├── MustBeInitialized.java │ │ ├── NestedTestBean.java │ │ ├── TestBean.java │ │ └── factory │ │ └── DummyFactory.java │ └── resources │ ├── com │ └── liferay │ │ └── portletmvc4spring │ │ ├── context │ │ └── WEB-INF │ │ │ ├── applicationContext.xml │ │ │ ├── context-messages.properties │ │ │ ├── context-messages_en_GB.properties │ │ │ ├── context-messages_en_US.properties │ │ │ ├── contextInclude.xml │ │ │ ├── empty-portlet.xml │ │ │ ├── more-context-messages.properties │ │ │ ├── myoverride.properties │ │ │ ├── myplaceholder.properties │ │ │ ├── resources │ │ │ ├── messageSource.xml │ │ │ └── themeSource.xml │ │ │ ├── test-messages.properties │ │ │ ├── test-portlet.xml │ │ │ └── test-servlet.xml │ │ └── handler │ │ ├── parameterMapping.xml │ │ ├── portletModeMapping.xml │ │ └── portletModeParameterMapping.xml │ └── log4j.properties ├── pom.xml ├── security ├── pom.xml └── src │ └── main │ ├── java │ ├── com │ │ └── liferay │ │ │ └── portletmvc4spring │ │ │ └── security │ │ │ ├── SpringSecurityPortletConfigurer.java │ │ │ ├── SpringSecurityPortletFilter.java │ │ │ ├── SpringSecurityRequestAdapter.java │ │ │ └── package-info.java │ └── overview.html │ └── resources │ └── META-INF │ └── LICENSE ├── test ├── pom.xml └── src │ └── main │ └── java │ └── com │ └── liferay │ └── portletmvc4spring │ └── test │ └── mock │ └── web │ └── portlet │ ├── MockActionParameters.java │ ├── MockActionRequest.java │ ├── MockActionResponse.java │ ├── MockActionURL.java │ ├── MockBaseURL.java │ ├── MockCacheControl.java │ ├── MockClientDataRequest.java │ ├── MockEvent.java │ ├── MockEventRequest.java │ ├── MockEventResponse.java │ ├── MockMimeResponse.java │ ├── MockMultipartActionRequest.java │ ├── MockMutableActionParameters.java │ ├── MockMutablePortletParameters.java │ ├── MockMutableRenderParameters.java │ ├── MockMutableResourceParameters.java │ ├── MockPortalContext.java │ ├── MockPortletConfig.java │ ├── MockPortletContext.java │ ├── MockPortletParameters.java │ ├── MockPortletPreferences.java │ ├── MockPortletRequest.java │ ├── MockPortletRequestDispatcher.java │ ├── MockPortletResponse.java │ ├── MockPortletSession.java │ ├── MockPortletURL.java │ ├── MockRenderParameters.java │ ├── MockRenderRequest.java │ ├── MockRenderResponse.java │ ├── MockRenderURL.java │ ├── MockResourceParameters.java │ ├── MockResourceRequest.java │ ├── MockResourceResponse.java │ ├── MockResourceURL.java │ ├── MockStateAwareResponse.java │ ├── ServletWrappingPortletContext.java │ └── package-info.java ├── thin ├── pom.xml └── src │ └── main │ ├── java │ └── com │ │ └── liferay │ │ └── portletmvc4spring │ │ └── thin │ │ └── OSGiPortletApplicationContext.java │ └── resources │ └── META-INF │ └── LICENSE └── webflow ├── pom.xml └── src ├── main └── java │ └── com │ └── liferay │ └── portletmvc4spring │ └── webflow │ ├── context │ └── portlet │ │ ├── DefaultFlowUrlHandler.java │ │ ├── FlowUrlHandler.java │ │ ├── PortletContextMap.java │ │ ├── PortletExternalContext.java │ │ ├── PortletRequestMap.java │ │ ├── PortletRequestParameterMap.java │ │ ├── PortletSessionMap.java │ │ └── package-info.java │ └── mvc │ ├── builder │ ├── DelegatingFlowViewResolver.java │ ├── FlowResourceFlowViewResolver.java │ ├── MvcEnvironment.java │ ├── MvcViewFactoryCreator.java │ └── package-info.java │ └── portlet │ ├── AbstractFlowHandler.java │ ├── FlowHandler.java │ ├── FlowHandlerAdapter.java │ ├── PortletMvcView.java │ ├── PortletMvcViewFactory.java │ └── package-info.java └── test └── java └── com └── liferay └── portletmvc4spring └── webflow ├── context └── portlet │ ├── DefaultFlowUrlHandlerTests.java │ ├── PortletContextMapTests.java │ ├── PortletExternalContextTests.java │ ├── PortletRequestMapTests.java │ ├── PortletRequestParameterMapTests.java │ └── PortletSessionMapTests.java └── mvc └── portlet ├── BindBean.java ├── FlowHandlerAdapterTests.java └── PortletMvcViewTests.java /.gitignore: -------------------------------------------------------------------------------- 1 | .classpath 2 | .idea 3 | .project 4 | .settings 5 | target 6 | *.sh 7 | *.iml 8 | *.ipr 9 | *.iws 10 | /.metadata/ 11 | -------------------------------------------------------------------------------- /CONTRIBUTING.md: -------------------------------------------------------------------------------- 1 | # Contributing 2 | 3 | If you contribute code that you have written yourself, then it must be contributed under the same license as the 4 | PortletMVC4Spring project, specifically the [Apache License, Version 2.0](http://www.apache.org/licenses/LICENSE-2.0). 5 | 6 | If you contribute code that you have not written yourself (i.e. copied from elsewhere), then the original license that 7 | governs the contribution must be kept in place. The original license must be clearly referenced in the contribution and 8 | must be compatible with the Apache License, Version 2.0. 9 | 10 | ## Developer Certificate of Origin (DCO) 11 | 12 | Contributions must be received in the form of GitHub pull requests and must adhere to the requirements of the 13 | [DCO](https://developercertificate.org/) by adding a "Signed-off-by" line to commit messages. 14 | 15 | For example: 16 | 17 | Implement feature X. 18 | 19 | Signed-off-by: Developer Name 20 | 21 | Note that Git as has a convenient `-s` command line option that will automatically append the "Signed-off-by" line to 22 | a commit message: 23 | 24 | $ git commit -s -m 'Implement feature X.' 25 | 26 | Pull requests that do not contain the "Signed-off-by" line in commit messages will have their status automatically 27 | set to `failed` by the [GitHub DCO Enforcement Application](https://github.com/apps/dco). 28 | -------------------------------------------------------------------------------- /archetype/archetype-build-file.properties: -------------------------------------------------------------------------------- 1 | @hibernate-version@=6.1.5.Final 2 | @slf4j-log4j-version@=1.7.25 3 | @portlet-api-version@=3.0.0 4 | @portletmvc4spring-version@=5.3.2 5 | @servlet-api-version@=3.1.0 6 | @thymeleaf-version@=3.0.13.RELEASE 7 | @validation-api-version@=2.0.1.Final 8 | -------------------------------------------------------------------------------- /archetype/form-jsp-portlet/pom.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | com.liferay.portletmvc4spring.archetype 6 | com.liferay.portletmvc4spring.archetype.parent 7 | 6.0.0-SNAPSHOT 8 | ../pom.xml 9 | 10 | 4.0.0 11 | com.liferay.portletmvc4spring.archetype.form.jsp.portlet 12 | maven-archetype 13 | Form (JSP) Portlet Archetype 14 | Maven archetype for PortletMVC4Spring with JSP form views 15 | 16 | 17 | 18 | org.apache.maven.archetype 19 | archetype-packaging 20 | 2.4 21 | 22 | 23 | 24 | 25 | maven-archetype-plugin 26 | 2.4 27 | true 28 | 29 | 30 | org.apache.maven.plugins 31 | maven-antrun-plugin 32 | 1.8 33 | 34 | 35 | filter-build-file-properties 36 | process-resources 37 | 38 | run 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | 51 | -------------------------------------------------------------------------------- /archetype/form-jsp-portlet/src/main/resources/META-INF/maven/archetype-metadata.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | src/main/java 7 | 8 | 9 | src/main/resources 10 | 11 | 12 | src/main/webapp 13 | 14 | resources/images/* 15 | WEB-INF/views/* 16 | 17 | 18 | 19 | src/main/webapp 20 | 21 | resources/images/* 22 | WEB-INF/views/* 23 | 24 | 25 | 26 | src/test/java 27 | 28 | 29 | 30 | 31 | build.gradle 32 | 33 | 34 | 35 | 36 | -------------------------------------------------------------------------------- /archetype/form-jsp-portlet/src/main/resources/META-INF/maven/archetype.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | com.liferay.portletmvc4spring.archetype.form.jsp.portlet 5 | 6 | src/main/webapp/WEB-INF/liferay-plugin-package.properties 7 | src/main/webapp/WEB-INF/web.xml 8 | src/main/webapp/WEB-INF/views/view.xhtml 9 | src/main/webapp/WEB-INF/resources/css/main.css 10 | src/main/webapp/WEB-INF/resources/images/icon.png 11 | 12 | 13 | -------------------------------------------------------------------------------- /archetype/form-jsp-portlet/src/main/resources/archetype-resources/build.gradle: -------------------------------------------------------------------------------- 1 | apply plugin: 'war' 2 | 3 | repositories { 4 | mavenCentral() 5 | } 6 | 7 | dependencies { 8 | compile group: 'com.liferay.portletmvc4spring', name: 'com.liferay.portletmvc4spring.framework', version: '@portletmvc4spring-version@' 9 | compile group: 'com.liferay.portletmvc4spring', name: 'com.liferay.portletmvc4spring.security', version: '@portletmvc4spring-version@' 10 | compile group: 'org.slf4j', name: 'slf4j-log4j12', version: '@slf4j-log4j-version@' 11 | compile(group: 'org.hibernate.validator', name: 'hibernate-validator', version: '@hibernate-version@') { 12 | exclude group: 'jakarta.validation', module: 'jakarta.validation-api' 13 | } 14 | providedCompile group: 'jakarta.validation', name: 'jakarta.validation-api', version: "2.0.2" 15 | providedCompile group: 'javax.portlet', name: 'portlet-api', version: '@portlet-api-version@' 16 | } -------------------------------------------------------------------------------- /archetype/form-jsp-portlet/src/main/resources/archetype-resources/src/main/java/portlet1/dto/User.java: -------------------------------------------------------------------------------- 1 | package portlet1.dto; 2 | 3 | import java.io.Serializable; 4 | 5 | import jakarta.validation.constraints.Min; 6 | import jakarta.validation.constraints.NotBlank; 7 | import jakarta.validation.constraints.NotNull; 8 | 9 | public class User implements Serializable { 10 | 11 | private static final long serialVersionUID = 1234273427623725552L; 12 | 13 | @NotBlank 14 | private String firstName; 15 | 16 | @NotBlank 17 | private String lastName; 18 | 19 | public String getFirstName() { 20 | return firstName; 21 | } 22 | 23 | public void setFirstName(String firstName) { 24 | this.firstName = firstName; 25 | } 26 | 27 | public String getLastName() { 28 | return lastName; 29 | } 30 | 31 | public void setLastName(String lastName) { 32 | this.lastName = lastName; 33 | } 34 | } 35 | 36 | -------------------------------------------------------------------------------- /archetype/form-jsp-portlet/src/main/resources/archetype-resources/src/main/resources/content/portlet1.properties: -------------------------------------------------------------------------------- 1 | first-name=First Name 2 | greetings=Greetings, {0} {1}! 3 | javax.portlet.display-name=${artifactId} 4 | javax.portlet.keywords=${artifactId} 5 | javax.portlet.short-title=${artifactId} 6 | javax.portlet.title=${artifactId} 7 | last-name=Last Name 8 | personal-information=Personal Information 9 | submit=Submit 10 | todays-date-is=Today''s date is {0} 11 | -------------------------------------------------------------------------------- /archetype/form-jsp-portlet/src/main/resources/archetype-resources/src/main/resources/log4j.properties: -------------------------------------------------------------------------------- 1 | log4j.rootLogger=INFO, R 2 | log4j.appender.R=org.apache.log4j.ConsoleAppender 3 | log4j.appender.R.layout=org.apache.log4j.PatternLayout 4 | log4j.appender.R.layout.ConversionPattern=%d{ABSOLUTE} %-5p [%c{1}:%L] %m%n 5 | log4j.logger.portlet1=DEBUG 6 | -------------------------------------------------------------------------------- /archetype/form-jsp-portlet/src/main/resources/archetype-resources/src/main/webapp/WEB-INF/liferay-display.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /archetype/form-jsp-portlet/src/main/resources/archetype-resources/src/main/webapp/WEB-INF/liferay-plugin-package.properties: -------------------------------------------------------------------------------- 1 | author=N/A 2 | change-log= 3 | licenses=N/A 4 | liferay-versions=7.1.0+ 5 | long-description= 6 | module-group-id=${groupId} 7 | module-incremental-version=1 8 | name=${artifactId} 9 | page-url= 10 | short-description=my portlet short description 11 | tags=myTag 12 | Bundle-Version: 1.0.0 13 | Import-Package: com.liferay.portal.webserver,com.liferay.portal.kernel.servlet.filters.invoker -------------------------------------------------------------------------------- /archetype/form-jsp-portlet/src/main/resources/archetype-resources/src/main/webapp/WEB-INF/liferay-portlet.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | portlet1 7 | /resources/images/icon.png 8 | false 9 | 10 | 11 | administrator 12 | Administrator 13 | 14 | 15 | guest 16 | Guest 17 | 18 | 19 | power-user 20 | Power User 21 | 22 | 23 | user 24 | User 25 | 26 | 27 | -------------------------------------------------------------------------------- /archetype/form-jsp-portlet/src/main/resources/archetype-resources/src/main/webapp/WEB-INF/portlet.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | portlet1 6 | ${artifactId} 7 | com.liferay.portletmvc4spring.DispatcherPortlet 8 | 9 | contextConfigLocation 10 | /WEB-INF/spring-context/portlet/portlet1-context.xml 11 | 12 | 0 13 | 14 | text/html 15 | view 16 | 17 | content.portlet1 18 | 19 | ${artifactId} 20 | ${artifactId} 21 | ${artifactId} 22 | 23 | 24 | administrator 25 | 26 | 27 | guest 28 | 29 | 30 | power-user 31 | 32 | 33 | user 34 | 35 | 36 | 37 | SpringSecurityPortletFilter 38 | com.liferay.portletmvc4spring.security.SpringSecurityPortletFilter 39 | ACTION_PHASE 40 | RENDER_PHASE 41 | RESOURCE_PHASE 42 | 43 | 44 | SpringSecurityPortletFilter 45 | portlet1 46 | 47 | -------------------------------------------------------------------------------- /archetype/form-jsp-portlet/src/main/resources/archetype-resources/src/main/webapp/WEB-INF/spring-context/portlet-application-context.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | content.portlet1 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | -------------------------------------------------------------------------------- /archetype/form-jsp-portlet/src/main/resources/archetype-resources/src/main/webapp/WEB-INF/spring-context/portlet/portlet1-context.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 12 | 13 | 14 | -------------------------------------------------------------------------------- /archetype/form-jsp-portlet/src/main/resources/archetype-resources/src/main/webapp/WEB-INF/views/greeting.jspx: -------------------------------------------------------------------------------- 1 | 2 | 7 | 8 | 9 | 10 |

11 | 12 |

13 |

14 | 15 |

16 |
17 | -------------------------------------------------------------------------------- /archetype/form-jsp-portlet/src/main/resources/archetype-resources/src/main/webapp/WEB-INF/views/user.jspx: -------------------------------------------------------------------------------- 1 | 2 | 7 | 8 | 9 | 10 | 11 | 12 |

13 | 14 |

15 |
16 |
17 | 18 | 19 | 20 | 21 | 22 |
23 |
24 | 25 | 26 | 27 | 28 | 29 |
30 |
31 |
32 | 33 | 34 |
35 |
36 | -------------------------------------------------------------------------------- /archetype/form-jsp-portlet/src/main/resources/archetype-resources/src/main/webapp/WEB-INF/web.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | contextConfigLocation 6 | /WEB-INF/spring-context/portlet-application-context.xml 7 | 8 | 9 | ViewRendererServlet 10 | com.liferay.portletmvc4spring.ViewRendererServlet 11 | 1 12 | 13 | 14 | ViewRendererServlet 15 | /WEB-INF/servlet/view 16 | 17 | 18 | delegatingFilterProxy 19 | org.springframework.web.filter.DelegatingFilterProxy 20 | 21 | 22 | delegatingFilterProxy 23 | /WEB-INF/servlet/view 24 | FORWARD 25 | INCLUDE 26 | 27 | 28 | org.springframework.web.context.ContextLoaderListener 29 | 30 | -------------------------------------------------------------------------------- /archetype/form-jsp-portlet/src/main/resources/archetype-resources/src/main/webapp/resources/css/main.css: -------------------------------------------------------------------------------- 1 | .user-form .caption { 2 | color: blue; 3 | font-weight: bold; 4 | } 5 | 6 | .user-greeting { 7 | font-weight: bold; 8 | } -------------------------------------------------------------------------------- /archetype/form-jsp-portlet/src/main/resources/archetype-resources/src/main/webapp/resources/images/icon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/liferay/portletmvc4spring/fe84b7b07cd4bc878360a9d83928bb00c1fddd1d/archetype/form-jsp-portlet/src/main/resources/archetype-resources/src/main/webapp/resources/images/icon.png -------------------------------------------------------------------------------- /archetype/form-thymeleaf-portlet/pom.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | com.liferay.portletmvc4spring.archetype 6 | com.liferay.portletmvc4spring.archetype.parent 7 | 6.0.0-SNAPSHOT 8 | ../pom.xml 9 | 10 | 4.0.0 11 | com.liferay.portletmvc4spring.archetype.form.thymeleaf.portlet 12 | maven-archetype 13 | Form (Thymeleaf) Portlet Archetype 14 | Maven archetype for PortletMVC4Spring with Thymeleaf form views 15 | 16 | 17 | 18 | org.apache.maven.archetype 19 | archetype-packaging 20 | 2.4 21 | 22 | 23 | 24 | 25 | maven-archetype-plugin 26 | 2.4 27 | true 28 | 29 | 30 | org.apache.maven.plugins 31 | maven-antrun-plugin 32 | 1.8 33 | 34 | 35 | filter-build-file-properties 36 | process-resources 37 | 38 | run 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | 51 | -------------------------------------------------------------------------------- /archetype/form-thymeleaf-portlet/src/main/resources/META-INF/maven/archetype-metadata.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | src/main/java 7 | 8 | 9 | src/main/resources 10 | 11 | 12 | src/main/webapp 13 | 14 | resources/images/* 15 | WEB-INF/views/* 16 | 17 | 18 | 19 | src/main/webapp 20 | 21 | resources/images/* 22 | WEB-INF/views/* 23 | 24 | 25 | 26 | src/test/java 27 | 28 | 29 | 30 | 31 | build.gradle 32 | 33 | 34 | 35 | 36 | -------------------------------------------------------------------------------- /archetype/form-thymeleaf-portlet/src/main/resources/META-INF/maven/archetype.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | com.liferay.portletmvc4spring.archetype.form.thymeleaf.portlet 5 | 6 | src/main/webapp/WEB-INF/liferay-plugin-package.properties 7 | src/main/webapp/WEB-INF/web.xml 8 | src/main/webapp/WEB-INF/views/view.xhtml 9 | src/main/webapp/WEB-INF/resources/css/main.css 10 | src/main/webapp/WEB-INF/resources/images/icon.png 11 | 12 | 13 | -------------------------------------------------------------------------------- /archetype/form-thymeleaf-portlet/src/main/resources/archetype-resources/build.gradle: -------------------------------------------------------------------------------- 1 | apply plugin: 'war' 2 | 3 | repositories { 4 | mavenCentral() 5 | } 6 | 7 | dependencies { 8 | compile group: 'com.liferay.portletmvc4spring', name: 'com.liferay.portletmvc4spring.framework', version: '@portletmvc4spring-version@' 9 | compile group: 'com.liferay.portletmvc4spring', name: 'com.liferay.portletmvc4spring.security', version: '@portletmvc4spring-version@' 10 | compile(group: 'org.hibernate.validator', name: 'hibernate-validator', version: '@hibernate-version@') { 11 | exclude group: 'jakarta.validation', module: 'jakarta.validation-api' 12 | } 13 | compile group: 'org.slf4j', name: 'slf4j-log4j12', version: '@slf4j-log4j-version@' 14 | compile(group: 'org.thymeleaf', name: 'thymeleaf', version: '@thymeleaf-version') { 15 | exclude group: 'ognl', module: 'ognl' 16 | } 17 | compile group: 'org.thymeleaf', name: 'thymeleaf-spring5', version: '@thymeleaf-version@' 18 | providedCompile group: 'jakarta.validation', name: 'jakarta.validation-api', version: "2.0.2" 19 | providedCompile group: 'javax.portlet', name: 'portlet-api', version: '@portlet-api-version@' 20 | providedCompile group: 'jakarta.servlet', name: 'jakarta.servlet-api', version: '@servlet-api-version@' 21 | } -------------------------------------------------------------------------------- /archetype/form-thymeleaf-portlet/src/main/resources/archetype-resources/src/main/java/portlet1/dto/User.java: -------------------------------------------------------------------------------- 1 | package portlet1.dto; 2 | 3 | import java.io.Serializable; 4 | 5 | import jakarta.validation.constraints.Min; 6 | import jakarta.validation.constraints.NotBlank; 7 | import jakarta.validation.constraints.NotNull; 8 | 9 | public class User implements Serializable { 10 | 11 | private static final long serialVersionUID = 1234273427623725552L; 12 | 13 | @NotBlank 14 | private String firstName; 15 | 16 | @NotBlank 17 | private String lastName; 18 | 19 | public String getFirstName() { 20 | return firstName; 21 | } 22 | 23 | public void setFirstName(String firstName) { 24 | this.firstName = firstName; 25 | } 26 | 27 | public String getLastName() { 28 | return lastName; 29 | } 30 | 31 | public void setLastName(String lastName) { 32 | this.lastName = lastName; 33 | } 34 | } 35 | 36 | -------------------------------------------------------------------------------- /archetype/form-thymeleaf-portlet/src/main/resources/archetype-resources/src/main/resources/content/portlet1.properties: -------------------------------------------------------------------------------- 1 | first-name=First Name 2 | greetings=Greetings, {0} {1}! 3 | javax.portlet.display-name=${artifactId} 4 | javax.portlet.keywords=${artifactId} 5 | javax.portlet.short-title=${artifactId} 6 | javax.portlet.title=${artifactId} 7 | last-name=Last Name 8 | personal-information=Personal Information 9 | submit=Submit 10 | todays-date-is=Today''s date is {0} 11 | -------------------------------------------------------------------------------- /archetype/form-thymeleaf-portlet/src/main/resources/archetype-resources/src/main/resources/log4j.properties: -------------------------------------------------------------------------------- 1 | log4j.rootLogger=INFO, R 2 | log4j.appender.R=org.apache.log4j.ConsoleAppender 3 | log4j.appender.R.layout=org.apache.log4j.PatternLayout 4 | log4j.appender.R.layout.ConversionPattern=%d{ABSOLUTE} %-5p [%c{1}:%L] %m%n 5 | log4j.logger.portlet1=DEBUG 6 | -------------------------------------------------------------------------------- /archetype/form-thymeleaf-portlet/src/main/resources/archetype-resources/src/main/webapp/WEB-INF/liferay-display.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /archetype/form-thymeleaf-portlet/src/main/resources/archetype-resources/src/main/webapp/WEB-INF/liferay-plugin-package.properties: -------------------------------------------------------------------------------- 1 | author=N/A 2 | change-log= 3 | licenses=N/A 4 | liferay-versions=7.1.0+ 5 | long-description= 6 | module-group-id=${groupId} 7 | module-incremental-version=1 8 | name=${artifactId} 9 | page-url= 10 | short-description=my portlet short description 11 | tags=myTag 12 | Bundle-Version: 1.0.0 13 | Import-Package: com.liferay.portal.webserver,com.liferay.portal.kernel.servlet.filters.invoker -------------------------------------------------------------------------------- /archetype/form-thymeleaf-portlet/src/main/resources/archetype-resources/src/main/webapp/WEB-INF/liferay-portlet.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | portlet1 7 | /resources/images/icon.png 8 | false 9 | 10 | 11 | administrator 12 | Administrator 13 | 14 | 15 | guest 16 | Guest 17 | 18 | 19 | power-user 20 | Power User 21 | 22 | 23 | user 24 | User 25 | 26 | 27 | -------------------------------------------------------------------------------- /archetype/form-thymeleaf-portlet/src/main/resources/archetype-resources/src/main/webapp/WEB-INF/portlet.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | portlet1 6 | ${artifactId} 7 | com.liferay.portletmvc4spring.DispatcherPortlet 8 | 9 | contextConfigLocation 10 | /WEB-INF/spring-context/portlet/portlet1-context.xml 11 | 12 | 0 13 | 14 | text/html 15 | view 16 | 17 | content.portlet1 18 | 19 | ${artifactId} 20 | ${artifactId} 21 | ${artifactId} 22 | 23 | 24 | administrator 25 | 26 | 27 | guest 28 | 29 | 30 | power-user 31 | 32 | 33 | user 34 | 35 | 36 | 37 | SpringSecurityPortletFilter 38 | com.liferay.portletmvc4spring.security.SpringSecurityPortletFilter 39 | ACTION_PHASE 40 | RENDER_PHASE 41 | RESOURCE_PHASE 42 | 43 | 44 | SpringSecurityPortletFilter 45 | portlet1 46 | 47 | -------------------------------------------------------------------------------- /archetype/form-thymeleaf-portlet/src/main/resources/archetype-resources/src/main/webapp/WEB-INF/spring-context/portlet-application-context.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | content.portlet1 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | -------------------------------------------------------------------------------- /archetype/form-thymeleaf-portlet/src/main/resources/archetype-resources/src/main/webapp/WEB-INF/spring-context/portlet/portlet1-context.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 12 | 13 | 14 | -------------------------------------------------------------------------------- /archetype/form-thymeleaf-portlet/src/main/resources/archetype-resources/src/main/webapp/WEB-INF/views/greeting.html: -------------------------------------------------------------------------------- 1 | 2 |
3 | 4 |

5 |

6 |

7 | -------------------------------------------------------------------------------- /archetype/form-thymeleaf-portlet/src/main/resources/archetype-resources/src/main/webapp/WEB-INF/views/user.html: -------------------------------------------------------------------------------- 1 | 2 |
3 | 4 |
5 |

6 |

7 |
8 |
12 |
13 |
17 |
18 |
19 | 20 |
21 |
22 | -------------------------------------------------------------------------------- /archetype/form-thymeleaf-portlet/src/main/resources/archetype-resources/src/main/webapp/WEB-INF/web.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | contextConfigLocation 6 | /WEB-INF/spring-context/portlet-application-context.xml 7 | 8 | 9 | ViewRendererServlet 10 | com.liferay.portletmvc4spring.ViewRendererServlet 11 | 1 12 | 13 | 14 | ViewRendererServlet 15 | /WEB-INF/servlet/view 16 | 17 | 18 | delegatingFilterProxy 19 | org.springframework.web.filter.DelegatingFilterProxy 20 | 21 | 22 | delegatingFilterProxy 23 | /WEB-INF/servlet/view 24 | FORWARD 25 | INCLUDE 26 | 27 | 28 | org.springframework.web.context.ContextLoaderListener 29 | 30 | -------------------------------------------------------------------------------- /archetype/form-thymeleaf-portlet/src/main/resources/archetype-resources/src/main/webapp/resources/css/main.css: -------------------------------------------------------------------------------- 1 | .user-form .caption { 2 | color: blue; 3 | font-weight: bold; 4 | } 5 | 6 | .user-greeting { 7 | font-weight: bold; 8 | } -------------------------------------------------------------------------------- /archetype/form-thymeleaf-portlet/src/main/resources/archetype-resources/src/main/webapp/resources/images/icon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/liferay/portletmvc4spring/fe84b7b07cd4bc878360a9d83928bb00c1fddd1d/archetype/form-thymeleaf-portlet/src/main/resources/archetype-resources/src/main/webapp/resources/images/icon.png -------------------------------------------------------------------------------- /archetype/pom.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | com.liferay.portletmvc4spring 6 | com.liferay.portletmvc4spring.parent 7 | 6.0.0-SNAPSHOT 8 | ../pom.xml 9 | 10 | 4.0.0 11 | com.liferay.portletmvc4spring.archetype 12 | com.liferay.portletmvc4spring.archetype.parent 13 | pom 14 | PortletMVC4Spring Archetypes 15 | 16 | form-jsp-portlet 17 | form-thymeleaf-portlet 18 | 19 | 20 | 21 | 22 | org.apache.maven.plugins 23 | maven-javadoc-plugin 24 | 25 | true 26 | 27 | 28 | 29 | 30 | -------------------------------------------------------------------------------- /demo/applicant-jsp-portlet/src/main/java/com/liferay/portletmvc4spring/demo/applicant/jsp/controller/HelpController.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (c) 2000-2020 the original author or authors. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package com.liferay.portletmvc4spring.demo.applicant.jsp.controller; 17 | 18 | import org.springframework.stereotype.Controller; 19 | 20 | import org.springframework.web.bind.annotation.RequestMapping; 21 | 22 | import com.liferay.portletmvc4spring.bind.annotation.RenderMapping; 23 | 24 | 25 | /** 26 | * @author Neil Griffin 27 | */ 28 | @Controller 29 | @RequestMapping("HELP") 30 | public class HelpController { 31 | 32 | @RenderMapping 33 | public String determineView() { 34 | return "help"; 35 | } 36 | } 37 | -------------------------------------------------------------------------------- /demo/applicant-jsp-portlet/src/main/java/com/liferay/portletmvc4spring/demo/applicant/jsp/dto/Attachment.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (c) 2000-2020 the original author or authors. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package com.liferay.portletmvc4spring.demo.applicant.jsp.dto; 17 | 18 | import java.io.File; 19 | import java.io.Serializable; 20 | 21 | 22 | /** 23 | * @author Neil Griffin 24 | */ 25 | public class Attachment implements Serializable { 26 | 27 | private static final long serialVersionUID = 1234897562376324261L; 28 | 29 | private File file; 30 | 31 | public Attachment(File file) { 32 | this.file = file; 33 | } 34 | 35 | public File getFile() { 36 | return file; 37 | } 38 | 39 | public String getName() { 40 | return file.getName(); 41 | } 42 | 43 | public long getSize() { 44 | return file.length(); 45 | } 46 | } 47 | -------------------------------------------------------------------------------- /demo/applicant-jsp-portlet/src/main/java/com/liferay/portletmvc4spring/demo/applicant/jsp/dto/City.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (c) 2000-2020 the original author or authors. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package com.liferay.portletmvc4spring.demo.applicant.jsp.dto; 17 | 18 | import java.io.Serializable; 19 | 20 | 21 | /** 22 | * This is a bean that represents a City, and implements the Transfer Object (formerly known as ValueObject/VO) design 23 | * pattern. 24 | * 25 | * @author "Neil Griffin" 26 | */ 27 | public class City implements Serializable { 28 | 29 | // serialVersionUID 30 | private static final long serialVersionUID = 3312342177113327761L; 31 | 32 | // JavaBean Properties 33 | private long cityId; 34 | private String cityName; 35 | private String postalCode; 36 | private long provinceId; 37 | 38 | public City(long cityId, long provinceId, String cityName, String postalCode) { 39 | this.cityId = cityId; 40 | this.provinceId = provinceId; 41 | this.cityName = cityName; 42 | this.postalCode = postalCode; 43 | } 44 | 45 | public long getCityId() { 46 | return cityId; 47 | } 48 | 49 | public String getCityName() { 50 | return cityName; 51 | } 52 | 53 | public String getPostalCode() { 54 | return postalCode; 55 | } 56 | 57 | public long getProvinceId() { 58 | return provinceId; 59 | } 60 | } 61 | -------------------------------------------------------------------------------- /demo/applicant-jsp-portlet/src/main/java/com/liferay/portletmvc4spring/demo/applicant/jsp/dto/Preferences.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (c) 2000-2020 the original author or authors. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package com.liferay.portletmvc4spring.demo.applicant.jsp.dto; 17 | 18 | import jakarta.validation.constraints.NotNull; 19 | import jakarta.validation.constraints.Pattern; 20 | 21 | 22 | /** 23 | * @author Neil Griffin 24 | */ 25 | public class Preferences { 26 | 27 | @NotNull 28 | @Pattern(regexp = "\\S+", message = "Value is required") 29 | // @NotBlank - Requires validation-api-2.0 30 | private String datePattern; 31 | 32 | public Preferences() { 33 | } 34 | 35 | public Preferences(String datePattern) { 36 | this.datePattern = datePattern; 37 | } 38 | 39 | public String getDatePattern() { 40 | return datePattern; 41 | } 42 | 43 | public void setDatePattern(String datePattern) { 44 | this.datePattern = datePattern; 45 | } 46 | } 47 | -------------------------------------------------------------------------------- /demo/applicant-jsp-portlet/src/main/java/com/liferay/portletmvc4spring/demo/applicant/jsp/dto/Province.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (c) 2000-2020 the original author or authors. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package com.liferay.portletmvc4spring.demo.applicant.jsp.dto; 17 | 18 | import java.io.Serializable; 19 | 20 | 21 | /** 22 | * This is a bean that represents a Province, and implements the Transfer Object (formerly known as ValueObject/VO) 23 | * design pattern. 24 | * 25 | * @author "Neil Griffin" 26 | */ 27 | public class Province implements Serializable { 28 | 29 | // serialVersionUID 30 | private static final long serialVersionUID = 2342374742262228819L; 31 | 32 | // JavaBean Properties 33 | private long provinceId; 34 | private String provinceName; 35 | 36 | public Province(long provinceId, String provinceName) { 37 | this.provinceId = provinceId; 38 | this.provinceName = provinceName; 39 | } 40 | 41 | public long getProvinceId() { 42 | return provinceId; 43 | } 44 | 45 | public String getProvinceName() { 46 | return provinceName; 47 | } 48 | } 49 | -------------------------------------------------------------------------------- /demo/applicant-jsp-portlet/src/main/java/com/liferay/portletmvc4spring/demo/applicant/jsp/dto/TransientUpload.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (c) 2000-2020 the original author or authors. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package com.liferay.portletmvc4spring.demo.applicant.jsp.dto; 17 | 18 | import java.util.ArrayList; 19 | import java.util.List; 20 | 21 | import org.springframework.web.multipart.MultipartFile; 22 | 23 | 24 | /** 25 | * @author Neil Griffin 26 | */ 27 | public class TransientUpload { 28 | 29 | private List multipartFiles = new ArrayList<>(); 30 | 31 | public List getMultipartFiles() { 32 | return multipartFiles; 33 | } 34 | 35 | public void setMultipartFiles(List multipartFiles) { 36 | this.multipartFiles = multipartFiles; 37 | } 38 | 39 | } 40 | -------------------------------------------------------------------------------- /demo/applicant-jsp-portlet/src/main/java/com/liferay/portletmvc4spring/demo/applicant/jsp/service/CityService.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (c) 2000-2020 the original author or authors. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package com.liferay.portletmvc4spring.demo.applicant.jsp.service; 17 | 18 | import com.liferay.portletmvc4spring.demo.applicant.jsp.dto.City; 19 | 20 | 21 | /** 22 | * @author Neil Griffin 23 | */ 24 | public interface CityService { 25 | 26 | public City getCityByPostalCode(String postalCode); 27 | } 28 | -------------------------------------------------------------------------------- /demo/applicant-jsp-portlet/src/main/java/com/liferay/portletmvc4spring/demo/applicant/jsp/service/ProvinceService.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (c) 2000-2020 the original author or authors. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package com.liferay.portletmvc4spring.demo.applicant.jsp.service; 17 | 18 | import java.util.List; 19 | 20 | import com.liferay.portletmvc4spring.demo.applicant.jsp.dto.Province; 21 | 22 | 23 | /** 24 | * @author Neil Griffin 25 | */ 26 | public interface ProvinceService { 27 | 28 | public List getAllProvinces(); 29 | 30 | public long getProvinceId(String provinceName); 31 | } 32 | -------------------------------------------------------------------------------- /demo/applicant-jsp-portlet/src/main/resources/ValidationMessages.properties: -------------------------------------------------------------------------------- 1 | # https://github.com/hibernate/hibernate-validator/blob/master/engine/src/main/resources/org/hibernate/validator/ValidationMessages.properties 2 | jakarta.validation.constraints.Email.message=Invalid e-mail address 3 | jakarta.validation.constraints.NotNull.message=Value is required 4 | jakarta.validation.constraints.NotBlank.message=Value is required 5 | -------------------------------------------------------------------------------- /demo/applicant-jsp-portlet/src/main/resources/log4j.properties: -------------------------------------------------------------------------------- 1 | log4j.rootLogger=INFO, R 2 | log4j.appender.R=org.apache.log4j.ConsoleAppender 3 | log4j.appender.R.layout=org.apache.log4j.PatternLayout 4 | log4j.appender.R.layout.ConversionPattern=%d{ABSOLUTE} %-5p [%c{1}:%L] %m%n 5 | log4j.logger.com.liferay.portletmvc4spring.demo.applicant.jsp=DEBUG 6 | -------------------------------------------------------------------------------- /demo/applicant-jsp-portlet/src/main/webapp/WEB-INF/liferay-display.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /demo/applicant-jsp-portlet/src/main/webapp/WEB-INF/liferay-plugin-package.properties: -------------------------------------------------------------------------------- 1 | author=Neil Griffin 2 | change-log= 3 | licenses=Apache License, Version 2.0 4 | liferay-versions=7.1.* 5 | long-description= 6 | module-group-id=liferay 7 | module-incremental-version=1 8 | name=portletmvc4spring-applicant-jsp 9 | page-url=http://www.liferay.com 10 | short-description= 11 | tags= 12 | Import-Package: com.liferay.portal.webserver,com.liferay.portal.kernel.servlet.filters.invoker -------------------------------------------------------------------------------- /demo/applicant-jsp-portlet/src/main/webapp/WEB-INF/liferay-portlet.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | portlet1 7 | /icon.png 8 | false 9 | 10 | 11 | administrator 12 | Administrator 13 | 14 | 15 | guest 16 | Guest 17 | 18 | 19 | power-user 20 | Power User 21 | 22 | 23 | user 24 | User 25 | 26 | -------------------------------------------------------------------------------- /demo/applicant-jsp-portlet/src/main/webapp/WEB-INF/portlet.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | portlet1 6 | com.liferay.portletmvc4spring.demo.applicant.jsp.portlet.ApplicantPortlet 7 | 8 | contextConfigLocation 9 | /WEB-INF/spring-context/portlet/portlet1-context.xml 10 | 11 | 0 12 | 13 | text/html 14 | view 15 | edit 16 | help 17 | 18 | content.portlet1 19 | 20 | 21 | datePattern 22 | MM/dd/yyyy 23 | 24 | 25 | recipientEmailAddress 26 | humanresources@some-company-domain.com 27 | 28 | 29 | 30 | administrator 31 | 32 | 33 | guest 34 | 35 | 36 | power-user 37 | 38 | 39 | user 40 | 41 | 42 | 43 | SpringSecurityPortletFilter 44 | com.liferay.portletmvc4spring.security.SpringSecurityPortletFilter 45 | ACTION_PHASE 46 | RENDER_PHASE 47 | RESOURCE_PHASE 48 | 49 | 50 | SpringSecurityPortletFilter 51 | portlet1 52 | 53 | -------------------------------------------------------------------------------- /demo/applicant-jsp-portlet/src/main/webapp/WEB-INF/spring-context/portlet-application-context.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | content.portlet1 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | -------------------------------------------------------------------------------- /demo/applicant-jsp-portlet/src/main/webapp/WEB-INF/spring-context/portlet/portlet1-context.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 12 | 13 | 14 | 15 | -------------------------------------------------------------------------------- /demo/applicant-jsp-portlet/src/main/webapp/WEB-INF/views/acceptance.jspx: -------------------------------------------------------------------------------- 1 | 2 | 5 | 6 | 7 | 8 | <spring:message code="terms-of-service"/> 9 | 10 | 11 |

12 | 13 |

14 | 15 | 16 | 17 | 18 | 19 | 20 |
21 | -------------------------------------------------------------------------------- /demo/applicant-jsp-portlet/src/main/webapp/WEB-INF/views/confirmation.jspx: -------------------------------------------------------------------------------- 1 | 2 | 7 | 8 |

9 | 12 |

13 |

14 | 15 | 16 |

17 | 18 |
19 |

20 |
21 | -------------------------------------------------------------------------------- /demo/applicant-jsp-portlet/src/main/webapp/WEB-INF/views/help.jspx: -------------------------------------------------------------------------------- 1 | 2 | 5 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /demo/applicant-jsp-portlet/src/main/webapp/WEB-INF/views/preferences.jspx: -------------------------------------------------------------------------------- 1 | 2 | 7 | 8 | 9 | 10 |
11 |
12 | 13 | 14 | 15 | 16 | 17 |
18 |
19 |
20 | 21 | 24 | 27 |
28 |
29 | -------------------------------------------------------------------------------- /demo/applicant-jsp-portlet/src/main/webapp/WEB-INF/views/terms.jspx: -------------------------------------------------------------------------------- 1 | 2 | 6 | 7 | 8 | 9 | <spring:message code="terms-of-service"/> 10 | 11 | 12 |

13 | 14 |

15 |

16 |

    17 |
  • 18 |
  • 19 |
  • 20 |
21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 |

29 |

30 | 31 | ${thisYear} 32 | 33 |

34 | 35 | 36 |
37 | -------------------------------------------------------------------------------- /demo/applicant-jsp-portlet/src/main/webapp/WEB-INF/web.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | contextConfigLocation 6 | /WEB-INF/spring-context/portlet-application-context.xml 7 | 8 | 9 | ViewRendererServlet 10 | com.liferay.portletmvc4spring.ViewRendererServlet 11 | 1 12 | 13 | 14 | ViewRendererServlet 15 | /WEB-INF/servlet/view 16 | 17 | 18 | delegatingFilterProxy 19 | org.springframework.web.filter.DelegatingFilterProxy 20 | 21 | 22 | delegatingFilterProxy 23 | /WEB-INF/servlet/view 24 | FORWARD 25 | INCLUDE 26 | 27 | 28 | org.springframework.web.context.ContextLoaderListener 29 | 30 | -------------------------------------------------------------------------------- /demo/applicant-jsp-portlet/src/main/webapp/icon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/liferay/portletmvc4spring/fe84b7b07cd4bc878360a9d83928bb00c1fddd1d/demo/applicant-jsp-portlet/src/main/webapp/icon.png -------------------------------------------------------------------------------- /demo/applicant-jsp-portlet/src/main/webapp/images/icon-delete.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/liferay/portletmvc4spring/fe84b7b07cd4bc878360a9d83928bb00c1fddd1d/demo/applicant-jsp-portlet/src/main/webapp/images/icon-delete.png -------------------------------------------------------------------------------- /demo/applicant-jsp-portlet/src/main/webapp/images/icon-help.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/liferay/portletmvc4spring/fe84b7b07cd4bc878360a9d83928bb00c1fddd1d/demo/applicant-jsp-portlet/src/main/webapp/images/icon-help.png -------------------------------------------------------------------------------- /demo/applicant-thymeleaf-portlet/src/main/java/com/liferay/portletmvc4spring/demo/applicant/thymeleaf/controller/ControllerUtil.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (c) 2000-2020 the original author or authors. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package com.liferay.portletmvc4spring.demo.applicant.thymeleaf.controller; 17 | 18 | import javax.portlet.MimeResponse; 19 | import javax.portlet.ResourceURL; 20 | 21 | 22 | /** 23 | * @author Neil Griffin 24 | */ 25 | public class ControllerUtil { 26 | 27 | public static ResourceURL createResourceURL(MimeResponse mimeResponse, String resourceID) { 28 | ResourceURL resourceURL = mimeResponse.createResourceURL(); 29 | resourceURL.setResourceID(resourceID); 30 | 31 | return resourceURL; 32 | } 33 | } 34 | -------------------------------------------------------------------------------- /demo/applicant-thymeleaf-portlet/src/main/java/com/liferay/portletmvc4spring/demo/applicant/thymeleaf/controller/HelpController.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (c) 2000-2020 the original author or authors. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package com.liferay.portletmvc4spring.demo.applicant.thymeleaf.controller; 17 | 18 | import org.springframework.stereotype.Controller; 19 | 20 | import org.springframework.web.bind.annotation.RequestMapping; 21 | 22 | import com.liferay.portletmvc4spring.bind.annotation.RenderMapping; 23 | 24 | 25 | /** 26 | * @author Neil Griffin 27 | */ 28 | @Controller 29 | @RequestMapping("HELP") 30 | public class HelpController { 31 | 32 | @RenderMapping 33 | public String determineView() { 34 | return "help"; 35 | } 36 | } 37 | -------------------------------------------------------------------------------- /demo/applicant-thymeleaf-portlet/src/main/java/com/liferay/portletmvc4spring/demo/applicant/thymeleaf/dto/Attachment.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (c) 2000-2020 the original author or authors. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package com.liferay.portletmvc4spring.demo.applicant.thymeleaf.dto; 17 | 18 | import java.io.File; 19 | import java.io.Serializable; 20 | 21 | 22 | /** 23 | * @author Neil Griffin 24 | */ 25 | public class Attachment implements Serializable { 26 | 27 | private static final long serialVersionUID = 1234897562376324261L; 28 | 29 | private File file; 30 | 31 | public Attachment(File file) { 32 | this.file = file; 33 | } 34 | 35 | public File getFile() { 36 | return file; 37 | } 38 | 39 | public String getName() { 40 | return file.getName(); 41 | } 42 | 43 | public long getSize() { 44 | return file.length(); 45 | } 46 | } 47 | -------------------------------------------------------------------------------- /demo/applicant-thymeleaf-portlet/src/main/java/com/liferay/portletmvc4spring/demo/applicant/thymeleaf/dto/City.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (c) 2000-2020 the original author or authors. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package com.liferay.portletmvc4spring.demo.applicant.thymeleaf.dto; 17 | 18 | import java.io.Serializable; 19 | 20 | 21 | /** 22 | * This is a bean that represents a City, and implements the Transfer Object (formerly known as ValueObject/VO) design 23 | * pattern. 24 | * 25 | * @author "Neil Griffin" 26 | */ 27 | public class City implements Serializable { 28 | 29 | // serialVersionUID 30 | private static final long serialVersionUID = 3312342177113327761L; 31 | 32 | // JavaBean Properties 33 | private long cityId; 34 | private String cityName; 35 | private String postalCode; 36 | private long provinceId; 37 | 38 | public City(long cityId, long provinceId, String cityName, String postalCode) { 39 | this.cityId = cityId; 40 | this.provinceId = provinceId; 41 | this.cityName = cityName; 42 | this.postalCode = postalCode; 43 | } 44 | 45 | public long getCityId() { 46 | return cityId; 47 | } 48 | 49 | public String getCityName() { 50 | return cityName; 51 | } 52 | 53 | public String getPostalCode() { 54 | return postalCode; 55 | } 56 | 57 | public long getProvinceId() { 58 | return provinceId; 59 | } 60 | } 61 | -------------------------------------------------------------------------------- /demo/applicant-thymeleaf-portlet/src/main/java/com/liferay/portletmvc4spring/demo/applicant/thymeleaf/dto/Preferences.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (c) 2000-2020 the original author or authors. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package com.liferay.portletmvc4spring.demo.applicant.thymeleaf.dto; 17 | 18 | import jakarta.validation.constraints.NotNull; 19 | import jakarta.validation.constraints.Pattern; 20 | 21 | 22 | /** 23 | * @author Neil Griffin 24 | */ 25 | public class Preferences { 26 | 27 | @NotNull 28 | @Pattern(regexp = "\\S+", message = "Value is required") 29 | // @NotBlank - Requires validation-api-2.0 30 | private String datePattern; 31 | 32 | public Preferences() { 33 | } 34 | 35 | public Preferences(String datePattern) { 36 | this.datePattern = datePattern; 37 | } 38 | 39 | public String getDatePattern() { 40 | return datePattern; 41 | } 42 | 43 | public void setDatePattern(String datePattern) { 44 | this.datePattern = datePattern; 45 | } 46 | } 47 | -------------------------------------------------------------------------------- /demo/applicant-thymeleaf-portlet/src/main/java/com/liferay/portletmvc4spring/demo/applicant/thymeleaf/dto/Province.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (c) 2000-2020 the original author or authors. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package com.liferay.portletmvc4spring.demo.applicant.thymeleaf.dto; 17 | 18 | import java.io.Serializable; 19 | 20 | 21 | /** 22 | * This is a bean that represents a Province, and implements the Transfer Object (formerly known as ValueObject/VO) 23 | * design pattern. 24 | * 25 | * @author "Neil Griffin" 26 | */ 27 | public class Province implements Serializable { 28 | 29 | // serialVersionUID 30 | private static final long serialVersionUID = 2342374742262228819L; 31 | 32 | // JavaBean Properties 33 | private long provinceId; 34 | private String provinceName; 35 | 36 | public Province(long provinceId, String provinceName) { 37 | this.provinceId = provinceId; 38 | this.provinceName = provinceName; 39 | } 40 | 41 | public long getProvinceId() { 42 | return provinceId; 43 | } 44 | 45 | public String getProvinceName() { 46 | return provinceName; 47 | } 48 | } 49 | -------------------------------------------------------------------------------- /demo/applicant-thymeleaf-portlet/src/main/java/com/liferay/portletmvc4spring/demo/applicant/thymeleaf/dto/TransientUpload.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (c) 2000-2020 the original author or authors. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package com.liferay.portletmvc4spring.demo.applicant.thymeleaf.dto; 17 | 18 | import java.util.ArrayList; 19 | import java.util.List; 20 | 21 | import org.springframework.web.multipart.MultipartFile; 22 | 23 | 24 | /** 25 | * @author Neil Griffin 26 | */ 27 | public class TransientUpload { 28 | 29 | private List multipartFiles = new ArrayList<>(); 30 | 31 | public List getMultipartFiles() { 32 | return multipartFiles; 33 | } 34 | 35 | public void setMultipartFiles(List multipartFiles) { 36 | this.multipartFiles = multipartFiles; 37 | } 38 | 39 | } 40 | -------------------------------------------------------------------------------- /demo/applicant-thymeleaf-portlet/src/main/java/com/liferay/portletmvc4spring/demo/applicant/thymeleaf/service/CityService.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (c) 2000-2020 the original author or authors. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package com.liferay.portletmvc4spring.demo.applicant.thymeleaf.service; 17 | 18 | import com.liferay.portletmvc4spring.demo.applicant.thymeleaf.dto.City; 19 | 20 | 21 | /** 22 | * @author Neil Griffin 23 | */ 24 | public interface CityService { 25 | 26 | public City getCityByPostalCode(String postalCode); 27 | } 28 | -------------------------------------------------------------------------------- /demo/applicant-thymeleaf-portlet/src/main/java/com/liferay/portletmvc4spring/demo/applicant/thymeleaf/service/ProvinceService.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (c) 2000-2020 the original author or authors. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package com.liferay.portletmvc4spring.demo.applicant.thymeleaf.service; 17 | 18 | import java.util.List; 19 | 20 | import com.liferay.portletmvc4spring.demo.applicant.thymeleaf.dto.Province; 21 | 22 | 23 | /** 24 | * @author Neil Griffin 25 | */ 26 | public interface ProvinceService { 27 | 28 | public List getAllProvinces(); 29 | 30 | public long getProvinceId(String provinceName); 31 | } 32 | -------------------------------------------------------------------------------- /demo/applicant-thymeleaf-portlet/src/main/resources/ValidationMessages.properties: -------------------------------------------------------------------------------- 1 | # https://github.com/hibernate/hibernate-validator/blob/master/engine/src/main/resources/org/hibernate/validator/ValidationMessages.properties 2 | jakarta.validation.constraints.Email.message=Invalid e-mail address 3 | jakarta.validation.constraints.NotNull.message=Value is required 4 | jakarta.validation.constraints.NotBlank.message=Value is required 5 | -------------------------------------------------------------------------------- /demo/applicant-thymeleaf-portlet/src/main/resources/log4j.properties: -------------------------------------------------------------------------------- 1 | log4j.rootLogger=INFO, R 2 | log4j.appender.R=org.apache.log4j.ConsoleAppender 3 | log4j.appender.R.layout=org.apache.log4j.PatternLayout 4 | log4j.appender.R.layout.ConversionPattern=%d{ABSOLUTE} %-5p [%c{1}:%L] %m%n 5 | log4j.logger.com.liferay.portletmvc4spring.demo.applicant.thymeleaf=DEBUG 6 | -------------------------------------------------------------------------------- /demo/applicant-thymeleaf-portlet/src/main/webapp/WEB-INF/liferay-display.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /demo/applicant-thymeleaf-portlet/src/main/webapp/WEB-INF/liferay-plugin-package.properties: -------------------------------------------------------------------------------- 1 | author=Neil Griffin 2 | change-log= 3 | licenses=Apache License, Version 2.0 4 | liferay-versions=7.1.* 5 | long-description= 6 | module-group-id=liferay 7 | module-incremental-version=1 8 | name=portletmvc4spring-applicant-thymeleaf 9 | page-url=http://www.liferay.com 10 | short-description= 11 | tags= 12 | Import-Package: com.liferay.portal.webserver,com.liferay.portal.kernel.servlet.filters.invoker -------------------------------------------------------------------------------- /demo/applicant-thymeleaf-portlet/src/main/webapp/WEB-INF/liferay-portlet.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | portlet1 7 | /icon.png 8 | false 9 | 10 | 11 | administrator 12 | Administrator 13 | 14 | 15 | guest 16 | Guest 17 | 18 | 19 | power-user 20 | Power User 21 | 22 | 23 | user 24 | User 25 | 26 | -------------------------------------------------------------------------------- /demo/applicant-thymeleaf-portlet/src/main/webapp/WEB-INF/spring-context/portlet/portlet1-context.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 12 | 13 | 14 | 15 | -------------------------------------------------------------------------------- /demo/applicant-thymeleaf-portlet/src/main/webapp/WEB-INF/views/acceptance.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | </head> 6 | <body> 7 | <p th:text="#{thank-you-for-accepting-our-terms-of-service}"/> 8 | <a th:href="${viewTermsAgainResourceURL}" th:text="#{back-to-terms-of-service}"/> 9 | </body> 10 | </html> 11 | -------------------------------------------------------------------------------- /demo/applicant-thymeleaf-portlet/src/main/webapp/WEB-INF/views/confirmation.html: -------------------------------------------------------------------------------- 1 | <?xml version="1.0" encoding="UTF-8"?> 2 | <div xmlns:th="http://www.thymeleaf.org"> 3 | <p th:text="#{thank-you-for-applying-for-a-job-with-our-organization(${applicant.firstName})}"/> 4 | <p> 5 | <form action="#" th:action="${submitAnotherRenderURL}" method="get"> 6 | <input class="btn btn-primary" th:value="#{submit-another-application}" type="submit" /> 7 | </form> 8 | </p> 9 | </div> 10 | -------------------------------------------------------------------------------- /demo/applicant-thymeleaf-portlet/src/main/webapp/WEB-INF/views/help.html: -------------------------------------------------------------------------------- 1 | <?xml version="1.0" encoding="UTF-8"?> 2 | <div xmlns:th="http://www.thymeleaf.org"> 3 | <p th:text="#{portlet-help}"/> 4 | </div> 5 | -------------------------------------------------------------------------------- /demo/applicant-thymeleaf-portlet/src/main/webapp/WEB-INF/views/preferences.html: -------------------------------------------------------------------------------- 1 | <?xml version="1.0" encoding="UTF-8"?> 2 | <div xmlns:th="http://www.thymeleaf.org"> 3 | <form th:id="|${namespace}mainForm|" method="post" th:action="${mainFormActionURL}" th:object="${preferences}"> 4 | <fieldset> 5 | <div class="form-group"> 6 | <label th:for="|${namespace}datePattern|" path="datePattern" th:text="#{date-format}"/> 7 | <input th:id="|${namespace}datePattern|" class="form-control" th:field="*{datePattern}"/> 8 | <span class="portlet-msg-error" th:if="${#fields.hasErrors('datePattern')}" th:errors="*{datePattern}"/> 9 | </div> 10 | </fieldset> 11 | <hr /> 12 | <!--/* The CSRF hidden field is automatically added by Thymeleaf because the th:action attribute is present for the form. */--> 13 | <button class="btn btn-primary" name="action" th:text="#{submit}" type="submit" value="submit"/> 14 | <button class="btn" name="action" th:text="#{reset}" type="submit" value="reset"/> 15 | </form> 16 | </div> 17 | -------------------------------------------------------------------------------- /demo/applicant-thymeleaf-portlet/src/main/webapp/WEB-INF/views/terms.html: -------------------------------------------------------------------------------- 1 | <?xml version="1.0" encoding="UTF-8"?> 2 | <html xmlns:th="http://www.thymeleaf.org"> 3 | <head> 4 | <title th:text="#{terms-of-service}"/> 5 | </head> 6 | <body> 7 | <h1 th:text="#{terms-of-service}"/> 8 | <p> 9 | <ul> 10 | <li th:text="#{terms-of-service-point1}"/> 11 | <li th:text="#{terms-of-service-point2}"/> 12 | <li th:text="#{terms-of-service-point3}"/> 13 | </ul> 14 | <form th:action="${acceptTermsResourceURL}" method="post"> 15 | <!--/* The CSRF hidden field is automatically added by Thymeleaf because the th:action attribute is present for the form. */--> 16 | <input class="btn btn-primary" th:value="#{accept}" type="submit"/> 17 | </form> 18 | </p> 19 | <p> 20 | <span th:text="#{copyright}"/> 21 | <span th:text="${thisYear}"/> 22 | <span th:text="#{all-rights-reserved}"/> 23 | </p> 24 | </body> 25 | </html> 26 | -------------------------------------------------------------------------------- /demo/applicant-thymeleaf-portlet/src/main/webapp/WEB-INF/web.xml: -------------------------------------------------------------------------------- 1 | <?xml version="1.0"?> 2 | 3 | <web-app version="3.1" xmlns="http://xmlns.jcp.org/xml/ns/javaee" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://xmlns.jcp.org/xml/ns/javaee http://xmlns.jcp.org/xml/ns/javaee/web-app_3_1.xsd"> 4 | <context-param> 5 | <param-name>contextConfigLocation</param-name> 6 | <param-value>/WEB-INF/spring-context/portlet-application-context.xml</param-value> 7 | </context-param> 8 | <servlet> 9 | <servlet-name>ViewRendererServlet</servlet-name> 10 | <servlet-class>com.liferay.portletmvc4spring.ViewRendererServlet</servlet-class> 11 | <load-on-startup>1</load-on-startup> 12 | </servlet> 13 | <servlet-mapping> 14 | <servlet-name>ViewRendererServlet</servlet-name> 15 | <url-pattern>/WEB-INF/servlet/view</url-pattern> 16 | </servlet-mapping> 17 | <filter> 18 | <filter-name>delegatingFilterProxy</filter-name> 19 | <filter-class>org.springframework.web.filter.DelegatingFilterProxy</filter-class> 20 | </filter> 21 | <filter-mapping> 22 | <filter-name>delegatingFilterProxy</filter-name> 23 | <url-pattern>/WEB-INF/servlet/view</url-pattern> 24 | <dispatcher>FORWARD</dispatcher> 25 | <dispatcher>INCLUDE</dispatcher> 26 | </filter-mapping> 27 | <listener> 28 | <listener-class>org.springframework.web.context.ContextLoaderListener</listener-class> 29 | </listener> 30 | </web-app> -------------------------------------------------------------------------------- /demo/applicant-thymeleaf-portlet/src/main/webapp/icon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/liferay/portletmvc4spring/fe84b7b07cd4bc878360a9d83928bb00c1fddd1d/demo/applicant-thymeleaf-portlet/src/main/webapp/icon.png -------------------------------------------------------------------------------- /demo/applicant-thymeleaf-portlet/src/main/webapp/images/icon-delete.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/liferay/portletmvc4spring/fe84b7b07cd4bc878360a9d83928bb00c1fddd1d/demo/applicant-thymeleaf-portlet/src/main/webapp/images/icon-delete.png -------------------------------------------------------------------------------- /demo/applicant-thymeleaf-portlet/src/main/webapp/images/icon-help.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/liferay/portletmvc4spring/fe84b7b07cd4bc878360a9d83928bb00c1fddd1d/demo/applicant-thymeleaf-portlet/src/main/webapp/images/icon-help.png -------------------------------------------------------------------------------- /demo/applicant-webflow-portlet/src/main/java/com/liferay/portletmvc4spring/demo/applicant/webflow/actions/AutoFillAction.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (c) 2000-2020 the original author or authors. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package com.liferay.portletmvc4spring.demo.applicant.webflow.actions; 17 | 18 | import org.slf4j.Logger; 19 | import org.slf4j.LoggerFactory; 20 | 21 | import org.springframework.beans.factory.annotation.Autowired; 22 | 23 | import org.springframework.stereotype.Component; 24 | 25 | import org.springframework.webflow.execution.RequestContext; 26 | 27 | import com.liferay.portletmvc4spring.demo.applicant.webflow.dto.Applicant; 28 | import com.liferay.portletmvc4spring.demo.applicant.webflow.dto.City; 29 | import com.liferay.portletmvc4spring.demo.applicant.webflow.service.CityService; 30 | 31 | 32 | /** 33 | * @author Fabian Bouché 34 | */ 35 | @Component 36 | public class AutoFillAction { 37 | 38 | private static final Logger logger = LoggerFactory.getLogger(AutoFillAction.class); 39 | 40 | @Autowired 41 | private CityService cityService; 42 | 43 | public void autoFillCity(Applicant applicant, RequestContext requestContext) { 44 | 45 | logger.debug("Auto Fill City"); 46 | 47 | City city = cityService.getCityByPostalCode(applicant.getPostalCode()); 48 | 49 | if (city != null) { 50 | applicant.setCity(city.getCityName()); 51 | applicant.setProvinceId(city.getProvinceId()); 52 | } 53 | 54 | } 55 | } 56 | -------------------------------------------------------------------------------- /demo/applicant-webflow-portlet/src/main/java/com/liferay/portletmvc4spring/demo/applicant/webflow/actions/DeleteAction.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (c) 2000-2020 the original author or authors. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package com.liferay.portletmvc4spring.demo.applicant.webflow.actions; 17 | 18 | import java.io.File; 19 | 20 | import org.slf4j.Logger; 21 | import org.slf4j.LoggerFactory; 22 | 23 | import org.springframework.stereotype.Component; 24 | 25 | import org.springframework.webflow.execution.RequestContext; 26 | 27 | import com.liferay.portletmvc4spring.demo.applicant.webflow.dto.Applicant; 28 | import com.liferay.portletmvc4spring.webflow.context.portlet.PortletExternalContext; 29 | 30 | 31 | /** 32 | * @author Fabian Bouché 33 | */ 34 | @Component 35 | public class DeleteAction { 36 | 37 | private static final Logger logger = LoggerFactory.getLogger(DeleteAction.class); 38 | 39 | public void deleteAttachment(Applicant applicant, RequestContext requestContext) { 40 | 41 | final PortletExternalContext context = (PortletExternalContext) requestContext.getExternalContext(); 42 | 43 | int attachmentIndex = Integer.valueOf(context.getRequestParameterMap().get("attachmentIndex", "-1")); 44 | 45 | logger.debug("Remove attachment with index {}", attachmentIndex); 46 | 47 | File file = applicant.getAttachments().get(attachmentIndex).getFile(); 48 | 49 | file.delete(); 50 | 51 | applicant.getAttachments().remove(attachmentIndex); 52 | 53 | } 54 | } 55 | -------------------------------------------------------------------------------- /demo/applicant-webflow-portlet/src/main/java/com/liferay/portletmvc4spring/demo/applicant/webflow/dto/Attachment.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (c) 2000-2020 the original author or authors. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package com.liferay.portletmvc4spring.demo.applicant.webflow.dto; 17 | 18 | import java.io.File; 19 | import java.io.Serializable; 20 | 21 | 22 | /** 23 | * @author Neil Griffin 24 | */ 25 | public class Attachment implements Serializable { 26 | 27 | private static final long serialVersionUID = 1234897562376324261L; 28 | 29 | private File file; 30 | 31 | public Attachment(File file) { 32 | this.file = file; 33 | } 34 | 35 | public File getFile() { 36 | return file; 37 | } 38 | 39 | public String getName() { 40 | return file.getName(); 41 | } 42 | 43 | public long getSize() { 44 | return file.length(); 45 | } 46 | 47 | } 48 | -------------------------------------------------------------------------------- /demo/applicant-webflow-portlet/src/main/java/com/liferay/portletmvc4spring/demo/applicant/webflow/dto/City.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (c) 2000-2020 the original author or authors. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package com.liferay.portletmvc4spring.demo.applicant.webflow.dto; 17 | 18 | import java.io.Serializable; 19 | 20 | 21 | /** 22 | * This is a bean that represents a City, and implements the Transfer Object (formerly known as ValueObject/VO) design 23 | * pattern. 24 | * 25 | * @author Neil Griffin 26 | */ 27 | public class City implements Serializable { 28 | 29 | // serialVersionUID 30 | private static final long serialVersionUID = 3312342177113327761L; 31 | 32 | // JavaBean Properties 33 | private long cityId; 34 | private String cityName; 35 | private String postalCode; 36 | private long provinceId; 37 | 38 | public City(long cityId, long provinceId, String cityName, String postalCode) { 39 | this.cityId = cityId; 40 | this.provinceId = provinceId; 41 | this.cityName = cityName; 42 | this.postalCode = postalCode; 43 | } 44 | 45 | public long getCityId() { 46 | return cityId; 47 | } 48 | 49 | public String getCityName() { 50 | return cityName; 51 | } 52 | 53 | public String getPostalCode() { 54 | return postalCode; 55 | } 56 | 57 | public long getProvinceId() { 58 | return provinceId; 59 | } 60 | } 61 | -------------------------------------------------------------------------------- /demo/applicant-webflow-portlet/src/main/java/com/liferay/portletmvc4spring/demo/applicant/webflow/dto/Province.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (c) 2000-2020 the original author or authors. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package com.liferay.portletmvc4spring.demo.applicant.webflow.dto; 17 | 18 | import java.io.Serializable; 19 | 20 | 21 | /** 22 | * This is a bean that represents a Province, and implements the Transfer Object (formerly known as ValueObject/VO) 23 | * design pattern. 24 | * 25 | * @author Neil Griffin 26 | */ 27 | public class Province implements Serializable { 28 | 29 | // serialVersionUID 30 | private static final long serialVersionUID = 2342374742262228819L; 31 | 32 | // JavaBean Properties 33 | private long provinceId; 34 | private String provinceName; 35 | 36 | public Province(long provinceId, String provinceName) { 37 | this.provinceId = provinceId; 38 | this.provinceName = provinceName; 39 | } 40 | 41 | public long getProvinceId() { 42 | return provinceId; 43 | } 44 | 45 | public String getProvinceName() { 46 | return provinceName; 47 | } 48 | } 49 | -------------------------------------------------------------------------------- /demo/applicant-webflow-portlet/src/main/java/com/liferay/portletmvc4spring/demo/applicant/webflow/dto/TransientUpload.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (c) 2000-2020 the original author or authors. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package com.liferay.portletmvc4spring.demo.applicant.webflow.dto; 17 | 18 | import java.io.Serializable; 19 | import java.util.ArrayList; 20 | import java.util.List; 21 | 22 | import org.springframework.web.multipart.MultipartFile; 23 | 24 | 25 | /** 26 | * @author Fabian Bouché 27 | */ 28 | public class TransientUpload implements Serializable { 29 | 30 | private static final long serialVersionUID = 1L; 31 | 32 | private List<MultipartFile> multipartFiles = new ArrayList<>(); 33 | 34 | public List<MultipartFile> getMultipartFiles() { 35 | return multipartFiles; 36 | } 37 | 38 | public void setMultipartFiles(List<MultipartFile> multipartFiles) { 39 | this.multipartFiles = multipartFiles; 40 | } 41 | 42 | } 43 | -------------------------------------------------------------------------------- /demo/applicant-webflow-portlet/src/main/java/com/liferay/portletmvc4spring/demo/applicant/webflow/handler/ViewFlowHandler.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (c) 2000-2020 the original author or authors. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package com.liferay.portletmvc4spring.demo.applicant.webflow.handler; 17 | 18 | import com.liferay.portletmvc4spring.webflow.mvc.portlet.AbstractFlowHandler; 19 | 20 | 21 | /** 22 | * @author Fabian Bouché 23 | */ 24 | public class ViewFlowHandler extends AbstractFlowHandler { 25 | 26 | public String getFlowId() { 27 | return "applicantFlow"; 28 | } 29 | 30 | } 31 | -------------------------------------------------------------------------------- /demo/applicant-webflow-portlet/src/main/java/com/liferay/portletmvc4spring/demo/applicant/webflow/portlet/ApplicantPortlet.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (c) 2000-2020 the original author or authors. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package com.liferay.portletmvc4spring.demo.applicant.webflow.portlet; 17 | 18 | import com.liferay.portletmvc4spring.DispatcherPortlet; 19 | 20 | 21 | /** 22 | * @author Fabian Bouché 23 | */ 24 | public class ApplicantPortlet extends DispatcherPortlet { 25 | 26 | } 27 | -------------------------------------------------------------------------------- /demo/applicant-webflow-portlet/src/main/java/com/liferay/portletmvc4spring/demo/applicant/webflow/service/CityService.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (c) 2000-2020 the original author or authors. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package com.liferay.portletmvc4spring.demo.applicant.webflow.service; 17 | 18 | import com.liferay.portletmvc4spring.demo.applicant.webflow.dto.City; 19 | 20 | 21 | /** 22 | * @author Neil Griffin 23 | */ 24 | public interface CityService { 25 | 26 | public City getCityByPostalCode(String postalCode); 27 | 28 | } 29 | -------------------------------------------------------------------------------- /demo/applicant-webflow-portlet/src/main/java/com/liferay/portletmvc4spring/demo/applicant/webflow/service/ProvinceService.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (c) 2000-2020 the original author or authors. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package com.liferay.portletmvc4spring.demo.applicant.webflow.service; 17 | 18 | import java.util.List; 19 | 20 | import com.liferay.portletmvc4spring.demo.applicant.webflow.dto.Province; 21 | 22 | 23 | /** 24 | * @author Fabian Bouché 25 | */ 26 | public interface ProvinceService { 27 | 28 | public List<Province> getAllProvinces(); 29 | 30 | public long getProvinceId(String provinceName); 31 | } 32 | -------------------------------------------------------------------------------- /demo/applicant-webflow-portlet/src/main/resources/log4j.properties: -------------------------------------------------------------------------------- 1 | log4j.rootLogger=INFO, R 2 | log4j.appender.R=org.apache.log4j.ConsoleAppender 3 | log4j.appender.R.layout=org.apache.log4j.PatternLayout 4 | log4j.appender.R.layout.ConversionPattern=%d{ABSOLUTE} %-5p [%c{1}:%L] %m%n 5 | log4j.logger.com.liferay.portletmvc4spring.demo.applicant.webflow=DEBUG 6 | -------------------------------------------------------------------------------- /demo/applicant-webflow-portlet/src/main/webapp/WEB-INF/flows/applicantFlow.xml: -------------------------------------------------------------------------------- 1 | <?xml version="1.0" encoding="UTF-8"?> 2 | <flow xmlns="http://www.springframework.org/schema/webflow" 3 | xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" 4 | xsi:schemaLocation="http://www.springframework.org/schema/webflow 5 | http://www.springframework.org/schema/webflow/spring-webflow.xsd"> 6 | 7 | <var name="applicant" class="com.liferay.portletmvc4spring.demo.applicant.webflow.dto.Applicant"/> 8 | 9 | <view-state id="page1" model="applicant"> 10 | <on-render> 11 | <evaluate expression="provinceService.getAllProvinces()" result="viewScope.provinces" /> 12 | </on-render> 13 | <transition on="autoFill" to="autoFillCity" validate="false" /> 14 | <transition on="submit" to="page2" /> 15 | </view-state> 16 | 17 | <view-state id="page2" model="applicant"> 18 | <transition on="return" to="page1"/> 19 | <transition on="uploadAttachment" to="uploadAttachment"/> 20 | <transition on="deleteAttachment" to="deleteAttachment"/> 21 | <transition on="submit" to="page3"/> 22 | </view-state> 23 | 24 | <action-state id="uploadAttachment"> 25 | <evaluate expression="uploadAction.uploadFile(applicant, flowRequestContext)"/> 26 | <transition to="page2" /> 27 | </action-state> 28 | 29 | <action-state id="autoFillCity"> 30 | <evaluate expression="autoFillAction.autoFillCity(applicant, flowRequestContext)"/> 31 | <transition to="page1" /> 32 | </action-state> 33 | 34 | <action-state id="deleteAttachment"> 35 | <evaluate expression="deleteAction.deleteAttachment(applicant, flowRequestContext)"/> 36 | <transition to="page2" /> 37 | </action-state> 38 | 39 | <view-state id="page3"> 40 | <transition on="return" to="page2"/> 41 | <transition on="submit" to="applicationEnd"/> 42 | </view-state> 43 | 44 | <end-state id="applicationEnd" /> 45 | 46 | </flow> -------------------------------------------------------------------------------- /demo/applicant-webflow-portlet/src/main/webapp/WEB-INF/flows/page3.jsp: -------------------------------------------------------------------------------- 1 | <?xml version="1.0" encoding="UTF-8"?> 2 | <jsp:root xmlns:c="http://java.sun.com/jsp/jstl/core" 3 | xmlns:form="http://www.springframework.org/tags/form" 4 | xmlns:jsp="http://java.sun.com/JSP/Page" 5 | xmlns:portlet="http://xmlns.jcp.org/portlet_3_0" 6 | xmlns:spring="http://www.springframework.org/tags" 7 | version="2.1"> 8 | 9 | <portlet:renderURL var="returnURL"> 10 | <portlet:param name="execution" value="${flowExecutionKey}" /> 11 | <portlet:param name="_eventId" value="return" /> 12 | </portlet:renderURL> 13 | 14 | <portlet:actionURL var="submitApplicantURL"> 15 | <portlet:param name="execution" value="${flowExecutionKey}" /> 16 | <portlet:param name="_eventId" value="submit" /> 17 | </portlet:actionURL> 18 | 19 | <h2>Applicant Flow - Comments (<c:out value="${flowExecutionKey}" />)</h2> 20 | 21 | <div class="container"> 22 | <form:form id="${namespace}mainForm" method="post" action="${submitApplicantURL}" modelAttribute="applicant"> 23 | <c:if test="${not empty globalInfoMessage}"> 24 | <span class="portlet-msg-info">${globalInfoMessage}</span> 25 | </c:if> 26 | <c:if test="${not empty globalErrorMessage}"> 27 | <span class="portlet-msg-error">${globalErrorMessage}</span> 28 | </c:if> 29 | 30 | <fieldset> 31 | <div class="row"> 32 | <div class="col"> 33 | <div class="form-group"> 34 | <form:label for="${namespace}comments" path="comments"> 35 | <spring:message code="comments" /> 36 | </form:label> 37 | <form:textarea id="${namespace}comments" cssClass="form-control" path="comments"/> 38 | <form:errors path="comments" cssClass="portlet-msg-error"/> 39 | </div> 40 | </div> 41 | </div> 42 | </fieldset> 43 | 44 | <spring:message code="return" var="return" /> 45 | <input class="btn btn-primary" formaction="${returnURL}" value="${return}" type="submit"/> 46 | 47 | <spring:message code="submit" var="submit" /> 48 | <input class="btn btn-primary" value="${submit}" type="submit"/> 49 | </form:form> 50 | </div> 51 | </jsp:root> -------------------------------------------------------------------------------- /demo/applicant-webflow-portlet/src/main/webapp/WEB-INF/liferay-display.xml: -------------------------------------------------------------------------------- 1 | <?xml version="1.0"?> 2 | <!DOCTYPE display PUBLIC "-//Liferay//DTD Display 7.1.0//EN" "http://www.liferay.com/dtd/liferay-display_7_1_0.dtd"> 3 | 4 | <display> 5 | <category name="category.sample"> 6 | <portlet id="portlet1" /> 7 | </category> 8 | </display> -------------------------------------------------------------------------------- /demo/applicant-webflow-portlet/src/main/webapp/WEB-INF/liferay-plugin-package.properties: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/liferay/portletmvc4spring/fe84b7b07cd4bc878360a9d83928bb00c1fddd1d/demo/applicant-webflow-portlet/src/main/webapp/WEB-INF/liferay-plugin-package.properties -------------------------------------------------------------------------------- /demo/applicant-webflow-portlet/src/main/webapp/WEB-INF/liferay-portlet.xml: -------------------------------------------------------------------------------- 1 | <?xml version="1.0"?> 2 | <!DOCTYPE liferay-portlet-app PUBLIC "-//Liferay//DTD Portlet Application 7.1.0//EN" "http://www.liferay.com/dtd/liferay-portlet-app_7_1_0.dtd"> 3 | 4 | <liferay-portlet-app> 5 | <portlet> 6 | <portlet-name>portlet1</portlet-name> 7 | <icon>/icon.png</icon> 8 | <requires-namespaced-parameters>false</requires-namespaced-parameters> 9 | </portlet> 10 | <role-mapper> 11 | <role-name>administrator</role-name> 12 | <role-link>Administrator</role-link> 13 | </role-mapper> 14 | <role-mapper> 15 | <role-name>guest</role-name> 16 | <role-link>Guest</role-link> 17 | </role-mapper> 18 | <role-mapper> 19 | <role-name>power-user</role-name> 20 | <role-link>Power User</role-link> 21 | </role-mapper> 22 | <role-mapper> 23 | <role-name>user</role-name> 24 | <role-link>User</role-link> 25 | </role-mapper> 26 | </liferay-portlet-app> -------------------------------------------------------------------------------- /demo/applicant-webflow-portlet/src/main/webapp/WEB-INF/portlet.xml: -------------------------------------------------------------------------------- 1 | <?xml version="1.0"?> 2 | 3 | <portlet-app xmlns="http://xmlns.jcp.org/xml/ns/portlet" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://xmlns.jcp.org/xml/ns/portlet http://xmlns.jcp.org/xml/ns/portlet/portlet-app_3_0.xsd" version="3.0"> 4 | <portlet> 5 | <portlet-name>portlet1</portlet-name> 6 | <portlet-class>com.liferay.portletmvc4spring.demo.applicant.webflow.portlet.ApplicantPortlet</portlet-class> 7 | <init-param> 8 | <name>contextConfigLocation</name> 9 | <value>/WEB-INF/spring-context/portlet/portlet1-context.xml</value> 10 | </init-param> 11 | <expiration-cache>0</expiration-cache> 12 | <supports> 13 | <mime-type>text/html</mime-type> 14 | <portlet-mode>view</portlet-mode> 15 | <portlet-mode>edit</portlet-mode> 16 | <portlet-mode>help</portlet-mode> 17 | </supports> 18 | <resource-bundle>content.portlet1</resource-bundle> 19 | <security-role-ref> 20 | <role-name>administrator</role-name> 21 | </security-role-ref> 22 | <security-role-ref> 23 | <role-name>guest</role-name> 24 | </security-role-ref> 25 | <security-role-ref> 26 | <role-name>power-user</role-name> 27 | </security-role-ref> 28 | <security-role-ref> 29 | <role-name>user</role-name> 30 | </security-role-ref> 31 | </portlet> 32 | <!-- 33 | <filter> 34 | <filter-name>SpringSecurityPortletFilter</filter-name> 35 | <filter-class>com.liferay.portletmvc4spring.security.SpringSecurityPortletFilter</filter-class> 36 | <lifecycle>ACTION_PHASE</lifecycle> 37 | <lifecycle>RENDER_PHASE</lifecycle> 38 | <lifecycle>RESOURCE_PHASE</lifecycle> 39 | </filter> 40 | <filter-mapping> 41 | <filter-name>SpringSecurityPortletFilter</filter-name> 42 | <portlet-name>portlet1</portlet-name> 43 | </filter-mapping> --> 44 | </portlet-app> -------------------------------------------------------------------------------- /demo/applicant-webflow-portlet/src/main/webapp/WEB-INF/spring-context/portlet-application-context.xml: -------------------------------------------------------------------------------- 1 | <?xml version="1.0"?> 2 | 3 | <beans 4 | xmlns="http://www.springframework.org/schema/beans" 5 | xmlns:context="http://www.springframework.org/schema/context" 6 | xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" 7 | xsi:schemaLocation=" 8 | http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd 9 | http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context.xsd"> 10 | 11 | <context:annotation-config /> 12 | 13 | <bean id="viewResolver" class="org.springframework.web.servlet.view.InternalResourceViewResolver"> 14 | <property name="contentType" value="text/html;charset=UTF-8" /> 15 | <property name="prefix" value="/WEB-INF/flows/" /> 16 | <property name="suffix" value=".jsp" /> 17 | <property name="viewClass" value="com.liferay.portletmvc4spring.PortletJstlView" /> 18 | </bean> 19 | 20 | <!-- Note: The messageSource bean must be defined in the portlet application --> 21 | <!-- context, rather than the specific portlet context. This is because --> 22 | <!-- the PortletMVC4Spring security module will try to lookup the messageSource --> 23 | <!-- bean in the portlet application context. --> 24 | <bean id="messageSource" class="org.springframework.context.support.ResourceBundleMessageSource"> 25 | <property name="basenames"> 26 | <list> 27 | <value>content.portlet1</value> 28 | </list> 29 | </property> 30 | <property name="defaultEncoding" value="UTF-8" /> 31 | </bean> 32 | <bean id="springSecurityPortletConfigurer" class="com.liferay.portletmvc4spring.security.SpringSecurityPortletConfigurer" /> 33 | <bean id="delegatingFilterProxy" class="org.springframework.web.filter.DelegatingFilterProxy"> 34 | <property name="targetBeanName" value="springSecurityFilterChain" /> 35 | </bean> 36 | </beans> -------------------------------------------------------------------------------- /demo/applicant-webflow-portlet/src/main/webapp/WEB-INF/web.xml: -------------------------------------------------------------------------------- 1 | <?xml version="1.0"?> 2 | 3 | <web-app version="3.1" xmlns="http://xmlns.jcp.org/xml/ns/javaee" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://xmlns.jcp.org/xml/ns/javaee http://xmlns.jcp.org/xml/ns/javaee/web-app_3_1.xsd"> 4 | <context-param> 5 | <param-name>contextConfigLocation</param-name> 6 | <param-value>/WEB-INF/spring-context/portlet-application-context.xml</param-value> 7 | </context-param> 8 | <servlet> 9 | <servlet-name>ViewRendererServlet</servlet-name> 10 | <servlet-class>com.liferay.portletmvc4spring.ViewRendererServlet</servlet-class> 11 | <load-on-startup>1</load-on-startup> 12 | </servlet> 13 | <servlet-mapping> 14 | <servlet-name>ViewRendererServlet</servlet-name> 15 | <url-pattern>/WEB-INF/servlet/view</url-pattern> 16 | </servlet-mapping> 17 | <filter> 18 | <filter-name>delegatingFilterProxy</filter-name> 19 | <filter-class>org.springframework.web.filter.DelegatingFilterProxy</filter-class> 20 | </filter> 21 | <filter-mapping> 22 | <filter-name>delegatingFilterProxy</filter-name> 23 | <url-pattern>/WEB-INF/servlet/view</url-pattern> 24 | <dispatcher>FORWARD</dispatcher> 25 | <dispatcher>INCLUDE</dispatcher> 26 | </filter-mapping> 27 | <listener> 28 | <listener-class>org.springframework.web.context.ContextLoaderListener</listener-class> 29 | </listener> 30 | </web-app> -------------------------------------------------------------------------------- /demo/applicant-webflow-portlet/src/main/webapp/images/icon-delete.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/liferay/portletmvc4spring/fe84b7b07cd4bc878360a9d83928bb00c1fddd1d/demo/applicant-webflow-portlet/src/main/webapp/images/icon-delete.png -------------------------------------------------------------------------------- /demo/applicant-webflow-portlet/src/main/webapp/images/icon-help.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/liferay/portletmvc4spring/fe84b7b07cd4bc878360a9d83928bb00c1fddd1d/demo/applicant-webflow-portlet/src/main/webapp/images/icon-help.png -------------------------------------------------------------------------------- /demo/pom.xml: -------------------------------------------------------------------------------- 1 | <?xml version="1.0" encoding="UTF-8"?> 2 | <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> 3 | <parent> 4 | <groupId>com.liferay.portletmvc4spring</groupId> 5 | <artifactId>com.liferay.portletmvc4spring.parent</artifactId> 6 | <version>6.0.0-SNAPSHOT</version> 7 | <relativePath>../pom.xml</relativePath> 8 | </parent> 9 | <packaging>pom</packaging> 10 | <modelVersion>4.0.0</modelVersion> 11 | <groupId>com.liferay.portletmvc4spring.demo</groupId> 12 | <artifactId>com.liferay.portletmvc4spring.demo.parent</artifactId> 13 | <name>PortletMVC4Spring Demo Portlets</name> 14 | <description>PortletMVC4Spring Demo Portlets</description> 15 | <modules> 16 | <module>applicant-jsp-portlet</module> 17 | <module>applicant-thymeleaf-portlet</module> 18 | <module>applicant-webflow-portlet</module> 19 | </modules> 20 | <build> 21 | <plugins> 22 | <plugin> 23 | <groupId>org.apache.maven.plugins</groupId> 24 | <artifactId>maven-javadoc-plugin</artifactId> 25 | <configuration> 26 | <skip>true</skip> 27 | </configuration> 28 | </plugin> 29 | </plugins> 30 | </build> 31 | </project> 32 | -------------------------------------------------------------------------------- /framework/src/main/java/com/liferay/portletmvc4spring/NoHandlerFoundException.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (c) 2000-2020 the original author or authors. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package com.liferay.portletmvc4spring; 17 | 18 | import javax.portlet.PortletException; 19 | import javax.portlet.PortletRequest; 20 | 21 | import org.springframework.core.style.StylerUtils; 22 | 23 | 24 | /** 25 | * Exception to be thrown if DispatcherPortlet is unable to determine a corresponding handler for an incoming portlet 26 | * request. 27 | * 28 | * @author Juergen Hoeller 29 | * @since 3.0.5 30 | */ 31 | @SuppressWarnings("serial") 32 | public class NoHandlerFoundException extends PortletException { 33 | 34 | /** 35 | * Constructor for NoHandlerFoundException. 36 | * 37 | * @param msg the detail message 38 | */ 39 | public NoHandlerFoundException(String msg) { 40 | super(msg); 41 | } 42 | 43 | /** 44 | * Constructor for NoHandlerFoundException. 45 | * 46 | * @param msg the detail message 47 | * @param request the current portlet request, for further context to be included in the exception message 48 | */ 49 | public NoHandlerFoundException(String msg, PortletRequest request) { 50 | super(msg + ": mode '" + request.getPortletMode() + "', phase '" + 51 | request.getAttribute(PortletRequest.LIFECYCLE_PHASE) + "', parameters " + 52 | StylerUtils.style(request.getParameterMap())); 53 | } 54 | 55 | } 56 | -------------------------------------------------------------------------------- /framework/src/main/java/com/liferay/portletmvc4spring/bind/PortletRequestBindingException.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (c) 2000-2020 the original author or authors. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package com.liferay.portletmvc4spring.bind; 17 | 18 | import javax.portlet.PortletException; 19 | 20 | 21 | /** 22 | * Fatal binding exception, thrown when we want to treat binding exceptions as unrecoverable. 23 | * 24 | * @author Juergen Hoeller 25 | * @author John A. Lewis 26 | * @since 2.0 27 | */ 28 | @SuppressWarnings("serial") 29 | public class PortletRequestBindingException extends PortletException { 30 | 31 | /** 32 | * Constructor for PortletRequestBindingException. 33 | * 34 | * @param msg the detail message 35 | */ 36 | public PortletRequestBindingException(String msg) { 37 | super(msg); 38 | } 39 | 40 | /** 41 | * Constructor for PortletRequestBindingException. 42 | * 43 | * @param msg the detail message 44 | * @param cause the root cause 45 | */ 46 | public PortletRequestBindingException(String msg, Throwable cause) { 47 | super(msg, cause); 48 | } 49 | 50 | } 51 | -------------------------------------------------------------------------------- /framework/src/main/java/com/liferay/portletmvc4spring/bind/annotation/EventMapping.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (c) 2000-2020 the original author or authors. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package com.liferay.portletmvc4spring.bind.annotation; 17 | 18 | import java.lang.annotation.Documented; 19 | import java.lang.annotation.ElementType; 20 | import java.lang.annotation.Retention; 21 | import java.lang.annotation.RetentionPolicy; 22 | import java.lang.annotation.Target; 23 | 24 | import org.springframework.web.bind.annotation.Mapping; 25 | 26 | 27 | /** 28 | * Annotation for mapping Portlet event requests onto handler methods. 29 | * 30 | * @author Juergen Hoeller 31 | * @since 3.0 32 | * @see org.springframework.web.bind.annotation.RequestMapping 33 | */ 34 | @Target({ ElementType.METHOD }) 35 | @Retention(RetentionPolicy.RUNTIME) 36 | @Documented 37 | @Mapping 38 | public @interface EventMapping { 39 | 40 | /** 41 | * The name of the event to be handled. This name uniquely identifies an event within a portlet mode. 42 | * 43 | * <p>Typically the local name of the event, but fully qualified names with a "{...}" namespace part will be mapped 44 | * correctly as well. 45 | * 46 | * <p>If not specified, the handler method will be invoked for any event request within its general mapping. 47 | * 48 | * @see javax.portlet.EventRequest#getEvent() 49 | * @see javax.portlet.Event#getName() 50 | */ 51 | String value() default ""; 52 | 53 | } 54 | -------------------------------------------------------------------------------- /framework/src/main/java/com/liferay/portletmvc4spring/bind/annotation/ResourceMapping.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (c) 2000-2020 the original author or authors. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package com.liferay.portletmvc4spring.bind.annotation; 17 | 18 | import java.lang.annotation.Documented; 19 | import java.lang.annotation.ElementType; 20 | import java.lang.annotation.Retention; 21 | import java.lang.annotation.RetentionPolicy; 22 | import java.lang.annotation.Target; 23 | 24 | import org.springframework.web.bind.annotation.Mapping; 25 | 26 | 27 | /** 28 | * Annotation for mapping Portlet resource requests onto handler methods. 29 | * 30 | * @author Juergen Hoeller 31 | * @since 3.0 32 | * @see org.springframework.web.bind.annotation.RequestMapping 33 | */ 34 | @Target({ ElementType.METHOD }) 35 | @Retention(RetentionPolicy.RUNTIME) 36 | @Documented 37 | @Mapping 38 | public @interface ResourceMapping { 39 | 40 | /** 41 | * The id of the resource to be handled. This id uniquely identifies a resource within a portlet mode. 42 | * 43 | * <p>If not specified, the handler method will be invoked for any resource request within its general mapping. 44 | * 45 | * @see javax.portlet.ResourceRequest#getResourceID() 46 | */ 47 | String value() default ""; 48 | 49 | } 50 | -------------------------------------------------------------------------------- /framework/src/main/java/com/liferay/portletmvc4spring/bind/annotation/package-info.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (c) 2000-2020 the original author or authors. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | /** 17 | * Annotations for binding portlet requests to handler methods. 18 | */ 19 | package com.liferay.portletmvc4spring.bind.annotation; 20 | -------------------------------------------------------------------------------- /framework/src/main/java/com/liferay/portletmvc4spring/bind/package-info.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (c) 2000-2020 the original author or authors. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | /** 17 | * Provides Portlet-specific data binding functionality. 18 | */ 19 | package com.liferay.portletmvc4spring.bind; 20 | -------------------------------------------------------------------------------- /framework/src/main/java/com/liferay/portletmvc4spring/context/PortletApplicationContext.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (c) 2000-2020 the original author or authors. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package com.liferay.portletmvc4spring.context; 17 | 18 | import org.springframework.web.context.WebApplicationContext; 19 | 20 | 21 | /** 22 | * @author Neil Griffin 23 | */ 24 | public interface PortletApplicationContext extends WebApplicationContext { 25 | 26 | /** 27 | * Scope identifier for global session scope: "globalSession". Supported in addition to the standard scopes 28 | * "singleton" and "prototype". 29 | */ 30 | String SCOPE_GLOBAL_SESSION = "globalSession"; 31 | } 32 | -------------------------------------------------------------------------------- /framework/src/main/java/com/liferay/portletmvc4spring/context/PortletConfigAware.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (c) 2000-2020 the original author or authors. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package com.liferay.portletmvc4spring.context; 17 | 18 | import javax.portlet.PortletConfig; 19 | 20 | import org.springframework.beans.factory.Aware; 21 | 22 | 23 | /** 24 | * Interface to be implemented by any object that wishes to be notified of the PortletConfig (typically determined by 25 | * the PortletApplicationContext) that it runs in. 26 | * 27 | * @author Juergen Hoeller 28 | * @author Chris Beams 29 | * @since 2.0 30 | * @see PortletContextAware 31 | */ 32 | public interface PortletConfigAware extends Aware { 33 | 34 | /** 35 | * Set the PortletConfigthat this object runs in. 36 | * 37 | * <p>Invoked after population of normal bean properties but before an init callback like InitializingBean's 38 | * afterPropertiesSet or a custom init-method. Invoked after ApplicationContextAware's setApplicationContext. 39 | * 40 | * @param portletConfig PortletConfig object to be used by this object 41 | */ 42 | void setPortletConfig(PortletConfig portletConfig); 43 | 44 | } 45 | -------------------------------------------------------------------------------- /framework/src/main/java/com/liferay/portletmvc4spring/context/PortletConfigPropertySource.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (c) 2000-2020 the original author or authors. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package com.liferay.portletmvc4spring.context; 17 | 18 | import javax.portlet.PortletConfig; 19 | 20 | import org.springframework.core.env.EnumerablePropertySource; 21 | import org.springframework.core.env.PropertySource; 22 | 23 | import org.springframework.util.StringUtils; 24 | 25 | 26 | /** 27 | * {@link PropertySource} that reads init parameters from a {@link PortletConfig} object. 28 | * 29 | * @author Chris Beams 30 | * @since 3.1 31 | * @see PortletContextPropertySource 32 | */ 33 | public class PortletConfigPropertySource extends EnumerablePropertySource<PortletConfig> { 34 | 35 | public PortletConfigPropertySource(String name, PortletConfig portletConfig) { 36 | super(name, portletConfig); 37 | } 38 | 39 | @Override 40 | public String getProperty(String name) { 41 | return this.source.getInitParameter(name); 42 | } 43 | 44 | @Override 45 | public String[] getPropertyNames() { 46 | return StringUtils.toStringArray(this.source.getInitParameterNames()); 47 | } 48 | 49 | } 50 | -------------------------------------------------------------------------------- /framework/src/main/java/com/liferay/portletmvc4spring/context/PortletContextAware.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (c) 2000-2020 the original author or authors. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package com.liferay.portletmvc4spring.context; 17 | 18 | import javax.portlet.PortletContext; 19 | 20 | import org.springframework.beans.factory.Aware; 21 | 22 | 23 | /** 24 | * Interface to be implemented by any object that wishes to be notified of the PortletContext (typically determined by 25 | * the PortletApplicationContext) that it runs in. 26 | * 27 | * @author Juergen Hoeller 28 | * @author William G. Thompson, Jr. 29 | * @author Chris Beams 30 | * @since 2.0 31 | * @see PortletConfigAware 32 | */ 33 | public interface PortletContextAware extends Aware { 34 | 35 | /** 36 | * Set the PortletContext that this object runs in. 37 | * 38 | * <p>Invoked after population of normal bean properties but before an init callback like InitializingBean's 39 | * afterPropertiesSet or a custom init-method. Invoked after ApplicationContextAware's setApplicationContext. 40 | * 41 | * @param portletContext PortletContext object to be used by this object 42 | */ 43 | void setPortletContext(PortletContext portletContext); 44 | 45 | } 46 | -------------------------------------------------------------------------------- /framework/src/main/java/com/liferay/portletmvc4spring/context/PortletContextPropertySource.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (c) 2000-2020 the original author or authors. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package com.liferay.portletmvc4spring.context; 17 | 18 | import javax.portlet.PortletContext; 19 | 20 | import org.springframework.core.env.EnumerablePropertySource; 21 | import org.springframework.core.env.PropertySource; 22 | 23 | import org.springframework.util.StringUtils; 24 | 25 | 26 | /** 27 | * {@link PropertySource} that reads init parameters from a {@link PortletContext} object. 28 | * 29 | * @author Chris Beams 30 | * @since 3.1 31 | * @see PortletConfigPropertySource 32 | */ 33 | public class PortletContextPropertySource extends EnumerablePropertySource<PortletContext> { 34 | 35 | public PortletContextPropertySource(String name, PortletContext portletContext) { 36 | super(name, portletContext); 37 | } 38 | 39 | @Override 40 | public String getProperty(String name) { 41 | return this.source.getInitParameter(name); 42 | } 43 | 44 | @Override 45 | public String[] getPropertyNames() { 46 | return StringUtils.toStringArray(this.source.getInitParameterNames()); 47 | } 48 | 49 | } 50 | -------------------------------------------------------------------------------- /framework/src/main/java/com/liferay/portletmvc4spring/context/package-info.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (c) 2000-2020 the original author or authors. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | /** 17 | * Support for Spring's application context concept in a portlet environment, including ApplicationContext 18 | * implementations and various utility classes. 19 | */ 20 | package com.liferay.portletmvc4spring.context; 21 | -------------------------------------------------------------------------------- /framework/src/main/java/com/liferay/portletmvc4spring/handler/PortletModeParameterLookupKey.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (c) 2000-2020 the original author or authors. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package com.liferay.portletmvc4spring.handler; 17 | 18 | import javax.portlet.PortletMode; 19 | 20 | import org.springframework.util.ObjectUtils; 21 | 22 | 23 | /** 24 | * Internal class used as lookup key, combining PortletMode and parameter value. 25 | * 26 | * @author Juergen Hoeller 27 | */ 28 | class PortletModeParameterLookupKey { 29 | 30 | private final PortletMode mode; 31 | 32 | private final String parameter; 33 | 34 | public PortletModeParameterLookupKey(PortletMode portletMode, String parameter) { 35 | this.mode = portletMode; 36 | this.parameter = parameter; 37 | } 38 | 39 | @Override 40 | public boolean equals(Object other) { 41 | 42 | if (this == other) { 43 | return true; 44 | } 45 | 46 | if (!(other instanceof PortletModeParameterLookupKey)) { 47 | return false; 48 | } 49 | 50 | PortletModeParameterLookupKey otherKey = (PortletModeParameterLookupKey) other; 51 | 52 | return (this.mode.equals(otherKey.mode) && ObjectUtils.nullSafeEquals(this.parameter, otherKey.parameter)); 53 | } 54 | 55 | @Override 56 | public int hashCode() { 57 | return ((this.mode.hashCode() * 29) + ObjectUtils.nullSafeHashCode(this.parameter)); 58 | } 59 | 60 | @Override 61 | public String toString() { 62 | return "Portlet mode '" + this.mode + "', parameter '" + this.parameter + "'"; 63 | } 64 | 65 | } 66 | -------------------------------------------------------------------------------- /framework/src/main/java/com/liferay/portletmvc4spring/handler/PortletSessionRequiredException.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (c) 2000-2020 the original author or authors. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package com.liferay.portletmvc4spring.handler; 17 | 18 | import javax.portlet.PortletException; 19 | 20 | 21 | /** 22 | * Exception thrown when a portlet content generator requires a pre-existing session. 23 | * 24 | * @author John A. Lewis 25 | * @since 2.0 26 | * @see com.liferay.portletmvc4spring.handler.PortletContentGenerator 27 | */ 28 | @SuppressWarnings("serial") 29 | public class PortletSessionRequiredException extends PortletException { 30 | 31 | /** 32 | * Create a new PortletSessionRequiredException. 33 | * 34 | * @param msg the detail message 35 | */ 36 | public PortletSessionRequiredException(String msg) { 37 | super(msg); 38 | } 39 | 40 | } 41 | -------------------------------------------------------------------------------- /framework/src/main/java/com/liferay/portletmvc4spring/handler/package-info.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (c) 2000-2020 the original author or authors. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | /** 17 | * Provides standard HandlerMapping implementations, including abstract base classes for custom implementations. 18 | */ 19 | package com.liferay.portletmvc4spring.handler; 20 | -------------------------------------------------------------------------------- /framework/src/main/java/com/liferay/portletmvc4spring/multipart/MultipartActionRequest.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (c) 2000-2020 the original author or authors. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package com.liferay.portletmvc4spring.multipart; 17 | 18 | import javax.portlet.ActionRequest; 19 | 20 | import org.springframework.web.multipart.MultipartRequest; 21 | 22 | 23 | /** 24 | * Interface which provides additional methods for dealing with multipart content within a portlet request, allowing to 25 | * access uploaded files. Implementations also need to override the standard ActionRequest methods for parameter access, 26 | * making multipart parameters available. 27 | * 28 | * <p>A concrete implementation is {@link DefaultMultipartActionRequest}. 29 | * 30 | * @author Juergen Hoeller 31 | * @since 2.0 32 | * @see PortletMultipartResolver 33 | * @see org.springframework.web.multipart.MultipartFile 34 | * @see javax.portlet.ActionRequest#getParameter 35 | * @see javax.portlet.ActionRequest#getParameterNames 36 | * @see javax.portlet.ActionRequest#getParameterMap 37 | */ 38 | public interface MultipartActionRequest extends ActionRequest, MultipartRequest { 39 | 40 | } 41 | -------------------------------------------------------------------------------- /framework/src/main/java/com/liferay/portletmvc4spring/multipart/MultipartResourceRequest.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (c) 2000-2020 the original author or authors. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package com.liferay.portletmvc4spring.multipart; 17 | 18 | import javax.portlet.ResourceRequest; 19 | 20 | import org.springframework.web.multipart.MultipartRequest; 21 | 22 | 23 | /** 24 | * Interface which provides additional methods for dealing with multipart content within a portlet request, allowing to 25 | * access uploaded files. Implementations also need to override the standard ResourceRequest methods for parameter 26 | * access, making multipart parameters available. 27 | * 28 | * <p>A concrete implementation is {@link DefaultMultipartResourceRequest}. 29 | * 30 | * @author Neil Griffin 31 | * @since 5.1 32 | * @see PortletMultipartResolver 33 | * @see org.springframework.web.multipart.MultipartFile 34 | * @see ResourceRequest#getParameter 35 | * @see ResourceRequest#getParameterNames 36 | * @see ResourceRequest#getParameterMap 37 | */ 38 | public interface MultipartResourceRequest extends ResourceRequest, MultipartRequest { 39 | 40 | } 41 | -------------------------------------------------------------------------------- /framework/src/main/java/com/liferay/portletmvc4spring/multipart/package-info.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (c) 2000-2020 the original author or authors. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | /** 17 | * Multipart resolution framework for handling file uploads. Provides a PortletMultipartResolver strategy interface, and 18 | * a generic extension of the ActionRequest interface for accessing multipart files in web application code. 19 | */ 20 | package com.liferay.portletmvc4spring.multipart; 21 | -------------------------------------------------------------------------------- /framework/src/main/java/com/liferay/portletmvc4spring/mvc/EventAwareController.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (c) 2000-2020 the original author or authors. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package com.liferay.portletmvc4spring.mvc; 17 | 18 | import javax.portlet.EventRequest; 19 | import javax.portlet.EventResponse; 20 | 21 | 22 | /** 23 | * Extension of the Portlet {@link Controller} interface that allows for handling Portlet 2.0 event requests as well. 24 | * Can also be implemented by {@link AbstractController} subclasses. 25 | * 26 | * @author Juergen Hoeller 27 | * @since 3.0 28 | * @see javax.portlet.EventPortlet 29 | * @see Controller 30 | * @see ResourceAwareController 31 | */ 32 | public interface EventAwareController { 33 | 34 | /** 35 | * Process the event request. There is nothing to return. 36 | * 37 | * @param request current portlet event request 38 | * @param response current portlet event response 39 | * 40 | * @throws Exception in case of errors 41 | */ 42 | void handleEventRequest(EventRequest request, EventResponse response) throws Exception; 43 | 44 | } 45 | -------------------------------------------------------------------------------- /framework/src/main/java/com/liferay/portletmvc4spring/mvc/PortletModeNameViewController.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (c) 2000-2020 the original author or authors. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package com.liferay.portletmvc4spring.mvc; 17 | 18 | import javax.portlet.ActionRequest; 19 | import javax.portlet.ActionResponse; 20 | import javax.portlet.PortletException; 21 | import javax.portlet.RenderRequest; 22 | import javax.portlet.RenderResponse; 23 | 24 | import com.liferay.portletmvc4spring.ModelAndView; 25 | 26 | 27 | /** 28 | * <p>Trivial controller that transforms the PortletMode to a view name. The advantage here is that the client is not 29 | * exposed to the concrete view technology but rather just to the controller URL; the concrete view will be determined 30 | * by the ViewResolver.</p> 31 | * 32 | * <p>Example: PortletMode.VIEW -> "view"</p> 33 | * 34 | * <p>This controller does not handle action requests.</p> 35 | * 36 | * @author William G. Thompson, Jr. 37 | * @author John A. Lewis 38 | * @since 2.0 39 | */ 40 | public class PortletModeNameViewController implements Controller { 41 | 42 | @Override 43 | public void handleActionRequest(ActionRequest request, ActionResponse response) throws Exception { 44 | throw new PortletException("PortletModeNameViewController does not handle action requests"); 45 | } 46 | 47 | @Override 48 | public ModelAndView handleRenderRequest(RenderRequest request, RenderResponse response) { 49 | return new ModelAndView(request.getPortletMode().toString()); 50 | } 51 | 52 | } 53 | -------------------------------------------------------------------------------- /framework/src/main/java/com/liferay/portletmvc4spring/mvc/ResourceAwareController.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (c) 2000-2020 the original author or authors. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package com.liferay.portletmvc4spring.mvc; 17 | 18 | import javax.portlet.ResourceRequest; 19 | import javax.portlet.ResourceResponse; 20 | 21 | import com.liferay.portletmvc4spring.ModelAndView; 22 | 23 | 24 | /** 25 | * Extension of the Portlet {@link Controller} interface that allows for handling Portlet 2.0 resource requests as well. 26 | * Can also be implemented by {@link AbstractController} subclasses. 27 | * 28 | * @author Juergen Hoeller 29 | * @since 3.0 30 | * @see javax.portlet.ResourceServingPortlet 31 | * @see Controller 32 | * @see EventAwareController 33 | */ 34 | public interface ResourceAwareController { 35 | 36 | /** 37 | * Process the resource request and return a ModelAndView object which the DispatcherPortlet will render. A {@code 38 | * null} return value is not an error: It indicates that this object completed request processing itself, thus there 39 | * is no ModelAndView to render. 40 | * 41 | * @param request current portlet resource request 42 | * @param response current portlet resource response 43 | * 44 | * @return a ModelAndView to render, or null if handled directly 45 | * 46 | * @throws Exception in case of errors 47 | */ 48 | ModelAndView handleResourceRequest(ResourceRequest request, ResourceResponse response) throws Exception; 49 | 50 | } 51 | -------------------------------------------------------------------------------- /framework/src/main/java/com/liferay/portletmvc4spring/mvc/annotation/package-info.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (c) 2000-2020 the original author or authors. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | /** 17 | * Support package for annotation-based PortletMVC4Spring controllers. 18 | */ 19 | package com.liferay.portletmvc4spring.mvc.annotation; 20 | -------------------------------------------------------------------------------- /framework/src/main/java/com/liferay/portletmvc4spring/mvc/method/annotation/PortletModelAndViewResolver.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (c) 2000-2020 the original author or authors. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package com.liferay.portletmvc4spring.mvc.method.annotation; 17 | 18 | import java.lang.reflect.Method; 19 | 20 | import org.springframework.lang.Nullable; 21 | 22 | import org.springframework.ui.ExtendedModelMap; 23 | 24 | import org.springframework.web.context.request.NativeWebRequest; 25 | 26 | import com.liferay.portletmvc4spring.ModelAndView; 27 | 28 | 29 | /** 30 | * This interface is inspired by the {@link org.springframework.web.servlet.mvc.annotation.ModelAndViewResolver} and is 31 | * meant for use with the portlet version of {@link ModelAndView}. 32 | * 33 | * @author Neil Griffin 34 | */ 35 | public interface PortletModelAndViewResolver { 36 | 37 | /** Marker to be returned when the resolver does not know how to handle the given method parameter. */ 38 | ModelAndView UNRESOLVED = new ModelAndView(); 39 | 40 | ModelAndView resolveModelAndView(Method handlerMethod, Class<?> handlerType, @Nullable Object returnValue, 41 | ExtendedModelMap implicitModel, NativeWebRequest webRequest); 42 | } 43 | -------------------------------------------------------------------------------- /framework/src/main/java/com/liferay/portletmvc4spring/mvc/method/annotation/PortletRequestDataBinderFactory.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (c) 2000-2020 the original author or authors. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package com.liferay.portletmvc4spring.mvc.method.annotation; 17 | 18 | import java.util.List; 19 | 20 | import org.springframework.lang.Nullable; 21 | 22 | import org.springframework.web.bind.WebDataBinder; 23 | import org.springframework.web.bind.support.WebBindingInitializer; 24 | import org.springframework.web.context.request.NativeWebRequest; 25 | import org.springframework.web.method.annotation.InitBinderDataBinderFactory; 26 | import org.springframework.web.method.support.InvocableHandlerMethod; 27 | 28 | import com.liferay.portletmvc4spring.bind.PortletRequestDataBinder; 29 | 30 | 31 | /** 32 | * Creates a {@code PortletRequestDataBinder}. 33 | * 34 | * @author Rossen Stoyanchev 35 | * @author Neil Griffin 36 | * @since 5.1 37 | */ 38 | public class PortletRequestDataBinderFactory extends InitBinderDataBinderFactory { 39 | 40 | public PortletRequestDataBinderFactory(@Nullable List<InvocableHandlerMethod> binderMethods, 41 | @Nullable WebBindingInitializer initializer) { 42 | super(binderMethods, initializer); 43 | } 44 | 45 | @Override 46 | protected WebDataBinder createBinderInstance(@Nullable Object target, String objectName, 47 | NativeWebRequest webRequest) throws Exception { 48 | return new PortletRequestDataBinder(target, objectName); 49 | } 50 | } 51 | -------------------------------------------------------------------------------- /framework/src/main/java/com/liferay/portletmvc4spring/mvc/package-info.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (c) 2000-2020 the original author or authors. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | /** 17 | * Standard controller implementations for the PortletMVC4Spring framework. Provides various controller styles, 18 | * including an annotation-based model. 19 | */ 20 | package com.liferay.portletmvc4spring.mvc; 21 | -------------------------------------------------------------------------------- /framework/src/main/java/com/liferay/portletmvc4spring/package-info.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (c) 2000-2020 the original author or authors. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | /** 17 | * Provides JSR-362 portlets that integrate with the application context infrastructure, and the core interfaces and 18 | * classes for PortletMVC4Spring. 19 | */ 20 | package com.liferay.portletmvc4spring; 21 | -------------------------------------------------------------------------------- /framework/src/main/java/com/liferay/portletmvc4spring/util/package-info.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (c) 2000-2020 the original author or authors. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | /** 17 | * Miscellaneous Portlet utility classes. 18 | */ 19 | package com.liferay.portletmvc4spring.util; 20 | -------------------------------------------------------------------------------- /framework/src/main/java/overview.html: -------------------------------------------------------------------------------- 1 | <html> 2 | <body> 3 | <p> 4 | PortletMVC4Spring framework API. Includes common support packages. 5 | </p> 6 | </body> 7 | </html> -------------------------------------------------------------------------------- /framework/src/main/resources/com/liferay/portletmvc4spring/DispatcherPortlet.properties: -------------------------------------------------------------------------------- 1 | # Default implementation classes for DispatcherPortlet's strategy interfaces. 2 | # Used as fallback when no matching beans are found in the DispatcherPortlet context. 3 | # Not meant to be customized by application developers. 4 | 5 | com.liferay.portletmvc4spring.HandlerMapping=com.liferay.portletmvc4spring.mvc.annotation.DefaultAnnotationHandlerMapping 6 | 7 | com.liferay.portletmvc4spring.HandlerAdapter=com.liferay.portletmvc4spring.mvc.SimpleControllerHandlerAdapter,\ 8 | com.liferay.portletmvc4spring.mvc.method.annotation.PortletRequestMappingHandlerAdapter 9 | 10 | com.liferay.portletmvc4spring.HandlerExceptionResolver=com.liferay.portletmvc4spring.mvc.annotation.AnnotationMethodHandlerExceptionResolver 11 | 12 | org.springframework.web.servlet.ViewResolver=org.springframework.web.servlet.view.InternalResourceViewResolver 13 | -------------------------------------------------------------------------------- /framework/src/test/java/com/liferay/portletmvc4spring/context/PortletConfigAwareBean.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (c) 2000-2020 the original author or authors. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package com.liferay.portletmvc4spring.context; 17 | 18 | import javax.portlet.PortletConfig; 19 | 20 | 21 | /** 22 | * @author Mark Fisher 23 | */ 24 | public class PortletConfigAwareBean implements PortletConfigAware { 25 | 26 | private PortletConfig portletConfig; 27 | 28 | public PortletConfig getPortletConfig() { 29 | return portletConfig; 30 | } 31 | 32 | @Override 33 | public void setPortletConfig(PortletConfig portletConfig) { 34 | this.portletConfig = portletConfig; 35 | } 36 | } 37 | -------------------------------------------------------------------------------- /framework/src/test/java/com/liferay/portletmvc4spring/context/PortletContextAwareBean.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (c) 2000-2020 the original author or authors. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package com.liferay.portletmvc4spring.context; 17 | 18 | import javax.portlet.PortletContext; 19 | 20 | 21 | /** 22 | * @author Mark Fisher 23 | */ 24 | public class PortletContextAwareBean implements PortletContextAware { 25 | 26 | private PortletContext portletContext; 27 | 28 | public PortletContext getPortletContext() { 29 | return portletContext; 30 | } 31 | 32 | @Override 33 | public void setPortletContext(PortletContext portletContext) { 34 | this.portletContext = portletContext; 35 | } 36 | } 37 | -------------------------------------------------------------------------------- /framework/src/test/java/com/liferay/spring/context/ACATester.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (c) 2000-2020 the original author or authors. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package com.liferay.spring.context; 17 | 18 | import java.util.Locale; 19 | 20 | import org.springframework.context.ApplicationContext; 21 | import org.springframework.context.ApplicationContextAware; 22 | import org.springframework.context.ApplicationContextException; 23 | import org.springframework.context.NoSuchMessageException; 24 | 25 | 26 | /** 27 | * @author Neil Griffin 28 | */ 29 | public class ACATester implements ApplicationContextAware { 30 | 31 | private ApplicationContext ac; 32 | 33 | public ApplicationContext getApplicationContext() { 34 | return ac; 35 | } 36 | 37 | @Override 38 | public void setApplicationContext(ApplicationContext ctx) throws ApplicationContextException { 39 | 40 | // check reinitialization 41 | if (this.ac != null) { 42 | throw new IllegalStateException("Already initialized"); 43 | } 44 | 45 | // check message source availability 46 | if (ctx != null) { 47 | 48 | try { 49 | ctx.getMessage("code1", null, Locale.getDefault()); 50 | } 51 | catch (NoSuchMessageException ex) { 52 | // expected 53 | } 54 | } 55 | 56 | this.ac = ctx; 57 | } 58 | 59 | } 60 | -------------------------------------------------------------------------------- /framework/src/test/java/com/liferay/spring/context/BeanThatBroadcasts.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (c) 2000-2020 the original author or authors. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package com.liferay.spring.context; 17 | 18 | import org.springframework.context.ApplicationContext; 19 | import org.springframework.context.ApplicationContextAware; 20 | 21 | 22 | /** 23 | * @author Juergen Hoeller 24 | */ 25 | public class BeanThatBroadcasts implements ApplicationContextAware { 26 | 27 | public ApplicationContext applicationContext; 28 | 29 | public int receivedCount; 30 | 31 | @Override 32 | public void setApplicationContext(ApplicationContext applicationContext) { 33 | this.applicationContext = applicationContext; 34 | 35 | if (applicationContext.getDisplayName().indexOf("listener") != -1) { 36 | applicationContext.getBean("listener"); 37 | } 38 | } 39 | 40 | } 41 | -------------------------------------------------------------------------------- /framework/src/test/java/com/liferay/spring/context/BeanThatListens.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (c) 2000-2020 the original author or authors. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package com.liferay.spring.context; 17 | 18 | import java.util.Map; 19 | 20 | import org.springframework.context.ApplicationEvent; 21 | import org.springframework.context.ApplicationListener; 22 | 23 | 24 | /** 25 | * A stub {@link ApplicationListener}. 26 | * 27 | * @author Thomas Risberg 28 | * @author Juergen Hoeller 29 | */ 30 | public class BeanThatListens implements ApplicationListener<ApplicationEvent> { 31 | 32 | private BeanThatBroadcasts beanThatBroadcasts; 33 | 34 | private int eventCount; 35 | 36 | public BeanThatListens() { 37 | } 38 | 39 | public BeanThatListens(BeanThatBroadcasts beanThatBroadcasts) { 40 | this.beanThatBroadcasts = beanThatBroadcasts; 41 | 42 | Map<String, BeanThatListens> beans = beanThatBroadcasts.applicationContext.getBeansOfType( 43 | BeanThatListens.class); 44 | 45 | if (!beans.isEmpty()) { 46 | throw new IllegalStateException("Shouldn't have found any BeanThatListens instances"); 47 | } 48 | } 49 | 50 | public int getEventCount() { 51 | return eventCount; 52 | } 53 | 54 | @Override 55 | public void onApplicationEvent(ApplicationEvent event) { 56 | eventCount++; 57 | 58 | if (beanThatBroadcasts != null) { 59 | beanThatBroadcasts.receivedCount++; 60 | } 61 | } 62 | 63 | public void zero() { 64 | eventCount = 0; 65 | } 66 | 67 | } 68 | -------------------------------------------------------------------------------- /framework/src/test/java/com/liferay/spring/context/TestListener.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (c) 2000-2020 the original author or authors. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package com.liferay.spring.context; 17 | 18 | import org.springframework.context.ApplicationEvent; 19 | import org.springframework.context.ApplicationListener; 20 | 21 | 22 | /** 23 | * Listener that maintains a global count of events. 24 | * 25 | * @author Rod Johnson 26 | * @since January 21, 2001 27 | */ 28 | public class TestListener implements ApplicationListener<ApplicationEvent> { 29 | 30 | private int eventCount; 31 | 32 | public int getEventCount() { 33 | return eventCount; 34 | } 35 | 36 | @Override 37 | public void onApplicationEvent(ApplicationEvent e) { 38 | ++eventCount; 39 | } 40 | 41 | public void zeroCounter() { 42 | eventCount = 0; 43 | } 44 | 45 | } 46 | -------------------------------------------------------------------------------- /framework/src/test/java/com/liferay/spring/tests/sample/beans/AgeHolder.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (c) 2000-2020 the original author or authors. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package com.liferay.spring.tests.sample.beans; 17 | 18 | /** 19 | * @author Neil Griffin 20 | */ 21 | public interface AgeHolder { 22 | 23 | default int age() { 24 | return getAge(); 25 | } 26 | 27 | int getAge(); 28 | 29 | void setAge(int age); 30 | 31 | } 32 | -------------------------------------------------------------------------------- /framework/src/test/java/com/liferay/spring/tests/sample/beans/Colour.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (c) 2000-2020 the original author or authors. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package com.liferay.spring.tests.sample.beans; 17 | 18 | /** 19 | * @author Rob Harrop 20 | * @author Juergen Hoeller 21 | */ 22 | @SuppressWarnings("serial") 23 | public class Colour { 24 | 25 | public static final Colour RED = new Colour("RED"); 26 | public static final Colour BLUE = new Colour("BLUE"); 27 | public static final Colour GREEN = new Colour("GREEN"); 28 | public static final Colour PURPLE = new Colour("PURPLE"); 29 | 30 | private final String name; 31 | 32 | public Colour(String name) { 33 | this.name = name; 34 | } 35 | 36 | @Override 37 | public String toString() { 38 | return this.name; 39 | } 40 | 41 | } 42 | -------------------------------------------------------------------------------- /framework/src/test/java/com/liferay/spring/tests/sample/beans/INestedTestBean.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (c) 2000-2020 the original author or authors. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package com.liferay.spring.tests.sample.beans; 17 | 18 | /** 19 | * @author Neil Griffin 20 | */ 21 | public interface INestedTestBean { 22 | 23 | public String getCompany(); 24 | 25 | } 26 | -------------------------------------------------------------------------------- /framework/src/test/java/com/liferay/spring/tests/sample/beans/IOther.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (c) 2000-2020 the original author or authors. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package com.liferay.spring.tests.sample.beans; 17 | 18 | /** 19 | * @author Neil Griffin 20 | */ 21 | public interface IOther { 22 | 23 | void absquatulate(); 24 | 25 | } 26 | -------------------------------------------------------------------------------- /framework/src/test/java/com/liferay/spring/tests/sample/beans/MustBeInitialized.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (c) 2000-2020 the original author or authors. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package com.liferay.spring.tests.sample.beans; 17 | 18 | import org.springframework.beans.factory.InitializingBean; 19 | 20 | 21 | /** 22 | * Simple test of BeanFactory initialization 23 | * 24 | * @author Rod Johnson 25 | * @since 12.03.2003 26 | */ 27 | public class MustBeInitialized implements InitializingBean { 28 | 29 | private boolean inited; 30 | 31 | /** 32 | * @see org.springframework.beans.factory.InitializingBean#afterPropertiesSet() 33 | */ 34 | @Override 35 | public void afterPropertiesSet() throws Exception { 36 | this.inited = true; 37 | } 38 | 39 | /** 40 | * Dummy business method that will fail unless the factory managed the bean's lifecycle correctly 41 | */ 42 | public void businessMethod() { 43 | 44 | if (!this.inited) 45 | throw new RuntimeException("Factory didn't call afterPropertiesSet() on MustBeInitialized object"); 46 | } 47 | 48 | } 49 | -------------------------------------------------------------------------------- /framework/src/test/java/com/liferay/spring/tests/sample/beans/NestedTestBean.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (c) 2000-2020 the original author or authors. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package com.liferay.spring.tests.sample.beans; 17 | 18 | /** 19 | * Simple nested test bean used for testing bean factories, AOP framework etc. 20 | * 21 | * @author Trevor D. Cook 22 | * @since 30.09.2003 23 | */ 24 | public class NestedTestBean implements INestedTestBean { 25 | 26 | private String company = ""; 27 | 28 | public NestedTestBean() { 29 | } 30 | 31 | public NestedTestBean(String company) { 32 | setCompany(company); 33 | } 34 | 35 | @Override 36 | public boolean equals(Object obj) { 37 | 38 | if (!(obj instanceof NestedTestBean)) { 39 | return false; 40 | } 41 | 42 | NestedTestBean ntb = (NestedTestBean) obj; 43 | 44 | return this.company.equals(ntb.company); 45 | } 46 | 47 | @Override 48 | public String getCompany() { 49 | return company; 50 | } 51 | 52 | @Override 53 | public int hashCode() { 54 | return this.company.hashCode(); 55 | } 56 | 57 | public void setCompany(String company) { 58 | this.company = ((company != null) ? company : ""); 59 | } 60 | 61 | @Override 62 | public String toString() { 63 | return "NestedTestBean: " + this.company; 64 | } 65 | 66 | } 67 | -------------------------------------------------------------------------------- /framework/src/test/resources/com/liferay/portletmvc4spring/context/WEB-INF/context-messages.properties: -------------------------------------------------------------------------------- 1 | code1=message1 2 | code2=message2 3 | 4 | # Example taken from the javadocs for the java.text.MessageFormat class 5 | message.format.example1=At '{1,time}' on "{1,date}", there was "{2}" on planet {0,number,integer}. 6 | message.format.example2=This is a test message in the message catalog with no args. 7 | -------------------------------------------------------------------------------- /framework/src/test/resources/com/liferay/portletmvc4spring/context/WEB-INF/context-messages_en_GB.properties: -------------------------------------------------------------------------------- 1 | # Example taken from the javadocs for the java.text.MessageFormat class 2 | message.format.example1=At '{1,time}' on "{1,date}", there was "{2}" on station number {0,number,integer}. -------------------------------------------------------------------------------- /framework/src/test/resources/com/liferay/portletmvc4spring/context/WEB-INF/context-messages_en_US.properties: -------------------------------------------------------------------------------- 1 | code1=message1 2 | 3 | # Example taken from the javadocs for the java.text.MessageFormat class 4 | message.format.example1=At '{1,time}' on "{1,date}", there was "{2}" on planet {0,number,integer}. 5 | message.format.example2=This is a test message in the message catalog with no args. -------------------------------------------------------------------------------- /framework/src/test/resources/com/liferay/portletmvc4spring/context/WEB-INF/contextInclude.xml: -------------------------------------------------------------------------------- 1 | <!-- Include snippet to be loaded via entity reference in applicationContext.xml --> 2 | 3 | <bean id="father" class="com.liferay.spring.tests.sample.beans.TestBean"> 4 | <property name="name"><value>yetanotherdummy</value></property> 5 | </bean> 6 | 7 | -------------------------------------------------------------------------------- /framework/src/test/resources/com/liferay/portletmvc4spring/context/WEB-INF/empty-portlet.xml: -------------------------------------------------------------------------------- 1 | <?xml version="1.0" encoding="UTF-8"?> 2 | <!DOCTYPE beans PUBLIC "-//SPRING//DTD BEAN 2.0//EN" "http://www.springframework.org/dtd/spring-beans-2.0.dtd"> 3 | 4 | <beans> 5 | 6 | <bean id="portletContextAwareBean" class="com.liferay.portletmvc4spring.context.PortletContextAwareBean"/> 7 | 8 | <bean id="portletConfigAwareBean" class="com.liferay.portletmvc4spring.context.PortletConfigAwareBean"/> 9 | 10 | </beans> 11 | -------------------------------------------------------------------------------- /framework/src/test/resources/com/liferay/portletmvc4spring/context/WEB-INF/more-context-messages.properties: -------------------------------------------------------------------------------- 1 | code1=message1x 2 | code3=message3 3 | -------------------------------------------------------------------------------- /framework/src/test/resources/com/liferay/portletmvc4spring/context/WEB-INF/myoverride.properties: -------------------------------------------------------------------------------- 1 | father.name=Albert 2 | rod.age=31 3 | rod.name=Roderick 4 | -------------------------------------------------------------------------------- /framework/src/test/resources/com/liferay/portletmvc4spring/context/WEB-INF/myplaceholder.properties: -------------------------------------------------------------------------------- 1 | useCodeAsDefaultMessage=false 2 | message-file=context-messages 3 | objectName=test:service=myservice 4 | theme-base=com/liferay/portletmvc4spring/context/WEB-INF/ 5 | -------------------------------------------------------------------------------- /framework/src/test/resources/com/liferay/portletmvc4spring/context/WEB-INF/resources/messageSource.xml: -------------------------------------------------------------------------------- 1 | <?xml version="1.0" encoding="UTF-8"?> 2 | <!DOCTYPE beans PUBLIC "-//SPRING//DTD BEAN 2.0//EN" "http://www.springframework.org/dtd/spring-beans-2.0.dtd"> 3 | 4 | <beans> 5 | 6 | <bean id="messageSource" class="org.springframework.context.support.ResourceBundleMessageSource"> 7 | <property name="useCodeAsDefaultMessage"> 8 | <value>${useCodeAsDefaultMessage}</value> 9 | </property> 10 | <property name="basenames"> 11 | <list> 12 | <value>com/liferay/portletmvc4spring/context/WEB-INF/${message-file}</value> 13 | <value>com/liferay/portletmvc4spring/context/WEB-INF/more-context-messages</value> 14 | </list> 15 | </property> 16 | </bean> 17 | 18 | <bean id="messageSourceString" factory-bean="messageSource" factory-method="toString"/> 19 | 20 | <bean id="currentTimeMillis" class="javax.management.ObjectName" factory-method="getInstance"> 21 | <constructor-arg value="${objectName}"/> 22 | </bean> 23 | 24 | </beans> 25 | -------------------------------------------------------------------------------- /framework/src/test/resources/com/liferay/portletmvc4spring/context/WEB-INF/resources/themeSource.xml: -------------------------------------------------------------------------------- 1 | <?xml version="1.0" encoding="UTF-8"?> 2 | <!DOCTYPE beans PUBLIC "-//SPRING//DTD BEAN 2.0//EN" "http://www.springframework.org/dtd/spring-beans-2.0.dtd"> 3 | 4 | <beans> 5 | 6 | <bean id="themeSource" class="org.springframework.ui.context.support.ResourceBundleThemeSource"> 7 | <property name="basenamePrefix"> 8 | <value>${theme-base}</value> 9 | </property> 10 | </bean> 11 | 12 | </beans> 13 | -------------------------------------------------------------------------------- /framework/src/test/resources/com/liferay/portletmvc4spring/context/WEB-INF/test-messages.properties: -------------------------------------------------------------------------------- 1 | code2=message2 2 | -------------------------------------------------------------------------------- /framework/src/test/resources/com/liferay/portletmvc4spring/context/WEB-INF/test-portlet.xml: -------------------------------------------------------------------------------- 1 | <?xml version="1.0" encoding="UTF-8"?> 2 | <!DOCTYPE beans PUBLIC "-//SPRING//DTD BEAN 2.0//EN" "http://www.springframework.org/dtd/spring-beans-2.0.dtd"> 3 | 4 | <beans> 5 | 6 | <import resource="classpath:/com/liferay/portletmvc4spring/context/WEB-INF/test-servlet.xml"/> 7 | 8 | <bean id="portletContextAwareBean" class="com.liferay.portletmvc4spring.context.PortletContextAwareBean"/> 9 | 10 | <bean id="portletConfigAwareBean" class="com.liferay.portletmvc4spring.context.PortletConfigAwareBean"/> 11 | 12 | </beans> -------------------------------------------------------------------------------- /framework/src/test/resources/com/liferay/portletmvc4spring/handler/parameterMapping.xml: -------------------------------------------------------------------------------- 1 | <?xml version="1.0" encoding="UTF-8"?> 2 | <!DOCTYPE beans PUBLIC "-//SPRING//DTD BEAN 2.0//EN" "http://www.springframework.org/dtd/spring-beans-2.0.dtd"> 3 | 4 | <beans> 5 | 6 | <bean id="handlerMapping" class="com.liferay.portletmvc4spring.handler.ParameterHandlerMapping"> 7 | <property name="parameterMap"> 8 | <map> 9 | <entry key="add" value-ref="addItemHandler"/> 10 | <entry key="remove" value-ref="removeItemHandler"/> 11 | </map> 12 | </property> 13 | </bean> 14 | 15 | <bean id="addItemHandler" class="java.lang.Object"/> 16 | 17 | <bean id="removeItemHandler" class="java.lang.Object"/> 18 | 19 | </beans> 20 | -------------------------------------------------------------------------------- /framework/src/test/resources/com/liferay/portletmvc4spring/handler/portletModeMapping.xml: -------------------------------------------------------------------------------- 1 | <?xml version="1.0" encoding="UTF-8"?> 2 | <!DOCTYPE beans PUBLIC "-//SPRING//DTD BEAN 2.0//EN" "http://www.springframework.org/dtd/spring-beans-2.0.dtd"> 3 | 4 | <beans> 5 | 6 | <bean id="handlerMapping" class="com.liferay.portletmvc4spring.handler.PortletModeHandlerMapping"> 7 | <property name="portletModeMap"> 8 | <map> 9 | <entry key="view" value-ref="viewHandler"/> 10 | <entry key="edit" value-ref="editHandler"/> 11 | <entry key="help" value-ref="helpHandler"/> 12 | </map> 13 | </property> 14 | </bean> 15 | 16 | <bean id="viewHandler" class="java.lang.Object"/> 17 | 18 | <bean id="editHandler" class="java.lang.Object"/> 19 | 20 | <bean id="helpHandler" class="java.lang.Object"/> 21 | 22 | </beans> 23 | -------------------------------------------------------------------------------- /framework/src/test/resources/com/liferay/portletmvc4spring/handler/portletModeParameterMapping.xml: -------------------------------------------------------------------------------- 1 | <?xml version="1.0" encoding="UTF-8"?> 2 | <!DOCTYPE beans PUBLIC "-//SPRING//DTD BEAN 2.0//EN" "http://www.springframework.org/dtd/spring-beans-2.0.dtd"> 3 | 4 | <beans> 5 | 6 | <bean id="handlerMapping" class="com.liferay.portletmvc4spring.handler.PortletModeParameterHandlerMapping"> 7 | <property name="portletModeParameterMap"> 8 | <map> 9 | <entry key="view"> 10 | <map> 11 | <entry key="add" value-ref="addItemHandler"/> 12 | <entry key="remove" value-ref="removeItemHandler"/> 13 | </map> 14 | </entry> 15 | <entry key="edit"> 16 | <map> 17 | <entry key="prefs" value-ref="preferencesHandler"/> 18 | </map> 19 | </entry> 20 | </map> 21 | </property> 22 | </bean> 23 | 24 | <bean id="addItemHandler" class="java.lang.Object"/> 25 | 26 | <bean id="removeItemHandler" class="java.lang.Object"/> 27 | 28 | <bean id="preferencesHandler" class="java.lang.Object"/> 29 | 30 | </beans> 31 | -------------------------------------------------------------------------------- /framework/src/test/resources/log4j.properties: -------------------------------------------------------------------------------- 1 | log4j.appender.console=org.apache.log4j.ConsoleAppender 2 | log4j.appender.console.layout=org.apache.log4j.PatternLayout 3 | log4j.appender.console.layout.ConversionPattern=%d{HH:mm:ss,SSS} [%c] - %m%n 4 | 5 | log4j.rootCategory=WARN, console 6 | log4j.logger.org.springframework.beans=WARN 7 | log4j.logger.org.springframework.binding=DEBUG 8 | 9 | #log4j.logger.com.liferay.portletmvc4spring=TRACE 10 | 11 | -------------------------------------------------------------------------------- /security/pom.xml: -------------------------------------------------------------------------------- 1 | <?xml version="1.0" encoding="UTF-8"?> 2 | <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> 3 | <parent> 4 | <groupId>com.liferay.portletmvc4spring</groupId> 5 | <artifactId>com.liferay.portletmvc4spring.parent</artifactId> 6 | <version>6.0.0-SNAPSHOT</version> 7 | <relativePath>../pom.xml</relativePath> 8 | </parent> 9 | <modelVersion>4.0.0</modelVersion> 10 | <artifactId>com.liferay.portletmvc4spring.security</artifactId> 11 | <name>PortletMVC4Spring Security</name> 12 | <description>PortletMVC4Spring Security</description> 13 | <dependencies> 14 | <dependency> 15 | <groupId>com.liferay</groupId> 16 | <artifactId>javax.portlet</artifactId> 17 | </dependency> 18 | <dependency> 19 | <groupId>jakarta.servlet</groupId> 20 | <artifactId>jakarta.servlet-api</artifactId> 21 | </dependency> 22 | <dependency> 23 | <groupId>com.liferay.portletmvc4spring</groupId> 24 | <artifactId>com.liferay.portletmvc4spring.framework</artifactId> 25 | <version>${project.version}</version> 26 | </dependency> 27 | <dependency> 28 | <groupId>org.apache.portals.pluto</groupId> 29 | <artifactId>portlet-servlet-adapter</artifactId> 30 | </dependency> 31 | <dependency> 32 | <groupId>org.springframework.security</groupId> 33 | <artifactId>spring-security-config</artifactId> 34 | </dependency> 35 | <dependency> 36 | <groupId>org.springframework.security</groupId> 37 | <artifactId>spring-security-web</artifactId> 38 | </dependency> 39 | </dependencies> 40 | <build> 41 | <plugins> 42 | <plugin> 43 | <groupId>org.codehaus.mojo</groupId> 44 | <artifactId>build-helper-maven-plugin</artifactId> 45 | </plugin> 46 | <plugin> 47 | <groupId>org.codehaus.mojo</groupId> 48 | <artifactId>buildnumber-maven-plugin</artifactId> 49 | </plugin> 50 | </plugins> 51 | </build> 52 | </project> 53 | -------------------------------------------------------------------------------- /security/src/main/java/com/liferay/portletmvc4spring/security/SpringSecurityRequestAdapter.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (c) 2000-2020 the original author or authors. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package com.liferay.portletmvc4spring.security; 17 | 18 | import javax.portlet.PortletRequest; 19 | import jakarta.servlet.DispatcherType; 20 | import jakarta.servlet.ServletContext; 21 | 22 | import org.apache.pluto.portlet.servlet.adapter.HttpServletRequestAdapter; 23 | 24 | 25 | /** 26 | * @author Neil Griffin 27 | */ 28 | public class SpringSecurityRequestAdapter extends HttpServletRequestAdapter { 29 | 30 | private DispatcherType dispatcherType; 31 | 32 | public SpringSecurityRequestAdapter(PortletRequest portletRequest, DispatcherType dispatcherType) { 33 | super(portletRequest); 34 | this.dispatcherType = dispatcherType; 35 | } 36 | 37 | public SpringSecurityRequestAdapter(PortletRequest portletRequest, ServletContext servletContext, 38 | DispatcherType dispatcherType) { 39 | super(portletRequest, servletContext); 40 | this.dispatcherType = dispatcherType; 41 | } 42 | 43 | @Override 44 | public DispatcherType getDispatcherType() { 45 | return dispatcherType; 46 | } 47 | 48 | @Override 49 | public String getHeader(String name) { 50 | 51 | if ("X-CSRF-TOKEN".equals(name)) { 52 | 53 | // https://issues.liferay.com/browse/MVCS-66 54 | return null; 55 | } 56 | 57 | return super.getHeader(name); 58 | } 59 | } 60 | -------------------------------------------------------------------------------- /security/src/main/java/com/liferay/portletmvc4spring/security/package-info.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (c) 2000-2020 the original author or authors. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | /** 17 | * Integrates PortletMVC4Spring with <a href="https://spring.io/projects/spring-security">Spring Security</a> in order 18 | * to provide CSRF protection. 19 | */ 20 | package com.liferay.portletmvc4spring.security; 21 | -------------------------------------------------------------------------------- /security/src/main/java/overview.html: -------------------------------------------------------------------------------- 1 | <html> 2 | <body> 3 | <p> 4 | PortletMVC4Spring Security API. 5 | </p> 6 | </body> 7 | </html> -------------------------------------------------------------------------------- /test/pom.xml: -------------------------------------------------------------------------------- 1 | <?xml version="1.0" encoding="UTF-8"?> 2 | <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> 3 | <parent> 4 | <groupId>com.liferay.portletmvc4spring</groupId> 5 | <artifactId>com.liferay.portletmvc4spring.parent</artifactId> 6 | <version>6.0.0-SNAPSHOT</version> 7 | <relativePath>../pom.xml</relativePath> 8 | </parent> 9 | <modelVersion>4.0.0</modelVersion> 10 | <artifactId>com.liferay.portletmvc4spring.test</artifactId> 11 | <name>PortletMVC4Spring Test</name> 12 | <description>PortletMVC4Spring Test</description> 13 | <dependencies> 14 | <dependency> 15 | <groupId>com.liferay.portletmvc4spring</groupId> 16 | <artifactId>com.liferay.portletmvc4spring.framework</artifactId> 17 | <!-- Compile against previously released version in order to avoid a circular dependency with the framework module --> 18 | <version>5.2.0</version> 19 | </dependency> 20 | <dependency> 21 | <groupId>com.liferay</groupId> 22 | <artifactId>javax.portlet</artifactId> 23 | </dependency> 24 | <dependency> 25 | <groupId>jakarta.servlet</groupId> 26 | <artifactId>jakarta.servlet-api</artifactId> 27 | </dependency> 28 | <dependency> 29 | <groupId>org.springframework</groupId> 30 | <artifactId>spring-core</artifactId> 31 | </dependency> 32 | <dependency> 33 | <groupId>org.springframework</groupId> 34 | <artifactId>spring-test</artifactId> 35 | <scope>compile</scope> 36 | </dependency> 37 | <dependency> 38 | <groupId>org.springframework</groupId> 39 | <artifactId>spring-web</artifactId> 40 | </dependency> 41 | </dependencies> 42 | <build> 43 | <plugins> 44 | <plugin> 45 | <groupId>org.codehaus.mojo</groupId> 46 | <artifactId>build-helper-maven-plugin</artifactId> 47 | </plugin> 48 | <plugin> 49 | <groupId>org.codehaus.mojo</groupId> 50 | <artifactId>buildnumber-maven-plugin</artifactId> 51 | </plugin> 52 | </plugins> 53 | </build> 54 | </project> 55 | -------------------------------------------------------------------------------- /test/src/main/java/com/liferay/portletmvc4spring/test/mock/web/portlet/MockActionParameters.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (c) 2000-2020 the original author or authors. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package com.liferay.portletmvc4spring.test.mock.web.portlet; 17 | 18 | import javax.portlet.ActionParameters; 19 | import javax.portlet.MutableActionParameters; 20 | 21 | 22 | /** 23 | * Mock implementation of the {@link ActionParameters} interface. 24 | * 25 | * @author Neil Griffin 26 | * @since 5.1.0 27 | */ 28 | public class MockActionParameters extends MockPortletParameters implements ActionParameters { 29 | 30 | @Override 31 | public MutableActionParameters clone() { 32 | return null; 33 | } 34 | } 35 | -------------------------------------------------------------------------------- /test/src/main/java/com/liferay/portletmvc4spring/test/mock/web/portlet/MockActionURL.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (c) 2000-2020 the original author or authors. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package com.liferay.portletmvc4spring.test.mock.web.portlet; 17 | 18 | import javax.portlet.ActionURL; 19 | import javax.portlet.MimeResponse; 20 | import javax.portlet.MutableActionParameters; 21 | import javax.portlet.MutableRenderParameters; 22 | import javax.portlet.PortalContext; 23 | 24 | 25 | /** 26 | * Mock implementation of the {@link ActionURL} interface. 27 | * 28 | * @author Neil Griffin 29 | * @since 5.1.0 30 | */ 31 | public class MockActionURL extends MockPortletURL implements ActionURL { 32 | 33 | private MimeResponse.Copy copy; 34 | private MutableActionParameters mutableActionParameters; 35 | private MutableRenderParameters mutableRenderParameters; 36 | 37 | public MockActionURL(PortalContext portalContext, MimeResponse.Copy copy) { 38 | super(portalContext, URL_TYPE_ACTION); 39 | this.copy = copy; 40 | } 41 | 42 | @Override 43 | public MutableActionParameters getActionParameters() { 44 | 45 | if (mutableActionParameters == null) { 46 | mutableActionParameters = new MockMutableActionParameters(); 47 | } 48 | 49 | return mutableActionParameters; 50 | } 51 | 52 | @Override 53 | public MutableRenderParameters getRenderParameters() { 54 | 55 | if (mutableRenderParameters == null) { 56 | mutableRenderParameters = new MockMutableRenderParameters(); 57 | } 58 | 59 | return mutableRenderParameters; 60 | } 61 | } 62 | -------------------------------------------------------------------------------- /test/src/main/java/com/liferay/portletmvc4spring/test/mock/web/portlet/MockEventResponse.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (c) 2000-2020 the original author or authors. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package com.liferay.portletmvc4spring.test.mock.web.portlet; 17 | 18 | import javax.portlet.EventRequest; 19 | import javax.portlet.EventResponse; 20 | 21 | 22 | /** 23 | * Mock implementation of the {@link javax.portlet.EventResponse} interface. 24 | * 25 | * @author Juergen Hoeller 26 | * @since 3.0 27 | */ 28 | public class MockEventResponse extends MockStateAwareResponse implements EventResponse { 29 | 30 | @Override 31 | public void setRenderParameters(EventRequest request) { 32 | setRenderParameters(request.getParameterMap()); 33 | } 34 | 35 | } 36 | -------------------------------------------------------------------------------- /test/src/main/java/com/liferay/portletmvc4spring/test/mock/web/portlet/MockMutableActionParameters.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (c) 2000-2020 the original author or authors. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package com.liferay.portletmvc4spring.test.mock.web.portlet; 17 | 18 | import javax.portlet.MutableActionParameters; 19 | 20 | 21 | /** 22 | * Mock implementation of the {@link MutableActionParameters} interface. 23 | * 24 | * @author Neil Griffin 25 | * @since 5.1.0 26 | */ 27 | public class MockMutableActionParameters extends MockMutablePortletParameters implements MutableActionParameters { 28 | 29 | @Override 30 | public MutableActionParameters clone() { 31 | return null; 32 | } 33 | } 34 | -------------------------------------------------------------------------------- /test/src/main/java/com/liferay/portletmvc4spring/test/mock/web/portlet/MockMutableRenderParameters.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (c) 2000-2020 the original author or authors. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package com.liferay.portletmvc4spring.test.mock.web.portlet; 17 | 18 | import javax.portlet.MutableRenderParameters; 19 | 20 | 21 | /** 22 | * Mock implementation of the {@link MutableRenderParameters} interface. 23 | * 24 | * @author Neil Griffin 25 | * @since 5.1.0 26 | */ 27 | public class MockMutableRenderParameters extends MockMutablePortletParameters implements MutableRenderParameters { 28 | 29 | @Override 30 | public void clearPrivate() { 31 | } 32 | 33 | @Override 34 | public void clearPublic() { 35 | } 36 | 37 | @Override 38 | public MutableRenderParameters clone() { 39 | return null; 40 | } 41 | 42 | @Override 43 | public boolean isPublic(String name) { 44 | return false; 45 | } 46 | } 47 | -------------------------------------------------------------------------------- /test/src/main/java/com/liferay/portletmvc4spring/test/mock/web/portlet/MockMutableResourceParameters.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (c) 2000-2020 the original author or authors. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package com.liferay.portletmvc4spring.test.mock.web.portlet; 17 | 18 | import javax.portlet.MutableResourceParameters; 19 | 20 | 21 | /** 22 | * Mock implementation of the {@link MutableResourceParameters} interface. 23 | * 24 | * @author Neil Griffin 25 | * @since 5.1.0 26 | */ 27 | public class MockMutableResourceParameters extends MockMutablePortletParameters implements MutableResourceParameters { 28 | 29 | @Override 30 | public MutableResourceParameters clone() { 31 | throw new UnsupportedOperationException(); 32 | } 33 | } 34 | -------------------------------------------------------------------------------- /test/src/main/java/com/liferay/portletmvc4spring/test/mock/web/portlet/MockPortletParameters.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (c) 2000-2020 the original author or authors. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package com.liferay.portletmvc4spring.test.mock.web.portlet; 17 | 18 | import java.util.HashMap; 19 | import java.util.Map; 20 | import java.util.Set; 21 | 22 | import javax.portlet.MutablePortletParameters; 23 | import javax.portlet.PortletParameters; 24 | 25 | 26 | /** 27 | * Mock implementation of the {@link PortletParameters} interface. 28 | * 29 | * @author Neil Griffin 30 | * @since 5.1.0 31 | */ 32 | public class MockPortletParameters implements PortletParameters { 33 | 34 | protected Map<String, String[]> parameters = new HashMap<>(); 35 | 36 | @Override 37 | public MutablePortletParameters clone() { 38 | return null; 39 | } 40 | 41 | @Override 42 | public Set<String> getNames() { 43 | return parameters.keySet(); 44 | } 45 | 46 | @Override 47 | public String getValue(String name) { 48 | String[] values = parameters.get(name); 49 | 50 | if ((values != null) && (values.length > 0)) { 51 | return values[0]; 52 | } 53 | 54 | return null; 55 | } 56 | 57 | @Override 58 | public String[] getValues(String name) { 59 | return parameters.get(name); 60 | } 61 | 62 | @Override 63 | public boolean isEmpty() { 64 | return parameters.isEmpty(); 65 | } 66 | 67 | @Override 68 | public int size() { 69 | return parameters.size(); 70 | } 71 | } 72 | -------------------------------------------------------------------------------- /test/src/main/java/com/liferay/portletmvc4spring/test/mock/web/portlet/MockRenderParameters.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (c) 2000-2020 the original author or authors. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package com.liferay.portletmvc4spring.test.mock.web.portlet; 17 | 18 | import javax.portlet.MutableRenderParameters; 19 | import javax.portlet.RenderParameters; 20 | 21 | 22 | /** 23 | * Mock implementation of the {@link RenderParameters} interface. 24 | * 25 | * @author Neil Griffin 26 | * @since 5.1.0 27 | */ 28 | public class MockRenderParameters extends MockPortletParameters implements RenderParameters { 29 | 30 | @Override 31 | public MutableRenderParameters clone() { 32 | return null; 33 | } 34 | 35 | @Override 36 | public boolean isPublic(String name) { 37 | return false; 38 | } 39 | } 40 | -------------------------------------------------------------------------------- /test/src/main/java/com/liferay/portletmvc4spring/test/mock/web/portlet/MockResourceParameters.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (c) 2000-2020 the original author or authors. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package com.liferay.portletmvc4spring.test.mock.web.portlet; 17 | 18 | import javax.portlet.MutableResourceParameters; 19 | import javax.portlet.ResourceParameters; 20 | 21 | 22 | /** 23 | * Mock implementation of the {@link ResourceParameters} interface. 24 | * 25 | * @author Neil Griffin 26 | * @since 5.1.0 27 | */ 28 | public class MockResourceParameters extends MockPortletParameters implements ResourceParameters { 29 | 30 | @Override 31 | public MutableResourceParameters clone() { 32 | return null; 33 | } 34 | } 35 | -------------------------------------------------------------------------------- /test/src/main/java/com/liferay/portletmvc4spring/test/mock/web/portlet/MockResourceResponse.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (c) 2000-2020 the original author or authors. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package com.liferay.portletmvc4spring.test.mock.web.portlet; 17 | 18 | import javax.portlet.ResourceResponse; 19 | 20 | 21 | /** 22 | * Mock implementation of the {@link javax.portlet.ResourceResponse} interface. 23 | * 24 | * @author Juergen Hoeller 25 | * @since 3.0 26 | */ 27 | public class MockResourceResponse extends MockMimeResponse implements ResourceResponse { 28 | 29 | private long contentLength; 30 | 31 | private int status; 32 | 33 | public int getContentLength() { 34 | return (int) this.contentLength; 35 | } 36 | 37 | @Override 38 | public int getStatus() { 39 | return status; 40 | } 41 | 42 | @Override 43 | public void setContentLength(int len) { 44 | this.contentLength = len; 45 | } 46 | 47 | @Override 48 | public void setContentLengthLong(long contentLengthLong) { 49 | this.contentLength = contentLengthLong; 50 | } 51 | 52 | @Override 53 | public void setStatus(int status) { 54 | this.status = status; 55 | } 56 | 57 | } 58 | -------------------------------------------------------------------------------- /test/src/main/java/com/liferay/portletmvc4spring/test/mock/web/portlet/package-info.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (c) 2000-2020 the original author or authors. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | /** 17 | * A comprehensive set of Portlet API mock objects, targeted at usage with Spring's web MVC framework. Useful for 18 | * testing web contexts and controllers. 19 | * 20 | * <p>More convenient to use than dynamic mock objects (<a href="http://www.easymock.org">EasyMock</a>) or existing 21 | * Portlet API mock objects. 22 | */ 23 | package com.liferay.portletmvc4spring.test.mock.web.portlet; 24 | -------------------------------------------------------------------------------- /webflow/src/main/java/com/liferay/portletmvc4spring/webflow/context/portlet/PortletRequestMap.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2000-2020 the original author or authors. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * https://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package com.liferay.portletmvc4spring.webflow.context.portlet; 17 | 18 | import java.util.Iterator; 19 | 20 | import javax.portlet.PortletRequest; 21 | 22 | import org.springframework.binding.collection.StringKeyedMapAdapter; 23 | 24 | import org.springframework.webflow.core.collection.CollectionUtils; 25 | 26 | 27 | /** 28 | * Map backed by the Portlet request attribute map for accessing request local attributes. 29 | * 30 | * @author Keith Donald 31 | * @author Scott Andrews 32 | */ 33 | public class PortletRequestMap extends StringKeyedMapAdapter<Object> { 34 | 35 | /** The wrapped portlet request. */ 36 | private PortletRequest request; 37 | 38 | /** 39 | * Create a new map wrapping the attributes of given request. 40 | */ 41 | public PortletRequestMap(PortletRequest request) { 42 | this.request = request; 43 | } 44 | 45 | protected Object getAttribute(String key) { 46 | return request.getAttribute(key); 47 | } 48 | 49 | protected Iterator<String> getAttributeNames() { 50 | return CollectionUtils.toIterator(request.getAttributeNames()); 51 | } 52 | 53 | protected void removeAttribute(String key) { 54 | request.removeAttribute(key); 55 | } 56 | 57 | protected void setAttribute(String key, Object value) { 58 | request.setAttribute(key, value); 59 | } 60 | } 61 | -------------------------------------------------------------------------------- /webflow/src/main/java/com/liferay/portletmvc4spring/webflow/context/portlet/package-info.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2000-2020 the original author or authors. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * https://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | /** 17 | * Contains the PortletExternalContext implementation for calling into Web Flow from a Portlet. 18 | */ 19 | package com.liferay.portletmvc4spring.webflow.context.portlet; 20 | -------------------------------------------------------------------------------- /webflow/src/main/java/com/liferay/portletmvc4spring/webflow/mvc/builder/package-info.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2000-2020 the original author or authors. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * https://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | /** 17 | * Support for configuring Spring MVC-based ViewFactory implementations when building a Flow. 18 | */ 19 | package com.liferay.portletmvc4spring.webflow.mvc.builder; 20 | -------------------------------------------------------------------------------- /webflow/src/main/java/com/liferay/portletmvc4spring/webflow/mvc/portlet/package-info.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2000-2020 the original author or authors. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * https://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | /** 17 | * The integration between Web Flow and Spring Portlet MVC, Spring's portlet application platform. 18 | */ 19 | package com.liferay.portletmvc4spring.webflow.mvc.portlet; 20 | --------------------------------------------------------------------------------