From dev-return-69672-archive-asf-public=cust-asf.ponee.io@myfaces.apache.org Thu May 31 15:56:08 2018 Return-Path: X-Original-To: archive-asf-public@cust-asf.ponee.io Delivered-To: archive-asf-public@cust-asf.ponee.io Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by mx-eu-01.ponee.io (Postfix) with SMTP id 75E0E180632 for ; Thu, 31 May 2018 15:56:07 +0200 (CEST) Received: (qmail 60000 invoked by uid 500); 31 May 2018 13:56:06 -0000 Mailing-List: contact dev-help@myfaces.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: "MyFaces Development" Delivered-To: mailing list dev@myfaces.apache.org Received: (qmail 59987 invoked by uid 99); 31 May 2018 13:56:05 -0000 Received: from pnap-us-west-generic-nat.apache.org (HELO spamd2-us-west.apache.org) (209.188.14.142) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 31 May 2018 13:56:05 +0000 Received: from localhost (localhost [127.0.0.1]) by spamd2-us-west.apache.org (ASF Mail Server at spamd2-us-west.apache.org) with ESMTP id 64F4E1A3ADD for ; Thu, 31 May 2018 13:56:05 +0000 (UTC) X-Virus-Scanned: Debian amavisd-new at spamd2-us-west.apache.org X-Spam-Flag: NO X-Spam-Score: -0.581 X-Spam-Level: X-Spam-Status: No, score=-0.581 tagged_above=-999 required=6.31 tests=[KAM_ASCII_DIVIDERS=0.8, RCVD_IN_DNSWL_MED=-2.3, SPF_FAIL=0.919] autolearn=disabled Received: from mx1-lw-eu.apache.org ([10.40.0.8]) by localhost (spamd2-us-west.apache.org [10.40.0.9]) (amavisd-new, port 10024) with ESMTP id mancFicxXx7s for ; Thu, 31 May 2018 13:56:02 +0000 (UTC) Received: from mailrelay1-us-west.apache.org (mailrelay1-us-west.apache.org [209.188.14.139]) by mx1-lw-eu.apache.org (ASF Mail Server at mx1-lw-eu.apache.org) with ESMTP id AC96B5FB9B for ; Thu, 31 May 2018 13:56:01 +0000 (UTC) Received: from jira-lw-us.apache.org (unknown [207.244.88.139]) by mailrelay1-us-west.apache.org (ASF Mail Server at mailrelay1-us-west.apache.org) with ESMTP id 7C532E062E for ; Thu, 31 May 2018 13:56:00 +0000 (UTC) Received: from jira-lw-us.apache.org (localhost [127.0.0.1]) by jira-lw-us.apache.org (ASF Mail Server at jira-lw-us.apache.org) with ESMTP id 30DD421097 for ; Thu, 31 May 2018 13:56:00 +0000 (UTC) Date: Thu, 31 May 2018 13:56:00 +0000 (UTC) From: "ASF GitHub Bot (JIRA)" To: dev@myfaces.apache.org Message-ID: In-Reply-To: References: Subject: [jira] [Commented] (MYFACES-4232) Update UIWebsocket signature in the JSF 2.3 API MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable X-JIRA-FingerPrint: 30527f35849b9dde25b450d4833f0394 [ https://issues.apache.org/jira/browse/MYFACES-4232?page=3Dcom.atlassi= an.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=3D16= 496582#comment-16496582 ]=20 ASF GitHub Bot commented on MYFACES-4232: ----------------------------------------- ebreijo closed pull request #2: MYFACES-4232 Update UIWebsocket signature i= n the JSF 2.3 API URL: https://github.com/apache/myfaces/pull/2 =20 =20 =20 This is a PR merged from a forked repository. As GitHub hides the original diff on merge, it is displayed below for the sake of provenance: As this is a foreign pull request (from a fork), the diff is supplied below (as it won't show otherwise due to GitHub magic): diff --git a/api/src/main/java/javax/faces/component/_UIWebsocket.java b/ap= i/src/main/java/javax/faces/component/_UIWebsocket.java index cc99bb91b..e2dc0b09b 100644 --- a/api/src/main/java/javax/faces/component/_UIWebsocket.java +++ b/api/src/main/java/javax/faces/component/_UIWebsocket.java @@ -33,7 +33,7 @@ defaultRendererType =3D "javax.faces.Websocket", implementz =3D "javax.faces.component.behavior.ClientBehaviorHolder", bodyContent =3D "empty") -abstract class _UIWebsocket extends UIOutput implements ClientBehaviorHold= er +abstract class _UIWebsocket extends UIComponentBase { =20 static public final String COMPONENT_FAMILY =3D "javax.faces.Script"; @@ -60,89 +60,4 @@ @JSFProperty(defaultValue =3D "true") public abstract boolean isConnected(); =20 - @Override - public java.util.Collection getEventNames() - { - return new java.util.Collection(){ - - @Override - public int size() - { - return 0; - } - - @Override - public boolean isEmpty() - { - return false; - } - - @Override - public boolean contains(Object o) - { - return true; - } - - @Override - public java.util.Iterator iterator() - { - throw new UnsupportedOperationException("Not supported yet= ."); - } - - @Override - public Object[] toArray() - { - throw new UnsupportedOperationException("Not supported yet= ."); - } - - @Override - public T[] toArray(T[] a) - { - throw new UnsupportedOperationException("Not supported yet= ."); - } - - @Override - public boolean add(String e) - { - throw new UnsupportedOperationException("Not supported yet= ."); - } - - @Override - public boolean remove(Object o) - { - throw new UnsupportedOperationException("Not supported yet= ."); - } - - @Override - public boolean containsAll(java.util.Collection c) - { - return true; - } - - @Override - public boolean addAll(java.util.Collection c= ) - { - throw new UnsupportedOperationException("Not supported yet= ."); - } - - @Override - public boolean removeAll(java.util.Collection c) - { - throw new UnsupportedOperationException("Not supported yet= ."); - } - - @Override - public boolean retainAll(java.util.Collection c) - { - throw new UnsupportedOperationException("Not supported yet= ."); - } - - @Override - public void clear() - { - throw new UnsupportedOperationException("Not supported yet= ."); - } - }; - } - } diff --git a/api/src/main/resources/META-INF/componentClass20.vm b/api/src/= main/resources/META-INF/componentClass20.vm index 11d8be7d9..ce205224b 100644 --- a/api/src/main/resources/META-INF/componentClass20.vm +++ b/api/src/main/resources/META-INF/componentClass20.vm @@ -131,6 +131,99 @@ $innersource } #end #end + +#if ($component.implements) +#if ( ($component.implements =3D=3D "javax.faces.component.behavior.Client= BehaviorHolder") + && (${utils.getClassFromFullClass($component.className)} =3D=3D "UIWe= bsocket")) + // Start UIWebsocket getEventNames template + @Override + public java.util.Collection getEventNames() + { + return new java.util.Collection(){ + + @Override + public int size() + { + return 0; + } + + @Override + public boolean isEmpty() + { + return false; + } + + @Override + public boolean contains(Object o) + { + return true; + } + + @Override + public java.util.Iterator iterator() + { + throw new UnsupportedOperationException("Not supported yet= ."); + } + + @Override + public Object[] toArray() + { + throw new UnsupportedOperationException("Not supported yet= ."); + } + + @Override + public T[] toArray(T[] a) + { + throw new UnsupportedOperationException("Not supported yet= ."); + } + + @Override + public boolean add(String e) + { + throw new UnsupportedOperationException("Not supported yet= ."); + } + + @Override + public boolean remove(Object o) + { + throw new UnsupportedOperationException("Not supported yet= ."); + } + + @Override + public boolean containsAll(java.util.Collection c) + { + return true; + } + + @Override + public boolean addAll(java.util.Collection c= ) + { + throw new UnsupportedOperationException("Not supported yet= ."); + } + + @Override + public boolean removeAll(java.util.Collection c) + { + throw new UnsupportedOperationException("Not supported yet= ."); + } + + @Override + public boolean retainAll(java.util.Collection c) + { + throw new UnsupportedOperationException("Not supported yet= ."); + } + + @Override + public void clear() + { + throw new UnsupportedOperationException("Not supported yet= ."); + } + }; + } + // End UIWebsocket getEventNames template +#end +#end + #if ($component.defaultEventName) #if ($component.defaultEventName !=3D "") =20 diff --git a/impl/src/main/java/org/apache/myfaces/push/WebsocketComponentR= enderer.java b/impl/src/main/java/org/apache/myfaces/push/WebsocketComponen= tRenderer.java index d71b716a6..36acddb56 100644 --- a/impl/src/main/java/org/apache/myfaces/push/WebsocketComponentRenderer= .java +++ b/impl/src/main/java/org/apache/myfaces/push/WebsocketComponentRenderer= .java @@ -112,79 +112,72 @@ public void encodeEnd(FacesContext facesContext, UICo= mponent c) throws IOExcepti =20 ResponseWriter writer =3D facesContext.getResponseWriter(); =20 - //Only the first time it is required a session id. - if (component.getValue() =3D=3D null) + String channel =3D component.getChannel(); + + // TODO: use a single bean and entry point for this algorithm. + BeanManager beanManager =3D CDIUtils.getBeanManager(facesContext.g= etExternalContext()); + + WebsocketChannelTokenBuilderBean channelTokenBean =3D CDIUtils.loo= kup( + beanManager, + WebsocketChannelTokenBuilderBean.class); + + // This bean is required because you always need to register the t= oken, so it can be properly destroyed + WebsocketViewBean viewTokenBean =3D CDIUtils.lookup( + beanManager, + WebsocketViewBean.class); + WebsocketSessionBean sessionTokenBean =3D CDIUtils.lookup( + beanManager, WebsocketSessionBean.class); + + // Create channel token=20 + // TODO: Use ResponseStateManager to create the token + String scope =3D component.getScope() =3D=3D null ? "application" = : component.getScope(); + WebsocketChannelMetadata metadata =3D new WebsocketChannelMetadata= ( + channel, scope, component.getUser(), component.isConnected= ()); + + String channelToken =3D null; + // Force a new channelToken if "connected" property is set to fals= e, because in that case websocket + // creation=20 + if (!component.isConnected()) { - String channel =3D component.getChannel(); - - // TODO: use a single bean and entry point for this algorithm. - BeanManager beanManager =3D CDIUtils.getBeanManager(facesConte= xt.getExternalContext()); - - WebsocketChannelTokenBuilderBean channelTokenBean =3D CDIUtils= .lookup( - beanManager, - WebsocketChannelTokenBuilderBean.class); - - // This bean is required because you always need to register t= he token, so it can be properly destroyed - WebsocketViewBean viewTokenBean =3D CDIUtils.lookup( - beanManager, - WebsocketViewBean.class); - WebsocketSessionBean sessionTokenBean =3D CDIUtils.lookup( - beanManager, WebsocketSessionBean.class); - - // Create channel token=20 - // TODO: Use ResponseStateManager to create the token - String scope =3D component.getScope() =3D=3D null ? "applicati= on" : component.getScope(); - WebsocketChannelMetadata metadata =3D new WebsocketChannelMeta= data( - channel, scope, component.getUser(), component.isConne= cted()); - - String channelToken =3D null; - // Force a new channelToken if "connected" property is set to = false, because in that case websocket - // creation=20 - if (!component.isConnected()) - { - channelToken =3D viewTokenBean.getChannelToken(metadata); - } - if (channelToken =3D=3D null) - { - // No channel token found for that combination, create a n= ew token for this view - channelToken =3D channelTokenBean.createChannelToken(faces= Context, channel); - =20 - // Register the channel into the bean that will manage the= Session instance used to do the push - component.setValue(channelToken); - =20 - // Register channel in view scope to chain discard view al= gorithm using @PreDestroy - viewTokenBean.registerToken(channelToken, metadata); - =20 - // Register channel in session scope to allow validation o= n handshake ( WebsocketConfigurator ) - sessionTokenBean.registerToken(channelToken, metadata); - } + channelToken =3D viewTokenBean.getChannelToken(metadata); + } + if (channelToken =3D=3D null) + { + // No channel token found for that combination, create a new t= oken for this view + channelToken =3D channelTokenBean.createChannelToken(facesCont= ext, channel); + =20 + // Register channel in view scope to chain discard view algori= thm using @PreDestroy + viewTokenBean.registerToken(channelToken, metadata); + =20 + // Register channel in session scope to allow validation on ha= ndshake ( WebsocketConfigurator ) + sessionTokenBean.registerToken(channelToken, metadata); + } =20 - // Ask these two scopes=20 - WebsocketApplicationBean appTokenBean =3D CDIUtils.getInstance= ( - beanManager, WebsocketApplicationBean.class, false); + // Ask these two scopes=20 + WebsocketApplicationBean appTokenBean =3D CDIUtils.getInstance( + beanManager, WebsocketApplicationBean.class, false); =20 - // Register token and metadata in the proper bean - if (scope.equals("view")) - { - viewTokenBean.registerWebsocketSession(channelToken, metad= ata); - } - else if (scope.equals("session")) - { - sessionTokenBean =3D (sessionTokenBean !=3D null) ? sessio= nTokenBean : CDIUtils.lookup( - CDIUtils.getBeanManager(facesContext.getExternalCo= ntext()), - WebsocketSessionBean.class); + // Register token and metadata in the proper bean + if (scope.equals("view")) + { + viewTokenBean.registerWebsocketSession(channelToken, metadata)= ; + } + else if (scope.equals("session")) + { + sessionTokenBean =3D (sessionTokenBean !=3D null) ? sessionTok= enBean : CDIUtils.lookup( + CDIUtils.getBeanManager(facesContext.getExternalContex= t()), + WebsocketSessionBean.class); =20 - sessionTokenBean.registerWebsocketSession(channelToken, me= tadata); - } - else - { - //Default application - appTokenBean =3D (appTokenBean !=3D null) ? appTokenBean := CDIUtils.lookup( - CDIUtils.getBeanManager(facesContext.getExternalCo= ntext()), - WebsocketApplicationBean.class); + sessionTokenBean.registerWebsocketSession(channelToken, metada= ta); + } + else + { + //Default application + appTokenBean =3D (appTokenBean !=3D null) ? appTokenBean : CDI= Utils.lookup( + CDIUtils.getBeanManager(facesContext.getExternalContex= t()), + WebsocketApplicationBean.class); =20 - appTokenBean.registerWebsocketSession(channelToken, metada= ta); - } + appTokenBean.registerWebsocketSession(channelToken, metadata); } =20 writer.startElement(HTML.SCRIPT_ELEM, component); @@ -196,7 +189,7 @@ else if (scope.equals("session")) sb.append(","); sb.append("'"+facesContext.getExternalContext().encodeWebsocketURL= ( facesContext.getApplication().getViewHandler().getWebsocke= tURL( - facesContext, component.getChannel()+"?"+(String) = component.getValue()))+"'"); + facesContext, component.getChannel()+"?"+channelTo= ken))+"'"); sb.append(","); sb.append("'"+component.getChannel()+"'"); sb.append(","); =20 ---------------------------------------------------------------- This is an automated message from the Apache Git Service. To respond to the message, please log on GitHub and use the URL above to go to the specific comment. =20 For queries about this service, please contact Infrastructure at: users@infra.apache.org > Update UIWebsocket signature in the JSF 2.3 API > ----------------------------------------------- > > Key: MYFACES-4232 > URL: https://issues.apache.org/jira/browse/MYFACES-4232 > Project: MyFaces Core > Issue Type: Bug > Components: JSR-372 > Affects Versions: 2.3.0, 2.3.1 > Reporter: Eduardo Breijo > Assignee: Eduardo Breijo > Priority: Major > > 1) Currently,=C2=A0javax.faces.component.UIWebsocket is extending=C2=A0ja= vax.faces.component.UIOutput.=C2=A0 > According to the JSF 2.3 API it needs to extend javax.faces.component.UIC= omponentBase > [https://javaee.github.io/javaee-spec/javadocs/javax/faces/component/UIWe= bsocket.html] > =C2=A0 > I tried to made this update but it also requires an update in the=C2=A0 > org.apache.myfaces.push.WebsocketComponentRenderer implementation as=C2= =A0UIComponentBase does not have the getValue() and setValue() methods. > =C2=A0 > 2) I also noticed that the following method in the auto-generated class j= avax.faces.component.UIWebsocket from javax.faces.component._UIWebsocket is= missing the **=C2=A0in the return type. > {code:java} > //BEGIN CODE COPIED FROM javax.faces.component._UIWebsocket=20 > public java.util.Collection getEventNames() > {code} > But=C2=A0javax.faces.component._UIWebsocket does have the in the= return type as defined in the API: > [https://javaee.github.io/javaee-spec/javadocs/javax/faces/component/UIWe= bsocket.html#getEventNames--] > =C2=A0 > It seems that=C2=A0myfaces-builder-plugin=C2=A0is not working properly in= this case. -- This message was sent by Atlassian JIRA (v7.6.3#76005)