[Lift] Re: Problem with BlazeDS and LiftFilter 1.0+

2009-11-13 Thread oshyshko

David,

 Your call to Service.say is outside the scope of the Lift HTTP request, so
 it's not wrapped with the transaction management stuff.

Exactly.

The thing that I want LiftFilter to wrap /messagebroker/*, so I will
get per-HTTP request
automatic transaction management and my code will remain clean.

LiftFilter 0.9 and BlazeDS worked perfectly together,
but when I switched to Lift 1.0 and greater, LiftFilter killed
BlazeDS.

Removing mappings from web.xml or adding
LiftRules.liftRequest.append { case Req(messagebroker :: _, _, _)
= false }
didn't really solved the problem but diverged it: BlazeDS is alive,
but it made nice features of Lift useless.

I believe that these are attempts to cure symptoms while disease is
still here: LiftFilter kills BlazeDS.

It would be great to have a solution like this:
- LiftFilter wraps /messagebroker/* but doesn't change requests, so
BlazeDS servlet still working
- methods like Service.say gain transaction management from Lift and
its code remains clean

--
Oleksandr

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
Lift group.
To post to this group, send email to liftweb@googlegroups.com
To unsubscribe from this group, send email to 
liftweb+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/liftweb?hl=en
-~--~~~~--~~--~--~---



[Lift] Re: Problem with BlazeDS and LiftFilter 1.0+

2009-11-13 Thread oshyshko

Hello David,

May be there can be a compromise solution.

A custom filter that has only these duties:
- to open LiftMapper-compatible transaction on HTTP-request (it will
be accessible from DB entities like User)
- call chain
- when all chain was processed
   + commit the transaction
   + in case of exception, roll back the transaction + propagate
exception

filter
filter-nameLiftFilterTransactionWrapper/filter-name
filter-classservices.LiftFilterTransactionWrapper /filter-
class
/filter

filter-mapping
filter-name LiftFilterTransactionWrapper /filter-name
url-pattern/messagebroker/*/url-pattern
/filter-mapping

class LiftFilterTransactionWrapper ... {
   ...
}

This will be just enough.

What should be inside LiftFilterTransactionWrapper?

--
Oleksandr

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
Lift group.
To post to this group, send email to liftweb@googlegroups.com
To unsubscribe from this group, send email to 
liftweb+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/liftweb?hl=en
-~--~~~~--~~--~--~---



[Lift] Re: Problem with BlazeDS and LiftFilter 1.0+

2009-11-12 Thread oshyshko

Hello David,

I have added some DB stuff + added S.addAround(DB.buildLoanWrapper)
But the code produces separate transactions.

For example, this code:
=
class Service {
  def say(message: String) {
println(message)

(0 to 5).foreach( i = User.findAll )
  }
}
=


Produces this SQL:
=
091113  2:59:24 6 Query SET autocommit=0
6 Query SET autocommit=0
6 Query commit
6 Query SET autocommit=0
6 Query SET autocommit=0
6 Query commit
6 Query SET autocommit=0
6 Query SET autocommit=0
6 Query SELECT user_t.id FROM user_t
6 Query commit
6 Query SET autocommit=0
6 Query SET autocommit=0
6 Query SELECT user_t.id FROM user_t
6 Query commit
6 Query SET autocommit=0
6 Query SET autocommit=0
6 Query SELECT user_t.id FROM user_t
6 Query commit
6 Query SET autocommit=0
6 Query SET autocommit=0
6 Query SELECT user_t.id FROM user_t
6 Query commit
6 Query SET autocommit=0
6 Query SET autocommit=0
6 Query SELECT user_t.id FROM user_t
6 Query commit
6 Query SET autocommit=0
6 Query SET autocommit=0
6 Query SELECT user_t.id FROM user_t
6 Query commit
=

Basically it behaves like when LiftFilter url mapping was commented in
web.xml.

I have updated http://github.com/oshyshko/lift_vs_blazeds

To reproduce it:

1. mysql - create database demo;

2. Enable MySQL query logging by editing my.ini + restart MySQL
daemon:
[mysqld]
log=mysql-log.log

3. Open separate console to watch what's going on
$ tail -f mysql-log.log

4. mvn jetty:run-exploded

5. Open http://localhost:8080/ + click Say it

6. Observe 7 transactions instead of 1 in the log
  should =
6. Observe all queries inside 1 transaction in the log

On Nov 13, 2:29 am, David Pollak feeder.of.the.be...@gmail.com
wrote:
 the issue is the new debugging help screen in dev mode got in the way of the
 passing not found... so...


--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
Lift group.
To post to this group, send email to liftweb@googlegroups.com
To unsubscribe from this group, send email to 
liftweb+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/liftweb?hl=en
-~--~~~~--~~--~--~---



[Lift] Re: Database transactions with Mapper

2009-11-07 Thread oshyshko

I have found the problem.

This is what I have in web.xml:
filter-mapping
filter-nameLiftFilter/filter-name
url-pattern*.html/url-pattern
/filter-mapping

By default it should be like this:

