コード例 #1
0
  @Test
  public void testRegistersTabrisLoaderWithId() {
    ApplicationImpl application = mockConfiguration();
    ApplicationContextImpl applicationContext = application.getApplicationContext();

    TabrisClientInstaller.install(application, "foo");

    verify(applicationContext.getResourceRegistry())
        .add(eq("index.json"), any(TabrisResourceLoader.class));
  }
コード例 #2
0
 private ApplicationImpl mockConfiguration() {
   ApplicationImpl application = mock(ApplicationImpl.class);
   ApplicationContextImpl context = mock(ApplicationContextImpl.class);
   ThemeManager themeManager = mock(ThemeManager.class);
   when(context.getThemeManager()).thenReturn(themeManager);
   when(context.getServletContext()).thenReturn(mock(ServletContext.class));
   when(application.getApplicationContext()).thenReturn(context);
   ResourceRegistry resourceRegistry = mock(ResourceRegistry.class);
   when(context.getResourceRegistry()).thenReturn(resourceRegistry);
   return application;
 }
コード例 #3
0
ファイル: RWTServlet.java プロジェクト: oaperez/rap
 private void sendStartupContent(HttpServletRequest request, HttpServletResponse response)
     throws IOException {
   String accept = request.getHeader(HTTP.HEADER_ACCEPT);
   if (accept != null && accept.contains(HTTP.CONTENT_TYPE_JSON)) {
     StartupJson.send(response);
   } else {
     applicationContext.getStartupPage().send(response);
   }
 }
コード例 #4
0
 private void registerJavascriptResource(ContentBuffer buffer, String name) throws IOException {
   InputStream inputStream = buffer.getContentAsStream();
   try {
     resourceManager.register(name, inputStream);
   } finally {
     inputStream.close();
   }
   String location = resourceManager.getLocation(name);
   applicationContext.getStartupPage().setClientJsLibrary(location);
 }
コード例 #5
0
ファイル: RWTServlet.java プロジェクト: oaperez/rap
 private void handleRequest(HttpServletRequest request, HttpServletResponse response)
     throws IOException, ServletException {
   if (!applicationContext.allowsRequests()) {
     response.sendError(SC_SERVICE_UNAVAILABLE);
   } else if (request.getPathInfo() == null) {
     // /context/servlet: no extra path info after servlet name
     handleValidRequest(request, response);
   } else if ("/".equals(request.getPathInfo()) && "".equals(request.getServletPath())) {
     // /context/: root servlet, in this case path info "/" is ok
     handleValidRequest(request, response);
   } else {
     response.sendError(SC_NOT_FOUND);
   }
 }
コード例 #6
0
 @Before
 public void setUp() {
   applicationContext = mock(ApplicationContextImpl.class);
   when(applicationContext.getEntryPointManager()).thenReturn(manager);
   when(applicationContext.getServletContext()).thenReturn(context);
 }
コード例 #7
0
 public ClientResources(ApplicationContextImpl applicationContext) {
   this.applicationContext = applicationContext;
   resourceManager = applicationContext.getResourceManager();
   themeManager = applicationContext.getThemeManager();
 }
コード例 #8
0
ファイル: RWTServlet.java プロジェクト: oaperez/rap
 @Override
 public void init() throws ServletException {
   ServletContext servletContext = getServletContext();
   applicationContext = ApplicationContextImpl.getFrom(servletContext);
 }
コード例 #9
0
ファイル: RWTServlet.java プロジェクト: oaperez/rap
 private ServiceHandler getServiceHandler() {
   return applicationContext.getServiceManager().getHandler();
 }