Compare commits
10 Commits
master
...
deploy_tes
Author | SHA1 | Date |
---|---|---|
Robert Vokac | 0bfd386456 | |
Robert Vokac | 09af6209fb | |
Robert Vokac | 6ced20e88a | |
Robert Vokac | 08ed752740 | |
Robert Vokac | ac55acfc49 | |
Robert Vokac | b5c0bc131d | |
Robert Vokac | 7b59ed7aab | |
Robert Vokac | b2ab35f1c1 | |
Robert Vokac | d6e50d50f2 | |
Robert Vokac | 125a206126 |
|
@ -0,0 +1,147 @@
|
|||
pipeline
|
||||
/*
|
||||
|
||||
Nanodata
|
||||
|
||||
Requirements:
|
||||
|
||||
Following variables are set in Jenkins:
|
||||
* TOMCAT10_HOME
|
||||
* TOMCAT10_TEST_HOME
|
||||
|
||||
Maven is Installed
|
||||
|
||||
Java 21 is installed - variable JAVA_21_HOME is set
|
||||
|
||||
Following Systemd services are installed:
|
||||
tomcat10
|
||||
tomcat10test
|
||||
|
||||
*/
|
||||
{
|
||||
agent any
|
||||
environment {
|
||||
AAA = 'aaa'
|
||||
}
|
||||
stages
|
||||
{
|
||||
stage('Build')
|
||||
{
|
||||
steps {
|
||||
|
||||
echo "*** Building ${env.JOB_NAME} ***"
|
||||
sh '''
|
||||
#!/bin/bash
|
||||
echo JOB_NAME=$JOB_NAME
|
||||
|
||||
if [ -z "$JAVA_21_HOME" ]
|
||||
then
|
||||
echo "KO : Variable JAVA_21_HOME is empty. You fix this issue by adding this variable to configuration of Jenkins."
|
||||
exit 1
|
||||
else
|
||||
echo "OK : Variable JAVA_21_HOME is NOT empty"
|
||||
fi
|
||||
export JAVA_HOME=$JAVA_21_HOME
|
||||
|
||||
mvn clean install -X
|
||||
|
||||
echo "Build of $JOB_NAME was successful"
|
||||
'''
|
||||
}
|
||||
}
|
||||
|
||||
stage('Deploy')
|
||||
{
|
||||
steps {
|
||||
echo "*** Deploying ${env.JOB_NAME} ***"
|
||||
|
||||
sh '''
|
||||
#!/bin/bash
|
||||
|
||||
#echo "Nothing to do"
|
||||
#exit
|
||||
|
||||
if [ -z "$TOMCAT10_HOME" ]
|
||||
then
|
||||
echo "KO : Variable TOMCAT10_HOME is empty. You fix this issue by adding this variable to configuration of Jenkins."
|
||||
exit 1
|
||||
else
|
||||
echo "OK : Variable TOMCAT10_HOME is NOT empty"
|
||||
fi
|
||||
|
||||
if [ -z "$TOMCAT10_TEST_HOME" ]
|
||||
then
|
||||
echo "KO : Variable TOMCAT10_TEST_HOME is empty. You fix this issue by adding this variable to configuration of Jenkins."
|
||||
exit 1
|
||||
else
|
||||
echo "OK : Variable TOMCAT10_TEST_HOME is NOT empty"
|
||||
fi
|
||||
|
||||
case $BRANCH_NAME in
|
||||
|
||||
master | deploy_prod)
|
||||
echo Branch $BRANCH_NAME is supported. Continuing.
|
||||
TOMCAT_HOME=$TOMCAT10_HOME
|
||||
systemdService=tomcat10
|
||||
;;
|
||||
|
||||
develop | jenkins | deploy_test | feature/octagon)
|
||||
echo Branch $BRANCH_NAME is supported. Continuing.
|
||||
TOMCAT_HOME=$TOMCAT10_TEST_HOME
|
||||
systemdService=tomcat10test
|
||||
;;
|
||||
|
||||
*)
|
||||
echo Branch $BRANCH_NAME is not supported. A failure happened. Exiting.
|
||||
exit 1
|
||||
;;
|
||||
esac
|
||||
|
||||
mv nanodata-web/target/nanodata-web-*.war nanodata.war
|
||||
|
||||
|
||||
currentDir=`pwd`&&cd $TOMCAT_HOME/bin
|
||||
#./catalina.sh stop
|
||||
sudo systemctl stop $systemdService
|
||||
sleep 5
|
||||
|
||||
if [ -f "$TOMCAT_HOME/webapps/nanodata.war" ]; then
|
||||
rm $TOMCAT_HOME/webapps/nanodata.war
|
||||
fi
|
||||
|
||||
if [ -f "$TOMCAT_HOME/webapps/nanodata" ]; then
|
||||
rm -r $TOMCAT_HOME/webapps/nanodata
|
||||
fi
|
||||
mv $currentDir/nanodata.war $TOMCAT_HOME/webapps
|
||||
|
||||
#(
|
||||
# set -e
|
||||
# export BUILD_ID=dontKillMe
|
||||
# export JENKINS_NODE_COOKIE=dontKillMe
|
||||
# ./catalina.sh start &
|
||||
#) &
|
||||
sudo systemctl start $systemdService
|
||||
|
||||
cd $currentDir
|
||||
|
||||
'''
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
post {
|
||||
always {
|
||||
script {
|
||||
env.color = "${currentBuild.currentResult == 'SUCCESS' ? 'green' : 'red'}"
|
||||
}
|
||||
|
||||
echo 'Sending e-mail.'
|
||||
sh "printenv | sort"
|
||||
emailext body: "<b style=\"color:$COLOR\">${currentBuild.currentResult}</b> - ${env.JOB_NAME} (#${env.BUILD_NUMBER})<br> <ul style=\"margin-top:2px;padding-top:2px;padding-left:30px;\"><li>More info at: <a href=\"${env.BUILD_URL}\">${env.BUILD_URL}</a></li></ul>",
|
||||
recipientProviders: [[$class: 'DevelopersRecipientProvider'], [$class: 'RequesterRecipientProvider']],
|
||||
subject: "Jenkins Build - ${currentBuild.currentResult} - $JOB_NAME (#$BUILD_NUMBER)"
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -23,7 +23,7 @@
|
|||
<parent>
|
||||
<groupId>org.nanoboot.nanodata</groupId>
|
||||
<artifactId>nanodata-parent</artifactId>
|
||||
<version>0.0.0</version>
|
||||
<version>0.0.1-SNAPSHOT</version>
|
||||
<relativePath>../pom.xml</relativePath>
|
||||
</parent>
|
||||
|
||||
|
|
|
@ -32,7 +32,7 @@ import lombok.ToString;
|
|||
@Data
|
||||
@AllArgsConstructor
|
||||
@ToString
|
||||
public class Statement {
|
||||
public class Statement implements Comparable<Statement>{
|
||||
|
||||
private String id;
|
||||
private String value;
|
||||
|
@ -40,4 +40,49 @@ public class Statement {
|
|||
private String target;
|
||||
private String createdAt;
|
||||
private String flags;
|
||||
|
||||
@Override
|
||||
public int compareTo(Statement o) {
|
||||
String flags1 = this.flags == null ? "" : this.flags;
|
||||
String flags2 = o.flags == null ? "" : o.flags;
|
||||
if(flags1.isBlank() && !flags2.isBlank()) {
|
||||
return -1;
|
||||
}
|
||||
if(!flags1.isBlank() && flags2.isBlank()) {
|
||||
return 1;
|
||||
}
|
||||
|
||||
if(flags1.isBlank() && flags2.isBlank()) {
|
||||
return 0;
|
||||
}
|
||||
if(!flags1.isBlank() && !flags2.isBlank()) {
|
||||
Integer flags1Int = switch(flags1) {
|
||||
case HIGHEST -> 5;
|
||||
case HIGH -> 4;
|
||||
case MEDIUM -> 3;
|
||||
case LOW -> 2;
|
||||
case LOWEST -> 1;
|
||||
case NONE -> 0;
|
||||
default -> 3;
|
||||
};
|
||||
Integer flags2Int = switch(flags2) {
|
||||
case HIGHEST -> 5;
|
||||
case HIGH -> 4;
|
||||
case MEDIUM -> 3;
|
||||
case LOW -> 2;
|
||||
case LOWEST -> 1;
|
||||
case NONE -> 0;
|
||||
default -> 3;
|
||||
};
|
||||
return flags1Int.compareTo(flags2Int);
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
private static final String HIGHEST = "highest";
|
||||
private static final String HIGH = "high";
|
||||
private static final String MEDIUM = "medium";
|
||||
private static final String LOW = "low";
|
||||
private static final String LOWEST = "lowest";
|
||||
private static final String NONE = "none";
|
||||
|
||||
}
|
||||
|
|
|
@ -23,7 +23,7 @@
|
|||
<parent>
|
||||
<groupId>org.nanoboot.nanodata</groupId>
|
||||
<artifactId>nanodata-parent</artifactId>
|
||||
<version>0.0.0</version>
|
||||
<version>0.0.1-SNAPSHOT</version>
|
||||
<relativePath>../pom.xml</relativePath>
|
||||
</parent>
|
||||
|
||||
|
|
|
@ -23,7 +23,7 @@
|
|||
<parent>
|
||||
<groupId>org.nanoboot.nanodata</groupId>
|
||||
<artifactId>nanodata-parent</artifactId>
|
||||
<version>0.0.0</version>
|
||||
<version>0.0.1-SNAPSHOT</version>
|
||||
<relativePath>../pom.xml</relativePath>
|
||||
</parent>
|
||||
|
||||
|
@ -52,7 +52,7 @@
|
|||
<plugin>
|
||||
<groupId>org.codehaus.mojo</groupId>
|
||||
<artifactId>build-helper-maven-plugin</artifactId>
|
||||
<version>3.2.0</version>
|
||||
<version>${build-helper-maven-plugin.version}</version>
|
||||
<executions>
|
||||
<execution>
|
||||
<id>add-resource</id>
|
||||
|
|
|
@ -24,7 +24,7 @@
|
|||
<parent>
|
||||
<groupId>org.nanoboot.nanodata</groupId>
|
||||
<artifactId>nanodata-parent</artifactId>
|
||||
<version>0.0.0</version>
|
||||
<version>0.0.1-SNAPSHOT</version>
|
||||
<relativePath>../pom.xml</relativePath>
|
||||
</parent>
|
||||
|
||||
|
@ -162,6 +162,13 @@
|
|||
<!-- <artifactId>log4j-slf4j-impl</artifactId>-->
|
||||
<!-- <version>2.11.2</version>-->
|
||||
<!-- </dependency>-->
|
||||
|
||||
<dependency>
|
||||
<groupId>org.nanoboot.octagon</groupId>
|
||||
<artifactId>octagon-jakarta</artifactId>
|
||||
<version>${octagon.version}</version>
|
||||
</dependency>
|
||||
|
||||
</dependencies>
|
||||
<repositories>
|
||||
|
||||
|
|
|
@ -32,4 +32,5 @@ module nanodata.web {
|
|||
requires spring.web;
|
||||
requires powerframework.time;
|
||||
requires org.xerial.sqlitejdbc;
|
||||
requires octagon.jakarta;
|
||||
}
|
||||
|
|
|
@ -1,84 +0,0 @@
|
|||
///////////////////////////////////////////////////////////////////////////////////////////////
|
||||
// Nanodata.
|
||||
// Copyright (C) 2023-2023 the original author or authors.
|
||||
//
|
||||
// This program is free software; you can redistribute it and/or
|
||||
// modify it under the terms of the GNU General Public License
|
||||
// as published by the Free Software Foundation; version 2
|
||||
// of the License only.
|
||||
//
|
||||
// This program is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU General Public License for more details.
|
||||
//
|
||||
// You should have received a copy of the GNU General Public License
|
||||
// along with this program; if not, write to the Free Software
|
||||
// Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||
///////////////////////////////////////////////////////////////////////////////////////////////
|
||||
package org.nanoboot.nanodata.web.filters;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.FileInputStream;
|
||||
import java.io.IOException;
|
||||
import java.io.InputStream;
|
||||
import java.util.Properties;
|
||||
|
||||
import jakarta.servlet.Filter;
|
||||
import jakarta.servlet.FilterChain;
|
||||
import jakarta.servlet.FilterConfig;
|
||||
import jakarta.servlet.ServletContext;
|
||||
import jakarta.servlet.ServletException;
|
||||
import jakarta.servlet.ServletRequest;
|
||||
import jakarta.servlet.ServletResponse;
|
||||
import jakarta.servlet.http.HttpServletRequest;
|
||||
import jakarta.servlet.http.HttpServletResponse;
|
||||
import jakarta.servlet.http.HttpSession;
|
||||
|
||||
public class AuthenticationFilter implements Filter {
|
||||
|
||||
private ServletContext context;
|
||||
|
||||
public void init(FilterConfig fConfig) throws ServletException {
|
||||
this.context = fConfig.getServletContext();
|
||||
this.context.log("AuthenticationFilter started");
|
||||
}
|
||||
|
||||
public void doFilter(ServletRequest request, ServletResponse response, FilterChain chain) throws IOException, ServletException {
|
||||
|
||||
HttpServletRequest req = (HttpServletRequest) request;
|
||||
HttpServletResponse res = (HttpServletResponse) response;
|
||||
|
||||
HttpSession session = req.getSession(false);
|
||||
boolean sessionExists = session != null;
|
||||
|
||||
String octConfpath = System.getProperty("nanodata.confpath");
|
||||
if (octConfpath == null || octConfpath.isEmpty()) {
|
||||
String msg = "csa configuration is broken : " + "nanodata.confpath=" + octConfpath;
|
||||
throw new RuntimeException(msg);
|
||||
}
|
||||
File octagonProperties = new File(octConfpath + "/nanodata.properties");
|
||||
try ( InputStream input = new FileInputStream(octagonProperties.getAbsolutePath())) {
|
||||
|
||||
Properties properties = new Properties();
|
||||
properties.load(input);
|
||||
|
||||
} catch (IOException ex) {
|
||||
ex.printStackTrace();
|
||||
throw new RuntimeException("Loading nanodata.properties failed.");
|
||||
}
|
||||
|
||||
if (!sessionExists) {
|
||||
res.sendRedirect(req.getContextPath() + "/login.html");
|
||||
this.context.log("Access is not authorized.");
|
||||
|
||||
} else {
|
||||
this.context.log("Access is authorized.");
|
||||
chain.doFilter(request, response);
|
||||
}
|
||||
}
|
||||
|
||||
public void destroy() {
|
||||
//close any resources here
|
||||
}
|
||||
}
|
|
@ -1,49 +0,0 @@
|
|||
///////////////////////////////////////////////////////////////////////////////////////////////
|
||||
// Nanodata.
|
||||
// Copyright (C) 2023-2023 the original author or authors.
|
||||
//
|
||||
// This program is free software; you can redistribute it and/or
|
||||
// modify it under the terms of the GNU General Public License
|
||||
// as published by the Free Software Foundation; version 2
|
||||
// of the License only.
|
||||
//
|
||||
// This program is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU General Public License for more details.
|
||||
//
|
||||
// You should have received a copy of the GNU General Public License
|
||||
// along with this program; if not, write to the Free Software
|
||||
// Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||
///////////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
package org.nanoboot.nanodata.web.misc.filters;
|
||||
|
||||
import jakarta.servlet.*;
|
||||
import java.io.IOException;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author <a href="mailto:robertvokac@nanoboot.org">Robert Vokac</a>
|
||||
* @since 0.0.0
|
||||
*/
|
||||
public class CharacterEncodingFilter implements Filter {
|
||||
|
||||
@Override
|
||||
public void init(final FilterConfig filterConfig)
|
||||
throws ServletException {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void doFilter(ServletRequest servletRequest, ServletResponse servletResponse, FilterChain filterChain)
|
||||
throws IOException, ServletException {
|
||||
servletRequest.setCharacterEncoding("UTF-8");
|
||||
//servletResponse.setContentType("text/html; charset=UTF-8");
|
||||
filterChain.doFilter(servletRequest, servletResponse);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void destroy() {
|
||||
|
||||
}
|
||||
}
|
|
@ -1,87 +0,0 @@
|
|||
///////////////////////////////////////////////////////////////////////////////////////////////
|
||||
// Nanodata.
|
||||
// Copyright (C) 2023-2023 the original author or authors.
|
||||
//
|
||||
// This program is free software; you can redistribute it and/or
|
||||
// modify it under the terms of the GNU General Public License
|
||||
// as published by the Free Software Foundation; version 2
|
||||
// of the License only.
|
||||
//
|
||||
// This program is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU General Public License for more details.
|
||||
//
|
||||
// You should have received a copy of the GNU General Public License
|
||||
// along with this program; if not, write to the Free Software
|
||||
// Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||
///////////////////////////////////////////////////////////////////////////////////////////////
|
||||
package org.nanoboot.nanodata.web.misc.utils;
|
||||
|
||||
import jakarta.servlet.http.HttpServletRequest;
|
||||
import jakarta.servlet.http.HttpSession;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author <a href="mailto:robertvokac@nanoboot.org">Robert Vokac</a>
|
||||
* @since 0.0.0
|
||||
*/
|
||||
public class Utils {
|
||||
|
||||
public static String getBaseUrl(HttpServletRequest request) {
|
||||
return request.getServerName() + ':' + request.getServerPort() + request.getContextPath() + '/';
|
||||
}
|
||||
|
||||
public static String formatToHtmlWithoutEmptyWord(Object o) {
|
||||
return formatToHtml(o, false);
|
||||
}
|
||||
|
||||
public static String formatToHtml(Object o) {
|
||||
return formatToHtml(o, true);
|
||||
}
|
||||
|
||||
public static String formatToHtml(Object o, boolean withEmptyWord) {
|
||||
if (o == null) {
|
||||
return withEmptyWord ? "<span style=\"color:grey;\">[empty]</span>" : "";
|
||||
}
|
||||
if (o instanceof String && (((String) o)).isEmpty()) {
|
||||
return withEmptyWord ? "<span style=\"color:grey;\">[empty]</span>" : "";
|
||||
}
|
||||
if (o instanceof Boolean) {
|
||||
Boolean b = (Boolean) o;
|
||||
return b.booleanValue() ? "<span style=\"color:#00CC00;font-weight:bold;\">YES</span>" : "<span style=\"color:red;font-weight:bold;\">NO</span>";
|
||||
}
|
||||
if (o instanceof String) {
|
||||
String s = (String) o;
|
||||
if(s.startsWith("http")) {
|
||||
return "<a href=\"" + s + "\" target=\"_blank\">" + s + "</a>";
|
||||
} else {
|
||||
return s;
|
||||
}
|
||||
}
|
||||
return o.toString();
|
||||
}
|
||||
|
||||
public static boolean cannotUpdate(HttpServletRequest request) {
|
||||
return !canUpdate(request);
|
||||
}
|
||||
|
||||
public static boolean canUpdate(HttpServletRequest request) {
|
||||
//if(true)return true;
|
||||
|
||||
String allcanupdate = System.getProperty("nanodata.allcanupdate");
|
||||
if (allcanupdate != null && allcanupdate.equals("true")) {
|
||||
return true;
|
||||
}
|
||||
HttpSession session = request.getSession(false);
|
||||
if (session == null) {
|
||||
return false;
|
||||
}
|
||||
Object canUpdateAttribute = session.getAttribute("canUpdate");
|
||||
if (canUpdateAttribute == null) {
|
||||
return false;
|
||||
}
|
||||
return canUpdateAttribute.equals("true");
|
||||
|
||||
}
|
||||
}
|
|
@ -28,6 +28,7 @@ import jakarta.servlet.annotation.WebServlet;
|
|||
import jakarta.servlet.http.HttpServlet;
|
||||
import jakarta.servlet.http.HttpServletRequest;
|
||||
import jakarta.servlet.http.HttpServletResponse;
|
||||
import org.nanoboot.octagon.jakarta.utils.OctagonJakartaUtils;
|
||||
|
||||
@WebServlet(
|
||||
name = "FileServlet",
|
||||
|
@ -41,7 +42,7 @@ public class FileServlet extends HttpServlet {
|
|||
protected void doGet(HttpServletRequest req, HttpServletResponse resp)
|
||||
throws ServletException, IOException {
|
||||
|
||||
if (org.nanoboot.nanodata.web.misc.utils.Utils.cannotUpdate(req)) {
|
||||
if (OctagonJakartaUtils.cannotUpdate(req)) {
|
||||
resp.getOutputStream().println("Access forbidden");
|
||||
return;
|
||||
}
|
||||
|
|
|
@ -1,114 +0,0 @@
|
|||
///////////////////////////////////////////////////////////////////////////////////////////////
|
||||
// Nanodata.
|
||||
// Copyright (C) 2023-2023 the original author or authors.
|
||||
//
|
||||
// This program is free software; you can redistribute it and/or
|
||||
// modify it under the terms of the GNU General Public License
|
||||
// as published by the Free Software Foundation; version 2
|
||||
// of the License only.
|
||||
//
|
||||
// This program is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU General Public License for more details.
|
||||
//
|
||||
// You should have received a copy of the GNU General Public License
|
||||
// along with this program; if not, write to the Free Software
|
||||
// Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||
///////////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
package org.nanoboot.nanodata.web.servlets;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.FileInputStream;
|
||||
import java.io.IOException;
|
||||
import java.io.InputStream;
|
||||
import java.io.PrintWriter;
|
||||
import java.util.Properties;
|
||||
|
||||
import jakarta.servlet.RequestDispatcher;
|
||||
import jakarta.servlet.ServletException;
|
||||
import jakarta.servlet.annotation.WebServlet;
|
||||
import jakarta.servlet.http.HttpServlet;
|
||||
import jakarta.servlet.http.HttpServletRequest;
|
||||
import jakarta.servlet.http.HttpServletResponse;
|
||||
import jakarta.servlet.http.HttpSession;
|
||||
|
||||
@WebServlet(
|
||||
name = "LoginServlet",
|
||||
urlPatterns = "/LoginServlet"
|
||||
)
|
||||
public class LoginServlet extends HttpServlet {
|
||||
|
||||
protected void doPost(HttpServletRequest request,
|
||||
HttpServletResponse response) throws ServletException, IOException {
|
||||
|
||||
String returnedUser = request.getParameter("user");
|
||||
String returnedPassword = request.getParameter("password");
|
||||
|
||||
String expectedUser = "";
|
||||
String expectedPassword = "";
|
||||
|
||||
String csaConfPath = System.getProperty("nanodata.confpath");
|
||||
if (csaConfPath == null || csaConfPath.isEmpty()) {
|
||||
String msg = "csa configuration is broken : " + "nanodata.confpath=" + csaConfPath;
|
||||
returnError(response, request, msg);
|
||||
return;
|
||||
}
|
||||
File csaProperties = new File(csaConfPath + "/nanodata.properties");
|
||||
|
||||
String authentication = "";
|
||||
try ( InputStream input = new FileInputStream(csaProperties.getAbsolutePath())) {
|
||||
|
||||
Properties properties = new Properties();
|
||||
properties.load(input);
|
||||
authentication = properties.getProperty("authentication");
|
||||
|
||||
} catch (IOException ex) {
|
||||
ex.printStackTrace();
|
||||
returnError(response, request, "Loading csa properties failed.");
|
||||
return;
|
||||
}
|
||||
|
||||
if (authentication != null && !authentication.isBlank()) {
|
||||
String[] authenticationArray = authentication.split("/");
|
||||
if (authenticationArray.length != 2) {
|
||||
returnError(response, request, "csa configuration is broken (array.length != 2). Contact csa administrator.");
|
||||
return;
|
||||
}
|
||||
expectedUser = authenticationArray[0];
|
||||
expectedPassword = authenticationArray[1];
|
||||
}
|
||||
|
||||
|
||||
|
||||
if (expectedUser.equals(returnedUser) && expectedPassword.equals(returnedPassword)) {
|
||||
HttpSession oldSession = request.getSession(false);
|
||||
//invalidate old session
|
||||
if (oldSession != null) {
|
||||
oldSession.invalidate();
|
||||
}
|
||||
//new session
|
||||
HttpSession newSession = request.getSession(true);
|
||||
|
||||
System.out.println("Created new session " + newSession.toString());
|
||||
newSession.setAttribute("canUpdate", "true");
|
||||
|
||||
System.err.println("canUpdate&& = " + newSession.getAttribute("canUpdate"));
|
||||
newSession.setMaxInactiveInterval(30 * 24 * 60 * 60);
|
||||
|
||||
response.sendRedirect("index.jsp");
|
||||
} else {
|
||||
returnError(response, request, "Either user or password is wrong.");
|
||||
}
|
||||
}
|
||||
|
||||
private void returnError(HttpServletResponse response, HttpServletRequest request, String error) throws ServletException, IOException {
|
||||
RequestDispatcher rd = getServletContext().getRequestDispatcher("/login.html");
|
||||
|
||||
PrintWriter out = response.getWriter();
|
||||
out.println("<font color=red>" + error + " </font>");
|
||||
rd.include(request, response);
|
||||
}
|
||||
|
||||
}
|
|
@ -1,43 +0,0 @@
|
|||
///////////////////////////////////////////////////////////////////////////////////////////////
|
||||
// Nanodata.
|
||||
// Copyright (C) 2023-2023 the original author or authors.
|
||||
//
|
||||
// This program is free software; you can redistribute it and/or
|
||||
// modify it under the terms of the GNU General Public License
|
||||
// as published by the Free Software Foundation; version 2
|
||||
// of the License only.
|
||||
//
|
||||
// This program is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU General Public License for more details.
|
||||
//
|
||||
// You should have received a copy of the GNU General Public License
|
||||
// along with this program; if not, write to the Free Software
|
||||
// Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||
///////////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
package org.nanoboot.nanodata.web.servlets;
|
||||
|
||||
import java.io.IOException;
|
||||
|
||||
import jakarta.servlet.ServletException;
|
||||
import jakarta.servlet.annotation.WebServlet;
|
||||
import jakarta.servlet.http.HttpServlet;
|
||||
import jakarta.servlet.http.HttpServletRequest;
|
||||
import jakarta.servlet.http.HttpServletResponse;
|
||||
import jakarta.servlet.http.HttpSession;
|
||||
|
||||
@WebServlet("/LogoutServlet")
|
||||
public class LogoutServlet extends HttpServlet {
|
||||
|
||||
protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
|
||||
|
||||
//invalidate session, if exists
|
||||
HttpSession session = request.getSession(false);
|
||||
if(session != null){
|
||||
session.invalidate();
|
||||
}
|
||||
response.sendRedirect(request.getContextPath() + "/");
|
||||
}
|
||||
}
|
|
@ -66,13 +66,23 @@
|
|||
|
||||
<filter>
|
||||
<filter-name>CharacterEncodingFilter</filter-name>
|
||||
<filter-class>org.nanoboot.nanodata.web.misc.filters.CharacterEncodingFilter</filter-class>
|
||||
<filter-class>org.nanoboot.octagon.jakarta.filters.CharacterEncodingFilter</filter-class>
|
||||
</filter>
|
||||
<filter-mapping>
|
||||
<filter-name>CharacterEncodingFilter</filter-name>
|
||||
<url-pattern>/*</url-pattern>
|
||||
</filter-mapping>
|
||||
|
||||
<filter>
|
||||
<filter-name>AuthenticationFilter</filter-name>
|
||||
<filter-class>org.nanoboot.octagon.jakarta.filters.AuthenticationFilter</filter-class>
|
||||
</filter>
|
||||
|
||||
<!-- <filter-mapping>
|
||||
<filter-name>AuthenticationFilter</filter-name>
|
||||
<url-pattern>*.jsp</url-pattern>
|
||||
</filter-mapping>-->
|
||||
|
||||
<jsp-config>
|
||||
<jsp-property-group>
|
||||
<url-pattern>*.jsp</url-pattern>
|
||||
|
@ -80,4 +90,13 @@
|
|||
</jsp-property-group>
|
||||
</jsp-config>
|
||||
|
||||
<context-param>
|
||||
<param-name>octagon.application-code</param-name>
|
||||
<param-value>nanodata</param-value>
|
||||
</context-param>
|
||||
|
||||
<listener>
|
||||
<listener-class>org.nanoboot.octagon.jakarta.listeners.ApplicationCodeListener</listener-class>
|
||||
</listener>
|
||||
|
||||
</web-app>
|
||||
|
|
|
@ -40,7 +40,7 @@
|
|||
>> <a href="create_item.jsp" class="nav_a_current">Add Item</a></span>
|
||||
|
||||
<%
|
||||
if (org.nanoboot.nanodata.web.misc.utils.Utils.cannotUpdate(request)) {
|
||||
if (org.nanoboot.octagon.jakarta.utils.OctagonJakartaUtils.cannotUpdate(request)) {
|
||||
out.println("Access forbidden");
|
||||
throw new jakarta.servlet.jsp.SkipPageException();
|
||||
}
|
||||
|
|
|
@ -40,7 +40,7 @@
|
|||
>> <a href="create_statement.jsp" class="nav_a_current">Add Statement</a></span>
|
||||
|
||||
<%
|
||||
if (org.nanoboot.nanodata.web.misc.utils.Utils.cannotUpdate(request)) {
|
||||
if (org.nanoboot.octagon.jakarta.utils.OctagonJakartaUtils.cannotUpdate(request)) {
|
||||
out.println("Access forbidden");
|
||||
throw new jakarta.servlet.jsp.SkipPageException();
|
||||
}
|
||||
|
|
|
@ -40,7 +40,7 @@
|
|||
>> <a href="create_url.jsp" class="nav_a_current">Add Url</a></span>
|
||||
|
||||
<%
|
||||
if (org.nanoboot.nanodata.web.misc.utils.Utils.cannotUpdate(request)) {
|
||||
if (org.nanoboot.octagon.jakarta.utils.OctagonJakartaUtils.cannotUpdate(request)) {
|
||||
out.println("Access forbidden");
|
||||
throw new jakarta.servlet.jsp.SkipPageException();
|
||||
}
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
<%@page import="org.nanoboot.powerframework.time.moment.LocalDate"%>
|
||||
<%@page import="org.nanoboot.nanodata.web.misc.utils.Utils"%>
|
||||
<%@page import="org.nanoboot.octagon.jakarta.utils.OctagonJakartaUtils"%>
|
||||
<%@page import="org.nanoboot.nanodata.persistence.api.StatementRepo"%>
|
||||
<%@page import="org.nanoboot.nanodata.entity.Statement"%>
|
||||
<%@page import="org.springframework.web.context.support.WebApplicationContextUtils"%>
|
||||
|
@ -66,7 +66,7 @@
|
|||
</span>
|
||||
|
||||
<%
|
||||
if (org.nanoboot.nanodata.web.misc.utils.Utils.cannotUpdate(request)) {
|
||||
if (org.nanoboot.octagon.jakarta.utils.OctagonJakartaUtils.cannotUpdate(request)) {
|
||||
out.println("Access forbidden");
|
||||
throw new jakarta.servlet.jsp.SkipPageException();
|
||||
}
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
<%@page import="org.nanoboot.powerframework.time.moment.LocalDate"%>
|
||||
<%@page import="org.nanoboot.nanodata.web.misc.utils.Utils"%>
|
||||
<%@page import="org.nanoboot.octagon.jakarta.utils.OctagonJakartaUtils"%>
|
||||
<%@page import="org.nanoboot.nanodata.persistence.api.UrlRepo"%>
|
||||
<%@page import="org.nanoboot.nanodata.entity.Url"%>
|
||||
<%@page import="org.springframework.web.context.support.WebApplicationContextUtils"%>
|
||||
|
@ -66,7 +66,7 @@
|
|||
</span>
|
||||
|
||||
<%
|
||||
if (org.nanoboot.nanodata.web.misc.utils.Utils.cannotUpdate(request)) {
|
||||
if (org.nanoboot.octagon.jakarta.utils.OctagonJakartaUtils.cannotUpdate(request)) {
|
||||
out.println("Access forbidden");
|
||||
throw new jakarta.servlet.jsp.SkipPageException();
|
||||
}
|
||||
|
|
|
@ -29,7 +29,7 @@
|
|||
|
||||
<%@page import="java.util.Scanner"%>
|
||||
<%@page import="java.io.File"%>
|
||||
<%@page import="org.nanoboot.nanodata.web.misc.utils.Utils"%>
|
||||
<%@page import="org.nanoboot.octagon.jakarta.utils.OctagonJakartaUtils"%>
|
||||
<%@page import="org.springframework.web.context.support.WebApplicationContextUtils"%>
|
||||
<%@page import="org.springframework.context.ApplicationContext"%>
|
||||
|
||||
|
@ -70,7 +70,7 @@
|
|||
</span>
|
||||
|
||||
<%
|
||||
if (org.nanoboot.nanodata.web.misc.utils.Utils.cannotUpdate(request)) {
|
||||
if (org.nanoboot.octagon.jakarta.utils.OctagonJakartaUtils.cannotUpdate(request)) {
|
||||
out.println("Access forbidden");
|
||||
throw new jakarta.servlet.jsp.SkipPageException();
|
||||
}
|
||||
|
|
|
@ -39,7 +39,7 @@
|
|||
<a href="urls.jsp">Urls</a></span>
|
||||
|
||||
|
||||
<% boolean canUpdate = org.nanoboot.nanodata.web.misc.utils.Utils.canUpdate(request); %>
|
||||
<% boolean canUpdate = org.nanoboot.octagon.jakarta.utils.OctagonJakartaUtils.canUpdate(request); %>
|
||||
<% if(canUpdate) { %>
|
||||
<form action="<%=request.getContextPath()%>/LogoutServlet" method="post" style="display:inline;margin-left:20px;">
|
||||
<input type="submit" value="Logout" >
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
<%@page import="org.nanoboot.nanodata.web.misc.utils.Utils"%>
|
||||
<%@page import="org.nanoboot.octagon.jakarta.utils.OctagonJakartaUtils"%>
|
||||
<%@page import="java.util.List"%>
|
||||
<%@page import="org.nanoboot.nanodata.persistence.api.ItemRepo"%>
|
||||
<%@page import="org.nanoboot.nanodata.entity.Item"%>
|
||||
|
@ -43,7 +43,7 @@
|
|||
>> <a href="items.jsp" class="nav_a_current">Items</a>
|
||||
|
||||
|
||||
<% boolean canUpdate = org.nanoboot.nanodata.web.misc.utils.Utils.canUpdate(request); %>
|
||||
<% boolean canUpdate = org.nanoboot.octagon.jakarta.utils.OctagonJakartaUtils.canUpdate(request); %>
|
||||
<% if(canUpdate) { %>
|
||||
>> <a href="create_item.jsp">Add Item</a>
|
||||
<% } %>
|
||||
|
@ -186,7 +186,7 @@
|
|||
<td><%=i.getDisambiguation() == null ? EMPTY : i.getDisambiguation()%></td>
|
||||
<td><%=i.getDescription() == null ? EMPTY : i.getDescription()%></td>
|
||||
<td><%=i.getAliases() == null ? EMPTY : i.getAliases()%></td>
|
||||
<td><%=org.nanoboot.nanodata.web.misc.utils.Utils.formatToHtml(i.getEntryPointItem())%></td>
|
||||
<td><%=org.nanoboot.octagon.jakarta.utils.OctagonJakartaUtils.formatToHtml(i.getEntryPointItem())%></td>
|
||||
|
||||
|
||||
</tr>
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
<%@page import="org.nanoboot.nanodata.web.misc.utils.Utils"%>
|
||||
<%@page import="org.nanoboot.octagon.jakarta.utils.OctagonJakartaUtils"%>
|
||||
<%@page import="org.nanoboot.nanodata.persistence.api.ItemRepo"%>
|
||||
<%@page import="org.nanoboot.nanodata.persistence.api.StatementRepo"%>
|
||||
<%@page import="org.nanoboot.nanodata.persistence.api.UrlRepo"%>
|
||||
|
@ -65,7 +65,7 @@
|
|||
<a href="read_item.jsp?id=<%=id%>" class="nav_a_current">Read</a>
|
||||
|
||||
|
||||
<% boolean canUpdate = org.nanoboot.nanodata.web.misc.utils.Utils.canUpdate(request); %>
|
||||
<% boolean canUpdate = org.nanoboot.octagon.jakarta.utils.OctagonJakartaUtils.canUpdate(request); %>
|
||||
<% if(canUpdate) { %>
|
||||
<a href="update_item.jsp?id=<%=id%>">Update</a>
|
||||
<a href="edit_content.jsp?id=<%=id%>">Edit</a>
|
||||
|
@ -156,11 +156,11 @@
|
|||
<tr>
|
||||
<th>ID</th><td><%=item.getId()%> <button onclick="copyId()">Copy</button></td></tr>
|
||||
<tr><th>Label</th><td><%=item.getLabel()%></a></td></tr>
|
||||
<tr><th>Disambiguation</th><td><%=Utils.formatToHtml(item.getDisambiguation())%></td></tr>
|
||||
<tr><th>Description</th><td><%=Utils.formatToHtml(item.getDescription())%></td></tr>
|
||||
<tr><th>Attributes</th><td><pre><%=Utils.formatToHtml(item.getAttributes())%></pre></td></tr>
|
||||
<tr><th>Aliases</th><td><%=Utils.formatToHtml(item.getAliases())%></td></tr>
|
||||
<tr><th>Entry Point Item</th><td><%=Utils.formatToHtml(item.getEntryPointItem())%></td></tr>
|
||||
<tr><th>Disambiguation</th><td><%=OctagonJakartaUtils.formatToHtml(item.getDisambiguation())%></td></tr>
|
||||
<tr><th>Description</th><td><%=OctagonJakartaUtils.formatToHtml(item.getDescription())%></td></tr>
|
||||
<tr><th>Attributes</th><td><pre><%=OctagonJakartaUtils.formatToHtml(item.getAttributes())%></pre></td></tr>
|
||||
<tr><th>Aliases</th><td><%=OctagonJakartaUtils.formatToHtml(item.getAliases())%></td></tr>
|
||||
<tr><th>Entry Point Item</th><td><%=OctagonJakartaUtils.formatToHtml(item.getEntryPointItem())%></td></tr>
|
||||
<tr><th>Created at</th><td><%=item.getCreatedAt()%></a></td></tr>
|
||||
|
||||
|
||||
|
@ -247,7 +247,7 @@
|
|||
<td><a href="read_item.jsp?id=<%=i.getSource()%>"><%=itemRepo.getLabel(i.getSource())%></a></td>
|
||||
<td><%=i.getValue()%></td>
|
||||
<td><a href="read_item.jsp?id=<%=i.getTarget()%>"><%=itemRepo.getLabel(i.getTarget())%></a></td>
|
||||
<td><%=Utils.formatToHtml(i.getFlags())%></td>
|
||||
<td><%=OctagonJakartaUtils.formatToHtml(i.getFlags())%></td>
|
||||
|
||||
|
||||
</tr>
|
||||
|
@ -284,6 +284,8 @@
|
|||
|
||||
<%
|
||||
} else {
|
||||
java.util.Collections.sort(reverseStatements);
|
||||
|
||||
%>
|
||||
|
||||
<table>
|
||||
|
@ -323,7 +325,7 @@
|
|||
<td><a href="read_item.jsp?id=<%=i.getSource()%>"><%=itemRepo.getLabel(i.getSource())%></a></td>
|
||||
<td><%=i.getValue()%></td>
|
||||
<td><a href="read_item.jsp?id=<%=i.getTarget()%>"><%=itemRepo.getLabel(i.getTarget())%></a></td>
|
||||
<td><%=Utils.formatToHtml(i.getFlags())%></td>
|
||||
<td><%=OctagonJakartaUtils.formatToHtml(i.getFlags())%></td>
|
||||
|
||||
|
||||
</tr>
|
||||
|
@ -401,7 +403,7 @@
|
|||
<td><a href="<%=u.getUrl()%>"><%=u.getUrl()%></a></td>
|
||||
<td><%=u.getName()%></td>
|
||||
<td><a href="read_item.jsp?id=<%=u.getItemId()%>"><%=itemRepo.getLabel(u.getItemId())%></a></td>
|
||||
<td><%=Utils.formatToHtml(u.getOfficial())%></td>
|
||||
<td><%=OctagonJakartaUtils.formatToHtml(u.getOfficial())%></td>
|
||||
|
||||
|
||||
</tr>
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
<%@page import="org.nanoboot.nanodata.web.misc.utils.Utils"%>
|
||||
<%@page import="org.nanoboot.octagon.jakarta.utils.OctagonJakartaUtils"%>
|
||||
<%@page import="org.nanoboot.nanodata.persistence.api.StatementRepo"%>
|
||||
<%@page import="org.nanoboot.nanodata.persistence.api.ItemRepo"%>
|
||||
<%@page import="org.nanoboot.nanodata.entity.Statement"%>
|
||||
|
@ -62,7 +62,7 @@
|
|||
<a href="read_statement.jsp?id=<%=id%>" class="nav_a_current">Read</a>
|
||||
|
||||
|
||||
<% boolean canUpdate = org.nanoboot.nanodata.web.misc.utils.Utils.canUpdate(request); %>
|
||||
<% boolean canUpdate = org.nanoboot.octagon.jakarta.utils.OctagonJakartaUtils.canUpdate(request); %>
|
||||
<% if(canUpdate) { %>
|
||||
<a href="update_statement.jsp?id=<%=id%>">Update</a>
|
||||
<a href="delete_statement.jsp?id=<%=id%>">Delete</a>
|
||||
|
@ -118,9 +118,9 @@ window.location.href = 'update_statement.jsp?id=<%=id%>'
|
|||
<tr>
|
||||
<th>ID</th><td><%=statement.getId()%></td></tr>
|
||||
<tr><th>Source</th><td><a href="read_item.jsp?id=<%=statement.getSource()%>"><%=itemRepo.getLabel(statement.getSource())%></a></td></tr>
|
||||
<tr><th>Value</th><td><%=Utils.formatToHtml(statement.getValue())%></td></tr>
|
||||
<tr><th>Value</th><td><%=OctagonJakartaUtils.formatToHtml(statement.getValue())%></td></tr>
|
||||
<tr><th>Target</th><td><a href="read_item.jsp?id=<%=statement.getTarget()%>"><%=itemRepo.getLabel(statement.getTarget())%></a></td></tr>
|
||||
<tr><th>Flags</th><td><%=Utils.formatToHtml(statement.getFlags())%></td></tr>
|
||||
<tr><th>Flags</th><td><%=OctagonJakartaUtils.formatToHtml(statement.getFlags())%></td></tr>
|
||||
<tr><th>Created at</th><td><%=statement.getCreatedAt()%></a></td></tr>
|
||||
|
||||
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
<%@page import="org.nanoboot.nanodata.web.misc.utils.Utils"%>
|
||||
<%@page import="org.nanoboot.octagon.jakarta.utils.OctagonJakartaUtils"%>
|
||||
<%@page import="org.nanoboot.nanodata.persistence.api.UrlRepo"%>
|
||||
<%@page import="org.nanoboot.nanodata.persistence.api.ItemRepo"%>
|
||||
<%@page import="org.nanoboot.nanodata.entity.Url"%>
|
||||
|
@ -62,7 +62,7 @@
|
|||
<a href="read_url.jsp?id=<%=id%>" class="nav_a_current">Read</a>
|
||||
|
||||
|
||||
<% boolean canUpdate = org.nanoboot.nanodata.web.misc.utils.Utils.canUpdate(request); %>
|
||||
<% boolean canUpdate = org.nanoboot.octagon.jakarta.utils.OctagonJakartaUtils.canUpdate(request); %>
|
||||
<% if(canUpdate) { %>
|
||||
<a href="update_url.jsp?id=<%=id%>">Update</a>
|
||||
<a href="delete_url.jsp?id=<%=id%>">Delete</a>
|
||||
|
@ -118,9 +118,9 @@ window.location.href = 'update_url.jsp?id=<%=id%>'
|
|||
<tr>
|
||||
<th>ID</th><td><%=url.getId()%></td></tr>
|
||||
<tr><th>Url</th><td><a href="<%=url.getUrl()%>"><%=url.getUrl()%></a></td></tr>
|
||||
<tr><th>Name</th><td><%=Utils.formatToHtml(url.getName())%></td></tr>
|
||||
<tr><th>Name</th><td><%=OctagonJakartaUtils.formatToHtml(url.getName())%></td></tr>
|
||||
<tr><th>Item</th><td><a href="read_item.jsp?id=<%=url.getItemId()%>"><%=itemRepo.getLabel(url.getItemId())%></a></td></tr>
|
||||
<tr><th>Official</th><td><%=Utils.formatToHtml(url.getOfficial())%></td></tr>
|
||||
<tr><th>Official</th><td><%=OctagonJakartaUtils.formatToHtml(url.getOfficial())%></td></tr>
|
||||
<tr><th>Created at</th><td><%=url.getCreatedAt()%></a></td></tr>
|
||||
|
||||
|
||||
|
|
|
@ -4,7 +4,7 @@
|
|||
<%@page import="org.nanoboot.nanodata.entity.Statement"%>
|
||||
<%@page import="org.springframework.web.context.support.WebApplicationContextUtils"%>
|
||||
<%@page import="org.springframework.context.ApplicationContext"%>
|
||||
<%@page import="org.nanoboot.nanodata.web.misc.utils.Utils"%>
|
||||
<%@page import="org.nanoboot.octagon.jakarta.utils.OctagonJakartaUtils"%>
|
||||
<!DOCTYPE>
|
||||
<%@ page session="false" %>
|
||||
|
||||
|
@ -44,7 +44,7 @@
|
|||
>> <a href="statements.jsp" class="nav_a_current">Statements</a>
|
||||
|
||||
|
||||
<% boolean canUpdate = org.nanoboot.nanodata.web.misc.utils.Utils.canUpdate(request); %>
|
||||
<% boolean canUpdate = org.nanoboot.octagon.jakarta.utils.OctagonJakartaUtils.canUpdate(request); %>
|
||||
<% if(canUpdate) { %>
|
||||
>> <a href="create_statement.jsp">Add Statement</a>
|
||||
<% } %>
|
||||
|
@ -188,7 +188,7 @@
|
|||
<td><a href="read_item.jsp?id=<%=i.getSource()%>"><%=itemRepo.getLabel(i.getSource())%></a></td>
|
||||
<td><%=i.getValue()%></td>
|
||||
<td><a href="read_item.jsp?id=<%=i.getTarget()%>"><%=itemRepo.getLabel(i.getTarget())%></a></td>
|
||||
<td><%=Utils.formatToHtml(i.getFlags())%></td>
|
||||
<td><%=OctagonJakartaUtils.formatToHtml(i.getFlags())%></td>
|
||||
|
||||
|
||||
</tr>
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
<%@page import="org.nanoboot.powerframework.time.moment.LocalDate"%>
|
||||
<%@page import="org.nanoboot.nanodata.web.misc.utils.Utils"%>
|
||||
<%@page import="org.nanoboot.octagon.jakarta.utils.OctagonJakartaUtils"%>
|
||||
<%@page import="org.nanoboot.nanodata.persistence.api.ItemRepo"%>
|
||||
<%@page import="org.nanoboot.nanodata.entity.Item"%>
|
||||
<%@page import="org.springframework.web.context.support.WebApplicationContextUtils"%>
|
||||
|
@ -67,7 +67,7 @@
|
|||
</span>
|
||||
|
||||
<%
|
||||
if (org.nanoboot.nanodata.web.misc.utils.Utils.cannotUpdate(request)) {
|
||||
if (org.nanoboot.octagon.jakarta.utils.OctagonJakartaUtils.cannotUpdate(request)) {
|
||||
out.println("Access forbidden");
|
||||
throw new jakarta.servlet.jsp.SkipPageException();
|
||||
}
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
<%@page import="org.nanoboot.powerframework.time.moment.LocalDate"%>
|
||||
<%@page import="org.nanoboot.nanodata.web.misc.utils.Utils"%>
|
||||
<%@page import="org.nanoboot.octagon.jakarta.utils.OctagonJakartaUtils"%>
|
||||
<%@page import="org.nanoboot.nanodata.persistence.api.StatementRepo"%>
|
||||
<%@page import="org.nanoboot.nanodata.entity.Statement"%>
|
||||
<%@page import="org.springframework.web.context.support.WebApplicationContextUtils"%>
|
||||
|
@ -66,7 +66,7 @@
|
|||
</span>
|
||||
|
||||
<%
|
||||
if (org.nanoboot.nanodata.web.misc.utils.Utils.cannotUpdate(request)) {
|
||||
if (org.nanoboot.octagon.jakarta.utils.OctagonJakartaUtils.cannotUpdate(request)) {
|
||||
out.println("Access forbidden");
|
||||
throw new jakarta.servlet.jsp.SkipPageException();
|
||||
}
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
<%@page import="org.nanoboot.powerframework.time.moment.LocalDate"%>
|
||||
<%@page import="org.nanoboot.nanodata.web.misc.utils.Utils"%>
|
||||
<%@page import="org.nanoboot.octagon.jakarta.utils.OctagonJakartaUtils"%>
|
||||
<%@page import="org.nanoboot.nanodata.persistence.api.UrlRepo"%>
|
||||
<%@page import="org.nanoboot.nanodata.entity.Url"%>
|
||||
<%@page import="org.springframework.web.context.support.WebApplicationContextUtils"%>
|
||||
|
@ -66,7 +66,7 @@
|
|||
</span>
|
||||
|
||||
<%
|
||||
if (org.nanoboot.nanodata.web.misc.utils.Utils.cannotUpdate(request)) {
|
||||
if (org.nanoboot.octagon.jakarta.utils.OctagonJakartaUtils.cannotUpdate(request)) {
|
||||
out.println("Access forbidden");
|
||||
throw new jakarta.servlet.jsp.SkipPageException();
|
||||
}
|
||||
|
|
|
@ -8,7 +8,7 @@
|
|||
<%@page import="java.util.List"%>
|
||||
<%@page import="java.io.File"%>
|
||||
<%@page import="org.nanoboot.powerframework.time.moment.LocalDate"%>
|
||||
<%@page import="org.nanoboot.nanodata.web.misc.utils.Utils"%>
|
||||
<%@page import="org.nanoboot.octagon.jakarta.utils.OctagonJakartaUtils"%>
|
||||
<%@page import="org.nanoboot.nanodata.persistence.api.ItemRepo"%>
|
||||
<%@page import="org.nanoboot.nanodata.entity.Item"%>
|
||||
<%@page import="org.springframework.web.context.support.WebApplicationContextUtils"%>
|
||||
|
@ -77,7 +77,7 @@
|
|||
</span>
|
||||
|
||||
<%
|
||||
if (org.nanoboot.nanodata.web.misc.utils.Utils.cannotUpdate(request)) {
|
||||
if (org.nanoboot.octagon.jakarta.utils.OctagonJakartaUtils.cannotUpdate(request)) {
|
||||
out.println("Access forbidden");
|
||||
throw new jakarta.servlet.jsp.SkipPageException();
|
||||
}
|
||||
|
|
|
@ -4,7 +4,7 @@
|
|||
<%@page import="org.nanoboot.nanodata.entity.Url"%>
|
||||
<%@page import="org.springframework.web.context.support.WebApplicationContextUtils"%>
|
||||
<%@page import="org.springframework.context.ApplicationContext"%>
|
||||
<%@page import="org.nanoboot.nanodata.web.misc.utils.Utils"%>
|
||||
<%@page import="org.nanoboot.octagon.jakarta.utils.OctagonJakartaUtils"%>
|
||||
<!DOCTYPE>
|
||||
<%@ page session="false" %>
|
||||
|
||||
|
@ -44,7 +44,7 @@
|
|||
>> <a href="urls.jsp" class="nav_a_current">Urls</a>
|
||||
|
||||
|
||||
<% boolean canUpdate = org.nanoboot.nanodata.web.misc.utils.Utils.canUpdate(request); %>
|
||||
<% boolean canUpdate = org.nanoboot.octagon.jakarta.utils.OctagonJakartaUtils.canUpdate(request); %>
|
||||
<% if(canUpdate) { %>
|
||||
>> <a href="create_url.jsp">Add Url</a>
|
||||
<% } %>
|
||||
|
@ -189,7 +189,7 @@
|
|||
<td><a href="<%=u.getUrl()%>"><%=u.getUrl()%></a></td>
|
||||
<td><%=u.getName()%></td>
|
||||
<td><a href="read_item.jsp?id=<%=u.getItemId()%>"><%=itemRepo.getLabel(u.getItemId())%></a></td>
|
||||
<td><%=Utils.formatToHtml(u.getOfficial())%></td>
|
||||
<td><%=OctagonJakartaUtils.formatToHtml(u.getOfficial())%></td>
|
||||
|
||||
|
||||
</tr>
|
||||
|
|
55
pom.xml
55
pom.xml
|
@ -26,12 +26,12 @@
|
|||
<parent>
|
||||
<groupId>org.nanoboot.essential</groupId>
|
||||
<artifactId>nanoboot-parent</artifactId>
|
||||
<version>0.1.0</version>
|
||||
<version>0.1.1-SNAPSHOT</version>
|
||||
</parent>
|
||||
|
||||
<groupId>org.nanoboot.nanodata</groupId>
|
||||
<artifactId>nanodata-parent</artifactId>
|
||||
<version>0.0.0</version>
|
||||
<version>0.0.1-SNAPSHOT</version>
|
||||
|
||||
<packaging>pom</packaging>
|
||||
<name>nanodata</name>
|
||||
|
@ -46,13 +46,11 @@
|
|||
</modules>
|
||||
<properties>
|
||||
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
|
||||
<nanodata.version>0.0.0</nanodata.version>
|
||||
<power.version>2.0.0</power.version>
|
||||
<log4j.version>2.17.0</log4j.version>
|
||||
<springframework.version>6.0.7</springframework.version>
|
||||
<nanodata.version>0.0.1-SNAPSHOT</nanodata.version>
|
||||
<power.version>2.0.1-SNAPSHOT</power.version>
|
||||
<checkstyle.skip>true</checkstyle.skip><!-- TODO: make false-->
|
||||
<maven-war-plugin.version>3.3.2</maven-war-plugin.version>
|
||||
<db-migration-core.version>0.1.0</db-migration-core.version>
|
||||
<db-migration-core.version>0.1.1-SNAPSHOT</db-migration-core.version>
|
||||
<octagon.version>2.0.0-SNAPSHOT</octagon.version>
|
||||
</properties>
|
||||
|
||||
<build>
|
||||
|
@ -311,11 +309,48 @@
|
|||
<dependency>
|
||||
<groupId>org.xerial</groupId>
|
||||
<artifactId>sqlite-jdbc</artifactId>
|
||||
<!-- <version>${sqlite-jdbc.version}</version>-->
|
||||
<version>3.41.2.1</version>
|
||||
<version>${sqlite-jdbc.version}</version>
|
||||
</dependency>
|
||||
|
||||
</dependencies>
|
||||
</dependencyManagement>
|
||||
|
||||
<repositories>
|
||||
<repository>
|
||||
<id>releases</id>
|
||||
<name>nanoboot-releases-repository</name>
|
||||
<url>https://maven.nanoboot.org/releases</url>
|
||||
</repository>
|
||||
<repository>
|
||||
<id>snapshots</id>
|
||||
<name>nanoboot-snapshots-repository</name>
|
||||
<url>https://maven.nanoboot.org/snapshots</url>
|
||||
</repository>
|
||||
</repositories>
|
||||
|
||||
<pluginRepositories>
|
||||
<pluginRepository>
|
||||
<id>releases</id>
|
||||
<name>nanoboot-releases-repository</name>
|
||||
<url>https://maven.nanoboot.org/releases</url>
|
||||
</pluginRepository>
|
||||
<pluginRepository>
|
||||
<id>snapshots</id>
|
||||
<name>nanoboot-snapshots-repository</name>
|
||||
<url>https://maven.nanoboot.org/snapshots</url>
|
||||
</pluginRepository>
|
||||
</pluginRepositories>
|
||||
|
||||
<distributionManagement>
|
||||
<repository>
|
||||
<id>nanoboot-releases-repository</id>
|
||||
<url>https://maven.nanoboot.org/releases</url>
|
||||
</repository>
|
||||
|
||||
<snapshotRepository>
|
||||
<id>nanoboot-snapshots-repository</id>
|
||||
<url>https://maven.nanoboot.org/snapshots</url>
|
||||
</snapshotRepository>
|
||||
</distributionManagement>
|
||||
|
||||
</project>
|
||||
|
|
Loading…
Reference in New Issue