Sorry

This feed does not validate.

In addition, interoperability with the widest range of feed readers could be improved by implementing the following recommendations.

Source: http://dpastov.blogspot.com/feeds/posts/default?alt=rss

  1. <?xml version='1.0' encoding='UTF-8'?><rss xmlns:atom="http://www.w3.org/2005/Atom" xmlns:openSearch="http://a9.com/-/spec/opensearchrss/1.0/" xmlns:blogger="http://schemas.google.com/blogger/2008" xmlns:georss="http://www.georss.org/georss" xmlns:gd="http://schemas.google.com/g/2005" xmlns:thr="http://purl.org/syndication/thread/1.0" version="2.0"><channel><atom:id>tag:blogger.com,1999:blog-34728599</atom:id><lastBuildDate>Thu, 05 Jun 2025 06:53:47 +0000</lastBuildDate><category>lotus script</category><category>Java</category><category>lotus approach</category><category>lotus features</category><category>lotus notes</category><category>Domino</category><category>lotus news</category><category>web</category><category>javascript</category><category>me</category><category>lotus issues</category><category>lotus and java</category><category>notes api</category><category>DSAPI</category><category>Development</category><category>lotus formula</category><category>Play Framework</category><category>lotus integration</category><category>Google</category><category>lotus community</category><category>xPages</category><category>GitHub</category><category>PDF</category><category>SEO</category><category>LS2J</category><category>Velocity</category><category>lotus fun</category><category>lotus perfomance</category><category>Certificate</category><category>XML-XSL</category><category>Drupal</category><category>Jenkins</category><category>Node.js</category><category>SSO</category><category>XFDF</category><category>locale</category><category>Algorithms</category><category>Analytics</category><category>CSS</category><category>CloudFlare</category><category>DDE</category><category>FDF</category><category>FreeMarker</category><category>JSON</category><category>Jira</category><category>LS</category><category>Mongodb</category><category>RSS</category><category>SOAP</category><category>Scala</category><category>Typesafe</category><category>XPath</category><category>XSS</category><category>htmlminifier</category><category>iText</category><category>notes.ini</category><category>sqwish</category><category>uglifyjs</category><category>views</category><title>Find the best way</title><description>I write about Java, HCL Notes Domino, Web</description><link>https://dpastov.blogspot.com/</link><managingEditor>noreply@blogger.com (Dmytro)</managingEditor><generator>Blogger</generator><openSearch:totalResults>277</openSearch:totalResults><openSearch:startIndex>1</openSearch:startIndex><openSearch:itemsPerPage>25</openSearch:itemsPerPage><item><guid isPermaLink="false">tag:blogger.com,1999:blog-34728599.post-8023669060304935948</guid><pubDate>Wed, 02 Apr 2025 05:00:00 +0000</pubDate><atom:updated>2025-04-02T07:00:00.233+02:00</atom:updated><category domain="http://www.blogger.com/atom/ns#">Java</category><category domain="http://www.blogger.com/atom/ns#">PDF</category><title>Generating PDF Documents in Domino Using PD4ML Java Library</title><description>&lt;p&gt;Generating PDF documents from web content or structured data is a common requirement in many applications. When working with HCL Domino, we often need to create PDFs from HTML templates, Notes documents, or dynamically generated content. In this article, I&#39;ll walk you through using the &lt;strong&gt;PD4ML&lt;/strong&gt; Java library to generate PDFs within a &lt;strong&gt;Domino Java Agent&lt;/strong&gt;.&lt;/p&gt;
  2.  
  3. &lt;h2&gt;Why Use PD4ML?&lt;/h2&gt;
  4. &lt;p&gt;PD4ML is a powerful Java library that allows you to convert HTML and CSS into high-quality PDF documents. It supports:&lt;/p&gt;
  5. &lt;ul&gt;
  6.    &lt;li&gt;&lt;strong&gt;CSS styling&lt;/strong&gt;&lt;/li&gt;
  7.    &lt;li&gt;&lt;strong&gt;Page breaks and headers/footers&lt;/strong&gt;&lt;/li&gt;
  8.    &lt;li&gt;&lt;strong&gt;Embedded images&lt;/strong&gt;&lt;/li&gt;
  9.    &lt;li&gt;&lt;strong&gt;Table of contents and bookmarks&lt;/strong&gt;&lt;/li&gt;
  10.    &lt;li&gt;&lt;strong&gt;Various output formats (A4, Letter, etc.)&lt;/strong&gt;&lt;/li&gt;
  11. &lt;/ul&gt;
  12. &lt;p&gt;This makes it a great choice for generating invoices, reports, or any structured documents from Domino applications.&lt;/p&gt;
  13.  
  14. &lt;h2&gt;Setting Up PD4ML in Domino&lt;/h2&gt;
  15. &lt;p&gt;To use &lt;strong&gt;PD4ML&lt;/strong&gt; in your Domino environment, follow these steps:&lt;/p&gt;
  16.  
  17. &lt;h3&gt;1. Download PD4ML&lt;/h3&gt;
  18. &lt;p&gt;Get the &lt;strong&gt;PD4ML JAR&lt;/strong&gt; from &lt;a href=&quot;https://pd4ml.com/download/&quot;&gt;pd4ml.com&lt;/a&gt;. You can use the free or commercial version, depending on your needs.&lt;/p&gt;
  19.  
  20. &lt;h3&gt;2. Add PD4ML to Your Domino Project&lt;/h3&gt;
  21. &lt;ol&gt;
  22.    &lt;li&gt;Place the &lt;strong&gt;PD4ML JAR&lt;/strong&gt; file in the &lt;code&gt;jvm/lib/ext&lt;/code&gt; directory of your Domino server (if you want it available for all agents) or within your NSF under &lt;code&gt;WEB-INF/lib&lt;/code&gt; (if used in an XPages app).&lt;/li&gt;
  23.    &lt;li&gt;If using a Java agent, attach the JAR to the agent&#39;s &lt;strong&gt;Build Path&lt;/strong&gt; (I usually create a dedicated Java library for external JARs).&lt;/li&gt;
  24. &lt;/ol&gt;
  25.  
  26. &lt;h3&gt;3. Write a Java Agent to Generate a PDF&lt;/h3&gt;
  27. &lt;p&gt;Below is just a snippet to get an idea what you need to do in your &lt;strong&gt;Domino Java Agent&lt;/strong&gt;. The example takes an HTML string and converts it into a PDF:&lt;/p&gt;
  28.  
  29. &lt;pre style=&quot;background-color: #f6f8fa; font-family: Consolas, &#39;Liberation Mono&#39;, Menlo, monospace; font-size: 12px; padding: 10px;&quot;&gt;
  30. &lt;code&gt;PD4ML pd4ml = new PD4ML();
  31.  
  32. String html = &quot;TEST &amp;lt;b&amp;gt;Hello, World!&amp;lt;/b&amp;gt;&quot;;
  33. ByteArrayInputStream bais = new ByteArrayInputStream(html.getBytes());
  34.  
  35. // read and parse HTML
  36. pd4ml.readHTML(bais);
  37.  
  38. File pdf = File.createTempFile(&quot;result&quot;, &quot;.pdf&quot;);
  39. FileOutputStream fos = new FileOutputStream(pdf);
  40.  
  41. // render and write the result as PDF
  42. pd4ml.writePDF(fos);
  43. &lt;/code&gt;&lt;/pre&gt;
  44.  
  45. &lt;h3&gt;PD4ML and HCL Notes/Domino &lt;/h3&gt;
  46.  
  47. PD4ML claims they provide support for converting HCL Notes documents into PDFs (I have never checked it though), making it an ideal solution for Domino applications.
  48.  
  49. &lt;p&gt;Using &lt;strong&gt;PD4ML&lt;/strong&gt; in HCL Domino makes PDF generation straightforward. Whether you need to create reports, invoices, or structured documents, this Java library is a flexible and efficient solution. Try it out in your Domino projects and let me know if you run into any issues!&lt;/p&gt;
  50.  
  51. &lt;p&gt;I have previously used &lt;a href=&quot;https://itextpdf.com/&quot; target=&quot;_blank&quot; rel=&quot;nofollow&quot;&gt;iText&lt;/a&gt; and &lt;a href=&quot;https://pdfbox.apache.org/&quot; target=&quot;_blank&quot; rel=&quot;nofollow&quot;&gt;Apache PDFBox&lt;/a&gt; for generating PDFs in Domino, as well as various external tools that convert HTML files into PDFs. However, I found PD4ML to be the most user-friendly solution due to its seamless integration with HTML and CSS, built-in support for page formatting, and its ability to handle embedded images and styles with minimal effort.&lt;/p&gt;
  52.  
  53. &lt;hr&gt;
  54.  
  55. &lt;p&gt;What tools or libraries do you use in your Domino applications to build PDF files?&lt;/p&gt;</description><link>https://dpastov.blogspot.com/2025/04/generating-pdf-documents-in-domino.html</link><author>noreply@blogger.com (Dmytro)</author><thr:total>1</thr:total></item><item><guid isPermaLink="false">tag:blogger.com,1999:blog-34728599.post-8569701489652909098</guid><pubDate>Tue, 17 Sep 2024 06:30:00 +0000</pubDate><atom:updated>2024-09-17T12:08:06.123+02:00</atom:updated><category domain="http://www.blogger.com/atom/ns#">SSO</category><title>Implementing SSO Authentication with Saml Using LotusScript &amp; Java</title><description>&lt;h4&gt;Introduction&lt;/h4&gt;
  56. &lt;p&gt;
  57.    SAML (Security Assertion Markup Language) is a widely used protocol for Single Sign-On (SSO), allowing users to authenticate once and access multiple applications.
  58.    In this article, we&#39;ll walk through implementing SAML authentication in a Domino application, detailing the steps needed to provide metadata, make the SSO call, and handle the assertion response (ACS call).
  59. &lt;/p&gt;
  60.  
  61. &lt;h4&gt;Prerequisites&lt;/h4&gt;
  62. &lt;p&gt;
  63.    Before you begin, ensure you have:
  64.    &lt;ul&gt;
  65.        &lt;li&gt;Access to a SAML Identity Provider (IdP) such as Microsoft Azure AD or Okta.&lt;/li&gt;
  66.        &lt;li&gt;Basic knowledge of Java and HTTP requests.&lt;/li&gt;
  67.        &lt;li&gt;A configured Domino server with the capability to execute Java agents.&lt;/li&gt;
  68.    &lt;/ul&gt;
  69. &lt;/p&gt;
  70.  
  71. &lt;h4&gt;Step-by-Step Implementation&lt;/h4&gt;
  72.  
  73. &lt;h5&gt;1. Providing Metadata&lt;/h5&gt;
  74. &lt;p&gt;
  75.    The first step in setting up SAML authentication is to provide metadata that the Identity Provider (IdP) and Service Provider (SP) can use for configuration.
  76.    You’ll need to supply both IdP and SP metadata to the Domino application.
  77. &lt;/p&gt;
  78.  
  79. &lt;p&gt;
  80.    Basically it means you will need to make 2 public URL: https://yourdomain.com/meta/{id} that provide XML response (and that will be used by IdP) and additionally to that IdP sohuld provide their URL you are going work with.
  81. &lt;/p&gt;
  82.  
  83. &lt;p&gt;
  84.    You also need to find a suitable Java library that can provide your a SamlClient (I use https://github.com/lastpass/saml-sdk-java)
  85. &lt;/p&gt;
  86.  
  87.  
  88. &lt;h5&gt;2. Making the SSO Call&lt;/h5&gt;
  89. &lt;p&gt;
  90.    Once the metadata is set, you can make the SSO request to the IdP. Here’s the code that generates the SAML authentication request and sends it to the IdP.
  91. &lt;/p&gt;
  92. &lt;pre style=&quot;background-color: #f6f8fa; font-family: Consolas, &#39;Liberation Mono&#39;, Menlo, monospace; font-size: 12px; padding: 10px;&quot;&gt;
  93. String idpURL = config.getItemValueString(&quot;IdPURL&quot;);
  94. idpMeta = new URL(idpURL).openStream();
  95.  
  96. String spData = config.getItemValueString(&quot;MetaXML&quot;);
  97. spMeta = new ByteArrayInputStream(spData.getBytes(StandardCharsets.UTF_8));
  98.  
  99. // 2. initialize saml client
  100. SAMLInit.initialize();
  101. IdPConfig idpConfig = new IdPConfig(idpMeta);
  102. SPConfig spConfig = new SPConfig(spMeta);
  103. SAMLClient client = new SAMLClient(spConfig, idpConfig);
  104.  
  105. // 3. send login request
  106. String requestId = SAMLUtils.generateRequestId();
  107. String authrequest = client.generateAuthnRequest(requestId);
  108. String url = client.getIdPConfig().getLoginUrl() + &quot;?SAMLRequest=&quot; + URLEncoder.encode(authrequest, &quot;UTF-8&quot;);
  109. &lt;/pre&gt;
  110. &lt;p&gt;
  111.    The &lt;code&gt;SAMLClient&lt;/code&gt; is used to generate the authentication request, and the resulting URL is the login endpoint where the user must be redirected.
  112. &lt;/p&gt;
  113.  
  114. &lt;h5&gt;3. Handling the Assertion Consumer Service (ACS) Call&lt;/h5&gt;
  115. &lt;p&gt;
  116.    After the user is authenticated by the IdP, the SAML response is sent back to the Domino server via the Assertion Consumer Service (ACS) endpoint.
  117.    The following code handles this response and extracts user attributes from it.
  118. &lt;/p&gt;
  119. &lt;pre style=&quot;background-color: #f6f8fa; font-family: Consolas, &#39;Liberation Mono&#39;, Menlo, monospace; font-size: 12px; padding: 10px;&quot;&gt;
  120. String authresponse = web.getParam(&quot;AuthResponse&quot;);
  121. String idpURL = config.getItemValueString(&quot;IdPURL&quot;);
  122. String spData = config.getItemValueString(&quot;MetaXML&quot;);
  123.  
  124. SAMLInit.initialize();
  125. IdPConfig idpConfig = new IdPConfig(idpMeta);
  126. SPConfig spConfig = new SPConfig(spMeta);
  127. SAMLClient client = new SAMLClient(spConfig, idpConfig);
  128.  
  129. AttributeSet aset = client.validateResponse(authresponse);
  130. Map&lt;String, List&lt;String&gt;&gt; attr = aset.getAttributes();
  131. for (Map.Entry&lt;String, List&lt;String&gt;&gt; entry : attr.entrySet()) {
  132.    String key = entry.getKey();
  133.    List&lt;String&gt; values = entry.getValue();
  134.    doc.replaceItemValue(key, new Vector&lt;&gt;(values));
  135. }
  136. &lt;/pre&gt;
  137. &lt;p&gt;
  138.    This code validates the SAML response using the &lt;code&gt;SAMLClient&lt;/code&gt;, extracts the attributes (such as username, email, etc.), and stores them in the Domino document.
  139. &lt;/p&gt;
  140.  
  141. &lt;h4&gt;Conclusion&lt;/h4&gt;
  142. &lt;p&gt;
  143.    Implementing SAML authentication in Domino involves configuring metadata for the IdP and SP, making an authentication request, and handling the ACS call to process the response.
  144.    While this example uses the LastPass SAML library, similar methods apply when using other libraries. The overall process is straightforward and can greatly improve the security
  145.    and convenience of user authentication in your Domino applications.
  146. &lt;/p&gt;
  147. </description><link>https://dpastov.blogspot.com/2024/09/implementing-sso-authentication-with_01404217988.html</link><author>noreply@blogger.com (Dmytro)</author><thr:total>0</thr:total></item><item><guid isPermaLink="false">tag:blogger.com,1999:blog-34728599.post-4722652683442742108</guid><pubDate>Mon, 16 Sep 2024 06:00:00 +0000</pubDate><atom:updated>2024-09-16T09:57:26.492+02:00</atom:updated><category domain="http://www.blogger.com/atom/ns#">Domino</category><category domain="http://www.blogger.com/atom/ns#">SSO</category><title>Implementing SSO Authentication with OpenID Using LotusScript</title><description>&lt;h4&gt;Introduction&lt;/h4&gt;
  148. &lt;p&gt;
  149.    Single Sign-On (SSO) simplifies the user authentication process by allowing users to log in once and gain access to multiple applications.
  150.    OpenID Connect is an authentication layer on top of OAuth 2.0 that facilitates SSO. In this article, we&#39;ll walk through implementing
  151.    SSO authentication using OpenID Connect with LotusScript.
  152. &lt;/p&gt;
  153.  
  154. &lt;h4&gt;Prerequisites&lt;/h4&gt;
  155. &lt;p&gt;
  156.    Before diving into the code, ensure you have:
  157.    &lt;ul&gt;
  158.        &lt;li&gt;Basic knowledge of LotusScript and HTTP requests.&lt;/li&gt;
  159.        &lt;li&gt;Familiarity with OpenID Connect and OAuth 2.0.&lt;/li&gt;
  160.        &lt;li&gt;Access to a Microsoft Azure AD tenant or another OpenID Connect provider.&lt;/li&gt;
  161.    &lt;/ul&gt;
  162. &lt;/p&gt;
  163.  
  164. &lt;h4&gt;Step-by-Step Implementation&lt;/h4&gt;
  165.  
  166. &lt;h5&gt;1. Setting Up Your Environment&lt;/h5&gt;
  167. &lt;p&gt;
  168.    Make sure your Lotus Domino server is properly configured to handle HTTP requests and that you have access to your OpenID Connect provider&#39;s endpoints.
  169. &lt;/p&gt;
  170.  
  171. &lt;h5&gt;2. Retrieving the Access Token&lt;/h5&gt;
  172. &lt;p&gt;The access token is obtained after the user successfully authenticates. I am pretty sure outdays most of developer know how to parse values from DocumentContext (fieldsÆ QUERY_STRING or REQUEST_CONTENT). In example below I just use my own class but really you can do it in a few lines if needed&lt;/p&gt;
  173. &lt;pre style=&quot;background-color: #f6f8fa; font-family: Consolas, &#39;Liberation Mono&#39;, Menlo, monospace; font-size: 12px; padding: 10px;&quot;&gt;
  174. access_token = web.GetRequestParam(&quot;access_token&quot;)
  175. token_type = web.GetRequestParam(&quot;token_type&quot;)
  176. &lt;/code&gt;&lt;/pre&gt;
  177.  
  178. &lt;h4&gt;3. Making API Requests&lt;/h4&gt;
  179. &lt;p&gt;
  180.    Use &lt;code&gt;NotesHTTPRequest&lt;/code&gt; to communicate with the OpenID Connect provider’s API. Set the &lt;code&gt;Authorization&lt;/code&gt; header with the access token:
  181. &lt;/p&gt;
  182. &lt;pre style=&quot;background-color: #f6f8fa; font-family: Consolas, &#39;Liberation Mono&#39;, Menlo, monospace; font-size: 12px; padding: 10px;&quot;&gt;
  183. Dim session as NotesSession
  184. Dim http As NotesHTTPRequest
  185. Dim jsonNav as NotesJSONNavigator
  186.  
  187. Set session = new NotesSession
  188. Set http = session.Createhttprequest()
  189. http.Preferjsonnavigator = True
  190. Call http.Setheaderfield(&quot;Authorization&quot;, token_type &amp; &quot; &quot; &amp; access_token)
  191. Set jsonNav = http.Get(&quot;https://graph.microsoft.com/v1.0/me&quot;)
  192. &lt;/code&gt;&lt;/pre&gt;
  193.  
  194. &lt;h4&gt;4. Parsing the Response&lt;/h4&gt;
  195. &lt;p&gt;Handle and parse the JSON response to extract user information:&lt;/p&gt;
  196. &lt;pre style=&quot;background-color: #f6f8fa; font-family: Consolas, &#39;Liberation Mono&#39;, Menlo, monospace; font-size: 12px; padding: 10px;&quot;&gt;
  197. On Error 4843 Resume Next
  198. Dim jsonEl As NotesJSONElement
  199. Dim jsonObj As NotesJSONObject
  200. Set jsonEl = jsonNav.getelementbyname(&quot;error&quot;)
  201. If Not jsonEl Is Nothing Then
  202.    Set jsonObj = jsonEl.Value
  203.    Print |Status: 401|
  204.    Print &quot;&amp;lt;h2&amp;gt;Error&amp;lt;/h2&amp;gt;&quot;
  205.    Print &quot;&amp;lt;p&amp;gt;&quot; &amp; jsonObj.Getelementbyname(&quot;code&quot;).Value &amp; &quot;&amp;lt;/p&amp;gt;&quot;
  206.    Print &quot;&amp;lt;p&amp;gt;&quot; &amp; jsonObj.Getelementbyname(&quot;message&quot;).Value &amp; &quot;&amp;lt;/p&amp;gt;&quot;
  207.    Call scriptLog.LogInfo(jsonNav.Stringify())
  208.    Exit Function
  209. End If
  210.  
  211. mail = jsonNav.Getelementbyname(&quot;mail&quot;).Value
  212. displayName = jsonNav.Getelementbyname(&quot;displayName&quot;).Value
  213. &lt;/code&gt;&lt;/pre&gt;
  214.  
  215. &lt;p&gt;Knowing user&#39;s email or other unique data will help you to find a user in your application and make necessary steps for auth.&lt;/p&gt;
  216.  
  217. &lt;h4&gt;Conclusion&lt;/h4&gt;
  218. &lt;p&gt;
  219.    In my case, I have a web application written in Domino where users can register and sign in without using &lt;code&gt;names.nsf&lt;/code&gt;.
  220.    This approach allows for seamless authentication using OpenID, bypassing the traditional Domino authentication model.
  221. &lt;/p&gt;
  222. &lt;p&gt;
  223.    While this solution does not allow users to authenticate directly with Domino, it is still a significant step in that direction.
  224.    By integrating OpenID Connect, we are moving closer to a more flexible authentication model that can eventually be expanded
  225.    to support Domino authentication.
  226. &lt;/p&gt;
  227. </description><link>https://dpastov.blogspot.com/2024/09/implementing-sso-authentication-with.html</link><author>noreply@blogger.com (Dmytro)</author><thr:total>2</thr:total></item><item><guid isPermaLink="false">tag:blogger.com,1999:blog-34728599.post-4321492353083690763</guid><pubDate>Thu, 02 Nov 2023 10:36:00 +0000</pubDate><atom:updated>2023-11-02T11:41:43.350+01:00</atom:updated><category domain="http://www.blogger.com/atom/ns#">Domino</category><title>Configuring Entitlement Tracking in Domino 12</title><description>&lt;p&gt;In the realm of HCL Domino Server 12.0, the feature of &quot;Entitlement Tracking&quot; has become a vital component for organizations.&lt;/p&gt;
  228.  
  229. &lt;p&gt;While comprehensive information regarding Entitlement Tracking is available through HCL, I needed to know some practical management aspects, such as disabling the feature and adjusting intervals etc.&lt;/p&gt;
  230.  
  231. &lt;h2&gt;Disabling Entitlement Tracking:&lt;/h2&gt;
  232. &lt;p&gt;To disable entitlement tracking, add the following entry and restart the server:&lt;/p&gt;
  233. &lt;pre style=&quot;background-color: #f6f8fa; border-radius: 3px; box-sizing: border-box; color: #24292e; font-family: SFMono-Regular, Consolas, &amp;quot;Liberation Mono&amp;quot;, Menlo, monospace; font-size: 13.6px; line-height: 1.45; overflow-wrap: normal; overflow: auto; padding: 16px;&quot;&gt;&lt;code style=&quot;background: initial; border-radius: 3px; border: 0px; box-sizing: border-box; display: inline; font-family: SFMono-Regular, Consolas, &amp;quot;Liberation Mono&amp;quot;, Menlo, monospace; line-height: inherit; margin: 0px; overflow-wrap: normal; overflow: visible; padding: 0px; word-break: normal;&quot;&gt;DISABLE_ENTITLEMENT_TRACKING=1
  234. &lt;/code&gt;&lt;/pre&gt;
  235.  
  236. &lt;h2&gt;Debugging for Entitlement Tracking Issues:&lt;/h2&gt;
  237. &lt;p&gt;Debug settings can be incredibly useful for troubleshooting any issues related to Entitlement Tracking. Here&#39;s how to configure debugging options:&lt;/p&gt;
  238.  &lt;pre style=&quot;background-color: #f6f8fa; border-radius: 3px; box-sizing: border-box; color: #24292e; font-family: SFMono-Regular, Consolas, &amp;quot;Liberation Mono&amp;quot;, Menlo, monospace; font-size: 13.6px; line-height: 1.45; overflow-wrap: normal; overflow: auto; padding: 16px;&quot;&gt;&lt;code style=&quot;background: initial; border-radius: 3px; border: 0px; box-sizing: border-box; display: inline; font-family: SFMono-Regular, Consolas, &amp;quot;Liberation Mono&amp;quot;, Menlo, monospace; line-height: inherit; margin: 0px; overflow-wrap: normal; overflow: visible; padding: 0px; word-break: normal;&quot;&gt;DEBUG_ENTITLEMENT_AGGREGATOR_INTERVAL=60
  239. DEBUG_UPDATE_ENTITLEMENT_TRACKING=2
  240. ES_OPT_TIMING=1
  241. DEBUG_DIRCAT=3
  242. &lt;/code&gt;&lt;/pre&gt;
  243.  
  244. &lt;p&gt;Hope that will help somebody.&lt;/p&gt;</description><link>https://dpastov.blogspot.com/2023/11/configuring-entitlement-tracking-in.html</link><author>noreply@blogger.com (Dmytro)</author><thr:total>0</thr:total></item><item><guid isPermaLink="false">tag:blogger.com,1999:blog-34728599.post-1274580201345768280</guid><pubDate>Fri, 27 Oct 2023 11:46:00 +0000</pubDate><atom:updated>2023-10-27T13:46:12.479+02:00</atom:updated><category domain="http://www.blogger.com/atom/ns#">Domino</category><category domain="http://www.blogger.com/atom/ns#">Java</category><title>Overcoming Domino&#39;s Agent Scheduling Limitations with JavaAddin</title><description>&lt;p style=&quot;text-align: justify;&quot;&gt;If you&#39;re frustrated with Domino&#39;s limitations on scheduling agents to run more frequently than once every 5 minutes, you&#39;re not alone. As a programmer, you understand the need for flexibility and control in your applications. In this article, we&#39;ll discuss a practical solution: creating a JavaAddin for Domino that can trigger agents at shorter intervals, allowing you to gain more fine-grained control over your scheduled tasks.&lt;/p&gt;&lt;h3 style=&quot;text-align: left;&quot;&gt;Understanding the Domino Agent Scheduler&lt;/h3&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;Domino provides a robust environment for running scheduled agents. However, it imposes a minimum time gap of 5 minutes between consecutive runs of the same agent. This limitation can be a roadblock for applications that require more frequent execution.&lt;h3 style=&quot;text-align: left;&quot;&gt;&lt;br /&gt;&lt;/h3&gt;&lt;h3 style=&quot;text-align: left;&quot;&gt;The Power of JavaAddins&lt;/h3&gt;&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;JavaAddins offer a way to extend Domino&#39;s functionality using Java code. This opens up a world of possibilities, including overcoming the 5-minute scheduling restriction. Here&#39;s how you can do it:&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;&lt;b&gt;1. Setting Up Your JavaAddin&lt;/b&gt;&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;div&gt;To get started, you&#39;ll need to create a JavaAddin. This involves writing Java code to interface with Domino. The code should enable you to trigger agents at shorter intervals than what Domino&#39;s native scheduling allows.&lt;/div&gt;&lt;b&gt;&lt;div&gt;&lt;b&gt;&lt;br /&gt;&lt;/b&gt;&lt;/div&gt;2. Utilizing Timers&lt;/b&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;One of the most effective ways to bypass the 5-minute limitation is to use timers in your JavaAddin. With timers, you can execute your agent at precise intervals, even down to seconds. Here&#39;s a simplified example of how this could look in your Java code:&lt;/div&gt;&lt;div&gt;
  245.    
  246. &lt;pre style=&quot;background-color: #f6f8fa; border-radius: 3px; box-sizing: border-box; color: #24292e; font-family: SFMono-Regular, Consolas, &amp;quot;Liberation Mono&amp;quot;, Menlo, monospace; font-size: 13.6px; line-height: 1.45; overflow-wrap: normal; overflow: auto; padding: 16px;&quot;&gt;&lt;code style=&quot;background: initial; border-radius: 3px; border: 0px; box-sizing: border-box; display: inline; font-family: SFMono-Regular, Consolas, &amp;quot;Liberation Mono&amp;quot;, Menlo, monospace; line-height: inherit; margin: 0px; overflow-wrap: normal; overflow: visible; padding: 0px; word-break: normal;&quot;&gt;import lotus.domino.*;
  247. public class CustomScheduler extends JavaServerAddin {
  248.    public void runNotes() {
  249.        try {
  250.            Session session = NotesFactory.createSession();
  251.            Database database = session.getDatabase(&quot;&quot;, &quot;YourDatabase.nsf&quot;);
  252.            Agent agent = database.getAgent(&quot;YourAgent&quot;);
  253.  
  254.            // Set the execution interval in milliseconds
  255.            int interval = 30000; // 30 seconds
  256.  
  257.            while (true) {
  258.                agent.runWithDocumentContext(null);
  259.                sleep(interval);
  260.            }
  261.        } catch (Exception e) {
  262.            e.printStackTrace();
  263.        }
  264.    }
  265. }&lt;/code&gt;&lt;/pre&gt;
  266.  &lt;/div&gt;&lt;/div&gt;&lt;div&gt;This code defines a Java thread that runs your specified agent every 30 seconds, effectively bypassing Domino&#39;s 5-minute restriction.&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;b&gt;3. Deploying Your JavaAddin&lt;/b&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;Once you&#39;ve created your JavaAddin, you need to deploy it within your Domino environment. Ensure that the necessary permissions and access controls are in place.&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;&lt;b&gt;4. Monitoring and Maintenance&lt;/b&gt;&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;Regularly monitor the execution of your custom scheduling solution. Ensure that it&#39;s working as expected and doesn&#39;t place undue stress on your Domino server.&lt;h3 style=&quot;text-align: left;&quot;&gt;&lt;b&gt;&lt;br /&gt;&lt;/b&gt;&lt;/h3&gt;&lt;h3 style=&quot;text-align: left;&quot;&gt;&lt;b&gt;Conclusion&lt;/b&gt;&lt;/h3&gt;&lt;div&gt;&lt;b&gt;&lt;br /&gt;&lt;/b&gt;&lt;/div&gt;By creating a JavaAddin for Domino that can trigger agents more frequently, you can take control of your scheduling needs. This solution empowers you to run your agents at shorter intervals, achieving the level of precision your applications require. While this approach requires some development effort, the benefits of fine-grained agent scheduling can greatly enhance your Domino-based applications.&lt;br /&gt;&lt;br /&gt;In summary, if you&#39;re tired of being constrained by Domino&#39;s 5-minute scheduling limitation, consider the power of JavaAddins to break free and gain control over your scheduled agents.&lt;br /&gt;&lt;br /&gt;I have also created a bit more advanced setup which you can get on github: &lt;a href=&quot;https://github.com/dpastov/DominoAgentsHelper/&quot; target=&quot;_blank&quot;&gt;DominoAgentsHelper&lt;/a&gt;&amp;nbsp;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;Stay tuned for more technical insights, delivered directly to the point, in future articles.&lt;/div&gt;&lt;/div&gt;</description><link>https://dpastov.blogspot.com/2023/10/overcoming-dominos-agent-scheduling.html</link><author>noreply@blogger.com (Dmytro)</author><thr:total>4</thr:total></item><item><guid isPermaLink="false">tag:blogger.com,1999:blog-34728599.post-1597830296760357664</guid><pubDate>Mon, 25 Sep 2023 09:35:00 +0000</pubDate><atom:updated>2023-09-25T12:10:42.287+02:00</atom:updated><category domain="http://www.blogger.com/atom/ns#">lotus script</category><category domain="http://www.blogger.com/atom/ns#">notes api</category><title>Change Database ReplicaID programmatically</title><description>&lt;p&gt;Here is a solution that change ReplicaId of NotesDatabase. Since native capabilities of LotusScript/Java classes do not allow such operation (at least yet), there is a way to do it using C Notes API. Our envrionment consists of both: Windows and Linux servers therefore I had to make a solution that cover both OS.&lt;/p&gt;
  267.  
  268.  
  269. &lt;h4&gt;Declare&lt;/h4&gt;
  270.  
  271. &lt;pre style=&quot;background-color: #f6f8fa; border-radius: 3px; box-sizing: border-box; color: #24292e; font-family: SFMono-Regular, Consolas, &amp;quot;Liberation Mono&amp;quot;, Menlo, monospace; font-size: 13.6px; line-height: 1.45; overflow-wrap: normal; overflow: auto; padding: 16px;&quot;&gt;&lt;code style=&quot;background: initial; border-radius: 3px; border: 0px; box-sizing: border-box; display: inline; font-family: SFMono-Regular, Consolas, &amp;quot;Liberation Mono&amp;quot;, Menlo, monospace; line-height: inherit; margin: 0px; overflow-wrap: normal; overflow: visible; padding: 0px; word-break: normal;&quot;&gt;Public Const W32_LIB = {nnotes.dll}
  272. Public Const LINUX_LIB = {libnotes.so}
  273.  
  274. Type TIMEDATE
  275. Innards(0 to 1) As Long
  276. End Type
  277.  
  278. Type DBREPLICAINFO
  279. ID As TIMEDATE &#39;ID that is same for all replica files
  280. Flags As Integer &#39;Replication flags
  281. CutoffInterval As Integer &#39;Automatic Replication Cutoff
  282. Cutoff As TIMEDATE &#39;Replication cutoff date
  283. End Type
  284.  
  285. Declare sub W32_OSCurrentTimeDate Lib W32_LIB Alias &quot;OSCurrentTIMEDATE&quot;(Ret As TIMEDATE)
  286. Declare Function W32_NSFDbOpen Lib W32_LIB Alias &quot;NSFDbOpen&quot; (ByVal dbName As String, hdb As Long) As Integer
  287. Declare Function W32_NSFDbClose Lib W32_LIB Alias &quot;NSFDbClose&quot; (ByVal hdb As Long) As Integer
  288. Declare Function W32_NSFDbReplicaInfoGet Lib W32_LIB Alias &quot;NSFDbReplicaInfoGet&quot; (ByVal hdb As Long, hdbr As DBREPLICAINFO) As Integer
  289. Declare Function W32_NSFDbReplicaInfoSet Lib W32_LIB Alias &quot;NSFDbReplicaInfoSet&quot; (ByVal hdb As Long, hdbr As DBREPLICAINFO) As Integer
  290.  
  291. Declare Sub LINUX_OSCurrentTimeDate Lib LINUX_LIB Alias &quot;OSCurrentTIMEDATE&quot;(Ret As TIMEDATE)
  292. Declare Function LINUX_NSFDbOpen Lib LINUX_LIB Alias &quot;NSFDbOpen&quot; (ByVal dbName As String, hdb As Long) As Integer
  293. Declare Function LINUX_NSFDbClose Lib LINUX_LIB Alias &quot;NSFDbClose&quot; (ByVal hdb As Long) As Integer
  294. Declare Function LINUX_NSFDbReplicaInfoGet Lib LINUX_LIB Alias &quot;NSFDbReplicaInfoGet&quot; (ByVal hdb As Long, hdbr As DBREPLICAINFO) As Integer
  295. Declare Function LINUX_NSFDbReplicaInfoSet Lib LINUX_LIB Alias &quot;NSFDbReplicaInfoSet&quot; (ByVal hdb As Long, hdbr As DBREPLICAINFO) As Integer&lt;/code&gt;&lt;/pre&gt;
  296.  
  297. &lt;h4&gt;Code C API (main part of it)&lt;/h4&gt;
  298.  
  299. &lt;pre style=&quot;background-color: #f6f8fa; border-radius: 3px; box-sizing: border-box; color: #24292e; font-family: SFMono-Regular, Consolas, &amp;quot;Liberation Mono&amp;quot;, Menlo, monospace; font-size: 13.6px; line-height: 1.45; overflow-wrap: normal; overflow: auto; padding: 16px;&quot;&gt;&lt;code style=&quot;background: initial; border-radius: 3px; border: 0px; box-sizing: border-box; display: inline; font-family: SFMono-Regular, Consolas, &amp;quot;Liberation Mono&amp;quot;, Menlo, monospace; line-height: inherit; margin: 0px; overflow-wrap: normal; overflow: visible; padding: 0px; word-break: normal;&quot;&gt;&#39;GET CURRENT TIMEDATE (TO BUILD NEW REPLICAID): OSCurrentTimeDate
  300. If IS_WINDOWS Then
  301. Call W32_OSCurrentTimeDate(ReplicaID)
  302. Else
  303. Call LINUX_OSCurrentTimeDate(ReplicaID)
  304. End If
  305. ReplicaInfo.ID = ReplicaID
  306. &#39;SET NEW REPLICAID: NSFDbReplicaInfoSet
  307. If IS_WINDOWS Then
  308. rc = W32_NSFDbReplicaInfoSet(hDb, replicaInfo)
  309. Else
  310. rc = LINUX_NSFDbReplicaInfoSet(hDb, replicaInfo)
  311. End If&lt;/code&gt;&lt;/pre&gt;
  312.  
  313.  
  314. &lt;p&gt;You can find all solution on GitHub: &lt;a href=&quot;https://github.com/dpastov/DominoChangeDatabaseReplicaID&quot; target=&quot;_blank&quot;&gt;DominoChangeDatabaseReplicaID&lt;/a&gt;&lt;/p&gt;</description><link>https://dpastov.blogspot.com/2023/09/here-is-solution-that-change-replicaid.html</link><author>noreply@blogger.com (Dmytro)</author><thr:total>3</thr:total></item><item><guid isPermaLink="false">tag:blogger.com,1999:blog-34728599.post-7456492786871285795</guid><pubDate>Thu, 08 Sep 2022 12:27:00 +0000</pubDate><atom:updated>2022-09-08T14:28:25.009+02:00</atom:updated><category domain="http://www.blogger.com/atom/ns#">Domino</category><category domain="http://www.blogger.com/atom/ns#">FreeMarker</category><category domain="http://www.blogger.com/atom/ns#">Java</category><title>Java Freemarker with Domino</title><description>There are plenty of different Java template engines but for last years I used to stick to &lt;a href=&quot;https://freemarker.apache.org/&quot;&gt;FreeMarker&lt;/a&gt;. It&#39;s open sourced and licensed under the Apache License, Version 2.0.&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;Here I only want to demonstrate how to integrate it with Domino nicely as it requires to write TemplateLoader class.&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;
  315.  
  316. Build result based on tempalte &quot;page&quot;
  317.  
  318. &lt;pre style=&quot;background-color: #f6f8fa; border-radius: 3px; box-sizing: border-box; color: #24292e; font-family: SFMono-Regular, Consolas, &amp;quot;Liberation Mono&amp;quot;, Menlo, monospace; font-size: 13.6px; line-height: 1.45; overflow-wrap: normal; overflow: auto; padding: 16px;&quot;&gt;&lt;code style=&quot;background: initial; border-radius: 3px; border: 0px; box-sizing: border-box; display: inline; font-family: SFMono-Regular, Consolas, &amp;quot;Liberation Mono&amp;quot;, Menlo, monospace; line-height: inherit; margin: 0px; overflow-wrap: normal; overflow: visible; padding: 0px; word-break: normal;&quot;&gt;Configuration cfg = new Configuration(Configuration.VERSION_2_3_31);
  319. cfg.setDefaultEncoding(&quot;UTF-8&quot;);
  320. cfg.setTemplateExceptionHandler(TemplateExceptionHandler.RETHROW_HANDLER);
  321. cfg.setLogTemplateExceptions(false);
  322.  
  323. Get the template (uses cache internally)
  324. DominoTemplateLoader dominoLoader = new DominoTemplateLoader(getDatabase());
  325. cfg.setTemplateLoader(dominoLoader);
  326.  
  327. Template template = cfg.getTemplate(&quot;page&quot;);
  328.  
  329. /* Merge data-model with template */
  330. HashMap&lt;String, Object&gt; tags = new HashMap&lt;String, Object&gt;();
  331. tags.put(&quot;title&quot;, &quot;hellow world&quot;);
  332. tags.put(&quot;description&quot;, &quot;Neque porro quisquam est qui dolorem ipsum quia dolor sit amet, consectetur, adipisci velit.&quot;);
  333. Writer out = new StringWriter();
  334. template.process(tags, out);
  335. String html = out.toString();
  336. &lt;/code&gt;&lt;/pre&gt;
  337.  
  338. The most important part was actually to build DominoTemplateLoader class and below you can see it
  339.  
  340. &lt;pre style=&quot;background-color: #f6f8fa; border-radius: 3px; box-sizing: border-box; color: #24292e; font-family: SFMono-Regular, Consolas, &amp;quot;Liberation Mono&amp;quot;, Menlo, monospace; font-size: 13.6px; line-height: 1.45; overflow-wrap: normal; overflow: auto; padding: 16px;&quot;&gt;&lt;code style=&quot;background: initial; border-radius: 3px; border: 0px; box-sizing: border-box; display: inline; font-family: SFMono-Regular, Consolas, &amp;quot;Liberation Mono&amp;quot;, Menlo, monospace; line-height: inherit; margin: 0px; overflow-wrap: normal; overflow: visible; padding: 0px; word-break: normal;&quot;&gt;public class DominoTemplateLoader implements TemplateLoader {
  341. private View m_view;
  342.  
  343. public DominoTemplateLoader(Database database) throws NotesException {
  344. m_view = database.getView(&quot;($Template)&quot;);
  345. }
  346.  
  347. public void closeTemplateSource(Object templateSource) throws IOException {
  348. Document doc = (Document) templateSource;
  349. try {
  350. doc.recycle();
  351. } catch (NotesException e) {
  352. e.printStackTrace();
  353. }
  354. }
  355.  
  356. public Object findTemplateSource(String id) throws IOException {
  357. try {
  358. return m_view.getDocumentByKey(id, true);
  359. } catch (NotesException e) {
  360. e.printStackTrace();
  361. }
  362.  
  363. return null;
  364. }
  365.  
  366. public long getLastModified(Object templateSource) {
  367. Document doc = (Document) templateSource;
  368.  
  369. try {
  370. return doc.getLastModified().toJavaDate().getTime();
  371. } catch (NotesException e) {
  372. e.printStackTrace();
  373. }
  374.  
  375. return 0;
  376. }
  377.  
  378. public Reader getReader(Object templateSource, String encoding) throws IOException {
  379. if (templateSource == null) return null;
  380. Document doc = (Document) templateSource;
  381. try {
  382. return doc.getFirstItem(&quot;Body&quot;).getReader();
  383. } catch (NotesException e) {
  384. e.printStackTrace();
  385. }
  386. return null;
  387. }
  388. }
  389. &lt;/code&gt;&lt;/pre&gt;
  390.  
  391. As you can see the Loader class get document form a view and simply get data from item Body.
  392. </description><link>https://dpastov.blogspot.com/2022/09/java-freemarker-with-domino.html</link><author>noreply@blogger.com (Dmytro)</author><thr:total>0</thr:total></item><item><guid isPermaLink="false">tag:blogger.com,1999:blog-34728599.post-8131522236122546237</guid><pubDate>Fri, 10 Dec 2021 11:42:00 +0000</pubDate><atom:updated>2021-12-10T12:50:24.979+01:00</atom:updated><category domain="http://www.blogger.com/atom/ns#">Domino</category><category domain="http://www.blogger.com/atom/ns#">Java</category><title>Journalize email from Exchange to Domino using Addin</title><description>&lt;p style=&quot;text-align: justify;&quot;&gt;One of my customer moves to Office 365 and also wants to move to to Exchange/Outlook 356 during next year while keeping Domino app running as it is of now.&lt;/p&gt;&lt;p style=&quot;text-align: justify;&quot;&gt;They have customized mail boxes with few actions which allow to journalize emails into their Domino applications and that is quite critical functionality so that would need to be mirrored.&lt;/p&gt;&lt;p style=&quot;text-align: justify;&quot;&gt;We have decided to built Outlook Add-in (works in web, client and also with mobile devices).&lt;/p&gt;&lt;p style=&quot;text-align: justify;&quot;&gt;Here are a few advises to those who would need to developer similar functionality.&lt;/p&gt;&lt;h2 style=&quot;text-align: left;&quot;&gt;1. Create a outlook add-in project and define manifest&lt;/h2&gt;&lt;p style=&quot;text-align: justify;&quot;&gt;You would have to create a project with manifest and needed html, css, js elementets. You can easily find information how to do that on MS sites (not going to provide any links as they could change in future). That will allow you to define UI, see my example.&lt;/p&gt;&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;&lt;a href=&quot;https://blogger.googleusercontent.com/img/a/AVvXsEh_4esBXJv79zol54gBm-sz2zOkSw29dSNOmGsmW0ox5bjrBYmYszxWcYzQAtgl9ylpUkwBHIT7PR6EQJ-ck03Agm6p_iCvJ_9AwZ7CS-vXjifEdpVARjPMycKFi3XTYls2BPFhwccfSA0Gc94tLBYEmSuwp1AtwhVutGzPTkleTwAM4hPHJQ=s1154&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;img border=&quot;0&quot; data-original-height=&quot;487&quot; data-original-width=&quot;1154&quot; height=&quot;169&quot; src=&quot;https://blogger.googleusercontent.com/img/a/AVvXsEh_4esBXJv79zol54gBm-sz2zOkSw29dSNOmGsmW0ox5bjrBYmYszxWcYzQAtgl9ylpUkwBHIT7PR6EQJ-ck03Agm6p_iCvJ_9AwZ7CS-vXjifEdpVARjPMycKFi3XTYls2BPFhwccfSA0Gc94tLBYEmSuwp1AtwhVutGzPTkleTwAM4hPHJQ=w400-h169&quot; width=&quot;400&quot; /&gt;&lt;/a&gt;&lt;/div&gt;&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;&lt;br /&gt;&lt;/div&gt;&lt;h2 style=&quot;clear: both; text-align: left;&quot;&gt;2. Send memo ID to Domino&lt;/h2&gt;
  393.  
  394. &lt;p&gt;We need to get information about email from Outlook Add in and send those items to Domino (you would have to build REST API on Domino side that can receive data from Outlook).&lt;/p&gt;
  395.  
  396. &lt;pre style=&quot;background-color: #f6f8fa; border-radius: 3px; box-sizing: border-box; color: #24292e; font-family: SFMono-Regular, Consolas, &amp;quot;Liberation Mono&amp;quot;, Menlo, monospace; font-size: 13.6px; line-height: 1.45; overflow-wrap: normal; overflow: auto; padding: 16px;&quot;&gt;&lt;code style=&quot;background: initial; border-radius: 3px; border: 0px; box-sizing: border-box; display: inline; font-family: SFMono-Regular, Consolas, &amp;quot;Liberation Mono&amp;quot;, Menlo, monospace; line-height: inherit; margin: 0px; overflow-wrap: normal; overflow: visible; padding: 0px; word-break: normal;&quot;&gt;Office.context.mailbox.getCallbackTokenAsync(function(result) {
  397.  
  398.  ...
  399.  
  400.  var token = result.value;
  401.  var ewsurl = Office.context.mailbox.restUrl;
  402.  var ewsItemId = Office.context.mailbox.item.itemId;
  403.  const itemId = Office.context.mailbox.convertToRestId(ewsItemId,Office.MailboxEnums.RestVersion.v2_0);
  404.  
  405.  // send token, ewsurl and itemId to Domino endpoint
  406.  ...
  407.  
  408. }
  409. &lt;/code&gt;&lt;/pre&gt;
  410.  
  411. &lt;p&gt;Having those keys (token url and itemId) you can pull email in Mime format&lt;/p&gt;
  412.  
  413. &lt;h2&gt;3. Convert Mime to Notes email&lt;/h2&gt;
  414. &lt;p style=&quot;text-align: justify;&quot;&gt;So at this point Domino received data from Add in and can finally do another request to Exchange server (using token, ewsurl and itemId) to read the memo MIME&lt;/p&gt;
  415.  
  416. &lt;pre style=&quot;background-color: #f6f8fa; border-radius: 3px; box-sizing: border-box; color: #24292e; font-family: SFMono-Regular, Consolas, &amp;quot;Liberation Mono&amp;quot;, Menlo, monospace; font-size: 13.6px; line-height: 1.45; overflow-wrap: normal; overflow: auto; padding: 16px;&quot;&gt;&lt;code style=&quot;background: initial; border-radius: 3px; border: 0px; box-sizing: border-box; display: inline; font-family: SFMono-Regular, Consolas, &amp;quot;Liberation Mono&amp;quot;, Menlo, monospace; line-height: inherit; margin: 0px; overflow-wrap: normal; overflow: visible; padding: 0px; word-break: normal;&quot;&gt;Dim http As NotesHTTPRequest
  417. Dim enpoint As string
  418. Set http = m_app.NotesSession.Createhttprequest()
  419. Call http.Setheaderfield(&quot;Authorization&quot;, &quot;Bearer &quot; + token)
  420. enpoint = ewsurl + |/v2.0/me/messages/| + itemId + |/$value|
  421. getItemMIME = http.get(enpoint)&lt;/code&gt;&lt;/pre&gt;
  422.  
  423. &lt;p style=&quot;text-align: justify;&quot;&gt;There is no native Domino LS/Java Mime Parser however I found working example by Stephan: &lt;a href=&quot;https://notessensei.com/blog/2012/04/importing-eml-files-into-notes-lots-of-them.html&quot;&gt;Importing EML files into Notes (lots of them)&lt;/a&gt;. It worked well, but seems it does not handle inline images (need to do more testing etc).
  424. &lt;/p&gt;&lt;p style=&quot;text-align: justify;&quot;&gt;Alternatively I was told that there is &lt;a href=&quot;https://github.com/OpenNTF/XPagesExtensionLibrary/blob/master/extlib/lwp/product/runtime/eclipse/plugins/com.ibm.domino.commons/src/com/ibm/domino/commons/mime/MimeMessageParser.java&quot;&gt;MimeMessageParser.java&lt;/a&gt; that writes MIME to a Notes document. This class is part of the XPages Extension Library. So it has sense to compare them.&lt;/p&gt;
  425.  
  426. &lt;p&gt;&lt;/p&gt;</description><link>https://dpastov.blogspot.com/2021/12/journalize-email-from-exchange-to.html</link><author>noreply@blogger.com (Dmytro)</author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="https://blogger.googleusercontent.com/img/a/AVvXsEh_4esBXJv79zol54gBm-sz2zOkSw29dSNOmGsmW0ox5bjrBYmYszxWcYzQAtgl9ylpUkwBHIT7PR6EQJ-ck03Agm6p_iCvJ_9AwZ7CS-vXjifEdpVARjPMycKFi3XTYls2BPFhwccfSA0Gc94tLBYEmSuwp1AtwhVutGzPTkleTwAM4hPHJQ=s72-w400-h169-c" height="72" width="72"/><thr:total>0</thr:total></item><item><guid isPermaLink="false">tag:blogger.com,1999:blog-34728599.post-4002131272119632850</guid><pubDate>Mon, 22 Nov 2021 09:10:00 +0000</pubDate><atom:updated>2021-11-22T10:24:03.256+01:00</atom:updated><category domain="http://www.blogger.com/atom/ns#">DSAPI</category><title>Alter user during authentication using DSAPI</title><description>&lt;div style=&quot;text-align: justify;&quot;&gt;I had a need to alter user during web-authentication process on fly (skipping password  validation).
  427. Initially the task looked impossible but I managed to solve it using DSAPI filter.&lt;/div&gt;
  428. &lt;div style=&quot;text-align: justify;&quot;&gt;Though the solution looks quite unsecure it could be very useful in some cases (by high level administrators) who needs to &#39;signin&#39; as a user in their organization to do some checks.&lt;/div&gt;
  429.  
  430. &lt;p&gt;Here are few most important snippets how to do that:&lt;/p&gt;&lt;p&gt;
  431.  
  432.  
  433. &lt;/p&gt;&lt;h4&gt;1. Subscribe for the event kFilterAuthenticate&lt;/h4&gt;
  434.  
  435. &lt;p&gt;That means that our dsapi filter only intercepts one specific event: kFilterAuthenticate), as there are other 10-15 other events which we do not wanna touch.&lt;/p&gt;
  436.  
  437. &lt;pre style=&quot;background-color: #f6f8fa; border-radius: 3px; box-sizing: border-box; color: #24292e; font-family: SFMono-Regular, Consolas, &amp;quot;Liberation Mono&amp;quot;, Menlo, monospace; font-size: 13.6px; line-height: 1.45; overflow-wrap: normal; overflow: auto; padding: 16px;&quot;&gt;&lt;code style=&quot;background: initial; border-radius: 3px; border: 0px; box-sizing: border-box; display: inline; font-family: SFMono-Regular, Consolas, &amp;quot;Liberation Mono&amp;quot;, Menlo, monospace; line-height: inherit; margin: 0px; overflow-wrap: normal; overflow: visible; padding: 0px; word-break: normal;&quot;&gt;EXPORT unsigned int FilterInit(FilterInitData* filterInitData) {
  438. STATUS   error = NOERROR;
  439.  
  440. filterInitData-&amp;gt;appFilterVersion = kInterfaceVersion;
  441. filterInitData-&amp;gt;eventFlags = kFilterAuthenticate;
  442.  
  443. // other logic
  444. // ...
  445. }&lt;/code&gt;&lt;/pre&gt;
  446.  
  447. &lt;h4&gt;2. Catch the authenticate event and process it&lt;/h4&gt;
  448.  
  449. &lt;p&gt;Get our event and associate it with a C function&lt;/p&gt;
  450.  
  451. &lt;pre style=&quot;background-color: #f6f8fa; border-radius: 3px; box-sizing: border-box; color: #24292e; font-family: SFMono-Regular, Consolas, &amp;quot;Liberation Mono&amp;quot;, Menlo, monospace; font-size: 13.6px; line-height: 1.45; overflow-wrap: normal; overflow: auto; padding: 16px;&quot;&gt;&lt;code style=&quot;background: initial; border-radius: 3px; border: 0px; box-sizing: border-box; display: inline; font-family: SFMono-Regular, Consolas, &amp;quot;Liberation Mono&amp;quot;, Menlo, monospace; line-height: inherit; margin: 0px; overflow-wrap: normal; overflow: visible; padding: 0px; word-break: normal;&quot;&gt;EXPORT unsigned int HttpFilterProc(FilterContext* context, unsigned int eventType, void* eventData) {
  452. /* Include only those events we want to handle */
  453. switch (eventType) {
  454. case kFilterAuthenticate:
  455. return Authenticate(context, (FilterAuthenticate *) eventData);
  456. default:
  457. break;
  458. }
  459.  
  460.   return kFilterNotHandled;
  461. } // end HttpFilterProc&lt;/code&gt;&lt;/pre&gt;
  462.  
  463.  
  464. &lt;h4&gt;3. Finally set a desired username&lt;/h4&gt;
  465.  
  466. &lt;p&gt;Below I only show the key moment - replace user name with another name&lt;/p&gt;
  467.  
  468. &lt;pre style=&quot;background-color: #f6f8fa; border-radius: 3px; box-sizing: border-box; color: #24292e; font-family: SFMono-Regular, Consolas, &amp;quot;Liberation Mono&amp;quot;, Menlo, monospace; font-size: 13.6px; line-height: 1.45; overflow-wrap: normal; overflow: auto; padding: 16px;&quot;&gt;&lt;code style=&quot;background: initial; border-radius: 3px; border: 0px; box-sizing: border-box; display: inline; font-family: SFMono-Regular, Consolas, &amp;quot;Liberation Mono&amp;quot;, Menlo, monospace; line-height: inherit; margin: 0px; overflow-wrap: normal; overflow: visible; padding: 0px; word-break: normal;&quot;&gt;unsigned int Authenticate(FilterContext* context, FilterAuthenticate* authData) {
  469. /* logic that calculate username  */
  470.    // .................................
  471.    // char[] fullName = &quot;CN=T5 Tester5/O=DmytroDev&quot;;
  472.    // .................................
  473.  
  474. /* Copy the canonical name for this user that dsapi requires.  */
  475. strncpy ((char *)authData-&amp;gt;authName, fullName, authData-&amp;gt;authNameSize);
  476. authData-&amp;gt;authNameSize = strlen(alterAuthToken);
  477. authData-&amp;gt;authType = kAuthenticBasic;
  478. authData-&amp;gt;foundInCache = TRUE;
  479.  
  480. return kFilterHandledEvent;
  481. }
  482. &lt;/code&gt;&lt;/pre&gt;
  483.  
  484. &lt;p style=&quot;text-align: justify;&quot;&gt;In order to improve security I have built an application on Domino side that generates tokens which have to be set in cookie and then DSAPI filter reads the cookie and get username from database. Tokens could be generated only by certain people are will be deleted by schedule agents after some time.&lt;/p&gt;&lt;p&gt;&lt;/p&gt;&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhK85lHFLoCOQDcGUz6PrsAY6Y4iKo059Z5apPuifaFqKsJZMKu_zmMxcxIyAx3yD13p_zzDikqBeTHowmsM9HEyvQuIMA7wRMO_A0fOIWyx5u2VB9qleNAnmA1fqtZXoc-80Pj/&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;img alt=&quot;&quot; data-original-height=&quot;208&quot; data-original-width=&quot;552&quot; height=&quot;121&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhK85lHFLoCOQDcGUz6PrsAY6Y4iKo059Z5apPuifaFqKsJZMKu_zmMxcxIyAx3yD13p_zzDikqBeTHowmsM9HEyvQuIMA7wRMO_A0fOIWyx5u2VB9qleNAnmA1fqtZXoc-80Pj/&quot; width=&quot;320&quot; /&gt;&lt;/a&gt;&lt;/div&gt;&lt;br /&gt;&lt;br /&gt;&lt;p&gt;&lt;/p&gt;&lt;p style=&quot;text-align: justify;&quot;&gt;On the screenshot below you can see that I signed in as a &quot;T5 Tester5&quot; using my custom token AlterAuthToken while I am Anonymous.&lt;/p&gt;&lt;p&gt;&lt;/p&gt;&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjpRKdnunl09_7rE2Dt9z2Sh06MCN_MG_RbB2LWvC3oPQ5svmJm0wXm7gVdOSzFQU7J5Zkl2Kqc1bG9OhOsOi6KgcQDiGLS91c3rqNnT7DY5Ll8lRgcUgA-Yblxdk6PbZCa29Vc/&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;img alt=&quot;&quot; data-original-height=&quot;446&quot; data-original-width=&quot;921&quot; height=&quot;194&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjpRKdnunl09_7rE2Dt9z2Sh06MCN_MG_RbB2LWvC3oPQ5svmJm0wXm7gVdOSzFQU7J5Zkl2Kqc1bG9OhOsOi6KgcQDiGLS91c3rqNnT7DY5Ll8lRgcUgA-Yblxdk6PbZCa29Vc/w400-h194/image.png&quot; width=&quot;500&quot; /&gt;&lt;/a&gt;&lt;/div&gt;&lt;br /&gt;&lt;br /&gt;&lt;p&gt;&lt;/p&gt;&lt;p&gt;&lt;/p&gt;&lt;p&gt;&lt;/p&gt;</description><link>https://dpastov.blogspot.com/2021/11/alter-user-during-authentication-using.html</link><author>noreply@blogger.com (Dmytro)</author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhK85lHFLoCOQDcGUz6PrsAY6Y4iKo059Z5apPuifaFqKsJZMKu_zmMxcxIyAx3yD13p_zzDikqBeTHowmsM9HEyvQuIMA7wRMO_A0fOIWyx5u2VB9qleNAnmA1fqtZXoc-80Pj/s72-c" height="72" width="72"/><thr:total>0</thr:total></item><item><guid isPermaLink="false">tag:blogger.com,1999:blog-34728599.post-1308867666822181335</guid><pubDate>Fri, 12 Nov 2021 09:29:00 +0000</pubDate><atom:updated>2023-09-25T11:36:50.787+02:00</atom:updated><category domain="http://www.blogger.com/atom/ns#">lotus script</category><category domain="http://www.blogger.com/atom/ns#">notes api</category><title>Clear database replication history programatically</title><description>&lt;p&gt;Recently I had a need to make a solution that can periodically clean replication history for list of databases.&lt;/p&gt;&lt;p&gt;Native LotusScript/Java classes do not allow that, but there is an C API for that.&lt;/p&gt;&lt;p&gt;Here is a cross platform solution (works for Windows/Linux)&lt;/p&gt;
  485.  
  486. &lt;h4&gt;Declare&lt;/h4&gt;
  487.  
  488. &lt;pre style=&quot;background-color: #f6f8fa; border-radius: 3px; box-sizing: border-box; color: #24292e; font-family: SFMono-Regular, Consolas, &amp;quot;Liberation Mono&amp;quot;, Menlo, monospace; font-size: 13.6px; line-height: 1.45; overflow-wrap: normal; overflow: auto; padding: 16px;&quot;&gt;&lt;code style=&quot;background: initial; border-radius: 3px; border: 0px; box-sizing: border-box; display: inline; font-family: SFMono-Regular, Consolas, &amp;quot;Liberation Mono&amp;quot;, Menlo, monospace; line-height: inherit; margin: 0px; overflow-wrap: normal; overflow: visible; padding: 0px; word-break: normal;&quot;&gt;Public Const W32_LIB = {nnotes.dll}
  489. Public Const LINUX_LIB = {libnotes.so}
  490.  
  491. Declare Function W32_NSFDbOpen Lib W32_LIB Alias {NSFDbOpen} (ByVal dbName As String, hDb As Long) As Integer
  492. Declare Function W32_NSFDbClose Lib W32_LIB Alias {NSFDbClose} (ByVal hDb As Long) As Integer
  493. Declare Function W32_NSFDbClearReplHistory Lib W32_LIB Alias {NSFDbClearReplHistory} (ByVal hDb As Long, flags As Integer) As Integer
  494.  
  495. Declare Function LINUX_NSFDbOpen Lib LINUX_LIB Alias {NSFDbOpen} (ByVal dbName As String, hDb As Long) As Integer
  496. Declare Function LINUX_NSFDbClose Lib LINUX_LIB Alias {NSFDbClose} (ByVal hDb As Long) As Integer
  497. Declare Function LINUX_NSFDbClearReplHistory Lib LINUX_LIB Alias {NSFDbClearReplHistory} (ByVal hDb As Long, flags As Integer) As Integer&lt;/code&gt;&lt;/pre&gt;
  498.  
  499. &lt;h4&gt;Using C API functions&lt;/h4&gt;
  500.  
  501. &lt;pre style=&quot;background-color: #f6f8fa; border-radius: 3px; box-sizing: border-box; color: #24292e; font-family: SFMono-Regular, Consolas, &amp;quot;Liberation Mono&amp;quot;, Menlo, monospace; font-size: 13.6px; line-height: 1.45; overflow-wrap: normal; overflow: auto; padding: 16px;&quot;&gt;&lt;code style=&quot;background: initial; border-radius: 3px; border: 0px; box-sizing: border-box; display: inline; font-family: SFMono-Regular, Consolas, &amp;quot;Liberation Mono&amp;quot;, Menlo, monospace; line-height: inherit; margin: 0px; overflow-wrap: normal; overflow: visible; padding: 0px; word-break: normal;&quot;&gt;// get a handler to database
  502. If IS_WINDOWS Then
  503. rc = W32_NSFDbOpen(Server &amp;amp; &quot;!!&quot; &amp;amp; FileName, hDb)
  504. Else
  505. rc = LINUX_NSFDbOpen(Server &amp;amp; &quot;!!&quot; &amp;amp; FileName, hDb)
  506. End If
  507.  
  508. // clear replication history
  509. If IS_WINDOWS Then
  510. rc = W32_NSFDbClearReplHistory(hDb, 0)
  511. Else
  512. rc = LINUX_NSFDbClearReplHistory(hDb, 0)
  513. End If
  514.  
  515. // close datababase (be sure you always close hDb if you opened it, otherwise memory leak).
  516. If IS_WINDOWS Then
  517. rc = W32_NSFDbClose(hDb)
  518. Else
  519. rc = LINUX_NSFDbClose(hDb)
  520. End If
  521. &lt;/code&gt;&lt;/pre&gt;
  522.  
  523. &lt;p&gt;Be sure that you always close hDb handler if you opened the database, otherwise it would lead to memory leak)&lt;/p&gt;
  524.  
  525. &lt;p&gt;See the full solution on GitHub: &lt;a href=&quot;https://github.com/dpastov/DominoReplicationHistoryCleaner&quot; target=&quot;_blank&quot;&gt;DominoReplicationHistoryCleaner&lt;/a&gt;&lt;/p&gt;</description><link>https://dpastov.blogspot.com/2021/11/clear-database-replication-history.html</link><author>noreply@blogger.com (Dmytro)</author><thr:total>0</thr:total></item><item><guid isPermaLink="false">tag:blogger.com,1999:blog-34728599.post-6990268371903179935</guid><pubDate>Thu, 08 Apr 2021 10:27:00 +0000</pubDate><atom:updated>2021-04-08T12:40:27.650+02:00</atom:updated><category domain="http://www.blogger.com/atom/ns#">lotus script</category><category domain="http://www.blogger.com/atom/ns#">notes api</category><title>Checking if database is encrypted with LotusScript (C API)</title><description>&lt;p&gt;
  526.  Since it&#39;s not possible to identify encryption status and level using native
  527.  LotusScript/Java classes here is a way to do that. The solution is based on
  528.  Notes CAPI (within LotusScript) but it works for both Linux/Windows
  529.  environment.
  530. &lt;/p&gt;
  531. &lt;p&gt;
  532.  I will omit&amp;nbsp;NSFDbOpen and NSFDbClose since it&#39;s easy to find out and
  533.  focus instead on the main function: NSFDbLocalSecInfoGetLocal.&lt;/p&gt;
  534. &lt;p&gt;&lt;b&gt;Declaration&lt;/b&gt;&lt;/p&gt;
  535.  
  536. &lt;pre style=&quot;background-color: #f6f8fa; border-radius: 3px; box-sizing: border-box; color: #24292e; font-family: SFMono-Regular, Consolas, &amp;quot;Liberation Mono&amp;quot;, Menlo, monospace; font-size: 13.6px; line-height: 1.45; overflow-wrap: normal; overflow: auto; padding: 16px;&quot;&gt;&lt;code style=&quot;background: initial; border-radius: 3px; border: 0px; box-sizing: border-box; display: inline; font-family: SFMono-Regular, Consolas, &amp;quot;Liberation Mono&amp;quot;, Menlo, monospace; line-height: inherit; margin: 0px; overflow-wrap: normal; overflow: visible; padding: 0px; word-break: normal;&quot;&gt;Const NNOTES =&quot;nnotes.dll&quot;
  537. Const LIBNOTES =&quot;libnotes.so&quot;
  538.  
  539. Declare Public Function WIN_NSFDbLocalSecInfoGetLocal Lib NNOTES Alias &quot;NSFDbLocalSecInfoGetLocal&quot;(ByVal hDb As Long, state As Long, strength As Long) As Integer
  540. Declare Public Function LIN_NSFDbLocalSecInfoGetLocal Lib LIBNOTES Alias &quot;NSFDbLocalSecInfoGetLocal&quot;(ByVal hDb As Long, state As Long, strength As Long) As integer&lt;/code&gt;&lt;/pre&gt;
  541.  
  542. &lt;p&gt;&lt;b&gt;Function check encryption status&lt;/b&gt;&lt;/p&gt;
  543. &lt;pre style=&quot;background-color: #f6f8fa; border-radius: 3px; box-sizing: border-box; color: #24292e; font-family: SFMono-Regular, Consolas, &amp;quot;Liberation Mono&amp;quot;, Menlo, monospace; font-size: 13.6px; line-height: 1.45; overflow-wrap: normal; overflow: auto; padding: 16px;&quot;&gt;&lt;code style=&quot;background: initial; border-radius: 3px; border: 0px; box-sizing: border-box; display: inline; font-family: SFMono-Regular, Consolas, &amp;quot;Liberation Mono&amp;quot;, Menlo, monospace; line-height: inherit; margin: 0px; overflow-wrap: normal; overflow: visible; padding: 0px; word-break: normal;&quot;&gt;public Function NSFDbLocalSecInfoGetLocal(hDB As Long, state As Long, strength As long) As Integer
  544. If isDefined(&quot;WINDOWS&quot;) Then
  545.  NSFDbLocalSecInfoGetLocal = WIN_NSFDbLocalSecInfoGetLocal(hDb, state, strength)
  546. ElseIf isDefined(&quot;LINUX&quot;) Then
  547.  NSFDbLocalSecInfoGetLocal = LIN_NSFDbLocalSecInfoGetLocal(hDb, state, strength)
  548. End If
  549. End Function&lt;/code&gt;&lt;/pre&gt;
  550. &lt;p&gt;&lt;b&gt;Example how to use it&lt;/b&gt;&lt;/p&gt;
  551. &lt;pre style=&quot;background-color: #f6f8fa; border-radius: 3px; box-sizing: border-box; color: #24292e; font-family: SFMono-Regular, Consolas, &amp;quot;Liberation Mono&amp;quot;, Menlo, monospace; font-size: 13.6px; line-height: 1.45; overflow-wrap: normal; overflow: auto; padding: 16px; text-align: left;&quot;&gt;&lt;code style=&quot;background: initial; border-radius: 3px; border: 0px; box-sizing: border-box; display: inline; font-family: SFMono-Regular, Consolas, &amp;quot;Liberation Mono&amp;quot;, Menlo, monospace; line-height: inherit; margin: 0px; overflow-wrap: normal; overflow: visible; padding: 0px; word-break: normal;&quot;&gt;Private Function calcEncryption(database As NotesDatabase, doc As notesdocument)
  552. Dim sDb As String
  553. Dim hDb As Long
  554. Dim state As Long
  555. Dim encrypt As Long
  556. Dim rc As Integer
  557.  
  558. sDb = database.server &amp;amp; &quot;!!&quot; &amp;amp; database.filepath
  559.  
  560. rc = NSFDbOpen(sDb, hDb)
  561. If rc &amp;lt;&amp;gt; 0 Then Exit function
  562.  
  563. rc = NSFDbLocalSecInfoGetLocal(hDB, &lt;b&gt;state&lt;/b&gt;, &lt;b&gt;encrypt&lt;/b&gt;)
  564. If rc &amp;lt;&amp;gt; 0 Then
  565.  Error 9001, &quot;Impossible to read encryption. Error code: &quot; &amp;amp; CStr(rc)
  566. End If
  567.  
  568. rc = NSFDbClose(hDb)
  569. End Function&lt;/code&gt;&lt;/pre&gt;&lt;ul&gt;&lt;li&gt;&lt;b&gt;
  570.  state&lt;/b&gt;: 0 (not encrypted), 1 (encrypted) or 2 (will be encrypted after compact)
  571. &lt;/li&gt;&lt;li&gt;&lt;b&gt;encrypt&lt;/b&gt;: 1 (easy), 2 (middle), 3 (strong)&lt;/li&gt;&lt;/ul&gt;&lt;p&gt;&lt;/p&gt;
  572.  
  573.  
  574. </description><link>https://dpastov.blogspot.com/2021/04/checking-if-database-is-encrypted-with.html</link><author>noreply@blogger.com (Dmytro)</author><thr:total>0</thr:total></item><item><guid isPermaLink="false">tag:blogger.com,1999:blog-34728599.post-5623655571788393425</guid><pubDate>Wed, 20 Jan 2021 11:25:00 +0000</pubDate><atom:updated>2025-02-26T22:38:09.925+01:00</atom:updated><category domain="http://www.blogger.com/atom/ns#">Java</category><category domain="http://www.blogger.com/atom/ns#">lotus script</category><category domain="http://www.blogger.com/atom/ns#">LS2J</category><category domain="http://www.blogger.com/atom/ns#">web</category><title>How to post attachments using form to agent </title><description>&lt;p&gt;I have a form with some text fields and I also needed to send attachments within same form.&lt;/p&gt;
  575.  
  576. &lt;p&gt;Form is printed by agent and is processed by another agent written in LotusScript.&lt;/p&gt;
  577.  
  578. &lt;p&gt;I spent some time working on solution and here it is.&lt;/p&gt;
  579.  
  580. &lt;p&gt;The idea is to convert selected files to base64 on client side and then post data on submission and agent that process submission will conver base64 to file.&lt;/p&gt;
  581.  
  582. &lt;p&gt;Here is a form, note that we run some logic when files are added&lt;/p&gt;
  583.  
  584. &lt;pre style=&quot;background-color: #f6f8fa; border-radius: 3px; box-sizing: border-box; color: #24292e; font-family: SFMono-Regular, Consolas, &amp;quot;Liberation Mono&amp;quot;, Menlo, monospace; font-size: 13.6px; line-height: 1.45; overflow-wrap: normal; overflow: auto; padding: 16px;&quot;&gt;&lt;code style=&quot;background: initial; border-radius: 3px; border: 0px; box-sizing: border-box; display: inline; font-family: SFMono-Regular, Consolas, &amp;quot;Liberation Mono&amp;quot;, Menlo, monospace; line-height: inherit; margin: 0px; overflow-wrap: normal; overflow: visible; padding: 0px; word-break: normal;&quot;&gt;&amp;lt;form name=&quot;formName&quot; method=&quot;post&quot; action=&quot;agentName?openagent&quot;&amp;gt;
  585. &amp;lt;input name=&quot;title&quot; value=&quot;xxx&quot;&amp;gt;
  586. &amp;lt;input type=&quot;file&quot; name=&quot;files&quot; multiple onchange=&quot;toBase64()&quot;&amp;gt;
  587. &amp;lt;/form&amp;gt;&lt;/code&gt;&lt;/pre&gt;
  588.  
  589. &lt;p&gt;Here is how we convert selected files to base64 and how we results as text fields to form (JS is not optimal, it can be done without jQuery)&lt;/p&gt;
  590.  
  591. &lt;pre style=&quot;background-color: #f6f8fa; border-radius: 3px; box-sizing: border-box; color: #24292e; font-family: SFMono-Regular, Consolas, &amp;quot;Liberation Mono&amp;quot;, Menlo, monospace; font-size: 13.6px; line-height: 1.45; overflow-wrap: normal; overflow: auto; padding: 16px;&quot;&gt;&lt;code style=&quot;background: initial; border-radius: 3px; border: 0px; box-sizing: border-box; display: inline; font-family: SFMono-Regular, Consolas, &amp;quot;Liberation Mono&amp;quot;, Menlo, monospace; line-height: inherit; margin: 0px; overflow-wrap: normal; overflow: visible; padding: 0px; word-break: normal;&quot;&gt;function toBase64() {
  592.  var files = document.querySelector(&#39;input[type=file]&#39;).files;
  593.  
  594.  var form = $(&quot;form&quot;);
  595.  form.find(&quot;input[name^=&#39;filebase64&#39;]&quot;).remove(); // replace
  596.  
  597.  function readAndSave(file, index) {
  598.    var reader = new FileReader();
  599.    reader.addEventListener(&quot;load&quot;, function() {
  600.      form.append(&quot;&amp;lt;input name=&quot;filebase64_&amp;quot;+index + &amp;quot;&quot; type=&quot;hidden&quot; value=&quot;&amp;quot;+this.result+&amp;quot;&quot; /&amp;gt;&quot;);
  601.      form.append(&quot;&amp;lt;input name=&quot;filename_&amp;quot;+index + &amp;quot;&quot; type=&quot;hidden&quot; value=&quot;&amp;quot;+file.name+&amp;quot;&quot; /&amp;gt;&quot;);
  602.    }, false);
  603.  
  604.    reader.readAsDataURL(file);
  605.  }
  606.  
  607.  if (files) {
  608.    [].forEach.call(files, readAndSave);
  609.  }
  610. }&lt;/code&gt;&lt;/pre&gt;
  611.  
  612. &lt;p&gt;Once form is submitted we have to read base64 items and convert them to file. There are at least 2 solutions: pure LS or Java/LS2J&lt;/p&gt;
  613.  
  614. a) LotusScript using NotesMIMEHeader
  615.  
  616. &lt;pre style=&quot;background-color: #f6f8fa; border-radius: 3px; box-sizing: border-box; color: #24292e; font-family: SFMono-Regular, Consolas, &amp;quot;Liberation Mono&amp;quot;, Menlo, monospace; font-size: 13.6px; line-height: 1.45; overflow-wrap: normal; overflow: auto; padding: 16px;&quot;&gt;&lt;code style=&quot;background: initial; border-radius: 3px; border: 0px; box-sizing: border-box; display: inline; font-family: SFMono-Regular, Consolas, &amp;quot;Liberation Mono&amp;quot;, Menlo, monospace; line-height: inherit; margin: 0px; overflow-wrap: normal; overflow: visible; padding: 0px; word-break: normal;&quot;&gt;Private Function saveBase64AsFile(base64 As String, filePath As string) As Boolean
  617. On Error GoTo ErrorHandler
  618.  
  619. Dim stub As NotesDocument
  620. Dim stream As NotesStream
  621. Dim item As NotesMIMEEntity
  622. Dim header As NotesMIMEHeader
  623. Dim emb As NotesEmbeddedObject
  624. Dim fileName As String
  625. Dim contentType As string
  626. Dim base64File As String
  627.  
  628. fileName = StrRightBack(filePath, &quot;\&quot;)
  629. contentType = StrRight(Strleft(base64, &quot;;&quot;), &quot;:&quot;)
  630. base64File = StrRight(Base64, &quot;,&quot;)
  631. Call scriptLog.loginfo(fileName)
  632. Call scriptLog.loginfo(contentType)
  633. Set stub = db.Createdocument()
  634. Set item = stub.CreateMIMEEntity(&quot;Body&quot;)
  635. Set header = item.createHeader(&quot;Content-Disposition&quot;)
  636. Call header.setHeaderVal({attachment; filename=&quot;} &amp;amp; fileName &amp;amp; {&quot;})
  637.  
  638. Set stream = app.NotesSession.CreateStream()
  639. Call stream.WriteText(base64File)
  640. Call item.SetContentFromText(stream, contentType, ENC_BASE64)
  641.  
  642. Call stream.Truncate
  643. Call stream.Close
  644. Call stub.Closemimeentities(True)
  645.  
  646. Set emb = stub.Getattachment(fileName)
  647. Call emb.Extractfile(filePath)
  648. Exit Function
  649. ErrorHandler:
  650. Error Err, Error
  651. End Function&lt;/code&gt;&lt;/pre&gt;
  652.  
  653.  
  654. b) Java with LS2J using native classses.
  655.  
  656. &lt;pre style=&quot;background-color: #f6f8fa; border-radius: 3px; box-sizing: border-box; color: #24292e; font-family: SFMono-Regular, Consolas, &amp;quot;Liberation Mono&amp;quot;, Menlo, monospace; font-size: 13.6px; line-height: 1.45; overflow-wrap: normal; overflow: auto; padding: 16px;&quot;&gt;&lt;code style=&quot;background: initial; border-radius: 3px; border: 0px; box-sizing: border-box; display: inline; font-family: SFMono-Regular, Consolas, &amp;quot;Liberation Mono&amp;quot;, Menlo, monospace; line-height: inherit; margin: 0px; overflow-wrap: normal; overflow: visible; padding: 0px; word-break: normal;&quot;&gt;import java.util.Base64;
  657. import java.io.IOException;
  658. import java.nio.file.*;
  659.  
  660. public class Base64ToFile{
  661.  
  662. public boolean convert(String base64String, String filePath) {
  663. try {
  664. byte[] decodedImg = Base64.getDecoder().decode(base64String.getBytes());
  665. Path destinationFile = Paths.get(filePath);
  666. Files.write(destinationFile, decodedImg);
  667. return true;
  668. } catch (IOException e) {
  669. e.printStackTrace();
  670. }
  671. return false;
  672. }
  673. }&lt;/code&gt;&lt;/pre&gt;
  674.  
  675. &lt;pre style=&quot;background-color: #f6f8fa; border-radius: 3px; box-sizing: border-box; color: #24292e; font-family: SFMono-Regular, Consolas, &amp;quot;Liberation Mono&amp;quot;, Menlo, monospace; font-size: 13.6px; line-height: 1.45; overflow-wrap: normal; overflow: auto; padding: 16px;&quot;&gt;&lt;code style=&quot;background: initial; border-radius: 3px; border: 0px; box-sizing: border-box; display: inline; font-family: SFMono-Regular, Consolas, &amp;quot;Liberation Mono&amp;quot;, Menlo, monospace; line-height: inherit; margin: 0px; overflow-wrap: normal; overflow: visible; padding: 0px; word-break: normal;&quot;&gt;UseLSX &quot;*javacon&quot;
  676. Use &quot;Base64ToFile&quot;
  677.  
  678. Class Base64ToFile
  679. Private jSession As JavaSession
  680. Private jClass As Javaclass
  681. Private jObject As JavaObject
  682. Private jError As JavaError
  683. Sub New()
  684. Set jSession = New JavaSession
  685. Set jClass = jSession.GetClass(&quot;Base64ToFile&quot;)
  686. Set jObject = jClass.Createobject()
  687. End Sub
  688. Public Function convert(base64 As String, filePath As String) As Boolean
  689. convert = jObject.convert(base64, filePath)
  690. End Function
  691. End Class&lt;/code&gt;&lt;/pre&gt;</description><link>https://dpastov.blogspot.com/2021/01/how-to-post-attachments-using-form-to.html</link><author>noreply@blogger.com (Dmytro)</author><thr:total>2</thr:total></item><item><guid isPermaLink="false">tag:blogger.com,1999:blog-34728599.post-610147718484182841</guid><pubDate>Tue, 20 Oct 2020 09:32:00 +0000</pubDate><atom:updated>2020-10-21T14:55:53.957+02:00</atom:updated><category domain="http://www.blogger.com/atom/ns#">Domino</category><category domain="http://www.blogger.com/atom/ns#">Java</category><title>JavaServerAddin in Domino - constructor and schedule</title><description>&lt;p&gt;In this article we will improve our java addin &#39;DemoAddin&#39; with following features:&lt;/p&gt;
  692.  
  693. &lt;ol style=&quot;text-align: left;&quot;&gt;&lt;li&gt;Constructor that accepts parameters when we load java addin from console.&lt;/li&gt;&lt;li&gt;We will schedule output to console amount of registered person in names.nsf (every 33 seconds).&lt;/li&gt;&lt;li&gt;Define destructor.&lt;/li&gt;&lt;li&gt;Load (with parameter) and Unload addin from console&lt;/li&gt;&lt;/ol&gt;
  694.  
  695. &lt;h4&gt;Constructor&lt;/h4&gt;
  696.  
  697. &lt;p&gt;We will define 2 constructor, one that can accept parameters and one in case if we load addin without any parameters. It is pretty obvious how it works.&lt;/p&gt;
  698.  
  699. &lt;pre style=&quot;background-color: #f6f8fa; border-radius: 3px; box-sizing: border-box; color: #24292e; font-family: SFMono-Regular, Consolas, &amp;quot;Liberation Mono&amp;quot;, Menlo, monospace; font-size: 13.6px; line-height: 1.45; overflow-wrap: normal; overflow: auto; padding: 16px;&quot;&gt;&lt;code style=&quot;background: initial; border-radius: 3px; border: 0px; box-sizing: border-box; display: inline; font-family: SFMono-Regular, Consolas, &amp;quot;Liberation Mono&amp;quot;, Menlo, monospace; line-height: inherit; margin: 0px; overflow-wrap: normal; overflow: visible; padding: 0px; word-break: normal;&quot;&gt;// we expect our first parameter is dedicated for secondsElapsed
  700. public DemoAddin(String[] args) {
  701. this.secondsElapsed = Integer.parseInt(args[0]);
  702. }
  703.  
  704. // constructor if no parameters
  705. public DemoAddin() {}&lt;/code&gt;&lt;/pre&gt;
  706.  
  707. &lt;p&gt;Means if we run command like below it will run using constructor with parameters&lt;/p&gt;
  708.  
  709. &lt;pre style=&quot;background-color: #f6f8fa; border-radius: 3px; box-sizing: border-box; color: #24292e; font-family: SFMono-Regular, Consolas, &amp;quot;Liberation Mono&amp;quot;, Menlo, monospace; font-size: 13.6px; line-height: 1.45; overflow-wrap: normal; overflow: auto; padding: 16px;&quot;&gt;&lt;code style=&quot;background: initial; border-radius: 3px; border: 0px; box-sizing: border-box; display: inline; font-family: SFMono-Regular, Consolas, &amp;quot;Liberation Mono&amp;quot;, Menlo, monospace; line-height: inherit; margin: 0px; overflow-wrap: normal; overflow: visible; padding: 0px; word-break: normal;&quot;&gt;load runjava org.demo.DemoAddin 33&lt;/code&gt;&lt;/pre&gt;
  710.  
  711. &lt;h4&gt;Schedule worker&lt;/h4&gt;
  712.  
  713. &lt;p&gt;There is a method (it works but deprecated, however I have not found what should be use instead). The snippet below run constant loop, open names.nsf, read amount of users in the view People and output it to console. The main line here is &lt;strong&gt;this.addInRunning()&lt;/strong&gt;, it keeps loop running forever (until we change it to &lt;strong&gt;this.stopAddin()&lt;/strong&gt; or unload addin from console)&lt;/p&gt;
  714.  
  715. &lt;pre style=&quot;background-color: #f6f8fa; border-radius: 3px; box-sizing: border-box; color: #24292e; font-family: SFMono-Regular, Consolas, &amp;quot;Liberation Mono&amp;quot;, Menlo, monospace; font-size: 13.6px; line-height: 1.45; overflow-wrap: normal; overflow: auto; padding: 16px;&quot;&gt;&lt;code style=&quot;background: initial; border-radius: 3px; border: 0px; box-sizing: border-box; display: inline; font-family: SFMono-Regular, Consolas, &amp;quot;Liberation Mono&amp;quot;, Menlo, monospace; line-height: inherit; margin: 0px; overflow-wrap: normal; overflow: visible; padding: 0px; word-break: normal;&quot;&gt;session = NotesFactory.createSession();
  716. String server = session.getServerName();
  717.  
  718. while (this.addInRunning()) {
  719. /* gives control to other task in non preemptive os*/
  720. OSPreemptOccasionally();
  721.  
  722. if (this.AddInHasSecondsElapsed(secondsElapsed)) {
  723. ab = session.getDatabase(server, &quot;names.nsf&quot;);
  724. long count = ab.getView(&quot;People&quot;).getAllEntries().getCount();
  725. logMessage(&quot;Count of persons: &quot; + Long.toString(count));
  726. ab.recycle();
  727. }
  728. }&lt;/code&gt;&lt;/pre&gt;
  729.  
  730. &lt;h4&gt;Destructor&lt;/h4&gt;
  731.  
  732. &lt;p&gt;Keep in mind that we need to be careful with Notes object, we have to release memory (recycle) after we no longer use them. So it&#39;s a good idea to create own terminate method that release memory for all Notes object you delcared and use it when addin unloads. There is also built-in method &lt;strong&gt;finalize&lt;/strong&gt; so you can put code there, but I prefer to have own method and use it in places I need&lt;/p&gt;
  733.  
  734. &lt;pre style=&quot;background-color: #f6f8fa; border-radius: 3px; box-sizing: border-box; color: #24292e; font-family: SFMono-Regular, Consolas, &amp;quot;Liberation Mono&amp;quot;, Menlo, monospace; font-size: 13.6px; line-height: 1.45; overflow-wrap: normal; overflow: auto; padding: 16px;&quot;&gt;&lt;code style=&quot;background: initial; border-radius: 3px; border: 0px; box-sizing: border-box; display: inline; font-family: SFMono-Regular, Consolas, &amp;quot;Liberation Mono&amp;quot;, Menlo, monospace; line-height: inherit; margin: 0px; overflow-wrap: normal; overflow: visible; padding: 0px; word-break: normal;&quot;&gt;private void terminate() {
  735. try {
  736. if (this.ab != null) {
  737. this.ab.recycle();
  738. }
  739. if (this.session != null) {
  740. this.session.recycle();
  741. }
  742.  
  743. logMessage(&quot;UNLOADED (OK)&quot;);
  744. } catch (NotesException e) {
  745. logMessage(&quot;UNLOADED (**FAILED**)&quot;);
  746. }
  747. }&lt;/code&gt;&lt;/pre&gt;
  748.  
  749. &lt;h4&gt;Load (with parameter) and Unload addin from console&lt;/h4&gt;
  750. &lt;p&gt; In order to run addin with parameter simply add it after name of Addin, use space as a separator when you need more than 1 parameter&lt;/p&gt;
  751.  
  752. &lt;pre style=&quot;background-color: #f6f8fa; border-radius: 3px; box-sizing: border-box; color: #24292e; font-family: SFMono-Regular, Consolas, &amp;quot;Liberation Mono&amp;quot;, Menlo, monospace; font-size: 13.6px; line-height: 1.45; overflow-wrap: normal; overflow: auto; padding: 16px;&quot;&gt;&lt;code style=&quot;background: initial; border-radius: 3px; border: 0px; box-sizing: border-box; display: inline; font-family: SFMono-Regular, Consolas, &amp;quot;Liberation Mono&amp;quot;, Menlo, monospace; line-height: inherit; margin: 0px; overflow-wrap: normal; overflow: visible; padding: 0px; word-break: normal;&quot;&gt;load runjava org.demo.DemoAddin 33&lt;/code&gt;&lt;/pre&gt;
  753.  
  754. &lt;pre style=&quot;background-color: #f6f8fa; border-radius: 3px; box-sizing: border-box; color: #24292e; font-family: SFMono-Regular, Consolas, &amp;quot;Liberation Mono&amp;quot;, Menlo, monospace; font-size: 13.6px; line-height: 1.45; overflow-wrap: normal; overflow: auto; padding: 16px;&quot;&gt;&lt;code style=&quot;background: initial; border-radius: 3px; border: 0px; box-sizing: border-box; display: inline; font-family: SFMono-Regular, Consolas, &amp;quot;Liberation Mono&amp;quot;, Menlo, monospace; line-height: inherit; margin: 0px; overflow-wrap: normal; overflow: visible; padding: 0px; word-break: normal;&quot;&gt;[1098:0002-23A0] 10/20/2020 11:15:00 AM  JVM: Java Virtual Machine initialized.
  755. [1098:0002-23A0] 10/20/2020 11:15:00 AM  RunJava: Started org/demo/DemoAddin Java task.
  756. [1098:0004-3984] 10/20/2020 11:15:00 AM  DemoAddin: version             2
  757. [1098:0004-3984] 10/20/2020 11:15:00 AM  DemoAddin: build date          2020-10-19 11:00 CET
  758. [1098:0004-3984] 10/20/2020 11:15:00 AM  DemoAddin: java                1.8
  759. [1098:0004-3984] 10/20/2020 11:15:00 AM  DemoAddin: seconds elapsed     33
  760. [1098:0004-3984] 10/20/2020 11:15:33 AM  DemoAddin: Count of persons: 11
  761. [1098:0004-3984] 10/20/2020 11:16:06 AM  DemoAddin: Count of persons: 11
  762. [1098:0004-3984] 10/20/2020 11:16:39 AM  DemoAddin: Count of persons: 11
  763. [1098:0004-3984] 10/20/2020 11:17:12 AM  DemoAddin: Count of persons: 11&lt;/code&gt;&lt;/pre&gt;
  764.  
  765. &lt;p&gt;When you want to unload addin using console here is a command&lt;/p&gt;
  766.  
  767. &lt;pre style=&quot;background-color: #f6f8fa; border-radius: 3px; box-sizing: border-box; color: #24292e; font-family: SFMono-Regular, Consolas, &amp;quot;Liberation Mono&amp;quot;, Menlo, monospace; font-size: 13.6px; line-height: 1.45; overflow-wrap: normal; overflow: auto; padding: 16px;&quot;&gt;&lt;code style=&quot;background: initial; border-radius: 3px; border: 0px; box-sizing: border-box; display: inline; font-family: SFMono-Regular, Consolas, &amp;quot;Liberation Mono&amp;quot;, Menlo, monospace; line-height: inherit; margin: 0px; overflow-wrap: normal; overflow: visible; padding: 0px; word-break: normal;&quot;&gt;tell runjava unload org.demo.DemoAddin&lt;/code&gt;&lt;/pre&gt;
  768.  
  769. &lt;p&gt;And you should be see confirmation on console if everything went fine&lt;/p&gt;
  770.  
  771. &lt;pre style=&quot;background-color: #f6f8fa; border-radius: 3px; box-sizing: border-box; color: #24292e; font-family: SFMono-Regular, Consolas, &amp;quot;Liberation Mono&amp;quot;, Menlo, monospace; font-size: 13.6px; line-height: 1.45; overflow-wrap: normal; overflow: auto; padding: 16px;&quot;&gt;&lt;code style=&quot;background: initial; border-radius: 3px; border: 0px; box-sizing: border-box; display: inline; font-family: SFMono-Regular, Consolas, &amp;quot;Liberation Mono&amp;quot;, Menlo, monospace; line-height: inherit; margin: 0px; overflow-wrap: normal; overflow: visible; padding: 0px; word-break: normal;&quot;&gt;[1098:0004-3984] 10/20/2020 11:26:55 AM  DemoAddin: UNLOADED (OK)
  772. [1098:0002-23A0] 10/20/2020 11:26:55 AM  RunJava: Finalized org/demo/DemoAddin Java task.
  773. [1098:0002-23A0] 10/20/2020 11:26:56 AM  RunJava shutdown.&lt;/code&gt;&lt;/pre&gt;
  774.  
  775. &lt;p&gt;If you are interested in this topic I can recommend at least two more sources
  776. &lt;a href=&quot;https://www.nsftools.com/tips/JavaAddinTest.java&quot;&gt;NSFTools.com JavaAddinTest&lt;/a&gt; and &lt;a href=&quot;https://github.com/AndyBrunner/Domino-JAddin&quot;&gt;AndyBrunner / Domino-JAddin&lt;/a&gt; or wait for new articles in my blog :-). Also feel free to ask questions if you are uncertain.&lt;/p&gt;
  777.  
  778. &lt;p&gt;Full version of DemoAddin class is hosted on github: &lt;a href=&quot;https://github.com/dpastov/DominoJavaAddin&quot;&gt;DominoDemoAddin&lt;/a&gt;&lt;/p&gt;
  779.  
  780. &lt;strong&gt;All articles in series&lt;/strong&gt;&lt;br&gt;
  781. &lt;ol&gt;
  782. &lt;li&gt;&lt;a href=&quot;https://dpastov.blogspot.com/2020/10/javaserveraddin-in-domino-introduction.html&quot;&gt;JavaServerAddin in Domino - introduction&lt;/a&gt;&lt;/li&gt;
  783. &lt;li&gt;&lt;a href=&quot;https://dpastov.blogspot.com/2020/10/javaserveraddin-in-domino-constructor.html&quot;&gt;JavaServerAddin in Domino - constructor and schedule&lt;/a&gt;&lt;/li&gt;
  784. &lt;/ol&gt;
  785. </description><link>https://dpastov.blogspot.com/2020/10/javaserveraddin-in-domino-constructor.html</link><author>noreply@blogger.com (Dmytro)</author><thr:total>0</thr:total></item><item><guid isPermaLink="false">tag:blogger.com,1999:blog-34728599.post-1941771492360303198</guid><pubDate>Wed, 14 Oct 2020 07:00:00 +0000</pubDate><atom:updated>2020-10-20T11:51:25.792+02:00</atom:updated><category domain="http://www.blogger.com/atom/ns#">Domino</category><category domain="http://www.blogger.com/atom/ns#">Java</category><title>JavaServerAddin in Domino - introduction</title><description>&lt;p style=&quot;text-align: justify;&quot;&gt;I will show how to build, register and load simple JavaAddin for Domino. I&#39;m not entirely sure if lotus.notes.addins.JavaServerAddin is supported by HCL, so use that for your own sake.&lt;/p&gt;
  786.  
  787. &lt;h3&gt;1) Java class&lt;/h3&gt;
  788.  
  789. &lt;pre style=&quot;background-color: #f6f8fa; border-radius: 3px; box-sizing: border-box; color: #24292e; font-family: SFMono-Regular, Consolas, &amp;quot;Liberation Mono&amp;quot;, Menlo, monospace; font-size: 13.6px; line-height: 1.45; overflow-wrap: normal; overflow: auto; padding: 16px;&quot;&gt;&lt;code style=&quot;background: initial; border-radius: 3px; border: 0px; box-sizing: border-box; display: inline; font-family: SFMono-Regular, Consolas, &amp;quot;Liberation Mono&amp;quot;, Menlo, monospace; line-height: inherit; margin: 0px; overflow-wrap: normal; overflow: visible; padding: 0px; word-break: normal;&quot;&gt;import lotus.notes.addins.JavaServerAddin;
  790.  
  791. public class DemoAddin extends JavaServerAddin {
  792. public void runNotes() {
  793. AddInLogMessageText(&quot;Hello world&quot;, 0);
  794. }
  795. }&lt;/code&gt;&lt;/pre&gt;
  796. &lt;h3&gt;2) JAR - from project&lt;/h3&gt;
  797. &lt;p style=&quot;text-align: justify;&quot;&gt;Export/build JAR file from the DemoAddin project (we are going to put jar file in the Domino folder).&lt;/p&gt;
  798.  
  799. &lt;h3&gt;3) Register JavaAddin&lt;/h3&gt;
  800. &lt;p style=&quot;text-align: justify;&quot;&gt;Place JAR file under Domino, f.x. path could be (DemoAddin is a folder and it could be just any name, DemoAddin-1.jar is our JAR file we built earlier)&lt;/p&gt;
  801.  
  802. &lt;pre style=&quot;background-color: #f6f8fa; border-radius: 3px; box-sizing: border-box; color: #24292e; font-family: SFMono-Regular, Consolas, &amp;quot;Liberation Mono&amp;quot;, Menlo, monospace; font-size: 13.6px; line-height: 1.45; overflow-wrap: normal; overflow: auto; padding: 16px;&quot;&gt;&lt;code style=&quot;background: initial; border-radius: 3px; border: 0px; box-sizing: border-box; display: inline; font-family: SFMono-Regular, Consolas, &amp;quot;Liberation Mono&amp;quot;, Menlo, monospace; line-height: inherit; margin: 0px; overflow-wrap: normal; overflow: visible; padding: 0px; word-break: normal;&quot;&gt;C:\IBM\Domino\DemoAddin\DemoAddin-1.jar&lt;/code&gt;&lt;/pre&gt;
  803. &lt;p style=&quot;text-align: justify;&quot;&gt;and then register it in server&#39;s notes.ini using variable &lt;b&gt;JAVAUSERCLASSES&lt;/b&gt;. In case if there are other addin registered there use semicolon as a separator for Windows and a colon for Linux&lt;/p&gt;
  804. &lt;pre style=&quot;background-color: #f6f8fa; border-radius: 3px; box-sizing: border-box; color: #24292e; font-family: SFMono-Regular, Consolas, &amp;quot;Liberation Mono&amp;quot;, Menlo, monospace; font-size: 13.6px; line-height: 1.45; overflow-wrap: normal; overflow: auto; padding: 16px;&quot;&gt;&lt;code style=&quot;background: initial; border-radius: 3px; border: 0px; box-sizing: border-box; display: inline; font-family: SFMono-Regular, Consolas, &amp;quot;Liberation Mono&amp;quot;, Menlo, monospace; line-height: inherit; margin: 0px; overflow-wrap: normal; overflow: visible; padding: 0px; word-break: normal;&quot;&gt;JAVAUSERCLASSES=addin-1;.\DemoAddin\DemoAddin-1.jar;addin-2&lt;/code&gt;&lt;/pre&gt;
  805.  
  806. &lt;p style=&quot;text-align: justify;&quot;&gt;&lt;strong&gt;Alternatively&lt;/strong&gt; simply put JAR file into the folder \jvm\lib\ext, but personally I prefer to keep customization separately instead of mixing core JAR files with customization. Additionally I&#39;m not sure what happens to custom JAR file when is upgradet.&lt;/p&gt;
  807.  
  808. &lt;h3&gt;4) Load JavaAddin&lt;/h3&gt;
  809. &lt;p style=&quot;text-align: justify;&quot;&gt;It&#39;s time to run our DemoAddin. From console run following command&lt;/p&gt;
  810.  
  811. &lt;pre style=&quot;background-color: #f6f8fa; border-radius: 3px; box-sizing: border-box; color: #24292e; font-family: SFMono-Regular, Consolas, &amp;quot;Liberation Mono&amp;quot;, Menlo, monospace; font-size: 13.6px; line-height: 1.45; overflow-wrap: normal; overflow: auto; padding: 16px;&quot;&gt;&lt;code style=&quot;background: initial; border-radius: 3px; border: 0px; box-sizing: border-box; display: inline; font-family: SFMono-Regular, Consolas, &amp;quot;Liberation Mono&amp;quot;, Menlo, monospace; line-height: inherit; margin: 0px; overflow-wrap: normal; overflow: visible; padding: 0px; word-break: normal;&quot;&gt;load runjava DemoAddin&lt;/code&gt;&lt;/pre&gt;
  812.  
  813. &lt;p style=&quot;text-align: justify;&quot;&gt;Take into account if your include your class into a package, f.x. package org.demo; than you should add that into run command&lt;/p&gt;
  814.  
  815. &lt;pre style=&quot;background-color: #f6f8fa; border-radius: 3px; box-sizing: border-box; color: #24292e; font-family: SFMono-Regular, Consolas, &amp;quot;Liberation Mono&amp;quot;, Menlo, monospace; font-size: 13.6px; line-height: 1.45; overflow-wrap: normal; overflow: auto; padding: 16px;&quot;&gt;&lt;code style=&quot;background: initial; border-radius: 3px; border: 0px; box-sizing: border-box; display: inline; font-family: SFMono-Regular, Consolas, &amp;quot;Liberation Mono&amp;quot;, Menlo, monospace; line-height: inherit; margin: 0px; overflow-wrap: normal; overflow: visible; padding: 0px; word-break: normal;&quot;&gt;load runjava org.demo.DemoAddin&lt;/code&gt;&lt;/pre&gt;
  816.  
  817. &lt;p style=&quot;text-align: justify;&quot;&gt;If everything went fine you should see 3 lines&lt;/p&gt;
  818.  
  819. &lt;pre style=&quot;background-color: #f6f8fa; border-radius: 3px; box-sizing: border-box; color: #24292e; font-family: SFMono-Regular, Consolas, &amp;quot;Liberation Mono&amp;quot;, Menlo, monospace; font-size: 13.6px; line-height: 1.45; overflow-wrap: normal; overflow: auto; padding: 16px;&quot;&gt;&lt;code style=&quot;background: initial; border-radius: 3px; border: 0px; box-sizing: border-box; display: inline; font-family: SFMono-Regular, Consolas, &amp;quot;Liberation Mono&amp;quot;, Menlo, monospace; line-height: inherit; margin: 0px; overflow-wrap: normal; overflow: visible; padding: 0px; word-break: normal;&quot;&gt;RunJava: Started DemoAddin Java task.
  820. Hello world
  821. RunJava: Finalized DemoAddin Java task.&lt;/code&gt;&lt;/pre&gt;
  822.  
  823. &lt;h3&gt;Possible error&lt;/h3&gt;
  824.  
  825. &lt;p style=&quot;text-align: justify;&quot;&gt;If you registered JAR file incorrectly, the error could be like this. In such case just make sure you followed steps properly.&lt;/p&gt;
  826.  
  827. &lt;pre style=&quot;background-color: #f6f8fa; border-radius: 3px; box-sizing: border-box; color: #24292e; font-family: SFMono-Regular, Consolas, &amp;quot;Liberation Mono&amp;quot;, Menlo, monospace; font-size: 13.6px; line-height: 1.45; overflow-wrap: normal; overflow: auto; padding: 16px;&quot;&gt;&lt;code style=&quot;background: initial; border-radius: 3px; border: 0px; box-sizing: border-box; display: inline; font-family: SFMono-Regular, Consolas, &amp;quot;Liberation Mono&amp;quot;, Menlo, monospace; line-height: inherit; margin: 0px; overflow-wrap: normal; overflow: visible; padding: 0px; word-break: normal;&quot;&gt;RunJava: Can&#39;t find class DemoAddin1 or lotus/notes/addins/demoaddin1/DemoAddin1 in the classpath.  Class names are case-sensitive.&lt;/code&gt;&lt;/pre&gt;
  828.  
  829. &lt;p style=&quot;text-align: justify;&quot;&gt;If I find time, I will make few more posts about this topic. It&#39;s really just a tip of the iceberg.&lt;/p&gt;
  830.  
  831. &lt;strong&gt;All articles in series&lt;/strong&gt;&lt;br&gt;
  832. &lt;ol&gt;
  833. &lt;li&gt;&lt;a href=&quot;https://dpastov.blogspot.com/2020/10/javaserveraddin-in-domino-introduction.html&quot;&gt;JavaServerAddin in Domino - introduction&lt;/a&gt;&lt;/li&gt;
  834. &lt;li&gt;&lt;a href=&quot;https://dpastov.blogspot.com/2020/10/javaserveraddin-in-domino-constructor.html&quot;&gt;JavaServerAddin in Domino - constructor and schedule&lt;/a&gt;&lt;/li&gt;
  835. &lt;/ol&gt;
  836. </description><link>https://dpastov.blogspot.com/2020/10/javaserveraddin-in-domino-introduction.html</link><author>noreply@blogger.com (Dmytro)</author><thr:total>6</thr:total><georss:featurename>Copenhagen, Denmark</georss:featurename><georss:point>55.6760968 12.5683372</georss:point><georss:box>27.365862963821158 -22.587912799999998 83.986330636178849 47.7245872</georss:box></item><item><guid isPermaLink="false">tag:blogger.com,1999:blog-34728599.post-3749560390882886022</guid><pubDate>Wed, 26 Feb 2020 23:06:00 +0000</pubDate><atom:updated>2020-02-27T00:10:39.196+01:00</atom:updated><category domain="http://www.blogger.com/atom/ns#">Java</category><title>NotesRichText to HTML native within Domino 10</title><description>Just realized that Domino 10+ came with possibility to convert RichTextItem to HTML almost in 1 line.&lt;br /&gt;
  837. &lt;br /&gt;
  838. &lt;pre style=&quot;background-color: #f6f8fa; border-radius: 3px; box-sizing: border-box; color: #24292e; font-family: SFMono-Regular, Consolas, &amp;quot;Liberation Mono&amp;quot;, Menlo, monospace; font-size: 13.6px; line-height: 1.45; overflow-wrap: normal; overflow: auto; padding: 16px;&quot;&gt;&lt;code style=&quot;background: initial; border-radius: 3px; border: 0px; box-sizing: border-box; display: inline; font-family: SFMono-Regular, Consolas, &amp;quot;Liberation Mono&amp;quot;, Menlo, monospace; line-height: inherit; margin: 0px; overflow-wrap: normal; overflow: visible; padding: 0px; word-break: normal;&quot;&gt;RichTextItem rt = (RichTextItem) doc.getFirstItem(&quot;Body&quot;);
  839. String html = rt.convertToHTML(null);
  840. &lt;/code&gt;&lt;/pre&gt;&lt;br /&gt;
  841. Finally all these tricky transformation of RichText to HTML can be removed, same goes to custom JSON and HTTPRequest libraries.&lt;br /&gt;
  842. &lt;br /&gt;
  843. I wonder what other useful improvements I missed?</description><link>https://dpastov.blogspot.com/2020/02/notesrichtext-to-html-native-from-10.html</link><author>noreply@blogger.com (Dmytro)</author><thr:total>2</thr:total></item><item><guid isPermaLink="false">tag:blogger.com,1999:blog-34728599.post-4869138124769123073</guid><pubDate>Mon, 17 Feb 2020 22:24:00 +0000</pubDate><atom:updated>2020-02-17T23:31:39.455+01:00</atom:updated><category domain="http://www.blogger.com/atom/ns#">CloudFlare</category><category domain="http://www.blogger.com/atom/ns#">DSAPI</category><title>Rewrite URL with CloudFlare for Domino</title><description>&lt;div&gt;
  844. Years ago I created few solutions for Domino using DSAPI:&lt;/div&gt;
  845. &lt;ol&gt;
  846. &lt;li&gt;remove last slash in URL served by Domino.&lt;/li&gt;
  847. &lt;li&gt;rewrite URL.&lt;/li&gt;
  848. &lt;li&gt;better control over 404/500 error pages.&lt;/li&gt;
  849. &lt;/ol&gt;
  850. &lt;br /&gt;
  851. &lt;div&gt;
  852. It was quite complicated solution (DSAPI is not easy topic).&lt;/div&gt;
  853. &lt;div&gt;
  854. Today another client asked similar features (remove last slash and rewrite url).&lt;/div&gt;
  855. &lt;div&gt;
  856. I started to recall how DSAPI works but then I reminded myself that the client stick with CloudFlare in front of their Domino servers.&lt;/div&gt;
  857. &lt;br /&gt;
  858. &lt;div&gt;
  859. Cloudflare has &#39;page rules&#39; which allow to solve issue with last trailing slash. Just matter of configuration.&lt;/div&gt;
  860. &lt;br /&gt;
  861. &lt;div&gt;
  862. And about rewriting URL it&#39;s actually possible to achieve with workers! You can see below how to rewrite URL.&lt;/div&gt;
  863. &lt;div&gt;
  864. In example below I changed url like&lt;br /&gt;
  865. domain.com/section/page?param1=aaa&amp;amp;param2=bbb&lt;br /&gt;
  866. =&amp;gt;&lt;br /&gt;
  867. domain.com/router?openagent&amp;amp;req=section/page&amp;amp;param1=aaa&amp;amp;param2=bbb&lt;/div&gt;
  868. &lt;br /&gt;
  869. &lt;pre style=&quot;background-color: #f6f8fa; border-radius: 3px; box-sizing: border-box; color: #24292e; font-family: SFMono-Regular, Consolas, &amp;quot;Liberation Mono&amp;quot;, Menlo, monospace; font-size: 13.6px; line-height: 1.45; overflow-wrap: normal; overflow: auto; padding: 16px;&quot;&gt;&lt;code style=&quot;background: initial; border-radius: 3px; border: 0px; box-sizing: border-box; display: inline; font-family: SFMono-Regular, Consolas, &amp;quot;Liberation Mono&amp;quot;, Menlo, monospace; line-height: inherit; margin: 0px; overflow-wrap: normal; overflow: visible; padding: 0px; word-break: normal;&quot;&gt;addEventListener(&#39;fetch&#39;, event =&amp;gt; {
  870.  const url = new URL(event.request.url);
  871.  const pathname = url.pathname.substr(1);
  872.  if (pathname.startsWith(&quot;design&quot;) || pathname.startsWith(&quot;files&quot;) || pathname.startsWith(&quot;api&quot;)) {
  873.    return;
  874.  }
  875.  event.respondWith(handleRequest(event.request));
  876. })
  877.  
  878. /**
  879. * Rewrite URL and makes query param available
  880. * @param {Request} request
  881. */
  882. async function handleRequest(request) {
  883.  let url = new URL(request.url);
  884.  let pathname = url.pathname.substr(1);
  885.  url.pathname = &quot;?openagent&amp;amp;req=&quot;+pathname;
  886.  var query = url.search;
  887.  if (query!=&quot;&quot;) {
  888.    url.pathname += &quot;&amp;amp;&quot; + query.substr(1);
  889.  }
  890.  
  891.  const newRequest = new Request(url, new Request(request));
  892.  return await fetch(newRequest)
  893. }
  894. &lt;/code&gt;&lt;/pre&gt;
  895. </description><link>https://dpastov.blogspot.com/2020/02/rewrite-url-with-cloudflare-for-domino.html</link><author>noreply@blogger.com (Dmytro)</author><thr:total>0</thr:total></item><item><guid isPermaLink="false">tag:blogger.com,1999:blog-34728599.post-4083845564953667170</guid><pubDate>Wed, 25 Sep 2019 10:46:00 +0000</pubDate><atom:updated>2019-09-25T12:46:26.807+02:00</atom:updated><category domain="http://www.blogger.com/atom/ns#">JSON</category><title>JSON Reader in LotusScript</title><description>For those who are still running Domino v9 (or below) here is a LotusScript library that can parse JSON into something useful. I implemented it some time ago and since that time almost had no issues with it. Since many customers that did not migrate to v10 (and probably won&#39;t do that in near future) it could be very useful to them.&lt;br /&gt;
  896. &lt;br /&gt;
  897. You can download my realization on github: &lt;a href=&quot;https://github.com/dpastov/jsonparser-ls&quot;&gt;jsonparser-ls&lt;/a&gt;&lt;br /&gt;
  898. &lt;br /&gt;
  899. See example below how it works&lt;br /&gt;
  900. &lt;br /&gt;
  901. &lt;pre style=&quot;background-color: #f6f8fa; border-radius: 3px; box-sizing: border-box; color: #24292e; font-family: SFMono-Regular, Consolas, &amp;quot;Liberation Mono&amp;quot;, Menlo, monospace; font-size: 13.6px; line-height: 1.45; overflow-wrap: normal; overflow: auto; padding: 16px;&quot;&gt;&lt;code style=&quot;background: initial; border-radius: 3px; border: 0px; box-sizing: border-box; display: inline; font-family: SFMono-Regular, Consolas, &amp;quot;Liberation Mono&amp;quot;, Menlo, monospace; line-height: inherit; margin: 0px; overflow-wrap: normal; overflow: visible; padding: 0px; word-break: normal;&quot;&gt;Dim parser As JSONParser
  902. Dim jsonObj As JSONObject
  903. Dim jsonArr As JSONArray
  904. Dim jsonString As String
  905.  
  906. Set parser = New JSONParser
  907.  
  908. &#39;object
  909. jsonString = |{&quot;array&quot;:[1,  2  ,   300.56  ]  ,  &quot;boolean&quot;:true,&quot;null&quot;:null,&quot;number&quot;:123,&quot;object&quot;:{&quot;a&quot;:&quot;b&quot;,&quot;c&quot;:&quot;d&quot;,&quot;arr&quot;:[&quot;12&quot;,&quot;23&quot;,34.56],&quot;e&quot;:&quot;f&quot;,&quot;ho&quot;:true},&quot;string&quot;:&quot;Hello World&quot;}|
  910. Set jsonObj = parser.parse(jsonString)
  911. &#39;test
  912. Print jsonObj.HasItem(&quot;array&quot;) &#39;true
  913. Print jsonObj.HasItem(&quot;array1&quot;) &#39;false
  914. print jsonObj.GetItem(&quot;array&quot;).Items(2) &#39;300.56
  915. print IsNull(jsonObj.GetItem(&quot;null&quot;)) &#39;true
  916. print jsonObj.GetItem(&quot;number&quot;) &#39;123
  917. print jsonObj.GetItem(&quot;object&quot;).getItem(&quot;c&quot;) &#39;d
  918. print jsonObj.GetItem(&quot;object&quot;).getItem(&quot;ho&quot;) &#39;true
  919. print jsonObj.GetItem(&quot;object&quot;).getItem(&quot;arr&quot;).Items(2) &#39;34.56
  920.  
  921. &#39;array
  922. jsonString = |[{a:1,b:true,_dd:null},12,&quot;13&quot;,true,{}]|
  923. Set jsonArr = parser.parse(jsonString)
  924. &#39;test
  925. print jsonArr.Items(0).getItem(&quot;b&quot;) &#39;true
  926. print jsonArr.Items(1) &#39;12
  927. print jsonArr.Items(2) &#39;13
  928. print jsonArr.Items(3) &#39;true
  929. print TypeName(jsonArr.Items(4)) &#39;&quot;JSONOBJECT&quot;&lt;/code&gt;&lt;/pre&gt;
  930. &lt;br /&gt;</description><link>https://dpastov.blogspot.com/2019/09/json-reader-in-lotusscript.html</link><author>noreply@blogger.com (Dmytro)</author><thr:total>2</thr:total></item><item><guid isPermaLink="false">tag:blogger.com,1999:blog-34728599.post-6711847220246992020</guid><pubDate>Tue, 24 Sep 2019 12:02:00 +0000</pubDate><atom:updated>2019-09-24T14:03:13.800+02:00</atom:updated><category domain="http://www.blogger.com/atom/ns#">javascript</category><category domain="http://www.blogger.com/atom/ns#">LS2J</category><title>Create Excel files with LotusScript without Excel installed</title><description>&lt;div style=&quot;text-align: justify;&quot;&gt;
  931. One of my customer asked me to find a solution to create Excel files using LotusScript on server without Excel on it (well who wants to do install Excel and other tools on Server). Took some time but I have made a proof of concept using&amp;nbsp;&lt;a href=&quot;https://poi.apache.org/&quot;&gt;Apache POI&lt;/a&gt; and it worked very very nice. I have also made a LS2J cover so it&#39;s more easily for people who are not familiar with Java to create Excel files.&lt;/div&gt;
  932. &lt;br /&gt;
  933. I put demo on my github account with some explanation so feel free to have a look on it: &lt;a href=&quot;https://github.com/dpastov/excel-apache-ls&quot;&gt;excel-apache-ls&lt;/a&gt;&amp;nbsp;but if you wonder how it works, see snippet below:&lt;br /&gt;
  934. &lt;br /&gt;
  935. &lt;pre style=&quot;background-color: #f6f8fa; border-radius: 3px; box-sizing: border-box; color: #24292e; font-family: SFMono-Regular, Consolas, &amp;quot;Liberation Mono&amp;quot;, Menlo, monospace; font-size: 13.6px; line-height: 1.45; overflow-wrap: normal; overflow: auto; padding: 16px;&quot;&gt;&lt;code style=&quot;background: initial; border-radius: 3px; border: 0px; box-sizing: border-box; display: inline; font-family: SFMono-Regular, Consolas, &amp;quot;Liberation Mono&amp;quot;, Menlo, monospace; line-height: inherit; margin: 0px; overflow-wrap: normal; overflow: visible; padding: 0px; word-break: normal;&quot;&gt;Option Public
  936. Option Declare
  937.  
  938. UseLSX &quot;*javacon&quot;
  939. Use &quot;Apache.Excel&quot;
  940.  
  941. Sub Initialize
  942. Dim jSession As JavaSession
  943. Dim jClass As Javaclass
  944. Dim jObject As JavaObject
  945. Dim filepath As String
  946. Dim row As Integer
  947.  
  948. Set jSession = New Javasession
  949. Set jClass = jSession.GetClass(&quot;explicants.office.Excel&quot;)
  950. Set jObject = jClass.Createobject()
  951. Call jObject.createSheet(&quot;sheet A-100&quot;)
  952. Call jObject.createSheet(&quot;sheet B-100&quot;)
  953. Call jObject.createSheet(&quot;sheet C-100&quot;)
  954. Call jObject.getSheet(&quot;sheet A-100&quot;)
  955.  
  956. row = row + 1
  957. Call jObject.setCellValueString(&quot;lorem&quot;, row, 0)
  958. Call jObject.setCellValueString(&quot;ipsum&quot;, row, 1)
  959. Call jObject.setCellValueDouble(55, row, 2)
  960. row = row + 1
  961. Call jObject.setCellValueString(&quot;hello&quot;, row, 0)
  962. Call jObject.setCellValueString(&quot;world&quot;, row, 1)
  963. Call jObject.setCellValueDouble(200.50, row, 2)
  964. row = row + 1
  965. Call jObject.setCellValueString(&quot;gurli gris&quot;, row, 0)
  966. Call jObject.setCellValueString(&quot;george&quot;, row, 1)
  967. Call jObject.setCellValueDouble(0.505, row, 2)
  968. filepath = Environ(&quot;Temp&quot;) &amp;amp; Join(Evaluate({@Unique})) &amp;amp; &quot;.xls&quot;
  969. Call jObject.saveAsFile(filepath)
  970. MsgBox filepath
  971. End Sub&lt;/code&gt;&lt;/pre&gt;
  972. &lt;br /&gt;</description><link>https://dpastov.blogspot.com/2019/09/create-excel-files-with-lotusscript.html</link><author>noreply@blogger.com (Dmytro)</author><thr:total>4</thr:total></item><item><guid isPermaLink="false">tag:blogger.com,1999:blog-34728599.post-8696763436701578120</guid><pubDate>Tue, 03 Sep 2019 12:49:00 +0000</pubDate><atom:updated>2019-09-29T10:00:55.955+02:00</atom:updated><category domain="http://www.blogger.com/atom/ns#">Java</category><category domain="http://www.blogger.com/atom/ns#">LS</category><title>Formatting NotesDatetime as Java SimpleDateFormat</title><description>&lt;div style=&quot;text-align: justify;&quot;&gt;Recently I had to made proper formatting of NotesDateTime object (using LotusScript) with respect to different locale. I had written a cover in LS2J for Java SimpleDateFormat class that works independently (without Java library), so copy/paste and go on.&lt;/div&gt;&lt;br /&gt;
  973. Here is an example how it works&lt;br /&gt;
  974. &lt;pre style=&quot;background-color: #f6f8fa; border-radius: 3px; box-sizing: border-box; color: #24292e; font-family: SFMono-Regular, Consolas, &amp;quot;Liberation Mono&amp;quot;, Menlo, monospace; font-size: 13.6px; line-height: 1.45; overflow-wrap: normal; overflow: auto; padding: 16px;&quot;&gt;&lt;code style=&quot;background: transparent; border-radius: 3px; border: 0px; box-sizing: border-box; display: inline; font-family: SFMono-Regular, Consolas, &amp;quot;Liberation Mono&amp;quot;, Menlo, monospace; font-size: 13.6px; line-height: inherit; margin: 0px; overflow-wrap: normal; overflow: visible; padding: 0px; word-break: normal;&quot;&gt;Dim jdtr As New jDateTimeRich
  975. Dim dt As New NotesDateTime(&quot;15-10-2017 10:20:30&quot;)
  976.  
  977. MsgBox jdtr.SimpleDateFormat(dt, &quot;dd-MM-yyyy&quot;, &quot;&quot;, &quot;&quot;) &#39; &quot;15-10-2017&quot;
  978. MsgBox jdtr.SimpleDateFormat(dt, &quot;d-MMM-yy&quot;, &quot;ru&quot;, &quot;RU&quot;) &#39; &quot;15-окт-17&quot;
  979. MsgBox jdtr.SimpleDateFormat(dt, &quot;EEEEE MMMMM yyyy HH:mm:ss.SSSZ&quot;, &quot;da&quot;, &quot;DK&quot;) &#39; &quot;søndag oktober 2017 11:20:30.000+0200&quot;)
  980. &lt;/code&gt;&lt;/pre&gt;&lt;div&gt;&lt;code style=&quot;background: transparent; border-radius: 3px; border: 0px; box-sizing: border-box; display: inline; font-family: SFMono-Regular, Consolas, &amp;quot;Liberation Mono&amp;quot;, Menlo, monospace; font-size: 13.6px; line-height: inherit; margin: 0px; overflow-wrap: normal; overflow: visible; padding: 0px; word-break: normal;&quot;&gt;&lt;br /&gt;
  981. &lt;/code&gt;&lt;/div&gt;&lt;div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;div style=&quot;text-align: left;&quot;&gt;&lt;code style=&quot;background: transparent; border-radius: 3px; border: 0px; box-sizing: border-box; display: inline; font-family: SFMono-Regular, Consolas, &amp;quot;Liberation Mono&amp;quot;, Menlo, monospace; font-size: 13.6px; line-height: inherit; margin: 0px; overflow-wrap: normal; overflow: visible; padding: 0px; word-break: normal;&quot;&gt;The beautiful part of it - is translation of months and days according to Locale.&lt;/code&gt;&lt;/div&gt;&lt;/div&gt;&lt;/div&gt;&lt;div&gt;&lt;/div&gt;&lt;div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;I have uploaded source/class on github. Feel free to re-use it: &lt;a href=&quot;https://github.com/dpastov/jdatetimerich-ls&quot;&gt;&lt;b&gt;jDatetimeRich-LS&lt;/b&gt;&lt;/a&gt;&amp;nbsp;and report issues of course.&lt;/div&gt;&lt;/div&gt;</description><link>https://dpastov.blogspot.com/2019/09/formatting-notesdatetime-as-java.html</link><author>noreply@blogger.com (Dmytro)</author><thr:total>0</thr:total></item><item><guid isPermaLink="false">tag:blogger.com,1999:blog-34728599.post-6610518483329320203</guid><pubDate>Tue, 17 Jul 2018 11:51:00 +0000</pubDate><atom:updated>2018-09-13T10:28:12.661+02:00</atom:updated><category domain="http://www.blogger.com/atom/ns#">Domino</category><category domain="http://www.blogger.com/atom/ns#">Java</category><title>Domino with Java 6 and TSL 1.2</title><description>Recently I have faced an issue where one of our provider changed SSL and they disabled supporting of TLS 1.0 (as far as I understand it&#39;s non secure ourdays) and TLS 1.2 should be used instead. As a result our java agents (which used HttpsURLConnection) could not connect anymore to provider.&lt;br /&gt;
  982. &lt;br /&gt;
  983. Error message looked like this:&lt;br /&gt;
  984. &lt;pre style=&quot;background-color: #eeeeee; border: 1px dashed rgb(153, 153, 153); color: black; font-size: 12px; line-height: 14px; overflow: auto; padding: 5px; width: 97%;&quot;&gt;&lt;span style=&quot;font-family: &amp;quot;verdana&amp;quot; , sans-serif;&quot;&gt;Caused by: java.security.AccessControlException: Access denied (&lt;a href=&quot;http://javax.net/&quot;&gt;javax.net&lt;/a&gt;.ssl.SSLPermission setHostnameVerifier)&lt;/span&gt;&lt;/pre&gt;I have found 2 possible solutions:&lt;br /&gt;
  985. &lt;br /&gt;
  986. &lt;h3&gt;Enable TLS 1.2 on Domino (applicable only for 9.0.1 FP3 IF2 and higher)&lt;/h3&gt;&lt;br /&gt;
  987. The Domino JVM is based on Java 1.6 and default settings configured in a way to use TLS 1.0. Luckily our Domino servers had version 9.0.1 FP4 (and TSL 1.2 support has been added since FP3 IF2). So our version was capable to work with 1.2 (in theory) but it took some time to make it work.&lt;br /&gt;
  988. &lt;br /&gt;
  989. In order to configure Domino JVM to use TLS 1.2 you need to:&lt;br /&gt;
  990. &lt;ol&gt;&lt;li&gt;Create JVM settings file, f.x. C:\Domino\jvmOptions.ini&lt;/li&gt;
  991. &lt;li&gt;Add parameter in jvmOptions.ini&lt;br /&gt;
  992. &lt;pre style=&quot;background-color: #eeeeee; border: 1px dashed rgb(153, 153, 153); color: black; font-size: 12px; line-height: 14px; overflow: auto; padding: 5px; width: 97%;&quot;&gt;&lt;span style=&quot;font-family: &amp;quot;verdana&amp;quot; , sans-serif;&quot;&gt;https.protocols=TLSv1.2&lt;/span&gt;&lt;/pre&gt;&lt;/li&gt;
  993. &lt;li&gt;Add path to jvmOptions.ini file in notes.ini&lt;br /&gt;
  994. &lt;pre style=&quot;background-color: #eeeeee; border: 1px dashed rgb(153, 153, 153); color: black; font-size: 12px; line-height: 14px; overflow: auto; padding: 5px; width: 97%;&quot;&gt;&lt;span style=&quot;font-family: &amp;quot;verdana&amp;quot; , sans-serif;&quot;&gt;JavaUserOptionsFile=C:\Domino\jvmOptions.ini&lt;/span&gt;&lt;/pre&gt;&lt;/li&gt;
  995. &lt;/ol&gt;After you added settings don&#39;t forget to restart Domino server. Keep in mind that setting is global meaning all agents that will start to use TLS1.2 therefore it is definitely worth to verify everything before and after this fix.&lt;br /&gt;
  996. &lt;br /&gt;
  997. &lt;h3&gt;Java library solution&lt;/h3&gt;&lt;br /&gt;
  998. If that is not a way you can go with (f.x. Domino has lower version or something won&#39;f work if you switch to TLS 1.2) then it&#39;s still possible to make custom Java Library that will make it possible, see link: &lt;a href=&quot;https://stackoverflow.com/questions/33364100/how-to-use-tls-1-2-in-java-6&quot;&gt;How to use TLS 1.2 in Java 6&lt;/a&gt;.&lt;br /&gt;
  999. &lt;br /&gt;
  1000. It worked for me as well, but it requires to give permission in java policy on Domino server.</description><link>https://dpastov.blogspot.com/2018/07/domino-with-java-6-and-tsl-12.html</link><author>noreply@blogger.com (Dmytro)</author><thr:total>3</thr:total></item><item><guid isPermaLink="false">tag:blogger.com,1999:blog-34728599.post-4574629473821550347</guid><pubDate>Wed, 08 Mar 2017 14:31:00 +0000</pubDate><atom:updated>2017-03-09T09:38:33.960+01:00</atom:updated><category domain="http://www.blogger.com/atom/ns#">Play Framework</category><title>View.html.index cannot be resolved to a type</title><description>&lt;div style=&quot;text-align: justify;&quot;&gt;If your play project in eclipse says that it can&#39;t resolve a type (see message below), but you are certain that everything should be fine&lt;/div&gt;&lt;pre style=&quot;background-color: #eeeeee; border: 1px dashed rgb(153, 153, 153); color: black; font-size: 12px; line-height: 14px; overflow: auto; padding: 5px; width: 97%;&quot;&gt;&lt;span style=&quot;font-family: &amp;quot;verdana&amp;quot; , sans-serif;&quot;&gt;$ View.html.index cannot be resolved to a type
  1001. &lt;/span&gt;&lt;/pre&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;try to make a clean compile&lt;/div&gt;&lt;pre style=&quot;background-color: #eeeeee; border: 1px dashed rgb(153, 153, 153); color: black; font-size: 12px; line-height: 14px; overflow: auto; padding: 5px; width: 97%;&quot;&gt;&lt;span style=&quot;font-family: &amp;quot;verdana&amp;quot; , sans-serif;&quot;&gt;$ activator clean compile eclipse&lt;/span&gt;&lt;/pre&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;It helped me to resolve my issue.&lt;/div&gt;</description><link>https://dpastov.blogspot.com/2017/03/viewhtmlindex-cannot-be-resolved-to-type.html</link><author>noreply@blogger.com (Dmytro)</author><thr:total>0</thr:total></item><item><guid isPermaLink="false">tag:blogger.com,1999:blog-34728599.post-1670596980056503904</guid><pubDate>Thu, 12 Jan 2017 12:08:00 +0000</pubDate><atom:updated>2017-01-12T13:08:49.000+01:00</atom:updated><category domain="http://www.blogger.com/atom/ns#">Play Framework</category><title>Kill Play Framework process</title><description>&lt;div style=&quot;text-align: justify;&quot;&gt;When we run application in DEV mode (using command activator run) the process normally will be killed when terminal is closed. It&#39;s pretty easy since PID is started/closed automatically and therefore we do not care about it at all.&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;Once we start application in PROD mode there is a file RUNNING_PID is created (./target/universal/stage/RUNNING_PID). There is a command (since version 2.4) in activator (stopProd) which will close PID&lt;/div&gt;&lt;pre style=&quot;background-color: #eeeeee; border: 1px dashed rgb(153, 153, 153); color: black; font-size: 12px; line-height: 14px; overflow: auto; padding: 5px; width: 97%;&quot;&gt;&lt;span style=&quot;font-family: &amp;quot;verdana&amp;quot; , sans-serif;&quot;&gt;$ activator stopProd&lt;/span&gt;&lt;/pre&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;Alternatively you can just kill process &#39;manually&#39;&lt;br /&gt;
  1002. &lt;/div&gt;&lt;pre style=&quot;background-color: #eeeeee; border: 1px dashed rgb(153, 153, 153); color: black; font-size: 12px; line-height: 14px; overflow: auto; padding: 5px; width: 97%;&quot;&gt;&lt;span style=&quot;font-family: &amp;quot;verdana&amp;quot; , sans-serif;&quot;&gt;$ kill $(cat target/universal/stage/RUNNING_PID)&lt;/span&gt;&lt;/pre&gt;</description><link>https://dpastov.blogspot.com/2017/01/kill-play-framework-process.html</link><author>noreply@blogger.com (Dmytro)</author><thr:total>0</thr:total></item><item><guid isPermaLink="false">tag:blogger.com,1999:blog-34728599.post-802839450719715223</guid><pubDate>Thu, 12 Jan 2017 09:31:00 +0000</pubDate><atom:updated>2017-01-12T15:18:18.096+01:00</atom:updated><category domain="http://www.blogger.com/atom/ns#">Play Framework</category><title>Play Framework project in production - Building process</title><description>&lt;div style=&quot;text-align: justify;&quot;&gt;We want to deploy our Play project to production environment.&lt;/div&gt;&lt;br /&gt;
  1003. &lt;h3&gt;Create a binary version of application&lt;/h3&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;There are two commands that can help you to make a build. Simply run &lt;b&gt;dist&lt;/b&gt; (it invokes universal:packageBin) or &lt;b&gt;universal:packageZipTarball&lt;/b&gt; in Play console and wait&lt;/div&gt;&lt;pre style=&quot;background-color: #eeeeee; border: 1px dashed rgb(153, 153, 153); color: black; font-size: 12px; line-height: 14px; overflow: auto; padding: 5px; width: 97%;&quot;&gt;&lt;span style=&quot;font-family: &amp;quot;verdana&amp;quot; , sans-serif;&quot;&gt;$ dist&lt;/span&gt;&lt;/pre&gt;&lt;pre style=&quot;background-color: #eeeeee; border: 1px dashed rgb(153, 153, 153); color: black; font-size: 12px; line-height: 14px; overflow: auto; padding: 5px; width: 97%;&quot;&gt;&lt;span style=&quot;font-family: &amp;quot;verdana&amp;quot; , sans-serif;&quot;&gt;$ universal:packageZipTarball&lt;/span&gt;&lt;/pre&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;Result will be a ZIP or TGZ file located in target/universal folder with everything needed for you project (it means you do not need to install SBT or Activator on your server, just pure Java). Once you extract ZIP you will find 2 runner files in bin folder (one for unix and one for windows). Just run it and your server will up&lt;/div&gt;&lt;pre style=&quot;background-color: #eeeeee; border: 1px dashed rgb(153, 153, 153); color: black; font-size: 12px; line-height: 14px; overflow: auto; padding: 5px; width: 97%;&quot;&gt;&lt;span style=&quot;font-family: &amp;quot;verdana&amp;quot; , sans-serif;&quot;&gt;$ path/to/hellow-world/bin/hello-world-app
  1004. [info] play.api.Play - Application started (Prod)
  1005. [info] p.c.s.NettyServer - Listening for HTTP on /0:0:0:0:0:0:0:0:9000&lt;/span&gt;&lt;/pre&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;Make sure you have rights to run server, sometimes you need to give rights (see example below)&lt;/div&gt;&lt;pre style=&quot;background-color: #eeeeee; border: 1px dashed rgb(153, 153, 153); color: black; font-size: 12px; line-height: 14px; overflow: auto; padding: 5px; width: 97%;&quot;&gt;&lt;span style=&quot;font-family: &amp;quot;verdana&amp;quot; , sans-serif;&quot;&gt;$ chmod +x /path/to/bin/project-name&lt;/span&gt;&lt;/pre&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;To run process in background&lt;br /&gt;
  1006. &lt;/div&gt;&lt;pre style=&quot;background-color: #eeeeee; border: 1px dashed rgb(153, 153, 153); color: black; font-size: 12px; line-height: 14px; overflow: auto; padding: 5px; width: 97%;&quot;&gt;&lt;span style=&quot;font-family: &amp;quot;verdana&amp;quot; , sans-serif;&quot;&gt;$ sudo nohup target/universal/stage/bin/eqa-app -Dhttp.port=80 -Dplay.crypto.secret=&quot;secret_token_123&quot; &lt;/dev/null &gt;/dev/null 2&gt;&amp;1 &amp;&lt;/span&gt;&lt;/pre&gt;</description><link>https://dpastov.blogspot.com/2017/01/play-project-production-building-process.html</link><author>noreply@blogger.com (Dmytro)</author><thr:total>0</thr:total></item><item><guid isPermaLink="false">tag:blogger.com,1999:blog-34728599.post-6201891631946620722</guid><pubDate>Thu, 12 Jan 2017 07:00:00 +0000</pubDate><atom:updated>2017-01-12T10:32:58.600+01:00</atom:updated><category domain="http://www.blogger.com/atom/ns#">Play Framework</category><title>Play Framework project in production - Application Secret</title><description>&lt;div style=&quot;text-align: justify;&quot;&gt;I am going to make series of articles about how to deploy &lt;a href=&quot;https://www.playframework.com/&quot;&gt;Play Framework&lt;/a&gt;&amp;nbsp;(version 2.5) application on &lt;a href=&quot;https://www.centos.org/&quot;&gt;centOS&lt;/a&gt;&amp;nbsp;together with build system &lt;a href=&quot;https://jenkins.io/&quot;&gt;Jenkins&lt;/a&gt;. I&#39;m doing this first time and want to document everything for myself and at the same time I hope it can be useful for somebody else as well.&lt;br /&gt;
  1007. &lt;br /&gt;
  1008. Before I wrote few articles how to setup hello-world project on centOS or macOS however now I&#39;m going to work on production setup. I assume you already have you hello-world project and clean centOS environment.&lt;br /&gt;
  1009. &lt;br /&gt;
  1010. Let&#39;s have a look on important moment.&lt;br /&gt;
  1011. &lt;/div&gt;&lt;br /&gt;
  1012. &lt;h1&gt;Application secret&lt;/h1&gt;&lt;br /&gt;
  1013. &lt;div style=&quot;text-align: justify;&quot;&gt;Each play application has secret key which is used for signing session and some other important stuff. It is not possible to run play project in production mode in case if secret is not set or if it is set to default value &#39;changeme&#39;. Secret key is stored in application.conf file /path/to/hello-word/conf/application.conf in variable play.crypto.secret (see below).&lt;/div&gt;&lt;pre style=&quot;background-color: #eeeeee; border: 1px dashed rgb(153, 153, 153); color: black; font-size: 12px; line-height: 14px; overflow: auto; padding: 5px; width: 97%;&quot;&gt;&lt;span style=&quot;font-family: Verdana, sans-serif;&quot;&gt;## Secret key
  1014. # http://www.playframework.com/documentation/latest/ApplicationSecret
  1015. # ~~~~~
  1016. # The secret key is used to sign Play&#39;s session cookie.
  1017. # This must be changed for production, but we don&#39;t recommend you change it in this file.
  1018. play.crypto.secret = &quot;changeme&quot;&lt;/span&gt;&lt;/pre&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;Of course we should not share our secret key and therefore it has to be used/stored on production side only.&lt;br /&gt;
  1019. &lt;/div&gt;&lt;br /&gt;
  1020. There are at least 3 ways how we can use secret key on production side.&lt;br /&gt;
  1021. &lt;br /&gt;
  1022. &lt;h3&gt;1. Secret key as a parameter&lt;/h3&gt;It is fine if you have simple application on 1 server, but I would not really recommend that for bigger project.&lt;br /&gt;
  1023. &lt;pre style=&quot;background-color: #eeeeee; border: 1px dashed rgb(153, 153, 153); color: black; font-size: 12px; line-height: 14px; overflow: auto; padding: 5px; width: 97%;&quot;&gt;&lt;span style=&quot;font-family: Verdana, sans-serif;&quot;&gt;/path/to/hello-world -Dplay.crypto.secret=&quot;secret_token_123&quot;
  1024. &lt;/span&gt;&lt;/pre&gt;&lt;h3&gt;2. Environment variables&lt;/h3&gt;That would read variable from OS environment, otherwise default value will be used (actually the last defined one, in example below it is &quot;chagneme&quot;).&lt;br /&gt;
  1025. &lt;pre style=&quot;background-color: #eeeeee; border: 1px dashed rgb(153, 153, 153); color: black; font-size: 12px; line-height: 14px; overflow: auto; padding: 5px; width: 97%;&quot;&gt;&lt;span style=&quot;font-family: Verdana, sans-serif;&quot;&gt;play.crypto.secret=&quot;changeme&quot;
  1026. play.crypto.secret=${?APPLICATION_SECRET}&lt;/span&gt;&lt;/pre&gt;&lt;h3&gt;3. Use separate configuration file&lt;/h3&gt;Separate configuration is probably the best way to go.&lt;br /&gt;
  1027. &lt;pre style=&quot;background-color: #eeeeee; border: 1px dashed rgb(153, 153, 153); color: black; font-size: 12px; line-height: 14px; overflow: auto; padding: 5px; width: 97%;&quot;&gt;&lt;span style=&quot;font-family: Verdana, sans-serif;&quot;&gt;include &quot;application&quot;
  1028. play.crypto.secret=&quot;QCY?tAnfk?aZ?iwrNwnxIlR6CTf:G3gf:90Latabg@5241AB`R5W:1uDFN];Ik@n&quot;
  1029. &lt;/span&gt;&lt;/pre&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;They include config while running application.&lt;br /&gt;
  1030. &lt;/div&gt;&lt;pre style=&quot;background-color: #eeeeee; border: 1px dashed rgb(153, 153, 153); color: black; font-size: 12px; line-height: 14px; overflow: auto; padding: 5px; width: 97%;&quot;&gt;&lt;span style=&quot;font-family: Verdana, sans-serif;&quot;&gt;/path/to/hello-word/bin/yourapp -Dconfig.file=/path/to/production.conf&lt;/span&gt;&lt;/pre&gt;&lt;h3&gt;Secret tools&lt;br /&gt;
  1031. &lt;/h3&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;There are few already builtin function that can help you deal with secrets: playGenerateSecret (generate secret) and playUpdateSecret (generate and update into config).&lt;br /&gt;
  1032. &lt;/div&gt;&lt;pre style=&quot;background-color: #eeeeee; border: 1px dashed rgb(153, 153, 153); color: black; font-size: 12px; line-height: 14px; overflow: auto; padding: 5px; width: 97%;&quot;&gt;&lt;span style=&quot;font-family: Verdana, sans-serif;&quot;&gt;$ playGenerateSecret
  1033. [info] Generated new secret: G28Dze]Z4lr@Or_9DCoz;tT_yCj6opKkkIh27K&gt;[0l_NT9lZaFfs?=zx[Wulz&gt;cX
  1034. [success] Total time: 0 s, completed Jan 11, 2017 6:24:12 PM
  1035. &lt;/span&gt;&lt;/pre&gt;&lt;pre style=&quot;background-color: #eeeeee; border: 1px dashed rgb(153, 153, 153); color: black; font-size: 12px; line-height: 14px; overflow: auto; padding: 5px; width: 97%;&quot;&gt;&lt;span style=&quot;font-family: Verdana, sans-serif;&quot;&gt;$ playUpdateSecret
  1036. [info] Generated new secret: QmJ?udauJgDj34AYifbprJvbT5I8^Vw1MY0WmbYRscZmAOotkalbhXbIs^48_Uc9
  1037. [info] Updating application secret in /Users/dpa/git/eqa-app/conf/application.conf
  1038. [info] Replacing old application secret: changeme
  1039. [success] Total time: 0 s, completed Jan 11, 2017 9:22:06 PM
  1040. &lt;/span&gt;&lt;/pre&gt;</description><link>https://dpastov.blogspot.com/2017/01/play-project-production-application-secret.html</link><author>noreply@blogger.com (Dmytro)</author><thr:total>1</thr:total></item><item><guid isPermaLink="false">tag:blogger.com,1999:blog-34728599.post-5478261138628991011</guid><pubDate>Sun, 25 Dec 2016 18:55:00 +0000</pubDate><atom:updated>2016-12-25T19:58:08.765+01:00</atom:updated><category domain="http://www.blogger.com/atom/ns#">Play Framework</category><title>HTTP Routing in Play Framework</title><description>&lt;p&gt;We are going to check how Play connect http requests with our code. F.x. when user hits http://localhost:9000/ what happens?&lt;/p&gt;&lt;h3&gt;HTTP Routing&lt;/h3&gt;&lt;p&gt;There is already built in http router in Play Framework. It allows to connect incoming requests with &lt;a href=&quot;https://dpastov.blogspot.dk/2016/12/actions-in-play-framework-25.html&quot; title=&quot;Action in Play Framework&quot;&gt;Play Action&lt;/a&gt; and therefore with public method in a controller class.&lt;/p&gt;&lt;h3&gt;Configuring HTTP Routing&lt;/h3&gt;&lt;p&gt;Normally the configuration for HTTP routing is located in conf/routes. See example:&lt;/p&gt;&lt;pre style=&quot;background-color: #eeeeee; border: 1px dashed rgb(153, 153, 153); color: black; font-size: 12px; line-height: 14px; overflow: auto; padding: 5px; width: 97%;&quot;&gt;&lt;span style=&quot;font-family: Verdana, sans-serif;&quot;&gt;# Static path
  1041. GET   /clients/all                  controllers.Clients.list()
  1042. # Dynamic path
  1043. GET   /clients/:id                  controllers.Clients.show(id: Long)
  1044. GET   /files/*name               controllers.Application.download(name)
  1045. # Dynamic parts with regexp
  1046. GET   /items/$id&lt;[0-9]+&gt;    controllers.Items.show(id: Long)
  1047. &lt;/span&gt;&lt;/pre&gt;&lt;p&gt;If there are few routes are matched for the same request then the first one in a configuration file will be used.&lt;/p&gt;</description><link>https://dpastov.blogspot.com/2016/12/http-routing-in-play-framework.html</link><author>noreply@blogger.com (Dmytro)</author><thr:total>0</thr:total></item></channel></rss>
Copyright © 2002-9 Sam Ruby, Mark Pilgrim, Joseph Walton, and Phil Ringnalda