From 90e62ebc05c13a7e0e44365e643bbdb175a537f8 Mon Sep 17 00:00:00 2001 From: AAnastaBASIS Date: Tue, 7 Jun 2022 11:43:31 -0600 Subject: [PATCH 1/2] Upgraded RESTBridge to use BBx Servlets instead of BBjsp Servlets --- OutputHandler.bbj | 12 +++---- RestBridge.bbj | 14 ++++---- cfg/RestBridgeConfigurationWindow.bbj | 24 +++++++------- cfg/RestBridgeConfigurator.bbj | 48 +++++++++++++-------------- docs/javadoc/OutputHandler.html | 8 ++--- docs/javadoc/RestBridge.html | 4 +-- docs/javadoc/indexAll.html | 10 +++--- test/CreateTestRestBridge.bbj | 2 +- test/RestBridgeTestConfigurator.bbj | 4 +-- test/TestRestBridge.bbjt | 4 +-- 10 files changed, 65 insertions(+), 65 deletions(-) diff --git a/OutputHandler.bbj b/OutputHandler.bbj index ded4c0a..d0963c4 100644 --- a/OutputHandler.bbj +++ b/OutputHandler.bbj @@ -40,10 +40,10 @@ class public OutputHandler field protected HashMap invokeResult! rem The actual request object which contains infromation about the client request - field protected BBjspWebRequest request! + field protected BBxServletRequest request! rem The actual response object used to write the response - field protected BBjspWebResponse response! + field protected BBxServletResponse response! rem /** rem * The default constructor used to create an instance of the OutputHandler. @@ -460,20 +460,20 @@ class public OutputHandler methodend rem /** - rem * Set the BBjspWebRequest object to use when handling the output. + rem * Set the BBxServletRequest object to use when handling the output. rem * rem * @param request! The request object to use. rem */ - method public void setRequest(BBjspWebRequest request!) + method public void setRequest(BBxServletRequest request!) #request! = request! methodend rem /** - rem * Set the BBjspWebResponse object to use when handling the output. + rem * Set the BBxServletResponse object to use when handling the output. rem * rem * @param response! The response object to use. rem */ - method public void setResponse(BBjspWebResponse response!) + method public void setResponse(BBxServletResponse response!) #response! = response! methodend diff --git a/RestBridge.bbj b/RestBridge.bbj index aaa2901..92933e2 100644 --- a/RestBridge.bbj +++ b/RestBridge.bbj @@ -18,9 +18,9 @@ class public RestBridge field public static BBjString LOGTPL$="ID:C(16*),METHOD:C(1*),START:N(1*),END:N(1*),DURATION:N(1*),ADDR:C(1*),URL:C(1*),URI:C(1*),QUERY:C(1*),HEADERS:C(1*),PARAMS:C(1*),STATUS:C(1*)" - METHOD PUBLIC void service(BBjspServletContext context!) - declare BBjspWebRequest request! - declare BBjspWebResponse response! + METHOD PUBLIC void service(BBxServletContext context!) + declare BBxServletRequest request! + declare BBxServletResponse response! request! = context!.getRequest() response! = context!.getResponse() @@ -847,7 +847,7 @@ class public RestBridge methodend - method private BBjString logRequest(BBjspWebRequest request!) + method private BBjString logRequest(BBxServletRequest request!) rlog$=stbl("REST_REQUESTLOG",err=skip) System.out.println("Logging request into "+rlog$) @@ -901,7 +901,7 @@ class public RestBridge methodend - method private void logResponse(BBjString id$, BBjspWebResponse response!) + method private void logResponse(BBjString id$, BBxServletResponse response!) if id$="" then methodret @@ -931,7 +931,7 @@ class public RestBridge methodend - method private HashMap getRequestLog(BBjspWebRequest request!) + method private HashMap getRequestLog(BBxServletRequest request!) answer! = new HashMap() rs! = new ResultSet() @@ -996,7 +996,7 @@ class public RestBridge rem * @param context! The servlet context used to read the parameters defined for the RestBridge servlet rem * @return a HashMap with the RestBridge parameters(=options) currenlty set. rem */ - method private static HashMap getServletParameters(BBjspServletContext context!) + method private static HashMap getServletParameters(BBxServletContext context!) rem the list of available parameter names declare BBjVector parameterNames! diff --git a/cfg/RestBridgeConfigurationWindow.bbj b/cfg/RestBridgeConfigurationWindow.bbj index bf4223f..5b05c6d 100644 --- a/cfg/RestBridgeConfigurationWindow.bbj +++ b/cfg/RestBridgeConfigurationWindow.bbj @@ -297,11 +297,11 @@ class public RestBridgeConfigurationWindow methodend - method private BBjspServletConfiguration reciveBridgeInformation() - declare BBjspServletConfiguration servlet! + method private BBxServlet reciveBridgeInformation() + declare BBxServlet servlet! if (!(#selectedBridge! = null()) AND !(#selected! = null())) then - servlet! = #configurate!.getBBjspServlet(#selected!.getName(),#selectedBridge!.getMapping()) + servlet! = #configurate!.getBBxServlet(#selected!.getName(),#selectedBridge!.getMapping()) else methodret null() endif @@ -331,7 +331,7 @@ class public RestBridgeConfigurationWindow methodend method private void updateUI() - declare BBjspServletConfiguration servlet! + declare BBxServlet servlet! servlet! = #reciveBridgeInformation() if (servlet! <> null()) then @@ -575,7 +575,7 @@ class public RestBridgeConfigurationWindow method public void loadTree() declare BBjVector vector! declare BBjVector vector2! - declare BBjspServletConfiguration bbjspServletConfiguration! + declare BBxServlet bbxServletConfiguration! #contexts!.clear() @@ -590,16 +590,16 @@ class public RestBridgeConfigurationWindow #treeContext!.addExpandableNode(#node!,parent,vector!.getItem(i).toString()) #contexts!.add(new Context(vector!.getItem(i).toString(),#node!)) - vector2! = #admin!.getJettyServerConfig().getCustomContext(vector!.getItem(i).toString()).getBBjspServlets() + vector2! = #admin!.getJettyServerConfig().getCustomContext(vector!.getItem(i).toString()).getBBxServlets() branch_node! = #node! if vector2!.size() > 0 then for y=0 to vector2!.size()-1 - bbjspServletConfiguration! = cast(BBjspServletConfiguration ,vector2!.getItem(y)) - if bbjspServletConfiguration!.getClassName() = "RestBridge" then + bbxServletConfiguration! = cast(BBxServlet ,vector2!.getItem(y)) + if bbxServletConfiguration!.getClassName() = "RestBridge" then #node! = #node!+1 - #treeContext!.addNode(#node!,branch_node!,bbjspServletConfiguration!.getMapping()) + #treeContext!.addNode(#node!,branch_node!,bbxServletConfiguration!.getMapping()) buffer! = cast(Context,#contexts!.get(i)) - buffer!.addBridge(new Bridge(bbjspServletConfiguration!.getMapping(),#node!)) + buffer!.addBridge(new Bridge(bbxServletConfiguration!.getMapping(),#node!)) endif next y endif @@ -696,7 +696,7 @@ class public RestBridgeConfigurationWindow builder!.append("declare BBjAdmin admin!"+$0A$) builder!.append("declare BBjJettyContextConfiguration contextConf!"+$0A$) builder!.append("declare BBjJettyServerConfiguration serverconfig!"+$0A$) - builder!.append("declare BBjspServletConfiguration bridgeConf!"+$0A$+$0A$) + builder!.append("declare BBxServlet bridgeConf!"+$0A$+$0A$) builder!.append("declare String user!"+$0A$) builder!.append("declare String password!"+$0A$) builder!.append("declare String contextName!"+$0A$) @@ -731,7 +731,7 @@ class public RestBridgeConfigurationWindow builder!.append("contextConf!.setPath(""/"" + contextName!)"+$0A$) builder!.append("serverConfig!.saveConfig()"+$0A$+$0A$) builder!.append("restBridgeFile! = new File(directory!.getParentFile(),""RestBridge.bbj"")"+$0A$) - builder!.append("bridgeConf! = contextConf!.addBBjspServlet(""RestBridge"",bridgeName!,restBridgeFile!.getAbsolutePath())"+$0A$+$0A$) + builder!.append("bridgeConf! = contextConf!.addBBxServlet(""RestBridge"",bridgeName!,restBridgeFile!.getAbsolutePath())"+$0A$+$0A$) builder!.append("bridgeConf!.setConfig(configFilePath!)"+$0A$) builder!.append("adapterProgram! = new File(directory!.getParentFile(),""RestBCAdapter.bbj"")"+$0A$+$0A$) builder!.append("REM Here you can add Parameter to your Birdge."+$0A$) diff --git a/cfg/RestBridgeConfigurator.bbj b/cfg/RestBridgeConfigurator.bbj index 59d34d4..e5d37a1 100644 --- a/cfg/RestBridgeConfigurator.bbj +++ b/cfg/RestBridgeConfigurator.bbj @@ -23,9 +23,9 @@ class public RestBridgeConfigurator declare BBjVector contextNames! declare Iterator contextNameIterator! declare Iterator bbjspConfigurationIterator! - declare BBjVector bbjspServletConfigurations! + declare BBjVector bbxServletConfigurations! declare BBjJettyContextConfiguration contextConfiguration! - declare BBjspServletConfiguration bbjspServletConfiguration! + declare BBxServlet bbxServletConfiguration! declare BBjVector restBridgeConfigurations! restBridgeConfigurations! = new BBjVector() @@ -40,15 +40,15 @@ class public RestBridgeConfigurator contextName! = str(contextNameIterator!.next()) contextConfiguration! = #serverConfig!.getCustomContext(contextName!) - bbjspServletConfigurations! = contextConfiguration!.getBBjspServlets() - if(bbjspServletConfigurations! <> null() AND !bbjspServletConfigurations!.isEmpty()) then + bbxServletConfigurations! = contextConfiguration!.getBBxServlets() + if(bbxServletConfigurations! <> null() AND !bbxServletConfigurations!.isEmpty()) then - bbjspConfigurationIterator! = bbjspServletConfigurations!.iterator() + bbjspConfigurationIterator! = bbxServletConfigurations!.iterator() while(bbjspConfigurationIterator!.hasNext()) - bbjspServletConfiguration! = cast(BBjspServletConfiguration ,bbjspConfigurationIterator!.next()) + bbxServletConfiguration! = cast(BBxServlet ,bbjspConfigurationIterator!.next()) - className! = bbjspServletConfiguration!.getClassName() - sourceName! = bbjspServletConfiguration!.getSourceName() + className! = bbxServletConfiguration!.getClassName() + sourceName! = bbxServletConfiguration!.getSourceName() if(className! = "RestBridge" AND sourceName! = restBridgeFile!.getAbsolutePath()) then restBridgeConfigurations!.add(contextName!) @@ -71,7 +71,7 @@ class public RestBridgeConfigurator methodret authenticationProgramFile!.getAbsolutePath() methodend - method public BBjspServletConfiguration getBBjspServlet(String contextName!, String mapping!) + method public BBxServlet getBBxServlet(String contextName!, String mapping!) declare BBjJettyContextConfiguration contextConf! contextConf! = #serverConfig!.getCustomContext(contextName!) @@ -87,7 +87,7 @@ class public RestBridgeConfigurator methodret null() endif - methodret contextConf!.getBBjspServlet(mapping!) + methodret contextConf!.getBBxServlet(mapping!) methodend rem /** @@ -100,13 +100,13 @@ class public RestBridgeConfigurator declare BBjJettyContextConfiguration contextConfiguration! contextConfiguration! = #serverConfig!.getCustomContext(contextName!) - declare BBjspServletConfiguration bbjspServlet! - bbjspServlet! = contextConfiguration!.getBBjspServlet(mapping!) - if(bbjspServlet! = null()) then + declare BBxServlet bbxServlet! + bbxServlet! = contextConfiguration!.getBBxServlet(mapping!) + if(bbxServlet! = null()) then methodret endif - contextConfiguration!.removeBBjspServlet(mapping!) + contextConfiguration!.removeBBxServlet(mapping!) #serverConfig!.saveConfig() methodend @@ -124,8 +124,8 @@ class public RestBridgeConfigurator REM * @param params! The HashMap with the Rest Bridge Parameters REM */ method public void editRestBridgeConfiguration(String contextName!, String mapping!, HashMap params!, String configFilePath!) - declare BBjspServletConfiguration conf! - conf! = #getBBjspServlet(contextName!, mapping!) + declare BBxServlet conf! + conf! = #getBBxServlet(contextName!, mapping!) if(conf! = null()) then methodret @@ -191,7 +191,7 @@ class public RestBridgeConfigurator endif rem check that the mapping is not already used by another program - if(contextConfig!.getBBjspServletMappings().contains(mapping!)) then + if(contextConfig!.getBBxServletMappings().contains(mapping!)) then a = msgbox("Mapping already exists!") methodret endif @@ -199,11 +199,11 @@ class public RestBridgeConfigurator declare File restBridgeFile! restBridgeFile! = new File(#pluginDirectory!, "RestBridge.bbj") - declare BBjspServletConfiguration configuration! + declare BBxServlet configuration! rem ClassName, Mapping, Source, Config(Optional) rem http://documentation.basis.com/BASISHelp/WebHelp/gridmethods4/bbjjettycontextconfiguration_addbbjspservlet.htm - configuration! = contextConfig!.addBBjspServlet("RestBridge", mapping!, restBridgeFile!.getAbsolutePath()) + configuration! = contextConfig!.addBBxServlet("RestBridge", mapping!, restBridgeFile!.getAbsolutePath()) configuration!.setConfig(configFilePath!) @@ -258,9 +258,9 @@ class public RestBridgeConfigurator method public BBjVector getRestBridgeMappingsForContext(String contextName!) declare Iterator it! declare File sourceFile! - declare BBjVector bbjspServlets! + declare BBjVector bbxServlets! declare BBjVector restBridgeMappings! - declare BBjspServletConfiguration conf! + declare BBxServlet conf! declare BBjJettyContextConfiguration contextConfiguration! rem get the custom context for the given context name @@ -272,11 +272,11 @@ class public RestBridgeConfigurator restBridgeMappings! = new BBjVector() rem retrieve the BBJSP servlets for the custom context - bbjspServlets! = contextConfiguration!.getBBjspServlets() + bbxServlets! = contextConfiguration!.getBBxServlets() - it! = bbjspServlets!.iterator() + it! = bbxServlets!.iterator() while(it!.hasNext()) - conf! = cast(BBjspServletConfiguration, it!.next()) + conf! = cast(BBxServlet, it!.next()) if(conf!.getClassName().equals("RestBridge") AND conf!.getSourceName().equals(sourceFile!.getAbsolutePath())) then restBridgeMappings!.addItem(conf!.getMapping()) endif diff --git a/docs/javadoc/OutputHandler.html b/docs/javadoc/OutputHandler.html index 21b4084..1da8dd8 100644 --- a/docs/javadoc/OutputHandler.html +++ b/docs/javadoc/OutputHandler.html @@ -150,8 +150,8 @@ response he's receiving is in the XML format.

