@Override public String getConfiguredWidgetset(VaadinRequest request) { return getDeploymentConfiguration() .getWidgetset(VaadinServlet.DEFAULT_WIDGETSET); }
return getService().getDeploymentConfiguration().getResourceCacheTime();
@Override public String getStaticFileLocation(VaadinRequest request) { VaadinServletRequest servletRequest = (VaadinServletRequest) request; String staticFileLocation; // if property is defined in configurations, use that staticFileLocation = getDeploymentConfiguration().getResourcesPath(); if (staticFileLocation != null) { return staticFileLocation; } // the last (but most common) option is to generate default location // from request by finding how many "../" should be added to the // requested path before we get to the context root String requestedPath = servletRequest.getServletPath(); String pathInfo = servletRequest.getPathInfo(); if (pathInfo != null) { requestedPath += pathInfo; } return getCancelingRelativePath(requestedPath); }
if (getService().getDeploymentConfiguration().isProductionMode()) {
/** * Create a VaadinSession * @param locale Client locale * @return VaadinSession instance * @throws Exception Failed to create session */ protected VaadinSession createVaadinSession(Locale locale) throws Exception { WrappedSession wrappedSession = mock(WrappedSession.class); VaadinServletService vaadinService = mock(VaadinServletService.class); when(vaadinService.getDeploymentConfiguration()) .thenReturn(new DefaultDeploymentConfiguration(VaadinServletService.class, getDeploymentProperties())); VaadinSession session = mock(VaadinSession.class); when(session.getState()).thenReturn(VaadinSession.State.OPEN); when(session.getSession()).thenReturn(wrappedSession); when(session.getService()).thenReturn(vaadinService); when(session.getSession().getId()).thenReturn(TEST_SESSION_ID); when(session.hasLock()).thenReturn(true); when(session.getLocale()).thenReturn(locale != null ? locale : Locale.US); return session; }
/** * Create a VaadinSession * @param locale Client locale * @return VaadinSession instance * @throws Exception Failed to create session */ protected VaadinSession createVaadinSession(Locale locale) throws Exception { WrappedSession wrappedSession = mock(WrappedSession.class); VaadinServletService vaadinService = mock(VaadinServletService.class); when(vaadinService.getDeploymentConfiguration()) .thenReturn(new DefaultDeploymentConfiguration(VaadinServletService.class, getDeploymentProperties())); VaadinSession session = mock(VaadinSession.class); when(session.getState()).thenReturn(VaadinSession.State.OPEN); when(session.getSession()).thenReturn(wrappedSession); when(session.getService()).thenReturn(vaadinService); when(session.getSession().getId()).thenReturn(TEST_SESSION_ID); when(session.hasLock()).thenReturn(true); when(session.getLocale()).thenReturn(locale != null ? locale : Locale.US); return session; }
protected void initializePlugin(VaadinServletService service) { // Spring system messages provider if (systemMessagesBeanName != null && systemMessagesBeanName != "") { SpringVaadinSystemMessagesProvider messagesProvider = new SpringVaadinSystemMessagesProvider(applicationContext, systemMessagesBeanName); logger.debug("set SpringVaadinSystemMessagesProvider"); service.setSystemMessagesProvider(messagesProvider); } String uiProviderProperty = service.getDeploymentConfiguration().getApplicationOrSystemProperty(Constants.SERVLET_PARAMETER_UI_PROVIDER, null); // Add SpringUIProvider if custom provider doesn't defined. if (uiProviderProperty == null) { service.addSessionInitListener(new SessionInitListener() { @Override public void sessionInit(SessionInitEvent event) throws ServiceException { event.getSession().addUIProvider(new SpringUIProvider()); } }); } }
@Override protected void service(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { if (handleContextRootWithoutSlash(request, response)) { return; } if (mappingPath == null) { mappingPath = findMappingPath(request); getService().getDeploymentConfiguration().getInitParameters().setProperty(PARAMETER_VAADIN_RESOURCES, mappingPath); } if (isLocalUIDL(request)) { request = new UidlRequestWrapper(request); } else if (isLocalStaticResourceRequest(request)) { request = createLocalRequestMapper(request); } super.service(request, response); }