Skip to content
This repository has been archived by the owner on Oct 17, 2018. It is now read-only.

analogweb/commons-fileupload-plugin

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

99 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Analog Web Framework Commons File Upload Plugin

Enable uploading file to Analogweb's routing endpoint. (NOT needs Servlet API.)

Example In Scala

Add SBT dependency.(scala-plugin includes this plugin on dependency.)

val scalaplugin = "org.analogweb" %% "analogweb-scala" % "0.9.6-SNAPSHOT"

Write them.

import org.analogweb.core.httpserver.HttpServers
import org.analogweb.scala.Analogweb

class Hello extends Analogweb {

  def upload = post("/upload") { implicit request => 
    multipart.as[java.io.File]("file").map { f =>
      // Read contents.
      ...
      Ok
    }.getOrElse(BadRequest)
  }

}

Example In Java

Add Maven dependency.

<dependency>
 <groupId>org.analogweb</groupId>
 <artifactId>analogweb-commons-fileupload</artifactId>
 <version>0.9.6-SNAPSHOT</version>
</dependency>

Write them.

package org.analogweb.hello;

import org.analogweb.annotation.Route;
import org.analogweb.annotation.Post;
import org.analogweb.acf.MultipartParam;

@Route("/")
public class Hello {

  @Route
  @Post
  public String upload(@MultipartParam("file") File uploaded) {
    // Read contents.
    ...
    return "File received.";
  }

}

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages