Skip to content

Commit a6f14bc

Browse files
committed
Added SPI for obtaining the DispatcherType of a request
1 parent f9f5b9b commit a6f14bc

2 files changed

Lines changed: 69 additions & 0 deletions

File tree

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
/*
2+
* Copyright 2011 <a href="mailto:lincolnbaxter@gmail.com">Lincoln Baxter, III</a>
3+
*
4+
* Licensed under the Apache License, Version 2.0 (the "License");
5+
* you may not use this file except in compliance with the License.
6+
* You may obtain a copy of the License at
7+
*
8+
* http://www.apache.org/licenses/LICENSE-2.0
9+
*
10+
* Unless required by applicable law or agreed to in writing, software
11+
* distributed under the License is distributed on an "AS IS" BASIS,
12+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
* See the License for the specific language governing permissions and
14+
* limitations under the License.
15+
*/
16+
package org.ocpsoft.rewrite.servlet;
17+
18+
/**
19+
* Same as <code>javax.servlet.DispatcherType</code>. We are using our own enum because it is only available in Servlet
20+
* 3.0 and newer.
21+
*
22+
* @author Christian Kaltepoth
23+
*/
24+
public enum DispatcherType
25+
{
26+
FORWARD,
27+
INCLUDE,
28+
REQUEST,
29+
ASYNC,
30+
ERROR
31+
}
Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
/*
2+
* Copyright 2011 <a href="mailto:lincolnbaxter@gmail.com">Lincoln Baxter, III</a>
3+
*
4+
* Licensed under the Apache License, Version 2.0 (the "License");
5+
* you may not use this file except in compliance with the License.
6+
* You may obtain a copy of the License at
7+
*
8+
* http://www.apache.org/licenses/LICENSE-2.0
9+
*
10+
* Unless required by applicable law or agreed to in writing, software
11+
* distributed under the License is distributed on an "AS IS" BASIS,
12+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
* See the License for the specific language governing permissions and
14+
* limitations under the License.
15+
*/
16+
package org.ocpsoft.rewrite.servlet.spi;
17+
18+
import javax.servlet.ServletContext;
19+
import javax.servlet.ServletRequest;
20+
21+
import org.ocpsoft.common.pattern.Weighted;
22+
import org.ocpsoft.rewrite.servlet.DispatcherType;
23+
24+
/**
25+
* SPI for obtaining the {@link DispatcherType} of a request.
26+
*
27+
* @author Christian Kaltepoth
28+
*/
29+
public interface DispatcherTypeProvider extends Weighted
30+
{
31+
32+
/**
33+
* Returns the {@link DispatcherType} for the given request. MEthod must return <code>null</code> if the provider is
34+
* unable to reason about the dispatch type.
35+
*/
36+
DispatcherType getDispatcherType(ServletRequest request, ServletContext context);
37+
38+
}

0 commit comments

Comments
 (0)