322683 made RewriteHandler thread safe
git-svn-id: svn+ssh://dev.eclipse.org/svnroot/rt/org.eclipse.jetty/jetty/trunk@2211 7e9141cc-0065-0410-87d8-b60c137991c4
This commit is contained in:
parent
c0510118a4
commit
db2f4cbcb2
|
@ -11,6 +11,7 @@ jetty-7.2-SNAPSHOT
|
|||
+ 321232 BasicAuthenticator ignores bad Authorization header.
|
||||
+ 321307 HashSessionManager calls passivation listeners.
|
||||
+ 321730 SelectChannelEndPoint prints to System.err
|
||||
+ 322683 RewriteHandler thread safety
|
||||
+ JETTY-912 added per exchange timeout api
|
||||
+ JETTY-1245 Do not use direct buffers with NIO SSL
|
||||
+ JETTY-1249 Apply max idle time to all connectors
|
||||
|
|
|
@ -38,6 +38,7 @@ public class LegacyRule extends Rule
|
|||
}
|
||||
|
||||
/* ------------------------------------------------------------ */
|
||||
@Override
|
||||
public String matchAndApply(String target, HttpServletRequest request, HttpServletResponse response) throws IOException
|
||||
{
|
||||
Map.Entry<?,?> rewrite =_rewrite.getMatch(target);
|
||||
|
|
|
@ -182,6 +182,7 @@ public class RewriteHandler extends HandlerWrapper
|
|||
*
|
||||
* @param legacyRule old style rewrite rule
|
||||
*/
|
||||
@Deprecated
|
||||
public void setLegacyRule(LegacyRule legacyRule)
|
||||
{
|
||||
_rules.setLegacyRule(legacyRule);
|
||||
|
@ -227,7 +228,6 @@ public class RewriteHandler extends HandlerWrapper
|
|||
_rules.addRule(rule);
|
||||
}
|
||||
|
||||
|
||||
/* ------------------------------------------------------------ */
|
||||
/**
|
||||
* @return the rewriteRequestURI If true, this handler will rewrite the value
|
||||
|
@ -289,37 +289,11 @@ public class RewriteHandler extends HandlerWrapper
|
|||
}
|
||||
|
||||
|
||||
/* ------------------------------------------------------------ */
|
||||
/**
|
||||
* @deprecated
|
||||
*/
|
||||
public PathMap getRewrite()
|
||||
{
|
||||
return _rules.getRewrite();
|
||||
}
|
||||
|
||||
/* ------------------------------------------------------------ */
|
||||
/**
|
||||
* @deprecated
|
||||
*/
|
||||
public void setRewrite(PathMap rewrite)
|
||||
{
|
||||
_rules.setRewrite(rewrite);
|
||||
}
|
||||
|
||||
/* ------------------------------------------------------------ */
|
||||
/**
|
||||
* @deprecated
|
||||
*/
|
||||
public void addRewriteRule(String pattern, String prefix)
|
||||
{
|
||||
_rules.addRewriteRule(pattern,prefix);
|
||||
}
|
||||
|
||||
/* ------------------------------------------------------------ */
|
||||
/* (non-Javadoc)
|
||||
* @see org.eclipse.jetty.server.handler.HandlerWrapper#handle(java.lang.String, javax.servlet.http.HttpServletRequest, javax.servlet.http.HttpServletResponse, int)
|
||||
*/
|
||||
@Override
|
||||
public void handle(String target, Request baseRequest, HttpServletRequest request, HttpServletResponse response) throws IOException, ServletException
|
||||
{
|
||||
if (isStarted())
|
||||
|
@ -327,10 +301,8 @@ public class RewriteHandler extends HandlerWrapper
|
|||
String returned = _rules.matchAndApply(target, request, response);
|
||||
target = (returned == null) ? target : returned;
|
||||
|
||||
if (!_rules.isHandled())
|
||||
{
|
||||
if (!baseRequest.isHandled())
|
||||
super.handle(target, baseRequest, request, response);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -34,7 +34,6 @@ import org.eclipse.jetty.util.log.Log;
|
|||
public class RuleContainer extends Rule
|
||||
{
|
||||
protected Rule[] _rules;
|
||||
protected boolean _handled;
|
||||
|
||||
protected String _originalPathAttribute;
|
||||
protected boolean _rewriteRequestURI=true;
|
||||
|
@ -43,7 +42,8 @@ public class RuleContainer extends Rule
|
|||
protected LegacyRule _legacy;
|
||||
|
||||
/* ------------------------------------------------------------ */
|
||||
private LegacyRule getLegacyRule()
|
||||
@Deprecated
|
||||
public LegacyRule getLegacyRule()
|
||||
{
|
||||
if (_legacy==null)
|
||||
{
|
||||
|
@ -61,6 +61,7 @@ public class RuleContainer extends Rule
|
|||
*
|
||||
* @param legacyRule old style rewrite rule
|
||||
*/
|
||||
@Deprecated
|
||||
public void setLegacyRule(LegacyRule legacyRule)
|
||||
{
|
||||
_legacy = legacyRule;
|
||||
|
@ -166,53 +167,6 @@ public class RuleContainer extends Rule
|
|||
_originalPathAttribute=originalPathAttribte;
|
||||
}
|
||||
|
||||
|
||||
/* ------------------------------------------------------------ */
|
||||
/**
|
||||
* @deprecated
|
||||
*/
|
||||
public PathMap getRewrite()
|
||||
{
|
||||
return getLegacyRule().getRewrite();
|
||||
}
|
||||
|
||||
/* ------------------------------------------------------------ */
|
||||
/**
|
||||
* @deprecated
|
||||
*/
|
||||
public void setRewrite(PathMap rewrite)
|
||||
{
|
||||
getLegacyRule().setRewrite(rewrite);
|
||||
}
|
||||
|
||||
/* ------------------------------------------------------------ */
|
||||
/**
|
||||
* @deprecated
|
||||
*/
|
||||
public void addRewriteRule(String pattern, String prefix)
|
||||
{
|
||||
getLegacyRule().addRewriteRule(pattern,prefix);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @return handled true if one of the rules within the rule container is handling the request
|
||||
*/
|
||||
public boolean isHandled()
|
||||
{
|
||||
return _handled;
|
||||
}
|
||||
|
||||
/*------------------------------------------------------------ */
|
||||
/**
|
||||
* @param handled true if one of the rules within the rule container is handling the request
|
||||
*/
|
||||
public void setHandled(boolean handled)
|
||||
{
|
||||
_handled=handled;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Process the contained rules
|
||||
* @param target target field to pass on to the contained rules
|
||||
|
@ -233,8 +187,6 @@ public class RuleContainer extends Rule
|
|||
*/
|
||||
protected String apply(String target, HttpServletRequest request, HttpServletResponse response) throws IOException
|
||||
{
|
||||
_handled=false;
|
||||
|
||||
boolean original_set=_originalPathAttribute==null;
|
||||
|
||||
for (Rule rule : _rules)
|
||||
|
@ -264,7 +216,6 @@ public class RuleContainer extends Rule
|
|||
if (rule.isHandling())
|
||||
{
|
||||
Log.debug("handling {}",rule);
|
||||
_handled=true;
|
||||
(request instanceof Request?(Request)request:HttpConnection.getCurrentConnection().getRequest()).setHandled(true);
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue