- ダウンロード先
- http://rubyinstaller.org/downloads/
- rubyは2.0.0推奨。1.9.2だと動かなかった
- インストール方法
- この辺りが参考になりました
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
ASP.NETはweb.configに書かれているhandlerを呼び出すため、リクエストごと(not スレッド)にServiceのインスタンスを生成する | |
一方、AppHostは起動時に1インスタンス生成される | |
その結果、ServiceStackでは1プロセスあたり、AppHost一つ、Serviceが複数という構成になる。 | |
OrmLiteのConnectionはautoDisposeConnection=falseの場合は、AppHostが持つFactoryの中に持つことになる。 | |
AppHostが実質シングルトンなので、OrmLiteのConnectionはシングルトンになる→リクエスト間でレースコンディションを発生させる可能性がある | |
autoDisposeConnection=trueの場合はリクエストごとに接続を生成するために(内部でプーリングしてるだろうけど)、トランザクションでレースコンディションは発生させない |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
namespace ServiceStackDTOSample{ | |
[Api("アイテムをItemIDを元に取得")] | |
[Route("/items/{id}", "GET")] | |
public class GetItem : IReturn<Item> | |
{ | |
public string Id { get; set; } | |
} | |
[Api("アイテムを追加する")] | |
[Route("/items", "POST")] | |
public class AddItem : IReturn<Item> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/// <summary> | |
/// AndroidUIスレッドのチャタリングを防ぐための機構 | |
/// </summary> | |
public static class AntiUIChattering | |
{ | |
public static EventHandler<T> WrapHandlerWithArgs<T>(EventHandler<T> funcForUIEvent) | |
{ | |
return (sender, e)=>{ | |
if(!Monitor.TryEnter(funcForUIEvent)) | |
return; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Java.Lang.Objectを継承しなさい。C#で。 | |
そうすると、勝手にDisposeとかJavaのポインタとか実装してくれる。 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public static class ScriptExtensions | |
{ | |
static Regex rxNonAscii = new Regex (@"\P{IsBasicLatin}", RegexOptions.Compiled); | |
public static byte[] ToUTF8Bytes(this string text){ | |
return System.Text.Encoding.UTF8.GetBytes (text); | |
} | |
public static string EncodeNonAsciiForLua(this string script){ | |
return rxNonAscii.Replace (script, (m) => | |
string.Join ("", m.Value.ToUTF8Bytes().Select ((it) => @"\" + it.ToString ().Trim ())) | |
); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
まずはJenkinsの設定でmsbuildのパスとしてxbuildのパスを教える | |
NuGetを動かすためにはMicrosoft.Build.dllが必要なのでダウンロードしてNuGet.exeに置く | |
http://headsigned.com/article/running-nuget-command-line-on-linux | |
(libmono-microsoft-build*ではダメだったので、多分バージョン違いかDLL違いかと。。。) | |
環境変数EnableNuGetPackageRestoreをtrueに設定する | |
mozroots --import --ask-remove を実行し、mozillaの証明書をmonoにインストール |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
AuthPluginは/authがContinueパラメータを受け取り、認証後はContinueパラメータで指定されたURLにリダイレクトする設計になっています | |
そして、Continueはホストも含めたフルURLを指定するため、オープンリダイレクタになってしまう危険性があります | |
対処法としては | |
AuthServiceクラスはstaticプロパティとしてValidateFnを持っており、これにdelegateをセットすると認証前にValidateFnにセットしたdelegateが呼び出されるようになります | |
なので、ValidateFnに入れるdelegateでContinueをチェックするようにし、ホワイトリストに無いhostを指定されたらリダイレクトせずに400/404を投げれば良い |