CQ ResourceResolver from external app? - aem

Is it possible to get reference to ResourceResolver from external app i.e. not deployed in CQ? Is it possible to use it to fetch Resource, AssetManagers, etc?
We have to create DAM Assets using an external application and would want a better solution than using JCR API for this. One way would be to host an osgi Service on CQ and call it using REST to create the assets but it would be cleaner if the code for creating assets was part of the app itself.

No, it is not possible to get a handle of ResourceResolver in your external app. The ResourceResolver handle or reference can only be obtained when your app is running inside OSGi.
If you are writing an external app then you can use only lower level JCR API(ResourceResolver is part of sling API).

Related

Connect JCR remotely + AEM/OAK

Is there a way to connect JCR/CRX(AEM) remotely apart from RMI/WEBDAV/JNDI? WEBDAV & RMI are not recommended to be open in PROD environment so I don't want to take that route in spite of a working solution.
Options explored which doesn't seem to fit my use case:
SLING API - sling.apache.org/documentation/development/repository-based-development.html
OAK API - github.com/davidegiannella/adaptTo16
REST/JSON - adapt.to/2016/en/schedule/remote-resources.html . Will work for a direct resource access but not for querying or CRUD operations.
JCR API- http://experience-aem.blogspot.com/2015/05/aem-6-sp2-accessing-crx-remotely-using-jcr-remoting-davex.html or https://wiki.apache.org/jackrabbit/RemoteAccess
Any pointers?
Given that Apache Sling is very good at exposing resources via HTTP, my first option would be to use the Sling Get Servlet to get resources as JSON.
For instance, accessing http://localhost:8080/content.json will get you a JSON rendering of the resource at /content.
If you want to get more data in you can specify the number of children to traverse down the hierarchy using a selector. http://localhost:8080/content.2.json will give you the properties of content and those of the children and grand-children.
If that is not enough for you, you can always create a custom servlet and perform the rendering there.

Calling JSP's directly in AEM 6.2

To call JSP's in AEM 6.2 I've been creating site pages then changing the resourceType to a JSP component. Without creating OSGi bundles, is it possible to call a JSP directly without having to go through the Page / Component reference method?
In short No. That is against Sling principles. Quoting the documentation
Sling Scripts cannot be called directly
Within Sling, scripts cannot be called directly as this would break
the strict concept of a REST server; you would mix resources and
representations.
If you call the representation (the script) directly you hide the
resource inside your script, so the framework (Sling) no longer knows
about it. Thus you lose certain features.
For more information, please refer The Basics

Creating RESTful Webservice in CQ5,AEM

I want to host restful webservice from CQ5. Basically the intention is to expose all the users present in CQ5 to external systems based on some parameters like modified date, user state etc.
I went through https://chanchal.wordpress.com/2015/01/11/using-jax-rs-and-jersey-to-write-restful-services-in-osgi-apache-felix-adobe-cq5aem/ as I could find only this post online, but as I am a beginner I couldn't implement it. Need guidance in implementing such RESTful webservice in CQ5
CQ5 is based on Apache Sling which is inherently RESTful, so you don't usually need additional libraries. In your case (and unless the users info is already available as Sling resources, I don't remember if that's the case) implementing a Sling ResourceProvider is enough to provide a browseable RESTful representation of those resources. See the Sling docs for more info, they point to a simple PlanetResourceProvider as a minimal example.
Couldn't get the REST webservices working with AEM/CQ5. Even after installing the packages for JAXB for CQ5. It seems like sling overrides the resolving before it goes to the JAXB annotation handler. Due to lack to time had to implement an alternative approach where CQ5 will be timely writing the json data to an shared location as json file and the third party applications will fetch the files from there.
This will however impact the performace as schedulers are to be written and also it's not a recommended approach but still it will work in my scenario.
Thanks all for helping me.

Embedding GWT application in ChromiumEmbedded

I have read through the chromiumembedded usage and looked at the cefclient application. Now i would like to provide my gwt application as an standalone application to my customers. Is it possible to package the gwt client code using chromiummebedded.
I am not sure how to make the RPC/RC calls to the server if its packaged in CEF.
I think you need to include an embedded webserver in your application, and serve the generated GWT application files from this.
Since the url for your server will be different, you could disable the same origin policy in ChromiumEmbedded to use normal RPC calls, but it might be better to use cross domain calls as describe in Googles tutorial

ASP.Net How do I get the base URL without HttpRequest?

I am trying to get the base URL from the worker role. I can't get it from there.
How do I get the base URL in this situation?
I have found this property:
Application.Current.Host.Source
but, in order for this to work, I need the reference System.Windows.dll which is in the Silverlight folder. Since I am not using Silverlight for this part of the application I am not sure if I should use it here or find another way.
What do you think?
Are you trying to find the external URL of your app? (Like something.cloudapp.net?) If so, there isn't a good way to do this from within a Windows Azure application (without calling out to the Service Management API and looking up the deployment by ID).