All Downloads are FREE. Search and download functionalities are using the official Maven repository.

jp.co.cyberagent.aeromock.server.http.HttpRequestProcessor.scala Maven / Gradle / Ivy

There is a newer version: 0.2.5
Show newest version
package jp.co.cyberagent.aeromock.server.http

import io.netty.channel.ChannelHandlerContext
import io.netty.handler.codec.http.{HttpResponse, FullHttpRequest}
import jp.co.cyberagent.aeromock.config.{Project, ConfigHolder}

/**
 * Base class of request processing.
 * @author stormcat24
 */
abstract class HttpRequestProcessor {

  /**
   *
   * @param request [[io.netty.handler.codec.http.FullHttpRequest]]
   * @param context [[io.netty.channel.ChannelHandlerContext]]
   * @return [[io.netty.handler.codec.http.HttpResponse]]
   */
  def delegate(request: FullHttpRequest)(implicit context: ChannelHandlerContext): HttpResponse = {
    process(ConfigHolder.getProject, request)
  }

  /**
   *
   * @param setting [[Project]]
   * @param request [[io.netty.handler.codec.http.FullHttpRequest]]
   * @param context [[io.netty.channel.ChannelHandlerContext]]
   * @return [[io.netty.handler.codec.http.HttpResponse]]
   */
  def process(setting: Project, request: FullHttpRequest)(implicit context: ChannelHandlerContext): HttpResponse

}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy