On Fri, Oct 10, 2014 at 6:40 PM, Sebastien <[email protected]> wrote:

> Hi Martin,
>
> Thanks for your quick answer!
>
> Just to be sure we are on the same page, I do not call #sendError myself...
> I suppose it is called automatically because an exception is thrown
> elsewhere (let's considering this is the intended behavior in my case...).
>
> > One option is to replace "throw UnsupportedOperationException" with
> log.warn.
> I would personally just have replaced "throw new
> UnsupportedOperationException()" by a "// noop" comment or something like
> that. Logging a warning would mean the user can take an action to correct
> this but - if I understood you correctly - that's not the case...
>

But do you really want the exception to be swallowed like this ?
This will lead to a lot of confusion - an error happens and Wicket neither
logs it nor sends any feedback back to the browser ...


>
> Checking that target IS-A WebSocketRequestHandler will be probably very
> useful in a near future! :)
>
> Best regards,
> Sebastien.
>
>
> On Fri, Oct 10, 2014 at 5:21 PM, Martin Grigorov <[email protected]>
> wrote:
>
> > Hi Sebastien,
> >
> > With https://issues.apache.org/jira/browse/WICKET-5701 I've added
> support
> > for RequestCycle.find(AjaxRequestTarget.class) and actually proper
> support
> > for scheduling any kind of IRequestHandler.
> > In M3 your ErrorCodeRequestHandler has been just send to /dev/null.
> >
> > One option is to replace "throw UnsupportedOperationException" with
> > log.warn.
> > The idea is that your error code doesn't mean anything in the web socket
> > response. It is not normal HTTP response so the browser won't try to
> > process it ...
> >
> > In your code you can check whether this is a WebSocketRequestHandler and
> > return something that your client side logic should process as an error.
> > Or maybe WebSocketResponse.sendError() can write this for you: {"type":
> > "error", "code": 456, "message": "optional"} ?
> > But again it is up to your client side logic to process it.
> >
> > Martin Grigorov
> > Wicket Training and Consulting
> > https://twitter.com/mtgrigorov
> >
> > On Fri, Oct 10, 2014 at 6:09 PM, Sebastien <[email protected]> wrote:
> >
> > > Hi,
> > >
> > > Using 7.0.0-SNAPSHOT, I've got a UnsupportedOperationException (see
> > below)
> > > whereas I do not have it on 7.0.0-M3. I don't really know how to
> > > investigate as an UnsupportedOperationException seems to be the
> expected
> > > result [1], or maybe #sendError is not supposed to be called anyway, or
> > it
> > > is a regression from -M3...
> > >
> > > I'm using wicket-native-websocket-core & wicket-native-websocket-javax
> on
> > > WildFly8
> > >
> > > Thanks in advance for your advise,
> > > Sebastien.
> > >
> > > [1]
> > >
> > >
> >
> https://github.com/apache/wicket/blob/master/wicket-native-websocket/wicket-native-websocket-core/src/main/java/org/apache/wicket/protocol/ws/api/WebSocketResponse.java#L193
> > >
> > > --
> > > ERROR [org.apache.wicket.request.cycle.RequestCycle] Error during
> > > processing error message: java.lang.UnsupportedOperationException
> > >         at
> > >
> > >
> >
> org.apache.wicket.protocol.ws.api.WebSocketResponse.sendError(WebSocketResponse.java:193)
> > > [wicket-native-websocket-core-7.0.0-SNAPSHOT.jar:7.0.0-SNAPSHOT]
> > >         at
> > >
> > >
> >
> org.apache.wicket.request.http.handler.ErrorCodeRequestHandler.respond(ErrorCodeRequestHandler.java:77)
> > > [wicket-request-7.0.0-SNAPSHOT.jar:7.0.0-SNAPSHOT]
> > >         at
> > >
> > >
> >
> org.apache.wicket.request.cycle.RequestCycle$HandlerExecutor.respond(RequestCycle.java:837)
> > > [wicket-core-7.0.0-SNAPSHOT.jar:7.0.0-SNAPSHOT]
> > >         at
> > >
> > >
> >
> org.apache.wicket.request.RequestHandlerStack.execute(RequestHandlerStack.java:64)
> > > [wicket-request-7.0.0-SNAPSHOT.jar:7.0.0-SNAPSHOT]
> > >         at
> > >
> > >
> >
> org.apache.wicket.request.cycle.RequestCycle.executeExceptionRequestHandler(RequestCycle.java:314)
> > > [wicket-core-7.0.0-SNAPSHOT.jar:7.0.0-SNAPSHOT]
> > >         at
> > >
> > >
> >
> org.apache.wicket.request.cycle.RequestCycle.executeExceptionRequestHandler(RequestCycle.java:323)
> > > [wicket-core-7.0.0-SNAPSHOT.jar:7.0.0-SNAPSHOT]
> > >         at
> > >
> > >
> >
> org.apache.wicket.request.cycle.RequestCycle.executeExceptionRequestHandler(RequestCycle.java:323)
> > > [wicket-core-7.0.0-SNAPSHOT.jar:7.0.0-SNAPSHOT]
> > >         at
> > >
> > >
> >
> org.apache.wicket.request.cycle.RequestCycle.executeExceptionRequestHandler(RequestCycle.java:323)
> > > [wicket-core-7.0.0-SNAPSHOT.jar:7.0.0-SNAPSHOT]
> > >         at
> > >
> > >
> >
> org.apache.wicket.request.cycle.RequestCycle.executeExceptionRequestHandler(RequestCycle.java:323)
> > > [wicket-core-7.0.0-SNAPSHOT.jar:7.0.0-SNAPSHOT]
> > >         at
> > >
> > >
> >
> org.apache.wicket.request.cycle.RequestCycle.executeExceptionRequestHandler(RequestCycle.java:323)
> > > [wicket-core-7.0.0-SNAPSHOT.jar:7.0.0-SNAPSHOT]
> > >         at
> > >
> > >
> >
> org.apache.wicket.request.cycle.RequestCycle.executeExceptionRequestHandler(RequestCycle.java:323)
> > > [wicket-core-7.0.0-SNAPSHOT.jar:7.0.0-SNAPSHOT]
> > >         at
> > >
> > >
> >
> org.apache.wicket.request.cycle.RequestCycle.executeExceptionRequestHandler(RequestCycle.java:323)
> > > [wicket-core-7.0.0-SNAPSHOT.jar:7.0.0-SNAPSHOT]
> > >         at
> > >
> > >
> >
> org.apache.wicket.request.cycle.RequestCycle.executeExceptionRequestHandler(RequestCycle.java:323)
> > > [wicket-core-7.0.0-SNAPSHOT.jar:7.0.0-SNAPSHOT]
> > >         at
> > >
> > >
> >
> org.apache.wicket.request.cycle.RequestCycle.executeExceptionRequestHandler(RequestCycle.java:323)
> > > [wicket-core-7.0.0-SNAPSHOT.jar:7.0.0-SNAPSHOT]
> > >         at
> > >
> > >
> >
> org.apache.wicket.request.cycle.RequestCycle.executeExceptionRequestHandler(RequestCycle.java:323)
> > > [wicket-core-7.0.0-SNAPSHOT.jar:7.0.0-SNAPSHOT]
> > >         at
> > >
> > >
> >
> org.apache.wicket.request.cycle.RequestCycle.processRequest(RequestCycle.java:237)
> > > [wicket-core-7.0.0-SNAPSHOT.jar:7.0.0-SNAPSHOT]
> > >         at
> > >
> > >
> >
> org.apache.wicket.request.cycle.RequestCycle.processRequestAndDetach(RequestCycle.java:293)
> > > [wicket-core-7.0.0-SNAPSHOT.jar:7.0.0-SNAPSHOT]
> > >         at
> > >
> > >
> >
> org.apache.wicket.protocol.ws.api.AbstractWebSocketProcessor.broadcastMessage(AbstractWebSocketProcessor.java:219)
> > > [wicket-native-websocket-core-7.0.0-SNAPSHOT.jar:7.0.0-SNAPSHOT]
> > >         at
> > >
> > >
> >
> org.apache.wicket.protocol.ws.api.AbstractWebSocketProcessor.onConnect(AbstractWebSocketProcessor.java:150)
> > > [wicket-native-websocket-core-7.0.0-SNAPSHOT.jar:7.0.0-SNAPSHOT]
> > >         at
> > >
> > >
> >
> org.apache.wicket.protocol.ws.javax.JavaxWebSocketProcessor.<init>(JavaxWebSocketProcessor.java:48)
> > > [wicket-native-websocket-javax-7.0.0-SNAPSHOT.jar:7.0.0-SNAPSHOT]
> > >         at
> > >
> > >
> >
> org.apache.wicket.protocol.ws.javax.WicketEndpoint.onOpen(WicketEndpoint.java:58)
> > > [wicket-native-websocket-javax-7.0.0-SNAPSHOT.jar:7.0.0-SNAPSHOT]
> > >         at
> > >
> > >
> >
> io.undertow.websockets.jsr.EndpointSessionHandler.onConnect(EndpointSessionHandler.java:84)
> > > [undertow-websockets-jsr-1.0.15.Final.jar:1.0.15.Final]
> > >         at
> > >
> > >
> >
> io.undertow.websockets.jsr.JsrWebSocketFilter$1.handleUpgrade(JsrWebSocketFilter.java:115)
> > > [undertow-websockets-jsr-1.0.15.Final.jar:1.0.15.Final]
> > >         at
> > >
> > >
> >
> io.undertow.server.protocol.http.HttpReadListener.exchangeComplete(HttpReadListener.java:271)
> > > [undertow-core-1.0.15.Final.jar:1.0.15.Final]
> > >         at
> > >
> > >
> >
> io.undertow.server.protocol.http.HttpServerConnection.exchangeComplete(HttpServerConnection.java:221)
> > > [undertow-core-1.0.15.Final.jar:1.0.15.Final]
> > >         at
> > >
> > >
> >
> io.undertow.server.HttpServerExchange.invokeExchangeCompleteListeners(HttpServerExchange.java:1131)
> > > [undertow-core-1.0.15.Final.jar:1.0.15.Final]
> > >         at
> > >
> > >
> >
> io.undertow.server.HttpServerExchange.terminateResponse(HttpServerExchange.java:1351)
> > > [undertow-core-1.0.15.Final.jar:1.0.15.Final]
> > >         at
> > > io.undertow.server.Connectors.terminateResponse(Connectors.java:78)
> > > [undertow-core-1.0.15.Final.jar:1.0.15.Final]
> > >         at
> > >
> > >
> >
> io.undertow.server.protocol.http.ServerFixedLengthStreamSinkConduit.channelFinished(ServerFixedLengthStreamSinkConduit.java:33)
> > > [undertow-core-1.0.15.Final.jar:1.0.15.Final]
> > >         at
> > >
> > >
> >
> io.undertow.conduits.AbstractFixedLengthStreamSinkConduit.exitFlush(AbstractFixedLengthStreamSinkConduit.java:273)
> > > [undertow-core-1.0.15.Final.jar:1.0.15.Final]
> > >         at
> > >
> > >
> >
> io.undertow.conduits.AbstractFixedLengthStreamSinkConduit.flush(AbstractFixedLengthStreamSinkConduit.java:207)
> > > [undertow-core-1.0.15.Final.jar:1.0.15.Final]
> > >         at
> > >
> > >
> >
> org.xnio.conduits.ConduitStreamSinkChannel.flush(ConduitStreamSinkChannel.java:162)
> > >         at
> > >
> > >
> >
> io.undertow.channels.DetachableStreamSinkChannel.flush(DetachableStreamSinkChannel.java:100)
> > > [undertow-core-1.0.15.Final.jar:1.0.15.Final]
> > >         at org.xnio.channels.Channels.flushBlocking(Channels.java:63)
> > >         at
> > >
> > >
> >
> io.undertow.servlet.spec.ServletOutputStreamImpl.close(ServletOutputStreamImpl.java:625)
> > > [undertow-servlet-1.0.15.Final.jar:1.0.15.Final]
> > >         at
> > >
> > >
> >
> io.undertow.servlet.spec.HttpServletResponseImpl.closeStreamAndWriter(HttpServletResponseImpl.java:451)
> > > [undertow-servlet-1.0.15.Final.jar:1.0.15.Final]
> > >         at
> > >
> > >
> >
> io.undertow.servlet.spec.HttpServletResponseImpl.responseDone(HttpServletResponseImpl.java:525)
> > > [undertow-servlet-1.0.15.Final.jar:1.0.15.Final]
> > >         at
> > >
> > >
> >
> io.undertow.servlet.handlers.ServletInitialHandler.handleFirstRequest(ServletInitialHandler.java:287)
> > > [undertow-servlet-1.0.15.Final.jar:1.0.15.Final]
> > >         at
> > >
> > >
> >
> io.undertow.servlet.handlers.ServletInitialHandler.dispatchRequest(ServletInitialHandler.java:227)
> > > [undertow-servlet-1.0.15.Final.jar:1.0.15.Final]
> > >         at
> > >
> > >
> >
> io.undertow.servlet.handlers.ServletInitialHandler.access$000(ServletInitialHandler.java:73)
> > > [undertow-servlet-1.0.15.Final.jar:1.0.15.Final]
> > >         at
> > >
> > >
> >
> io.undertow.servlet.handlers.ServletInitialHandler$1.handleRequest(ServletInitialHandler.java:146)
> > > [undertow-servlet-1.0.15.Final.jar:1.0.15.Final]
> > >         at
> > > io.undertow.server.Connectors.executeRootHandler(Connectors.java:177)
> > > [undertow-core-1.0.15.Final.jar:1.0.15.Final]
> > >         at
> > >
> io.undertow.server.HttpServerExchange$1.run(HttpServerExchange.java:727)
> > > [undertow-core-1.0.15.Final.jar:1.0.15.Final]
> > >         at
> > >
> > >
> >
> java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)
> > > [rt.jar:1.7.0_65]
> > >         at
> > >
> > >
> >
> java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)
> > > [rt.jar:1.7.0_65]
> > >         at java.lang.Thread.run(Thread.java:745) [rt.jar:1.7.0_65]
> > >
> >
>

Reply via email to