Java connector

1)In my web.xml configuration the url mapping is configured as /scheduler/events.do and is mapped to the class Scheduler_BasicConnector.

  • Do I understand it correclly, that only the class Scheduler_BasicConnector is called when the url pattern is present in the client browser? If affirmative, how does it get to embedded into the url?

2)On the client side the load event is like this scheduler.load(‘events.do?uid=’+scheduler.uid());

  • Could you explain to what the ¨events.do?uid='+scheduler.uid()¨ refers to?
    I can see that it links to the web.xml config But is unclear, to me, what it actually does.

  • Can I change this to be a part of the client url which renders the Scheduler? As for each session the url is different in my case, when I render the Scheduler.

In my webserver log I can see the following when I render the Scheduler page:
0:0:0:0:0:0:0:1 - - [09/Feb/2015:00:19:36 -0400] “GET /test-webclient/events.do?uid=1423455576628&timeshift=240 HTTP/1.1” 404 949
It displays an 404 error on the page.

However, the ouput in my webserver´s log when I directly type the url pattern /scheduler/events.do
in the client browser.
[09/Feb/2015:16:33:05 -0400] “GET /scheduler/events.do HTTP/1.1” 200 -
Seems that something is happening.

Thanks in advance for your reply!

Client side code will call a url and will expect to receive the json or xml data in response.

The url naming is used only to call some servlet ( single class, you are right ) and receive its response.

“?uid=’+scheduler.uid()” this part of url is added to make url unique for each call and prevent data caching.

Can I change this to be a part of the client url which renders the Scheduler? As for each session the url is different in my case, when I render the Scheduler.

The url must trigger the servlet class. This is the only requirement. So you an change url pattern as necessary

In my webserver log I can see the following when I render the Scheduler page: 0:0:0:0:0:0:0:1 - - [09/Feb/2015:00:19:36 -0400] "GET /test-webclient/events.do?uid=1423455576628&timeshift=240 HTTP/1.1" 404 949

Please check servlet mapping rules. It seems they are configured in too strict way and because of extra parameters in url ( uid, timeshift ) Scheduler servlet is not triggered.

Hi,

I get some error messages, the first two are displayed on loading the Scheduler and last one is displayed on saving an event. Any idea to what this could be related? Thx.




The first error message was only shown once, it does not appear anymore. However, messages two and three are persistent, could this be related to a DB connection problem?

Can you share a Java code of servlet ?

First error can be caused by wrong DB connection object ( first parameter of connector class )

Second error is related to the parsing of data which comes from client side. It may be caused by the wrong configuration of the scheduler or some kind of client side conflict.

My servlet code is

import java.sql.Connection;
import java.sql.DriverManager;
import com.dhtmlx.connector.*;
 

 
 
/**
 * The Class BasicConnector.
 */

public class Scheduler_BasicConnector extends ConnectorServlet {
	static final long serialVersionUID = 1L;
	@Override
    protected void configure() {

	                //obtain DB connection
	        Connection conn=null;
	        try {
	            Class.forName ("org.postgresql.Driver").newInstance ();
	            conn = DriverManager.getConnection("jdbc:postgresql://127.0.0.1:5432/sample_data", "DBA", "test");
	        } catch (Throwable e) {
	            e.printStackTrace();
	    }
	 
	                //Initializes connector
	        SchedulerConnector c = new SchedulerConnector(conn,DBType.PostgreSQL);
	                //configures the used table and fields
	        c.render_table("events","event_id","BeginDate","enddate","eventDescription");


        c.enable_log("dhtmlxlog.txt", true);
        

}
}

and the client code is

[code]

var js =“scheduler.init(‘scheduler_here’,null,‘month’);”
plugins.WebClientUtils.executeClientSideJS(js)
var js00 = "scheduler.load(’/scheduler/events.do?uid=’+scheduler.uid()); var dp=new dataProcessor(’/scheduler/events.do’); dp.init(scheduler); "
plugins.WebClientUtils.executeClientSideJS(js00)[/code]

Change code of render_table command in java code like next

c.render_table("events","event_id","BeginDate,enddate,eventDescription");

Also, if issue still occurs then try to enable logging

docs.dhtmlx.com/connector__java__errors.html