Guest User

Untitled

a guest
Jul 2nd, 2012
63
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.25 KB | None | 0 0
  1. package com.dotmarketing.osgi.controller;
  2.  
  3. import org.osgi.framework.BundleActivator;
  4. import org.osgi.framework.BundleContext;
  5. import org.osgi.framework.ServiceReference;
  6. import org.osgi.service.http.HttpService;
  7. import org.springframework.web.servlet.DispatcherServlet;
  8.  
  9. import com.dotmarketing.filters.CMSFilter;
  10.  
  11. /**
  12. * Created by Jonathan Gamba
  13. * Date: 6/18/12
  14. */
  15. public class Activator implements BundleActivator {
  16.  
  17. @SuppressWarnings ("unchecked")
  18. public void start ( BundleContext context ) throws Exception {
  19.  
  20. ServiceReference sRef = context.getServiceReference( HttpService.class.getName() );
  21. if ( sRef != null ) {
  22.  
  23. HttpService service = (HttpService) context.getService( sRef );
  24. try {
  25. DispatcherServlet ds = new DispatcherServlet();
  26. ds.setContextConfigLocation( "spring/example-servlet.xml" );
  27. service.registerServlet( "/spring", ds, null, null );
  28. } catch ( Exception e ) {
  29. e.printStackTrace();
  30. }
  31. CMSFilter.addExclude("/dynmaic/spring");
  32. }
  33. }
  34.  
  35. public void stop ( BundleContext context ) throws Exception {
  36. CMSFilter.removeExclude("/dynmaic/spring");
  37. }
  38.  
  39. }
Advertisement
Add Comment
Please, Sign In to add comment