It is currently Tue Jun 27, 2017 5:17 am

News News of Back-end Service Development

Site map of Back-end Service Development » Forum : Back-end Service Development

Back-end Service Development tools and source code for CrossUI.

CrossUI Node.js Backend Demo

xuiService.js :

/**
* Important note: this demo application is for CrossUI created by Alex Pavlov ([email protected])
*/

var http = require('http'),
url = require('url'),
fs = require('fs'),
querystring = require('querystring'),
server,
net = require('net');

var getParams = function(req, callback){
if(req.method=='POST') {
var body = '';
req.on('data', function(chunk){
body += chunk;
})
.on('end', function() {
var obj = querystring.parse( body.replace( /\+/g, ' ' ) ) ;
callback( obj );
});
}
else if(req.method=='GET') {
var ...
Read more : CrossUI Node.js Backend Demo | Views : 4874 | Replies : 0 | Forum : Node.js


CrossUI Java Backend Demo

xuiUtils.java :

package com.crossui;

import java.io.IOException;
import java.io.OutputStream;
import java.util.HashMap;
import java.util.Map;
import java.util.zip.GZIPOutputStream;
import java.util.zip.ZipOutputStream;

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

/**
*
* @author linb
*
*/

public class xuiUtils {
// input keys
public static final String LINB_KEYWORD_CALLBACK = "callback";

// output keys
public static final String LINB_KEYWORD_DATA = "data";
public static final String LINB_KEYWORD_ERROR = "error";

@SuppressWarnings("unchecked")
public static Map<String, Object> getRequestData(HttpServletRequest req)
throws Exception {
// UTF-8
req.setCharacterEncoding("UTF-8");
// request data
Map<String, ...
Read more : CrossUI Java Backend Demo | Views : 4066 | Replies : 0 | Forum : Java


CrossUI C# Backend Demo

xui.cs:

using System;
using System.Web;
using System.Collections;
using System.Collections.Specialized;
using Jayrock;
using Jayrock.Json;
using Jayrock.Json.Conversion;


namespace xuiService
{
public class xuiException : Exception
{
public xuiException()
{
}
public xuiException(string message)
: base(message)
{
}
public xuiException(string message, Exception inner)
: base(message, inner)
{
}
}

public class xui
{
public const string ERR = "error";
public const string DATA = "data";
public const string CALLBACK = "callback";


public static Hashtable getRequestData(HttpContext context)
{
Hashtable ...
Read more : CrossUI C# Backend Demo | Views : 5683 | Replies : 0 | Forum : C#


CrossUI PHP Backend Demo

xuiservice.php:

<?php
// input and output keys
define('XUI_KEYWORD_CALLBACK', "callback");
define('XUI_KEYWORD_DATA', "data");
define('XUI_KEYWORD_ERROR', "error");

// for json
if(!function_exists('json_encode')){
include_once("JSON.php");
function json_encode($var){
return (new JSON).encode($var);
}
function json_decode($str){
return (new JSON).decode($str);
}
}

// handle request data
function xui_getRequestData(){
$callback = XUI_KEYWORD_CALLBACK;
$inputData=new stdClass;

// 1. for "post" request
// 1.1. form post( a=b$c=d )
if(count($_POST)>0){
foreach ($_POST as $k=>$v)
$inputData->$k = get_magic_quotes_gpc()?stripslashes($v):$v;
// 1.2. form post( {a:'b',c:'d'} ) or xmlhttp post
}else{
$request = file_get_contents('php://input');
if($request){ ...
Read more : CrossUI PHP Backend Demo | Views : 5908 | Replies : 0 | Forum : PHP


 

Login  •  Register


Statistics

Total posts 960 • Total topics 321 • Total members 35

cron