xref: /OpenGrok/opengrok-web/src/main/webapp/projects.jspf (revision 5631d336b0af3cf36b42b98596d71b679aab5456)
1<%--
2$Id$
3
4CDDL HEADER START
5
6The contents of this file are subject to the terms of the
7Common Development and Distribution License (the "License").
8You may not use this file except in compliance with the License.
9
10See LICENSE.txt included in this distribution for the specific
11language governing permissions and limitations under the License.
12
13When distributing Covered Code, include this CDDL HEADER in each
14file and include the License file at LICENSE.txt.
15If applicable, add the following below this CDDL HEADER, with the
16fields enclosed by brackets "[]" replaced with your own identifying
17information: Portions Copyright [yyyy] [name of copyright owner]
18
19CDDL HEADER END
20
21Copyright (c) 2007, 2018, Oracle and/or its affiliates. All rights reserved.
22
23Portions Copyright 2011 Jens Elkner.
24Portions Copyright (c) 2018, Chris Fraire <cfraire@me.com>.
25
26--%>
27<%@page import="
28java.net.URLEncoder,
29java.nio.charset.StandardCharsets,
30org.opengrok.web.PageConfig
31"%><%
32/* ---------------------- projects.jspf start --------------------- */
33{
34    // Use UTF-8 if no encoding is specified in the request
35    if (request.getCharacterEncoding() == null) {
36        request.setCharacterEncoding("UTF-8");
37    }
38
39    PageConfig cfg = PageConfig.get(request);
40
41    String projects = cfg.getRequestedProjectsAsString();
42    if (projects.length() != 0) {
43        Cookie cookie = new Cookie(PageConfig.OPEN_GROK_PROJECT, URLEncoder.encode(projects, StandardCharsets.UTF_8));
44        response.addCookie(cookie);
45    }
46}
47/* ---------------------- projects.jspf end --------------------- */
48%>