Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsWhite Papers
Discussion GroupsFirst AidDatabasesJavaBeansGUIJava 3DVirtual MachineCORBASecurityToolsGeneral
Java DirectoryOpen Source ProjectsSample Book ChaptersUser GroupsWeb Resources
Related Topics
Databases.NETMore Topics ...

Java Forum / General / March 2007

Tip: Looking for answers? Try searching our database.

Between C++ and web server

Thread view: 
Carey Carlan - 20 Feb 2007 16:29 GMT
Can the bright minds here point me to the java tools best suited to
interfacing a C++ library with the widest range of web servers?

Fundamental question from a Java newbie.  I'm about to start a web app with
the business logic contained in a C++ DLL (could be a COM object if
necessary).  It must be compiled to protect the intellectual property
within.  My research to date indicates that java is both portable and
powerful enough to manage my library if I can talk to enough servers.

I'll need to host this C++ code on the client's web server, be that Apache,
IIS, or the next new flavor of the month.  I'm hoping for many clients with
many different web servers.

Do web servers have a common, standard java interface?  Do all web servers
except IE share an interface?

Is Java the best interface for this application?

Book and web page references are welcome.
IchBin - 20 Feb 2007 17:50 GMT
> Can the bright minds here point me to the java tools best suited to
> interfacing a C++ library with the widest range of web servers?
[quoted text clipped - 15 lines]
>
> Book and web page references are welcome.
You want to search for JNI, "Java Native Interface".

A simple Google for say "Java JNI Tutorials" would return a lot of
references. Like:

http://java.sun.com/developer/onlineTraining/Programming/JDCBook/jni.html

Signature

Thanks in Advance...           http://weconsultants.prophp.org
IchBin, Pocono Lake, Pa, USA   http://ichbinquotations.awardspace.com
______________________________________________________________________
'If there is one, Knowledge is the "Fountain of Youth"'
-William E. Taylor, Regular Guy (1952-)

Carey Carlan - 20 Feb 2007 18:07 GMT
>> Can the bright minds here point me to the java tools best suited to
>> interfacing a C++ library with the widest range of web servers?
[quoted text clipped - 23 lines]
> http://java.sun.com/developer/onlineTraining/Programming/JDCBook/jni.ht
> ml

Thank you, that is very helpful in connecting the C++ library to java.  
I've marked it and will use that information.  Knowing what to look for
is half the battle.

However, the question is:  Is there a common interface between java and
the web servers of the world?  If I create an HTTP request to a Java
class from my browser via IIS or Apache, is the java side of that call
identical in both cases?  How does the server invoke java?  Are the
parameters identical?

Is there another acronym I can research for the server -> java interface?
IchBin - 20 Feb 2007 20:22 GMT
>>> Can the bright minds here point me to the java tools best suited to
>>> interfacing a C++ library with the widest range of web servers?
[quoted text clipped - 35 lines]
>
> Is there another acronym I can research for the server -> java interface?
JSP and Servlets

Signature

Thanks in Advance...           http://weconsultants.prophp.org
IchBin, Pocono Lake, Pa, USA   http://ichbinquotations.awardspace.com
______________________________________________________________________
'If there is one, Knowledge is the "Fountain of Youth"'
-William E. Taylor, Regular Guy (1952-)

IchBin - 20 Feb 2007 20:30 GMT
>>> Can the bright minds here point me to the java tools best suited to
>>> interfacing a C++ library with the widest range of web servers?
[quoted text clipped - 35 lines]
>
> Is there another acronym I can research for the server -> java interface?

Sorry... Look at JSP, Servlets and maybe Tomcat. Not sure if you already
have a server. A  lot of other people use apache in front of Tomcat
which run JSP and Servlets for security and performance.

A lot of people may watch this newsgroup but it maybe better if you post
to either:

comp.lang.java.help
comp.lang.java.programmer

You may bet more specific responses than mine, sorry.

Signature

Thanks in Advance...           http://weconsultants.prophp.org
IchBin, Pocono Lake, Pa, USA   http://ichbinquotations.awardspace.com
______________________________________________________________________
'If there is one, Knowledge is the "Fountain of Youth"'
-William E. Taylor, Regular Guy (1952-)

Carey Carlan - 20 Feb 2007 23:19 GMT
>> However, the question is:  Is there a common interface between java
>> and the web servers of the world?  If I create an HTTP request to a
[quoted text clipped - 16 lines]
>
> You may bet more specific responses than mine, sorry.

Please don't apologize.  The information you are supplying is what I need.
I'm moving into new turf here.  A few directions go a long way.
Mark Rafn - 20 Feb 2007 21:14 GMT
>Can the bright minds here point me to the java tools best suited to
>interfacing a C++ library with the widest range of web servers?

A whole lot depends on exactly what you're doing.  If you've got a bunch of
C++ code that works, there may be no reason to bring Java into it at all -
just use the code you have.

