Skip to content

Commit

Permalink
Deploy website
Browse files Browse the repository at this point in the history
Deploy website version based on f3aaaa5
  • Loading branch information
Docusaurus bot committed May 31, 2024
1 parent 072bfa7 commit e4bdd52
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 10 deletions.
6 changes: 3 additions & 3 deletions docs/airframe-http.html
Original file line number Diff line number Diff line change
Expand Up @@ -190,14 +190,14 @@ <h2><a class="anchor" aria-hidden="true" id="customizing-netty"></a><a href="#cu
<span class="hljs-comment">// Add a custom log entry</span>
m += <span class="hljs-string">"application_version"</span> -&gt; <span class="hljs-string">"1.0"</span>
<span class="hljs-comment">// Add a thread-local parameter to the log</span>
<span class="hljs-type">RPCContext</span>.current.getThreadLocal[<span class="hljs-type">String</span>](<span class="hljs-string">"user_id"</span>).map { uid =&gt;
<span class="hljs-type">RPCContext</span>.current.getThreadLocal(<span class="hljs-string">"user_id"</span>).map { uid =&gt;
m += <span class="hljs-string">"user_id"</span> -&gt; uid
}
m.result
}
<span class="hljs-comment">// [optional] Disable server-side logging (log/http_server.json)</span>
.noLogging
<span class="hljs-comment">// Add a custom MessageCodec mapping</span>
<span class="hljs-comment">// [optional] Add a custom MessageCodec mapping</span>
.withCustomCodec{ <span class="hljs-keyword">case</span> s: <span class="hljs-type">Surface</span>.of[<span class="hljs-type">MyClass</span>] =&gt; ... }

server.start { server =&gt;
Expand Down Expand Up @@ -372,7 +372,7 @@ <h3><a class="anchor" aria-hidden="true" id="thread-local-storage"></a><a href="
<span class="hljs-function"><span class="hljs-keyword">def</span> <span class="hljs-title">apply</span></span>(request: <span class="hljs-type">Request</span>, next: <span class="hljs-type">RxHttpEndpoint</span>): <span class="hljs-type">Rx</span>[<span class="hljs-type">Response</span>] = {
next(request).map { response =&gt;
<span class="hljs-comment">// Read the thread-local parameter set in the context(request)</span>
<span class="hljs-type">RPCContext</span>.current.getThreadLocal[<span class="hljs-type">String</span>](<span class="hljs-string">"user_id"</span>).map { uid =&gt;
<span class="hljs-type">RPCContext</span>.current.getThreadLocal(<span class="hljs-string">"user_id"</span>).map { uid =&gt;
info(<span class="hljs-string">s"user_id: <span class="hljs-subst">${uid}</span>"</span>)
}
response
Expand Down
6 changes: 3 additions & 3 deletions docs/airframe-http/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -190,14 +190,14 @@ <h2><a class="anchor" aria-hidden="true" id="customizing-netty"></a><a href="#cu
<span class="hljs-comment">// Add a custom log entry</span>
m += <span class="hljs-string">"application_version"</span> -&gt; <span class="hljs-string">"1.0"</span>
<span class="hljs-comment">// Add a thread-local parameter to the log</span>
<span class="hljs-type">RPCContext</span>.current.getThreadLocal[<span class="hljs-type">String</span>](<span class="hljs-string">"user_id"</span>).map { uid =&gt;
<span class="hljs-type">RPCContext</span>.current.getThreadLocal(<span class="hljs-string">"user_id"</span>).map { uid =&gt;
m += <span class="hljs-string">"user_id"</span> -&gt; uid
}
m.result
}
<span class="hljs-comment">// [optional] Disable server-side logging (log/http_server.json)</span>
.noLogging
<span class="hljs-comment">// Add a custom MessageCodec mapping</span>
<span class="hljs-comment">// [optional] Add a custom MessageCodec mapping</span>
.withCustomCodec{ <span class="hljs-keyword">case</span> s: <span class="hljs-type">Surface</span>.of[<span class="hljs-type">MyClass</span>] =&gt; ... }

server.start { server =&gt;
Expand Down Expand Up @@ -372,7 +372,7 @@ <h3><a class="anchor" aria-hidden="true" id="thread-local-storage"></a><a href="
<span class="hljs-function"><span class="hljs-keyword">def</span> <span class="hljs-title">apply</span></span>(request: <span class="hljs-type">Request</span>, next: <span class="hljs-type">RxHttpEndpoint</span>): <span class="hljs-type">Rx</span>[<span class="hljs-type">Response</span>] = {
next(request).map { response =&gt;
<span class="hljs-comment">// Read the thread-local parameter set in the context(request)</span>
<span class="hljs-type">RPCContext</span>.current.getThreadLocal[<span class="hljs-type">String</span>](<span class="hljs-string">"user_id"</span>).map { uid =&gt;
<span class="hljs-type">RPCContext</span>.current.getThreadLocal(<span class="hljs-string">"user_id"</span>).map { uid =&gt;
info(<span class="hljs-string">s"user_id: <span class="hljs-subst">${uid}</span>"</span>)
}
response
Expand Down
4 changes: 2 additions & 2 deletions docs/airframe-rpc.html
Original file line number Diff line number Diff line change
Expand Up @@ -423,14 +423,14 @@ <h3><a class="anchor" aria-hidden="true" id="object-serialization"></a><a href="
the target type, for example, if the input data is &quot;100&quot;, but the target type is Int, the input
String &quot;100&quot; will be translated into an Int value <code>100</code> automatically.</p>
<h3><a class="anchor" aria-hidden="true" id="rpccontext"></a><a href="#rpccontext" aria-hidden="true" class="hash-link"><svg class="hash-link-icon" aria-hidden="true" height="16" version="1.1" viewBox="0 0 16 16" width="16"><path fill-rule="evenodd" d="M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z"></path></svg></a>RPCContext</h3>
<p>Since Airframe 22.8.0, airframe-rpc introduced <code>RPCContext</code> for reading and writing the thread-local storage, and referencing the original HTTP request:</p>
<p>Since Airframe 22.8.0, airframe-rpc introduced <code>RPCContext.current</code> for reading and writing the thread-local storage, and referencing the original HTTP request:</p>
<pre><code class="hljs css language-scala"><span class="hljs-keyword">import</span> wvlet.airframe.http._

<span class="hljs-meta">@RPC</span>
<span class="hljs-class"><span class="hljs-keyword">trait</span> <span class="hljs-title">MyAPI</span> </span>{
<span class="hljs-function"><span class="hljs-keyword">def</span> <span class="hljs-title">hello</span></span>: <span class="hljs-type">String</span> = {
<span class="hljs-comment">// Read the thread-local storage</span>
<span class="hljs-keyword">val</span> userName = <span class="hljs-type">RPCContext</span>.current.getThreadLocal[<span class="hljs-type">String</span>](<span class="hljs-string">"context_user"</span>)
<span class="hljs-keyword">val</span> userName = <span class="hljs-type">RPCContext</span>.current.getThreadLocal(<span class="hljs-string">"context_user"</span>)
<span class="hljs-string">s"Hello <span class="hljs-subst">${userName}</span>"</span>
}

Expand Down
4 changes: 2 additions & 2 deletions docs/airframe-rpc/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -423,14 +423,14 @@ <h3><a class="anchor" aria-hidden="true" id="object-serialization"></a><a href="
the target type, for example, if the input data is &quot;100&quot;, but the target type is Int, the input
String &quot;100&quot; will be translated into an Int value <code>100</code> automatically.</p>
<h3><a class="anchor" aria-hidden="true" id="rpccontext"></a><a href="#rpccontext" aria-hidden="true" class="hash-link"><svg class="hash-link-icon" aria-hidden="true" height="16" version="1.1" viewBox="0 0 16 16" width="16"><path fill-rule="evenodd" d="M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z"></path></svg></a>RPCContext</h3>
<p>Since Airframe 22.8.0, airframe-rpc introduced <code>RPCContext</code> for reading and writing the thread-local storage, and referencing the original HTTP request:</p>
<p>Since Airframe 22.8.0, airframe-rpc introduced <code>RPCContext.current</code> for reading and writing the thread-local storage, and referencing the original HTTP request:</p>
<pre><code class="hljs css language-scala"><span class="hljs-keyword">import</span> wvlet.airframe.http._

<span class="hljs-meta">@RPC</span>
<span class="hljs-class"><span class="hljs-keyword">trait</span> <span class="hljs-title">MyAPI</span> </span>{
<span class="hljs-function"><span class="hljs-keyword">def</span> <span class="hljs-title">hello</span></span>: <span class="hljs-type">String</span> = {
<span class="hljs-comment">// Read the thread-local storage</span>
<span class="hljs-keyword">val</span> userName = <span class="hljs-type">RPCContext</span>.current.getThreadLocal[<span class="hljs-type">String</span>](<span class="hljs-string">"context_user"</span>)
<span class="hljs-keyword">val</span> userName = <span class="hljs-type">RPCContext</span>.current.getThreadLocal(<span class="hljs-string">"context_user"</span>)
<span class="hljs-string">s"Hello <span class="hljs-subst">${userName}</span>"</span>
}

Expand Down

0 comments on commit e4bdd52

Please sign in to comment.