private ResourceConfig createResourceConfig(WebConfig webConfig) throws ServletException { final Map<String, Object> props = getInitParams(webConfig); final ResourceConfig rc = createResourceConfig(webConfig, props); rc.setPropertiesAndFeatures(props); return rc; }
/** * Destroy this Servlet or Filter. * */ @Override public void destroy() { if (webComponent != null) { webComponent.destroy(); } }
final ContainerRequest cRequest = createRequest( _application, request, filterFormParameters(request, cRequest); traceOnException(cRequest, response); throw new ServletException(ex.getCause()); } catch (ContainerException ex) { traceOnException(cRequest, response); throw new ServletException(ex); } catch (RuntimeException ex) { traceOnException(cRequest, response); throw ex; } finally {
/** * Reload the Web application. This will create and initiate the web * application using the same {@link ResourceConfig} implementation * that was used to load the Web application. * <p/> * This method may be called at runtime, more than once, to reload the * Web application. For example, if a {@link ResourceConfig} implementation * is capable of detecting changes to resource classes (addition or removal) * or providers then this method may be invoked to reload the web * application for such changes to take effect. * <p/> * If this method is called when there are pending requests then such * requests will be processed using the previously loaded web application. */ public void onReload() { WebApplication oldApplication = application; WebApplication newApplication = create(); initiate(resourceConfig, newApplication); application = newApplication; if (resourceConfig instanceof ReloadListener) ((ReloadListener) resourceConfig).onReload(); oldApplication.destroy(); }
/** * Initiate the Web component. * * @param webConfig the Web configuration. * @throws javax.servlet.ServletException in case of any initialization error */ public void init(WebConfig webConfig) throws ServletException { config = webConfig; if (resourceConfig == null) resourceConfig = createResourceConfig(config); load(); Object o = resourceConfig.getProperties().get( ResourceConfig.PROPERTY_CONTAINER_NOTIFIER); if (o instanceof List) { List list = (List) o; for (Object elem : list) { if (elem instanceof ContainerNotifier) { ContainerNotifier crf = (ContainerNotifier) elem; crf.addListener(this); } } } else if (o instanceof ContainerNotifier) { ContainerNotifier crf = (ContainerNotifier) o; crf.addListener(this); } }
return defaultConfig; return getDefaultResourceConfig(props, webConfig); String[] paths = getPaths(webConfig.getInitParameter( ClasspathResourceConfig.PROPERTY_CLASSPATH)); props.put(ClasspathResourceConfig.PROPERTY_CLASSPATH, paths); Constructor constructor = resourceConfigClass.getConstructor(Map.class); if (ClasspathResourceConfig.class.isAssignableFrom(resourceConfigClass)) { String[] paths = getPaths(webConfig.getInitParameter( ClasspathResourceConfig.PROPERTY_CLASSPATH)); props.put(ClasspathResourceConfig.PROPERTY_CLASSPATH, paths);
@Override protected void configure(WebConfig wc, ResourceConfig rc, WebApplication wa) { super.configure(wc, rc, wa); ServletContainer.this.configure(wc, rc, wa); }
/** * Extension point for creating your custom container request. * * @param app the web app * @param request the current servlet api request * @param baseUri the base uri * @param requestUri the request uri * @return the request container * @throws IOException if any error occurs when getting the input stream */ protected ContainerRequest createRequest(WebApplication app, HttpServletRequest request, URI baseUri, URI requestUri) throws IOException { return new ContainerRequest( app, request.getMethod(), baseUri, requestUri, getHeaders(request), request.getInputStream()); }
final ContainerRequest cRequest = createRequest( _application, request, filterFormParameters(request, cRequest); traceOnException(cRequest, response); throw new ServletException(ex.getCause()); } catch (ContainerException ex) { traceOnException(cRequest, response); throw new ServletException(ex); } catch (RuntimeException ex) { traceOnException(cRequest, response); throw ex; } finally {
/** * Reload the Web application. This will create and initiate the web * application using the same {@link ResourceConfig} implementation * that was used to load the Web application. * <p/> * This method may be called at runtime, more than once, to reload the * Web application. For example, if a {@link ResourceConfig} implementation * is capable of detecting changes to resource classes (addition or removal) * or providers then this method may be invoked to reload the web * application for such changes to take effect. * <p/> * If this method is called when there are pending requests then such * requests will be processed using the previously loaded web application. */ public void onReload() { WebApplication oldApplication = application; WebApplication newApplication = create(); initiate(resourceConfig, newApplication); application = newApplication; if (resourceConfig instanceof ReloadListener) ((ReloadListener) resourceConfig).onReload(); oldApplication.destroy(); }
/** * Initiate the Web component. * * @param webConfig the Web configuration. * @throws javax.servlet.ServletException in case of any initialization error */ public void init(WebConfig webConfig) throws ServletException { config = webConfig; if (resourceConfig == null) resourceConfig = createResourceConfig(config); load(); Object o = resourceConfig.getProperties().get( ResourceConfig.PROPERTY_CONTAINER_NOTIFIER); if (o instanceof List) { List list = (List) o; for (Object elem : list) { if (elem instanceof ContainerNotifier) { ContainerNotifier crf = (ContainerNotifier) elem; crf.addListener(this); } } } else if (o instanceof ContainerNotifier) { ContainerNotifier crf = (ContainerNotifier) o; crf.addListener(this); } }
return defaultConfig; return getDefaultResourceConfig(props, webConfig); String[] paths = getPaths(webConfig.getInitParameter( ClasspathResourceConfig.PROPERTY_CLASSPATH)); props.put(ClasspathResourceConfig.PROPERTY_CLASSPATH, paths); Constructor constructor = resourceConfigClass.getConstructor(Map.class); if (ClasspathResourceConfig.class.isAssignableFrom(resourceConfigClass)) { String[] paths = getPaths(webConfig.getInitParameter( ClasspathResourceConfig.PROPERTY_CLASSPATH)); props.put(ClasspathResourceConfig.PROPERTY_CLASSPATH, paths);
@Override protected void configure(WebConfig wc, ResourceConfig rc, WebApplication wa) { super.configure(wc, rc, wa); ServletContainer.this.configure(wc, rc, wa); }
/** * Extension point for creating your custom container request. * * @param app the web app * @param request the current servlet api request * @param baseUri the base uri * @param requestUri the request uri * @return the request container * @throws IOException if any error occurs when getting the input stream */ protected ContainerRequest createRequest(WebApplication app, HttpServletRequest request, URI baseUri, URI requestUri) throws IOException { return new ContainerRequest( app, request.getMethod(), baseUri, requestUri, getHeaders(request), request.getInputStream()); }
final ContainerRequest cRequest = createRequest( _application, request, filterFormParameters(request, cRequest); traceOnException(cRequest, response); throw new ServletException(ex.getCause()); } catch (ContainerException ex) { traceOnException(cRequest, response); throw new ServletException(ex); } catch (RuntimeException ex) { traceOnException(cRequest, response); throw ex; } finally {
private ResourceConfig createResourceConfig(WebConfig webConfig) throws ServletException { final Map<String, Object> props = getInitParams(webConfig); final ResourceConfig rc = createResourceConfig(webConfig, props); rc.setPropertiesAndFeatures(props); return rc; }