filter-mapping
filter-nameLiftFilter/filter-name
url-pattern/*/url-pattern
/filter-mapping

S.addAround(DB.buildLoanWrapper) does work, if the request path is
covered by LiftFilter.
And it does not work, if not covered (my case) -- in this case it will
create separate transactions.

So its okay.


Now I see thatreal problem is because I use BlazeDS servet which
should not be covered by LiftFilter. I wrote about it:
http://groups.google.com/group/liftweb/browse_thread/thread/33a4d1d111f54ef0/ea4c08393ce76c1d
Looks like the old problem has reappeared in a new place.


On Nov 7, 5:10 pm, David Pollak feeder.of.the.be...@gmail.com wrote:
 On Fri, Nov 6, 2009 at 10:14 PM, oshyshko oshys...@gmail.com wrote:

  Looks like S.addAround(DB.buildLoanWrapper) has no effect.

 What code are you using to make the query?

 Please create a fully running example (making a GitHub project is the best
 way to do this) so that I can see exactly what is happening.

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
Lift group.
To post to this group, send email to liftweb@googlegroups.com
To unsubscribe from this group, send email to 
liftweb+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/liftweb?hl=en
-~--~~~~--~~--~--~---



[Lift] Re: Problem with BlazeDS and LiftFilter 1.0+

2009-11-07 Thread oshyshko

Removing BlazeDS servlet from LiftFilter coverage is a bad idea:
If it is done so, lift-mapper creates separate transactions for all
operations.

http://groups.google.com/group/liftweb/browse_thread/thread/e2c0dd2c5dcc458b

This means LiftFilter and BlazeDS servlet should become friends.

LiftRules.passNotFoundToChain = true is in my Boot.scala. The
response is:

HTTP/1.1 200 OK
Expires: Thu, 01 Jan 1970 00:00:00 GMT
Set-Cookie: JSESSIONID=1a8mg0498vrwd;Path=/
Content-Length: 0
Server: Jetty(6.1.21)


Note: if I remove LiftFilter, the servlet works fine.

Any ideas how to make LiftFilter not to intrude into BlazeDS deeds?

On Oct 31, 2:19 pm, Timothy Perrett timo...@getintheloop.eu wrote:
 You needed to specify the passNotFoundToChain var, thats why you were
 getting the 404 originally - as you detail, its not needed to
 explicitly set the /messagebroker URL in your web.xml.
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
Lift group.
To post to this group, send email to liftweb@googlegroups.com
To unsubscribe from this group, send email to 
liftweb+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/liftweb?hl=en
-~--~~~~--~~--~--~---



[Lift] Problem with BlazeDS and LiftFilter 1.0+

2009-10-31 Thread oshyshko

Looks like net.liftweb.http.LiftFilter after version 1.0.+ breaks
BlazeDS servlet.

Version 0.9. of net.liftweb.http.LiftFilter works fine.
I want to switch to a newer version of Liftweb, but I can't.

Any ideas how to make LiftFilter 1.0.+ to work with BlazeDS servlet?


More info:
I used Scala 2.7.1 and Liftweb 0.9 with BlazeDS (works fine).

BlazeDS is simply a rpc-servlet that maps to /messagebroker/* path
and exposes your classes as web services.


servlet
servlet-nameMessageBrokerServlet/servlet-name
servlet-classflex.messaging.MessageBrokerServlet/servlet-
class
/servlet

servlet-mapping
servlet-nameMessageBrokerServlet/servlet-name
url-pattern/messagebroker/*/url-pattern
/servlet-mapping



These web-services are simple Scala classes like this:

class UserService {
  def list(): Array[User] = User.findAll().toArray
}

// User is a regular Lifweb Remapper class:
class User extends KeyedMapper[Long, User] { ... }


This servlet is wrapped by net.liftweb.http.LiftFilter.
If not wrapped, all DB stuff inside UserService wouldn't work.

   filter
filter-nameLiftFilter/filter-name
filter-classnet.liftweb.http.LiftFilter/filter-class
/filter

filter-mapping
filter-nameLiftFilter/filter-name
url-pattern/messagebroker/*/url-pattern
/filter-mapping


Now, If i change my POMs from:
scala.version2.7.1/scala.version
liftweb.version0.9/liftweb.version

to

scala.version2.7.4/scala.version
liftweb.version1.0/liftweb.version

!-- or any 1.0+ :
liftweb.version1.1-M5/liftweb.version
liftweb.version1.0.2/liftweb.version
--

Then its all broken and any access to /messagebroker/* returns:

HTTP/1.1 404 Not Found
Content-Type: text/html
Content-Length: 257
Expires: Thu, 01 Jan 1970 00:00:00 GMT
Set-Cookie: JSESSIONID=1dj9cjb4kegk7;Path=/
X-Lift-Version: 0.11-SNAPSHOT
Server: Jetty(6.1.21)

?xml version=1.0 encoding=UTF-8?
!DOCTYPE html PUBLIC -//W3C//DTD XHTML 1.0 Transitional//EN http://
www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd
htmlbodyThe Requested URL /messagebroker/amf was not found on this
server/body/html
  

And this makes me bound to Liftweb 0.9.

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
Lift group.
To post to this group, send email to liftweb@googlegroups.com
To unsubscribe from this group, send email to 
liftweb+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/liftweb?hl=en
-~--~~~~--~~--~--~---