Árvore de páginas

A partir do release 12.1.27 do AppServer passou a ser disponibilizado também um servidor integrado responsável pelo REST da linguagem TL++.

Chamamos de Rest Server algumas funcionalidades implementadas no HttpServer especificamente para atender requisições HTTP no modelo REST utilizando a linguagem TL++.

Para o correto funcionamento do Rest Server é necessário proceder com algumas configurações, a seguir veremos como fazê-las.

É possível configurar o Rest Server de duas formas: 1.Pelo arquivo de configuração appserver.ini do servidor de aplicação Appserver. 2.Utilizando um JSON a partir de uma User Function.


Abaixo segue exemplo de configuração com todas as possibilidades.


Para saber detalhes de cada Sessão / Chave, basta clicar em cima de cada item no exemplo para acessar a documentação especializada.

...


[HTTPSERVER]
Enable=1
Log=0
Servers=HTTP_SSL_SERVER

[HTTP_SSL_SERVER]
HostName=localhost
Port=443
Charset=UTF-8
Locations=HTTP_ROOT
ContentTypes=ContentTypes
SslCertificate=SSL_certificate.crt
SslCertificateKey=SSL_certificate_key.pem
TlppData='{"Authorization":{"scheme":"basic","OnAuth":"userRestAuthorization"}}'
UserData='{"chave":"valor"}'


[HTTP_ROOT]
Path=/
RootPath=root/web
DefaultPage=index.html
AllowMethods=GET, HEAD, POST, PUT, DELETE, PATCH, OPTIONS
ThreadPool=THREAD_POOL

[THREAD_POOL]
Environment=ENV
UserExits=THREAD_POOL_UEX
MinThreads=1
MaxThreads=4
MinFreeThreads=1
GrowthFactor=1
InactiveTimeout=30000
AcceptTimeout=10000
Slaves=SLAVE_01,SLAVE_02

[THREAD_POOL_UEX]
OnStart=userRestEnvironment
OnStop=userRestStop
OnSelect=userRestGrader
OnError=userRestError

[SLAVE_01]
Environment=ENV
UserExits=THREAD_POOL_SLAVES_UEX
MinThreads=1
MaxThreads=2
MinFreeThreads=1
GrowthFactor=1
InactiveTimeout=30000
AcceptTimeout=10000

[SLAVE_02]
Environment=TLPPCORE
UserExits=THREAD_POOL_SLAVES_UEX
MinThreads=2
MaxThreads=4
MinFreeThreads=2
GrowthFactor=1
InactiveTimeout=30000
AcceptTimeout=10000

[THREAD_POOL_SLAVES_UEX]
OnStart=userRestEnvironmentSlave
OnStop=userRestStopSlave
OnSelect=restGraderSlave
OnError=userRestErrorSlave

[ContentTypes]
json = text/plain;charset=UTF-8
xml = text/xml;charset=UTF-8
htm = text/html;charset=UTF-8
html = text/html;charset=UTF-8
txt = text/plain;charset=UTF-8

...

  • Sem rótulos