private void addServlet(String mountPoint, Servlet servlet, Map<?, ?> contextParam, ServiceReference<WebApplicationFactory<?>> appFactoryReference) { Bundle bundle = appFactoryReference.getBundle(); httpTracker.addServlet(mountPoint, servlet, contextParam, bundle); } }
public final void stop(BundleContext context) throws Exception { httpTracker.close(); applicationFactoryTracker.close(); httpTracker = null; applicationFactoryTracker = null; bundleContext = null; if (LOGGER.isDebugEnabled()) { Bundle bundle = context.getBundle(); String bundleSymbolicName = bundle.getSymbolicName(); LOGGER.debug("Bundle [" + bundleSymbolicName + "] stopped."); } }
private void removeApplication(ServiceReference<WebApplicationFactory<?>> reference) { PaxWicketApplicationFactory factory; synchronized (factories) { if (!factories.containsKey(reference)) { LOGGER .warn("Trying to unregister ApplicationFactory without application name or mount point is not possible"); return; } factory = factories.remove(reference); } LOGGER.debug("Service Removed [{}], Factory hash [{}]", reference, identityHashCode(factory)); httpTracker.removeServlet(factory.getMountPoint()); }
public final void start(BundleContext context) throws Exception { if (LOGGER.isDebugEnabled()) { Bundle bundle = context.getBundle(); String bundleSymbolicName = bundle.getSymbolicName(); LOGGER.debug("Initializing [" + bundleSymbolicName + "] bundle."); } bundleContext = context; LOGGER.debug("Set object stream factory"); Objects.setObjectStreamFactory(new PaxWicketObjectStreamFactory(true)); httpTracker = new HttpTracker(context); httpTracker.open(); applicationFactoryTracker = new PaxWicketAppFactoryTracker(context, httpTracker); applicationFactoryTracker.open(); }
/** * <p>addServlet.</p> * * @param mountPoint a {@link java.lang.String} object. * @param servlet a {@link javax.servlet.Servlet} object. * @param contextParams a {@link java.util.Map} object. * @param paxWicketBundle a {@link org.osgi.framework.Bundle} object. */ public final void addServlet(String mountPoint, Servlet servlet, Map<?, ?> contextParams, Bundle paxWicketBundle) { mountPoint = GenericContext.normalizeMountPoint(mountPoint); ServletDescriptor descriptor = new ServletDescriptor(servlet, mountPoint, paxWicketBundle, contextParams); synchronized (servlets) { ServletDescriptor put = servlets.put(mountPoint, descriptor); if (put != null) { LOG.warn( "Two servlets are registered under the same mountpoint '{}' the first of them is overwritten by the second call", mountPoint); unregisterServletDescriptor(put); } registerServletDescriptor(descriptor); } }
/** {@inheritDoc} */ @Override public final void removedService(ServiceReference<HttpService> serviceReference, HttpService httpService) { // TODO This does not work well with multiple http services! synchronized (servlets) { for (ServletDescriptor servletDescriptor : servlets.values()) { unregisterServletDescriptor(servletDescriptor); } } super.removedService(serviceReference, httpService); }
final synchronized Servlet getServlet(String mountPoint) { mountPoint = normalizeMountPoint(mountPoint); ServletDescriptor descriptor = servlets.get(mountPoint); return descriptor.servlet; }
/** {@inheritDoc} */ @Override public final HttpService addingService(ServiceReference<HttpService> serviceReference) { // TODO This does not work well with multiple http services! httpService = super.addingService(serviceReference); synchronized (servlets) { for (ServletDescriptor servletDescriptor : servlets.values()) { registerServletDescriptor(servletDescriptor); } } return httpService; }
Servlet servlet = httpTracker.getServlet(oldMountPoint); FilterDelegator delegator = filterDelegators.get(reference); removedService(reference, service);
/** {@inheritDoc} */ @SuppressWarnings("unchecked") public final void start(BundleContext context) throws Exception { LOGGER .info("Pax Wicket makes uses of Decarative Services starting with this release. Make sure a suitable implementation (e.g. Felix SCR or Equinox DS) is present and started in your framework!"); LOGGER.debug("Initializing [{}] bundle.", context.getBundle().getSymbolicName()); bundleContext = context; httpTracker = new HttpTracker(context); httpTracker.open(); applicationFactoryTracker = new PaxWicketAppFactoryTracker(context, httpTracker); bundleTrackerAggregator = new BundleTrackerAggregator<WebApplicationFactory<?>>(context, WebApplicationFactory.class.getName(), null, applicationFactoryTracker); bundleTrackerAggregator.open(true); }
/** * <p>addServlet.</p> * * @param mountPoint a {@link java.lang.String} object. * @param servlet a {@link javax.servlet.Servlet} object. * @param contextParams a {@link java.util.Map} object. * @param paxWicketBundle a {@link org.osgi.framework.Bundle} object. */ public final void addServlet(String mountPoint, Servlet servlet, Map<?, ?> contextParams, Bundle paxWicketBundle) { mountPoint = GenericContext.normalizeMountPoint(mountPoint); ServletDescriptor descriptor = new ServletDescriptor(servlet, mountPoint, paxWicketBundle, contextParams); synchronized (servlets) { ServletDescriptor put = servlets.put(mountPoint, descriptor); if (put != null) { LOG.warn( "Two servlets are registered under the same mountpoint '{}' the first of them is overwritten by the second call", mountPoint); unregisterServletDescriptor(put); } registerServletDescriptor(descriptor); } }
/** {@inheritDoc} */ @Override public final void removedService(ServiceReference<HttpService> serviceReference, HttpService httpService) { // TODO This does not work well with multiple http services! synchronized (servlets) { for (ServletDescriptor servletDescriptor : servlets.values()) { unregisterServletDescriptor(servletDescriptor); } } super.removedService(serviceReference, httpService); }
final synchronized void removeServlet(String mountPoint) { mountPoint = normalizeMountPoint(mountPoint); if (servlets.remove(mountPoint) != null) { if (httpService != null) { httpService.unregister(mountPoint); } } }
/** {@inheritDoc} */ @Override public final HttpService addingService(ServiceReference<HttpService> serviceReference) { // TODO This does not work well with multiple http services! httpService = super.addingService(serviceReference); synchronized (servlets) { for (ServletDescriptor servletDescriptor : servlets.values()) { registerServletDescriptor(servletDescriptor); } } return httpService; }
/** {@inheritDoc} */ @SuppressWarnings("unchecked") public final void start(BundleContext context) throws Exception { LOGGER .info("Pax Wicket makes uses of Decarative Services starting with this release. Make sure a suitable implementation (e.g. Felix SCR or Equinox DS) is present and started in your framework!"); LOGGER.debug("Initializing [{}] bundle.", context.getBundle().getSymbolicName()); bundleContext = context; httpTracker = new HttpTracker(context); httpTracker.open(); applicationFactoryTracker = new PaxWicketAppFactoryTracker(context, httpTracker); bundleTrackerAggregator = new BundleTrackerAggregator<WebApplicationFactory<?>>(context, WebApplicationFactory.class.getName(), null, applicationFactoryTracker); bundleTrackerAggregator.open(true); }
private void removeApplication(ServiceReference<WebApplicationFactory<?>> reference) { PaxWicketApplicationFactory factory; synchronized (factories) { if (!factories.containsKey(reference)) { LOGGER .warn("Trying to unregister ApplicationFactory without application name or mount point is not possible"); return; } factory = factories.remove(reference); } LOGGER.debug("Service Removed [{}], Factory hash [{}]", reference, identityHashCode(factory)); httpTracker.removeServlet(factory.getMountPoint()); }
/** {@inheritDoc} */ public final void stop(BundleContext context) throws Exception { bundleTrackerAggregator.close(); httpTracker.close(); bundleContext = null; LOGGER.debug("Stopped [{}] bundle.", context.getBundle().getSymbolicName()); }
private void addServlet(String mountPoint, Servlet servlet, Map<?, ?> contextParam, ServiceReference<WebApplicationFactory<?>> appFactoryReference) { Bundle bundle = appFactoryReference.getBundle(); httpTracker.addServlet(mountPoint, servlet, contextParam, bundle); } }
/** * <p>removeServlet.</p> * * @param mountPoint a {@link java.lang.String} object. */ public final void removeServlet(String mountPoint) { mountPoint = GenericContext.normalizeMountPoint(mountPoint); synchronized (servlets) { ServletDescriptor remove = servlets.remove(mountPoint); if (remove != null) { unregisterServletDescriptor(remove); } } }
final void addServlet(String mountPoint, Servlet servlet, Map<?, ?> contextParams, Bundle paxWicketBundle) throws NamespaceException, ServletException { mountPoint = normalizeMountPoint(mountPoint); HttpContext httpContext = new GenericContext(paxWicketBundle, mountPoint); ServletDescriptor descriptor = new ServletDescriptor(servlet, httpContext); synchronized (this) { servlets.put(mountPoint, descriptor); } if (httpService != null) { httpService.registerServlet(mountPoint, servlet, contextParams == null ? null : MapAsDictionary.wrap(contextParams), httpContext); } }