voidsetCharset(String charset!) voidsetInvokeResult(HashMap invokeResult!)

Sets the result of the BC invoke which contains infomation about the bc method invocation.

-
voidsetRequest(BBjspWebRequest request!)

Set the BBjspWebRequest object to use when handling the output.

-
voidsetResponse(BBjspWebResponse response!)

Set the BBjspWebResponse object to use when handling the output.

+
voidsetRequest(BBxServletRequest request!)

Set the BBxServletRequest object to use when handling the output.

+
voidsetResponse(BBxServletResponse response!)

Set the BBxServletResponse object to use when handling the output.

voidsetResultSet(ResultSet rs!)

Set the ResultSet to use when creating the output. The given ResultSet is usually the direct value from the BCs.

Returns:
the XML-String content to return to the client
diff --git a/docs/javadoc/RestBridge.html b/docs/javadoc/RestBridge.html index c2041df..0e81269 100644 --- a/docs/javadoc/RestBridge.html +++ b/docs/javadoc/RestBridge.html @@ -106,7 +106,7 @@ -
+ diff --git a/docs/javadoc/indexAll.html b/docs/javadoc/indexAll.html index f067e34..db75324 100644 --- a/docs/javadoc/indexAll.html +++ b/docs/javadoc/indexAll.html @@ -169,7 +169,7 @@

