Documenti di Didattica
Documenti di Professioni
Documenti di Cultura
Swagger
• Free and open source framework
Introducing Swagger
• Specification donated to Open API Initiative (OAI) per 1-
1-2016
Introducing Swagger
Swagger
Swagger Core
Editor
{specification
}
json, yaml
Swagger
Swagger UI
Codegen
Introducing Swagger
Swagger UI Webserver
HTML
{specification CSS
}
JS
json, yaml
/api-docs
Swagger UI
{specification 1.2} {specification 2.0}
json json, yaml
Resource
swagger.json
listing
API
declaration
API
declaration
Specification
Demo
Specification
Backend Frontend
{specification api-docs
}
Interpretation
Validation
webservices
API
CRUD
Database
Specification webservices
api_doc
No webservice Webservice
Resource Webservice
listing {specification
doc
}
servoy-service/rest_ws/<module name>/api_doc/<apiKey>/<webservice>
Document generation
onSolutionOpe For each
defined
n webserv
ice
api_webservi ws_create
ce ws_read
(base form) ws_update
ws_delete
{specification
} “contact” webservice
contact
(cloned
form)
“country” webservice country
(cloned
form)
Webservice generation
API docs
/servoy-service/rest_ws/<module name>/api_doc/<apiKey>/<webservice>
/api-doc/<apiKey>/<webservice>
API
/servoy-service/rest_ws/<module name>/<form name>/apiKey
/api/<apiKey>/<webservice>
URL Rewrite
• Tuckey’s UrlRewriteFilter
<filter>
<filter-name>UrlRewriteFilter</filter-name>
<filter-class>org.tuckey.web.filters.urlrewrite.UrlRewriteFilter</filter-class>
</filter>
<filter-mapping>
<filter-name>UrlRewriteFilter</filter-name>
<url-pattern>/*</url-pattern>
<dispatcher>REQUEST</dispatcher>
<dispatcher>FORWARD</dispatcher>
</filter-mapping>
URL Rewrite
• Add rules to \server\webapps\ROOT\WEB-INF\rewrite.xml
<rule match-type="wildcard">
<from>/api/**</from>
<to>/servoy-service/rest_ws/mSTB_api/$1</to>
</rule>
<rule match-type="wildcard">
<from>/api-doc/**</from>
<to>/servoy-service/rest_ws/mSTB_api/api_doc/$1</to>
</rule>
• Velocity:
<rule match-type="wildcard">
<from>/api-doc/**</from>
<to>/servoy-service/velocity/mSTB_api/api_doc/$1</to>
</rule>
<rule match-type="wildcard">
<from>/api/**</from>
<to>/servoy-service/velocity/mSTB_api/api_webservice/$1</to>
</rule>
URL Rewrite
Questions
• Swagger
http://swagger.io/
• Tuckey’s UrlRewriteFilter
http://tuckey.org/urlrewrite/
Resources