Git Product home page Git Product logo

ajax-qrcode-springboot's Introduction

Ajax-QRcode-SpringBoot

Description

Examples of Ajax and SpringBoot.
This project is based on Ajax-QRcode.

Deploy

Usage

Install

git clone https://github.com/ahuglajbclajep/Ajax-QRcode-SpringBoot.git
cd Ajax-QRcode-SpringBoot

Run

./gradlew bootRun

If you're OS is Windows, please read ./gradlew as gradlew.bat.
Server stop command is ctrl + c.

Check

firefox http://localhost:8080 &

License

Apache-2.0

ajax-qrcode-springboot's People

Contributors

ahuglajbclajep avatar

Stargazers

 avatar

Watchers

 avatar  avatar

ajax-qrcode-springboot's Issues

Can't work gradle plugins DSL

gradlespringのドキュメントによると

plugins {
  id "org.springframework.boot" version "1.5.4.RELEASE"
}

だけでpluginのapplyまでやってくれるらしいが

group 'ahuglajbclajep.spring.boot'
version = '1.1.0'
buildscript {
    plugins {
        id "org.springframework.boot" version "1.5.4.RELEASE"
    }
}

としたところorg.springframework.bootプラグインの解決に失敗した

bodyが日本語を受け付けない

bodyの時点でエンコードされたものになってしまうので正しいQRコードが生成されない
これによるとapplication/x-www-form-urlencodedだと手間っぽい
そもそも複数パラメーターをもらうためのものだし

createQRcodeの引数の扱いについて

nullはもちろん空文字でも生成する画像はない
nullに対するアプローチは

  • privateならnullがこないのは自明
    空文字はisEmpty()IllegalArgumentExceptionを投げるなどする
  • java.util.Optional<T>.orElseでデフォルト値でなどで処理を継続
  • null以外にもとりたくない値があるならIllegalArgumentExceptionを投げる
  • java.util.Objects.requireNonNullNullPointerExceptionを投げる
  • @NonNullを使う
    などが上げられる

ToDo

v2.0までにやりたいこと

IEで$.ajaxが機能しない

おそらく

$.ajax({
  url: "create",
  type: "POST",
  contentType: "text/plain",
  data: text,
  xhr: function () {
    var xhr = new XMLHttpRequest();
    xhr.responseType = "blob";
    return xhr;
  }
})

とxhrを指定してるのが原因
ドキュメントにも

Defaults to the ActiveXObject when available (IE)

とある(IEにもXMLHttpRequestはあるはずだが…)

素直に素のJSで書くと動作するのでそのように対応する

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.