-
 KDE-Apps.org Applications for the KDE-Desktop 
 GTK-Apps.org Applications using the GTK Toolkit 
 GnomeFiles.org Applications for GNOME 
 MeeGo-Central.org Applications for MeeGo 
 CLI-Apps.org Command Line Applications 
 Qt-Apps.org Free Qt Applications 
 Qt-Prop.org Proprietary Qt Applications 
 Maemo-Apps.org Applications for the Maemo Plattform 
 Java-Apps.org Free Java Applications 
 eyeOS-Apps.org Free eyeOS Applications 
 Wine-Apps.org Wine Applications 
 Server-Apps.org Server Applications 
 apps.ownCloud.com ownCloud Applications 
--
-
 KDE-Look.org Artwork for the KDE-Desktop 
 GNOME-Look.org Artwork for the GNOME-Desktop 
 Xfce-Look.org Artwork for the Xfce-Desktop 
 Box-Look.org Artwork for your Windowmanager 
 E17-Stuff.org Artwork for Enlightenment 
 Beryl-Themes.org Artwork for the Beryl Windowmanager 
 Compiz-Themes.org Artwork for the Compiz Windowmanager 
 EDE-Look.org Themes for your EDE Desktop 
--
-
 Debian-Art.org Stuff for Debian 
 Gentoo-Art.org Artwork for Gentoo Linux 
 SUSE-Art.org Artwork for openSUSE 
 Ubuntu-Art.org Artwork for Ubuntu 
 Kubuntu-Art.org Artwork for Kubuntu 
 LinuxMint-Art.org Artwork for Linux Mint 
 Arch-Stuff.org Art And Stuff for Arch Linux 
 Frugalware-Art.org Themes for Frugalware 
 Fedora-Art.org Artwork for Fedora Linux 
 Mandriva-Art.org Artwork for Mandriva Linux 
--
-
 KDE-Files.org Files for KDE Applications 
 OpenTemplate.org Documents for OpenOffice.org
 GIMPStuff.org Files for GIMP
 InkscapeStuff.org Files for Inkscape
 ScribusStuff.org Files for Scribus
 BlenderStuff.org Textures and Objects for Blender
 VLC-Addons.org Themes and Extensions for VLC
--
-
 KDE-Help.org Support for your KDE Desktop 
 GNOME-Help.org Support for your GNOME Desktop 
 Xfce-Help.org Support for your Xfce Desktop 
--
openDesktop.orgopenDesktop.org:   Applications   Artwork   Linux Distributions   Documents    LinuxDaily.com    Linux42.org    OpenSkillz.com   
 
Home
Apps
Artwork
News
Groups
Knowledge
Events
Forum
People
Jobs
Register
Login


-
- Content .- Fans (1) .- Knowledge Base  . 

QtWebApp (lib)

   1.2.7  

Qt Web Application

Score 50%
Downloads:  155
Submitted:  Jul 23 2012
Updated:  Jul 23 2012

Description:

QtWebApp contains a HTTP web server library and an example program. With the libraries in this package, you can write your own web servers easily. The API is similar to Java servlets.

a basic servlet:
Quote:
void MyController::service(HttpRequest& request, HttpResponse& response) {

// Get some request parameters
QByteArray path=request.getPath();
QByteArray username=request.getParameter("username");

// set some headers
response.setHeader("Content-Type", "text/html; charset=ISO-8859-1");
response.setCookie(HttpCookie("myCookie","hello",600));

// generate response
response.write("*html**body*");
response.write("Hello ");
response.write(username);
response.write("*body**html*");
}
(replace the * by angle brackets)

main program:
Quote:
int main(int argc, char *argv[]) {

QCoreApplication* app=new QCoreApplication(argc,argv);
QSettings* settings=new QSettings("etc/configfile.ini",QSettings::IniFormat,app);
MyController* controller=new MyController(app);
HttpListener* listener=new HttpListener(settings,controller,app);

return app->exec();
}

configfile.ini:
Quote:
port=8080
minThreads=1
maxThreads=10
cleanupInterval=1000
readTimeout=60000
maxRequestSize=16000
maxMultiPartSize=1000000

The HTTP server processes incoming requests in multiple threads, that are managed in a dynamic pool. It supports persistent connections, sessions, and file-uploads. The example above answers all requests in a single controller. However real applications would branch to more specific classes depending on the requested path, as the demo application does.

A simple multi-language capable template engine is included, that fills placeholders in HTML files with dynamic values at runtime. The template engine also supports conditional output and loops. Other larger template engines, such as ClearSilver, may be used as an alternative.

The logger plugs into QT and redirects log messages from qDebug(...) to qFatal(...) to files, while they are enriched with additional attributes like timestamp, thread ID, session ID and some more. The logger can filter by log-level as usual, but it can also keep unwritten messages in a memory buffer per thread which is written when an error occurs. Thus the logfiles are kept small and clean during normal operation but contain much more detailled informations about what happened before errors. Changes to the settings file become active automatically without program restart.

The included QtService library from Nokia allows you to start the application as a Linux Daemon or Windows Service.




LicenseLGPL
(Project Website)
Send to a friend
Subscribe
Other  Content  from sfrings
Report inappropriate content



Add commentBack




-
openDesktop.org Facebook App




 
 
 Who we are
Contact
More about us
Frequently Asked Questions
Register
Twitter
Blog
Explore
Apps
Artwork
Jobs
Knowledge
Events
People
Updates on identi.ca
Updates on Twitter
Facebook App
Content RSS   
Events RSS   

Participate
Groups
Forum
Add Content
Public API
About openDesktop.org
Legal Notice
Spreadshirt Shop
CafePress Shop
Advertising
Sponsor us
Report Abuse
 

Copyright 2007-2013 openDesktop.org Team  
All rights reserved. openDesktop.org is not liable for any content or goods on this site.
All contributors are responsible for the lawfulness of their uploads.
openDesktop is a trademark of the openDesktop.org Team