Security with Headless Client

How does Servoy security work with the Headless Client?

as far as I know exactly the same where applicable. If security is set you log in with a user. The rest is up to you!

I tried that last night but setting Servoy security settings appeared to break the Headless Client. After I removed the require password setting, which I assumed was causing the problem, Servoy would hang when I opened the head (browser) and then closed it. Servoy did not appear to be aware that the browser was closed.

Hmm, there must be something wrong but I can’t imagine it is the security system because this works for me without any issues… Do you have a logging or something like that?

you dit suplly the username/password when intializing the headless client?

Previously posted in the wrong place:

Example of a simple contact management database fit for a PDA browser can be viewed at 149.142.139.141:8080/1.

Headless client is very cool.

John McCann

I have security set on the above example and it does not request that I log in when I go to the URL. Is thier some way to force log in?

John McCann

Are you saying that you have a solution where you checked the require login box.
And that you can access them without username/password specified when creating a headless client?

You should get an can’t login error when initation..

Can we see the code for the simplelistview.jsp file? Other steps required to make it work? He asks excitedly.

Here you go:

<%@ page import = "java.util.*" %>
<%@ page import = "com.servoy.j2db.server.headlessclient.*" %>
<%@ page import = "com.servoy.j2db.dataprocessing.IDataSet" %>
<%@ page errorPage="errorpage.jsp" %>
<%
	ISessionBean servoy_hc = (ISessionBean)session.getAttribute("servoy");
	if (servoy_hc == null)
	{
		servoy_hc = HeadlessClientFactory.createSessionBean(request,"example_headless_client_01");
		session.setAttribute("servoy",servoy_hc);
	}
	boolean ok = servoy_hc.setMainForm("customers");
	if (!ok)
	{
		servoy_hc = HeadlessClientFactory.createSessionBean(request,"example_headless_client_01");
		session.setAttribute("servoy",servoy_hc);
	}
	String custid = request.getParameter("custid");
	String pageid = request.getParameter("pageid");
	if (null==pageid) pageid = "1";
	String filter = request.getParameter("filter");
	String showOrders = request.getParameter("showOrders");
%>
<html>
<head>

<style type="text/css">

</style>

<title>Servoy Headless Client test</title>
</head>
<body onload="javascript:document.searchform.filter.focus()">
  <%
	String theTable = "";
	if(null==custid || null != filter)
	{
		theTable= (String)servoy_hc.executeMethod(null,"getList",new Object[]{pageid,filter});
	}
	else if(null==showOrders)
	{
	    theTable = (String)servoy_hc.executeMethod(null,"getDetails",new Object[]{custid,pageid});
	}
	else
	{
		theTable = (String)servoy_hc.executeMethod(null,"getOrders",new Object[]{custid,pageid});
	}
	out.println(theTable);


%>


<font class="small">Company, Name or City:</font><form action="" method="post" name="searchform"><input name="filter" type="text" class="lg" id="filter" size="20" maxlength="10" onBlur="javascript:if (this.value.length>0) document.searchform.submit()"></form> 

</body>
</html>

Most of the “hard” work is done in the solution itself - it returns the HTML to display from methods that run in the solution.

I’ve put together the simplelistview.jsp sample and solution. You can download from here:

http://developer.servoy.com/downloads/headless_client_examples.zip

Hope this helps.

Great. Thank you very much! :D

Are you saying that you have a solution where you checked the require login box.
And that you can access them without username/password specified when creating a headless client?

You should get an can’t login error when initation..

Johan,

I went back and looked at it more closely. I made the the little headless client application a module. I did not realize one needs to set secuirty in a module seperate from the main application. When I flip the flag for log on required in the module I am no longer allowed to log on to the headless client. This is very cool for playing with but without security I cannot use it for what I need over the WWW. So how, or when will I be able to get the log on screeen using the headless client? Come on. You guys came up with this idea over a week ago. It should be completely polished by now.

John McCann

if youre users must login before opening the solution. Then you have to make youre login dialog yourself. So create a jsp page before making the sessionclient and with the input of the first login page you make the session client with the user/password you got.

jcompagner:
if youre users must login before opening the solution. Then you have to make youre login dialog yourself. So create a jsp page before making the sessionclient and with the input of the first login page you make the session client with the user/password you got.

What is the proper syntax in order to include the username and password when making the session? A sample of what you describe would be really helpful.

All documented here:

http://developer.servoy.com/docs/headle … index.html

take a look at ‘HeadlessClientFactory’…