[jira] [Created] (WICKET-5824) PropertyValidator sets Required flag too late in StatelessForm
Adam Huječek created WICKET-5824: Summary: PropertyValidator sets Required flag too late in StatelessForm Key: WICKET-5824 URL: https://issues.apache.org/jira/browse/WICKET-5824 Project: Wicket Issue Type: Bug Components: wicket-bean-validation Affects Versions: 7.0.0-M4 Environment: Windows 7, Wildfly 8.1.0 Reporter: Adam Huječek Assignee: Igor Vaynberg Priority: Minor I am writing a simple stateless form with validation based on annotations in Wicket 7.0.0-SNAPSHOT. When the model's field is annotated @NotNull and PropertyValidator is added to its form component, the validation error is not generated if user's input is empty. It seems to me that the Required flag is set too late, because while debugging I noticed that isRequired is called at least once before PropertyValidator's onConfigure. In the end the component has the flag set but without effect. As a workaround I have created descendants of CheckBox, TextArea and TextField with isRequired overriden as follows: {code} @Override public boolean isRequired() { if (!isRequiredRecurse) { isRequiredRecurse = true; configure(); //this should let PropertyValidator call setRequired isRequiredRecurse = false; } return super.isRequired(); } {code} Martin Grigorov kindly explained what is wrong here: The problem comes from the fact that you use stateless form. The required flag is set for the form component on the rendered page, but later when the form is submitted a new page with a new form (and components) is created and the flag is gone. Since there is no Behavior#onInitialize() we can only use #onBind() but as WICKET-5329 says at this time the parent may be not yet available and the logic breaks whenCompoundPropertyModel is used. -- This message was sent by Atlassian JIRA (v6.3.4#6332)
[jira] [Updated] (WICKET-5823) DefaultAuthenticationStrategy should be modified to reduce copy/paste while extending it's functionality
[ https://issues.apache.org/jira/browse/WICKET-5823?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ] Maxim Solodovnik updated WICKET-5823: - Attachment: wicket7.patch wicket6.patch DefaultAuthenticationStrategy should be modified to reduce copy/paste while extending it's functionality Key: WICKET-5823 URL: https://issues.apache.org/jira/browse/WICKET-5823 Project: Wicket Issue Type: Improvement Components: wicket Affects Versions: 6.18.0, 7.0.0-M4 Reporter: Maxim Solodovnik Labels: patch Attachments: wicket6.patch, wicket7.patch Currently all fields are private and methods should be copy/pasted to extend DefaultAuthenticationStrategy. I propose to extend IAuthenticationStrategy in wicket7 to enable store as much fields in cookie as necessary and modify wicket6 without code-break. Please see the patches attached -- This message was sent by Atlassian JIRA (v6.3.4#6332)
[jira] [Created] (WICKET-5823) DefaultAuthenticationStrategy should be modified to reduce copy/paste while extending it's functionality
Maxim Solodovnik created WICKET-5823: Summary: DefaultAuthenticationStrategy should be modified to reduce copy/paste while extending it's functionality Key: WICKET-5823 URL: https://issues.apache.org/jira/browse/WICKET-5823 Project: Wicket Issue Type: Improvement Components: wicket Affects Versions: 7.0.0-M4, 6.18.0 Reporter: Maxim Solodovnik Currently all fields are private and methods should be copy/pasted to extend DefaultAuthenticationStrategy. I propose to extend IAuthenticationStrategy in wicket7 to enable store as much fields in cookie as necessary and modify wicket6 without code-break. Please see the patches attached -- This message was sent by Atlassian JIRA (v6.3.4#6332)
[jira] [Commented] (WICKET-5801) Responsive Images
[ https://issues.apache.org/jira/browse/WICKET-5801?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanelfocusedCommentId=14295386#comment-14295386 ] ASF subversion and git services commented on WICKET-5801: - Commit 6d0eae5f4f8fcfd9e56dc2bf6115feb970d32a82 in wicket's branch refs/heads/master from [~mgrigorov] [ https://git-wip-us.apache.org/repos/asf?p=wicket.git;h=6d0eae5 ] WICKET-5801 Responsive Images Follow Wicket code style. Java 7 diamonds Fix the demo. Responsive Images - Key: WICKET-5801 URL: https://issues.apache.org/jira/browse/WICKET-5801 Project: Wicket Issue Type: Improvement Components: wicket Affects Versions: 7.0.0-M5 Reporter: Tobias Soloschenko Labels: features It would be nice to provide the functionality of responsive images to wicket: http://responsiveimages.org/ http://www.w3.org/html/wg/drafts/html/master/embedded-content.html#introduction-0 This would require to refactor the Image class and provide some new classes for picture and source tags. A documentation / implementation is provided here: https://github.com/klopfdreh/wicket-components-playground The changes are source backward compatible to the current implementation of Wicket 6 / 7 and there are also some junit tests. -- This message was sent by Atlassian JIRA (v6.3.4#6332)
[4/4] wicket git commit: Wicket-5801 Responsive Images
Wicket-5801 Responsive Images Project: http://git-wip-us.apache.org/repos/asf/wicket/repo Commit: http://git-wip-us.apache.org/repos/asf/wicket/commit/0880713f Tree: http://git-wip-us.apache.org/repos/asf/wicket/tree/0880713f Diff: http://git-wip-us.apache.org/repos/asf/wicket/diff/0880713f Branch: refs/heads/master Commit: 0880713fa15ee8ce67c8005759312964609f5e7c Parents: 1c1bb4d Author: klopfdreh klopfdreh@tobiass-mbp Authored: Tue Jan 20 00:21:34 2015 +0100 Committer: Martin Tzvetanov Grigorov mgrigo...@apache.org Committed: Wed Jan 28 18:53:33 2015 +0200 -- .../apache/wicket/markup/html/image/Image.java | 277 --- .../wicket/markup/html/image/Picture.java | 67 + .../apache/wicket/markup/html/image/Source.java | 123 .../markup/html/image/ImagePictureTestPage.html | 13 + .../markup/html/image/ImagePictureTestPage.java | 45 +++ .../image/ImageResourceReferenceTestPage.html | 9 + .../image/ImageResourceReferenceTestPage.java | 46 +++ .../markup/html/image/ImageSrcSetTestPage.html | 9 + .../markup/html/image/ImageSrcSetTestPage.java | 37 +++ .../markup/html/image/ResponsiveImageTest.java | 90 ++ .../org/apache/wicket/examples/images/Home.html | 6 + .../org/apache/wicket/examples/images/Home.java | 32 +++ .../wicket/examples/images/Image2_large.gif | Bin 0 - 1562 bytes .../wicket/examples/images/Image2_medium.gif| Bin 0 - 1276 bytes .../wicket/examples/images/Image2_small.gif | Bin 0 - 1092 bytes 15 files changed, 718 insertions(+), 36 deletions(-) -- http://git-wip-us.apache.org/repos/asf/wicket/blob/0880713f/wicket-core/src/main/java/org/apache/wicket/markup/html/image/Image.java -- diff --git a/wicket-core/src/main/java/org/apache/wicket/markup/html/image/Image.java b/wicket-core/src/main/java/org/apache/wicket/markup/html/image/Image.java index 93d4475..74b6512 100644 --- a/wicket-core/src/main/java/org/apache/wicket/markup/html/image/Image.java +++ b/wicket-core/src/main/java/org/apache/wicket/markup/html/image/Image.java @@ -17,6 +17,9 @@ package org.apache.wicket.markup.html.image; import java.lang.reflect.Method; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.List; import org.apache.wicket.Component; import org.apache.wicket.IResourceListener; @@ -32,22 +35,37 @@ import org.apache.wicket.request.resource.IResource; import org.apache.wicket.request.resource.ResourceReference; /** - * An Image component displays a localizable image resource. + * An Image component displays localizable image resources. * p * For details of how Images load, generate and manage images, see {@link LocalizedImageResource}. * + * The first ResourceReference / ImageResource is used for the src attribute within the img tag, all + * following are applied to the srcset. If setXValues(String... values) is used the values are set + * behind the srcset elements in the order they are given to the setXValues(String... valus) method. + * The separated values in the sizes attribute are set with setSizes(String... sizes) + * * @see NonCachingImage * * @author Jonathan Locke + * @author Tobias Soloschenko * */ public class Image extends WebComponent implements IResourceListener { private static final long serialVersionUID = 1L; - /** The image resource this image component references */ + /** The image resource this image component references (src attribute) */ private final LocalizedImageResource localizedImageResource = new LocalizedImageResource(this); + /** The image resources this image component references (srcset attribute) */ + private final ListLocalizedImageResource localizedImageResources = new ArrayListLocalizedImageResource(); + + /** The x values to be used within the srcset */ + private ListString xValues = null; + + /** The sizes of the responsive images */ + private ListString sizes = null; + /** * This constructor can be used if you override {@link #getImageResourceReference()} or * {@link #getImageResource()} @@ -72,11 +90,14 @@ public class Image extends WebComponent implements IResourceListener * @param id *See Component * @param resourceReference -*The shared image resource +*The shared image resource used in the src attribute +* @param resourceReferences +*The shared image resources used in the srcset attribute */ - public Image(final String id, final ResourceReference resourceReference) + public Image(final String id, final ResourceReference resourceReference, + final ResourceReference... resourceReferences) { -
[1/4] wicket git commit: WICKET-5801 Responsive Images
Repository: wicket Updated Branches: refs/heads/master 1c1bb4d69 - 6d0eae5f4 WICKET-5801 Responsive Images Follow Wicket code style. Java 7 diamonds Fix the demo. Project: http://git-wip-us.apache.org/repos/asf/wicket/repo Commit: http://git-wip-us.apache.org/repos/asf/wicket/commit/6d0eae5f Tree: http://git-wip-us.apache.org/repos/asf/wicket/tree/6d0eae5f Diff: http://git-wip-us.apache.org/repos/asf/wicket/diff/6d0eae5f Branch: refs/heads/master Commit: 6d0eae5f4f8fcfd9e56dc2bf6115feb970d32a82 Parents: 2948a2c Author: Martin Tzvetanov Grigorov mgrigo...@apache.org Authored: Wed Jan 28 18:52:08 2015 +0200 Committer: Martin Tzvetanov Grigorov mgrigo...@apache.org Committed: Wed Jan 28 18:53:33 2015 +0200 -- .../apache/wicket/markup/html/image/Image.java | 155 ++- .../wicket/markup/html/image/Picture.java | 1 - .../apache/wicket/markup/html/image/Source.java | 9 +- .../image/ImageResourceReferenceTestPage.java | 2 +- .../markup/html/image/ResponsiveImageTest.java | 29 ++-- .../org/apache/wicket/examples/images/Home.java | 4 +- 6 files changed, 98 insertions(+), 102 deletions(-) -- http://git-wip-us.apache.org/repos/asf/wicket/blob/6d0eae5f/wicket-core/src/main/java/org/apache/wicket/markup/html/image/Image.java -- diff --git a/wicket-core/src/main/java/org/apache/wicket/markup/html/image/Image.java b/wicket-core/src/main/java/org/apache/wicket/markup/html/image/Image.java index 644e491..6c650cb 100644 --- a/wicket-core/src/main/java/org/apache/wicket/markup/html/image/Image.java +++ b/wicket-core/src/main/java/org/apache/wicket/markup/html/image/Image.java @@ -48,17 +48,37 @@ import org.apache.wicket.request.resource.ResourceReference; * * @author Jonathan Locke * @author Tobias Soloschenko - * */ public class Image extends WebComponent implements IResourceListener { private static final long serialVersionUID = 1L; + /** +* To be used for the crossOrigin attribute +* +* @see {@link #setCrossOrigin(Cors)} +*/ + public enum Cors { + ANONYMOUS(anonymous), + USE_CREDENTIALS(user-credentials), + NO_CORS(); + + private final String realName; + + private Cors(String realName) { + this.realName = realName; + } + + public String getRealName() { + return realName; + } + } + /** The image resource this image component references (src attribute) */ private final LocalizedImageResource localizedImageResource = new LocalizedImageResource(this); /** The image resources this image component references (srcset attribute) */ - private final ListLocalizedImageResource localizedImageResources = new ArrayListLocalizedImageResource(); + private final ListLocalizedImageResource localizedImageResources = new ArrayList(); /** The x values to be used within the srcset */ private ListString xValues = null; @@ -69,7 +89,7 @@ public class Image extends WebComponent implements IResourceListener /** * Cross origin settings */ - private Cors crossorigin = null; + private Cors crossOrigin = null; /** * This constructor can be used if you override {@link #getImageResourceReference()} or @@ -128,8 +148,8 @@ public class Image extends WebComponent implements IResourceListener PageParameters resourceParameters, final ResourceReference... resourceReferences) { super(id); - this.setImageResourceReference(resourceParameters, resourceReference); - this.setImageResourceReferences(resourceParameters, resourceReferences); + setImageResourceReference(resourceParameters, resourceReference); + setImageResourceReferences(resourceParameters, resourceReferences); } /** @@ -150,8 +170,8 @@ public class Image extends WebComponent implements IResourceListener public Image(final String id, final IResource imageResource, final IResource... imageResources) { super(id); - this.setImageResource(imageResource); - this.setImageResources(imageResources); + setImageResource(imageResource); + setImageResources(imageResources); } /** @@ -171,7 +191,7 @@ public class Image extends WebComponent implements IResourceListener */ public Image(final String id, final String string) { - this(id, new ModelString(string)); + this(id, new Model(string)); } /** @@ -181,7 +201,7 @@ public class
[jira] [Commented] (WICKET-5692) Misleading message in PropertyValidator
[ https://issues.apache.org/jira/browse/WICKET-5692?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanelfocusedCommentId=14295388#comment-14295388 ] ASF GitHub Bot commented on WICKET-5692: Github user tkruse closed the pull request at: https://github.com/apache/wicket/pull/77 Misleading message in PropertyValidator --- Key: WICKET-5692 URL: https://issues.apache.org/jira/browse/WICKET-5692 Project: Wicket Issue Type: Improvement Reporter: Thibault Kruse Assignee: Martin Grigorov Priority: Minor Fix For: 6.18.0, 7.0.0-M4 in org.apache.wicket.bean.validation.PropertyValidator.java: {code} if (property_ == null) { throw new IllegalStateException( Could not resolve Property from component: + component + . Either specify the Property in the constructor or use a model that works in combination with a + IPropertyResolver.class.getSimpleName() + to resolve the Property automatically); } {code} The error message is misleading, as other causes might lead to a result of null. As PropertyResolvers can be of any type, the message should not assume any given cause, but may hint at common errors. In particular in my case when Using a bean Foo having a field bar of Type Bar, and a Model on an instance foo of Foo having null for field bar. Instead, it would be nice if the Error Message made an attempt to cast the component model to AbstractPropertyModel and print the propertyExpression, as well as the type of the modelObject, but without failure if the cast is not possible, and reporting the modelObject is null if so. -- This message was sent by Atlassian JIRA (v6.3.4#6332)
[jira] [Resolved] (WICKET-5801) Responsive Images
[ https://issues.apache.org/jira/browse/WICKET-5801?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ] Martin Grigorov resolved WICKET-5801. - Resolution: Fixed Fix Version/s: 7.0.0 Assignee: Martin Grigorov Responsive Images - Key: WICKET-5801 URL: https://issues.apache.org/jira/browse/WICKET-5801 Project: Wicket Issue Type: Improvement Components: wicket Affects Versions: 7.0.0-M5 Reporter: Tobias Soloschenko Assignee: Martin Grigorov Labels: features Fix For: 7.0.0 It would be nice to provide the functionality of responsive images to wicket: http://responsiveimages.org/ http://www.w3.org/html/wg/drafts/html/master/embedded-content.html#introduction-0 This would require to refactor the Image class and provide some new classes for picture and source tags. A documentation / implementation is provided here: https://github.com/klopfdreh/wicket-components-playground The changes are source backward compatible to the current implementation of Wicket 6 / 7 and there are also some junit tests. -- This message was sent by Atlassian JIRA (v6.3.4#6332)
[jira] [Commented] (WICKET-5775) Replace the session upon successful signin for better support for Session Fixation
[ https://issues.apache.org/jira/browse/WICKET-5775?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanelfocusedCommentId=14295884#comment-14295884 ] Martin Grigorov commented on WICKET-5775: - This change seems to break applications which use Apache Shiro for authen/authorization :-/ After replacing the session Shiro continues to use the old http session and any roles/permissions checks fail. Workaround is to override Wicket's Session#replaceSession() to do nothing. Replace the session upon successful signin for better support for Session Fixation -- Key: WICKET-5775 URL: https://issues.apache.org/jira/browse/WICKET-5775 Project: Wicket Issue Type: Improvement Components: wicket-auth-roles Affects Versions: 6.18.0, 7.0.0-M4 Reporter: Martin Grigorov Assignee: Martin Grigorov Priority: Minor Fix For: 7.0.0-M5, 6.19.0 See http://markmail.org/message/twbipkcmc5v6rto7: Hi all, during implementing the login a my current project I came across WICKET-1767[1] which deals with session fixation problems, but to my surprise it looks like the newly created method is not called automatically by Wicket. If I search the code base for replaceSession( I only get one result, the method itself. Is there any reason why Wicket doesn't call the method automatically? Looks to me like AuthenticatedWebSession.signIn would be a good place to call it automatically. When should I call it instead, at the beginning of AuthenticatedWebSession.authenticate? This would prevent session fixation even if exception got throw during the authentication itself for any reason. -- This message was sent by Atlassian JIRA (v6.3.4#6332)
[jira] [Commented] (WICKET-5801) Responsive Images
[ https://issues.apache.org/jira/browse/WICKET-5801?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanelfocusedCommentId=14295842#comment-14295842 ] ASF GitHub Bot commented on WICKET-5801: Github user klopfdreh closed the pull request at: https://github.com/apache/wicket/pull/85 Responsive Images - Key: WICKET-5801 URL: https://issues.apache.org/jira/browse/WICKET-5801 Project: Wicket Issue Type: Improvement Components: wicket Affects Versions: 7.0.0-M5 Reporter: Tobias Soloschenko Assignee: Martin Grigorov Labels: features Fix For: 7.0.0 It would be nice to provide the functionality of responsive images to wicket: http://responsiveimages.org/ http://www.w3.org/html/wg/drafts/html/master/embedded-content.html#introduction-0 This would require to refactor the Image class and provide some new classes for picture and source tags. A documentation / implementation is provided here: https://github.com/klopfdreh/wicket-components-playground The changes are source backward compatible to the current implementation of Wicket 6 / 7 and there are also some junit tests. -- This message was sent by Atlassian JIRA (v6.3.4#6332)
[jira] [Commented] (WICKET-5801) Responsive Images
[ https://issues.apache.org/jira/browse/WICKET-5801?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanelfocusedCommentId=14295841#comment-14295841 ] ASF GitHub Bot commented on WICKET-5801: Github user klopfdreh commented on the pull request: https://github.com/apache/wicket/pull/85#issuecomment-71913385 Integrated. Thanks a lot! Responsive Images - Key: WICKET-5801 URL: https://issues.apache.org/jira/browse/WICKET-5801 Project: Wicket Issue Type: Improvement Components: wicket Affects Versions: 7.0.0-M5 Reporter: Tobias Soloschenko Assignee: Martin Grigorov Labels: features Fix For: 7.0.0 It would be nice to provide the functionality of responsive images to wicket: http://responsiveimages.org/ http://www.w3.org/html/wg/drafts/html/master/embedded-content.html#introduction-0 This would require to refactor the Image class and provide some new classes for picture and source tags. A documentation / implementation is provided here: https://github.com/klopfdreh/wicket-components-playground The changes are source backward compatible to the current implementation of Wicket 6 / 7 and there are also some junit tests. -- This message was sent by Atlassian JIRA (v6.3.4#6332)
[jira] [Created] (WICKET-5826) Add setContentType to DownloadLink
Craig Jorgensen created WICKET-5826: --- Summary: Add setContentType to DownloadLink Key: WICKET-5826 URL: https://issues.apache.org/jira/browse/WICKET-5826 Project: Wicket Issue Type: Improvement Components: wicket Affects Versions: 6.18.0 Reporter: Craig Jorgensen Priority: Minor I am generating an excel file when the DownloadLink is clicked on. Everything worked fine when I was running locally for development (meaning Excel would automatically start and my excel file would be loaded) but when I used our webdev server, the file would get appended with an .htm and the browser would try to display the excel file which resulted in garbage on the screen. I eventually discovered that the contentType for the FileResourceStream in the DownloadLink::onClick() method was set to null and there is no way (that I know of to change it). I modified the DownloadLink slightly to allow this change. If there is a better way to handle this, I would like to know it. Otherwise, I would suggest adding my changes to the code. Basically, I added a private member variable. private String contentType = null; to the DownloadLink class with a getter and a setter and modified the onClick() method to allow me to set the FileResourceStream ContentType. @Override public void onClick() { final File file = getModelObject(); if (file == null) { throw new IllegalStateException(getClass().getName() + failed to retrieve a File object from model); } String fileName = fileNameModel != null ? fileNameModel.getObject() : null; if (Strings.isEmpty(fileName)) { fileName = file.getName(); } fileName = UrlEncoder.QUERY_INSTANCE.encode(fileName, getRequest().getCharset()); IResourceStream resourceStream = new FileResourceStream(new org.apache.wicket.util.file.File(file)) { @Override public String getContentType() { return contentType; } }; getRequestCycle().scheduleRequestHandlerAfterCurrent( new ResourceStreamRequestHandler(resourceStream) { @Override public void respond(IRequestCycle requestCycle) { super.respond(requestCycle); if (deleteAfter) { Files.remove(file); } } }.setFileName(fileName) .setContentDisposition(ContentDisposition.ATTACHMENT) .setCacheDuration(cacheDuration)); } -- This message was sent by Atlassian JIRA (v6.3.4#6332)
[jira] [Commented] (WICKET-5825) Deployment of wicket-examples.war fails in Tomcat
[ https://issues.apache.org/jira/browse/WICKET-5825?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanelfocusedCommentId=14295323#comment-14295323 ] Martin Grigorov commented on WICKET-5825: - At the moment mvn dependency:tree returns; INFO] +- org.hibernate:hibernate-validator:jar:5.1.2.Final:compile [INFO] | +- javax.validation:validation-api:jar:1.1.0.Final:provided Deployment of wicket-examples.war fails in Tomcat - Key: WICKET-5825 URL: https://issues.apache.org/jira/browse/WICKET-5825 Project: Wicket Issue Type: Bug Components: wicket-examples Affects Versions: 7.0.0-M5 Reporter: Martin Grigorov Trying to deploy wicket-examples.war in Tomcat 7(.0.55) and 8(.0.17) fails with: Caused by: java.lang.ClassNotFoundException: javax.validation.constraints.Pattern$Flag at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1720) at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1571) ... 51 more It seems javax-validation-api.jar should be added to the dependencies ?! -- This message was sent by Atlassian JIRA (v6.3.4#6332)
[jira] [Created] (WICKET-5825) Deployment of wicket-examples.war fails in Tomcat
Martin Grigorov created WICKET-5825: --- Summary: Deployment of wicket-examples.war fails in Tomcat Key: WICKET-5825 URL: https://issues.apache.org/jira/browse/WICKET-5825 Project: Wicket Issue Type: Bug Components: wicket-examples Affects Versions: 7.0.0-M5 Reporter: Martin Grigorov Trying to deploy wicket-examples.war in Tomcat 7(.0.55) and 8(.0.17) fails with: Caused by: java.lang.ClassNotFoundException: javax.validation.constraints.Pattern$Flag at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1720) at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1571) ... 51 more It seems javax-validation-api.jar should be added to the dependencies ?! -- This message was sent by Atlassian JIRA (v6.3.4#6332)
wicket git commit: WICKET-5808 Add support for extracting the generic element for List/Set/Map subtypes
Repository: wicket Updated Branches: refs/heads/WICKET-5808-ArrayList [created] cc075e9c2 WICKET-5808 Add support for extracting the generic element for List/Set/Map subtypes Project: http://git-wip-us.apache.org/repos/asf/wicket/repo Commit: http://git-wip-us.apache.org/repos/asf/wicket/commit/cc075e9c Tree: http://git-wip-us.apache.org/repos/asf/wicket/tree/cc075e9c Diff: http://git-wip-us.apache.org/repos/asf/wicket/diff/cc075e9c Branch: refs/heads/WICKET-5808-ArrayList Commit: cc075e9c25050ff8b9153d2b759f9c6d783c22f1 Parents: 6d0eae5 Author: Martin Tzvetanov Grigorov mgrigo...@apache.org Authored: Thu Jan 29 00:28:46 2015 +0200 Committer: Martin Tzvetanov Grigorov mgrigo...@apache.org Committed: Thu Jan 29 00:28:46 2015 +0200 -- .../apache/wicket/spring/SpringBeanLocator.java | 8 ++--- .../wicket/spring/FieldBeansCollectorTest.java | 18 +- .../annot/SpringBeanWithGenericsTest.java | 35 ++-- 3 files changed, 45 insertions(+), 16 deletions(-) -- http://git-wip-us.apache.org/repos/asf/wicket/blob/cc075e9c/wicket-spring/src/main/java/org/apache/wicket/spring/SpringBeanLocator.java -- diff --git a/wicket-spring/src/main/java/org/apache/wicket/spring/SpringBeanLocator.java b/wicket-spring/src/main/java/org/apache/wicket/spring/SpringBeanLocator.java index 1f51ef9..60ccbfa 100644 --- a/wicket-spring/src/main/java/org/apache/wicket/spring/SpringBeanLocator.java +++ b/wicket-spring/src/main/java/org/apache/wicket/spring/SpringBeanLocator.java @@ -137,7 +137,7 @@ public class SpringBeanLocator implements IProxyTargetLocator /** * If the field type is a collection (Map, Set or List) extracts type -* informations about its elements. +* information about its elements. * * @param fieldResolvableType * the resolvable type of the field @@ -147,13 +147,13 @@ public class SpringBeanLocator implements IProxyTargetLocator { Class? clazz = fieldResolvableType.resolve(); - if (clazz == Set.class || clazz == List.class) + if (Set.class.isAssignableFrom(clazz) || List.class.isAssignableFrom(clazz)) { return fieldResolvableType.getGeneric(); } - else if (clazz == Map.class) + else if (Map.class.isAssignableFrom(clazz)) { - return fieldResolvableType.getGeneric(1); + return fieldResolvableType.getGeneric(1); } return null; http://git-wip-us.apache.org/repos/asf/wicket/blob/cc075e9c/wicket-spring/src/test/java/org/apache/wicket/spring/FieldBeansCollectorTest.java -- diff --git a/wicket-spring/src/test/java/org/apache/wicket/spring/FieldBeansCollectorTest.java b/wicket-spring/src/test/java/org/apache/wicket/spring/FieldBeansCollectorTest.java index 4a20d44..62597f4 100644 --- a/wicket-spring/src/test/java/org/apache/wicket/spring/FieldBeansCollectorTest.java +++ b/wicket-spring/src/test/java/org/apache/wicket/spring/FieldBeansCollectorTest.java @@ -29,28 +29,28 @@ import org.springframework.core.ResolvableType; public class FieldBeansCollectorTest { public ListListString listOfStringList; - + public List genericList; - + @Test public void resolveGenericList() throws Exception { Field field = getClass().getField(listOfStringList); ResolvableType resolvableType = ResolvableType.forField(field); - + FieldBeansCollector fieldBeansCollector = new FieldBeansCollector(resolvableType); - - assertTrue(fieldBeansCollector.getFieldType() == FieldType.LIST); + + assertTrue(fieldBeansCollector.getFieldType() == FieldType.LIST); } - + @Test public void resolveRowList() throws Exception { Field field = getClass().getField(genericList); - + ResolvableType resolvableType = ResolvableType.forField(field); FieldBeansCollector fieldBeansCollector = new FieldBeansCollector(resolvableType); - + assertTrue(fieldBeansCollector.getFieldType() == FieldType.LIST); } -} \ No newline at end of file +} http://git-wip-us.apache.org/repos/asf/wicket/blob/cc075e9c/wicket-spring/src/test/java/org/apache/wicket/spring/injection/annot/SpringBeanWithGenericsTest.java -- diff
[jira] [Commented] (WICKET-5808) SpringBean, support generic beans
[ https://issues.apache.org/jira/browse/WICKET-5808?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanelfocusedCommentId=14295966#comment-14295966 ] ASF subversion and git services commented on WICKET-5808: - Commit cc075e9c25050ff8b9153d2b759f9c6d783c22f1 in wicket's branch refs/heads/WICKET-5808-ArrayList from [~mgrigorov] [ https://git-wip-us.apache.org/repos/asf?p=wicket.git;h=cc075e9 ] WICKET-5808 Add support for extracting the generic element for List/Set/Map subtypes SpringBean, support generic beans - Key: WICKET-5808 URL: https://issues.apache.org/jira/browse/WICKET-5808 Project: Wicket Issue Type: Improvement Components: wicket-spring Affects Versions: 6.18.0, 7.0.0-M4 Environment: Spring Framework 4.1.4.RELEASE (currently the latest version) Reporter: Flying Wolf Assignee: Andrea Del Bene Priority: Minor Labels: generics, spring Fix For: 7.0.0-M5 Attachments: AnnotProxyFieldValueFactory.java, AnnotProxyFieldValueFactory.new.java, CollectionResolving.java, SpringBeanLocator.java, SpringBeanLocator.new.java, myproject.zip *Short Description:* Since Spring Framework 4.0, Spring is able to inject/autowire generic beans like: {code}@Autowired public GenericDaoCar genericCarDao;{code} As is described here: http://spring.io/blog/2013/12/03/spring-framework-4-0-and-java-generics . However, SpringBean doesn't seem to support this yet, resulting in a IllegalStateException. *Detailed Description* Given the following code: {code}public interface GenericDaoT {}{code} {code}@Repository public class CarDao implements GenericDaoCar {}{code} {code}@Repository public class PhoneDao implements GenericDaoPhone {}{code} {code}@Component public class DaoClient { @Autowired public GenericDaoCar genericCarDao; @Autowired public CarDao nonGenericCarDao; }{code} Spring 4 is able to inject both genericCaoDao and nonGenericCarDao into the DaoClient class. Performing the same using SpringBean, fails: {code}public class HomePage extends WebPage { @SpringBean private CarDao nonGenericCarDao; @SpringBean private GenericDaoCar genericCarDao; //. } {code} In this case, SpringBean is unable to inject genericCarDao, and throws the following error: {code} Caused by: java.lang.IllegalStateException: More than one bean of type [com.mycompany.springcomponents.GenericDao] found, you have to specify the name of the bean (@SpringBean(name=foo)) or (@Named(foo) if using @javax.inject classes) in order to resolve this conflict. Matched beans: carDao,phoneDao at org.apache.wicket.spring.injection.annot.AnnotProxyFieldValueFactory.getBeanNameOfClass(AnnotProxyFieldValueFactory.java:289) at org.apache.wicket.spring.injection.annot.AnnotProxyFieldValueFactory.getBeanName(AnnotProxyFieldValueFactory.java:198) at org.apache.wicket.spring.injection.annot.AnnotProxyFieldValueFactory.getFieldValue(AnnotProxyFieldValueFactory.java:130) at org.apache.wicket.injection.Injector.inject(Injector.java:111) at org.apache.wicket.spring.injection.annot.SpringComponentInjector.inject(SpringComponentInjector.java:124) at org.apache.wicket.spring.injection.annot.SpringComponentInjector.onInstantiation(SpringComponentInjector.java:130) at org.apache.wicket.application.ComponentInstantiationListenerCollection$1.notify(ComponentInstantiationListenerCollection.java:38) at org.apache.wicket.application.ComponentInstantiationListenerCollection$1.notify(ComponentInstantiationListenerCollection.java:34) at org.apache.wicket.util.listener.ListenerCollection.notify(ListenerCollection.java:80) at org.apache.wicket.application.ComponentInstantiationListenerCollection.onInstantiation(ComponentInstantiationListenerCollection.java:33) at org.apache.wicket.Component.init(Component.java:687) at org.apache.wicket.MarkupContainer.init(MarkupContainer.java:121) at org.apache.wicket.Page.init(Page.java:168) at org.apache.wicket.Page.init(Page.java:157) at org.apache.wicket.markup.html.WebPage.init(WebPage.java:106) at com.mycompany.HomePage.init(HomePage.java:22) {code} *Workaround solution:* Explicitly using bean names (qualifiers) does work. In this case {code} @SpringBean private CarDao nonGenericCarDao; @SpringBean private GenericDaoCar genericCarDao; {code} has to be changed to: {code} @SpringBean(name = carDao) private CarDao nonGenericCarDao; @SpringBean(name = carDao) private GenericDaoCar genericCarDao; {code} *Description of some of the attached files:* * pom.xml: added spring-context, spring-web, wicket-spring dependencies. Changed java version to 1.8. *
[jira] [Commented] (WICKET-5808) SpringBean, support generic beans
[ https://issues.apache.org/jira/browse/WICKET-5808?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanelfocusedCommentId=14296023#comment-14296023 ] Tobias Soloschenko commented on WICKET-5808: The bean type should be resolved to String not to null as it is defined in the generic, but it should not be allowed to use generic autowiring for implementation of collections like: @SpringBean private ArrayListMyServiceString myServiceList Because if you have a closer look into the code of FieldBeansCollector an instance of HashMap / ArrayList / HashSet is returned. So if you have a Special MyList which is assignable to List an ArrayList would be returned which causes an exception for: @SpringBean private MyListServiceString myServiceList Because an ArrayList would be returned for the wired Field. MyList ArrayList SpringBean, support generic beans - Key: WICKET-5808 URL: https://issues.apache.org/jira/browse/WICKET-5808 Project: Wicket Issue Type: Improvement Components: wicket-spring Affects Versions: 6.18.0, 7.0.0-M4 Environment: Spring Framework 4.1.4.RELEASE (currently the latest version) Reporter: Flying Wolf Assignee: Andrea Del Bene Priority: Minor Labels: generics, spring Fix For: 7.0.0-M5 Attachments: AnnotProxyFieldValueFactory.java, AnnotProxyFieldValueFactory.new.java, CollectionResolving.java, SpringBeanLocator.java, SpringBeanLocator.new.java, myproject.zip *Short Description:* Since Spring Framework 4.0, Spring is able to inject/autowire generic beans like: {code}@Autowired public GenericDaoCar genericCarDao;{code} As is described here: http://spring.io/blog/2013/12/03/spring-framework-4-0-and-java-generics . However, SpringBean doesn't seem to support this yet, resulting in a IllegalStateException. *Detailed Description* Given the following code: {code}public interface GenericDaoT {}{code} {code}@Repository public class CarDao implements GenericDaoCar {}{code} {code}@Repository public class PhoneDao implements GenericDaoPhone {}{code} {code}@Component public class DaoClient { @Autowired public GenericDaoCar genericCarDao; @Autowired public CarDao nonGenericCarDao; }{code} Spring 4 is able to inject both genericCaoDao and nonGenericCarDao into the DaoClient class. Performing the same using SpringBean, fails: {code}public class HomePage extends WebPage { @SpringBean private CarDao nonGenericCarDao; @SpringBean private GenericDaoCar genericCarDao; //. } {code} In this case, SpringBean is unable to inject genericCarDao, and throws the following error: {code} Caused by: java.lang.IllegalStateException: More than one bean of type [com.mycompany.springcomponents.GenericDao] found, you have to specify the name of the bean (@SpringBean(name=foo)) or (@Named(foo) if using @javax.inject classes) in order to resolve this conflict. Matched beans: carDao,phoneDao at org.apache.wicket.spring.injection.annot.AnnotProxyFieldValueFactory.getBeanNameOfClass(AnnotProxyFieldValueFactory.java:289) at org.apache.wicket.spring.injection.annot.AnnotProxyFieldValueFactory.getBeanName(AnnotProxyFieldValueFactory.java:198) at org.apache.wicket.spring.injection.annot.AnnotProxyFieldValueFactory.getFieldValue(AnnotProxyFieldValueFactory.java:130) at org.apache.wicket.injection.Injector.inject(Injector.java:111) at org.apache.wicket.spring.injection.annot.SpringComponentInjector.inject(SpringComponentInjector.java:124) at org.apache.wicket.spring.injection.annot.SpringComponentInjector.onInstantiation(SpringComponentInjector.java:130) at org.apache.wicket.application.ComponentInstantiationListenerCollection$1.notify(ComponentInstantiationListenerCollection.java:38) at org.apache.wicket.application.ComponentInstantiationListenerCollection$1.notify(ComponentInstantiationListenerCollection.java:34) at org.apache.wicket.util.listener.ListenerCollection.notify(ListenerCollection.java:80) at org.apache.wicket.application.ComponentInstantiationListenerCollection.onInstantiation(ComponentInstantiationListenerCollection.java:33) at org.apache.wicket.Component.init(Component.java:687) at org.apache.wicket.MarkupContainer.init(MarkupContainer.java:121) at org.apache.wicket.Page.init(Page.java:168) at org.apache.wicket.Page.init(Page.java:157) at org.apache.wicket.markup.html.WebPage.init(WebPage.java:106) at com.mycompany.HomePage.init(HomePage.java:22) {code} *Workaround solution:* Explicitly using bean names (qualifiers) does work. In this case {code} @SpringBean private CarDao nonGenericCarDao; @SpringBean private GenericDaoCar genericCarDao;
[jira] [Commented] (WICKET-5808) SpringBean, support generic beans
[ https://issues.apache.org/jira/browse/WICKET-5808?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanelfocusedCommentId=14295973#comment-14295973 ] Martin Grigorov commented on WICKET-5808: - [~klopfdreh] Please take a look at the change I've made in branch 'WICKET-5808-ArrayList'. With my change org.apache.wicket.spring.SpringBeanLocator#fieldElementsResolvableType is resolved to String when the bean type is ArrayListString. With the old code it is resolved to null. The test case seems to work in both cases, so I'm not sure whether there is a big improvement. SpringBean, support generic beans - Key: WICKET-5808 URL: https://issues.apache.org/jira/browse/WICKET-5808 Project: Wicket Issue Type: Improvement Components: wicket-spring Affects Versions: 6.18.0, 7.0.0-M4 Environment: Spring Framework 4.1.4.RELEASE (currently the latest version) Reporter: Flying Wolf Assignee: Andrea Del Bene Priority: Minor Labels: generics, spring Fix For: 7.0.0-M5 Attachments: AnnotProxyFieldValueFactory.java, AnnotProxyFieldValueFactory.new.java, CollectionResolving.java, SpringBeanLocator.java, SpringBeanLocator.new.java, myproject.zip *Short Description:* Since Spring Framework 4.0, Spring is able to inject/autowire generic beans like: {code}@Autowired public GenericDaoCar genericCarDao;{code} As is described here: http://spring.io/blog/2013/12/03/spring-framework-4-0-and-java-generics . However, SpringBean doesn't seem to support this yet, resulting in a IllegalStateException. *Detailed Description* Given the following code: {code}public interface GenericDaoT {}{code} {code}@Repository public class CarDao implements GenericDaoCar {}{code} {code}@Repository public class PhoneDao implements GenericDaoPhone {}{code} {code}@Component public class DaoClient { @Autowired public GenericDaoCar genericCarDao; @Autowired public CarDao nonGenericCarDao; }{code} Spring 4 is able to inject both genericCaoDao and nonGenericCarDao into the DaoClient class. Performing the same using SpringBean, fails: {code}public class HomePage extends WebPage { @SpringBean private CarDao nonGenericCarDao; @SpringBean private GenericDaoCar genericCarDao; //. } {code} In this case, SpringBean is unable to inject genericCarDao, and throws the following error: {code} Caused by: java.lang.IllegalStateException: More than one bean of type [com.mycompany.springcomponents.GenericDao] found, you have to specify the name of the bean (@SpringBean(name=foo)) or (@Named(foo) if using @javax.inject classes) in order to resolve this conflict. Matched beans: carDao,phoneDao at org.apache.wicket.spring.injection.annot.AnnotProxyFieldValueFactory.getBeanNameOfClass(AnnotProxyFieldValueFactory.java:289) at org.apache.wicket.spring.injection.annot.AnnotProxyFieldValueFactory.getBeanName(AnnotProxyFieldValueFactory.java:198) at org.apache.wicket.spring.injection.annot.AnnotProxyFieldValueFactory.getFieldValue(AnnotProxyFieldValueFactory.java:130) at org.apache.wicket.injection.Injector.inject(Injector.java:111) at org.apache.wicket.spring.injection.annot.SpringComponentInjector.inject(SpringComponentInjector.java:124) at org.apache.wicket.spring.injection.annot.SpringComponentInjector.onInstantiation(SpringComponentInjector.java:130) at org.apache.wicket.application.ComponentInstantiationListenerCollection$1.notify(ComponentInstantiationListenerCollection.java:38) at org.apache.wicket.application.ComponentInstantiationListenerCollection$1.notify(ComponentInstantiationListenerCollection.java:34) at org.apache.wicket.util.listener.ListenerCollection.notify(ListenerCollection.java:80) at org.apache.wicket.application.ComponentInstantiationListenerCollection.onInstantiation(ComponentInstantiationListenerCollection.java:33) at org.apache.wicket.Component.init(Component.java:687) at org.apache.wicket.MarkupContainer.init(MarkupContainer.java:121) at org.apache.wicket.Page.init(Page.java:168) at org.apache.wicket.Page.init(Page.java:157) at org.apache.wicket.markup.html.WebPage.init(WebPage.java:106) at com.mycompany.HomePage.init(HomePage.java:22) {code} *Workaround solution:* Explicitly using bean names (qualifiers) does work. In this case {code} @SpringBean private CarDao nonGenericCarDao; @SpringBean private GenericDaoCar genericCarDao; {code} has to be changed to: {code} @SpringBean(name = carDao) private CarDao nonGenericCarDao; @SpringBean(name = carDao) private GenericDaoCar genericCarDao; {code} *Description of some of the attached files:* * pom.xml: added spring-context, spring-web,
[jira] [Comment Edited] (WICKET-5775) Replace the session upon successful signin for better support for Session Fixation
[ https://issues.apache.org/jira/browse/WICKET-5775?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanelfocusedCommentId=14295884#comment-14295884 ] Martin Grigorov edited comment on WICKET-5775 at 1/29/15 7:55 AM: -- This change seems to break applications which use Apache Shiro for authen/authorization :-/ After replacing the session Shiro continues to use the old http session and any roles/permissions checks fail. Probably the solution is: - apply the suggested solution at https://issues.apache.org/jira/browse/SHIRO-170 to the application code where Shiro Subject#login(token) is called - override Wicket's Session#replaceSession() to do nothing, because Shiro handles this was (Author: mgrigorov): This change seems to break applications which use Apache Shiro for authen/authorization :-/ After replacing the session Shiro continues to use the old http session and any roles/permissions checks fail. Workaround is to override Wicket's Session#replaceSession() to do nothing. Replace the session upon successful signin for better support for Session Fixation -- Key: WICKET-5775 URL: https://issues.apache.org/jira/browse/WICKET-5775 Project: Wicket Issue Type: Improvement Components: wicket-auth-roles Affects Versions: 6.18.0, 7.0.0-M4 Reporter: Martin Grigorov Assignee: Martin Grigorov Priority: Minor Fix For: 7.0.0-M5, 6.19.0 See http://markmail.org/message/twbipkcmc5v6rto7: Hi all, during implementing the login a my current project I came across WICKET-1767[1] which deals with session fixation problems, but to my surprise it looks like the newly created method is not called automatically by Wicket. If I search the code base for replaceSession( I only get one result, the method itself. Is there any reason why Wicket doesn't call the method automatically? Looks to me like AuthenticatedWebSession.signIn would be a good place to call it automatically. When should I call it instead, at the beginning of AuthenticatedWebSession.authenticate? This would prevent session fixation even if exception got throw during the authentication itself for any reason. -- This message was sent by Atlassian JIRA (v6.3.4#6332)
[3/3] wicket git commit: WICKET-5808 Add more unit tests
WICKET-5808 Add more unit tests Project: http://git-wip-us.apache.org/repos/asf/wicket/repo Commit: http://git-wip-us.apache.org/repos/asf/wicket/commit/3a36b0a2 Tree: http://git-wip-us.apache.org/repos/asf/wicket/tree/3a36b0a2 Diff: http://git-wip-us.apache.org/repos/asf/wicket/diff/3a36b0a2 Branch: refs/heads/master Commit: 3a36b0a234a559f952ac0893a9de5326c86059de Parents: 4b62ed0 Author: Martin Tzvetanov Grigorov mgrigo...@apache.org Authored: Thu Jan 29 09:30:08 2015 +0200 Committer: Martin Tzvetanov Grigorov mgrigo...@apache.org Committed: Thu Jan 29 09:30:08 2015 +0200 -- .../annot/SpringBeanWithGenericsTest.java | 76 +++- 1 file changed, 75 insertions(+), 1 deletion(-) -- http://git-wip-us.apache.org/repos/asf/wicket/blob/3a36b0a2/wicket-spring/src/test/java/org/apache/wicket/spring/injection/annot/SpringBeanWithGenericsTest.java -- diff --git a/wicket-spring/src/test/java/org/apache/wicket/spring/injection/annot/SpringBeanWithGenericsTest.java b/wicket-spring/src/test/java/org/apache/wicket/spring/injection/annot/SpringBeanWithGenericsTest.java index 245cf90..f5e57e1 100644 --- a/wicket-spring/src/test/java/org/apache/wicket/spring/injection/annot/SpringBeanWithGenericsTest.java +++ b/wicket-spring/src/test/java/org/apache/wicket/spring/injection/annot/SpringBeanWithGenericsTest.java @@ -17,6 +17,7 @@ package org.apache.wicket.spring.injection.annot; import static org.hamcrest.CoreMatchers.equalTo; +import static org.hamcrest.CoreMatchers.hasItem; import static org.hamcrest.CoreMatchers.is; import static org.hamcrest.CoreMatchers.notNullValue; @@ -86,6 +87,21 @@ public class SpringBeanWithGenericsTest extends Assert assertTrue(beans.contains(ctx.getBean(stringBean))); assertTrue(beans.contains(ctx.getBean(integerBean))); } + + @Test + public void listOfStringGenerics() throws Exception + { + AnnotatedListOfBeanStringGenericQualifier page = + tester.startPage(new AnnotatedListOfBeanStringGenericQualifier()); + + ListBeanWithGenericString beans = page.getBeans(); + + assertThat(beans, is(notNullValue())); + assertThat(beans.size(), is(1)); + + BeanWithGenericString stringBean = (BeanWithGenericString) ctx.getBean(stringBean); + assertThat(beans, hasItem(stringBean)); + } @Test public void mapOfGenerics() throws Exception @@ -132,8 +148,20 @@ public class SpringBeanWithGenericsTest extends Assert assertThat(arrayListStrings.get(0), is(equalTo(one))); assertThat(arrayListStrings.get(1), is(equalTo(two))); assertThat(arrayListStrings.get(2), is(equalTo(three))); + + ArrayListInteger arrayListIntegers = page.getArrayListIntegers(); + assertThat(arrayListIntegers, is(notNullValue())); + assertThat(arrayListIntegers.size(), is(3)); + assertThat(arrayListIntegers.get(0), is(1)); + assertThat(arrayListIntegers.get(1), is(2)); + assertThat(arrayListIntegers.get(2), is(3)); + + MyListString myList = page.getMyList(); + assertThat(myList, is(notNullValue())); + assertThat(myList.size(), is(1)); + assertThat(myList.get(0), is(one)); } - + @Test public void listOfTypedGenerics() throws Exception { @@ -155,6 +183,17 @@ public class SpringBeanWithGenericsTest extends Assert } } + class AnnotatedListOfBeanStringGenericQualifier extends DummyHomePage + { + @SpringBean + private ListBeanWithGenericString beans; + + public ListBeanWithGenericString getBeans() + { + return beans; + } + } + class AnnotatedListOfBeanGenericQualifier extends DummyHomePage { @SpringBean @@ -216,6 +255,22 @@ public class SpringBeanWithGenericsTest extends Assert { return arrayListStrings; } + + @SpringBean + private ArrayListInteger arrayListIntegers; + + public ArrayListInteger getArrayListIntegers() + { + return arrayListIntegers; + } + + @SpringBean + private MyListString myList; + + public MyListString getMyList() + { + return myList; + } } @Configuration @@ -248,5 +303,24 @@ public class SpringBeanWithGenericsTest extends Assert
[jira] [Commented] (WICKET-5808) SpringBean, support generic beans
[ https://issues.apache.org/jira/browse/WICKET-5808?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanelfocusedCommentId=14296514#comment-14296514 ] ASF subversion and git services commented on WICKET-5808: - Commit cc075e9c25050ff8b9153d2b759f9c6d783c22f1 in wicket's branch refs/heads/master from [~mgrigorov] [ https://git-wip-us.apache.org/repos/asf?p=wicket.git;h=cc075e9 ] WICKET-5808 Add support for extracting the generic element for List/Set/Map subtypes SpringBean, support generic beans - Key: WICKET-5808 URL: https://issues.apache.org/jira/browse/WICKET-5808 Project: Wicket Issue Type: Improvement Components: wicket-spring Affects Versions: 6.18.0, 7.0.0-M4 Environment: Spring Framework 4.1.4.RELEASE (currently the latest version) Reporter: Flying Wolf Assignee: Andrea Del Bene Priority: Minor Labels: generics, spring Fix For: 7.0.0-M5 Attachments: AnnotProxyFieldValueFactory.java, AnnotProxyFieldValueFactory.new.java, CollectionResolving.java, SpringBeanLocator.java, SpringBeanLocator.new.java, myproject.zip *Short Description:* Since Spring Framework 4.0, Spring is able to inject/autowire generic beans like: {code}@Autowired public GenericDaoCar genericCarDao;{code} As is described here: http://spring.io/blog/2013/12/03/spring-framework-4-0-and-java-generics . However, SpringBean doesn't seem to support this yet, resulting in a IllegalStateException. *Detailed Description* Given the following code: {code}public interface GenericDaoT {}{code} {code}@Repository public class CarDao implements GenericDaoCar {}{code} {code}@Repository public class PhoneDao implements GenericDaoPhone {}{code} {code}@Component public class DaoClient { @Autowired public GenericDaoCar genericCarDao; @Autowired public CarDao nonGenericCarDao; }{code} Spring 4 is able to inject both genericCaoDao and nonGenericCarDao into the DaoClient class. Performing the same using SpringBean, fails: {code}public class HomePage extends WebPage { @SpringBean private CarDao nonGenericCarDao; @SpringBean private GenericDaoCar genericCarDao; //. } {code} In this case, SpringBean is unable to inject genericCarDao, and throws the following error: {code} Caused by: java.lang.IllegalStateException: More than one bean of type [com.mycompany.springcomponents.GenericDao] found, you have to specify the name of the bean (@SpringBean(name=foo)) or (@Named(foo) if using @javax.inject classes) in order to resolve this conflict. Matched beans: carDao,phoneDao at org.apache.wicket.spring.injection.annot.AnnotProxyFieldValueFactory.getBeanNameOfClass(AnnotProxyFieldValueFactory.java:289) at org.apache.wicket.spring.injection.annot.AnnotProxyFieldValueFactory.getBeanName(AnnotProxyFieldValueFactory.java:198) at org.apache.wicket.spring.injection.annot.AnnotProxyFieldValueFactory.getFieldValue(AnnotProxyFieldValueFactory.java:130) at org.apache.wicket.injection.Injector.inject(Injector.java:111) at org.apache.wicket.spring.injection.annot.SpringComponentInjector.inject(SpringComponentInjector.java:124) at org.apache.wicket.spring.injection.annot.SpringComponentInjector.onInstantiation(SpringComponentInjector.java:130) at org.apache.wicket.application.ComponentInstantiationListenerCollection$1.notify(ComponentInstantiationListenerCollection.java:38) at org.apache.wicket.application.ComponentInstantiationListenerCollection$1.notify(ComponentInstantiationListenerCollection.java:34) at org.apache.wicket.util.listener.ListenerCollection.notify(ListenerCollection.java:80) at org.apache.wicket.application.ComponentInstantiationListenerCollection.onInstantiation(ComponentInstantiationListenerCollection.java:33) at org.apache.wicket.Component.init(Component.java:687) at org.apache.wicket.MarkupContainer.init(MarkupContainer.java:121) at org.apache.wicket.Page.init(Page.java:168) at org.apache.wicket.Page.init(Page.java:157) at org.apache.wicket.markup.html.WebPage.init(WebPage.java:106) at com.mycompany.HomePage.init(HomePage.java:22) {code} *Workaround solution:* Explicitly using bean names (qualifiers) does work. In this case {code} @SpringBean private CarDao nonGenericCarDao; @SpringBean private GenericDaoCar genericCarDao; {code} has to be changed to: {code} @SpringBean(name = carDao) private CarDao nonGenericCarDao; @SpringBean(name = carDao) private GenericDaoCar genericCarDao; {code} *Description of some of the attached files:* * pom.xml: added spring-context, spring-web, wicket-spring dependencies. Changed java version to 1.8. * WicketApplication: added Spring
[2/3] wicket git commit: WICKET-5808 Remove unused parameter
WICKET-5808 Remove unused parameter It is a private method so this is not API change Project: http://git-wip-us.apache.org/repos/asf/wicket/repo Commit: http://git-wip-us.apache.org/repos/asf/wicket/commit/4b62ed0f Tree: http://git-wip-us.apache.org/repos/asf/wicket/tree/4b62ed0f Diff: http://git-wip-us.apache.org/repos/asf/wicket/diff/4b62ed0f Branch: refs/heads/master Commit: 4b62ed0fe460c2b8618e70799d6ea68d6de044bf Parents: cc075e9 Author: Martin Tzvetanov Grigorov mgrigo...@apache.org Authored: Thu Jan 29 09:29:36 2015 +0200 Committer: Martin Tzvetanov Grigorov mgrigo...@apache.org Committed: Thu Jan 29 09:29:36 2015 +0200 -- .../spring/injection/annot/AnnotProxyFieldValueFactory.java | 7 ++- 1 file changed, 2 insertions(+), 5 deletions(-) -- http://git-wip-us.apache.org/repos/asf/wicket/blob/4b62ed0f/wicket-spring/src/main/java/org/apache/wicket/spring/injection/annot/AnnotProxyFieldValueFactory.java -- diff --git a/wicket-spring/src/main/java/org/apache/wicket/spring/injection/annot/AnnotProxyFieldValueFactory.java b/wicket-spring/src/main/java/org/apache/wicket/spring/injection/annot/AnnotProxyFieldValueFactory.java index 27c4008..efa333d 100644 --- a/wicket-spring/src/main/java/org/apache/wicket/spring/injection/annot/AnnotProxyFieldValueFactory.java +++ b/wicket-spring/src/main/java/org/apache/wicket/spring/injection/annot/AnnotProxyFieldValueFactory.java @@ -192,8 +192,7 @@ public class AnnotProxyFieldValueFactory implements IFieldValueFactory name = beanNameCache.get(fieldType); if (name == null) { - name = getBeanNameOfClass(contextLocator.getSpringContext(), fieldType, generic, - required); + name = getBeanNameOfClass(contextLocator.getSpringContext(), fieldType, generic); if (name != null) { @@ -217,13 +216,11 @@ public class AnnotProxyFieldValueFactory implements IFieldValueFactory *spring application context * @param clazz *bean class -* @param required -*true if the value is required * @throws IllegalStateException * @return spring name of the bean */ private String getBeanNameOfClass(final ApplicationContext ctx, final Class? clazz, - final Class? generic, final boolean required) + final Class? generic) { // get the list of all possible matching beans ListString names = new ArrayList(
[jira] [Commented] (WICKET-5808) SpringBean, support generic beans
[ https://issues.apache.org/jira/browse/WICKET-5808?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanelfocusedCommentId=14296516#comment-14296516 ] ASF subversion and git services commented on WICKET-5808: - Commit 3a36b0a234a559f952ac0893a9de5326c86059de in wicket's branch refs/heads/master from [~mgrigorov] [ https://git-wip-us.apache.org/repos/asf?p=wicket.git;h=3a36b0a ] WICKET-5808 Add more unit tests SpringBean, support generic beans - Key: WICKET-5808 URL: https://issues.apache.org/jira/browse/WICKET-5808 Project: Wicket Issue Type: Improvement Components: wicket-spring Affects Versions: 6.18.0, 7.0.0-M4 Environment: Spring Framework 4.1.4.RELEASE (currently the latest version) Reporter: Flying Wolf Assignee: Andrea Del Bene Priority: Minor Labels: generics, spring Fix For: 7.0.0-M5 Attachments: AnnotProxyFieldValueFactory.java, AnnotProxyFieldValueFactory.new.java, CollectionResolving.java, SpringBeanLocator.java, SpringBeanLocator.new.java, myproject.zip *Short Description:* Since Spring Framework 4.0, Spring is able to inject/autowire generic beans like: {code}@Autowired public GenericDaoCar genericCarDao;{code} As is described here: http://spring.io/blog/2013/12/03/spring-framework-4-0-and-java-generics . However, SpringBean doesn't seem to support this yet, resulting in a IllegalStateException. *Detailed Description* Given the following code: {code}public interface GenericDaoT {}{code} {code}@Repository public class CarDao implements GenericDaoCar {}{code} {code}@Repository public class PhoneDao implements GenericDaoPhone {}{code} {code}@Component public class DaoClient { @Autowired public GenericDaoCar genericCarDao; @Autowired public CarDao nonGenericCarDao; }{code} Spring 4 is able to inject both genericCaoDao and nonGenericCarDao into the DaoClient class. Performing the same using SpringBean, fails: {code}public class HomePage extends WebPage { @SpringBean private CarDao nonGenericCarDao; @SpringBean private GenericDaoCar genericCarDao; //. } {code} In this case, SpringBean is unable to inject genericCarDao, and throws the following error: {code} Caused by: java.lang.IllegalStateException: More than one bean of type [com.mycompany.springcomponents.GenericDao] found, you have to specify the name of the bean (@SpringBean(name=foo)) or (@Named(foo) if using @javax.inject classes) in order to resolve this conflict. Matched beans: carDao,phoneDao at org.apache.wicket.spring.injection.annot.AnnotProxyFieldValueFactory.getBeanNameOfClass(AnnotProxyFieldValueFactory.java:289) at org.apache.wicket.spring.injection.annot.AnnotProxyFieldValueFactory.getBeanName(AnnotProxyFieldValueFactory.java:198) at org.apache.wicket.spring.injection.annot.AnnotProxyFieldValueFactory.getFieldValue(AnnotProxyFieldValueFactory.java:130) at org.apache.wicket.injection.Injector.inject(Injector.java:111) at org.apache.wicket.spring.injection.annot.SpringComponentInjector.inject(SpringComponentInjector.java:124) at org.apache.wicket.spring.injection.annot.SpringComponentInjector.onInstantiation(SpringComponentInjector.java:130) at org.apache.wicket.application.ComponentInstantiationListenerCollection$1.notify(ComponentInstantiationListenerCollection.java:38) at org.apache.wicket.application.ComponentInstantiationListenerCollection$1.notify(ComponentInstantiationListenerCollection.java:34) at org.apache.wicket.util.listener.ListenerCollection.notify(ListenerCollection.java:80) at org.apache.wicket.application.ComponentInstantiationListenerCollection.onInstantiation(ComponentInstantiationListenerCollection.java:33) at org.apache.wicket.Component.init(Component.java:687) at org.apache.wicket.MarkupContainer.init(MarkupContainer.java:121) at org.apache.wicket.Page.init(Page.java:168) at org.apache.wicket.Page.init(Page.java:157) at org.apache.wicket.markup.html.WebPage.init(WebPage.java:106) at com.mycompany.HomePage.init(HomePage.java:22) {code} *Workaround solution:* Explicitly using bean names (qualifiers) does work. In this case {code} @SpringBean private CarDao nonGenericCarDao; @SpringBean private GenericDaoCar genericCarDao; {code} has to be changed to: {code} @SpringBean(name = carDao) private CarDao nonGenericCarDao; @SpringBean(name = carDao) private GenericDaoCar genericCarDao; {code} *Description of some of the attached files:* * pom.xml: added spring-context, spring-web, wicket-spring dependencies. Changed java version to 1.8. * WicketApplication: added Spring support * SpringApp: boots plain Spring and shows
[1/3] wicket git commit: WICKET-5808 Add support for extracting the generic element for List/Set/Map subtypes
Repository: wicket Updated Branches: refs/heads/master 6d0eae5f4 - 3a36b0a23 WICKET-5808 Add support for extracting the generic element for List/Set/Map subtypes Project: http://git-wip-us.apache.org/repos/asf/wicket/repo Commit: http://git-wip-us.apache.org/repos/asf/wicket/commit/cc075e9c Tree: http://git-wip-us.apache.org/repos/asf/wicket/tree/cc075e9c Diff: http://git-wip-us.apache.org/repos/asf/wicket/diff/cc075e9c Branch: refs/heads/master Commit: cc075e9c25050ff8b9153d2b759f9c6d783c22f1 Parents: 6d0eae5 Author: Martin Tzvetanov Grigorov mgrigo...@apache.org Authored: Thu Jan 29 00:28:46 2015 +0200 Committer: Martin Tzvetanov Grigorov mgrigo...@apache.org Committed: Thu Jan 29 00:28:46 2015 +0200 -- .../apache/wicket/spring/SpringBeanLocator.java | 8 ++--- .../wicket/spring/FieldBeansCollectorTest.java | 18 +- .../annot/SpringBeanWithGenericsTest.java | 35 ++-- 3 files changed, 45 insertions(+), 16 deletions(-) -- http://git-wip-us.apache.org/repos/asf/wicket/blob/cc075e9c/wicket-spring/src/main/java/org/apache/wicket/spring/SpringBeanLocator.java -- diff --git a/wicket-spring/src/main/java/org/apache/wicket/spring/SpringBeanLocator.java b/wicket-spring/src/main/java/org/apache/wicket/spring/SpringBeanLocator.java index 1f51ef9..60ccbfa 100644 --- a/wicket-spring/src/main/java/org/apache/wicket/spring/SpringBeanLocator.java +++ b/wicket-spring/src/main/java/org/apache/wicket/spring/SpringBeanLocator.java @@ -137,7 +137,7 @@ public class SpringBeanLocator implements IProxyTargetLocator /** * If the field type is a collection (Map, Set or List) extracts type -* informations about its elements. +* information about its elements. * * @param fieldResolvableType * the resolvable type of the field @@ -147,13 +147,13 @@ public class SpringBeanLocator implements IProxyTargetLocator { Class? clazz = fieldResolvableType.resolve(); - if (clazz == Set.class || clazz == List.class) + if (Set.class.isAssignableFrom(clazz) || List.class.isAssignableFrom(clazz)) { return fieldResolvableType.getGeneric(); } - else if (clazz == Map.class) + else if (Map.class.isAssignableFrom(clazz)) { - return fieldResolvableType.getGeneric(1); + return fieldResolvableType.getGeneric(1); } return null; http://git-wip-us.apache.org/repos/asf/wicket/blob/cc075e9c/wicket-spring/src/test/java/org/apache/wicket/spring/FieldBeansCollectorTest.java -- diff --git a/wicket-spring/src/test/java/org/apache/wicket/spring/FieldBeansCollectorTest.java b/wicket-spring/src/test/java/org/apache/wicket/spring/FieldBeansCollectorTest.java index 4a20d44..62597f4 100644 --- a/wicket-spring/src/test/java/org/apache/wicket/spring/FieldBeansCollectorTest.java +++ b/wicket-spring/src/test/java/org/apache/wicket/spring/FieldBeansCollectorTest.java @@ -29,28 +29,28 @@ import org.springframework.core.ResolvableType; public class FieldBeansCollectorTest { public ListListString listOfStringList; - + public List genericList; - + @Test public void resolveGenericList() throws Exception { Field field = getClass().getField(listOfStringList); ResolvableType resolvableType = ResolvableType.forField(field); - + FieldBeansCollector fieldBeansCollector = new FieldBeansCollector(resolvableType); - - assertTrue(fieldBeansCollector.getFieldType() == FieldType.LIST); + + assertTrue(fieldBeansCollector.getFieldType() == FieldType.LIST); } - + @Test public void resolveRowList() throws Exception { Field field = getClass().getField(genericList); - + ResolvableType resolvableType = ResolvableType.forField(field); FieldBeansCollector fieldBeansCollector = new FieldBeansCollector(resolvableType); - + assertTrue(fieldBeansCollector.getFieldType() == FieldType.LIST); } -} \ No newline at end of file +} http://git-wip-us.apache.org/repos/asf/wicket/blob/cc075e9c/wicket-spring/src/test/java/org/apache/wicket/spring/injection/annot/SpringBeanWithGenericsTest.java -- diff --git
[jira] [Commented] (WICKET-5808) SpringBean, support generic beans
[ https://issues.apache.org/jira/browse/WICKET-5808?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanelfocusedCommentId=14296515#comment-14296515 ] ASF subversion and git services commented on WICKET-5808: - Commit 4b62ed0fe460c2b8618e70799d6ea68d6de044bf in wicket's branch refs/heads/master from [~mgrigorov] [ https://git-wip-us.apache.org/repos/asf?p=wicket.git;h=4b62ed0 ] WICKET-5808 Remove unused parameter It is a private method so this is not API change SpringBean, support generic beans - Key: WICKET-5808 URL: https://issues.apache.org/jira/browse/WICKET-5808 Project: Wicket Issue Type: Improvement Components: wicket-spring Affects Versions: 6.18.0, 7.0.0-M4 Environment: Spring Framework 4.1.4.RELEASE (currently the latest version) Reporter: Flying Wolf Assignee: Andrea Del Bene Priority: Minor Labels: generics, spring Fix For: 7.0.0-M5 Attachments: AnnotProxyFieldValueFactory.java, AnnotProxyFieldValueFactory.new.java, CollectionResolving.java, SpringBeanLocator.java, SpringBeanLocator.new.java, myproject.zip *Short Description:* Since Spring Framework 4.0, Spring is able to inject/autowire generic beans like: {code}@Autowired public GenericDaoCar genericCarDao;{code} As is described here: http://spring.io/blog/2013/12/03/spring-framework-4-0-and-java-generics . However, SpringBean doesn't seem to support this yet, resulting in a IllegalStateException. *Detailed Description* Given the following code: {code}public interface GenericDaoT {}{code} {code}@Repository public class CarDao implements GenericDaoCar {}{code} {code}@Repository public class PhoneDao implements GenericDaoPhone {}{code} {code}@Component public class DaoClient { @Autowired public GenericDaoCar genericCarDao; @Autowired public CarDao nonGenericCarDao; }{code} Spring 4 is able to inject both genericCaoDao and nonGenericCarDao into the DaoClient class. Performing the same using SpringBean, fails: {code}public class HomePage extends WebPage { @SpringBean private CarDao nonGenericCarDao; @SpringBean private GenericDaoCar genericCarDao; //. } {code} In this case, SpringBean is unable to inject genericCarDao, and throws the following error: {code} Caused by: java.lang.IllegalStateException: More than one bean of type [com.mycompany.springcomponents.GenericDao] found, you have to specify the name of the bean (@SpringBean(name=foo)) or (@Named(foo) if using @javax.inject classes) in order to resolve this conflict. Matched beans: carDao,phoneDao at org.apache.wicket.spring.injection.annot.AnnotProxyFieldValueFactory.getBeanNameOfClass(AnnotProxyFieldValueFactory.java:289) at org.apache.wicket.spring.injection.annot.AnnotProxyFieldValueFactory.getBeanName(AnnotProxyFieldValueFactory.java:198) at org.apache.wicket.spring.injection.annot.AnnotProxyFieldValueFactory.getFieldValue(AnnotProxyFieldValueFactory.java:130) at org.apache.wicket.injection.Injector.inject(Injector.java:111) at org.apache.wicket.spring.injection.annot.SpringComponentInjector.inject(SpringComponentInjector.java:124) at org.apache.wicket.spring.injection.annot.SpringComponentInjector.onInstantiation(SpringComponentInjector.java:130) at org.apache.wicket.application.ComponentInstantiationListenerCollection$1.notify(ComponentInstantiationListenerCollection.java:38) at org.apache.wicket.application.ComponentInstantiationListenerCollection$1.notify(ComponentInstantiationListenerCollection.java:34) at org.apache.wicket.util.listener.ListenerCollection.notify(ListenerCollection.java:80) at org.apache.wicket.application.ComponentInstantiationListenerCollection.onInstantiation(ComponentInstantiationListenerCollection.java:33) at org.apache.wicket.Component.init(Component.java:687) at org.apache.wicket.MarkupContainer.init(MarkupContainer.java:121) at org.apache.wicket.Page.init(Page.java:168) at org.apache.wicket.Page.init(Page.java:157) at org.apache.wicket.markup.html.WebPage.init(WebPage.java:106) at com.mycompany.HomePage.init(HomePage.java:22) {code} *Workaround solution:* Explicitly using bean names (qualifiers) does work. In this case {code} @SpringBean private CarDao nonGenericCarDao; @SpringBean private GenericDaoCar genericCarDao; {code} has to be changed to: {code} @SpringBean(name = carDao) private CarDao nonGenericCarDao; @SpringBean(name = carDao) private GenericDaoCar genericCarDao; {code} *Description of some of the attached files:* * pom.xml: added spring-context, spring-web, wicket-spring dependencies. Changed java version to 1.8. * WicketApplication: added Spring
[jira] [Commented] (WICKET-5808) SpringBean, support generic beans
[ https://issues.apache.org/jira/browse/WICKET-5808?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanelfocusedCommentId=14296525#comment-14296525 ] Tobias Soloschenko commented on WICKET-5808: Saw your commit and the unit test of MyList - forgot to say that as long as MyList extends ArrayList everything is fine, but if MyList only implements List there will be the issue which I described previously. SpringBean, support generic beans - Key: WICKET-5808 URL: https://issues.apache.org/jira/browse/WICKET-5808 Project: Wicket Issue Type: Improvement Components: wicket-spring Affects Versions: 6.18.0, 7.0.0-M4 Environment: Spring Framework 4.1.4.RELEASE (currently the latest version) Reporter: Flying Wolf Assignee: Andrea Del Bene Priority: Minor Labels: generics, spring Fix For: 7.0.0-M5 Attachments: AnnotProxyFieldValueFactory.java, AnnotProxyFieldValueFactory.new.java, CollectionResolving.java, SpringBeanLocator.java, SpringBeanLocator.new.java, myproject.zip *Short Description:* Since Spring Framework 4.0, Spring is able to inject/autowire generic beans like: {code}@Autowired public GenericDaoCar genericCarDao;{code} As is described here: http://spring.io/blog/2013/12/03/spring-framework-4-0-and-java-generics . However, SpringBean doesn't seem to support this yet, resulting in a IllegalStateException. *Detailed Description* Given the following code: {code}public interface GenericDaoT {}{code} {code}@Repository public class CarDao implements GenericDaoCar {}{code} {code}@Repository public class PhoneDao implements GenericDaoPhone {}{code} {code}@Component public class DaoClient { @Autowired public GenericDaoCar genericCarDao; @Autowired public CarDao nonGenericCarDao; }{code} Spring 4 is able to inject both genericCaoDao and nonGenericCarDao into the DaoClient class. Performing the same using SpringBean, fails: {code}public class HomePage extends WebPage { @SpringBean private CarDao nonGenericCarDao; @SpringBean private GenericDaoCar genericCarDao; //. } {code} In this case, SpringBean is unable to inject genericCarDao, and throws the following error: {code} Caused by: java.lang.IllegalStateException: More than one bean of type [com.mycompany.springcomponents.GenericDao] found, you have to specify the name of the bean (@SpringBean(name=foo)) or (@Named(foo) if using @javax.inject classes) in order to resolve this conflict. Matched beans: carDao,phoneDao at org.apache.wicket.spring.injection.annot.AnnotProxyFieldValueFactory.getBeanNameOfClass(AnnotProxyFieldValueFactory.java:289) at org.apache.wicket.spring.injection.annot.AnnotProxyFieldValueFactory.getBeanName(AnnotProxyFieldValueFactory.java:198) at org.apache.wicket.spring.injection.annot.AnnotProxyFieldValueFactory.getFieldValue(AnnotProxyFieldValueFactory.java:130) at org.apache.wicket.injection.Injector.inject(Injector.java:111) at org.apache.wicket.spring.injection.annot.SpringComponentInjector.inject(SpringComponentInjector.java:124) at org.apache.wicket.spring.injection.annot.SpringComponentInjector.onInstantiation(SpringComponentInjector.java:130) at org.apache.wicket.application.ComponentInstantiationListenerCollection$1.notify(ComponentInstantiationListenerCollection.java:38) at org.apache.wicket.application.ComponentInstantiationListenerCollection$1.notify(ComponentInstantiationListenerCollection.java:34) at org.apache.wicket.util.listener.ListenerCollection.notify(ListenerCollection.java:80) at org.apache.wicket.application.ComponentInstantiationListenerCollection.onInstantiation(ComponentInstantiationListenerCollection.java:33) at org.apache.wicket.Component.init(Component.java:687) at org.apache.wicket.MarkupContainer.init(MarkupContainer.java:121) at org.apache.wicket.Page.init(Page.java:168) at org.apache.wicket.Page.init(Page.java:157) at org.apache.wicket.markup.html.WebPage.init(WebPage.java:106) at com.mycompany.HomePage.init(HomePage.java:22) {code} *Workaround solution:* Explicitly using bean names (qualifiers) does work. In this case {code} @SpringBean private CarDao nonGenericCarDao; @SpringBean private GenericDaoCar genericCarDao; {code} has to be changed to: {code} @SpringBean(name = carDao) private CarDao nonGenericCarDao; @SpringBean(name = carDao) private GenericDaoCar genericCarDao; {code} *Description of some of the attached files:* * pom.xml: added spring-context, spring-web, wicket-spring dependencies. Changed java version to 1.8. * WicketApplication: added Spring support * SpringApp: boots plain Spring and shows that DaoClient is able
[jira] [Commented] (WICKET-5735) Propagate fileSizeMax attribute to org.apache.commons.fileupload.FileUploadBase
[ https://issues.apache.org/jira/browse/WICKET-5735?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanelfocusedCommentId=14295339#comment-14295339 ] ASF GitHub Bot commented on WICKET-5735: Github user martin-g commented on the pull request: https://github.com/apache/wicket/pull/79#issuecomment-71863362 The PR has been merged some months ago. We don't have karma to close the PR. @bravehorsie Please close it. Thanks! Propagate fileSizeMax attribute to org.apache.commons.fileupload.FileUploadBase --- Key: WICKET-5735 URL: https://issues.apache.org/jira/browse/WICKET-5735 Project: Wicket Issue Type: Improvement Components: wicket Reporter: Roman Grigoriadi Assignee: Martin Grigorov Priority: Minor Fix For: 6.18.0, 7.0.0-M4 Wicket's MultipartServletWebRequestImpl uses commons ServletFileUpload internally, but there is no way to configure this component, for example to propagate fileSizeMax inside. As supposed in http://apache-wicket.1842946.n4.nabble.com/org-apache-wicket-util-upload-FileUploadBase-fileSizeMax-td4668001.html there should be implemented: 1) add Form#fileSizeMax and pass it to MultipartServletWebRequest 2) add MultipartServletWebRequestImpl#newFileUpload(FileItemFactory) -- This message was sent by Atlassian JIRA (v6.3.4#6332)
[2/4] wicket git commit: Wicket-5801 Responsive Images - CORS settings
Wicket-5801 Responsive Images - CORS settings Project: http://git-wip-us.apache.org/repos/asf/wicket/repo Commit: http://git-wip-us.apache.org/repos/asf/wicket/commit/6b31d4c6 Tree: http://git-wip-us.apache.org/repos/asf/wicket/tree/6b31d4c6 Diff: http://git-wip-us.apache.org/repos/asf/wicket/diff/6b31d4c6 Branch: refs/heads/master Commit: 6b31d4c64b8ee0dd3b513025eebec9ae75ff2893 Parents: 0880713 Author: klopfdreh noctur...@googlemail.com Authored: Thu Jan 22 12:28:52 2015 +0100 Committer: Martin Tzvetanov Grigorov mgrigo...@apache.org Committed: Wed Jan 28 18:53:33 2015 +0200 -- .../apache/wicket/markup/html/image/Image.java | 60 .../apache/wicket/markup/html/image/Source.java | 16 ++ 2 files changed, 76 insertions(+) -- http://git-wip-us.apache.org/repos/asf/wicket/blob/6b31d4c6/wicket-core/src/main/java/org/apache/wicket/markup/html/image/Image.java -- diff --git a/wicket-core/src/main/java/org/apache/wicket/markup/html/image/Image.java b/wicket-core/src/main/java/org/apache/wicket/markup/html/image/Image.java index 74b6512..644e491 100644 --- a/wicket-core/src/main/java/org/apache/wicket/markup/html/image/Image.java +++ b/wicket-core/src/main/java/org/apache/wicket/markup/html/image/Image.java @@ -67,6 +67,11 @@ public class Image extends WebComponent implements IResourceListener private ListString sizes = null; /** +* Cross origin settings +*/ + private Cors crossorigin = null; + + /** * This constructor can be used if you override {@link #getImageResourceReference()} or * {@link #getImageResource()} * @@ -347,8 +352,13 @@ public class Image extends WebComponent implements IResourceListener String srcAttribute = this.buildSrcAttribute(tag); this.buildSrcSetAttribute(tag); tag.put(src, srcAttribute); + } this.buildSizesAttribute(tag); + + if (this.crossorigin != null) { + tag.put(crossorigin, this.crossorigin.getRealName()); + } } /** @@ -514,4 +524,54 @@ public class Image extends WebComponent implements IResourceListener return super.canCallListenerInterface(method); } } + + /** +* Gets the cross origin settings +* +* @see {@link #setCrossorigin(Cors)} +* +* @return the cross origins settings +*/ + public Cors getCrossorigin() { + return this.crossorigin; + } + + /** +* Sets the cross origin settingsbr +* br +* +* banonymous/b: Cross-origin CORS requests for the element will not have the credentials flag set.br +* br +* buse_credentials/b: Cross-origin CORS requests for the element will have the credentials flag set.br +* br +* bno_cores/b: The empty string is also a valid keyword, and maps to the Anonymous state. The attribute's invalid value default is the +* Anonymous state. The missing value default, used when the attribute is omitted, is the No CORS state +* +* @param crossorigin +*the cross origins settings to set +*/ + public void setCrossorigin(Cors crossorigin) { + this.crossorigin = crossorigin; + } + + /** +* To be used for the crossorigin attribute +* +* @see {@link #setCrossorigin(Cors)} +*/ + public enum Cors { + anonymous(anonymous), + use_credentials(user-credentials), + no_cors(); + + private String realName; + + private Cors(String realName) { + this.realName = realName; + } + + public String getRealName() { + return this.realName; + } + } } http://git-wip-us.apache.org/repos/asf/wicket/blob/6b31d4c6/wicket-core/src/main/java/org/apache/wicket/markup/html/image/Source.java -- diff --git a/wicket-core/src/main/java/org/apache/wicket/markup/html/image/Source.java b/wicket-core/src/main/java/org/apache/wicket/markup/html/image/Source.java index cb074e9..b38f5fc 100644 --- a/wicket-core/src/main/java/org/apache/wicket/markup/html/image/Source.java +++ b/wicket-core/src/main/java/org/apache/wicket/markup/html/image/Source.java @@ -120,4 +120,20 @@ public class Source extends Image { return media; } + + /** +* Unsupported for source tag +*/ + @Override + public void setCrossorigin(Cors
[3/4] wicket git commit: Wicket-5801 Responsive Images - CORS settings unit test
Wicket-5801 Responsive Images - CORS settings unit test Project: http://git-wip-us.apache.org/repos/asf/wicket/repo Commit: http://git-wip-us.apache.org/repos/asf/wicket/commit/2948a2c1 Tree: http://git-wip-us.apache.org/repos/asf/wicket/tree/2948a2c1 Diff: http://git-wip-us.apache.org/repos/asf/wicket/diff/2948a2c1 Branch: refs/heads/master Commit: 2948a2c16088a83bfad09f5ce1d3febc5f868766 Parents: 6b31d4c Author: klopfdreh klopfdreh@tobiass-mbp Authored: Thu Jan 22 21:12:30 2015 +0100 Committer: Martin Tzvetanov Grigorov mgrigo...@apache.org Committed: Wed Jan 28 18:53:33 2015 +0200 -- .../markup/html/image/ImageResourceReferenceTestPage.java | 5 ++--- .../apache/wicket/markup/html/image/ResponsiveImageTest.java| 1 + 2 files changed, 3 insertions(+), 3 deletions(-) -- http://git-wip-us.apache.org/repos/asf/wicket/blob/2948a2c1/wicket-core/src/test/java/org/apache/wicket/markup/html/image/ImageResourceReferenceTestPage.java -- diff --git a/wicket-core/src/test/java/org/apache/wicket/markup/html/image/ImageResourceReferenceTestPage.java b/wicket-core/src/test/java/org/apache/wicket/markup/html/image/ImageResourceReferenceTestPage.java index cb96f67..0bca071 100644 --- a/wicket-core/src/test/java/org/apache/wicket/markup/html/image/ImageResourceReferenceTestPage.java +++ b/wicket-core/src/test/java/org/apache/wicket/markup/html/image/ImageResourceReferenceTestPage.java @@ -17,9 +17,7 @@ package org.apache.wicket.markup.html.image; import org.apache.wicket.markup.html.WebPage; -import org.apache.wicket.markup.html.image.Image; -import org.apache.wicket.markup.html.image.Picture; -import org.apache.wicket.markup.html.image.Source; +import org.apache.wicket.markup.html.image.Image.Cors; import org.apache.wicket.model.Model; import org.apache.wicket.request.resource.PackageResourceReference; import org.apache.wicket.request.resource.ResourceReference; @@ -41,6 +39,7 @@ public class ImageResourceReferenceTestPage extends WebPage return new PackageResourceReference(this.getClass(), small.jpg); } }; + image1.setCrossorigin(Cors.anonymous); this.add(image1); } } http://git-wip-us.apache.org/repos/asf/wicket/blob/2948a2c1/wicket-core/src/test/java/org/apache/wicket/markup/html/image/ResponsiveImageTest.java -- diff --git a/wicket-core/src/test/java/org/apache/wicket/markup/html/image/ResponsiveImageTest.java b/wicket-core/src/test/java/org/apache/wicket/markup/html/image/ResponsiveImageTest.java index 49fad03..4c00d48 100644 --- a/wicket-core/src/test/java/org/apache/wicket/markup/html/image/ResponsiveImageTest.java +++ b/wicket-core/src/test/java/org/apache/wicket/markup/html/image/ResponsiveImageTest.java @@ -40,6 +40,7 @@ public class ResponsiveImageTest String lastResponseAsString = wicketTester.getLastResponse().getDocument(); TagTester createTagByAttribute = TagTester.createTagByAttribute(lastResponseAsString, img); Assert.assertFalse(createTagByAttribute.hasAttribute(srcset)); + Assert.assertEquals(anonymous, createTagByAttribute.getAttribute(crossorigin)); } @Test
[jira] [Closed] (WICKET-5735) Propagate fileSizeMax attribute to org.apache.commons.fileupload.FileUploadBase
[ https://issues.apache.org/jira/browse/WICKET-5735?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ] Roman Grigoriadi closed WICKET-5735. Propagate fileSizeMax attribute to org.apache.commons.fileupload.FileUploadBase --- Key: WICKET-5735 URL: https://issues.apache.org/jira/browse/WICKET-5735 Project: Wicket Issue Type: Improvement Components: wicket Reporter: Roman Grigoriadi Assignee: Martin Grigorov Priority: Minor Fix For: 6.18.0, 7.0.0-M4 Wicket's MultipartServletWebRequestImpl uses commons ServletFileUpload internally, but there is no way to configure this component, for example to propagate fileSizeMax inside. As supposed in http://apache-wicket.1842946.n4.nabble.com/org-apache-wicket-util-upload-FileUploadBase-fileSizeMax-td4668001.html there should be implemented: 1) add Form#fileSizeMax and pass it to MultipartServletWebRequest 2) add MultipartServletWebRequestImpl#newFileUpload(FileItemFactory) -- This message was sent by Atlassian JIRA (v6.3.4#6332)
[jira] [Commented] (WICKET-5735) Propagate fileSizeMax attribute to org.apache.commons.fileupload.FileUploadBase
[ https://issues.apache.org/jira/browse/WICKET-5735?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanelfocusedCommentId=14295708#comment-14295708 ] Martin Grigorov commented on WICKET-5735: - I meant the Pull Request at GitHub - https://github.com/apache/wicket/pull/79. Thanks! Propagate fileSizeMax attribute to org.apache.commons.fileupload.FileUploadBase --- Key: WICKET-5735 URL: https://issues.apache.org/jira/browse/WICKET-5735 Project: Wicket Issue Type: Improvement Components: wicket Reporter: Roman Grigoriadi Assignee: Martin Grigorov Priority: Minor Fix For: 6.18.0, 7.0.0-M4 Wicket's MultipartServletWebRequestImpl uses commons ServletFileUpload internally, but there is no way to configure this component, for example to propagate fileSizeMax inside. As supposed in http://apache-wicket.1842946.n4.nabble.com/org-apache-wicket-util-upload-FileUploadBase-fileSizeMax-td4668001.html there should be implemented: 1) add Form#fileSizeMax and pass it to MultipartServletWebRequest 2) add MultipartServletWebRequestImpl#newFileUpload(FileItemFactory) -- This message was sent by Atlassian JIRA (v6.3.4#6332)
[jira] [Commented] (WICKET-5735) Propagate fileSizeMax attribute to org.apache.commons.fileupload.FileUploadBase
[ https://issues.apache.org/jira/browse/WICKET-5735?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanelfocusedCommentId=14295717#comment-14295717 ] ASF GitHub Bot commented on WICKET-5735: Github user bravehorsie closed the pull request at: https://github.com/apache/wicket/pull/79 Propagate fileSizeMax attribute to org.apache.commons.fileupload.FileUploadBase --- Key: WICKET-5735 URL: https://issues.apache.org/jira/browse/WICKET-5735 Project: Wicket Issue Type: Improvement Components: wicket Reporter: Roman Grigoriadi Assignee: Martin Grigorov Priority: Minor Fix For: 6.18.0, 7.0.0-M4 Wicket's MultipartServletWebRequestImpl uses commons ServletFileUpload internally, but there is no way to configure this component, for example to propagate fileSizeMax inside. As supposed in http://apache-wicket.1842946.n4.nabble.com/org-apache-wicket-util-upload-FileUploadBase-fileSizeMax-td4668001.html there should be implemented: 1) add Form#fileSizeMax and pass it to MultipartServletWebRequest 2) add MultipartServletWebRequestImpl#newFileUpload(FileItemFactory) -- This message was sent by Atlassian JIRA (v6.3.4#6332)