/aquiver

The aquiver is a java web framework based on netty

Primary LanguageJavaMIT LicenseMIT

Aquiver

The aquifer is a java web framework based on jdk11 and netty

Build Status Build Status Downloads

Quick Start

Create a basic Maven or Gradle project.

Do not create a webapp project, Aquiver does not require much trouble.

Run with Maven:

<dependency>
    <groupId>org.aquiver</groupId>
    <artifactId>aquiver</artifactId>
    <version>1.0-SNAPSHOT</version>
</dependency>

Create Http Server

public class Application {
 public static void main(String[] args) {
   Aquiver.run(Main.class, args);
 }
}

Route Register

@GET(value = "/get")
public String get() {
    //todo
}

Or Use @Path

@Path(value = "/path",method = PathMethod.GET)
public String path(){
    //todo
}

Get Param

@Path(value = "/path", method = PathMethod.GET)
public String path(@Param String paramName){
    //todo
}

Get Cookie

@Path(value = "/path", method = PathMethod.GET)
public String path(@Param String cookieName){
    //todo
}

Get Body

@Path(value = "/path", method = PathMethod.POST)
public String path(@Body User user){
    //todo
}

File Upload

@POST(value = "/uploadFile")
public void uploadFile(@FileUpload MultipartFile file) {
  log.info("fileName:{}", file.getFileName());
  try {
    System.out.println(multipartFile.readFileContent());
  } catch (IOException e) {
    e.printStackTrace();
  }
}

Multi File Upload

@POST(value = "/uploadFiles")
public void uploadFileS(@MultiFileUpload List<MultipartFile> files) {
  log.info("file size:{}", files.size());
  for (MultipartFile multipartFile : files) {
    log.info("fileName:{}", multipartFile.getFileName());
    try {
      System.out.println(multipartFile.readFileContent());
    } catch (IOException e) {
      e.printStackTrace();
    }
  }
}

License

MIT

Copyright (c) 2018-present, Yi (Ever) Wang