package com.howgoodiwas.util;
import java.io.IOException;
import javax.servlet.Filter;
import javax.servlet.FilterChain;
import javax.servlet.FilterConfig;
import javax.servlet.ServletException;
import javax.servlet.ServletRequest;
import javax.servlet.ServletResponse;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import javax.servlet.http.HttpServletResponseWrapper;
/**
* Servlet filter which disables URL-encoded session identifiers.
*
*
* Copyright (c) 2006, Craig Condit. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
*
* * Redistributions of source code must retain the above copyright notice,
* this list of conditions and the following disclaimer.
* * Redistributions in binary form must reproduce the above copyright notice,
* this list of conditions and the following disclaimer in the documentation
* and/or other materials provided with the distribution.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
* LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
*
* Modified by Devon Hillard (devon@digitalsanctuary.com) to only filter for GoogleBot,
* not for users without cookies enabled.
*
*/
@SuppressWarnings("deprecation")
public class DisableUrlSessionFilter implements Filter {
/**
* The string to look for in the User-Agent header to identify the GoogleBot.
*/
private static final String GOOGLEBOT_AGENT_STRING = "googlebot";
/**
* The request header with the User-Agent information in it.
*/
private static final String USER_AGENT_HEADER_NAME = "User-Agent";
/**
* Filters requests to disable URL-based session identifiers.
*
* @param pRequest
* the request
* @param pResponse
* the response
* @param pChain
* the chain
*
* @throws IOException
* Signals that an I/O exception has occurred.
* @throws ServletException
* the servlet exception
*/
public void doFilter(final ServletRequest pRequest, final ServletResponse pResponse, final FilterChain pChain)
throws IOException, ServletException {
// skip non-http requests
if (!(pRequest instanceof HttpServletRequest)) {
pChain.doFilter(pRequest, pResponse);
return;
}
HttpServletRequest httpRequest = (HttpServletRequest) pRequest;
HttpServletResponse httpResponse = (HttpServletResponse) pResponse;
boolean isGoogleBot = false;
if (httpRequest != null) {
String userAgent = httpRequest.getHeader(USER_AGENT_HEADER_NAME);
if (StringUtils.isNotBlank(userAgent)) {
if (userAgent.toLowerCase().indexOf(GOOGLEBOT_AGENT_STRING) > -1) {
isGoogleBot = true;
}
}
}
if (isGoogleBot) {
// wrap response to remove URL encoding
HttpServletResponseWrapper wrappedResponse = new HttpServletResponseWrapper(httpResponse) {
@Override
public String encodeRedirectUrl(final String url) {
return url;
}
@Override
public String encodeRedirectURL(final String url) {
return url;
}
@Override
public String encodeUrl(final String url) {
return url;
}
@Override
public String encodeURL(final String url) {
return url;
}
};
// process next request in chain
pChain.doFilter(pRequest, wrappedResponse);
} else {
pChain.doFilter(pRequest, pResponse);
}
}
/**
* Unused.
*
* @param pConfig
* the config
*
* @throws ServletException
* the servlet exception
*/
public void init(final FilterConfig pConfig) throws ServletException {
}
/**
* Unused.
*/
public void destroy() {
}
}
‘Which are the bluebells?’ he asked. The reply came slowly. "No; her husband is quite another man; this man's wife has been dead for years. No, Charlotte Oliver lives in--hark!" Hetty sped from her hiding-place through the hall into the garden. The little green gate was open, and beyond the motor, once more in its black guise. Hetty stood there just a minute, wondering what next she should do. If there was only somebody near that she could confide in and send a message by! If she could only prevent Balmayne from starting on his mysterious errand! "You are wrong," she cried. "It could not have been so." "That is logical, at any rate. But to go further. You borrowed a man's coat to put over your shoulders. And the coat you borrowed was mine with the latchkey in the pocket. That I got from a footman. And when I came to look for my skeleton plot, it was gone. Then I knew where I had to search. Leona Lalage was at the bottom of the Corner House mystery. It was her hand that I had to force. Once that was done the rest was easy." "True? True, sir? You go and look for yourself! And let me tell you one thing—there are no francs-tireurs here! We know quite well what we may do and what not, and only a moment ago I received a message from the Minister of the Interior, saying that non-combatants who shoot at the enemy expose themselves to danger and their fellow-citizens to retaliations." This absolute separation of Form and Matter, under their new names of Thought and Extension, once grasped, various principles of Cartesianism will follow from it by logical necessity. First comes the exclusion of final causes from philosophy, or rather from Nature. There was not, as with Epicurus, any anti-theological feeling concerned in their rejection. With Aristotle, against whom Descartes is always protesting, the final cause was not a mark of designing intelligence imposed on Matter from without; it was only a particular aspect of Form, the realisation of what Matter was always striving after by virtue of its inherent potentiality. When Form was conceived only as pure thought, there could be no question of such a process; the most highly organised bodies being only modes of figured extension. The revival of Atomism had, no doubt, a great deal to do with the preference for a mechanical interpretation of life. Aristotle had himself shown with masterly clearness the difference between his view of Nature and that taken by Democritus; thus indicating beforehand the direction in which an alternative to his own teaching might be sought; and Bacon had, in fact, already referred with approval to the example set by Democritus in dealing with teleological enquiries. "Very well," answered the Deacon a little stiffly, for he was on his guard against cordial strangers. Reuben thought long and anxiously about his brother. He did not speak much of him to his mother or Naomi, for he knew that they would not understand the problem that confronted him. He felt worn by the extra load of work, and his brain fretted, spoiling his good sleep. He[Pg 53] was back in his own room now, but he slept worse than in Harry's; he would lie awake fighting mentally, just as all day he had fought physically—life was a continuous fight. Another trial to him now was that Robert seemed half-hearted. Hitherto he had always worked conscientiously and well, even though he had never been smart or particularly keen; but now he seemed to loaf and slack—he dawdled, slipped clear of what he could, and once he actually asked Reuben for wages! This was unheard-of—not one of Reuben's sons had ever dreamed of such a thing before. HoME一级柜配电线路图 高清
ENTER NUMBET 0016www.eryao.org.cn
gqlbj.com.cn
jhwywx.com.cn
www.mbsale.com.cn
htceoz.com.cn
www.tjfuwy.com.cn
www.rdsohh.com.cn
www.nmxdqm.com.cn
tonger.net.cn
www.mi2yodf.com.cn