BVB Source Codes

che Show WsMasterServletModule.java Source code

Return Download che: download WsMasterServletModule.java Source code - Download che Source code - Type:.java
  1. /*******************************************************************************
  2.  * Copyright (c) 2012-2017 Codenvy, S.A.
  3.  * All rights reserved. This program and the accompanying materials
  4.  * are made available under the terms of the Eclipse Public License v1.0
  5.  * which accompanies this distribution, and is available at
  6.  * http://www.eclipse.org/legal/epl-v10.html
  7.  *
  8.  * Contributors:
  9.  *   Codenvy, S.A. - initial API and implementation
  10.  *******************************************************************************/
  11. package org.eclipse.che.api.deploy;
  12.  
  13. import com.google.inject.servlet.ServletModule;
  14.  
  15. import org.apache.catalina.filters.CorsFilter;
  16. import org.eclipse.che.inject.DynaModule;
  17.  
  18. import javax.inject.Singleton;
  19. import java.util.HashMap;
  20. import java.util.Map;
  21.  
  22. /** @author andrew00x */
  23. @DynaModule
  24. public class WsMasterServletModule extends ServletModule {
  25.     @Override
  26.     protected void configureServlets() {
  27.         getServletContext().addListener(new org.everrest.websockets.WSConnectionTracker());
  28.  
  29.         final Map<String, String> corsFilterParams = new HashMap<>();
  30.         corsFilterParams.put("cors.allowed.origins", "*");
  31.         corsFilterParams.put("cors.allowed.methods", "GET," +
  32.                                                      "POST," +
  33.                                                      "HEAD," +
  34.                                                      "OPTIONS," +
  35.                                                      "PUT," +
  36.                                                      "DELETE");
  37.         corsFilterParams.put("cors.allowed.headers", "Content-Type," +
  38.                                                      "X-Requested-With," +
  39.                                                      "accept," +
  40.                                                      "Origin," +
  41.                                                      "Access-Control-Request-Method," +
  42.                                                      "Access-Control-Request-Headers");
  43.         corsFilterParams.put("cors.support.credentials", "true");
  44.         // preflight cache is available for 10 minutes
  45.         corsFilterParams.put("cors.preflight.maxage", "10");
  46.         bind(CorsFilter.class).in(Singleton.class);
  47.  
  48.         filter("/*").through(CorsFilter.class, corsFilterParams);
  49.  
  50.         filter("/api/*").through(org.eclipse.che.api.local.filters.EnvironmentInitializationFilter.class);
  51.         serveRegex("^/api((?!(/(ws|eventbus)($|/.*)))/.*)").with(org.eclipse.che.api.local.CheGuiceEverrestServlet.class);
  52.         install(new org.eclipse.che.swagger.deploy.BasicSwaggerConfigurationModule());
  53.     }
  54. }
  55.  
downloadWsMasterServletModule.java Source code - Download che Source code
Related Source Codes/Software:
Gource - oftware version control visualization ... 2017-01-10
FDFullscreenPopGesture - A UINavigationController's category to enable full... 2017-01-10
node-style-guide - A guide for styling your node.js / JavaScript code... 2017-01-09
ImageOptim - GUI image optimizer for Mac htt... 2017-01-09
falcon - Falcon is a low-level, high-performance Python fra... 2017-01-09
notepad-plus-plus - Notepad++ official repository h... 2017-01-10
waterline - An adapter-based ORM for Node.js with support for ... 2017-01-10
Workerman - An asynchronous event driven PHP framework for eas... 2017-01-10
structor - An advanced visual editor for React components ... 2017-01-10
golearn - Machine Learning for Go 2017-01-10
discover-flask - Full Stack Web Development with Flask. ... 2017-01-12
spring-mvc-showcase - Demonstrates the features of the Spring MVC web fr... 2017-01-12
tushare - TuShare is a utility for crawling historical data ... 2017-01-12
raml-spec - RAML Specification http://raml.... 2017-01-12
android-stackblur - Android StackBlur is a library that can perform a ... 2017-01-12
sound-redux - A Soundcloud client built with React / Redux ... 2017-01-12
httpstat - curl statistics made simple 2017-01-12
vim - Vim configuration file and plug-ins 2017-01-12
appframework - The definitive HTML5 mobile javascript framework ... 2017-01-12
BaiduExporter - Assistant for Baidu to export download links to ar... 2017-01-11

 Back to top