Get Alfresco content from web application - java

Until today I used RESTFul Api to extract content from Alfresco repository so, with an Alfresco Web Script I was able to get the right contented I need. Until today. Now, I need to extract translated content from Alfresco but it seems that Alfresco Javascript API doesn't support the multilingual translation of a content. Do you know it there is another way to get Alfresco content from my web application?
I tried using Alfresco Web Service API for Java with:
WebServiceFactory.setEndpointAddress(alfresco_webservicefactory);
AuthenticationUtils.startSession(getAlfrescoLogin(session), getAlfrescoPassword(session));
but I get this exception:
05:41:25,576 ERROR ApplicationProperty [72] - Can not initiate session with Alfresco server.
java.lang.NullPointerException
at org.apache.axis.client.Service.getEngineConfiguration(Service.java:813)
it seems it's not possible to open a connection from my Tomcat to Alfresco because trying from a simple Java main class it works (but really slow and not applicable to a web application)
Any suggestion?

Related

Is there an easy way to log the content of the console to a web page?

Currently, I develop with java / spring-boot / log4j2 , and as much as I have searched I have not seen anything interesting to log directly to a web page in real-time (something like swagger style with requests, which is by configuration without having to write code) .
Do you know anything?
You need Javascript to modify the DOM of a webpage, not Java.
You could use Spring to send Server-Sent-Events (SSE) to a frontend JS library, or host a WebSocket or other REST API on some web server and use AJAX to issue requests, upon which the DOM is modified as part of a response, but this really has nothing to do with Java/Spring/log4j
If you want a packaged distribution of Spring w/ some Javascript framework, JHipster is a popular option.

Developing app with web and Android client with Java

I'm going to start developing a new simple "X management" kind app, like contact management or events management. What I want to know is which tools would be the best to achieve it in the way I want.
My app needs to be a web app running on a server that has a mysql database to save and retrieve some simple information. This app must have a web client but I want it to be able to be extended to work with an Android app client.
Things I've thought:
I've worked on Java with facelets and JPA travels management app running on a GlassFish server on localhost with a JSF web view, so maybe my web client and the full app could be done with this.
I've worked with web services such as SOAP and REST with Jaxb and xml schemes to retrieve information parsing some webs into xml or json to show on a client .net app. So I've thought I can add to my app, like last topic we talked about, a REST web service layer to easily work as I want, or at least I think it would be easy. If I do this the Android app could share the same app core code but using the REST service.
My question is what could be the best way to do an app with 2 client side in different platforms that could share some code to be easy to extend it moreover to a desktop app. I've talked about these 2 options because I'm a students of computers at university and those are the tools I know, but I can easy learn more. I've also think about just a REST service and create a web and an Android client to work on same service or something like that.
This post is getting long, so here is the summary: What technologies and tools do you think are the best choice to create an java web app that needs to have web and Android client? Also what server, like tomcat, GlassFish or another, should I use? And what about persistence layer? JPA with mysql is the best I know to work with.
Thanks a lot.
P.D: I work with eclipse
From my point of view:
You can use java jersey and java spring both ( java spring as Dependency injection) for creating RESTful Web service. So, In server side you will create endpoint and you can access data from any platform through those endpoint.
Server can be anyone. It's up to you. I always try to use tomcat but tomcat is not a full JavaEE container it's only a servlet container. So if you want to use full JavaEE version then you should use Glassfish.
And yes JPA .It can be easily used in any environment supporting JPA including Java SE applications, Java EE application servers, Enterprise OSGi containers etc.
On the other hand, still choice is yours.

how to communicate android application to mysql database through JSP and Servlet

I am creating an android application and I want that when user fill up the registration form in my android application then that data should be saved in remote MySQL database.But i want JSP and Servlet for this as middle level.
I searched a lot on internet but every tutorial shown on internet are using PHP. I don't want to use PHP at server side.
So is there any tutorial or resource for saving android application data to remote MySQL database using JSP and Servlet.
You usually call RESTful services from the Android App. The RESTful services can be written in any language of your choice. Your Android client is one which is communicating with the REST Backend. If you are using ButtonView and on the click of it some update or retrieval are supposed to be performed then REST based services are best.
I would recommend this approach.
Look at the way servlet is deployed from the below blog :
http://hmkcode.com/java-servlet-send-receive-json-using-jquery-ajax/
Hit the servlet URL in a browser.If u get the JSON response, the same call can be leveraged from the mobile client building the URLconnection and rendered in the app using some Parser at Mobile end.
Hope this meets the requirement.

Setting up a basic cloud for documents using Java EE 7

I'm planning to setup an Enterprise application where the Java standalone client can upload and download .doc and .odt documents from an application server (WildFly). I'm evaluating different solutions such as:
Using a Servlet as bridge to upload documents and download using an HttpConnection.
Using a REST Web service to upload and download the document
Using an EJB and passing the document as argument and returning the document from the EJB call
I think all of the above solutions should somehow work, but which is more fit for a Desktop application, which also needs some level of authentication during the communication?
Thanks
I agree all of the above solutions should work, however instead of using plain Servlets, why not using HttpClient libraries from Apache which make fairly simple to upload and download files ? There is even a library written on the top of HttpClient which is named Awake file which is opensource and allows secure upload and download of documents from Java Desktop applications and Android clients as well.
Hope it helps

How would I/can I post a java web project from Netbeans to Sharepoint?

I have a java web application that I am developing in Netbeans (and running through Tomcat). Is there any way to put this application on Sharepoint?
This is my first time doing this. I've read that to post the application to a tomcat server you just have to copy the .war file over, but I haven't been able to find an easy solution for Sharepoint.
Sharepoint isn't a Java Application Server. You'll have to use Tomcat (or another Java Application Server) to host your application. If you need to interact with Sharepoint from your application, you'll have to use web services, a shared database or something else to communicate.
That's not possible out of the box. SharePoint only runs ASP.NET applications, not java projects.
You can deploy the solution to a Tomcat server and then use the Page Viewer Web Part to show external content.

Categories

Resources