CRUD operations with PostgreSQL using SLICK with LOGBACK EMAIL functionality.

Knoldus

This article is about to show how to send logging email using logback-test.xml, the backend is postgresql and the queries format is in slick, language used is scala.

The code is well commented so, files to be noticed are:

  1. KnolRepo.scala
  2. KnolRepoTest.scala
  3. logback-test.xml

Download the source code to check the functionality. GitHub

View original post

Advertisements

Playing MultipartFormData: A basic example to handle and test MultipartFormData request in Play Framework 2.3.8

Knoldus

Playing MultipartFormData

The following blog and attached code represent an example to upload file using MultipartFormData request and Testing it into Play Application.

A basic example to handle and test MultipartFormData request in Play Framework 2.3.8

The standard way to upload files in a web application is to use a form with a special multipart/form-data encoding, which lets you mix standard form data with file attachment data. Please note: the HTTP method used to submit the form must be POST (not GET).


Code in action for Controller and Service


  val uploadService: UploadService

  def upload = Action(parse.multipartFormData) { implicit request =>
    val result = uploadService.uploadFile(request)
    Redirect(routes.Application.index).flashing("message" -> result)
  }
 /** * Get file from the request and move it in your location * * @param request * @return */ def uploadFile(request: Request[MultipartFormData[TemporaryFile]]): String = { log.error("Called…

View original post 245 more words