mirror of
https://github.com/valitydev/openapi-generator.git
synced 2024-11-07 10:58:55 +00:00
rebuilt
This commit is contained in:
parent
5e69d929a0
commit
539496d735
@ -33,57 +33,16 @@ class {{classname}} (implicit val swagger: Swagger) extends ScalatraServlet
|
||||
|
||||
val {{nickname}}Operation = (apiOperation[{{#returnType}}{{{returnType}}}{{/returnType}}{{^returnType}}Unit{{/returnType}}]("{{nickname}}")
|
||||
summary "{{{summary}}}"
|
||||
parameters(
|
||||
{{#allParams}}{{#isQueryParam}}queryParam[{{dataType}}]("{{paramName}}").description(""){{^required}}.optional{{/required}}{{#defaultValue}}.defaultValue({{{defaultValue}}}){{/defaultValue}}
|
||||
{{/isQueryParam}}
|
||||
{{#isPathParam}}pathParam[{{dataType}}]("{{paramName}}").description(""){{#defaultValue}}.defaultValue({{{defaultValue}}}){{/defaultValue}}
|
||||
{{/isPathParam}}
|
||||
{{#isHeaderParam}}headerParam[{{dataType}}]("{{paramName}}").description(""){{^required}}.optional{{/required}}{{#defaultValue}}.defaultValue({{{defaultValue}}}){{/defaultValue}}
|
||||
{{/isHeaderParam}}
|
||||
{{#isBodyParam}}bodyParam[{{dataType}}]("{{paramName}}").description(""){{^required}}.optional{{/required}}{{#defaultValue}}.defaultValue({{{defaultValue}}}){{/defaultValue}}
|
||||
{{/isBodyParam}}
|
||||
{{#isFormParam}}formParam[{{dataType}}]("{{paramName}}").description(""){{^required}}.optional{{/required}}{{#defaultValue}}.defaultValue({{{defaultValue}}}){{/defaultValue}}
|
||||
{{/isFormParam}}
|
||||
{{#hasMore}},{{/hasMore}}
|
||||
{{/allParams}})
|
||||
parameters({{#allParams}}{{>queryParam}}{{>pathParam}}{{>bodyParam}}{{>formParam}}{{#hasMore}},
|
||||
{{/hasMore}}{{/allParams}})
|
||||
)
|
||||
|
||||
{{httpMethod}}("{{path}}",operation({{nickname}}Operation)) {
|
||||
{{#allParams}}
|
||||
{{#isFile}}
|
||||
val {{paramName}} = fileParams("{{paramName}}")
|
||||
{{/isFile}}
|
||||
{{^isFile}}
|
||||
{{#isPathParam}}
|
||||
val {{paramName}} = params.getOrElse("{{paramName}}", halt(400))
|
||||
{{/isPathParam}}
|
||||
|
||||
{{#isQueryParam}}
|
||||
{{#collectionFormat}}val {{paramName}}String = params.getAs[String]("{{paramName}}")
|
||||
val {{paramName}} = if("{{collectionFormat}}".equals("default")) {
|
||||
{{paramName}}String match {
|
||||
case Some(str) => str.split(",")
|
||||
case None => List()
|
||||
}
|
||||
}
|
||||
else
|
||||
List()
|
||||
{{/collectionFormat}}
|
||||
{{^collectionFormat}}val {{paramName}} = params.getAs[{{dataType}}]("{{paramName}}"){{/collectionFormat}}
|
||||
|
||||
{{/isQueryParam}}
|
||||
|
||||
{{#isHeaderParam}}
|
||||
val {{paramName}} = request.getHeader("{{paramName}}")
|
||||
{{/isHeaderParam}}
|
||||
|
||||
{{#isFormParam}}
|
||||
val {{paramName}} = params.getAs[{{dataType}}]("{{paramName}}")
|
||||
{{/isFormParam}}
|
||||
|
||||
{{#isBodyParam}}
|
||||
val {{paramName}} = parsedBody.extract[{{dataType}}]
|
||||
{{/isBodyParam}}
|
||||
{{#isFile}}val {{paramName}} = fileParams("{{paramName}}"){{/isFile}}
|
||||
{{^isFile}}{{#isPathParam}}
|
||||
val {{paramName}} = params.getOrElse("{{paramName}}", halt(400)){{/isPathParam}}
|
||||
{{>queryParamOperation}}{{>headerParamOperation}}{{>formParamMustache}}{{>bodyParam}}
|
||||
{{/isFile}}
|
||||
println("{{paramName}}: " + {{paramName}})
|
||||
{{/allParams}}
|
||||
|
@ -0,0 +1 @@
|
||||
{{#isBodyParam}}bodyParam[{{dataType}}]("{{paramName}}").description(""){{^required}}.optional{{/required}}{{#defaultValue}}.defaultValue({{{defaultValue}}}){{/defaultValue}}{{/isBodyParam}}
|
@ -0,0 +1,3 @@
|
||||
{{#isBodyParam}}
|
||||
val {{paramName}} = parsedBody.extract[{{dataType}}]
|
||||
{{/isBodyParam}}
|
@ -0,0 +1 @@
|
||||
{{#isFormParam}}formParam[{{dataType}}]("{{paramName}}").description(""){{^required}}.optional{{/required}}{{#defaultValue}}.defaultValue({{{defaultValue}}}){{/defaultValue}}{{/isFormParam}}
|
@ -0,0 +1,3 @@
|
||||
{{#isFormParam}}
|
||||
val {{paramName}} = params.getAs[{{dataType}}]("{{paramName}}")
|
||||
{{/isFormParam}}
|
@ -0,0 +1 @@
|
||||
{{#isHeaderParam}}headerParam[{{dataType}}]("{{paramName}}").description(""){{^required}}.optional{{/required}}{{#defaultValue}}.defaultValue({{{defaultValue}}}){{/defaultValue}}{{/isHeaderParam}}
|
@ -0,0 +1,3 @@
|
||||
{{#isHeaderParam}}
|
||||
val {{paramName}} = request.getHeader("{{paramName}}")
|
||||
{{/isHeaderParam}}
|
@ -0,0 +1 @@
|
||||
{{#isPathParam}}pathParam[{{dataType}}]("{{paramName}}").description(""){{#defaultValue}}.defaultValue({{{defaultValue}}}){{/defaultValue}}{{/isPathParam}}
|
@ -0,0 +1 @@
|
||||
{{#isQueryParam}}queryParam[{{dataType}}]("{{paramName}}").description(""){{^required}}.optional{{/required}}{{#defaultValue}}.defaultValue({{{defaultValue}}}){{/defaultValue}}{{/isQueryParam}}
|
@ -0,0 +1,13 @@
|
||||
{{#isQueryParam}}
|
||||
{{#collectionFormat}}val {{paramName}}String = params.getAs[String]("{{paramName}}")
|
||||
val {{paramName}} = if("{{collectionFormat}}".equals("default")) {
|
||||
{{paramName}}String match {
|
||||
case Some(str) => str.split(",")
|
||||
case None => List()
|
||||
}
|
||||
}
|
||||
else
|
||||
List()
|
||||
{{/collectionFormat}}
|
||||
{{^collectionFormat}}val {{paramName}} = params.getAs[{{dataType}}]("{{paramName}}"){{/collectionFormat}}
|
||||
{{/isQueryParam}}
|
@ -1,10 +1,10 @@
|
||||
# Swagger generated server
|
||||
|
||||
## Overview
|
||||
This server was generated by the [swagger-codegen](https://github.com/wordnik/swagger-codegen) project. By using the
|
||||
[swagger-spec](https://github.com/wordnik/swagger-core/wiki) from a remote server, you can easily generate a server stub. This
|
||||
This server was generated by the [swagger-codegen](https://github.com/swagger-api/swagger-codegen) project. By using the
|
||||
[swagger-spec](https://github.com/swagger-api/swagger-core/wiki) from a remote server, you can easily generate a server stub. This
|
||||
is an example of building a swagger-enabled scalatra server.
|
||||
|
||||
This example uses the [scalatra](http://scalatra.org/) framework. To see how to make this your own, look here:
|
||||
|
||||
[README](https://github.com/wordnik/swagger-codegen/tree/master/samples/server-generator/scalatra)
|
||||
[README](https://github.com/swagger-api/swagger-codegen/tree/master/samples/server-generator/scalatra)
|
@ -1,6 +1,4 @@
|
||||
|
||||
|
||||
// put this at the top of the file
|
||||
import AssemblyKeys._ // put this at the top of the file
|
||||
|
||||
import NativePackagerKeys._
|
||||
|
||||
@ -10,9 +8,9 @@ assemblySettings
|
||||
|
||||
scalariformSettings
|
||||
|
||||
organization := "com.wordnik"
|
||||
organization := "io.swagger"
|
||||
|
||||
seq(webSettings: _*)
|
||||
seq(webSettings :_*)
|
||||
|
||||
mainClass in assembly := Some("JettyMain")
|
||||
|
||||
@ -25,40 +23,40 @@ scalaVersion := "2.11.2"
|
||||
scalacOptions += "-language:postfixOps"
|
||||
|
||||
libraryDependencies ++= Seq(
|
||||
"org.scalatest" %% "scalatest" % "2.2.1" % "test",
|
||||
"org.scalatra" %% "scalatra" % "2.3.0.RC3",
|
||||
"org.scalatra" %% "scalatra-scalate" % "2.3.0.RC3",
|
||||
"org.scalatra" %% "scalatra-json" % "2.3.0.RC3",
|
||||
"org.scalatra" %% "scalatra-swagger" % "2.3.0.RC3",
|
||||
"org.scalatra" %% "scalatra-swagger-ext" % "2.3.0.RC3",
|
||||
"org.scalatra" %% "scalatra-slf4j" % "2.3.0.RC3",
|
||||
"org.json4s" %% "json4s-jackson" % "3.2.10",
|
||||
"org.json4s" %% "json4s-ext" % "3.2.10",
|
||||
"commons-codec" % "commons-codec" % "1.7",
|
||||
"net.databinder.dispatch" %% "dispatch-core" % "0.11.2",
|
||||
"org.scalatest" %% "scalatest" % "2.2.1" % "test",
|
||||
"org.scalatra" %% "scalatra" % "2.3.0.RC3",
|
||||
"org.scalatra" %% "scalatra-scalate" % "2.3.0.RC3",
|
||||
"org.scalatra" %% "scalatra-json" % "2.3.0.RC3",
|
||||
"org.scalatra" %% "scalatra-swagger" % "2.3.0.RC3",
|
||||
"org.scalatra" %% "scalatra-swagger-ext" % "2.3.0.RC3",
|
||||
"org.scalatra" %% "scalatra-slf4j" % "2.3.0.RC3",
|
||||
"org.json4s" %% "json4s-jackson" % "3.2.10",
|
||||
"org.json4s" %% "json4s-ext" % "3.2.10",
|
||||
"commons-codec" % "commons-codec" % "1.7",
|
||||
"net.databinder.dispatch" %% "dispatch-core" % "0.11.2",
|
||||
//"net.databinder.dispatch" %% "json4s-jackson" % "0.11.2",
|
||||
"net.databinder.dispatch" %% "dispatch-json4s-jackson" % "0.11.2",
|
||||
"com.typesafe.akka" %% "akka-actor" % "2.3.6",
|
||||
"org.eclipse.jetty" % "jetty-server" % "9.2.3.v20140905" % "container;compile;test",
|
||||
"org.eclipse.jetty" % "jetty-webapp" % "9.2.3.v20140905" % "container;compile;test",
|
||||
"org.eclipse.jetty.orbit" % "javax.servlet" % "3.0.0.v201112011016" % "container;compile;provided;test" artifacts (Artifact("javax.servlet", "jar", "jar"))
|
||||
"net.databinder.dispatch" %% "dispatch-json4s-jackson" % "0.11.2",
|
||||
"com.typesafe.akka" %% "akka-actor" % "2.3.6",
|
||||
"org.eclipse.jetty" % "jetty-server" % "9.2.3.v20140905" % "container;compile;test",
|
||||
"org.eclipse.jetty" % "jetty-webapp" % "9.2.3.v20140905" % "container;compile;test",
|
||||
"org.eclipse.jetty.orbit" % "javax.servlet" % "3.0.0.v201112011016" % "container;compile;provided;test" artifacts (Artifact("javax.servlet", "jar", "jar"))
|
||||
)
|
||||
|
||||
resolvers += "Local Maven Repository" at "file://" + Path.userHome.absolutePath + "/.m2/repository"
|
||||
resolvers += "Local Maven Repository" at "file://"+Path.userHome.absolutePath+"/.m2/repository"
|
||||
|
||||
resolvers += "Sonatype OSS Snapshots" at "http://oss.sonatype.org/content/repositories/snapshots/"
|
||||
|
||||
resolvers += "Sonatype OSS Releases" at "http://oss.sonatype.org/content/repositories/releases/"
|
||||
|
||||
ivyXML := <dependencies>
|
||||
<exclude module="slf4j-log4j12"/>
|
||||
<exclude module="grizzled-slf4j_2.9.1"/>
|
||||
<exclude module="jsr311-api"/>
|
||||
</dependencies>
|
||||
<exclude module="slf4j-log4j12"/>
|
||||
<exclude module="grizzled-slf4j_2.9.1"/>
|
||||
<exclude module="jsr311-api" />
|
||||
</dependencies>
|
||||
|
||||
mergeStrategy in assembly <<= (mergeStrategy in assembly) {
|
||||
(old) => {
|
||||
case "about.html" => MergeStrategy.discard
|
||||
case "about.html" => MergeStrategy.discard
|
||||
case x => old(x)
|
||||
}
|
||||
}
|
||||
|
0
samples/server/petstore/scalatra/sbt
Normal file → Executable file
0
samples/server/petstore/scalatra/sbt
Normal file → Executable file
@ -1,7 +1,17 @@
|
||||
|
||||
import org.eclipse.jetty.server._
|
||||
import org.eclipse.jetty.webapp.WebAppContext
|
||||
import org.scalatra.servlet.ScalatraListener
|
||||
|
||||
object JettyMain {
|
||||
|
||||
object conf {
|
||||
val port = sys.env.get("PORT") map (_.toInt) getOrElse (8080)
|
||||
val stopTimeout = sys.env.get("STOP_TIMEOUT") map (_.toInt) getOrElse (5000)
|
||||
val connectorIdleTimeout = sys.env.get("CONNECTOR_IDLE_TIMEOUT") map (_.toInt) getOrElse (90000)
|
||||
val webapp = sys.env.get("PUBLIC") getOrElse "webapp"
|
||||
val contextPath = sys.env.get("CONTEXT_PATH") getOrElse "/"
|
||||
}
|
||||
|
||||
def main(args: Array[String]) = {
|
||||
val server: Server = new Server
|
||||
println("starting jetty")
|
||||
@ -30,12 +40,4 @@ object JettyMain {
|
||||
|
||||
server.start()
|
||||
}
|
||||
|
||||
object conf {
|
||||
val port = sys.env.get("PORT") map (_.toInt) getOrElse (8080)
|
||||
val stopTimeout = sys.env.get("STOP_TIMEOUT") map (_.toInt) getOrElse (5000)
|
||||
val connectorIdleTimeout = sys.env.get("CONNECTOR_IDLE_TIMEOUT") map (_.toInt) getOrElse (90000)
|
||||
val webapp = sys.env.get("PUBLIC") getOrElse "webapp"
|
||||
val contextPath = sys.env.get("CONTEXT_PATH") getOrElse "/"
|
||||
}
|
||||
}
|
||||
|
@ -1,4 +1,8 @@
|
||||
|
||||
import com.wordnik.client.api._
|
||||
import akka.actor.ActorSystem
|
||||
import io.swagger.app.{ResourcesApp, SwaggerApp}
|
||||
import javax.servlet.ServletContext
|
||||
import org.scalatra.LifeCycle
|
||||
|
||||
class ScalatraBootstrap extends LifeCycle {
|
||||
implicit val swagger = new SwaggerApp
|
||||
@ -6,11 +10,11 @@ class ScalatraBootstrap extends LifeCycle {
|
||||
override def init(context: ServletContext) {
|
||||
implicit val system = ActorSystem("appActorSystem")
|
||||
try {
|
||||
context mount(new UserApi, "/User/*")
|
||||
context mount(new PetApi, "/Pet/*")
|
||||
context mount(new StoreApi, "/Store/*")
|
||||
|
||||
context mount(new ResourcesApp, "/api-docs/*")
|
||||
context mount (new UserApi, "/User/*")
|
||||
context mount (new PetApi, "/Pet/*")
|
||||
context mount (new StoreApi, "/Store/*")
|
||||
|
||||
context mount (new ResourcesApp, "/api-docs/*")
|
||||
} catch {
|
||||
case e: Throwable => e.printStackTrace()
|
||||
}
|
||||
|
@ -1,4 +1,11 @@
|
||||
package com.wordnik.swagger.app
|
||||
package io.swagger.app
|
||||
|
||||
import _root_.akka.actor.ActorSystem
|
||||
|
||||
import org.scalatra.swagger.{ ApiInfo, SwaggerWithAuth, Swagger }
|
||||
import org.scalatra.swagger.{JacksonSwaggerBase, Swagger}
|
||||
import org.scalatra.ScalatraServlet
|
||||
import org.json4s.{DefaultFormats, Formats}
|
||||
|
||||
class ResourcesApp(implicit protected val system: ActorSystem, val swagger: SwaggerApp)
|
||||
extends ScalatraServlet with JacksonSwaggerBase {
|
||||
@ -6,17 +13,16 @@ class ResourcesApp(implicit protected val system: ActorSystem, val swagger: Swag
|
||||
response.headers += ("Access-Control-Allow-Origin" -> "*")
|
||||
}
|
||||
|
||||
protected def buildFullUrl(path: String) = if (path.startsWith("http")) path
|
||||
else {
|
||||
val port = request.getServerPort
|
||||
val h = request.getServerName
|
||||
val prot = if (port == 443) "https" else "http"
|
||||
val (proto, host) = if (port != 80 && port != 443) ("http", h + ":" + port.toString) else (prot, h)
|
||||
"%s://%s%s%s".format(
|
||||
proto,
|
||||
host,
|
||||
request.getContextPath,
|
||||
path)
|
||||
protected def buildFullUrl(path: String) = if (path.startsWith("http")) path else {
|
||||
val port = request.getServerPort
|
||||
val h = request.getServerName
|
||||
val prot = if (port == 443) "https" else "http"
|
||||
val (proto, host) = if (port != 80 && port != 443) ("http", h+":"+port.toString) else (prot, h)
|
||||
"%s://%s%s%s".format(
|
||||
proto,
|
||||
host,
|
||||
request.getContextPath,
|
||||
path)
|
||||
}
|
||||
}
|
||||
|
||||
@ -25,7 +31,7 @@ class SwaggerApp extends Swagger(apiInfo = ApiSwagger.apiInfo, apiVersion = "1.0
|
||||
object ApiSwagger {
|
||||
val apiInfo = ApiInfo(
|
||||
"""Swagger Petstore""",
|
||||
"""This is a sample server Petstore server. You can find out more about Swagger at [http://swagger.io](http://swagger.io) or on [irc.freenode.net, #swagger](http://webchat.freenode.net/?channels=swagger). For this sample, you can use the api key `special-key` to test the authorization filters""",
|
||||
"""This is a sample server Petstore server. You can find out more about Swagger at <a href=\"http://swagger.io\">http://swagger.io</a> or on irc.freenode.net, #swagger. For this sample, you can use the api key \"special-key\" to test the authorization filters""",
|
||||
"""""",
|
||||
"""apiteam@swagger.io""",
|
||||
"""Apache 2.0""",
|
||||
|
@ -1,7 +1,23 @@
|
||||
package com.wordnik.client.apiass PetApi(implicit val swagger: Swagger) extends ScalatraServlet
|
||||
with FileUploadSupport
|
||||
with JacksonJsonSupport
|
||||
with SwaggerSupport {
|
||||
package com.wordnik.client.api
|
||||
|
||||
import com.wordnik.client.model.Pet
|
||||
import java.io.File
|
||||
|
||||
import java.io.File
|
||||
|
||||
import org.scalatra.{ TypedParamSupport, ScalatraServlet }
|
||||
import org.scalatra.swagger._
|
||||
import org.json4s._
|
||||
import org.json4s.JsonDSL._
|
||||
import org.scalatra.json.{ JValueResult, JacksonJsonSupport }
|
||||
import org.scalatra.servlet.{FileUploadSupport, MultipartConfig, SizeConstraintExceededException}
|
||||
|
||||
import scala.collection.JavaConverters._
|
||||
|
||||
class PetApi (implicit val swagger: Swagger) extends ScalatraServlet
|
||||
with FileUploadSupport
|
||||
with JacksonJsonSupport
|
||||
with SwaggerSupport {
|
||||
protected implicit val jsonFormats: Formats = DefaultFormats
|
||||
|
||||
protected val applicationDescription: String = "PetApi"
|
||||
@ -11,268 +27,221 @@ with SwaggerSupport {
|
||||
contentType = formats("json")
|
||||
response.headers += ("Access-Control-Allow-Origin" -> "*")
|
||||
}
|
||||
|
||||
|
||||
|
||||
val updatePetOperation = (apiOperation[Unit]("updatePet")
|
||||
summary "Update an existing pet"
|
||||
parameters (
|
||||
|
||||
|
||||
bodyParam[Pet]("body").description("").optional
|
||||
|
||||
|
||||
)
|
||||
)
|
||||
|
||||
put("/pet", operation(updatePetOperation)) {
|
||||
|
||||
|
||||
val body = parsedBody.extract[Pet]
|
||||
|
||||
summary "Update an existing pet"
|
||||
parameters(bodyParam[Pet]("body").description("").optional)
|
||||
)
|
||||
|
||||
put("/pet",operation(updatePetOperation)) {
|
||||
|
||||
|
||||
|
||||
|
||||
bodyParam[Pet]("body").description("").optional
|
||||
|
||||
println("body: " + body)
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
val addPetOperation = (apiOperation[Unit]("addPet")
|
||||
summary "Add a new pet to the store"
|
||||
parameters (
|
||||
|
||||
|
||||
bodyParam[Pet]("body").description("").optional
|
||||
|
||||
|
||||
)
|
||||
)
|
||||
|
||||
post("/pet", operation(addPetOperation)) {
|
||||
|
||||
|
||||
val body = parsedBody.extract[Pet]
|
||||
|
||||
summary "Add a new pet to the store"
|
||||
parameters(bodyParam[Pet]("body").description("").optional)
|
||||
)
|
||||
|
||||
post("/pet",operation(addPetOperation)) {
|
||||
|
||||
|
||||
|
||||
|
||||
bodyParam[Pet]("body").description("").optional
|
||||
|
||||
println("body: " + body)
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
val findPetsByStatusOperation = (apiOperation[List[Pet]]("findPetsByStatus")
|
||||
summary "Finds Pets by status"
|
||||
parameters (
|
||||
queryParam[List[String]]("status").description("").optional
|
||||
summary "Finds Pets by status"
|
||||
parameters(queryParam[List[String]]("status").description("").optional.defaultValue(available))
|
||||
)
|
||||
|
||||
|
||||
)
|
||||
)
|
||||
|
||||
get("/pet/findByStatus", operation(findPetsByStatusOperation)) {
|
||||
|
||||
|
||||
val statusString = params.getAs[String]("status")
|
||||
val status = if ("multi".equals("default")) {
|
||||
statusString match {
|
||||
case Some(str) => str.split(",")
|
||||
case None => List()
|
||||
get("/pet/findByStatus",operation(findPetsByStatusOperation)) {
|
||||
|
||||
|
||||
|
||||
|
||||
val statusString = params.getAs[String]("status")
|
||||
val status = if("multi".equals("default")) {
|
||||
statusString match {
|
||||
case Some(str) => str.split(",")
|
||||
case None => List()
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
List()
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
else
|
||||
List()
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
println("status: " + status)
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
val findPetsByTagsOperation = (apiOperation[List[Pet]]("findPetsByTags")
|
||||
summary "Finds Pets by tags"
|
||||
parameters (
|
||||
queryParam[List[String]]("tags").description("").optional
|
||||
summary "Finds Pets by tags"
|
||||
parameters(queryParam[List[String]]("tags").description("").optional)
|
||||
)
|
||||
|
||||
|
||||
)
|
||||
)
|
||||
|
||||
get("/pet/findByTags", operation(findPetsByTagsOperation)) {
|
||||
|
||||
|
||||
val tagsString = params.getAs[String]("tags")
|
||||
val tags = if ("multi".equals("default")) {
|
||||
tagsString match {
|
||||
case Some(str) => str.split(",")
|
||||
case None => List()
|
||||
get("/pet/findByTags",operation(findPetsByTagsOperation)) {
|
||||
|
||||
|
||||
|
||||
|
||||
val tagsString = params.getAs[String]("tags")
|
||||
val tags = if("multi".equals("default")) {
|
||||
tagsString match {
|
||||
case Some(str) => str.split(",")
|
||||
case None => List()
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
List()
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
else
|
||||
List()
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
println("tags: " + tags)
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
val getPetByIdOperation = (apiOperation[Pet]("getPetById")
|
||||
summary "Find pet by ID"
|
||||
parameters (
|
||||
|
||||
pathParam[Long]("petId").description("")
|
||||
|
||||
|
||||
)
|
||||
)
|
||||
|
||||
get("/pet/{petId}", operation(getPetByIdOperation)) {
|
||||
|
||||
|
||||
val petId = params.getOrElse("petId", halt(400))
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
summary "Find pet by ID"
|
||||
parameters(pathParam[Long]("petId").description(""))
|
||||
)
|
||||
|
||||
get("/pet/{petId}",operation(getPetByIdOperation)) {
|
||||
|
||||
|
||||
|
||||
val petId = params.getOrElse("petId", halt(400))
|
||||
|
||||
|
||||
|
||||
println("petId: " + petId)
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
val updatePetWithFormOperation = (apiOperation[Unit]("updatePetWithForm")
|
||||
summary "Updates a pet in the store with form data"
|
||||
parameters(
|
||||
|
||||
pathParam[String]("petId").description("")
|
||||
|
||||
|
||||
,
|
||||
|
||||
|
||||
formParam[String]("name").description("").optional
|
||||
|
||||
,
|
||||
|
||||
|
||||
formParam[String]("status").description("").optional
|
||||
|
||||
)
|
||||
)
|
||||
|
||||
post("/pet/{petId}", operation(updatePetWithFormOperation)) {
|
||||
|
||||
|
||||
val petId = params.getOrElse("petId", halt(400))
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
summary "Updates a pet in the store with form data"
|
||||
parameters(pathParam[String]("petId").description(""),
|
||||
formParam[String]("name").description("").optional,
|
||||
formParam[String]("status").description("").optional)
|
||||
)
|
||||
|
||||
post("/pet/{petId}",operation(updatePetWithFormOperation)) {
|
||||
|
||||
|
||||
|
||||
val petId = params.getOrElse("petId", halt(400))
|
||||
|
||||
|
||||
|
||||
println("petId: " + petId)
|
||||
|
||||
|
||||
|
||||
|
||||
val name = params.getAs[String]("name")
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
val name = params.getAs[String]("name")
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
println("name: " + name)
|
||||
|
||||
|
||||
|
||||
|
||||
val status = params.getAs[String]("status")
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
val status = params.getAs[String]("status")
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
println("status: " + status)
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
val deletePetOperation = (apiOperation[Unit]("deletePet")
|
||||
summary "Deletes a pet"
|
||||
parameters(
|
||||
|
||||
headerParam[String]("api_key").description("").optional
|
||||
|
||||
|
||||
,
|
||||
|
||||
pathParam[Long]("petId").description("")
|
||||
|
||||
)
|
||||
)
|
||||
|
||||
delete("/pet/{petId}", operation(deletePetOperation)) {
|
||||
|
||||
|
||||
val api_key = request.getHeader("api_key")
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
println("api_key: " + api_key)
|
||||
|
||||
|
||||
|
||||
|
||||
val petId = params.getOrElse("petId", halt(400))
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
summary "Deletes a pet"
|
||||
parameters(pathParam[Long]("petId").description(""),
|
||||
)
|
||||
)
|
||||
|
||||
delete("/pet/{petId}",operation(deletePetOperation)) {
|
||||
|
||||
|
||||
|
||||
val petId = params.getOrElse("petId", halt(400))
|
||||
|
||||
|
||||
|
||||
println("petId: " + petId)
|
||||
|
||||
|
||||
|
||||
|
||||
val apiKey = request.getHeader("apiKey")
|
||||
|
||||
|
||||
|
||||
println("apiKey: " + apiKey)
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
val uploadFileOperation = (apiOperation[Unit]("uploadFile")
|
||||
summary "uploads an image"
|
||||
parameters(pathParam[Long]("petId").description(""),
|
||||
formParam[String]("additionalMetadata").description("").optional,
|
||||
formParam[File]("file").description("").optional)
|
||||
)
|
||||
|
||||
post("/pet/{petId}/uploadImage",operation(uploadFileOperation)) {
|
||||
|
||||
|
||||
|
||||
val petId = params.getOrElse("petId", halt(400))
|
||||
|
||||
|
||||
|
||||
println("petId: " + petId)
|
||||
|
||||
|
||||
|
||||
|
||||
val additionalMetadata = params.getAs[String]("additionalMetadata")
|
||||
|
||||
|
||||
|
||||
println("additionalMetadata: " + additionalMetadata)
|
||||
|
||||
val file = fileParams("file")
|
||||
|
||||
println("file: " + file)
|
||||
|
||||
}
|
||||
|
||||
}
|
@ -1,99 +1,96 @@
|
||||
package com.wordnik.client.api
|
||||
|
||||
class StoreApi(implicit val swagger: Swagger) extends ScalatraServlet
|
||||
with FileUploadSupport
|
||||
with JacksonJsonSupport
|
||||
with SwaggerSupport {
|
||||
import com.wordnik.client.model.Order
|
||||
|
||||
import java.io.File
|
||||
|
||||
import org.scalatra.{ TypedParamSupport, ScalatraServlet }
|
||||
import org.scalatra.swagger._
|
||||
import org.json4s._
|
||||
import org.json4s.JsonDSL._
|
||||
import org.scalatra.json.{ JValueResult, JacksonJsonSupport }
|
||||
import org.scalatra.servlet.{FileUploadSupport, MultipartConfig, SizeConstraintExceededException}
|
||||
|
||||
import scala.collection.JavaConverters._
|
||||
|
||||
class StoreApi (implicit val swagger: Swagger) extends ScalatraServlet
|
||||
with FileUploadSupport
|
||||
with JacksonJsonSupport
|
||||
with SwaggerSupport {
|
||||
protected implicit val jsonFormats: Formats = DefaultFormats
|
||||
|
||||
protected val applicationDescription: String = "StoreApi"
|
||||
override protected val applicationName: Option[String] = Some("Store")
|
||||
val getInventoryOperation = (apiOperation[Map[String, Int]]("getInventory")
|
||||
summary "Returns pet inventories by status"
|
||||
parameters(
|
||||
)
|
||||
)
|
||||
val placeOrderOperation = (apiOperation[Order]("placeOrder")
|
||||
summary "Place an order for a pet"
|
||||
parameters (
|
||||
|
||||
|
||||
bodyParam[Order]("body").description("").optional
|
||||
|
||||
|
||||
)
|
||||
)
|
||||
|
||||
before() {
|
||||
contentType = formats("json")
|
||||
response.headers += ("Access-Control-Allow-Origin" -> "*")
|
||||
}
|
||||
val getOrderByIdOperation = (apiOperation[Order]("getOrderById")
|
||||
summary "Find purchase order by ID"
|
||||
parameters (
|
||||
|
||||
|
||||
pathParam[String]("orderId").description("")
|
||||
|
||||
|
||||
)
|
||||
)
|
||||
|
||||
get("/store/inventory", operation(getInventoryOperation)) {
|
||||
val getInventoryOperation = (apiOperation[Map[String, Int]]("getInventory")
|
||||
summary "Returns pet inventories by status"
|
||||
parameters()
|
||||
)
|
||||
|
||||
get("/store/inventory",operation(getInventoryOperation)) {
|
||||
|
||||
}
|
||||
val deleteOrderOperation = (apiOperation[Unit]("deleteOrder")
|
||||
summary "Delete purchase order by ID"
|
||||
parameters (
|
||||
|
||||
pathParam[String]("orderId").description("")
|
||||
|
||||
|
||||
)
|
||||
)
|
||||
|
||||
post("/store/order", operation(placeOrderOperation)) {
|
||||
|
||||
|
||||
val body = parsedBody.extract[Order]
|
||||
|
||||
|
||||
val placeOrderOperation = (apiOperation[Order]("placeOrder")
|
||||
summary "Place an order for a pet"
|
||||
parameters(bodyParam[Order]("body").description("").optional)
|
||||
)
|
||||
|
||||
post("/store/order",operation(placeOrderOperation)) {
|
||||
|
||||
|
||||
|
||||
|
||||
bodyParam[Order]("body").description("").optional
|
||||
|
||||
println("body: " + body)
|
||||
|
||||
|
||||
}
|
||||
protected implicit val jsonFormats: Formats = DefaultFormats
|
||||
|
||||
get("/store/order/{orderId}", operation(getOrderByIdOperation)) {
|
||||
|
||||
|
||||
val orderId = params.getOrElse("orderId", halt(400))
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
val getOrderByIdOperation = (apiOperation[Order]("getOrderById")
|
||||
summary "Find purchase order by ID"
|
||||
parameters(pathParam[String]("orderId").description(""))
|
||||
)
|
||||
|
||||
get("/store/order/{orderId}",operation(getOrderByIdOperation)) {
|
||||
|
||||
|
||||
|
||||
val orderId = params.getOrElse("orderId", halt(400))
|
||||
|
||||
|
||||
|
||||
println("orderId: " + orderId)
|
||||
|
||||
|
||||
}
|
||||
protected val applicationDescription: String = "StoreApi"
|
||||
|
||||
delete("/store/order/{orderId}", operation(deleteOrderOperation)) {
|
||||
|
||||
|
||||
val orderId = params.getOrElse("orderId", halt(400))
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
val deleteOrderOperation = (apiOperation[Unit]("deleteOrder")
|
||||
summary "Delete purchase order by ID"
|
||||
parameters(pathParam[String]("orderId").description(""))
|
||||
)
|
||||
|
||||
delete("/store/order/{orderId}",operation(deleteOrderOperation)) {
|
||||
|
||||
|
||||
|
||||
val orderId = params.getOrElse("orderId", halt(400))
|
||||
|
||||
|
||||
|
||||
println("orderId: " + orderId)
|
||||
|
||||
|
||||
}
|
||||
|
||||
}
|
@ -1,7 +1,22 @@
|
||||
package com.wordnik.client.apiass UserApi(implicit val swagger: Swagger) extends ScalatraServlet
|
||||
with FileUploadSupport
|
||||
with JacksonJsonSupport
|
||||
with SwaggerSupport {
|
||||
package com.wordnik.client.api
|
||||
|
||||
import com.wordnik.client.model.User
|
||||
|
||||
import java.io.File
|
||||
|
||||
import org.scalatra.{ TypedParamSupport, ScalatraServlet }
|
||||
import org.scalatra.swagger._
|
||||
import org.json4s._
|
||||
import org.json4s.JsonDSL._
|
||||
import org.scalatra.json.{ JValueResult, JacksonJsonSupport }
|
||||
import org.scalatra.servlet.{FileUploadSupport, MultipartConfig, SizeConstraintExceededException}
|
||||
|
||||
import scala.collection.JavaConverters._
|
||||
|
||||
class UserApi (implicit val swagger: Swagger) extends ScalatraServlet
|
||||
with FileUploadSupport
|
||||
with JacksonJsonSupport
|
||||
with SwaggerSupport {
|
||||
protected implicit val jsonFormats: Formats = DefaultFormats
|
||||
|
||||
protected val applicationDescription: String = "UserApi"
|
||||
@ -11,238 +26,166 @@ with SwaggerSupport {
|
||||
contentType = formats("json")
|
||||
response.headers += ("Access-Control-Allow-Origin" -> "*")
|
||||
}
|
||||
|
||||
|
||||
|
||||
val createUserOperation = (apiOperation[Unit]("createUser")
|
||||
summary "Create user"
|
||||
parameters (
|
||||
|
||||
|
||||
bodyParam[User]("body").description("").optional
|
||||
|
||||
|
||||
)
|
||||
)
|
||||
|
||||
post("/user", operation(createUserOperation)) {
|
||||
|
||||
|
||||
val body = parsedBody.extract[User]
|
||||
|
||||
summary "Create user"
|
||||
parameters(bodyParam[User]("body").description("").optional)
|
||||
)
|
||||
|
||||
post("/user",operation(createUserOperation)) {
|
||||
|
||||
|
||||
|
||||
|
||||
bodyParam[User]("body").description("").optional
|
||||
|
||||
println("body: " + body)
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
val createUsersWithArrayInputOperation = (apiOperation[Unit]("createUsersWithArrayInput")
|
||||
summary "Creates list of users with given input array"
|
||||
parameters (
|
||||
|
||||
|
||||
bodyParam[List[User]]("body").description("").optional
|
||||
|
||||
|
||||
)
|
||||
)
|
||||
|
||||
post("/user/createWithArray", operation(createUsersWithArrayInputOperation)) {
|
||||
|
||||
|
||||
val body = parsedBody.extract[List[User]]
|
||||
|
||||
summary "Creates list of users with given input array"
|
||||
parameters(bodyParam[List[User]]("body").description("").optional)
|
||||
)
|
||||
|
||||
post("/user/createWithArray",operation(createUsersWithArrayInputOperation)) {
|
||||
|
||||
|
||||
|
||||
|
||||
bodyParam[List[User]]("body").description("").optional
|
||||
|
||||
println("body: " + body)
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
val createUsersWithListInputOperation = (apiOperation[Unit]("createUsersWithListInput")
|
||||
summary "Creates list of users with given input array"
|
||||
parameters (
|
||||
|
||||
|
||||
bodyParam[List[User]]("body").description("").optional
|
||||
|
||||
|
||||
)
|
||||
)
|
||||
|
||||
post("/user/createWithList", operation(createUsersWithListInputOperation)) {
|
||||
|
||||
|
||||
val body = parsedBody.extract[List[User]]
|
||||
|
||||
summary "Creates list of users with given input array"
|
||||
parameters(bodyParam[List[User]]("body").description("").optional)
|
||||
)
|
||||
|
||||
post("/user/createWithList",operation(createUsersWithListInputOperation)) {
|
||||
|
||||
|
||||
|
||||
|
||||
bodyParam[List[User]]("body").description("").optional
|
||||
|
||||
println("body: " + body)
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
val loginUserOperation = (apiOperation[String]("loginUser")
|
||||
summary "Logs user into the system"
|
||||
parameters(
|
||||
queryParam[String]("username").description("").optional
|
||||
|
||||
|
||||
,
|
||||
queryParam[String]("password").description("").optional
|
||||
|
||||
)
|
||||
)
|
||||
|
||||
get("/user/login", operation(loginUserOperation)) {
|
||||
|
||||
|
||||
val username = params.getAs[String]("username")
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
summary "Logs user into the system"
|
||||
parameters(queryParam[String]("username").description("").optional,
|
||||
queryParam[String]("password").description("").optional)
|
||||
)
|
||||
|
||||
get("/user/login",operation(loginUserOperation)) {
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
val username = params.getAs[String]("username")
|
||||
|
||||
|
||||
|
||||
println("username: " + username)
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
val password = params.getAs[String]("password")
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
val password = params.getAs[String]("password")
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
println("password: " + password)
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
val logoutUserOperation = (apiOperation[Unit]("logoutUser")
|
||||
summary "Logs out current logged in user session"
|
||||
parameters(
|
||||
)
|
||||
)
|
||||
|
||||
get("/user/logout", operation(logoutUserOperation)) {
|
||||
summary "Logs out current logged in user session"
|
||||
parameters()
|
||||
)
|
||||
|
||||
get("/user/logout",operation(logoutUserOperation)) {
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
val getUserByNameOperation = (apiOperation[User]("getUserByName")
|
||||
summary "Get user by user name"
|
||||
parameters (
|
||||
|
||||
pathParam[String]("username").description("")
|
||||
|
||||
|
||||
)
|
||||
)
|
||||
|
||||
get("/user/{username}", operation(getUserByNameOperation)) {
|
||||
|
||||
|
||||
val username = params.getOrElse("username", halt(400))
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
summary "Get user by user name"
|
||||
parameters(pathParam[String]("username").description(""))
|
||||
)
|
||||
|
||||
get("/user/{username}",operation(getUserByNameOperation)) {
|
||||
|
||||
|
||||
|
||||
val username = params.getOrElse("username", halt(400))
|
||||
|
||||
|
||||
|
||||
println("username: " + username)
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
val updateUserOperation = (apiOperation[Unit]("updateUser")
|
||||
summary "Updated user"
|
||||
parameters(
|
||||
|
||||
pathParam[String]("username").description("")
|
||||
|
||||
|
||||
,
|
||||
|
||||
|
||||
bodyParam[User]("body").description("").optional
|
||||
|
||||
)
|
||||
)
|
||||
|
||||
put("/user/{username}", operation(updateUserOperation)) {
|
||||
|
||||
|
||||
val username = params.getOrElse("username", halt(400))
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
summary "Updated user"
|
||||
parameters(pathParam[String]("username").description(""),
|
||||
bodyParam[User]("body").description("").optional)
|
||||
)
|
||||
|
||||
put("/user/{username}",operation(updateUserOperation)) {
|
||||
|
||||
|
||||
|
||||
val username = params.getOrElse("username", halt(400))
|
||||
|
||||
|
||||
|
||||
println("username: " + username)
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
val body = parsedBody.extract[User]
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
bodyParam[User]("body").description("").optional
|
||||
|
||||
println("body: " + body)
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
val deleteUserOperation = (apiOperation[Unit]("deleteUser")
|
||||
summary "Delete user"
|
||||
parameters (
|
||||
|
||||
pathParam[String]("username").description("")
|
||||
|
||||
|
||||
)
|
||||
)
|
||||
|
||||
delete("/user/{username}", operation(deleteUserOperation)) {
|
||||
|
||||
|
||||
val username = params.getOrElse("username", halt(400))
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
summary "Delete user"
|
||||
parameters(pathParam[String]("username").description(""))
|
||||
)
|
||||
|
||||
delete("/user/{username}",operation(deleteUserOperation)) {
|
||||
|
||||
|
||||
|
||||
val username = params.getOrElse("username", halt(400))
|
||||
|
||||
|
||||
|
||||
println("username: " + username)
|
||||
|
||||
|
||||
}
|
||||
|
||||
}
|
@ -1,7 +1,8 @@
|
||||
package com.wordnik.client.model
|
||||
|
||||
|
||||
case class Category(
|
||||
id: Long,
|
||||
name: String
|
||||
)
|
||||
|
||||
case class Category (
|
||||
id: Long,
|
||||
name: String
|
||||
)
|
||||
|
@ -3,11 +3,11 @@ package com.wordnik.client.model
|
||||
import java.util.Date
|
||||
|
||||
|
||||
case class Order(
|
||||
id: Long,
|
||||
petId: Long,
|
||||
quantity: Int,
|
||||
shipDate: Date,
|
||||
status: String,
|
||||
complete: Boolean
|
||||
)
|
||||
case class Order (
|
||||
id: Long,
|
||||
petId: Long,
|
||||
quantity: Int,
|
||||
shipDate: Date,
|
||||
status: String,
|
||||
complete: Boolean
|
||||
)
|
||||
|
@ -1,11 +1,14 @@
|
||||
package com.wordnik.client.model
|
||||
|
||||
import com.wordnik.client.model.Category
|
||||
import com.wordnik.client.model.Tag
|
||||
|
||||
case class Pet(
|
||||
id: Long,
|
||||
category: Category,
|
||||
name: String,
|
||||
photoUrls: List[String],
|
||||
tags: List[Tag],
|
||||
status: String
|
||||
)
|
||||
|
||||
case class Pet (
|
||||
id: Long,
|
||||
category: Category,
|
||||
name: String,
|
||||
photoUrls: List[String],
|
||||
tags: List[Tag],
|
||||
status: String
|
||||
)
|
||||
|
@ -1,7 +1,8 @@
|
||||
package com.wordnik.client.model
|
||||
|
||||
|
||||
case class Tag(
|
||||
id: Long,
|
||||
name: String
|
||||
)
|
||||
|
||||
case class Tag (
|
||||
id: Long,
|
||||
name: String
|
||||
)
|
||||
|
@ -1,13 +1,14 @@
|
||||
package com.wordnik.client.model
|
||||
|
||||
|
||||
case class User(
|
||||
id: Long,
|
||||
username: String,
|
||||
firstName: String,
|
||||
lastName: String,
|
||||
email: String,
|
||||
password: String,
|
||||
phone: String,
|
||||
userStatus: Int
|
||||
)
|
||||
|
||||
case class User (
|
||||
id: Long,
|
||||
username: String,
|
||||
firstName: String,
|
||||
lastName: String,
|
||||
email: String,
|
||||
password: String,
|
||||
phone: String,
|
||||
userStatus: Int
|
||||
)
|
||||
|
@ -1,17 +1,17 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<web-app xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xmlns="http://java.sun.com/xml/ns/javaee"
|
||||
xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_3_0.xsd"
|
||||
version="3.0">
|
||||
<listener>
|
||||
<listener-class>org.scalatra.servlet.ScalatraListener</listener-class>
|
||||
</listener>
|
||||
<web-app xmlns="http://java.sun.com/xml/ns/javaee"
|
||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_3_0.xsd"
|
||||
version="3.0">
|
||||
<listener>
|
||||
<listener-class>org.scalatra.servlet.ScalatraListener</listener-class>
|
||||
</listener>
|
||||
|
||||
<servlet-mapping>
|
||||
<servlet-name>default</servlet-name>
|
||||
<url-pattern>/*.html</url-pattern>
|
||||
<url-pattern>/css/*</url-pattern>
|
||||
<url-pattern>/js/*.js</url-pattern>
|
||||
<url-pattern>/images/*</url-pattern>
|
||||
</servlet-mapping>
|
||||
<servlet-mapping>
|
||||
<servlet-name>default</servlet-name>
|
||||
<url-pattern>/*.html</url-pattern>
|
||||
<url-pattern>/css/*</url-pattern>
|
||||
<url-pattern>/js/*.js</url-pattern>
|
||||
<url-pattern>/images/*</url-pattern>
|
||||
</servlet-mapping>
|
||||
</web-app>
|
||||
|
Loading…
Reference in New Issue
Block a user