wordnik/swagger-core — pull request #156 by johannbarbie (2013-03-15 09:13:47+00:00)
Title: Removed Jersey and Servet Dependencies from Swagger-JAXRS

Following my issue https://github.com/wordnik/swagger-core/issues/146 I'm providing my code here to run Swagger without servlet container.

As there is no web.xml to configure things, I've created a FileConfigReader based on https://github.com/typesafehub/config following the JerseyConfigReader example.

```scala
class FileConfigReader extends ConfigReader {

var conf: com.typesafe.config.Config = ConfigFactory.load()

def basePath(): String = conf.getString("swagger.api.basepath")

def swaggerVersion(): String = conf.getString("swagger.version")

def apiVersion(): String = conf.getString("api.version")

def modelPackages(): String = conf.getString("api.model.packages")

def apiFilterClassName(): String = null

}
```

I'm placing a application.properties file into src/main/resources which looks like this

```java
api.version=1.0
swagger.version=1.1
swagger.api.basepath=
api.model.packages=org.restnucleus.persistence,org.restnucleus.persistence.stub
swagger.security.filter=
```

Note that I'm not providing a base-path. The static path was a pain for me, as the doc should work in different environments DEV/QA/PROD, so I'm trying to read it from the request:

```scala
val basePath = reader.basePath() match {
case s: String => s
case _ => uriInfo.getBaseUri().toString()
}
```
Hope that's useful.