>Fundamental question from a Java newbie.  I'm about to start a web app with
>the business logic contained in a C++ DLL (could be a COM object if
>necessary).  It must be compiled to protect the intellectual property
>within.

You're aware that this is not actual security, right?  Java's a bit easier to
decompile than C++, but both are possible.

>Do web servers have a common, standard java interface?  Do all web servers
>except IE share an interface?

No.  Every web server has a different interface.  One common way to handle
this is to run the java servlets in Tomcat, and use the Jakarta Connector to
interface that with the frontend webserver (there are a number of different
supported ones).  See http://tomcat.apache.org/connectors-doc/

>Is Java the best interface for this application?

Probably not.  If you're doing all the work in C++, I'd recommend writing the
adaptors to each webserver you want to support in C++.  IMO, obfuscation is a
poor reason to prefer a language, but once you've chosen, dance with who brung
ya.  Supporting pieces in two languages is going to be harder, and you should
only do it if there are strong reasons.  Such reasons exist, but you haven't
mentioned any of them so they may not apply to you.
--
Mark Rafn    dagon@dagon.net    <http://www.dagon.net/>
Carey Carlan - 20 Feb 2007 23:25 GMT
>>Can the bright minds here point me to the java tools best suited to
>>interfacing a C++ library with the widest range of web servers?
>
> A whole lot depends on exactly what you're doing.  If you've got a
> bunch of C++ code that works, there may be no reason to bring Java
> into it at all - just use the code you have.

What I'm doing is porting a desktop application to the web.  Many of our
customers already have websites and working this application into their
existing web server is important.  Others currently run offline and for
those I'll build a simple localhost interface to link their web browser
almost directly to the back end.

>>Fundamental question from a Java newbie.  I'm about to start a web app
>>with the business logic contained in a C++ DLL (could be a COM object
[quoted text clipped - 3 lines]
> You're aware that this is not actual security, right?  Java's a bit
> easier to decompile than C++, but both are possible.

It keeps the honest people out.  More importantly, I'm more familiar with
C and C++ and can write faster using those tools.

>>Do web servers have a common, standard java interface?  Do all web
>>servers except IE share an interface?
[quoted text clipped - 4 lines]
> number of different supported ones).  See
> http://tomcat.apache.org/connectors-doc/ 

That's good information, thank you.

>>Is Java the best interface for this application?
>
[quoted text clipped - 6 lines]
> of them so they may not apply to you. --
> Mark Rafn    dagon@dagon.net    <http://www.dagon.net/>  

I hoped to separate the business logic from the web server interface.  I
was under the impression that web servers "like" java better than generic
compiled libraries.  If the interface is that variant then perhaps I
could just build the various interfaces into my web service.
Lew - 21 Feb 2007 00:58 GMT
> I hoped to separate the business logic from the web server interface.  I
> was under the impression that web servers "like" java better than generic
> compiled libraries.  If the interface is that variant then perhaps I
> could just build the various interfaces into my web service.

Web servers /per se/ do not like Java. Certain application servers such as
Apache Tomcat or JBoss are written specifically to support Java, especially
Java Web technologies like JEE (JSP, servlets, EJB and other acronyms).
Others, like IIS and Apache Web Server, have no built-in mechanisms for
working with Java code.

One can protect Java code behind the server just as readily (or unreadily) as
C++ code.

Consider also portals, that is, web adapters that interact with legacy systems
and make a web interface for them.

- Lew
mlw - 27 Mar 2007 04:10 GMT
> Can the bright minds here point me to the java tools best suited to
> interfacing a C++ library with the widest range of web servers?

If you have the C++ library, I'm sure you have C binding functions, if not,
something like this:

extern "C" myfunction(...)
{
       cppobj->method();
}

In java, use the native interface decl

class myclass
{
       native int foo();
}

To interface between Java and C bindings, you need javah, use it like this:

javah -jni myclass

And it will produce a header file, from which you can probably hack a C
interface.

Have fun, the rest is up to you.

> Fundamental question from a Java newbie.  I'm about to start a web app
> with the business logic contained in a C++ DLL (could be a COM object if
> necessary).  It must be compiled to protect the intellectual property
> within.  My research to date indicates that java is both portable and
> powerful enough to manage my library if I can talk to enough servers.

Once you have a Java interface, you could use Java's remote interfacing and
make it distributed. Just know, once you use JNI, you have to compile and
test for every supported platform and java VM.

> I'll need to host this C++ code on the client's web server, be that
> Apache,
> IIS, or the next new flavor of the month.  I'm hoping for many clients
> with many different web servers.

Well, it should be possible. If your C++ library compiles and works on a
various assortment of operating systems and environments aleady, chances
are you have the expertise to do the same with the JNI interface.
> Do web servers have a common, standard java interface?  Do all web servers
> except IE share an interface?
>
> Is Java the best interface for this application?
>
> Book and web page references are welcome.


Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.