views:

1088

answers:

6

What could be the best way of developing a C++ web application? The web app would be run on Apache HTTP server. How can you overcome challenges like sessions, persistence, context switching, multithreading etc with C++? How could one utilize C++ in best possible way to make it work like Servlets?

+3  A: 

I'm saying this as a C++ developer...

I would probably consider using Java instead. Since Java is much more commonly used for this, you'll find way more existing libraries to leverage. If you ever want to hire more people, you'll have an easier time finding web-app Java developers than web-app C++ developers.

If you insist using C++, check out:

http://rudeserver.com/

nsanders
+4  A: 

Use C++ web framework like CppCMS if you like web-like development, it is oriented for high performance and works with .

It provides:

  • FastCGI, SCGI and CGI interfaces.
  • Form processing and validation
  • HTML Templates system
  • Session management
  • Cache system
  • Transparent scale up to numerous servers.

You may give a try to Wt but it is much more like writing GUI using browser rather then traditional web development tool.

Artyom
+6  A: 

Take a look at Wt.

Wt (pronounced 'witty') is a C++ library and application server for developing and deploying web applications. It is not a 'framework', which enforces a way of programming, but a library.

The API is widget-centric, and inspired by existing C++ Graphical User Interface (GUI) APIs. To the developer, it offers complete abstraction of any web-specific implementation details, including event handling and graphics support.

It's not free for commercial use though.

the_drow
+1  A: 

You can use Qt framework, Boost & Poco libraries to do web development in C++. Qt & Poco have DB support for various RDBMS. You may look into Axis C++ if you need to develop web services in C++. ClearSilver has C library to handle CGI and you can use C++ on top of it. Plenty of choices for you!

Viet
I'd like to add-on to the_drow's answer.Wt is licensed under GPL v2 so you can use it for commercial purposes without redistributing source code if:1. You don't ship binaries to users2. Users use as a web application and don't install or download any binaries derived from Wt C++You only need to redistribute your source code in all cases when Wt C++ is licensed under GPL Affero 3.
Viet
@Viet: What if it's an embedded application?The GUI is a web interface.Should I buy a commercial license or not?
the_drow
As long as you don't ship binaries and users don't need binaries to run, you don't have to buy any license. If you sell embedded appliances with the binaries, obviously you need.
Viet
A: 

How can you overcome challenges like sessions, persistence, context switching, multithreading etc with C++?

The answer is what you'd expect it to be: pick libraries that handle issues when possible (multithreading) and implement libraries where necessary (generating a session key and storing it somewhere like a database).

Max Lybbert
A: 

Take a look at the Snorkel Embedded Web Server SDK. Its easy to use and produces the fastest web application solutions. http://sites.google.com/site/snorkelembedded

Walt C.