Using pjax for single page app

86 views
Skip to first unread message

El Softwarerero

unread,
Nov 13, 2012, 11:02:15 AM11/13/12
to xitrum-f...@googlegroups.com
Trying to make a single page app with pjax (https://github.com/defunkt/jquery-pjax) leads to the exception when clicking Link1 in the attached sample app.

[WARN] Could not parse POST body, URI: /link1?_pjax=.container_12
org.jboss.netty.handler.codec.http.multipart.HttpPostRequestDecoder$IncompatibleDataDecoderException: No Body to decode
xitrum-pjax.zip

Ngoc Dao

unread,
Nov 13, 2012, 4:58:55 PM11/13/12
to Xitrum web framework
The exception is thrown because the content type of the request is
"application/x-www-form-urlencoded", but the request is a GET thus has
no body:

GET /link1?_pjax=.container_12 HTTP/1.1
Host: localhost:8000
Connection: keep-alive
X-Requested-With: XMLHttpRequest
X-PJAX: true
X-PJAX-Container: .container_12
Content-Type: application/x-www-form-urlencoded; charset=UTF-8

I will fix the problem by decoding the body only when the request
method is POST, PUT, or PATCH.

Ngoc Dao

unread,
Nov 13, 2012, 5:38:01 PM11/13/12
to Xitrum web framework
Dear El Softwarerero,

I've just released Xitrum 1.9.9-SNAPSHOT.

In your build.sbt file, you just need to change:
libraryDependencies += "tv.cntt" %% "xitrum" % "1.9.8"
to:
libraryDependencies += "tv.cntt" %% "xitrum" % "1.9.9-SNAPSHOT"

Commit:
https://github.com/ngocdaothanh/xitrum/commit/be1e00ba0294805dc8b315a42bea8a4429ceef86

Thanks for your report.

Stefan Undorf

unread,
Nov 13, 2012, 5:48:30 PM11/13/12
to xitrum-f...@googlegroups.com
Again impressed by your care and reaction time. I get this:

sbt.ResolveException: unresolved dependency: tv.cntt#xitrum_2.9.2;1.9.9-SNAPSHOT: not found

Ngoc Dao

unread,
Nov 13, 2012, 6:13:35 PM11/13/12
to Xitrum web framework
Ah, please add this line to your build.sbt:
resolvers += "SonatypeSnapshots" at "http://oss.sonatype.org/content/
repositories/snapshots/"

Also, you can always use the source code from GitHub:
git clone git://github.com/ngocdaothanh/xitrum.git
cd xitrum
sbt/sbt publish-local

Stefan Undorf

unread,
Nov 13, 2012, 7:35:42 PM11/13/12
to xitrum-f...@googlegroups.com
thanks, it works perfect now
Reply all
Reply to author
Forward
0 new messages