R

S

-
service(BBjspServletContext context!) - method in class RestBridge
+
service(BBxServletContext context!) - method in class RestBridge

@@ -183,14 +183,14 @@

S

the bc method invocation.


-
setRequest(BBjspWebRequest request!) - method in class OutputHandler
+
setRequest(BBxServletRequest request!) - method in class OutputHandler
-

Set the BBjspWebRequest object to use when handling the output.

+

Set the BBxServletRequest object to use when handling the output.


-
setResponse(BBjspWebResponse response!) - method in class OutputHandler
+
setResponse(BBxServletResponse response!) - method in class OutputHandler
-

Set the BBjspWebResponse object to use when handling the output.

+

Set the BBxServletResponse object to use when handling the output.


setResultSet(ResultSet rs!) - method in class OutputHandler
diff --git a/test/CreateTestRestBridge.bbj b/test/CreateTestRestBridge.bbj index 81d1e44..b48e06b 100644 --- a/test/CreateTestRestBridge.bbj +++ b/test/CreateTestRestBridge.bbj @@ -11,7 +11,7 @@ path! = bbjapi().getFileSystem().resolvePath("RestBridge/RestBridge.bbj") directory! = new File(path!).getParent() bcDir! = new File(directory!, "test/example-bcs/") -config! = context!.addBBjspServlet("RestBridge", "/rest_test/*", path!) +config! = context!.addBBxServlet("RestBridge", "/rest_test/*", path!) config!.addParam("REST_TIMEOUT", "100") config!.addParam("REST_AUTHPGM", new File(directory!, "authenticate.bbj").getAbsolutePath()) config!.addParam("REST_WD", bcDir!.getAbsolutePath()) diff --git a/test/RestBridgeTestConfigurator.bbj b/test/RestBridgeTestConfigurator.bbj index ae4103b..d0caaac 100644 --- a/test/RestBridgeTestConfigurator.bbj +++ b/test/RestBridgeTestConfigurator.bbj @@ -48,7 +48,7 @@ class public RestBridgeTestConfigurator #mapping! = "/rest" + str(System.currentTimeMillis()) + "/" - config! = context!.addBBjspServlet("RestBridge", #mapping! + "*", path!) + config! = context!.addBBxServlet("RestBridge", #mapping! + "*", path!) config!.addParam("REST_TIMEOUT", "100") config!.addParam("REST_AUTHPGM", new File(directory!, "authenticate.bbj").getAbsolutePath()) config!.addParam("REST_WD", bcDir!.getAbsolutePath()) @@ -61,7 +61,7 @@ class public RestBridgeTestConfigurator method public void removeTestRestBridge() admin! = BBJAPI().getAdmin(#username!, #password!) context! = admin!.getJettyServerConfig().getRootContextInfo() - context!.removeBBjspServlet(#mapping! + "*") + context!.removeBBxServlet(#mapping! + "*") admin!.getJettyServerConfig().saveConfig() methodend diff --git a/test/TestRestBridge.bbjt b/test/TestRestBridge.bbjt index 2c99cc6..d401074 100644 --- a/test/TestRestBridge.bbjt +++ b/test/TestRestBridge.bbjt @@ -61,7 +61,7 @@ class public RestBridgeTest #mapping! = "/rest" + str(System.currentTimeMillis()) + "/" - config! = context!.addBBjspServlet("RestBridge", #mapping! + "*", path!) + config! = context!.addBBxServlet("RestBridge", #mapping! + "*", path!) config!.addParam("REST_TIMEOUT", "100") config!.addParam("REST_AUTHPGM", new File(directory!, "authenticate.bbj").getAbsolutePath()) config!.addParam("REST_WD", bcDir!.getAbsolutePath()) @@ -75,7 +75,7 @@ class public RestBridgeTest method public void cleanUpRestBridge() admin! = BBJAPI().getAdmin(#username!, #password!) context! = admin!.getJettyServerConfig().getRootContextInfo() - context!.removeBBjspServlet(#mapping! + "*") + context!.removeBBxServlet(#mapping! + "*") admin!.getJettyServerConfig().saveConfig() methodend From eddbe6b02ee2f5ed3ae2f831dfa6db3a4da089d8 Mon Sep 17 00:00:00 2001 From: AAnastaBASIS Date: Tue, 7 Jun 2022 17:34:53 -0600 Subject: [PATCH 2/2] Made BBxServlet configuration compatible with versions of BBj less than 22.00 --- cfg/RestBridgeConfigurationWindow.bbj | 26 +++++++++++++------------- cfg/RestBridgeConfigurator.bbj | 26 +++++++++++++------------- test/CreateTestRestBridge.bbj | 14 +++++++------- test/RestBridgeTestConfigurator.bbj | 14 +++++++------- test/TestRestBridge.bbjt | 14 +++++++------- 5 files changed, 47 insertions(+), 47 deletions(-) diff --git a/cfg/RestBridgeConfigurationWindow.bbj b/cfg/RestBridgeConfigurationWindow.bbj index 5b05c6d..2196790 100644 --- a/cfg/RestBridgeConfigurationWindow.bbj +++ b/cfg/RestBridgeConfigurationWindow.bbj @@ -345,12 +345,12 @@ class public RestBridgeConfigurationWindow #setWorkingDirectoryPath(servlet!.getParameter("REST_WD")) #setAuthProgramPath(servlet!.getParameter("REST_AUTHPGM")) #setRequestLogPath(servlet!.getParameter("REST_REQUESTLOG")) - #setConfigFilePath(servlet!.getConfig()) + #setConfigFilePath(servlet!.getConfigFile()) error = 1; #setUseGetAllowedFilters(num(servlet!.getParameter("USE_GET_ALLOWED_FILTER")),err=*next); error = 0 if error = 1 then #setUseGetAllowedFilters(0) - #setConfigFilePath(servlet!.getConfig()) + #setConfigFilePath(servlet!.getConfigFile()) #enableUI(1) #enableSubmitters(1) else @@ -731,19 +731,19 @@ class public RestBridgeConfigurationWindow builder!.append("contextConf!.setPath(""/"" + contextName!)"+$0A$) builder!.append("serverConfig!.saveConfig()"+$0A$+$0A$) builder!.append("restBridgeFile! = new File(directory!.getParentFile(),""RestBridge.bbj"")"+$0A$) - builder!.append("bridgeConf! = contextConf!.addBBxServlet(""RestBridge"",bridgeName!,restBridgeFile!.getAbsolutePath())"+$0A$+$0A$) - builder!.append("bridgeConf!.setConfig(configFilePath!)"+$0A$) + builder!.append("bridgeConf! = contextConf!.addBBxServlet(bridgeName!,restBridgeFile!.getAbsolutePath(),""RestBridge"",""service"")"+$0A$+$0A$) + builder!.append("bridgeConf!.setConfigFile(configFilePath!)"+$0A$) builder!.append("adapterProgram! = new File(directory!.getParentFile(),""RestBCAdapter.bbj"")"+$0A$+$0A$) builder!.append("REM Here you can add Parameter to your Birdge."+$0A$) - builder!.append("bridgeConf!.addParam(""REST_ADAPTERPGM"", adapterProgram!.getAbsolutePath())"+$0A$) - builder!.append("bridgeConf!.addParam(""REST_ADAPTERTERM"", ""IO"")"+$0A$) - builder!.append("bridgeConf!.addParam(""REST_TIMEOUT"",timeOut!)"+$0A$) - builder!.append("bridgeConf!.addParam(""REST_WD"",workingDirectory!)"+$0A$) - builder!.append("bridgeConf!.addParam(""REST_AUTHPGM"",authpgm!)"+$0A$) - builder!.append("bridgeConf!.addParam(""REST_PGM_PREFIX"",preffix!)"+$0A$) - builder!.append("bridgeConf!.addParam(""REST_PGM_SUFFIX"",suffix!)"+$0A$) - builder!.append("bridgeConf!.addParam(""USE_GET_ALLOWED_FILTER"",useGetAllowedFilter!)"+$0A$) - builder!.append("bridgeConf!.addParam(""REST_REQUESTLOG"",requestLogPath!)"+$0A$) + builder!.append("bridgeConf!.addParameter(""REST_ADAPTERPGM"", adapterProgram!.getAbsolutePath())"+$0A$) + builder!.append("bridgeConf!.addParameter(""REST_ADAPTERTERM"", ""IO"")"+$0A$) + builder!.append("bridgeConf!.addParameter(""REST_TIMEOUT"",timeOut!)"+$0A$) + builder!.append("bridgeConf!.addParameter(""REST_WD"",workingDirectory!)"+$0A$) + builder!.append("bridgeConf!.addParameter(""REST_AUTHPGM"",authpgm!)"+$0A$) + builder!.append("bridgeConf!.addParameter(""REST_PGM_PREFIX"",preffix!)"+$0A$) + builder!.append("bridgeConf!.addParameter(""REST_PGM_SUFFIX"",suffix!)"+$0A$) + builder!.append("bridgeConf!.addParameter(""USE_GET_ALLOWED_FILTER"",useGetAllowedFilter!)"+$0A$) + builder!.append("bridgeConf!.addParameter(""REST_REQUESTLOG"",requestLogPath!)"+$0A$) builder!.append("serverConfig!.saveConfig()"+$0A$) methodret builder!.toString() diff --git a/cfg/RestBridgeConfigurator.bbj b/cfg/RestBridgeConfigurator.bbj index e5d37a1..759dec4 100644 --- a/cfg/RestBridgeConfigurator.bbj +++ b/cfg/RestBridgeConfigurator.bbj @@ -48,7 +48,7 @@ class public RestBridgeConfigurator bbxServletConfiguration! = cast(BBxServlet ,bbjspConfigurationIterator!.next()) className! = bbxServletConfiguration!.getClassName() - sourceName! = bbxServletConfiguration!.getSourceName() + sourceName! = bbxServletConfiguration!.getSourceFile() if(className! = "RestBridge" AND sourceName! = restBridgeFile!.getAbsolutePath()) then restBridgeConfigurations!.add(contextName!) @@ -131,7 +131,7 @@ class public RestBridgeConfigurator methodret endif - conf!.setConfig(configFilePath!) + conf!.setConfigFile(configFilePath!) rem Clearing the parameters rem This is actually a work-around for the @@ -140,7 +140,7 @@ class public RestBridgeConfigurator if ok then rem remove the servlet parameters while !conf!.getParameterNames().isEmpty() - conf!.clearParams() + conf!.clearParameters() wend endif @@ -150,22 +150,22 @@ class public RestBridgeConfigurator if ok then rem remove the servlet parameters while !conf!.getParamaterNames().isEmpty() - conf!.clearParams() + conf!.clearParameters() wend endif declare File adapterProgram! adapterProgram! = new File(#pluginDirectory!, "RestBCAdapter.bbj") - conf!.addParam("REST_ADAPTERPGM", adapterProgram!.getAbsolutePath()) - conf!.addParam("REST_ADAPTERTERM", "IO") + conf!.addParameter("REST_ADAPTERPGM", adapterProgram!.getAbsolutePath()) + conf!.addParameter("REST_ADAPTERTERM", "IO") declare Iterator it! it! = params!.entrySet().iterator() while(it!.hasNext()) entry! = it!.next() if(entry!.getValue() <> "") then - conf!.addParam(entry!.getKey(), entry!.getValue()) + conf!.addParameter(entry!.getKey(), entry!.getValue()) endif wend @@ -203,21 +203,21 @@ class public RestBridgeConfigurator rem ClassName, Mapping, Source, Config(Optional) rem http://documentation.basis.com/BASISHelp/WebHelp/gridmethods4/bbjjettycontextconfiguration_addbbjspservlet.htm - configuration! = contextConfig!.addBBxServlet("RestBridge", mapping!, restBridgeFile!.getAbsolutePath()) + configuration! = contextConfig!.addBBxServlet(mapping!, restBridgeFile!.getAbsolutePath(), "RestBridge", "service") - configuration!.setConfig(configFilePath!) + configuration!.setConfigFile(configFilePath!) declare File adapterProgram! adapterProgram! = new File(#pluginDirectory!, "RestBCAdapter.bbj") - configuration!.addParam("REST_ADAPTERPGM", adapterProgram!.getAbsolutePath()) - configuration!.addParam("REST_ADAPTERTERM", "IO") + configuration!.addParameter("REST_ADAPTERPGM", adapterProgram!.getAbsolutePath()) + configuration!.addParameter("REST_ADAPTERTERM", "IO") declare Iterator it! it! = params!.entrySet().iterator() while(it!.hasNext()) entry! = it!.next() if(entry!.getValue() <> "") then - configuration!.addParam(entry!.getKey(), entry!.getValue()) + configuration!.addParameter(entry!.getKey(), entry!.getValue()) endif wend @@ -277,7 +277,7 @@ class public RestBridgeConfigurator it! = bbxServlets!.iterator() while(it!.hasNext()) conf! = cast(BBxServlet, it!.next()) - if(conf!.getClassName().equals("RestBridge") AND conf!.getSourceName().equals(sourceFile!.getAbsolutePath())) then + if(conf!.getClassName().equals("RestBridge") AND conf!.getSourceFile().equals(sourceFile!.getAbsolutePath())) then restBridgeMappings!.addItem(conf!.getMapping()) endif wend diff --git a/test/CreateTestRestBridge.bbj b/test/CreateTestRestBridge.bbj index b48e06b..da0d35f 100644 --- a/test/CreateTestRestBridge.bbj +++ b/test/CreateTestRestBridge.bbj @@ -11,12 +11,12 @@ path! = bbjapi().getFileSystem().resolvePath("RestBridge/RestBridge.bbj") directory! = new File(path!).getParent() bcDir! = new File(directory!, "test/example-bcs/") -config! = context!.addBBxServlet("RestBridge", "/rest_test/*", path!) -config!.addParam("REST_TIMEOUT", "100") -config!.addParam("REST_AUTHPGM", new File(directory!, "authenticate.bbj").getAbsolutePath()) -config!.addParam("REST_WD", bcDir!.getAbsolutePath()) -config!.addParam("REST_PGM_SUFFIX", ".bbj") -config!.addParam("USE_GET_ALLOWED_FILTER", "true") -config!.addParam("REST_ADAPTERPGM", new File(directory!, "RestBCAdapter.bbj").getAbsolutePath()) +config! = context!.addBBxServlet("/rest_test/*", path!, "RestBridge", "service") +config!.addParameter("REST_TIMEOUT", "100") +config!.addParameter("REST_AUTHPGM", new File(directory!, "authenticate.bbj").getAbsolutePath()) +config!.addParameter("REST_WD", bcDir!.getAbsolutePath()) +config!.addParameter("REST_PGM_SUFFIX", ".bbj") +config!.addParameter("USE_GET_ALLOWED_FILTER", "true") +config!.addParameter("REST_ADAPTERPGM", new File(directory!, "RestBCAdapter.bbj").getAbsolutePath()) admin!.getJettyServerConfig().saveConfig() \ No newline at end of file diff --git a/test/RestBridgeTestConfigurator.bbj b/test/RestBridgeTestConfigurator.bbj index d0caaac..742c597 100644 --- a/test/RestBridgeTestConfigurator.bbj +++ b/test/RestBridgeTestConfigurator.bbj @@ -48,13 +48,13 @@ class public RestBridgeTestConfigurator #mapping! = "/rest" + str(System.currentTimeMillis()) + "/" - config! = context!.addBBxServlet("RestBridge", #mapping! + "*", path!) - config!.addParam("REST_TIMEOUT", "100") - config!.addParam("REST_AUTHPGM", new File(directory!, "authenticate.bbj").getAbsolutePath()) - config!.addParam("REST_WD", bcDir!.getAbsolutePath()) - config!.addParam("REST_PGM_SUFFIX", ".bbj") - config!.addParam("USE_GET_ALLOWED_FILTER", "true") - config!.addParam("REST_ADAPTERPGM", new File(directory!, "RestBCAdapter.bbj").getAbsolutePath()) + config! = context!.addBBxServlet(#mapping! + "*", path!, "RestBridge", "service") + config!.addParameter("REST_TIMEOUT", "100") + config!.addParameter("REST_AUTHPGM", new File(directory!, "authenticate.bbj").getAbsolutePath()) + config!.addParameter("REST_WD", bcDir!.getAbsolutePath()) + config!.addParameter("REST_PGM_SUFFIX", ".bbj") + config!.addParameter("USE_GET_ALLOWED_FILTER", "true") + config!.addParameter("REST_ADAPTERPGM", new File(directory!, "RestBCAdapter.bbj").getAbsolutePath()) admin!.getJettyServerConfig().saveConfig() methodend diff --git a/test/TestRestBridge.bbjt b/test/TestRestBridge.bbjt index d401074..3f0c5d7 100644 --- a/test/TestRestBridge.bbjt +++ b/test/TestRestBridge.bbjt @@ -61,13 +61,13 @@ class public RestBridgeTest #mapping! = "/rest" + str(System.currentTimeMillis()) + "/" - config! = context!.addBBxServlet("RestBridge", #mapping! + "*", path!) - config!.addParam("REST_TIMEOUT", "100") - config!.addParam("REST_AUTHPGM", new File(directory!, "authenticate.bbj").getAbsolutePath()) - config!.addParam("REST_WD", bcDir!.getAbsolutePath()) - config!.addParam("REST_PGM_SUFFIX", ".bbj") - config!.addParam("USE_GET_ALLOWED_FILTER", "0") - config!.addParam("REST_ADAPTERPGM", new File(directory!, "RestBCAdapter.bbj").getAbsolutePath()) + config! = context!.addBBxServlet(#mapping! + "*", path!, "RestBridge", "service") + config!.addParameter("REST_TIMEOUT", "100") + config!.addParameter("REST_AUTHPGM", new File(directory!, "authenticate.bbj").getAbsolutePath()) + config!.addParameter("REST_WD", bcDir!.getAbsolutePath()) + config!.addParameter("REST_PGM_SUFFIX", ".bbj") + config!.addParameter("USE_GET_ALLOWED_FILTER", "0") + config!.addParameter("REST_ADAPTERPGM", new File(directory!, "RestBCAdapter.bbj").getAbsolutePath()) admin!.getJettyServerConfig().saveConfig() methodend