Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6385613
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 25, 20262026-05-25T02:55:19+00:00 2026-05-25T02:55:19+00:00

I followed the example here . It works, fine. But now I need to

  • 0

I followed the example here. It works, fine. But now I need to perform some business logic in case get:Get =>

Required business logic includes using dispatch library. In a nutshell, I do a request to some page, get the data, wrap it in some class, and return it.

My receiving case looks like this:

case get:Get => {
  get.response.setContentType(MediaType.APPLICATION_JSON)
  val response = Sender.doLogin
  val battery = (response.batteryRemaining / response.batteryCapacity) * 100
  val soc = (response.pluginState + ", " + response.chargingStatus).replaceAll("_", " ")
  val jsonResult = pretty(render(("battery" -> battery) ~ ("soc" -> soc)))
  get OK jsonResult
  // get OK "works"
}

This does not work:

ERROR [akka:event-driven:dispatcher:event:handler-5] akka.event.slf4j.Slf4jEventHandler - 
    [akka.http.Servlet30ContextMethodFactory$$anon$2]
    [org.eclipse.jetty.io.EofException]
    [org.eclipse.jetty.io.UncheckedIOException: org.eclipse.jetty.io.EofException
    at org.eclipse.jetty.io.UncheckedPrintWriter.setError(UncheckedPrintWriter.java:107)
    at org.eclipse.jetty.io.UncheckedPrintWriter.write(UncheckedPrintWriter.java:280)
    at org.eclipse.jetty.io.UncheckedPrintWriter.write(UncheckedPrintWriter.java:295)
    at akka.http.RequestMethod$$anonfun$complete$1.apply(Mist.scala:346)
    at akka.http.RequestMethod$$anonfun$complete$1.apply(Mist.scala:343)
    at akka.http.RequestMethod$class.rawComplete(Mist.scala:357)
    at akka.http.Get.rawComplete(Mist.scala:407)
    at akka.http.RequestMethod$class.complete(Mist.scala:343)
    at akka.http.Get.complete(Mist.scala:407)
    at akka.http.RequestMethod$class.complete(Mist.scala:340)
    at akka.http.Get.complete(Mist.scala:407)
    at akka.http.RequestMethod$class.OK(Mist.scala:388)
    at akka.http.Get.OK(Mist.scala:407)
    at com.thenewmotion.caronline.services.rest.BatteryStatusService$$anonfun$receive$1.apply(BatteryStatusService.scala:36)
    at com.thenewmotion.caronline.services.rest.BatteryStatusService$$anonfun$receive$1.apply(BatteryStatusService.scala:28)
    at akka.actor.Actor$class.apply(Actor.scala:563)
    at com.thenewmotion.caronline.services.rest.BatteryStatusService.apply(BatteryStatusService.scala:27)
    at akka.actor.LocalActorRef.invoke(ActorRef.scala:890)
    at akka.dispatch.MessageInvocation.invoke(MessageHandling.scala:25)
    at akka.dispatch.ExecutableMailbox$class.processMailbox(ExecutorBasedEventDrivenDispatcher.scala:214)
    at akka.dispatch.ExecutorBasedEventDrivenDispatcher$$anon$4.processMailbox(ExecutorBasedEventDrivenDispatcher.scala:120)
    at akka.dispatch.ExecutableMailbox$class.run(ExecutorBasedEventDrivenDispatcher.scala:186)
    at akka.dispatch.ExecutorBasedEventDrivenDispatcher$$anon$4.run(ExecutorBasedEventDrivenDispatcher.scala:120)
    at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886)
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908)
    at java.lang.Thread.run(Thread.java:662)
    at akka.dispatch.MonitorableThread.run(ThreadPoolBuilder.scala:181)
Caused by: org.eclipse.jetty.io.EofException
    at org.eclipse.jetty.server.HttpOutput.write(HttpOutput.java:150)
    at org.eclipse.jetty.server.HttpOutput.write(HttpOutput.java:97)
    at java.io.ByteArrayOutputStream.writeTo(ByteArrayOutputStream.java:109)
    at org.eclipse.jetty.server.HttpWriter.write(HttpWriter.java:283)
    at org.eclipse.jetty.server.HttpWriter.write(HttpWriter.java:107)
    at org.eclipse.jetty.io.UncheckedPrintWriter.write(UncheckedPrintWriter.java:271)
    ... 25 more
]

It also seems, that it starts making the request (with dispatch library) after it responds with HTTP 200 OK.

What could be the problem here?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-25T02:55:19+00:00Added an answer on May 25, 2026 at 2:55 am

    Try turning off connection-close: https://github.com/jboner/akka/blob/master/config/akka-reference.conf#L262

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I followed an example of expander in wpf. Works fine but old bullet is
I followed this example and it works great but I'm wondering if I can
I followed the example here: Why does <h:inputText required="true"> allow blank spaces? to create
I followed the explanation on the sIFR wiki, but can't seem to get accented
Right now I'm using this which works for the development host, but I have
I want to replace char '&' if it's not followed by '#'. For example
Followed this question about delayed_job and monit Its working on my development machine. But
So followed all the basic tutorials. Am using Zend 1.8 but i keep getting
I followed Ray Wenderlich's tutorial on text autocompletion here: http://www.raywenderlich.com/336/how-to-auto-complete-with-custom-values And it works great,
Here's what I need in what I guess must be the right order: The

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.