Skip to content
Snippets Groups Projects
Commit 4d19cb7c authored by gmantele's avatar gmantele
Browse files

[TAP] Add the tap.TAP instance in attribute of the request for the Home Page when

forwarding toward a JSP file in the WebContent directory.

The name of the attribute is merely `tap`.
parent 0ea1f323
No related branches found
No related tags found
No related merge requests found
...@@ -2,21 +2,21 @@ package tap.resource; ...@@ -2,21 +2,21 @@ package tap.resource;
/* /*
* This file is part of TAPLibrary. * This file is part of TAPLibrary.
* *
* TAPLibrary is free software: you can redistribute it and/or modify * TAPLibrary is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as published by * it under the terms of the GNU Lesser General Public License as published by
* the Free Software Foundation, either version 3 of the License, or * the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version. * (at your option) any later version.
* *
* TAPLibrary is distributed in the hope that it will be useful, * TAPLibrary is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of * but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Lesser General Public License for more details. * GNU Lesser General Public License for more details.
* *
* You should have received a copy of the GNU Lesser General Public License * You should have received a copy of the GNU Lesser General Public License
* along with TAPLibrary. If not, see <http://www.gnu.org/licenses/>. * along with TAPLibrary. If not, see <http://www.gnu.org/licenses/>.
* *
* Copyright 2015-2016 - Astronomisches Rechen Institut (ARI) * Copyright 2015-2018 - Astronomisches Rechen Institut (ARI)
*/ */
import java.io.IOException; import java.io.IOException;
...@@ -34,25 +34,25 @@ import uws.UWSToolBox; ...@@ -34,25 +34,25 @@ import uws.UWSToolBox;
/** /**
* <p>Write the content of the TAP service's home page.</p> * <p>Write the content of the TAP service's home page.</p>
* *
* <p><i>Note: * <p><i>Note:
* This class is using the two following {@link TAP} attributes in order to display the home page: * This class is using the two following {@link TAP} attributes in order to display the home page:
* {@link TAP#homePageURI} and {@link TAP#homePageMimeType}. The MIME type is used only for the third case below (local file). * {@link TAP#homePageURI} and {@link TAP#homePageMimeType}. The MIME type is used only for the third case below (local file).
* </i></p> * </i></p>
* *
* <p> * <p>
* The home page URI is expected to be either relative/absolute path (both related to the Web Application * The home page URI is expected to be either relative/absolute path (both related to the Web Application
* directory, NOT the local file system), a <code>file:</code> URI (pointing toward a local file system file) * directory, NOT the local file system), a <code>file:</code> URI (pointing toward a local file system file)
* or a URL (basically any URI whose the scheme is not <code>file:</code>). * or a URL (basically any URI whose the scheme is not <code>file:</code>).
* </p> * </p>
* *
* <p> * <p>
* To read/write the specified file, this class extends {@link ForwardResource} in order to use its function * To read/write the specified file, this class extends {@link ForwardResource} in order to use its function
* {@link ForwardResource#forward(String, String, HttpServletRequest, HttpServletResponse)}. * {@link ForwardResource#forward(String, String, HttpServletRequest, HttpServletResponse)}.
* </p> * </p>
* *
* @author Gr&eacute;gory Mantelet (ARI) * @author Gr&eacute;gory Mantelet (ARI)
* @version 2.1 (09/2016) * @version 2.3 (04/2018)
* @since 2.0 * @since 2.0
*/ */
public class HomePage extends ForwardResource { public class HomePage extends ForwardResource {
...@@ -84,6 +84,9 @@ public class HomePage extends ForwardResource { ...@@ -84,6 +84,9 @@ public class HomePage extends ForwardResource {
@Override @Override
public boolean executeResource(final HttpServletRequest request, final HttpServletResponse response) throws IOException, TAPException{ public boolean executeResource(final HttpServletRequest request, final HttpServletResponse response) throws IOException, TAPException{
// Share the TAP instance with JSPs:
request.setAttribute("tap", tap);
// Try by default a forward toward the specified file: // Try by default a forward toward the specified file:
boolean written = forward(tap.homePageURI, tap.homePageMimeType, request, response); boolean written = forward(tap.homePageURI, tap.homePageMimeType, request, response);
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment