203 Lotus blogs updated hourly. Who will post next? Home | Blogs | Search | About 
 
Latest 7 Posts
HCL and IBM Partner on Domino 10
Wed, Oct 25th 2017 11
Importing CSV via Java to a Notes Database
Fri, Aug 11th 2017 2
HTML5 Canvas to PNG via RPC
Tue, Jun 21st 2016 8
Eternal fustrations with IBM "Help" - - this time trying to give them money
Mon, May 23rd 2016 2
Simple Example: Bootstrap
Tue, May 3rd 2016 2
Import CSVs into a Notes/XPage database
Thu, Mar 24th 2016 3
REST via Service Bean
Tue, Feb 16th 2016 3
Top 10
HCL and IBM Partner on Domino 10
Wed, Oct 25th 2017 11
dataTable with Categories
Tue, Jul 14th 2015 9
HTML5 Canvas to PNG via RPC
Tue, Jun 21st 2016 8
ComboBox - Validate so default value is not selected
Wed, Jul 1st 2015 7
Bootstrap Progress Bars - sample database
Wed, Aug 12th 2015 6
Reversing the display order of a Multi-value field (XPages)
Wed, Jan 13th 2016 6
REST via Service Bean
Tue, Feb 16th 2016 3
Import CSVs into a Notes/XPage database
Thu, Mar 24th 2016 3
StartKeys for categorized viewPanel and number column
Sat, Jul 4th 2015 2
New blog
Wed, Jun 3rd 2015 2


REST via Service Bean
Twitter Google+ Facebook LinkedIn Addthis Email Gmail Flipboard Reddit Tumblr WhatsApp StumbleUpon Yammer Evernote Delicious
   


This is based on Custom REST service in Xpages using a service bean by Stephan Wissel. But it doesn't show actually getting prints from the method sent. My work partner Brian Hester  and I both tried at the same time and ended up getting it at the same time – we actually started IM-ing each other that we had it. And this is the day before Bernd Hort posted his presentation.

So to intercept the REST methods, so you can get prints like this:

02/11/2016 09:06:26 AM HTTP JVM: renderService
02/11/2016 09:06:26 AM HTTP JVM: rType: GET
02/11/2016 09:06:40 AM HTTP JVM: renderService
02/11/2016 09:06:40 AM HTTP JVM: rType: POST

Once you get the method, you can have the bean do whatever you would like. It's nice to have it all in one place.

Here is the bean:
package com.companyname;

import java.io.IOException;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import com.ibm.domino.services.ServiceException;
import com.ibm.domino.services.rest.RestServiceEngine;
import com.ibm.xsp.extlib.component.rest.CustomService;
import com.ibm.xsp.extlib.component.rest.CustomServiceBean;

publicclassDynamicViewService extendsCustomServiceBean {

publicvoidDynamicViewService(){

System.out.println("init...");

}

@Override
publicvoidrenderService(CustomService service, RestServiceEngine engine) throwsServiceException {
System.out.println("renderService");
HttpServletRequest request = engine.getHttpRequest();
HttpServletResponse response = engine.getHttpResponse();

response.setHeader("Content-Type", "application/json; charset=UTF-8");

// Here goes your code, get the response writer or stream
String rType = request.getMethod();
System.out.println("rType: "+ rType);
try{
response.getWriter().write("<html><body>"+ rType + "</body></html>");
response.getWriter().close();
return;
} catch(IOException e) {
// TODOAuto-generated catch block
System.out.println(e.toString());
return;
}
}

}


And here is the full Xpage:

<?xmlversion="1.0"encoding="UTF-8"?>
<xp:viewxmlns:xp="http://www.ibm.com/xsp/core"
xmlns:xe="http://www.ibm.com/xsp/coreex">
<xe:restServiceid="JSONSearch"pathInfo="json"state="false">
<xe:this.service>
<xe:customRestService
contentType="application/json"
serviceBean="com.randstadusa.DynamicViewService">
</xe:customRestService>
</xe:this.service>
</xe:restService>
<xp:br></xp:br>
<xp:br></xp:br>
</xp:view>


---------------------
http://dominoherald.blogspot.com/2016/02/rest-via-service-bean.html
Feb 16, 2016
4 hits



Recent Blog Posts
11
HCL and IBM Partner on Domino 10
Wed, Oct 25th 2017 10:27p   Brian M. Moore
I was excited to see the announcement about HCL and IBM working on Domino 10 in 2018. The thing I want most out of this is a focus on Sales, even more than I want most of the changes that could come from new elements to work with. Domino has a very mature NoSQL datastore that has a lot of built-in functionality. I think if an emphasis was put on that and whatever sales teams exist pushed the product there would be an upturn in the user base. If they would make it worth the financial while of sa
2
Importing CSV via Java to a Notes Database
Fri, Aug 11th 2017 8:35p   Brian M. Moore
It's been longer than I intended since my last post, but here it is. One of the things I've posted has been importing to a Notes database. My first was using LotusScript to import from an Excel file, I've moved to using CSV which does not require an external program. This one uses a Java bean and HashMap to map the field names. As with the others, this takes two files. First is a simple where the you have the data. The column titles will match up with the same row in a title spreadsheet. Th




Created and Maintained by Yancy Lent - About - Planet Lotus Blog - Advertising - Mobile Edition