I realize this is a dated question since appengine now comes in java, but I have a python appengine app that I want to access via GWT. Python is just better for server-side text processing (using pyparsing of course!). I have tried to interpret GWT's client-side RPC and that is convoluted since there is no python counterpart (python-gwt-rpc is out of date). I just tried using JSON and RequestBuilder, but that fails when using SSL. Does anyone have a good solution for putting a GWT frontend on a python appengine app?
The only alternative (if you can call it that) that I'm familiar with is Pyjamas. Obviously, this is more of a GWT replacement than a GWT-RPC replacement. Beyond that, I think you would be stuck with writing your own communications layer using some sort of REST-type protocol.
You can maybe have a look at the GWT JSON RPC example.
If that fails, there are always several XML parser implementations in Python AND Java :)
I agree with your evaluation of Python's text processing and GWT's quality. Have you considered using Jython? Googling "pyparsing jython" gives some mixed reviews, but it seems there has been some success with recent versions of Jython.
I know I am late to this question...
Have you seen this project?
http://code.google.com/p/python-gwt-rpc/
It might be useful as a starting point.
Related
There is some library called pymorphy written in python. Unfortunately, for java there is not any library with the similar functionality - natural language processing for Russian lang. So I need to invoke some methods of pymorphy library from Java code.
First I've tried to solve this problem with Jython. But I've spent 2 days and the goal was not accomplished because python modules cdb, bsddb3, sqlite are written in C and they will not work with Jython.
Now I want to run some python light-weight server with pymorphy for handling request from Java code.
How could I implement this kind of java-python interaction with the maximum production performance? Or is there more simple way to call python from java?
Try Jepp, "Java Embedded Python". http://jepp.sourceforge.net/
I haven't used it beyond small projects, but it works as advertised, allowing one to call CPython transparently from Java. If you have the opposite problem, needing to call Java from CPython, definitely check out JPype. I've used it extensively and it works very well.
I think these libraries (cdb, bsddb3, sqlite) has a jython implementation in https://code.google.com/p/django-jython/ check it out
If I have implemented a Java Library (that offers certain functionality), could I transform this into a JavaScript library, such that the same functionality can be offered?
I know this may be an ask, but, I was wondering if there are frameworks existing that help in this?
No, in general this is not possible, Java and JavaScript are more or less completely different languages.
However there are a couple of Java to JavaScript translators that you can try. Java2Script is one such tool. Apparently the Google Web Toolkit (GWT) does this as well. Source.
While you could probably do some sort of conversion, it's important to note that Java and JavaScript, while similarly named, are not at all related. Unfortunately, I think you'll be hard pressed to find a framework or system that does a good job converting one to the other. :(
Everything I download seems hellbent on using all of Java EE. I need to build a single page to handle requests to it and do a tiny bit of processing based on parameters. This is to hook into another framework that will routinely call this URL.
I want a quick and easy way to create a page with some processing. Is there an easy way to do this using Java? I am using Java because I am comfortable with Java. I used SE for years and did some work in EE but I don't want all the stuff that comes with EE.
Should I maybe just avoid Java altogether and use something else. This needs to be deployed in a linux environment.
I used SE for years and did some work in EE but I don't want all the stuff that comes with EE.
Then just use a Servlet and that's all. Nothing, I repeat NOTHING, forces you to use "all that stuff" and your question is either a free rant or shows some deep misunderstanding.
You need Tomcat (or jetty, or any servlet container - jetty has an embeddable version btw)
You need a .jsp file and optionally an HttpServlet
Generally, it's not a good practice to put any processing code in a JSP, but if it is really simple and won't be extended, simply put the logic there - it is translated to a Servlet anyway.
yes, all the servlet based solutions are quite chubby.
jetty is all right, but the download is 20MB. that is ridiculous.
currently, the best choice is probably com.sun.net.httpserver which is bundled in JDK 6. you can easily implement your service.
It sounds like you could use PHP to do your processing. Call the page and POST the parameters to it, compute, and return the result.
If you are not very particular about using java and are willing to experiment, you should look at nodejs. It runs on V8 javascript engine and runs on linux.
There are a couple of fraemworks for nodejs for web apps:
Expressjs and spludo
as mentioned, you can do this very simply with jetty and a servlet, you don't even need a JSP if you just need a URL that does some processing based on request parameters and returns a response.
For development, it's really easy to create a dynamic web project in eclipse, just follow the steps in this article.
That said, I don't think java is a great choice for really lightweight stuff. PHP is probably the easiest thing to use if you just want to get it working yesterday.
You can use Java with FastCGI. This is very flexible, but also a bit low-level for most Java programmers.
If you aren't afraid of servlets (they are only a very small part of Java EE!), I can recommend JAX-RS, it is quite easy to get started with. If you client-side is JavaScript based, you can avoid using JSP (which I would recommend you to avoid).
For example, see backbone-jax-cellar. The Java source is here. For a Java app, this is light-weight. He is rolling his own DAO, but that's the price you pay for using Java and SQL and no dependencies (other than JDBC). The code is reminiscent of object-oriented PHP if you ask me. The point is, that if you have a JavaScript client, you don't need template rendering or all that cruft and a REST interface should be enough.
If you are afraid of the heavy build systems too, I made an example REST Todo app backend (which uses an existing frontend) that only requires a POSIX system, the JDK and sqlite3, and gets its own other dependencies (including webserver). I did not use a DAO. The repository front page has a README.
Another possibility is the Play Framework which does not use Java EE. It is rather heavy-weight, though. Full featured though. You would definitely need to use an IDE for this, you don't need that for developing JAX-RS/FastCGI apps.
I would reccomend Sinatra it is a very light-weight ruby web framework.
There's a lot of information out there, but I can't quite figure out:
What's Java's answer to PHP's SoapClient()?
No frills, just want to create a client to access the methods described by a .wsdl document.
See this question. There are many Web Services frameworks in Java that can generate a client from a WSDL file. Eclipse has a plug-in to create a client stub from a WSDL file using the Axis2 framework. Perhaps this is the easiest option for a beginner.
If all you want is a piece of software to generate client code from an existing WSDL, you have more options than you can shake a stick at. I've tried several, and they all do pretty much the same thing in the same way, the big difference between them being the documentation. For me, the best documented of the lot is Apache CXF, which will generate JAX-WS-compliant code that you can then use with any JAX-WS library in your application (such as CXF itself, or Sun's JAX-WS-RI, and so on).
It's going to be more complex than SoapClient, I would imagine.
JAX-WS, most appserver vendors supply implementations and tooling.
See glassfish for an exmple implementation. The glassfish guide docs give details of how to go about developing, there are many variations depending upon how you would normally go about doing Java development. For me, I work with IBM tools and therefore simply load up RAD point as the WSDL and click "generate".
You can try using RCPServiceClient class in axis2.
Here is the java doc for it:
ws.apache.org/axis2/1_1_1/api/org/apache/axis2/rpc/client/RPCServiceClient.html
It doesn't require you to generate code to call web services.
Here is a decent example of how you can interact with a service using RPCServiceClient.
ws.apache.org/axis2/1_2/pojoguide.html#testingpojows
Do remember that java is strongly typed language so you can't do things like serviceClient->someRandomFunction(params), since someRandomFunction will not be defined ahead of time if you are trying to do something like PHP's SoapClient.
However, it will be equivalent to $soapClient->_soapCall function, as you will be able to do something like
serviceClient.invokeBlocking(
opProcess, -- function you are trying to call..
opResponseArgs, -- these are arguments you are passing
returnTypes); -- types that you are expecting back
Hope this helps.
I am interested to create a drag-and-drop layout designer using only JavaScript, HTML and CSS. The designer will allow the user to drag the page elements from one place to another (something like Blogger's layout designer) to create a site layout. But I don't want to hand code everything in JavaScript, I would prefer to write my application in .NET (preferably) or Java and rely on a compiler to compile it to JavaScript and HTML.
What are the .NET or Java to JavaScript compilers that you have used and can recommend? For Java to JavaScript I know GWT is available. What about .NET to JavaScript? Microsoft did come out with Volta, but the project seems to be no longer available.
Look no further, you already mentioned GWT pick that!
It has a very good API and many good applications have use them.
Even JavaScript frameworks like http://extjs.com/ have GWT support.
I use it for an small JavaScript calendar recently.
To be honest, I don't really like JavaScript that much. Most of the times the errors are hard to track (specially for a non JavaScript guy as me) and the workarounds included some plug-ins for the explorer just to get exactly what a compiler should do. Catch silly error early.
In the other hand I'm very familiar with the Java Programming language, and many of the libraries (if not the most important) such as java.lang and java.util have been ported to GWT.
Plus, the guy who wrote relevant parts of java.util is the same behind GWT (google Joshua Bloch.)
Check out Nikhil Khotari's Script# project. It allows you to write C# code and compiles it to JavaScript.
Script# has already been mentioned. It hasn't been updated since August 2008.
Milescript is another, but also has seen very little for 6 months.
Extsharp for the Ext library. Adds Ext support for Script#
Javascript compiler to Java (going the wrong way for you)
Java to script Eclipse plugin
My issues with Script# (a known issue) is it doesn't support jQuery yet. However it comes with a very lightweight library to tie in with the .NET framework, in Nikhil's sscorlib.js file and ssfx.core.js files. And also has support for lots of other Javascript APIs (mostly Microsoft, seeing as he is in the ASP.NET team).
I'd love to see a Script# extension for jQuery (I'm thinking about writing it if it's easy enough). As it stands, most don't provide full compilation yet but they're certainly getting there.
Update: I wrote a small extension to enable JQuery support Script# a few months ago. The project can be found here.
I'm going to second the use of GWT. I've used it for several projects and, when used in combination with a modern editor like Eclipse or IDEA, it really makes the mess manageable.
It's important to note that not only does it allow you to write in Java and have that transformed into optimized and obfuscated Javascript it also comes with a substantial subset of the core Java API. In addition to this they provide lots of additional classes for doing things like parsing and working with JSON and XML and communicating with a server via asynchronous HTTP. You can check out the docs to get an idea of what else they offer.
Another feature that might be of special interest to you for implementing drag and drop functionality is it's integration with javascript libraries like Ext and scriptaculous. Either through pre-built interfaces or via JSNI
Also for Java there is J2S.
Java2Script (J2S) Pacemaker provides
an Eclipse Java to JavaScript compiler
plugin and an implementation of
JavaScript version of Eclipse Standard
Widget Toolkit (SWT) with other common
utilities, such as java.lang.* and
java.util.*. You can convert your
SWT-base Rich Client Platform (RCP)
into Rich Internet Application (RIA)
by Java2Script Pacemaker.
This means that if you use the SWT IDE (drag and drop) you can then convert the generated code to JS + HTML.
I wouldn't hand write any Javascript for UI. This can lead to maintenance disaster. jQuery is what I am using but I still wouldn't use it to write full UI Javascript code. ExtJS is also another good option if you plan to write in Javascript. In general what I am saying here is that it's so much easier to main in Java/C# than Javascript. Check out cappuccino framework and Atlas. Never used GWT. Script# is similar to GWT but for ASP.NET framework. Also depends on the requirement, if your site is public facing then RIA isn't a good option. It's all about which extreme end you pursuit (hand written and web standard, or RAD or libraries like jQuery/ExtJS as the middle option).
Check out Axial, a .NET to JavaScript converter that works well in ASP.NET. It supports WebForms, jQuery and canvas. It's not very mature, but it's worth a look.
http://jsc.sourceforge.net/ is a C# to JavaScript, Java, Flash and PHP compiler.
JscriptSuite offers another free .NET to Javascript compiler. There is a big difference to Saltarelle (jsc, SharpKit# etc.). Developer write down and debug only C# code (or any other .NET langauge), like in GWT. Javascript will be generated für deployment only.