I'm sort of new to http://www.parse.com . And I want to develop backend in Java using REST API. It seems parse.com does not provides direct Java library for REST API development. But I found some third party libraries(un-official) like for Java:
JAVA
Almonds — A Java REST API that mimics the Android API.
mobile-parse-api — This library implements the REST API of parse.com in java with open interfaces for libgdx and playN.
Parse4J — Library for the REST API.
ParseFacade — Parse Android SDK alternative.
But I am not understainding how to get start with these libraries in order to create backend API in Java
#Mahendra
I assume by now you have found your answer. In case you haven't then here is a thought process that might be of interest.
From the little reading I have done on Parse.com it is a sort of like an Object database in itself which provides ready REST style api for all data stored there. See this - https://parse.com/docs/rest/guide
In addition they provide libraries for all popular Front Ends (iOS, Android, JS).
I think they are advocating a paradigm shift for programmers who are used to having a lot of processing on the Backend servers and exposing simpler rest API which provides a processed and targeted response to each http request.
Basically they are suggesting that the whole backend infrastructure (db, app server, server side logic etc) can be replaced by parse.com
If you are considering using Parse.com I assume you have read and understood above mentioned thought process and decided that it makes sense for your project.
I would advise you to consider using a using a common client side Java library that works with the Parse rest api and then use appropriate Client SDK (iOS, Java, JS etc) to work with your library and design the UI. Since you are asking about Java library, I assume your language of choice for storing processing logic is Java.
What I suggest next may be bit of a long shot ... but worth a consideration.
Write code non-ui code in Java and work with the Android API from Parse.com. Use a Java to Objective C. https://github.com/google/j2objc
This will also allow you to use Java code for your web browser (using GWT as a UI framework).
Then write UI code in the framework suited for the platform (obj c for ios, Java for Android, GWT + Java for web browsers) and use the java library to connect to Parse.com.
If you have already tried out such an approach would be good to write back opinions in a comment so the community may benefit.
Related
tl;dr: Is Spring + Django back-end possible?
When I was new to industry and was still working my way around the office, I got interested in Django and created a very small, basic-level application using the framework. When I got to meet my team after a few weeks, they said to go for Spring framework. After spending half a year on the framework and the main proj, I finally started to get time to start working off-hours. But, I don't want to lose both the skills - My teammate(when we were still in office ;) ) once told me that they worked on a project that started with python code, and then later added features using Java. And I am unable to find any helpful google searches(mostly showing Spring vs Django).
How should I go about it? Is it too much to ask for? Is it worthwhile? Will I learn some new concepts of application architecture a noob like me would have missed. Please provide me with some insight.
Are there resources(docs) I can go through?
P.S. I'm not a diehard fan of either of the frameworks right now, just another coder testing waters.
You can't write java in python.
You can extend Python with C/C++ which is quite common: Extending Python with C or C++
And about the part that they told that they added features with java:
It's common to create different parts of a project using different languages and tools. Microservice architecture is a common architecture for these kinds of use cases. You basically code different parts of the project in a language you want and then you connect all the parts using different methods like REST APIs, gRPC and etc.
Imagine you are creating a website like youtube that lets others upload videos. There is a form that users upload their files and you store them in your storage and then you have to encode the video file for different qualities. You can code the form handler using Python and Django to store the files in your storage. Then you can code another service using java that handles the encoding part which is a heavy process. When an upload is completed, you send the file or file path to your java service using an internal REST API and tell the service to start encoding the video and notify the Django service and then the Django service will publish the video on the feed that can itself be written in another language.
I would say go for 1 framework and stick with it. For example Django if you want to code in python, and spring if you want to code in java. Learning both frameworks however brings a lot of value, because you can compare their benefits (eg. spring forces you to write clean code, django has build-in and simpler database management)
I like Django's build-in tooling a lot, you only need to know python for it to work. Spring requires a bit more knowledge of eg. hibernate for database management. However I predict Django will outgrow spring at some point, because of cloud valuing fast iteration over code and quick startup time (auto-scaling apps) over large overhead apps and long boot times. Hoever, if you like java, I can recommend JHipster for java/spring webapp development to get up to speed very fast and learning the ways of REST CRUD api fast.
To combine 2 programs: write your main logic in one app, and write a small service in the second language, making sure its independent of the first app (no back and forth communication and complicated logic, but simple independent request/response, as if the main app was never there). Add a REST api to the second app and use eg. http requests to communicate.
What's possible in terms of combining languages:
connect different applications with each other: by letting them communicate through their APIs. For example a python api developed with flask or django can send requests to a java api developed with spring, as long as they have a way to communicate (eg over http, or via some queue like rabbitmq)
connect a webapp to 2 different backends: by using a shared authentication system: For example a keycloak authentication server to handle tokens, that your backend applications know about.
What's not possible (and also not preferable):
combining java with python code in the same program: there are some hacky ways to get it to work, but its asking for trouble and not readable.
My company currently has a Java project that allows us to run jobs to process data. The current project has a web interface, but its rather old, and most of the web interface is implemented through Java Servlets by printing HTML out to the web browser.
We want to instead create a REST API using the same core process, and replace the web interface with a different implementation in the future. Then eventually, we may have customers use the REST API.
My question is this: I understand NodeJS is pretty powerful, and from what I've read, makes the most sense when developing a REST API with the JavaScript and JSON integration. Should I attempt to create the REST API with Java, and if so, should I use JavaEE and Glass Fish, or should I have the API be built with NodeJS, then have the NodeJS server call the core Java service to process the requests?
I understand I may be introducing unnecessary complexity, however the project is rather large, and it won't be feasible to port the project over to NodeJS. I don't have experience with REST API creation (or SOAP), so this is new territory for me.
Thanks for the help,
Colby
Your aim is to create REST API so that your customer could use the API.
For this you can use :
NodeJS to create all your complete application code and Rest API.
There are plenty of
Java is good to create Rest API. You can use JEE and server you are comfortable with. For example, GlassFish.
My suggestions : Use Java because your current application is on Java. You could save time because working on same language. You already have skills in Java languages. You can use Spring framework ( Spring MVC, Spring Security and Spring Boot). Theses frameworks offer some great features and are simple to learn.
Since your current application is already in Java, based on Servlets, the easiest way to create a REST API is just to use the JAX-RS API in your current application. You can start with this JAX-RS tutorial. You would probably also want to use JSON-P for converting between Java objects and JSON. GlassFish, Payara, or any other application server should already provide both the API out of the box.
If you want to use plain servlet container, such as Tomcat, you can add Jersey library to our application, which provides a servlet to support the JAX-RS API in the same way. Or you can alternatively use Spring REST to build the REST API.
I don't recommend to use Node.js just for the REST API - it would introduce a new language for a thing, which can just as easily be done with Java, which is already used by your application. In the end, you would still need to connect the additional Node.js application with the current Java app, which is cumbersome. You would probably end up creating a REST interface between the Node.js app and the Java app, making the Node.js app redundant.
I'm using Azure for the first time and wanting to make a very simple RESTful API, but trying to follow the example using Swagger.io feels like a lot of work for what I want to achieve. Is there a way to just write Java code for JAX-RX without going through the Swagger.io generator process?
Service description stating that you can bring your API as is:
Bring your existing API as-is - You don't have to change any of the
code in your existing APIs to take advantage of API Apps -- just
deploy your code to an API app. Your API can use any language or
framework supported by App Service, including ASP.NET and C#, Java,
PHP, Node.js, and Python.
Swagger support facilitate ease of consumption, since you able to auto generate client sdks in various languages based on swagger spec. Nothing prevent you not having swagger and still use service.
I just started working on a project which will about making a big website.
With big i mean:
Webshop
Forum
Normal Website (Information pages etc..)
At first i just wanted to pick a decent open-source webshop and just built my site around it.
But then i started thinking about how to expand etc.
I started to think how i would like this website to be acces from a mobile phone. Not just with a browser but with an App. (I have decent experience in making apps for Android & Iphone). So the real question is:
Would it be smart to make the "Core" of my whole website in Java and use services to acces it and thus allowing different frontends to use the same "Core". Like:
- PHP for browser frontend
- Java (android) for the android App
- Objective C for the IPhone App.
And let them all just communication to the "Core" through REST (Json).
What will be the advantages / disadvantages with this approach and will there be a significant delay in rendering eg. a webpage (http request to php, then php making calls to java server (different physical server) then accessing the database and then returning it all, so php can format it to HTML).
Hope hearing some answers or suggestions!
I would skip the Java layer and make the "core" PHP. There is a wealth of tools and frameworks (like Zend FW) for building thoses components in PHP. Design your application around a REST interface and allow your mobile apps to use REST.
Better yet, use Rails. It's so easy to design and set up a REST interface.
I think your solution is “smart”. The only changes I suggest are:
Use the same platform to build both the "core" and the "browser frontend." This way you will have more productivity.
Keep the "core" and "browser" frontend on the same server, if possible in the same process. Unless you have a reason do it differently. This will reduce problems with performance, latency and so on.
If you're already familiar with Java I would suggest you look at something like GWT (or GWT + third-party libraries like Ext GWT or Smart GWT) for your front-end. I don't see the point in picking another language for the front-end unless you really want to learn something else (e.g. PHP as you suggest in your question).
I think the rest of your approach is sound (i.e. Java on the backend, providing RESTful services, etc.)
I come from a .Net background and recently x-training to java.
I wanted to develop an Android application that required simple functionality to communicate with a server. For example, functionality such as post a username/score to a website (or service), or request information such as top 10 scores.
What type of communications should I focus on? What is the common technology to use? Does Java have the equivalent of WCF? Or does it have some sort of simple web service? Can web services be secured with authentication?
Ive heard other references to xml-rpc. Should this be something I should look into?
Depends on what your server is running. I usually just use URLs to fetch and/or send data and then parse the response with whatever is suited (such as org.json for JSON or org.w3c.dom for XML or HTML).
Java has the equivalent of WCF in the fact that you can develop Web Services with Java and use frameworks to develop such services to benefit from different features. The format which you send messages to these web services I think is what you are asking as such you literally can use any format you want (Dependent on support of such format by the service). You will find libraries for many of the well known formats like SOAP (KSOAP2), REST (JSON,XML) etc... Since the transport of these can be over HTTP, and you get a library in android to develop such services over HTTP you have quite a choice.
For Reference:
http://ksoap2.sourceforge.net/
https://metro.dev.java.net/
http://msdn.microsoft.com/en-us/netframework/cc950529.aspx
Hope this helps,
Andrew
Without knowing all of your requirements but assuming it's gaming-related, you might be better served trying one of the Android gaming APIs rather than trying to roll-your-own networking solution. Scoreloop and OpenFeint, the two I am currently considering for my own Android game, both offer Android APIs that make it fairly straight-forward for posting and retrieving high-scores, in addition to other game-related features such as challenges and social network integration.
The advantage of this option is that you don't have to worry about how the phone talks to the server nor do you have to host the server itself - they have already solved those problems for you - and they're free which makes it great for us indie developers.