Return-Path: X-Original-To: apmail-struts-user-archive@www.apache.org Delivered-To: apmail-struts-user-archive@www.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id A176510069 for ; Wed, 12 Feb 2014 05:47:26 +0000 (UTC) Received: (qmail 56921 invoked by uid 500); 12 Feb 2014 05:47:23 -0000 Delivered-To: apmail-struts-user-archive@struts.apache.org Received: (qmail 56564 invoked by uid 500); 12 Feb 2014 05:47:14 -0000 Mailing-List: contact user-help@struts.apache.org; run by ezmlm Precedence: bulk List-Unsubscribe: List-Help: List-Post: List-Id: "Struts Users Mailing List" Reply-To: "Struts Users Mailing List" Delivered-To: mailing list user@struts.apache.org Received: (qmail 56555 invoked by uid 99); 12 Feb 2014 05:47:09 -0000 Received: from minotaur.apache.org (HELO minotaur.apache.org) (140.211.11.9) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 12 Feb 2014 05:47:09 +0000 Received: from localhost (HELO mail-yh0-f50.google.com) (127.0.0.1) (smtp-auth username lukaszlenart, mechanism plain) by minotaur.apache.org (qpsmtpd/0.29) with ESMTP; Wed, 12 Feb 2014 05:47:08 +0000 Received: by mail-yh0-f50.google.com with SMTP id 29so8015193yhl.37 for ; Tue, 11 Feb 2014 21:47:07 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :content-type:content-transfer-encoding; bh=U7Ygv/XGZtMFY2q4xjU3i/NOOtskixW1E6PmA2h63jU=; b=DV0rkIGoSdCth2jUQU1w/7KzoN1kycbypd55wtHgsrG7j2dthu9gYX+eE5xfRfOZ+6 2t/dNCXJc5Fr8rQaDSueNn2LIKqSYAD/4A1PUz6bkzYERVKGlqQn7CJmQgLiqUWEcv9i 9ohaHfIHar8mntLzz+lPdgRT2A1paX/pQYHWM4noCSQbsCSx5FMNm9fSsZnVhaMCQE3p moz6MoqQL4pl4Jljf4M/XBDfFk6zTgzkWRAs5c8YHtBPhZ7H1CwPC1HAvJnzkb7n/O2D 11tNMvp8ZUmH6nWlhOMPn4SnTlfDJM3H+wuh9WIhj2WA4OMi5Yt3jA/+0Jr4xgo1Ymqs 0YGA== X-Received: by 10.236.199.82 with SMTP id w58mr18404985yhn.57.1392184027780; Tue, 11 Feb 2014 21:47:07 -0800 (PST) MIME-Version: 1.0 Received: by 10.170.78.197 with HTTP; Tue, 11 Feb 2014 21:46:47 -0800 (PST) In-Reply-To: References: From: Lukasz Lenart Date: Wed, 12 Feb 2014 06:46:47 +0100 Message-ID: Subject: Re: REST question To: Struts Users Mailing List Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable You can define REST namespace http://struts.apache.org/release/2.3.x/docs/rest-plugin.html#RESTPlugin-Set= tings struts.rest.namespace =3D /rest Regards --=20 =C5=81ukasz + 48 606 323 122 http://www.lenart.org.pl/ 2014-02-12 0:15 GMT+01:00 Miguel : > Hi Ken, > > Thanks for the pointer, In fact the app uses open session in view with a > custom interceptor, but does the REST Plugin changes the struts-default a= nd > the json-default packages when you include the > struts2-rest-plugin-2.3.16.jar? > > > That could explain what is happening, but, how I assing the rest-default > stack to my Rest controllers ONLY, and the other 'old' actions continue t= o > work with the custom stack (Spring + Open_session_in_view + > paramsPrepareParamsStack), based on package json-default? It's a rather b= ig > application and can't be refactored to be REST only. > > Thanks for your time reading an replying the question. > > > > > Si quieres ser m=C3=A1s positivo, pierde un electr=C3=B3n > Miguel Ruiz Velasco Sobrino > > > On Tue, Feb 11, 2014 at 3:42 PM, Ken McWilliams wrote: > >> Sounds like you have used the Open Session in View method... probably >> provided by a custom interceptor, when adding the rest plugin you have >> changed your action to the rest package and forgot to put your intercept= or >> back in place, so now you don't have a hibernate session and the view >> generates this error. >> >> >> On Mon, Feb 10, 2014 at 10:40 PM, Miguel wrote: >> >> > Hi, >> > >> > A strange situation happens when I load *struts2-rest-plugin-2.3.16.ja= r* >> > With out the REST plugin my action and jsp's works as always has worke= d. >> > But with the mere inclusion of the REST Plugin, some jsp's stops findi= ng >> > variables, because the variable name changes. >> > Here is the snippet: >> > >> > struts.xml >> > >> > > > value=3D"org.apache.struts2.spring.StrutsSpringObjectFactory" /> >> > >> > >> > >> > >> > > > >> > >> class=3D"com.proyectox.ui.interceptor.HibernateOpenSessionInViewIntercep= tor"/> >> > > > class=3D"com.proyectox.ui.interceptor.UserAgentResultInterceptor"/> >> > >> > >> > >> > >> > >> > >> > ... >> > >> > >> > >> > >> > >> > edit >> > >> > >> > headerEdit.jsp >> > /facturaerror.jsp >> > >> > contribuyente >> > true >> > contribuyenteActual >> > >> > >> > factura >> > false >> > cfdi >> > >> > >> > >> > >> > >> > >> > HeaderAction.java: >> > >> > public class HeaderAction extends ActionSupport implements Preparable = { >> > protected Contribuyente contribuyente; >> > protected Long contribuyenteId; >> > >> > public void prepare() throws Exception { >> > ... >> > } >> > >> > >> > public String input(){ >> > >> > dirReceptorId =3D factura.getDomicilioReceptor().getId(); >> > dirEmisionId =3D factura.getDomicilioEmision().getId(); >> > return INPUT; >> > } >> > ... >> > public Contribuyente getContribuyente() { >> > return contribuyente; >> > } >> > >> > public void setContribuyente(Contribuyente contribuyente) { >> > this.contribuyente =3D contribuyente; >> > } >> > ... >> > } >> > >> > edit.jsp: >> > ... >> > > > name=3D"dirEmisionId" >> > list=3D"*contribuyente*.domicilios" >> > listKey=3D"id" >> > listValue=3D"nombre" >> > multiple=3D"false" >> > size=3D"1" >> > required=3D"true" >> > key=3D"factura.direccionEmision.id" >> > /> >> > ... >> > >> > After loading *struts2-rest-plugin-2.3.16.jar* it starts giving the >> > following exception: >> > Caused by: org.hibernate.LazyInitializationException: failed to lazily >> > initialize a collection of role: *contribuyentes.domicilios*, no sessi= on >> or >> > session was closed >> > ... >> > >> > I know that's a Hibernate exception, but the jsp works fine without th= e >> > REST Plugin. >> > It's like the REST Plugin appends that extra "s" after the variable na= me >> in >> > the .jsp or the value stack changes or something like that. >> > >> > The action is invoked without error in either case, and has into it's >> > fields the required values. >> > >> > >> > Does anyone has any pointer of what can be happening? >> > >> > Thanks >> > >> > Si quieres ser m=C3=A1s positivo, pierde un electr=C3=B3n >> > Miguel Ruiz Velasco Sobrino >> > >> --------------------------------------------------------------------- To unsubscribe, e-mail: user-unsubscribe@struts.apache.org For additional commands, e-mail: user-help@struts.apache.org