Start line:  
End line:  

Snippet Preview

Snippet HTML Code

Stack Overflow Questions
 /*
  * Copyright 2011 <a href="mailto:lincolnbaxter@gmail.com">Lincoln Baxter, III</a>
  * 
  * Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.
  * You may obtain a copy of the License at
  * 
  *     http://www.apache.org/licenses/LICENSE-2.0
  * 
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */
package org.ocpsoft.rewrite.config.tuckey;
import  org.tuckey.web.filters.urlrewrite.UrlRewriter;

Author(s):
Lincoln Baxter, III
public class TuckeyRewriteRuleAdaptor implements Rule
   private final UrlRewriter rewriter;
   public TuckeyRewriteRuleAdaptor(final UrlRewriter urlRewriter)
   {
      this. = urlRewriter;
   }
   @Override
   public boolean evaluate(final Rewrite eventfinal EvaluationContext context)
   {
      return Direction.isInbound().evaluate(eventcontext);
   }
   @Override
   public void perform(final Rewrite eventfinal EvaluationContext context)
   {
      new HttpOperation() {
         boolean forwarded = false;
         @Override
         public void performHttp(final HttpServletRewrite eventfinal EvaluationContext context)
         {
            try {
               FilterChain filterChainAdaptor = new FilterChain() {
                  @Override
                  public void doFilter(final ServletRequest requestfinal ServletResponse response)
                           throws IOExceptionServletException
                  {
                      = true;
                  }
               };
               if (.processRequest(event.getRequest(), event.getResponse(), filterChainAdaptor))
               {
                  if ()
                     event.handled();
                  else
                     event.abort();
               }
            }
            catch (Exception e) {
               throw new RewriteException("Error processing [" + this.getClass().getName() + "]"e);
            }
         }
      }.perform(eventcontext);
   }
   @Override
   public String getId()
   {
      return "tuckey-" + hashCode();
   }
New to GrepCode? Check out our FAQ X