Start line:  
End line:  

Snippet Preview

Snippet HTML Code

Stack Overflow Questions
  /*
   * JBoss, Home of Professional Open Source.
   * Copyright 2014 Red Hat, Inc., and individual contributors
   * as indicated by the @author tags.
   *
   * 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 io.undertow.servlet.handlers;

Author(s):
Stuart Douglas
 
 public class ServletPathMatch {
 
     private final String matched;
     private final String remaining;
     private final boolean requiredWelcomeFileMatch;
     private final ServletChain servletChain;
     private final String rewriteLocation;
     private final Type type;
 
     public ServletPathMatch(final ServletChain targetfinal String uriboolean requiredWelcomeFileMatch) {
         this. = target;
         this. = requiredWelcomeFileMatch;
         this. = .;
         this. = null;
         if (target.getServletPath() == null) {
             //the default servlet is always considered to have matched the full path.
             this. = uri;
             this. = null;
         } else {
             this. = target.getServletPath();
             if(uri.length() == .length()) {
                  = null;
             } else {
                  = uri.substring(.length());
             }
         }
     }
 
     public ServletPathMatch(final ServletChain targetfinal String matchedfinal String remainingfinal Type typefinal String rewriteLocation) {
         this. = target;
         this. = matched;
         this. = remaining;
         this. = false;
         this. = type;
         this. = rewriteLocation;
     }
 
     public String getMatched() {
         return ;
     }
 
     public String getRemaining() {
         return ;
     }
 
     public boolean isRequiredWelcomeFileMatch() {
         return ;
     }
 
     public ServletChain getServletChain() {
         return ;
     }
 
     public String getRewriteLocation() {
         return ;
     }
 
     public Type getType() {
         return ;
     }
 
     public static enum Type {
        
A normal servlet match, the invocation should proceed as normal
 
         NORMAL,
        
A redirect is required, as the path does not end with a trailing slash
 
         REDIRECT,
        
An internal rewrite is required, because the path matched a welcome file. The provided match data is the match data after the rewrite.
 
         REWRITE;
     }
New to GrepCode? Check out our FAQ X