Package org.ocpsoft.rewrite.servlet.http.event

Examples of org.ocpsoft.rewrite.servlet.http.event.HttpServletRewrite


   @Override
   public boolean evaluate(final Rewrite event, final EvaluationContext context)
   {
      if (event instanceof HttpInboundServletRewrite && rule.isInbound() && PFUtil.isRewritingEnabled(event))
      {
         HttpServletRewrite httpRewrite = (HttpServletRewrite) event;
         String path = httpRewrite.getInboundAddress().getPath();

         String url = URL.build(path).decode().toURL()
                  + QueryString.build(httpRewrite.getInboundAddress().getQuery()).toQueryString();

         String contextPath = httpRewrite.getContextPath();
         if (!contextPath.equals("/") && url.startsWith(contextPath))
            url = url.substring(contextPath.length());

         if (rule.matches(url))
         {
View Full Code Here


   @Override
   public void perform(final Rewrite event, final EvaluationContext context)
   {
      RewriteEngine engine = new RewriteEngine();
      HttpServletRewrite httpRewrite = (HttpServletRewrite) event;
      String originalUrl = httpRewrite.getInboundAddress().getPath();

      originalUrl = URL.build(originalUrl).decode().toURL()
               + QueryString.build(httpRewrite.getInboundAddress().getQuery()).toQueryString();

      String contextPath = ((HttpServletRewrite) event).getContextPath();
      if (!contextPath.equals("/") && originalUrl.startsWith(contextPath))
         originalUrl = originalUrl.substring(contextPath.length());
View Full Code Here

   }

   @Override
   public boolean evaluateHttp(HttpServletRewrite event, EvaluationContext context)
   {
      HttpServletRewrite rewrite = event;

      // check if user has all required roles
      for (String role : roles) {
         if (!rewrite.getRequest().isUserInRole(role)) {
            return false;
         }
      }

      return true;
View Full Code Here

   @Override
   public void finishStreamWrappers()
   {
      if (isResponseStreamWrapped())
      {
         HttpServletRewrite event = new HttpBufferRewriteImpl(request, this, servletContext);
         for (ResponseStreamWrapper wrapper : responseStreamWrappers) {
            wrapper.finish(event);
         }
      }
   }
View Full Code Here

         if (isResponseStreamWrapped())
         {
            if (wrappedOutputStream == null)
            {
               HttpServletRewrite event = new HttpBufferRewriteImpl(request, this, servletContext);

               try {
                  OutputStream wrapped = super.getOutputStream();
                  for (ResponseStreamWrapper wrapper : responseStreamWrappers) {
                     wrapped = wrapper.wrap(event, wrapped);
View Full Code Here

TOP

Related Classes of org.ocpsoft.rewrite.servlet.http.event.HttpServletRewrite

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.