Ejemplo n.º 1
0
 public String[] getDispatcherNames() {
   ArrayList<String> result = new ArrayList<String>();
   if ((dispatcherMapping & FORWARD) > 0) {
     result.add(DispatcherType.FORWARD.name());
   }
   if ((dispatcherMapping & INCLUDE) > 0) {
     result.add(DispatcherType.INCLUDE.name());
   }
   if ((dispatcherMapping & REQUEST) > 0) {
     result.add(DispatcherType.REQUEST.name());
   }
   if ((dispatcherMapping & ERROR) > 0) {
     result.add(DispatcherType.ERROR.name());
   }
   if ((dispatcherMapping & ASYNC) > 0) {
     result.add(DispatcherType.ASYNC.name());
   }
   return result.toArray(new String[result.size()]);
 }
Ejemplo n.º 2
0
  protected ServiceRegistration<?> createRestrictPortletServletRequestFilter(
      BundleContext bundleContext, String contextName, ClassLoader classLoader) {

    Dictionary<String, Object> properties = new HashMapDictionary<>();

    properties.put(HttpWhiteboardConstants.HTTP_WHITEBOARD_CONTEXT_SELECT, contextName);
    properties.put(HttpWhiteboardConstants.HTTP_WHITEBOARD_FILTER_ASYNC_SUPPORTED, Boolean.TRUE);
    properties.put(
        HttpWhiteboardConstants.HTTP_WHITEBOARD_FILTER_DISPATCHER,
        new String[] {
          DispatcherType.ASYNC.toString(),
          DispatcherType.FORWARD.toString(),
          DispatcherType.INCLUDE.toString(),
          DispatcherType.REQUEST.toString()
        });
    properties.put(HttpWhiteboardConstants.HTTP_WHITEBOARD_FILTER_PATTERN, "/*");

    return bundleContext.registerService(
        Filter.class, new RestrictPortletServletRequestFilter(), properties);
  }
Ejemplo n.º 3
0
  /**
   * This method will be used to set the current state of the FilterMap representing the state of
   * when filters should be applied.
   */
  public void setDispatcher(String dispatcherString) {
    String dispatcher = dispatcherString.toUpperCase(Locale.ENGLISH);

    if (dispatcher.equals(DispatcherType.FORWARD.name())) {
      // apply FORWARD to the global dispatcherMapping.
      dispatcherMapping |= FORWARD;
    } else if (dispatcher.equals(DispatcherType.INCLUDE.name())) {
      // apply INCLUDE to the global dispatcherMapping.
      dispatcherMapping |= INCLUDE;
    } else if (dispatcher.equals(DispatcherType.REQUEST.name())) {
      // apply REQUEST to the global dispatcherMapping.
      dispatcherMapping |= REQUEST;
    } else if (dispatcher.equals(DispatcherType.ERROR.name())) {
      // apply ERROR to the global dispatcherMapping.
      dispatcherMapping |= ERROR;
    } else if (dispatcher.equals(DispatcherType.ASYNC.name())) {
      // apply ERROR to the global dispatcherMapping.
      dispatcherMapping |= ASYNC;
    }
  }