mirror of
https://github.com/Kingsrook/qqq.git
synced 2025-07-17 20:50:44 +00:00
add a ProcessBasedRouter to the sample site, and SimpleRouteAuthenticator
This commit is contained in:
@ -22,10 +22,12 @@
|
|||||||
package com.kingsrook.sampleapp;
|
package com.kingsrook.sampleapp;
|
||||||
|
|
||||||
|
|
||||||
import java.util.List;
|
|
||||||
import com.kingsrook.qqq.backend.core.logging.QLogger;
|
import com.kingsrook.qqq.backend.core.logging.QLogger;
|
||||||
|
import com.kingsrook.qqq.backend.core.model.metadata.code.QCodeReference;
|
||||||
import com.kingsrook.qqq.middleware.javalin.QApplicationJavalinServer;
|
import com.kingsrook.qqq.middleware.javalin.QApplicationJavalinServer;
|
||||||
|
import com.kingsrook.qqq.middleware.javalin.routeproviders.ProcessBasedRouter;
|
||||||
import com.kingsrook.qqq.middleware.javalin.routeproviders.SimpleFileSystemDirectoryRouter;
|
import com.kingsrook.qqq.middleware.javalin.routeproviders.SimpleFileSystemDirectoryRouter;
|
||||||
|
import com.kingsrook.qqq.middleware.javalin.routeproviders.authentication.SimpleRouteAuthenticator;
|
||||||
import com.kingsrook.sampleapp.metadata.SampleMetaDataProvider;
|
import com.kingsrook.sampleapp.metadata.SampleMetaDataProvider;
|
||||||
|
|
||||||
|
|
||||||
@ -56,7 +58,13 @@ public class SampleJavalinServer
|
|||||||
try
|
try
|
||||||
{
|
{
|
||||||
QApplicationJavalinServer javalinServer = new QApplicationJavalinServer(new SampleMetaDataProvider());
|
QApplicationJavalinServer javalinServer = new QApplicationJavalinServer(new SampleMetaDataProvider());
|
||||||
javalinServer.withAdditionalRouteProvider(new SimpleFileSystemDirectoryRouter("/static-site", "/Users/dkelkhoff/tmp/static-site"));
|
|
||||||
|
javalinServer.withAdditionalRouteProvider(new SimpleFileSystemDirectoryRouter("/static-site", "static-site/")
|
||||||
|
.withRouteAuthenticator(new QCodeReference(SimpleRouteAuthenticator.class)));
|
||||||
|
|
||||||
|
javalinServer.withAdditionalRouteProvider(new ProcessBasedRouter("dynamic-site/<pagePath>", "DynamicSiteProcess")
|
||||||
|
.withRouteAuthenticator(new QCodeReference(SimpleRouteAuthenticator.class)));
|
||||||
|
|
||||||
javalinServer.start();
|
javalinServer.start();
|
||||||
}
|
}
|
||||||
catch(Exception e)
|
catch(Exception e)
|
||||||
|
@ -0,0 +1,57 @@
|
|||||||
|
/*
|
||||||
|
* QQQ - Low-code Application Framework for Engineers.
|
||||||
|
* Copyright (C) 2021-2025. Kingsrook, LLC
|
||||||
|
* 651 N Broad St Ste 205 # 6917 | Middletown DE 19709 | United States
|
||||||
|
* contact@kingsrook.com
|
||||||
|
* https://github.com/Kingsrook/
|
||||||
|
*
|
||||||
|
* This program is free software: you can redistribute it and/or modify
|
||||||
|
* it under the terms of the GNU Affero General Public License as
|
||||||
|
* published by the Free Software Foundation, either version 3 of the
|
||||||
|
* License, or (at your option) any later version.
|
||||||
|
*
|
||||||
|
* 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 Affero General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU Affero General Public License
|
||||||
|
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||||
|
*/
|
||||||
|
|
||||||
|
package com.kingsrook.sampleapp.metadata;
|
||||||
|
|
||||||
|
|
||||||
|
import com.kingsrook.qqq.backend.core.exceptions.QException;
|
||||||
|
import com.kingsrook.qqq.backend.core.model.metadata.MetaDataProducer;
|
||||||
|
import com.kingsrook.qqq.backend.core.model.metadata.QInstance;
|
||||||
|
import com.kingsrook.qqq.backend.core.model.metadata.code.QCodeReference;
|
||||||
|
import com.kingsrook.qqq.backend.core.model.metadata.processes.QBackendStepMetaData;
|
||||||
|
import com.kingsrook.qqq.backend.core.model.metadata.processes.QProcessMetaData;
|
||||||
|
import com.kingsrook.sampleapp.processes.dynamicsite.DynamicSiteProcessStep;
|
||||||
|
|
||||||
|
|
||||||
|
/*******************************************************************************
|
||||||
|
** Meta Data Producer for DynamicSiteProcess
|
||||||
|
*******************************************************************************/
|
||||||
|
public class DynamicSiteProcessMetaDataProducer extends MetaDataProducer<QProcessMetaData>
|
||||||
|
{
|
||||||
|
public static final String NAME = "DynamicSiteProcess";
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
/*******************************************************************************
|
||||||
|
**
|
||||||
|
*******************************************************************************/
|
||||||
|
@Override
|
||||||
|
public QProcessMetaData produce(QInstance qInstance) throws QException
|
||||||
|
{
|
||||||
|
return (new QProcessMetaData()
|
||||||
|
.withName(NAME)
|
||||||
|
.withStep(new QBackendStepMetaData()
|
||||||
|
.withName("DynamicSiteProcessStep")
|
||||||
|
.withCode(new QCodeReference(DynamicSiteProcessStep.class)))
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
@ -0,0 +1,50 @@
|
|||||||
|
/*
|
||||||
|
* QQQ - Low-code Application Framework for Engineers.
|
||||||
|
* Copyright (C) 2021-2025. Kingsrook, LLC
|
||||||
|
* 651 N Broad St Ste 205 # 6917 | Middletown DE 19709 | United States
|
||||||
|
* contact@kingsrook.com
|
||||||
|
* https://github.com/Kingsrook/
|
||||||
|
*
|
||||||
|
* This program is free software: you can redistribute it and/or modify
|
||||||
|
* it under the terms of the GNU Affero General Public License as
|
||||||
|
* published by the Free Software Foundation, either version 3 of the
|
||||||
|
* License, or (at your option) any later version.
|
||||||
|
*
|
||||||
|
* 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 Affero General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU Affero General Public License
|
||||||
|
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||||
|
*/
|
||||||
|
|
||||||
|
package com.kingsrook.sampleapp.processes.dynamicsite;
|
||||||
|
|
||||||
|
|
||||||
|
import com.kingsrook.qqq.backend.core.actions.processes.BackendStep;
|
||||||
|
import com.kingsrook.qqq.backend.core.exceptions.QException;
|
||||||
|
import com.kingsrook.qqq.backend.core.model.actions.processes.RunBackendStepInput;
|
||||||
|
import com.kingsrook.qqq.backend.core.model.actions.processes.RunBackendStepOutput;
|
||||||
|
import com.kingsrook.qqq.middleware.javalin.routeproviders.ProcessBasedRouterPayload;
|
||||||
|
|
||||||
|
|
||||||
|
/*******************************************************************************
|
||||||
|
**
|
||||||
|
*******************************************************************************/
|
||||||
|
public class DynamicSiteProcessStep implements BackendStep
|
||||||
|
{
|
||||||
|
/***************************************************************************
|
||||||
|
**
|
||||||
|
***************************************************************************/
|
||||||
|
@Override
|
||||||
|
public void run(RunBackendStepInput runBackendStepInput, RunBackendStepOutput runBackendStepOutput) throws QException
|
||||||
|
{
|
||||||
|
ProcessBasedRouterPayload processPayload = runBackendStepInput.getProcessPayload(ProcessBasedRouterPayload.class);
|
||||||
|
|
||||||
|
String path = processPayload.getPath();
|
||||||
|
processPayload.setResponseString("You requested: " + path);
|
||||||
|
runBackendStepOutput.setProcessPayload(processPayload);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
@ -0,0 +1 @@
|
|||||||
|
World!
|
22
qqq-sample-project/src/main/resources/static-site/index.html
Normal file
22
qqq-sample-project/src/main/resources/static-site/index.html
Normal file
@ -0,0 +1,22 @@
|
|||||||
|
<!--
|
||||||
|
~ QQQ - Low-code Application Framework for Engineers.
|
||||||
|
~ Copyright (C) 2021-2025. Kingsrook, LLC
|
||||||
|
~ 651 N Broad St Ste 205 # 6917 | Middletown DE 19709 | United States
|
||||||
|
~ contact@kingsrook.com
|
||||||
|
~ https://github.com/Kingsrook/
|
||||||
|
~
|
||||||
|
~ This program is free software: you can redistribute it and/or modify
|
||||||
|
~ it under the terms of the GNU Affero General Public License as
|
||||||
|
~ published by the Free Software Foundation, either version 3 of the
|
||||||
|
~ License, or (at your option) any later version.
|
||||||
|
~
|
||||||
|
~ 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 Affero General Public License for more details.
|
||||||
|
~
|
||||||
|
~ You should have received a copy of the GNU Affero General Public License
|
||||||
|
~ along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||||
|
-->
|
||||||
|
|
||||||
|
hello world
|
Reference in New Issue
Block a user