Java Code Examples for javax.servlet.http.HttpServletRequest.isRequestedSessionIdFromURL()

The following are Jave code examples for showing how to use isRequestedSessionIdFromURL() of the javax.servlet.http.HttpServletRequest class. You can vote up the examples you like. Your votes will be used in our system to get more good examples.
Example 1
Project: oscm   File:   Source Code and License Vote up 6 votes
public void doFilter(ServletRequest req, ServletResponse res,
        FilterChain chain) throws IOException, ServletException {

    if (!(req instanceof HttpServletRequest)) {
        chain.doFilter(req, res);

    HttpServletRequest request = (HttpServletRequest) req;
    HttpServletResponse response = (HttpServletResponse) res;

    if (hasToBeFiltered(request) && request.isRequestedSessionIdFromURL()) {
        String url = request
                .append(request.getQueryString() != null ? "?"
                        + request.getQueryString() : "").toString();
        response.setHeader("Location", url);
    chain.doFilter(req, res);