Correctly shutting down a websocket handler
by Robin Anil
When a client disconnects, I see that onClose is not being fired. The only
way this seems to be firing if client sents a close frame.
Is there any way to detect disconnection and immediately close all the
opened resources.
Robin
Robin Anil | Software Engineer
1 year, 2 months
We are noticing broken websocket messages
by Robin Anil
Stuart,
We are using undertow websocket library for passing back and forth
serialized JSON messages using Websockets.sendText method
On the client side in Chrome we are noticing that that instead of 1 message
we are receiving 2 where the first one is truncated at some 323,821 B and
the second message is of 148,583 but malformed (its text but its garbled)
and therefore not a JSON even if its concatenated with the first message
We are converting protocol buffers to JSON on the server side and can't
point the finger at that code as it had worked for even bigger JSON
messages.
To investigate this further I need help ruling out any message size or
frame size limitation on undertow that could cause this. Any pointers here
would be helpful.
Robin
8 years, 7 months
how to use ExceptionHandler & security together
by Michael Grove
I have a pretty basic server set up:
ExceptionHandler -> Security Handlers * -> PathTemplateHandler -> my routes
* The security handlers are set up as shown in the examples [1] and I'm
also using the same `IdentityManager` for my tinkering.
What I'm seeing is that in ExceptionHandler [2] the request is just passed
directly onto the next handler, which in this case, is the start of the
security handlers.
The request is passed through each handler until it hits
`AuthenticationCallHandler` and is moved off the IO thread [3]. The call
then returns, and all the invocations to the next handler finish back up
the stack until `ExceptionHandler`, where the call completes successfully.
Trouble is, the request was malformed and the route handling it threw an
exception and it wasn't handled as expected.
I guess the correct answer is that I shouldn't have allowed it to get
thrown out of the handler for the route; catch it there and send the
expected error response.
But, I'm curious if there was a way to do this with the handlers, or
perhaps, more generally, what are the expectations along the call chain of
handlers when some may move off the initial IO thread.
Thanks.
Mike
[1]
https://github.com/undertow-io/undertow/blob/master/examples/src/main/jav...
[2]
https://github.com/undertow-io/undertow/blob/master/core/src/main/java/io...
[3]
https://github.com/undertow-io/undertow/blob/master/core/src/main/java/io...
8 years, 7 months
Broken #toArray-methods in SecureHashMap$KeySet/Values/EntrySet
by Andrej Golovnin
Hi Stuart,
all toArray-methods implementations in the classes
SecureHashMap$KeySet
SecureHashMap$Values
SecureHashMap$EntrySet
are broken and throw StackOverflowError.
The methods can be removed from this classes because
the parent class AbstractCollection provides valid
implementations of this methods.
The class SecureHashMap is not used in Undertow and
I think it is not used in WildFly too. Therefore maybe
it makes sense to remove the whole class SecureHashMap.
Best regards,
Andrej Golovnin
8 years, 8 months
Loss of perfomance between 1.3.0.Beta9 and 1.3.18.Final
by Toby Crawley
Is there a known decrease in throughput (measured with req/s)
between 1.3.0.Beta9 and 1.3.18.Final? We currently ship the former
with Immutant, and were looking at upgrading to the latter in the next
release, but noticed a decrease in throughput with a simple Clojure
benchmark app.
I have replicated the basics of our benchmark app in Java[1], and saw a
decrease in req/s between the two versions of ~7% when testing with ab
and averaging the output of several runs.
Is there something that changed between those versions that is known
to have reduced performance?
- Toby
[1]: https://github.com/tobias/undertow-speed
8 years, 8 months
Undertow 1.3.0 - rewrite HTML content
by Hugo Calado
Greetings,
How can i rewrite the path inside html files.
Original HTML file:
....<script type=*"text/javascript"* src=*"**/v/js/abc.js**"*></script>
After rewrite:
....<script type=*"text/javascript"* src=*"**/v123/js/abc.js**"*></script>
The main objective is to solve browser cache issues assuring that in each
new release the url's of static objects are modified,
Thank you,
Hugo Calado
8 years, 8 months
java.lang.NoClassDefFoundError: freemarker/cache/TemplateLoader
by Shiva Saxena
Hi,
I am just creating a Hello world example of undertow.js like so
$undertow
.onGet("/hello-freemarker",
{template: '/resources/hello.ftl','template_type': 'freemarker',
headers: {"content-type": "text/plain"}},
[function ($exchange) {
return {data: 'Hello World!'};
}]);
When deploying the project I am getting the following exception
ERROR [org.jboss.msc.service.fail] (ServerService Thread Pool -- 2)
MSC000001: Failed to start service
jboss.undertow.deployment.default-server.default-host./undertowjs-example:
org.jboss.msc.service.StartException in service
jboss.undertow.deployment.default-server.default-host./undertowjs-example:
java.util.ServiceConfigurationError:
io.undertow.js.templates.TemplateProvider: Provider
io.undertow.js.templates.freemarker.FreemarkerTemplateProvider could not be
instantiated
at
org.wildfly.extension.undertow.deployment.UndertowDeploymentService$1.run(UndertowDeploymentService.java:85)
at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)
at java.util.concurrent.FutureTask.run(FutureTask.java:266)
at
java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
at
java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
at java.lang.Thread.run(Thread.java:745)
I have also added the freemarker jar file in the modules folder but it
still doesn't help. Please let me know what I might be doing wrong or is
come extra conf required.
--
Best Regards
*Shiva Saxena*
*Mobile : +91-9889787094 *
*Blog <http://metalop.com/> | Linkedin
<http://in.linkedin.com/in/shivasaxena/> | StackOverflow
<http://stackoverflow.com/users/2490343/shiva>*
8 years, 8 months
Change response body in Undertow
by Geisselmann Benno (INST/ECS1)
Hi,
Can you tell me, whether it is possible to change the Body of a request response (within HttpServerExchange) if this response has already been created by another handler? I saw that I can change for example the response status code, but it seems like I cannot change the response body.
Thanks for your help.
Benno Geißelmann
Bosch Software Innovations GmbH
www.blog.bosch-si.com<http://www.blog.bosch-si.com/>
www.bosch-si.de
benno.geisselmann(a)bosch-si.com<mailto:benno.geisselmann@bosch-si.com>
Registered office: Berlin, Register court: Amtsgericht Charlottenburg; HRB 148411 B;
Executives: Dr.-Ing. Rainer Kallenbach, Michael Hahn
8 years, 8 months
WSS Java Client Examplt
by Gorman, Steve A.
All,
I have a J2EE project that runs a Resource Adapter to allow some socket communications to a CPP app, all running in Wildfly 9. I now want to write a java socket listener that reads broadcast messages on a TCP/IP connection and forward those broadcast message to a bunch of browser sessions. My deployment structure is ..
artifact.ear
JcaAdapter.rar (tcp/ip socket reader lives in here)
BusinessLogic.war ( jcaAdapter.getConnection() and receive tcp/ip messages )
Inside my BusinessLogic.war I have created a javax @ServerEndpoint("/broadcasts/") websocket endpoint for the JS browser clients. Inside my JcaAdapter.rar I have put a TCP/IP socket reader which constantly listens for broadcast messages. When they arrive I want to have a Java based WSS websocket client that sends the messages to the @ServerEndpoint websocket. My Wildfly instance is SSL so my web socket java client has to be WSS.
I have scoured the internet and safari books looking for an example client for WSS written in Java but have found nothing.
Any help or advice is so very appreciated.
8 years, 8 months