NI-Lab.

nilog:

← 前の日 2018-12-31 次の日 →
← 一年前 一年後 →
Twitter (2018-12-31)
「Spring Bootのデフォルトでは、コントローラで例外が発生するとHTTPの500エラーと合わせてWhitelabel Error Pageと呼ばれるページが表示される」

Spring Bootでエラーページをカスタマイズする - ももいろテクノロジー http://inaz2.hatenablog.com/entry/2017/05/03/153121
[t] 2018-12-31 14:32:13
関連するかも情報
resources/templates/error.html を作成したら 404 のときにこっちのページを表示するようになった。
[t] 2018-12-31 14:31:25
「Spring Bootのデフォルトでは、コントローラで例外が発生するとHTTPの500エラーと合わせてWhitelabel Error Pageと呼ばれるページが表示される」

Spring Bootでエラーページをカスタマイズする - ももいろテクノロジー http://inaz2.hatenablog.com/entry/2017/05/03/153121
[t] 2018-12-31 14:32:13
resources/public/error/404.html とか置けば良いらしい。

28.1.11 Error Handling / 28. Developing Web Applications https://docs.spring.io/spring-boot/docs/2.1.0.RELEASE/reference/html/boot-features-developing-web-applications.html#boot-features-error-handling
[t] 2018-12-31 14:35:40
Spring Boot とThymeleaf の公式ドキュメントを探してみたけど resources/templates/error.html の記述が見つからないなぁ。。。
[t] 2018-12-31 14:42:28
公式が提供しているサンプルコードには src/main/resources/templates/error.html が見つかった。

spring-boot/error.html at master · spring-projects/spring-boot · GitHub https://github.com/spring-projects/spring-boot/blob/master/spring-boot-samples/spring-boot-sample-web-secure/src/main/resources/templates/error.html
[t] 2018-12-31 14:43:24
error の View を追加しろって書いてあるから、これが error.html を置けってことなのかな。わからん。。。

"error view that renders the same data in HTML format (to customize it, add a View that resolves to error)."

28. Developing Web Applications https://docs.spring.io/spring-boot/docs/2.1.0.RELEASE/reference/html/boot-features-developing-web-applications.html#boot-features-error-handling
[t] 2018-12-31 14:53:44
"In the demo application this view maps in turn to the error.html Thymeleaf template. (If using JSP, it would map to error.jsp according to the setup of your InternalResourceViewResolver)."

Exception Handling in Spring MVC https://spring.io/blog/2013/11/01/exception-handling-in-spring-mvc
[t] 2018-12-31 14:56:00
結局、頼りになるのはドキュメントではなくサンプルコードってことかな。ドキュメントを探しても解決策が見つけにくいのなら、コピペコードが増えるのもしょうがないな。
[t] 2018-12-31 14:58:32
"htmlEscape(java.lang.String input, java.lang.String encoding)"

"Turn special characters into HTML character references."

HtmlUtils (Spring Framework 5.1.3.RELEASE API) https://docs.spring.io/spring-framework/docs/current/javadoc-api/org/springframework/web/util/HtmlUtils.html
[t] 2018-12-31 15:03:30
HtmlCharacterEntityReferences#convertToReference

spring-framework/HtmlUtils.java at master · spring-projects/spring-framework · GitHub https://github.com/spring-projects/spring-framework/blob/master/spring-web/src/main/java/org/springframework/web/util/HtmlUtils.java
[t] 2018-12-31 15:04:43
UTF- なエンコーディングだとHTML特別文字を普通に置換。それ以外だと if (character < 1000 || (character >= 8000 && character < 10000)) で別の処理。

spring-framework/HtmlCharacterEntityReferences.java at master · spring-projects/spring-framework · GitHub https://github.com/spring-projects/spring-framework/blob/master/spring-web/src/main/java/org/springframework/web/util/HtmlCharacterEntityReferences.java#L135
[t] 2018-12-31 15:07:56
【話題のキーワード】
1. アテナ
2. アンナチュラル
3. ユーステス
4. 探偵ナイトスクープ
5. クビラ
6. グラブル
7. 神風
8. ガブリエル
9. 桐光
10. 中堂
https://search.yahoo.co.jp/realtime #buzzbot
[t] 2018-12-31 15:10:02
「KotlinのStringクラスには replaceAll メソッドはありません」
「Javaの様に正規表現で変換するには、kotlin.text.RegexExtensions.ktクラスにある拡張関数 toRegex()メソッドを用いて」

Kotlinの型を知る ~前編~ - Qiita https://qiita.com/AAkira/items/16ae2e9c0f6073e0e983
[t] 2018-12-31 15:17:30
Kotlin の文法になかなか慣れないな。

add の代わりに += が使えるのはちょっといいなと思った。

MutableList - Kotlin Programming Language https://kotlinlang.org/api/latest/jvm/stdlib/kotlin.collections/-mutable-list/index.html
[t] 2018-12-31 15:25:35
RT @m_bird:
ネットリテラシーとやら、インターネット長い人は付いてて当たり前みたいな雰囲気出してるけど、相当に難しい。Google検索結果も雑なまとめ記事ばかり、amazonの商品レビューもあてにならなくなってきてる世界で、「このにおいは怪しい」っての、どうやって伝えるねん、って60過ぎた母前にして頭抱える
[t] 2018-12-31 15:49:21
RT @oqarakun:
@m_bird 「ネットリテラシーのある人」を集めて、ネット上のデータを怪しいものと怪しくないものに分けさせて、それを教師データとして機械学習させるということをしなければならない(うまくいくかはしらん)
[t] 2018-12-31 15:49:47
lsof コマンド

Linuxでプロセスが何のポート使っているかを調べる - Qiita https://qiita.com/sonoshou/items/cc2b740147ba1b8da1f3
[t] 2018-12-31 16:05:47
【話題のキーワード】
1. アンナチュラル
2. みりあ
3. 中堂
4. 探偵ナイトスクープ
5. 神風
6. ヨドバシカメラ
7. 秋商
8. 帝京長岡
9. 大津
10. 尚志
https://search.yahoo.co.jp/realtime #buzzbot
[t] 2018-12-31 16:10:02
Spring Boot でポート番号を変更する。

application properties の場合

server.port=${port:8080}

application.yml の場合

server:
port: 9000
[t] 2018-12-31 16:25:12
コマンドラインからでもポート番号を指定できる。

"Some people like to use (for example) --port=9000 instead of --server.port=9000 to set configuration properties on the command line."

77. Properties and Configuration https://docs.spring.io/spring-boot/docs/current/reference/html/howto-properties-and-configuration.html
[t] 2018-12-31 16:25:12
2018年12年31日のnilogをすべて表示する

- NI-Lab.
- Mastodon (@nilab@mastodon-japan.net)
- Twitter (@nilab)
- Timelog (@nilab)
- はてなブックマーク (id:nilab)

Web Services by Yahoo! JAPAN