<commit_before>package funnel
package chemist

import unfiltered.request._
import unfiltered.response._
import unfiltered.netty._
import argonaut._, Argonaut._
import scalaz.concurrent.Task
import journal.Logger

object JsonRequest {
  def apply[T](r: HttpRequest[T]) =
    new ParseWrap(r, new Parse[HttpRequest[T]] {
      def parse(req: HttpRequest[T]) = JsonParser.parse(Body.string(req))
    })
}

object JsonResponse {
  def apply[A: EncodeJson](a: A, params: PrettyParams = PrettyParams.nospace) =
    JsonContent ~> ResponseString(a.jencode.pretty(params))
}

object Server {
  private val log = Logger[Server.type]

  def start[U <: Platform](chemist: Chemist[U], platform: U): Task[Unit] =
    Task.reduceUnordered[Unit, Unit](Seq(
      chemist.bootstrap(platform),
      chemist.init(platform),
      Task(unfiltered.netty.Server
        .http(platform.config.network.port, platform.config.network.host)
        .resources(getClass.getResource("/oncue/www/"), cacheSeconds = 3600)
        .handler(Server(chemist, platform))
        .run
      )
    ))
}

@io.netty.channel.ChannelHandler.Sharable
case class Server[U <: Platform](chemist: Chemist[U], platform: U) extends cycle.Plan with cycle.SynchronousExecution with ServerErrorResponse {
  import JSON._<commit_msg>appear to have resolved the issue with the http resources not returning when deployed on centos<commit_after>package funnel
package chemist

import unfiltered.request._
import unfiltered.response._
import unfiltered.netty._
import argonaut._, Argonaut._
import scalaz.concurrent.Task
import journal.Logger

object JsonRequest {
  def apply[T](r: HttpRequest[T]) =
    new ParseWrap(r, new Parse[HttpRequest[T]] {
      def parse(req: HttpRequest[T]) = JsonParser.parse(Body.string(req))
    })
}

object JsonResponse {
  def apply[A: EncodeJson](a: A, params: PrettyParams = PrettyParams.nospace) =
    JsonContent ~> ResponseString(a.jencode.pretty(params))
}

object Server {
  private val log = Logger[Server.type]

  def start[U <: Platform](chemist: Chemist[U], platform: U): Task[Unit] =
    Task.reduceUnordered[Unit, Unit](Seq(
      Task.delay(unfiltered.netty.Server
        .http(platform.config.network.port, platform.config.network.host)
        .resources(getClass.getResource("/oncue/www/"), cacheSeconds = 3600)
        .handler(Server(chemist, platform))
        .run
      ),
      chemist.bootstrap(platform),
      chemist.init(platform)
    ))
}

@io.netty.channel.ChannelHandler.Sharable
case class Server[U <: Platform](chemist: Chemist[U], platform: U) extends cycle.Plan with cycle.SynchronousExecution with ServerErrorResponse {
  import JSON._
{'fraction_non_alphanumeric': 0.11953242835595777, 'fraction_numerical': 0.0030165912518853697, 'mean_word_length': 4.253465346534654, 'pattern_counts': {'":': 0, '<': 7, '<?xml version=': 0, '>': 5, 'https://': 0, 'lorem ipsum': 0, 'www.': 2, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '4805079', 'n_tokens_mistral': 830, 'n_tokens_neox': 805, 'n_words': 180}