Coder Social home page Coder Social logo

appengine-standard-java8-jax-rs-with-scala's Introduction

個人的な学習のためのRepository

GOAL

  • JAX-RS(の参照実装であるJersey) をなんとなく一通り使えるようにする
  • GAE/J SE で動く

LICENSE

MIT

appengine-standard-java8-jax-rs-with-scala's People

Contributors

daneko avatar

Watchers

 avatar

appengine-standard-java8-jax-rs-with-scala's Issues

ServletConfigからプロパティを取り出す

config.getInitParameter 関連のやつとか?
今どうせ確認だからとFirebaseAdminSDK用のjsonまでrepository管理下にあるが…
その辺を別途取り出せるようにしておきたい(し、環境別に値を切り替えたい?)

AppEngineのInstanceが一個も立ち上がっていないときにアクセスした場合のErrorの対応

HTTP/1.1 500 Internal Server Error
X-Cloud-Trace-Context: 992e150733b9f4de5feb331a74ed7102;o=1
Date: Mon, 03 Jul 2017 14:06:48 GMT
Content-Type: text/html; charset=UTF-8
Server: Google Frontend
Content-Length: 323
Alt-Svc: quic=":443"; ma=2592000; v="39,38,37,36,35"


<html><head>
<meta http-equiv="content-type" content="text/html;charset=utf-8">
<title>500 Server Error</title>
</head>
<body text=#000000 bgcolor=#ffffff>
<h1>Error: Server Error</h1>
<h2>The server encountered an error and could not complete your request.<p>Please try again in 30 seconds.</h2>
<h2></h2>
</body></html>

これどうすれば良いんだろうな?
まさかidle instance 1にしろってことはないだろうし…(実際にこのリクエストを受けて一回立ち上がり、その後普通に動いているわけだし)

FirebaseAuthを使った簡易なサンプル

check list

  • clientはとりあえずAndroidで適当実装(暇ならFirebaseUIでも試せば?)
  • token検証でFirebase Admin SDK を使った場合、GAEをbackend serviceにしろってあるけど、そうじゃないと本当に動かない?
  • Authentication: Bearer なHeaderを ContainerRequestFilter を使って実装して動かす

reference

ExceptionMapperは全部に対応しない?

例としてError時のBodyをJsonとするようなMapperを用意している。

curl -i -X POST -d '{"c":1, "b":"hoge"}' -H 'Content-Type: application/json' https://hello-jaxrs-dot-semiotic-karma-172203.appspot.com/hello_jso 
HTTP/1.1 404 Not Found
Content-Type: application/json
X-Cloud-Trace-Context: 1b24c26d71a809feb822830a254df7b6;o=1
Date: Mon, 03 Jul 2017 14:07:08 GMT
Server: Google Frontend
Content-Length: 196
Alt-Svc: quic=":443"; ma=2592000; v="39,38,37,36,35"

{"status_code":404,"status_type":"CLIENT_ERROR","message":"Not Found","for_developer":{"message":"HTTP 404 Not Found","path":"https://hello-jaxrs-dot-semiotic-karma-172203.appspot.com/hello_jso"}}

これはわかる。想定通り。

curl -i -X POST -d '{"c":1, "b":"hoge"}' -H 'Content-Type: application/json' https://hello-jaxrs-dot-semiotic-karma-172203.appspot.com/hello_json
HTTP/1.1 400 Bad Request
Content-Type: text/plain
X-Cloud-Trace-Context: 52b88346333facebdc8f401203145ba6
Date: Mon, 03 Jul 2017 14:08:23 GMT
Server: Google Frontend
Content-Length: 312

Unrecognized field "c" (class com.example.sample.RequestBody), not marked as ignorable (2 known properties: "a", "b"])
 at [Source: org.glassfish.jersey.message.internal.ReaderInterceptorExecutor$UnCloseableInputStream@65de26b8; line: 1, column: 20] (through reference chain: com.example.sample.RequestBody["c"])

なんでPlanTextなんだろうな?

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.