javax.servlet.ServletContext Scala Examples
The following examples show how to use javax.servlet.ServletContext.
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example.
Example 1
Source File: Plugin.scala From gitbucket-ipynb-plugin with Apache License 2.0 | 5 votes |
import javax.servlet.ServletContext import gitbucket.core.plugin.PluginRegistry import gitbucket.core.service.SystemSettingsService.SystemSettings import gitbucket.ipynb.IpynbRenderer import io.github.gitbucket.solidbase.model.Version import scala.util.Try class Plugin extends gitbucket.core.plugin.Plugin { override val pluginId: String = "ipynb" override val pluginName: String = "ipynb Plugin" override val description: String = "Provides ipynb rendering for GitBucket." override val versions: List[Version] = List( new Version("0.1.0"), new Version("0.1.1"), new Version("0.2.0"), new Version("0.2.1"), new Version("0.3.0"), new Version("0.3.1"), new Version("0.4.0"), new Version("0.4.1") ) private[this] var renderer: Option[IpynbRenderer] = None override def initialize(registry: PluginRegistry, context: ServletContext, settings: SystemSettings): Unit = { val test = Try{ new IpynbRenderer() } val ipynb = test.get registry.addRenderer("ipynb", ipynb) renderer = Option(ipynb) super.initialize(registry, context, settings) } override def shutdown(registry: PluginRegistry, context: ServletContext, settings: SystemSettings): Unit = { renderer.map(r => r.shutdown()) } override val assetsMappings = Seq("/ipynb" -> "/ipynb/assets") }
Example 2
Source File: ScalatraBootstrap.scala From chatoverflow with Eclipse Public License 2.0 | 5 votes |
import javax.servlet.ServletContext import org.codeoverflow.chatoverflow.VersionInfo import org.codeoverflow.chatoverflow.ui.web.rest.config.ConfigController import org.codeoverflow.chatoverflow.ui.web.rest.connector.ConnectorController import org.codeoverflow.chatoverflow.ui.web.rest.events.{EventsController, EventsDispatcher} import org.codeoverflow.chatoverflow.ui.web.rest.plugin.PluginInstanceController import org.codeoverflow.chatoverflow.ui.web.rest.types.TypeController import org.codeoverflow.chatoverflow.ui.web.{CodeOverflowSwagger, GUIServlet, OpenAPIServlet} import org.scalatra._ class ScalatraBootstrap extends LifeCycle { implicit val swagger: CodeOverflowSwagger = new CodeOverflowSwagger(VersionInfo.rest) override def init(context: ServletContext) { // Allow CORS context.initParameters("org.scalatra.cors.allowedOrigins") = "*" context.initParameters("org.scalatra.cors.allowCredentials") = "false" context.initParameters("org.scalatra.cors.allowedMethods") = "*" // Add all servlets and controller val eventsController = new EventsController() EventsDispatcher.init(eventsController) context.mount(eventsController, "/events/*", "events") context.mount(new TypeController(), "/types/*", "types") context.mount(new ConfigController(), "/config/*", "config") context.mount(new PluginInstanceController(), "/instances/*", "instances") context.mount(new ConnectorController(), "/connectors/*", "connectors") context.mount(new OpenAPIServlet(), "/api-docs") context.mount(new GUIServlet(), "/*") } }
Example 3
Source File: Plugin.scala From gitbucket-plantuml-plugin with Apache License 2.0 | 5 votes |
import com.yotaichino.gitbucket.plugins.plantuml.PlantUMLRenderer import com.yotaichino.gitbucket.plugins.plantuml.PlantUMLController import javax.servlet.ServletContext import gitbucket.core.plugin.PluginRegistry import gitbucket.core.service.SystemSettingsService.SystemSettings import io.github.gitbucket.solidbase.model.Version class Plugin extends gitbucket.core.plugin.Plugin { override val pluginId: String = "plantuml_plugin" override val pluginName: String = "PlantUML Plugin" override val description: String = "Renders PlantUML diagrams!" override val versions: List[Version] = List( new Version("1.0.0"), new Version("1.1.0"), new Version("1.1.1"), new Version("1.1.2"), new Version("1.2.0"), new Version("1.2.1"), new Version("1.3.0"), new Version("1.4.0"), new Version("1.5.0"), new Version("1.6.0"), new Version("1.6.1") ) override def initialize(registry: PluginRegistry, context: ServletContext, settings: SystemSettings): Unit = { val renderer = new PlantUMLRenderer() registry.addRenderer("plantuml", renderer) registry.addRenderer("puml", renderer) registry.addRenderer("pu", renderer) registry.addController("/*", new PlantUMLController()) } }