+ httpServer.getConnectorAddress(0).getPort()); } catch (IOException e) { throw new WebAppException("Error starting http server", e);
+ httpServer.getConnectorAddress(0).getPort()); } catch (IOException e) { throw new WebAppException("Error starting http server", e); .at(NetUtils.getHostPortString(bindAddress)).start(webApp); } catch (WebAppException e){ throw new WebAppException("Error starting http server", e); } catch (Exception e){ throw new WebAppException("Error start http server. For more detail", e);
protected PrintWriter writer() { try { return response().getWriter(); } catch (Exception e) { throw new WebAppException(e); } } }
public PrintWriter writer() { try { return response().getWriter(); } catch (IOException e) { throw new WebAppException(e); } }
public PrintWriter writer() { try { return response().getWriter(); } catch (IOException e) { throw new WebAppException(e); } }
public ServletOutputStream outputStream() { try { return response().getOutputStream(); } catch (IOException e) { throw new WebAppException(e); } }
void sendErrorResponse(int sc, String msg, Exception e) { if (LOG.isDebugEnabled()) { LOG.debug(msg, e); } try { response().sendError(sc, msg); } catch (IOException e1) { throw new WebAppException(e); } }
protected PrintWriter writer() { try { return response().getWriter(); } catch (Exception e) { throw new WebAppException(e); } } }
protected PrintWriter writer() { try { return response().getWriter(); } catch (Exception e) { throw new WebAppException(e); } } }
public void stop() { try { checkNotNull(httpServer, "httpServer").stop(); checkNotNull(guiceFilter, "guiceFilter").destroy(); } catch (Exception e) { throw new WebAppException(e); } }
HttpServletResponse createResponse() { try { HttpServletResponse res = mock(HttpServletResponse.class); when(res.getWriter()).thenReturn(writer); return res; } catch (Exception e) { throw new WebAppException(e); } } });
HttpServletResponse createResponse() { try { HttpServletResponse res = mock(HttpServletResponse.class); when(res.getWriter()).thenReturn(writer); return res; } catch (Exception e) { throw new WebAppException(e); } } });
HttpServletResponse createResponse() { try { HttpServletResponse res = mock(HttpServletResponse.class); when(res.getWriter()).thenReturn(writer); return res; } catch (Exception e) { throw new WebAppException(e); } } });
public WebApp start(WebApp webapp) { WebApp webApp = build(webapp); HttpServer2 httpServer = webApp.httpServer(); try { httpServer.start(); LOG.info("Web app " + name + " started at " + httpServer.getConnectorAddress(0).getPort()); } catch (IOException e) { throw new WebAppException("Error starting http server", e); } return webApp; }
/** * Render a sub-view * @param cls the class of the sub-view */ public void render(Class<? extends SubView> cls) { int saved = context().nestLevel; getInstance(cls).renderPartial(); if (context().nestLevel != saved) { throw new WebAppException("View "+ cls.getSimpleName() +" not complete"); } } }
public static <T> Injector testController(Class<? extends Controller> ctrlr, String methodName, Class<T> api, T impl, Module... modules) { try { Injector injector = createMockInjector(api, impl, modules); Method method = ctrlr.getMethod(methodName, (Class<?>[])null); method.invoke(injector.getInstance(ctrlr), (Object[])null); return injector; } catch (Exception e) { throw new WebAppException(e); } }
/** * Render a sub-view * @param cls the class of the sub-view */ public void render(Class<? extends SubView> cls) { int saved = context().nestLevel; getInstance(cls).renderPartial(); if (context().nestLevel != saved) { throw new WebAppException("View "+ cls.getSimpleName() +" not complete"); } } }
public static <T> Injector testController(Class<? extends Controller> ctrlr, String methodName, Class<T> api, T impl, Module... modules) { try { Injector injector = createMockInjector(api, impl, modules); Method method = ctrlr.getMethod(methodName, (Class<?>[])null); method.invoke(injector.getInstance(ctrlr), (Object[])null); return injector; } catch (Exception e) { throw new WebAppException(e); } }
@Override public void render() { int nestLevel = context().nestLevel(); LOG.debug("Rendering {} @{}", getClass(), nestLevel); render(block()); if (block.nestLevel() != nestLevel) { throw new WebAppException("Error rendering block: nestLevel="+ block.nestLevel() +" expected "+ nestLevel); } context().set(nestLevel, block.wasInline()); }
@Override public void render() { putWithoutEscapeHtml(DOCTYPE); render(page().html().meta_http("X-UA-Compatible", "IE=8") .meta_http("Content-type", MimeType.HTML)); if (page().nestLevel() != 0) { throw new WebAppException("Error rendering page: nestLevel="+ page().nestLevel()); } }