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

skinny.micro.multipart.MultipartConfig.scala Maven / Gradle / Ivy

The newest version!
package skinny.micro.multipart

import javax.servlet.{ MultipartConfigElement, ServletContext }

import skinny.micro.context.MountConfig

/**
 * Multipart config.
 */
case class MultipartConfig(
  location: Option[String] = None,
  maxFileSize: Option[Long] = None,
  maxRequestSize: Option[Long] = None,
  fileSizeThreshold: Option[Int] = None) extends MountConfig {

  def toMultipartConfigElement: MultipartConfigElement = {
    new MultipartConfigElement(
      location.getOrElse(""),
      maxFileSize.getOrElse(-1),
      maxRequestSize.getOrElse(-1),
      fileSizeThreshold.getOrElse(0))
  }

  def apply(ctx: ServletContext): Unit = {
    ctx.setAttribute(HasMultipartConfig.MultipartConfigKey, this)
  }

}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy