-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[jenkins] automatic docbook update [2.0.1]
- Loading branch information
Showing
26 changed files
with
6,310 additions
and
84 deletions.
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,138 @@ | ||
<html><head> | ||
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1"> | ||
<title>Chapter 5. Configurations</title><link rel="stylesheet" type="text/css" href="/tyrus-project.github.io/documentation.css"><meta name="generator" content="DocBook XSL Stylesheets V1.78.1"><link rel="home" href="index.html" title="Tyrus 2.0.1 User Guide"><link rel="up" href="index.html" title="Tyrus 2.0.1 User Guide"><link rel="prev" href="websocket-api.html" title="Chapter 4. WebSocket API Endpoints, Sessions and MessageHandlers"><link rel="next" href="lifecycle.html" title="Chapter 6. Endpoint Lifecycle, Sessions, Sending Messages"></head><body class="contents"><div class="contents" bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF"><div class="navheader"><table width="100%" summary="Navigation header"><tr><th colspan="3" align="center">Chapter 5. Configurations</th></tr><tr><td width="20%" align="left"><a accesskey="p" href="websocket-api.html">Prev</a> </td><th width="60%" align="center"> </th><td width="20%" align="right"> <a accesskey="n" href="lifecycle.html">Next</a></td></tr></table><hr></div><div lang="en" class="chapter"><div class="titlepage"><div><div><h1 class="title"><a name="configurations"></a>Chapter 5. Configurations</h1></div></div></div><div class="toc"><p><b>Table of Contents</b></p><dl class="toc"><dt><span class="section"><a href="configurations.html#d0e786">5.1. <code class="code">jakarta.websocket.server.ServerEndpointConfig</code></a></span></dt><dt><span class="section"><a href="configurations.html#d0e839">5.2. <code class="code">jakarta.websocket.ClientEndpointConfig</code></a></span></dt></dl></div><p> | ||
<code class="code">jakarta.websocket.server.ServerEndpointConfig</code> and <code class="code">jakarta.websocket.ClientEndpointConfig</code> objects | ||
are used to provide the user the ability to configure websocket endpoints. Both server and client endpoints have some | ||
part of configuration in common, namely encoders, decoders, and user properties. The user properties may developers | ||
use to store the application specific data. For the developer's convenience the builders are provided for both | ||
ServerEndpointConfig and ClientEndpointConfig. | ||
</p><div class="section"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a name="d0e786"></a>5.1. <code class="code">jakarta.websocket.server.ServerEndpointConfig</code></h2></div></div></div><p> | ||
The <code class="code">jakarta.websocket.server.ServerEndpointConfig</code> is used when deploying the endpoint either via | ||
implementing the <code class="code">jakarta.websocket.server.ServerApplicationConfig</code>, or via registering the programmatic endpoint | ||
at the <code class="code">jakarta.websocket.server.ServerContainer</code> instance. It allows the user to create the configuration | ||
programmatically. | ||
</p><p> | ||
The following example is used to deploy the EchoEndpoint programmatically. In the method | ||
<code class="code">getEndpointClass()</code> the user has to specify the class of the deployed endpoint. In | ||
the example Tyrus will create an instance of <code class="code">EchoEndpoint</code> and deploy it. | ||
This is the way how to tie together endpoint and it's configuration. In the method | ||
<code class="code">getPath()</code> the user specifies that that the endpoint instance will be deployed at the | ||
path "/echo". In the method <code class="code">public List<String> getSubprotocols()</code> the user | ||
specifies that the supported subprotocols are "echo1" and "echo2". The method <code class="code">getExtensions()</code> | ||
defines the extensions the endpoint supports. Similarly the example configuration does not use any configurator. | ||
Method <code class="code">public List<Class<? extends Encoder>> getEncoders()</code> defines the encoders | ||
used by the endpoint. The decoders and user properties map are defined in similar fashion. | ||
</p><p> | ||
If the endpoint class which is about to be deployed is an annotated endpoint, note that the endpoint configuration | ||
will be taken from configuration object, not from the annotation on the endpoint class. | ||
</p><div class="example"><a name="d0e823"></a><p class="title"><b>Example 5.1. Configuration for EchoEndpoint Deployment</b></p><div class="example-contents"><pre class="
 toolbar: false;
 brush: java;
 ">public class EchoEndpointConfig implements ServerEndpointConfig{ | ||
|
||
private final Map<String, Object> userProperties = new HashMap<String, Object>(); | ||
|
||
@Override | ||
public Class<?> getEndpointClass() { | ||
return EchoEndpoint.class; | ||
} | ||
|
||
@Override | ||
public String getPath() { | ||
return "/echo"; | ||
} | ||
|
||
@Override | ||
public List<String> getSubprotocols() { | ||
return Arrays.asList("echo1","echo2"); | ||
} | ||
|
||
@Override | ||
public List<Extension> getExtensions() { | ||
return null; | ||
} | ||
|
||
@Override | ||
public Configurator getConfigurator() { | ||
return null; | ||
} | ||
|
||
@Override | ||
public List<Class<? extends Encoder>> getEncoders() { | ||
return Arrays.asList(SampleEncoder.class); | ||
} | ||
|
||
@Override | ||
public List<Class<? extends Decoder>> getDecoders() { | ||
return Arrays.asList(SampleDecoder.class); | ||
} | ||
|
||
@Override | ||
public Map<String, Object> getUserProperties() { | ||
return userProperties; | ||
} | ||
}</pre></div></div><br class="example-break"><p> | ||
To make the development easy the <span class="emphasis"><em>jakarta.websocket.server.ServerEndpointConfig</em></span> provides a builder to construct | ||
the configuration object: | ||
</p><div class="example"><a name="d0e833"></a><p class="title"><b>Example 5.2. ServerEndpointConfigu built using Builder</b></p><div class="example-contents"><pre class="
 toolbar: false;
 brush: java;
 ">ServerEndpointConfig config = ServerEndpointConfig.Builder.create(EchoEndpoint.class,"/echo"). | ||
decoders(Arrays.<Class<? extends Decoder>>asList(JsonDecoder.class)). | ||
encoders(Arrays.<Class< extends Encoder>>asList(JsonEncoder.class)).build();</pre></div></div><p><br class="example-break"> | ||
</p></div><div class="section"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a name="d0e839"></a>5.2. <code class="code">jakarta.websocket.ClientEndpointConfig</code></h2></div></div></div><p> | ||
The <code class="code">jakarta.websocket.ClientEndpointConfig</code> is used when deploying the programmatic client endpoint | ||
via registering the programmatic endpoint at the <code class="code">WebSocketContainer</code> instance. Some of | ||
the configuration methods come from the <code class="code">EndpointConfig</code>class, which is extended by both | ||
<code class="code">jakarta.websocket.server.ServerEndpointConfig</code> and <code class="code">jakarta.websocket.ClientEndpointConfig</code>. Then there are methods | ||
for configuring the preferred subprotocols the client endpoint wants to use and supported extensions. It is | ||
also possible to use the ClientEndpointConfig.Configurator in order to be able to affect the endpoint behaviour | ||
before and after request. | ||
</p><p> | ||
Similarly to the ServerEndpointConfig, there is a Builder provided to construct the configuration easily: | ||
</p><div class="example"><a name="d0e862"></a><p class="title"><b>Example 5.3. ClientEndpointConfig built using Builder</b></p><div class="example-contents"><pre class="
 toolbar: false;
 brush: java;
 ">ClientEndpointConfig.Builder.create(). | ||
decoders(Arrays.<Class<? extends Decoder>>asList(JsonDecoder.class)). | ||
encoders(Arrays.<Class<? extends Encoder>>asList(JsonEncoder.class)). | ||
preferredSubprotocols(Arrays.asList("echo1", "echo2")).build();</pre></div></div><br class="example-break"></div></div><link href="http://tyrus.java.net/sh/shCore.css" rel="stylesheet" type="text/css"><link href="http://tyrus.java.net/sh/shThemeDefault.css" rel="stylesheet" type="text/css"><script src="http://tyrus.java.net/sh/shCore.js" type="text/javascript"></script><script src="http://tyrus.java.net/sh/shAutoloader.js" type="text/javascript"></script><script type="text/javascript"> | ||
function path() { | ||
var args = arguments, | ||
result = [] | ||
; | ||
|
||
for(var i = 0; i < args.length; i++) | ||
result.push(args[i].replace('@', 'http://tyrus.java.net/sh/')); | ||
|
||
return result | ||
}; | ||
|
||
SyntaxHighlighter.autoloader.apply(null, path( | ||
'applescript @shBrushAppleScript.js', | ||
'actionscript3 as3 @shBrushAS3.js', | ||
'bash shell @shBrushBash.js', | ||
'coldfusion cf @shBrushColdFusion.js', | ||
'cpp c @shBrushCpp.js', | ||
'c# c-sharp csharp @shBrushCSharp.js', | ||
'css @shBrushCss.js', | ||
'delphi pascal @shBrushDelphi.js', | ||
'diff patch pas @shBrushDiff.js', | ||
'erl erlang @shBrushErlang.js', | ||
'groovy @shBrushGroovy.js', | ||
'java @shBrushJava.js', | ||
'jfx javafx @shBrushJavaFX.js', | ||
'js jscript javascript @shBrushJScript.js', | ||
'perl pl @shBrushPerl.js', | ||
'php @shBrushPhp.js', | ||
'text plain @shBrushPlain.js', | ||
'py python @shBrushPython.js', | ||
'ruby rails ror rb @shBrushRuby.js', | ||
'sass scss @shBrushSass.js', | ||
'scala @shBrushScala.js', | ||
'sql @shBrushSql.js', | ||
'vb vbnet @shBrushVb.js', | ||
'xml xhtml xslt html @shBrushXml.js' | ||
)); | ||
|
||
SyntaxHighlighter.all(); | ||
</script><script> | ||
(function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){ | ||
(i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o), | ||
m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m) | ||
})(window,document,'script','//www.google-analytics.com/analytics.js','ga'); | ||
|
||
ga('create', 'UA-41373632-1', 'java.net'); | ||
ga('send', 'pageview'); | ||
</script><div class="navfooter"><hr><table width="100%" summary="Navigation footer"><tr><td width="40%" align="left"><a accesskey="p" href="websocket-api.html">Prev</a> </td><td width="20%" align="center"> </td><td width="40%" align="right"> <a accesskey="n" href="lifecycle.html">Next</a></td></tr><tr><td width="40%" align="left" valign="top">Chapter 4. WebSocket API Endpoints, Sessions and MessageHandlers </td><td width="20%" align="center"><a accesskey="h" href="index.html">Home</a></td><td width="40%" align="right" valign="top"> Chapter 6. Endpoint Lifecycle, Sessions, Sending Messages</td></tr></table></div></div></body></html> |
Oops, something went wrong.