Return-Path: X-Original-To: apmail-deltaspike-users-archive@www.apache.org Delivered-To: apmail-deltaspike-users-archive@www.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id 13A99181DA for ; Tue, 2 Feb 2016 01:08:05 +0000 (UTC) Received: (qmail 93725 invoked by uid 500); 2 Feb 2016 01:08:04 -0000 Delivered-To: apmail-deltaspike-users-archive@deltaspike.apache.org Received: (qmail 93688 invoked by uid 500); 2 Feb 2016 01:08:04 -0000 Mailing-List: contact users-help@deltaspike.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: users@deltaspike.apache.org Delivered-To: mailing list users@deltaspike.apache.org Received: (qmail 93627 invoked by uid 99); 2 Feb 2016 01:08:04 -0000 Received: from Unknown (HELO spamd1-us-west.apache.org) (209.188.14.142) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 02 Feb 2016 01:08:04 +0000 Received: from localhost (localhost [127.0.0.1]) by spamd1-us-west.apache.org (ASF Mail Server at spamd1-us-west.apache.org) with ESMTP id F113AC0ED3 for ; Tue, 2 Feb 2016 00:56:12 +0000 (UTC) X-Virus-Scanned: Debian amavisd-new at spamd1-us-west.apache.org X-Spam-Flag: NO X-Spam-Score: 2.4 X-Spam-Level: ** X-Spam-Status: No, score=2.4 tagged_above=-999 required=6.31 tests=[DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, HTML_MESSAGE=2.5, SPF_PASS=-0.001, URIBL_BLOCKED=0.001] autolearn=disabled Authentication-Results: spamd1-us-west.apache.org (amavisd-new); dkim=pass (2048-bit key) header.d=gmail.com Received: from mx1-eu-west.apache.org ([10.40.0.8]) by localhost (spamd1-us-west.apache.org [10.40.0.7]) (amavisd-new, port 10024) with ESMTP id oaJcjI6OYcAD for ; Tue, 2 Feb 2016 00:56:04 +0000 (UTC) Received: from mail-oi0-f52.google.com (mail-oi0-f52.google.com [209.85.218.52]) by mx1-eu-west.apache.org (ASF Mail Server at mx1-eu-west.apache.org) with ESMTPS id 2EDFF2565F for ; Tue, 2 Feb 2016 00:56:03 +0000 (UTC) Received: by mail-oi0-f52.google.com with SMTP id r14so101832303oie.0 for ; Mon, 01 Feb 2016 16:56:03 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :content-type; bh=C3VV5RtI31GBvnL65bA8R/psYL2vuER4qg8G+gqiEaQ=; b=F1rhVjh+X/YHjLYaGJzb41AgPV2J/+P6DOs8R+igx7XOZ6DRjQzcmd/q6bSRRohDQZ /hdRzxNFFX60TRIkefXYjSXs4X+rsOp+50/Ki66jPflDm592Zr+bb0fuf9ZWn3UsBSd2 n821RtE1Oh1cRkOmztKYq5k2QtXZkKrwBTjEbRsyTj2Q+0koyuzVZcCb2hjtJij7hgce A5iD/c7FYXnGfsuNVTsbuYvjDVJX/XZp89eemssUrpbtV1VZOWGevgtlgrN5rzsj6eH+ vf1B5heKiu7UDHkNeQPdzkXEpLOglyvrDaiOhIOMw2j4TxaSNfasIg3ryYrRXsFL9BPm 624g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:mime-version:in-reply-to:references:date :message-id:subject:from:to:content-type; bh=C3VV5RtI31GBvnL65bA8R/psYL2vuER4qg8G+gqiEaQ=; b=NivYcIFpLuciROqHn747k+ga0UyCxOM3vJlGUa/48H0yb8FhpRrR/kIY8j2/+lx7Wj MVa0LPkpJJVdlgjWIT92Al4oU+upa67K9uF00q592zkMDPIARkI04dAgj/+lXewTS9dC uIVjh1oyoKPogkoBH78DcVnotrkSP75maIlyU122805NrptnjjxLwTcN7Rr/+tlr5vdA sbBBCmUN9sQrCndhYwt0Ic0z8LsTf0ARy7rWfFYAIylGRiyPwLE79Lj7G2Dp+Xpj4JDY wDTF6U0NOQaQRsa0m0MNzwPjMq1fWaOs7RQJC6Gc8oDsHidbsGRBSyPuk089kVCjaOUy 2y+Q== X-Gm-Message-State: AG10YOTO5RJQ9sctZDLTBsrMRW0u+YZBcWdq3o8ejDGC7LP4pRPr0tPyQ8u1zg8gFMJmFpDeQuEk1HQkaoEjYg== MIME-Version: 1.0 X-Received: by 10.202.189.195 with SMTP id n186mr19577732oif.109.1454374561530; Mon, 01 Feb 2016 16:56:01 -0800 (PST) Received: by 10.76.29.10 with HTTP; Mon, 1 Feb 2016 16:56:01 -0800 (PST) In-Reply-To: References: Date: Mon, 1 Feb 2016 19:56:01 -0500 Message-ID: Subject: Re: migrate from MyFaces CODI to DeltaSpike == WELD-001303: No active contexts for scope type org.apache.deltaspike.core.api.scope.WindowScoped From: Stephen More To: users@deltaspike.apache.org Content-Type: multipart/alternative; boundary=001a113ddb761c48f9052abef7c9 --001a113ddb761c48f9052abef7c9 Content-Type: text/plain; charset=UTF-8 Thanks, I now have a servlet working as expected. For anyone else here is some psuedo code: @Inject private org.apache.deltaspike.core.spi.scope.window.WindowContext windowContext; protected void service(HttpServletRequest request,HttpServletResponse response) throws ServletException, IOException { windowContext.activateWindow( "abc123" ); TabInfo tabInfo = org.apache.deltaspike.core.api.provider.BeanProvider.getContextualReference( "tabInfo", false, TabInfo.class ); tabInfo.setImportantInfo( ii ); javax.servlet.RequestDispatcher dispatcher = getServletContext().getRequestDispatcher( "/detail.jsf?dswid=abc123" ); dispatcher.forward( request, response ); } -Thanks again On Mon, Feb 1, 2016 at 6:27 PM, Gerhard Petracek wrote: > hi stephen, > > in your special case (= an own servlet) you need to restore the window-id > on your own -> use the restored value for WindowContext#activateWindow. > (how you can restore it depends on the client-window-strategy you are > using. > with the default-strategy you can use HttpServletRequest#getParameter and > "dswid" as parameter-name.) > > if the window-id doesn't exist already (= first/initial get-request), you > can generate and use any random value. > (in this case please also have a look at deltaspike.window-id.max_length - > see JsfBaseConfig) > > regards, > gerhard > > > > 2016-02-01 23:49 GMT+01:00 Stephen More : > > > I am not able to get this to work - in my servlet I have tried: > > > > A. > > @Inject > > private org.apache.deltaspike.core.spi.scope.window.WindowContext > > windowContext; > > > > windowContext.getCurrentWindowId() is null; > > > > > > B. > > org.apache.deltaspike.core.api.provider.DependentProvider dp = > > org.apache.deltaspike.core.api.provider.BeanProvider.getDependent( > > "tabInfo" ); > > Object obj = dp.get(); > > log.info( "Object: " + obj ); > > > > org.jboss.weld.context.ContextNotActiveException: WELD-001303: No active > > contexts for scope type org.apache.deltaspike.core.api.scope.WindowScoped > > > > C. > > TabInfo tabInfo = > > > org.apache.deltaspike.core.api.provider.BeanProvider.getContextualReference( > > "tabInfo", false, TabInfo.class ); > > tabInfo.setImportantInfo( ii ); > > > > > > org.jboss.weld.context.ContextNotActiveException: WELD-001303: No active > > contexts for scope type org.apache.deltaspike.core.api.scope.WindowScoped > > > > > > > > -- I am running this in Tomcat not a full blown J2EE AS - could that be > > the issue ? > > > > > > > > > > > > > > > > > > On Mon, Feb 1, 2016 at 4:04 PM, Gerhard Petracek > > wrote: > > > >> hi stephen, > >> > >> codi restores the window-id once it's needed and ds restores it e.g. at > >> the beginning of a faces-request. > >> -> > >> inject and use WindowContext (or use BeanProvider#getContextualReference > >> or even better in this case BeanProvider#getDependent). > >> (WindowContext allows you to manage the window-id manually.) > >> > >> regards, > >> gerhard > >> > >> > >> > >> 2016-02-01 21:32 GMT+01:00 Stephen More : > >> > >>> I have a MyFaces CODI application that utilizes WindowScoped beans. ( > >>> Session per tab - so thankful for that. ) > >>> > >>> I have been able to create url links that navigate to jsf pages using a > >>> servlet. ( > >>> > >>> > http://balusc.omnifaces.org/2006/06/communication-in-jsf.html#AccessingTheFacesContextInsideHttpServletOrFilter > >>> ) > >>> > >>> protected void service(HttpServletRequest request,HttpServletResponse > >>> response) throws ServletException, IOException > >>> { > >>> javax.faces.context.FacesContext context = FacesUtil.getFacesContext( > >>> request, response ); > >>> TabInfo tabInfo = context.getApplication().evaluateExpressionGet( > >>> context, > >>> "#{tabInfo}", TabInfo.class ); > >>> tabInfo.setImportantInfo( ii ); > >>> > >>> javax.servlet.RequestDispatcher dispatcher = > >>> getServletContext().getRequestDispatcher( "/detail.jsf" ); > >>> dispatcher.forward( request, response ); > >>> } > >>> > >>> Everything has been working flawlessly. > >>> > >>> When I try to achieve the exact same feature using DeltaSpike, tabInfo > >>> will > >>> come back null. > >>> > >>> When I try: > >>> TabInfo tabInfo = (TabInfo)application.createValueBinding( > >>> "#{tabInfo}" ).getValue( context ); > >>> the following will show up in error logs: > >>> "org.jboss.weld.context.ContextNotActiveException: WELD-001303: > No > >>> active contexts for scope type > >>> org.apache.deltaspike.core.api.scope.WindowScoped" > >>> > >>> > >>> I appreciate any help you can provide. > >>> -Thanks > >>> > >> > >> > > > --001a113ddb761c48f9052abef7c9--