Árvore de páginas

Versões comparadas

Chave

  • Esta linha foi adicionada.
  • Esta linha foi removida.
  • A formatação mudou.

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++TLPP.

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

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

É possível configurar o Rest 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.

...


[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
UserExits=THREAD_POOL_UEX

[THREAD_POOL_UEX]
OnBlock=userRestBlockURNs
OnStart=userRestEnvironment
OnStop=userRestStop
OnSelect=userRestGrader
OnError=userRestError
OnSend=userRestSendBeforeMessages

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


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


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

[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

...