openntf / socialsdk Goto Github PK
View Code? Open in Web Editor NEWIBM Social Business Toolkit SDK
Home Page: https://developer.ibm.com/social
IBM Social Business Toolkit SDK
Home Page: https://developer.ibm.com/social
Welcome to the IBM Social Business Toolkit SDK! The Social Business Toolkit SDK is a set of libraries and code samples that you use for connecting to the IBM Social Platform. It covers many products like IBM Connections, IBM Notes/Domino, IBM Sametime. It includes support for many authentication mechanisms, as well as comprehensive wrappers for the REST APIs. The SDK can be run on Java-based application servers such WebSphere Application Server, WebSphere Portal, IBM Domino, and Apache Tomcat. A built version is distributed on OpenNTF at http://ibmsbt.openntf.org and on the releases tab https://github.com/OpenNTF/SocialSDK/releases OPENNTF This project is an OpenNTF project, and is available under the Apache License V2.0. All other aspects of the project, including contributions, defect reports, discussions, feature requests and reviews are subject to the OpenNTF Terms of Use - available at http://openntf.org/Internal/home.nsf/dx/Terms_of_Use.
The Community ID is missing from the Activity Member object
For example, the response from http://<CONNECTIONS_URL>/activities/service/atom2/forms/acl?activityUuid=<ACTIVITY_UUID> (where ACTIVITY_UUID> is substituted for the id of the Activity) contains 3 IDs; MemberId, UserId & CommunityUUID.
Compared to the SBT Member object which only contains 2; MemberId & UserId.
The forceTrustSSLCertificate is not implemented in all places.
I get a "javax.net.ssl.SSLPeerUnverifiedException: peer not authenticated" exception at the internal method "protected AccessToken _renewToken(AccessToken token)".
This code is missing there
if(forceTrustSSLCertificate)
client = (DefaultHttpClient)SSLUtil.wrapHttpClient((DefaultHttpClient)client);
If I create a community with a tag like mountain climbing, it gets posted as one tag and even on native ui shows up as one tag.
However while reading community object in SDK, 2 different tags are returned mountain and climbing.
Per Yasser:
The SDK doesn't have an equivalent method to get forums for a given community id. The method exists in the javascript snippet and REST API.
Is this something that will be included in the new sdk or any plan to include it?
ie: javascript has:
communityService.getForums();
Hi ,
SBT is about connections, and connection's support sametime so vcard should have X-Sametime-resolve as class attribute else sametime awareness does not work.
Content of ProfileVCard.html and Inline version content should be
${userName}
${userId}
Dilip
Hi,
I tried use this sample: https://greenhouse.lotus.com/sbt/SBTPlayground.nsf/JavaScriptSnippets.xsp#snippet=Social_Blogs_Read_Blog
it returns no tags for as you can see:
always it returns empty array.
Please could you check it?
Thanks
When running controls in the script portlet,in particular the views, there are css issues. When you click one of the view actions for example in the files view, upload file. the diaplog box has no css. There are some minor styling issues with some of the grid controls also.
Hi,
When I use the method createActivityStreamEntryObject in ActivityStreamEntry Class.
The Attachment is not detected in the response.
The problem come from fetchAttachment :
// BEFORE : DataNavigator SUAttachments = object.get("attachments");
Solution -> DataNavigator SUAttachments = object.get(0).get("attachments");
Moreover, the flag isContainAttachment is not setting automatically.
You need to add in createActivityStreamEntryObject
Attachment attachment = fetchAttachment(object); // fetch attachments
entryObj.setAttachment(attachment);
if (attachment.getId() !=null) {
entryObj.setContainAttachment(true);
}
Regards,
The maven build in the latest release fails using the included build.cmd.
The prior release works fine.
I rely on the latest release tag to deploy the toolkit with the build.cmd.
Would it be possible to test this bevor publishing a new release?
Thank you.
Create a more generic method for createCommunity
Line 605
public String createCommunity(Community community) throws CommunityServiceException {
if (null == community){
throw new CommunityServiceException(null, Messages.NullCommunityObjectException);
}
try {
Object communityPayload;
try {
communityPayload = community.constructCreateRequestBody();
} catch (TransformerException e) {
throw new CommunityServiceException(e, Messages.CreateCommunityPayloadException);
}
String communityPostUrl = resolveCommunityUrl(CommunityEntity.COMMUNITIES.getCommunityEntityType(),CommunityType.MY.getCommunityType());
Response requestData = createData(communityPostUrl, null, communityPayload,ClientService.FORMAT_CONNECTIONS_OUTPUT);
community.clearFieldsMap();
return extractCommunityIdFromHeaders(requestData);
} catch (ClientServicesException e) {
throw new CommunityServiceException(e, Messages.CreateCommunityException);
} catch (IOException e) {
throw new CommunityServiceException(e, Messages.CreateCommunityException);
}
}
Modify the communityPostUrl as a parameter...
You'll want to change your communityPostUrl to match...
https://greenhouse.lotus.com/communities/service/atom/community/subcommunities?communityUuid=2fba29fd-adfa-4d28-98cc-05cab12a7c43
and also a more generic createCommunity without parent
and where the Uuid here is the parent uuid.
In the AuthType class, there is a dotless-i problem in get() method.
public String get(){
return name().toLowerCase();
}
It converts "BASIC" to "basıc" in servers with Turkish locale. toLowerCase(Locale.US) should be used instead.
SmartCloud uses UTC times, for example when retrieving activity todo's:
<updated>2014-06-05T07:20:07Z</updated>
getAsDate
creates a new SimpleDateFormat
and then parses the date. There is no timezone set, so SimpleDateFormat
uses the default timezone. In my case the UTC date gets parsed as CEST.
Could this be fixed so that it uses UTC as timezone on the SimpleDateFormat: format.setTimeZone(TimeZone.getTimeZone("UTC"));
Then the parsed Date.getTime
returns the milliseconds since January 1, 1970, 00:00:00 UTC (epoch).
Maybe other datahandlers like the JsonDataHandler
have the same issue, but I haven't looked into that.
public List getTags() {
return (List) Arrays.asList(getDataHandler().getAsString(CommunityXPath.tags).split(" "));
}
I don't recommend this approach. It should be getEntries or getArray
The same thing should be done in the JavaScript API.
In order to properly consume and cache some REST services results in a server side Java framework, then the classes ("entities") have to be serializable (by implementing Serializable)
The SBT does have a method to get the tags on a file (File.getTags()), which is what we have been using; however it doesn't work. We now know why - it's because the REST call that they make to get the file metadata doesn't include this "includeTags" parameter, so the Atom that they are parsing and trying to extract the tags from doesn't include the tags content.
I first posted this on SO to verify this is actually a bug: http://stackoverflow.com/questions/23674389/how-to-get-and-set-contents-on-a-wikipage
For short:
WikiPage getContent() throws a ClassCastException.
WikiPage setContent() doesn't seem to do anything at all.
Unable to create any VCard using declarative syntax as follows.
<span dojoType="sbt.connections.controls.vcard.ProfileVCard" userName="Frank Adams" userId="12345" id="foo" />
Below html which included just the library servlet does not work in IE and gives error
Expected identifier, string or number dojo.js, line 15 character 13023
<script type="text/javascript" src="/sbt.dojo180/dojo/dojo.js"></script> <script type="text/javascript" src="/searchApplication/library?lib=dojo&ver=1.8"></script> hello thjereTrying to use XPages Social Enabler app in XPiNC, in preparation for using SBT in a customer project.
However, when I click the login button to log into Connections, I'm getting the following error: "Error 404: ProxyServlet: /XPagesSBT.nsf/_BasicLogin.xsp"
The logins use the method endpoint.authenticate(true), for example on BasicAuthenticationPanel Custom Control, used to handle all authentications to e.g. Connections, Sametime etc. I've tracked this through in the source code to com.ibm.commons.runtime.util.UrlUtil.makeUrlAbsolute(). This uses request.getServerName() and request.getServerPort().
If using an XPages app that's local or on my local server, I'm finding getServerName() is return "127.0.0.1" and getServerPort() is returning "55325". So the URL it's trying to go to is "http://127.0.0.1:55325/XPagesSBT/_BasicLogin.xsp", which is failing.
For XPiNC it needs to omit the server port. "http://127.0.0.1/XPagesSBT/_BasicLogin.xsp" works for me.
However, I'm not sure how you can check for XPiNC and code accordingly, without then having dependencies on XPages packages, which would break other implementations on SBT.
form based authentication on SmartCloud fails when having a redirection to a federated authentication page
The datasources go through XMLArrayBlockAccessor's XmlBlock.readExternal
This sets this.doc = XmlSerializer.readDOMObject(in)
XmlSerializer.readDOMObject() does not appear to be fully implemented yet. It just throws an UnsupportedOperationException "Only available from domino/xpages deployments", even though I'm in an XPages app.
So the XPages demo app's demos of IBM Connections > Activities and Communities don't work.
The code still seems to be the same in the other branch of the project.
The UID of the Actor of an ActivityStreamEntry contains to many characters
I get this if I get the entry list with "getActivityStream('@me', '@ALL', '@ALL', header);"
urn:lsid:lconn.ibm.com:profiles.person:835089c0-1a1d-1032-8b39-c90c9bc07561&lang=de_de
Correct should be
835089c0-1a1d-1032-8b39-c90c9bc07561
We are recently facing issues using tagging and wall post services listed below.
tagging service: https:///profiles/atom/profileTags.do
wall post service:https:///common/opensocial/rest/ublog/(userid)/@ALL
We use SBT library to call them ,here is the error thrown by client classes.
SLF4J: See http://www.slf4j.org/codes.html#multiple_bindings for an explanation.
[5/28/14 14:25:34:568 IST] 00000226 SystemErr R 2396462370 [WebContainer : 8] INFO org.apache.bval.jsr303.ConfigurationImpl - ignoreXmlConfiguration == true
[5/28/14 14:25:49:452 IST] 00000226 SystemErr R com.ibm.sbt.services.client.ClientServicesException: Request to url https:///profiles/atom/profileTags.do?sourceKey=ab16c549-1d93-4156-a350-02c191323c51&targetKey=075029a8-c108-4356-a62e-ff6c27507886&extensionAware=true returned an error response 403:Forbidden org.apache.http.message.BasicHttpResponse@77c55fd1
[5/28/14 14:25:49:452 IST] 00000226 SystemErr R at com.ibm.sbt.services.client.ClientService.throwClientServicesException(ClientService.java:1350)
Kindly help to resolve the issue or give potential reasons of the failures. Let me know if you need more details regarding the issue.
These jars we used:
com.ibm.sbt.core-1.0.0.20140125-1133.jar
com.ibm.sbt.samples.commons-1.0.0.20140125-1133.jar
Connections instance version:
connections instance versions to be 4.6
Hello,
i am trying to get the SDK working with Twitter.
Everything went fine, until i am trying to authorize the app on Twitter. I get the “authorize app” screen, i provide the allowence, the Twitter site redirects to the XPagesSBT.nsf.
Using the latest version of the social enabler XPages Social Enabler Version: 901_201311181140 and the provided site.xml update site.
Here again, the website loads the Twitter Authorize screen and so on. This issue can be handled hours and hours. Every time when the Twitter Authorize screen redirects to/XPagesSBT.nsf/ i can see in the error in the console log:
[2074:000A-2100] 13.01.2014 13:50:14 HTTP JVM: CLFAD0211E: Exception thrown. F
or more detailed information, please consult error-log-0.xml located in D:/Lotus
DominoData/domino/workspace/logs
[2074:000A-2100] 13.01.2014 13:50:14 HTTP JVM: CLFAD0246E: Exception occurred
servicing request for:/development/XPagesSBT.nsf/Twitter.xsp - HTTP Code: 500.
For more detailed information, please consult error-log-0.xml located in D:/Lotu
sDominoData/domino/workspace/logs
I tried several version, all have the same issue.
Issue is also reproduceable for domino 8.5.3
I have a servlet that creates an instance of the Smartcloud ProfileService. When I create the first instance and it determines that authentication is required, the code properly triggers the authentication redirects to the browser, but it does not interrupt the flow of execution within the original thread and provides no feedback that the authentication flow has been triggered. There needs to be some kind of feedback to notify the currently executing code that it should exit and wait for authentication to complete.
I currently work around this by immediately checking the authentication state of the Endpoint.. e.g.
if (service == null)
service = new ProfileService("smartcloud");
boolean authed = service.getEndpoint().isAuthenticated();
if (!authed) service.getProfile(); // force authentication
return authed;
Line four is to force the authentication step to occur prior to exiting out of the thread of execution.
This should be made more explicit... perhaps by throwing a catchable exception if authentication is required and has not yet been established... or providing a more easily accessible method to check for authentication state on the ProfileService object. e.g.
if (service == null)
service = new ProfileService("smartcloud");
if (service.authenticated()) {
// do stuff
}
Calling service.authenticated in the above example would trigger the authentication flow if necessary, then return false if that flow has not yet been successfully completed.. or return true immediately if authentication credentials are established.
I have a JSON which looks like this:
...
"case_number": 127,
...
As you can see, this is an integer. However when I use JsonDataHandler.getAsInt("case_number"), the result will be 0. When examining the method, that's no surprise:
@Override
public int getAsInt(FieldEntry field) {
return Integer.parseInt(getAsString(field));
// return data.getAsInt((String)field.getPath());
}
/**
* @param fieldName
* @return value as int
*/
@Override
public int getAsInt(String fieldName) {
try {
return Integer.parseInt(getAsString(fieldName));
} catch (NumberFormatException e) {
return 0;
}
}
Why is getAsString used here and not getAsInt? It's even commented out in the first method.
Maybe this even reveals a deeper issue. The getAsString method calls JsonJavaObject.getString, which apparently returns my int as 127.0
Is it supposed to do that?
Currently if I use basic auth , there is no way I can find out who has logged in i.e his email or userid whatever was used to login to connection. there should be a provision to get that
Dilip ( [email protected] )
Hi,
The comment is empty when I use the method createActivityStreamEntryObject in the Class ActivityStreamEntry. that's call fetchComments()
When I see the 'DataNavigator' in ' fetchComments', I think the problem come from :
// Before : object.get("replies").get("items");
-> solution : DataNavigator replies = object.get(0);
and to
// Before : String comment = reply.stringValue("content");
-> solution : String comment = reply.stringValue("summary");
Regards,
Even though a db2 database has been created using the supplied script, a datasource set up and the necessary configuration changes made in managed-beans.xml, credentials never get saved to the database so the oauth authorization must happen for each new browser session.
Unless I missed it, the Smartcloud ProfileService Profile object does not provide access to the subscriber's "Org ID" (customerid)... it only provides access to the user's id (subscriberid). The org id is required too. It needs to be made available as a property of the profile.
Also, fwiw, calling profile.get("orgId") results in a Class Cast Error going from a Double to a String.
I want to convert a project from an Abdera implementation to the SocialSDK.
But I discoverd a real performance issue. The program based on the SocialSDK needs more than 9-10 times as the original Abdera code.
Using the SocialSDK it takes more than 50 seconds to get 104 communities. The abdera code needs 5-6 seconds.
Both are using the same Connections API:
"communities/service/atom/communities/my"
SocialSDK snippet:
CommunityService communityService = app.getCommunityService();
HashMap<String, String> parameters = new HashMap<String, String>();
parameters.put("ps", "20");
parameters.put("page", page.toString());
do {
communities = communityService.getMyCommunities(parameters);
System.out.println(communities.getTotalResults());
for (Community community : communities) {
System.out.println(community.getTitle() + " " + community.getCommunityUuid());
}
page++;
parameters.put("page", page.toString());
} while (communities.size() == 20);
Because of the Dojo and Jquery dependency, it is currently not possible to load the library javascript within a javascript Web Worker... Errors are thrown within Dojo and Jquery.
It is possible to workaround using a non-default dojo configuration and a bit of hacking but that's not optimum.
The method to rename the community:
(y.getTitle().equalsIgnoreCase("TestPrincipale"))
{
y.setTitle("EJB" + tempEsprinetOrganization);
y.save();
...
break the mechanism of hereditary father-son community, breaking all communities. We need a save method that correctly perpetual inheritance of the community to solve this issue.
The production environment of the customer (Esprinet) is waiting for this fix and there are a lot of pressure from the business.
Thank's
Michela
content.close();
in the finally block must be more safe
Currently
} finally {
content.close();
}
Needed
} finally {
if(content != null)
content.close();
}
Motivation: I got a NullPointerException instead of the real SSLPeerUnverifiedException
getMyCommunities (java) fails with a null pointer exception when using the SSOEndpoint
java.lang.NullPointerException
at com.ibm.sbt.services.client.base.BaseService.retrieveData(BaseService.java:351)
at com.ibm.sbt.services.client.base.BaseService.retrieveData(BaseService.java:372)
at com.ibm.sbt.services.client.base.BaseService.retrieveData(BaseService.java:325)
at com.ibm.sbt.services.client.base.BaseService.getEntities(BaseService.java:185)
at com.ibm.sbt.services.client.connections.communities.CommunityService.getMyCommunities(CommunityService.java:259)
at com.ibm.sbt.services.client.connections.communities.CommunityService.getMyCommunities(CommunityService.java:243)
at com.ibm.colpal.filepublisher.FilePublisher.doGet(FilePublisher.java:52)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:575)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:668)
at com.ibm.ws.cache.servlet.ServletWrapper.serviceProxied(ServletWrapper.java:307)
at com.ibm.ws.cache.servlet.CacheHook.handleFragment(CacheHook.java:562)
at com.ibm.ws.cache.servlet.CacheHook.handleServlet(CacheHook.java:255)
at com.ibm.ws.cache.servlet.ServletWrapper.service(ServletWrapper.java:259)
at com.ibm.ws.webcontainer.servlet.ServletWrapper.service(ServletWrapper.java:1224)
at com.ibm.ws.webcontainer.servlet.ServletWrapper.handleRequest(ServletWrapper.java:774)
at com.ibm.ws.webcontainer.servlet.ServletWrapper.handleRequest(ServletWrapper.java:456)
at com.ibm.ws.webcontainer.servlet.ServletWrapperImpl.handleRequest(ServletWrapperImpl.java:178)
at com.ibm.ws.webcontainer.filter.WebAppFilterChain.invokeTarget(WebAppFilterChain.java:136)
at com.ibm.ws.webcontainer.filter.WebAppFilterChain.doFilter(WebAppFilterChain.java:97)
at com.ibm.sbt.util.SBTFilter.doFilter(SBTFilter.java:53)
at com.ibm.ws.webcontainer.filter.FilterInstanceWrapper.doFilter(FilterInstanceWrapper.java:195)
at com.ibm.ws.webcontainer.filter.WebAppFilterChain.doFilter(WebAppFilterChain.java:91)
at com.ibm.ws.webcontainer.filter.WebAppFilterManager.doFilter(WebAppFilterManager.java:928)
at com.ibm.ws.webcontainer.filter.WebAppFilterManager.invokeFilters(WebAppFilterManager.java:1025)
...
in this specific case there where multiple cookie token on the request as shown in the firebug detail panel
CommunityXpath is not right. It should not return 4 tags when there are only three (as highlighted below)
Tag1:community
Tag2:test
Tag3:test2
Tag4:test3
The Tags should not return the community tag, when using
String communityUuid = "4aa94a1a-8710-4abf-ac63-b6a0c3d1e930";
Community community = communityService.getCommunity(communityUuid);
/*
* Gets the current details of the Community
*/
out.println(community.getTitle());
out.println("<br/>");
List<String> tags = community.getTags();
int tagCount = 1;
for(String tag : tags){
out.println("Tag" + tagCount++ + ":" + tag);
out.println("<br/>");
}
This means that when I update I should get 4 tags instead of the 3.
Thanks
paul
snx:communityUuid4aa94a1a-8710-4abf-ac63-b6a0c3d1e930/snx:communityUuid
snx:membercount1/snx:membercount
snx:communityTypeprivate/snx:communityType
snx:handle
/snx:handle
snx:preModerationfalse/snx:preModeration
snx:postModerationfalse/snx:postModeration
2013-09-23T20:30:44.743Z
2013-10-22T16:45:19.526Z
<p dir="ltr"> </p>
<name>Paul Bastide</name>
snx:userid20089096/snx:userid
snx:userStateactive/snx:userState
<snx:orgId type="text">20085940/snx:orgId
<name>Paul Bastide</name>
snx:userid20089096/snx:userid
snx:userStateactive/snx:userState
<snx:orgId type="text">20085940/snx:orgId
<snx:communityTheme snx:uuid="">
/snx:communityTheme
snx:communityStartPage
/snx:communityStartPage
snx:isExternaltrue/snx:isExternal
Calls to CommunityService.updateCommunityLogo(file, communityUuid) do not set the given file as new community logo.
Additionally, with default settings a "logout" (LTPA token invalidation?) is forced.
For further details, see:
We looked at the Social Business Toolkit source code, and they seem to always be setting the content type as atom+xml, which is probably the problem, since all of our files are being created through this mechanism:
headers.put("content-type", "application/atom+xml");
Trying to send a POST request to the ActivityStream with the Javascript API on a Chrome browser (version 28.0.1500.72) returns a HTTP 403. However, the same function works when executed on Mozilla Firefox.
Script sample :
function publish(postData){
require([ "sbt/Endpoint", "sbt/dom", "sbt/json", "sbt/config"], function(Endpoint, dom, json, config) {
// ActivityStream URL
var url = "/connections/opensocial/oauth/rest/activitystreams/@me/@all";
// HTTP params
var params = {
method: 'POST',
headers: {
'Content-Type': 'application/json'
},
data: postData
};
// Endpoint
var endpoint = config.findEndpoint("connectionsOA2");
endpoint.request(url, params).then(function(response){
dom.setText('data', 'Success');
console.debug(response);
}, function(error){
dom.setText('data', 'Error');
console.debug(error);
});
});
}
HTTP Request
POST /sbt.sample.web/service/proxy/connectionsOA2/connections/opensocial/oauth/rest/activitystreams/@me/@ALL HTTP/1.1
Host: vmdev:8081
Connection: keep-alive
Content-Length: 255
X-Requested-With: XMLHttpRequest
User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/28.0.1500.72 Safari/537.36
Content-Type: application/json
Accept: /
Accept-Encoding: gzip,deflate,sdch
Accept-Language: en,en-US;q=0.8
Cookie: JSESSIONID=5EB2E4953F6AD1646F1DD81A451DBAF2
HTTP Response
HTTP/1.1 403 Forbidden
Date: Wed, 31 Jul 2013 13:27:25 GMT
Server: IBM_HTTP_Server
X-Powered-By: Servlet/3.0
X-LConn-Auth: true
X-UA-Compatible: IE=EmulateIE7
Expires: Thu, 01 Dec 1994 16:00:00 GMT
Cache-Control: no-cache="set-cookie, set-cookie2"
Keep-Alive: timeout=10, max=100
Connection: Keep-Alive
Content-Language: en-US
Content-Type: text/xml;charset=utf-8
Transfer-Encoding: chunked
after updating SocialSDK to the version 0527, the method to get blogpost from a specific blog has failed, and return all the blogposts
please try it here,
https://greenhouse.lotus.com/sbt/SBTPlayground.nsf/XPagesSnippets.xsp#snippet=Connections_Blogs_Get_Blog_Entries
I consider it as a serious error, please act on it as soon as possible
I cannot find any representation (as a Java class) of Community Widgets as general objects.
There should be added support ("someone should implement...") for Community Widgets management to the IBM SBT SDK for Java, like there is support for other entities like Communities, Forums, Blogs...
Starting from "community.getWidgets()", a general Widget type would be required. Depending on the actual widgetDefId, a collection of entries of that type should be available, like "Forums", "Files" etc.
The operations described at http://www-10.lotus.com/ldd/appdevwiki.nsf/xpDocViewer.xsp?lookupName=IBM+Connections+4.5+API+Documentation#action=openDocument&res_title=Community_widgets_feed_ic45&content=pdcontent should be available in a reasonable way, i. e. things like "community.addWidget(widgetDefId)", "community.getWidget(widgetInstanceId)", "community.getWidgets(widgetDefId, ...)", "community.hideWidget(widgetInstanceId)" etc. should be implemented.
When attempting to load a profile for a specific user id, the ProfileService.load method is instead returning the profile of the authenticated user.
If you look specifically at [1], lines 137 and 140, you'll note that the user id parameter is never set. And the method calls the ProfilesAPIMap.GETPROFILE URL, which is hard coded to "/lotuslive-shindig-server/social/rest/people/@me/@self".
This makes the ProfileService class unusable for retrieving profile details for anyone other than the authenticated user.
The following piece of code for a standalone Java application normally works. In case we provide a wrong password, it will throw an uncatchable NoClassDefFoundError with the stack trace below...
ClientService.processResponse gets an error code (404) from the remote server. In this case, it doesn't fail, instead, tries to redirect user to the login page. However, since it's a standalone application, there is no servlet context. It fails with an uncatchable error and developer has no chance to recover the application in case of a wrong password.
I'm using this for a background application where username/password is pre-configured and such a failure will result in an unstable environment.
In case of a standalone application, redirection would be canceled or better, a way to test authentication within the endpoint would be fantastic!
Thanks.
RuntimeFactory runtimeFactory=null;
Application application=null;
Context context = null;
try {
runtimeFactory=new RuntimeFactoryStandalone();
application=runtimeFactory.initApplication(null);
context = Context.init(application, null, null);
ConnectionsBasicEndpoint endpoint= new ConnectionsBasicEndpoint();
endpoint.setUrl("https://connectionserver.com");
endpoint.setForceTrustSSLCertificate(true);
endpoint.login("someuser", "somepassword"); // password is wrong
System.out.println(endpoint.isAuthenticated());
ProfileService ps=new ProfileService(endpoint);
Profile me=ps.getMyProfile();
System.out.println(me.getName());
} catch(Throwable t) {
t.printStackTrace();
} finally {
if (context != null)
Context.destroy(context);
if (application != null)
Application.destroy(application);
}
Trace:
java.lang.NoClassDefFoundError: javax.servlet.http.HttpServletRequest
at com.ibm.commons.runtime.Context.getHttpRequest(Context.java:115)
at com.ibm.sbt.services.endpoints.BasicEndpoint.authenticate(BasicEndpoint.java:151)
at com.ibm.sbt.services.client.ClientService.forceAuthentication(ClientService.java:296)
at com.ibm.sbt.services.client.ClientService.processResponse(ClientService.java:1154)
at com.ibm.sbt.services.client.ClientService._xhr(ClientService.java:1072)
at com.ibm.sbt.services.client.ClientService.execRequest(ClientService.java:1037)
at com.ibm.sbt.services.client.ClientService.xhr(ClientService.java:997)
at com.ibm.sbt.services.client.ClientService.get(ClientService.java:873)
at com.ibm.sbt.services.client.ClientService.get(ClientService.java:869)
at com.ibm.sbt.services.client.ClientService.get(ClientService.java:859)
at com.ibm.sbt.services.client.ClientService.get(ClientService.java:846)
at com.ibm.sbt.services.client.connections.profiles.ProfileService.getMyUserId(ProfileService.java:805)
at com.ibm.sbt.services.client.connections.profiles.ProfileService.getMyProfile(ProfileService.java:824)
at testing.Test01.main(Test01.java:34)
Viewing community invitations in the Connections UI, there's a "Feed for Invitations" link that gets all invitations for a single community.
It uses a path like /communities/service/atom/community/invites?communityUuid=[communityUuid]
Please add a method to CommunityService and/or Community in the SBT API to retrieve this feed as an InviteList.
I had problems with the re new token methods. I got "An invalid HTTP method was used at the token endpoint". I switched to a post call like "getAccessTokenForAuthorizedUsingPOST()" and it works.
g
A
the example code on
https://greenhouse.lotus.com/sbt/SBTPlayground.nsf/JavaScriptSnippets.xsp#snippet=Social_ActivityStreams_Controls_Simple_Stream_All_Extensions
does not really work, I can see all extensions UI being displayed, but three of four configured extensions(save/commenting/delete) do not work
can see errors on all three of them on developer tools
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.