additional change to cause crawlers to never get munged URLs, always get the

raw servlet URL
This commit is contained in:
Eric J. Bowersox 2004-11-06 02:20:58 +00:00
parent 2b12c944d9
commit 17c12459a5
4 changed files with 53 additions and 3 deletions

View File

@ -31,6 +31,9 @@ if (binfo.hasCapability("crawler") || binfo.hasCapability("stripper"))
logger.debug("this session is a crawler, it will be killed"); logger.debug("this session is a crawler, it will be killed");
sess.setMaxInactiveInterval(30); sess.setMaxInactiveInterval(30);
// don't encode any servlet paths we send
rinput.setSpecial("No-Session-Encode","true");
// the session will be killed at the end of the request anyway // the session will be killed at the end of the request anyway
rinput.registerCleanup(new SessionKiller(sess)); rinput.registerCleanup(new SessionKiller(sess));

View File

@ -364,4 +364,6 @@ public interface RequestInput extends ServiceProvider
public String getConfigProperty(String name, String default_val); public String getConfigProperty(String name, String default_val);
public void setSpecial(String name, String value);
} // end interface RequestInput } // end interface RequestInput

View File

@ -17,10 +17,18 @@
*/ */
package com.silverwrist.venice.ui.helpers; package com.silverwrist.venice.ui.helpers;
import org.apache.log4j.Logger;
import com.silverwrist.venice.ui.*; import com.silverwrist.venice.ui.*;
public class SessionKiller implements AutoCleanup public class SessionKiller implements AutoCleanup
{ {
/*--------------------------------------------------------------------------------
* Static data members
*--------------------------------------------------------------------------------
*/
private static Logger logger = Logger.getLogger(SessionKiller.class);
/*-------------------------------------------------------------------------------- /*--------------------------------------------------------------------------------
* Attributes * Attributes
*-------------------------------------------------------------------------------- *--------------------------------------------------------------------------------
@ -46,6 +54,8 @@ public class SessionKiller implements AutoCleanup
public void cleanup() public void cleanup()
{ {
if (logger.isDebugEnabled())
logger.debug("SessionKiller killing session " + m_sess.getID());
m_sess.invalidate(); m_sess.invalidate();
} // end cleanup } // end cleanup

View File

@ -453,9 +453,26 @@ public class RequestImpl implements RequestInput
if (type==ABSOLUTE) if (type==ABSOLUTE)
fmt_url = where; fmt_url = where;
else if (type==SERVLET) else if (type==SERVLET)
fmt_url = response.encodeRedirectURL(request.getContextPath() + "/" + where); { // servlet
fmt_url = request.getContextPath() + "/" + where;
if (!m_no_session_encode)
fmt_url = response.encodeRedirectURL(fmt_url);
} // end else if
else if (type==FRAME) else if (type==FRAME)
fmt_url = response.encodeRedirectURL(request.getContextPath() + "/frame/" + where); { // frame
fmt_url = request.getContextPath() + "/frame/" + where;
if (!m_no_session_encode)
fmt_url = response.encodeRedirectURL(fmt_url);
} // end else if
else if (type==FULLSERVLET)
{ // full servlet
fmt_url = expandServletPath(where,false);
if (!m_no_session_encode)
fmt_url = response.encodeRedirectURL(fmt_url);
} // end else if
else else
throw new IndexOutOfBoundsException("invalid format type index for redirect"); throw new IndexOutOfBoundsException("invalid format type index for redirect");
@ -595,6 +612,7 @@ public class RequestImpl implements RequestInput
private ScriptSupportImpl script_support = null; // script support interface private ScriptSupportImpl script_support = null; // script support interface
private ResourceLoaderImpl m_resource_loader = null; // resource loader interface private ResourceLoaderImpl m_resource_loader = null; // resource loader interface
private BrowserInformationImpl m_browser_info = null; // browser information interface private BrowserInformationImpl m_browser_info = null; // browser information interface
private boolean m_no_session_encode = false; // override session encoding?
/*-------------------------------------------------------------------------------- /*--------------------------------------------------------------------------------
* Constructor * Constructor
@ -838,7 +856,10 @@ public class RequestImpl implements RequestInput
final String encodeServletPath(String servlet) final String encodeServletPath(String servlet)
{ {
return response.encodeURL(request.getContextPath() + "/" + servlet); if (m_no_session_encode)
return request.getContextPath() + "/" + servlet;
else
return response.encodeURL(request.getContextPath() + "/" + servlet);
} // end encodeServletPath } // end encodeServletPath
@ -1638,6 +1659,20 @@ public class RequestImpl implements RequestInput
} // end getConfigProperty } // end getConfigProperty
public void setSpecial(String name, String value)
{
if (name.equals("No-Session-Encode"))
{ // the special name "No-Session-Encode"
if (StringUtil.isBooleanTrue(value))
m_no_session_encode = true;
else if (StringUtil.isBooleanFalse(value))
m_no_session_encode = false;
return;
} // end if
} // end setSpecial
/*-------------------------------------------------------------------------------- /*--------------------------------------------------------------------------------
* External static operations * External static operations
*-------------------------------------------------------------------------------- *--------------------------------------------------------------------------------