Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

set_expect_multipart not working #43

Open
giaosudau opened this issue Aug 2, 2015 · 0 comments
Open

set_expect_multipart not working #43

giaosudau opened this issue Aug 2, 2015 · 0 comments

Comments

@giaosudau
Copy link

My code to handle a post request

__author__ = 'chanhlt'

import vertx
from core.http import RouteMatcher

logger = vertx.logger()

rm = RouteMatcher()


def auctions_handler(req):
    req.set_expect_multipart(True)

    @req.end_handler
    def end_handler():
        print 'multi part %s' % req.is_expect_multipart()
        attrs = req.form_attributes()
        print attrs


rm.all_re("/auction/", auctions_handler)

vertx.create_http_server().request_handler(rm).listen(8080)

Error

vertx run app.py
Succeeded in deploying verticle
multi part True
Exception in Python verticle
java.lang.IllegalStateException: Call expectMultiPart(true) before request body is received to receive form attributes
    at org.vertx.java.core.http.impl.DefaultHttpServerRequest.formAttributes(DefaultHttpServerRequest.java:251)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke(Method.java:497)
    at org.python.core.PyReflectedFunction.__call__(PyReflectedFunction.java:186)
    at org.python.core.PyReflectedFunction.__call__(PyReflectedFunction.java:204)
    at org.python.core.PyObject.__call__(PyObject.java:387)
    at org.python.core.PyObject.__call__(PyObject.java:391)
    at org.python.core.PyMethod.__call__(PyMethod.java:109)
    at core.http$py.form_attributes$79(__pyclasspath__/core/http.py:684)
    at core.http$py.call_function(__pyclasspath__/core/http.py)
    at org.python.core.PyTableCode.call(PyTableCode.java:165)
    at org.python.core.PyBaseCode.call(PyBaseCode.java:134)
    at org.python.core.PyFunction.__call__(PyFunction.java:317)
    at org.python.core.PyFunction.__call__(PyFunction.java:312)
    at org.python.core.PyProperty.property___get__(PyProperty.java:69)
    at org.python.core.PyProperty.__get__(PyProperty.java:58)
    at org.python.core.PyObject.object___findattr__(PyObject.java:3706)
    at org.python.core.Deriveds.__findattr_ex__(Deriveds.java:42)
    at org.python.core.PyObjectDerived.__findattr_ex__(PyObjectDerived.java:983)
    at org.python.core.PyObject.__getattr__(PyObject.java:923)
    at org.python.pycode._pyx0.end_handler$3(app.py:34)
    at org.python.pycode._pyx0.call_function(app.py)
    at org.python.core.PyTableCode.call(PyTableCode.java:165)
    at org.python.core.PyBaseCode.call(PyBaseCode.java:120)
    at org.python.core.PyFunction.__call__(PyFunction.java:307)
    at core.handlers$py.handle$6(__pyclasspath__/core/handlers.py:41)
    at core.handlers$py.call_function(__pyclasspath__/core/handlers.py)
    at org.python.core.PyTableCode.call(PyTableCode.java:165)
    at org.python.core.PyBaseCode.call(PyBaseCode.java:301)
    at org.python.core.PyBaseCode.call(PyBaseCode.java:194)
    at org.python.core.PyFunction.__call__(PyFunction.java:387)
    at org.python.core.PyMethod.instancemethod___call__(PyMethod.java:220)
    at org.python.core.PyMethod.__call__(PyMethod.java:211)
    at org.python.core.PyMethod.__call__(PyMethod.java:201)
    at org.python.core.PyMethod.__call__(PyMethod.java:196)
    at org.python.core.PyObject._jcallexc(PyObject.java:3502)
    at org.python.core.PyObject._jcall(PyObject.java:3534)
    at org.python.proxies.core.handlers$NullDoneHandler$1.handle(Unknown Source)
    at org.vertx.java.core.http.impl.DefaultHttpServerRequest.handleEnd(DefaultHttpServerRequest.java:314)
    at org.vertx.java.core.http.impl.ServerConnection.handleEnd(ServerConnection.java:209)
    at org.vertx.java.core.http.impl.ServerConnection.processMessage(ServerConnection.java:313)
    at org.vertx.java.core.http.impl.ServerConnection.handleMessage(ServerConnection.java:94)
    at org.vertx.java.core.http.impl.DefaultHttpServer$ServerHandler.doMessageReceived(DefaultHttpServer.java:710)
    at org.vertx.java.core.http.impl.DefaultHttpServer$ServerHandler.doMessageReceived(DefaultHttpServer.java:600)
    at org.vertx.java.core.http.impl.VertxHttpHandler.channelRead(VertxHttpHandler.java:72)
    at org.vertx.java.core.net.impl.VertxHandler.channelRead(VertxHandler.java:155)
    at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:333)
    at io.netty.channel.AbstractChannelHandlerContext.fireChannelRead(AbstractChannelHandlerContext.java:319)
    at io.netty.handler.codec.ByteToMessageDecoder.channelRead(ByteToMessageDecoder.java:163)
    at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:333)
    at io.netty.channel.AbstractChannelHandlerContext.fireChannelRead(AbstractChannelHandlerContext.java:319)
    at org.vertx.java.core.http.impl.cgbystrom.FlashPolicyHandler.channelRead(FlashPolicyHandler.java:53)
    at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:333)
    at io.netty.channel.AbstractChannelHandlerContext.fireChannelRead(AbstractChannelHandlerContext.java:319)
    at io.netty.channel.DefaultChannelPipeline.fireChannelRead(DefaultChannelPipeline.java:787)
    at io.netty.channel.nio.AbstractNioByteChannel$NioByteUnsafe.read(AbstractNioByteChannel.java:125)
    at io.netty.channel.nio.NioEventLoop.processSelectedKey(NioEventLoop.java:511)
    at io.netty.channel.nio.NioEventLoop.processSelectedKeysOptimized(NioEventLoop.java:468)
    at io.netty.channel.nio.NioEventLoop.processSelectedKeys(NioEventLoop.java:382)
    at io.netty.channel.nio.NioEventLoop.run(NioEventLoop.java:354)
    at io.netty.util.concurrent.SingleThreadEventExecutor$2.run(SingleThreadEventExecutor.java:116)
    at java.lang.Thread.run(Thread.java:745)

How to fix this?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant