Flex app with Angular2

classic Classic list List threaded Threaded
17 messages Options
Reply | Threaded
Open this post in threaded view
|

Flex app with Angular2

olegkon
Hi,

We have a large legacy Flex4 web app (with Java8, Spring4, BlazeDS4, Spring-BlazeDS integration),
which we want to start gradually converting to Angular2.

At this point we are trying to display Angular2 SPA as HTML5
in Flex Group via LinkButton or as a tab.  Is it possible?

Has anyone ever tried that?

Do we have to use iFrame or can do without it?  
What to do with session management?  
We would like to reuse Spring Security (need to add Spring Boot for that?)

If that is not possible, we can avoid using Java (as of now we have Angular2 app more like MEAN
without Mongo - calling DB Stored Procs via MSSQL client running on NodeJS),
so can try using security tokens (JWT).

Please advise.


TIA,
Oleg.
Reply | Threaded
Open this post in threaded view
|

Re: Flex app with Angular2

Jeffry Houser

On 4/3/2017 12:05 PM, olegkon wrote:

> Hi,
>
> We have a large legacy Flex4 web app (with Java8, Spring4, BlazeDS4,
> Spring-BlazeDS integration),
> which we want to start gradually converting to Angular2.
>
> At this point we are trying to display Angular2 SPA as HTML5
> in Flex Group via LinkButton or as a tab.  Is it possible?
>
> Has anyone ever tried that?
> Do we have to use iFrame or can do without it?

  I never tried it with a single page app, but there are plenty of
options / components to display HTML as if it were part of a Flex app.  
It's been ages since I researched that, but I think most of them use an
iframe trick; and I recommend investigating the same approach.


> What to do with session management?
  Assuming you are talking about client side session state; I would
probably handle session management independently between the Flex app
and the Angular app.  Send a URL variable or something similar to the
Angular app so it can load relevant session data from the server.

> We would like to reuse Spring Security (need to add Spring Boot for that?)

  This is where my knowledge breaks down as I have limited Java / Spring
experience.

  I worked on a Single Page App [Angular 1] for a client who used Spring
to manage sessions server side.  I never understood why a single page
app needed to maintain server side sessions, however it worked with
minimal issues.

> If that is not possible, we can avoid using Java (as of now we have Angular2
> app more like MEAN
> without Mongo - calling DB Stored Procs via MSSQL client running on NodeJS),
> so can try using security tokens (JWT).
  If you have Java experience, and a lot of services already built for
the Flex app; my impulse is to wrap those services to return JSON
instead of AMF.  That will probably save you lots of time compared to
switching to an entirely new platform.

  Is that helpful?

--
Jeffry Houser
Technical Entrepreneur
http://www.jeffryhouser.com
203-379-0773

Reply | Threaded
Open this post in threaded view
|

Re: Flex app with Angular2

olegkon
Jeffry,

>If you have Java experience, and a lot of services already built for the Flex app;
>my impulse is to wrap those services to return JSON instead of AMF.  
>That will probably save you lots of time compared to switching to an entirely new platform.

Absolutely agree with you (I have 20 yrs of Java on and off).

So now I am trying to expose those services as RESTful Web Services sending JSON
and then consume them from Angular2.
But for some reason, so far I was not able to get anything in the URL,
so my sample getProducts sample  http://localhost:8080/ws/products returns 404

As I mentioned, using Java8, BlazeDS4.7 with Spring 4.3 and Spring-Flex integration 1.6.
Do I need to create/configure a separate channel  in BlazeDS for Web Service?
Or any other Spring configuration?

I have seen Yakov Fain's sample connecting Angular2/4 app to Java [web service] via Spring Boot,
it does use same Java RESTful service, but same code not working inside my web app.
Is Spring Boot doing some magic which I am missing?
There is no Spring configuration there.

Please advise.

TIA,
Oleg.
Reply | Threaded
Open this post in threaded view
|

Re: Flex app with Angular2

Jeffry Houser

  Sounds like a Java problem; so I won't be able to help, personally.  I
have lots of Angular 2/4 experience lately this year, but minimal Java
stuff.

  Based on what little I understand from dealing w/ ColdFusion, the
channels are just a way to tell Flex how to call the services.

  If I were doing this in CF; I'd just write new CF Code that executed
the services manually--not through the remoting interface--and processed
the results to return them in a different format.  As long as those new
services are browser accessible, an Angular app should be able to hit them.

  Can anyone else help?  If not; I'd go to StackOverflow.


On 4/25/2017 3:49 PM, olegkon wrote:

> Jeffry,
>
>> If you have Java experience, and a lot of services already built for the
> Flex app;
>> my impulse is to wrap those services to return JSON instead of AMF.
>> That will probably save you lots of time compared to switching to an
> entirely new platform.
>
> Absolutely agree with you (I have 20 yrs of Java on and off).
>
> So now I am trying to expose those services as RESTful Web Services sending
> JSON
> and then consume them from Angular2.
> But for some reason, so far I was not able to get anything in the URL,
> so my sample getProducts sample  http://localhost:8080/ws/products returns
> 404
>
> As I mentioned, using Java8, BlazeDS4.7 with Spring 4.3 and Spring-Flex
> integration 1.6.
> Do I need to create/configure a separate channel  in BlazeDS for Web
> Service?
> Or any other Spring configuration?
>
> I have seen Yakov Fain's sample connecting Angular2/4 app to Java [web
> service] via Spring Boot,
> it does use same Java RESTful service, but same code not working inside my
> web app.
> Is Spring Boot doing some magic which I am missing?
> There is no Spring configuration there.
>
> Please advise.
>
> TIA,
> Oleg.
>
>
>
>
> --
> View this message in context: http://apache-flex-users.2333346.n4.nabble.com/Flex-app-with-Angular2-tp14960p15113.html
> Sent from the Apache Flex Users mailing list archive at Nabble.com.

--
Jeffry Houser
Technical Entrepreneur
http://www.jeffryhouser.com
203-379-0773

Reply | Threaded
Open this post in threaded view
|

Re: Flex app with Angular2

jmclean
Administrator
In reply to this post by olegkon
Hi,

Depending on the version of CF you are using you can make CFC return JSON easily

Either specify returnFormat=“JSON” in the method or append returnformat=json to the URL query string, CF then handles all of the conversation for you, that may be an easier way to go.

Thanks,
Justin
Reply | Threaded
Open this post in threaded view
|

Re: Flex app with Angular2

Jeffry Houser

On 4/25/2017 10:59 PM, Justin Mclean wrote:
> Hi,
>
> Depending on the version of CF you are using you can make CFC return JSON easily
>
> Either specify returnFormat=“JSON” in the method or append returnformat=json to the URL query string, CF then handles all of the conversation for you, that may be an easier way to go.
  Sorry if I confused things by mentioning CF.  Oleg was using Java; not
ColdFusion.  I was just trying to parallel my experience; since they are
both the same thing "under the hood."

  I didn't think you could add returnFormat="JSON" to a CFC method while
still supporting AMF calls; but don't think I've actually tried it.


--
Jeffry Houser
Technical Entrepreneur
http://www.jeffryhouser.com
203-379-0773

Reply | Threaded
Open this post in threaded view
|

Re: Flex app with Angular2

olegkon
We did not use CF or Lucee in our project so far (although some people here like it :-) ),
I have no experience with it.

So far I am trying to run latest Spring-BlazeDS testdrive 1.6 (trying to resolve security exceptions).
https://github.com/spring-projects/spring-flex

There is rest-insync sample there. If I am able to run that, will try to port it to Spring 4.3.
Hope it will help to add RESTful web service with JSON to BlazeDS4 in our Flex web app.

Has anyone tried that?
Reply | Threaded
Open this post in threaded view
|

Re: Flex app with Angular2

jmclean
Administrator
In reply to this post by Jeffry Houser
HI,

> I didn't think you could add returnFormat="JSON" to a CFC method while still supporting AMF calls; but don't think I've actually tried it.

I’ve tried it it works, but as you say it probably not the answer here.

Thanks,
Justin
Reply | Threaded
Open this post in threaded view
|

Re: Flex app with Angular2

Christofer Dutz
In reply to this post by olegkon
You already had a look at the Apache Flex BlazeDS Spring-Boot archetype?

Chris

Am 26.04.17, 21:23 schrieb "olegkon" <[hidden email]>:

    We did not use CF or Lucee in our project so far (although some people here
    like it :-) ),
    I have no experience with it.
   
    So far I am trying to run latest Spring-BlazeDS testdrive 1.6 (trying to
    resolve security exceptions).
    https://github.com/spring-projects/spring-flex
   
    There is rest-insync sample there. If I am able to run that, will try to
    port it to Spring 4.3.
    Hope it will help to add RESTful web service with JSON to BlazeDS4 in our
    Flex web app.
   
    Has anyone tried that?
   
   
   
    --
    View this message in context: http://apache-flex-users.2333346.n4.nabble.com/Flex-app-with-Angular2-tp14960p15122.html
    Sent from the Apache Flex Users mailing list archive at Nabble.com.
   

Reply | Threaded
Open this post in threaded view
|

Re: Flex app with Angular2

olegkon
Chris,

Could you please elaborate on that?

As I mentioned, I know it is possible to connect Angular2 to Java via Spring Boot.
But what exactly makes it happen?  Is it plain RESTful web service or something else?
From what I've seen, there is no config files there.

As of today, we have many Java services, each having 3-10 methods (but no Web Services),
called from Flex via BlazeDS4 and Spring4-Flex integration 1.6.0.  
So should we wrap them out as RESTful web services?
And add Spring Boot there?  What is involved in that?

Please help.

Oleg.
Reply | Threaded
Open this post in threaded view
|

Re: Flex app with Angular2

Christofer Dutz
Hi Oleg,

Angular2 can’t speak AMF and this is the only format BlazeDS understands.
Angular2 understands JSON and spring boot rest services natively talk JSON in a spring boot application.

So if you are building an Angular2 application, I think you don’t need BlazeDS at all.

Chris


Am 27.04.17, 15:24 schrieb "olegkon" <[hidden email]>:

    Chris,
   
    Could you please elaborate on that?
   
    As I mentioned, I know it is possible to connect Angular2 to Java via Spring
    Boot.
    But what exactly makes it happen?  Is it plain RESTful web service or
    something else?
    From what I've seen, there is no config files there.
   
    As of today, we have many Java services, each having 3-10 methods (but no
    Web Services),
    called from Flex via BlazeDS4 and Spring4-Flex integration 1.6.0.  
    So should we wrap them out as RESTful web services?
    And add Spring Boot there?  What is involved in that?
   
    Please help.
   
    Oleg.
   
   
   
   
    --
    View this message in context: http://apache-flex-users.2333346.n4.nabble.com/Flex-app-with-Angular2-tp14960p15126.html
    Sent from the Apache Flex Users mailing list archive at Nabble.com.
   

Reply | Threaded
Open this post in threaded view
|

Re: Flex app with Angular2

olegkon
That is not entirely true. From Spring-BlazeDS-reference:
"A complete insync-rest example of interacting with a Spring MVC @Controller is now provided in the Test
Drive. This sample duplicates the full functionality of the complete inSync application that was originally built
using BlazeDS Remoting. It shows in detail how to work around Flash player's limitations to use AMF to
interact with a RESTful service that supports it."

There is "Chapter 4. Communicating with RESTful Spring[3] MVC Endpoints using AMF" which shows some JSON, so in theory that can be called from JS.
See:  http://docs.spring.io/spring-flex/docs/1.6.x/reference/pdf/spring-blazeds-reference.pdf
Reply | Threaded
Open this post in threaded view
|

Re: Flex app with Angular2

Christofer Dutz
Well the Spring Flex integration test-drive has this functionality because spring has it on board.
I have never come across any JSON functionality inside BlazeDS however.

Chris

Am 27.04.17, 16:51 schrieb "olegkon" <[hidden email]>:

    That is not entirely true. From Spring-BlazeDS-reference:
    "A complete insync-rest example of interacting with a Spring MVC @Controller
    is now provided in the Test
    Drive. This sample duplicates the full functionality of the complete inSync
    application that was originally built
    using BlazeDS Remoting. It shows in detail how to work around Flash player's
    limitations to use AMF to
    interact with a RESTful service that supports it."
   
    There is "Chapter 4. Communicating with RESTful Spring[3] MVC Endpoints
    using AMF" which shows some JSON, so in theory that can be called from JS.
    See:
    http://docs.spring.io/spring-flex/docs/1.6.x/reference/pdf/spring-blazeds-reference.pdf
   
   
   
   
    --
    View this message in context: http://apache-flex-users.2333346.n4.nabble.com/Flex-app-with-Angular2-tp14960p15128.html
    Sent from the Apache Flex Users mailing list archive at Nabble.com.
   

Reply | Threaded
Open this post in threaded view
|

Re: Flex app with Angular2

olegkon
OK. So do I have to add Spring Boot to my current Spring4 app backend
in order to be able to connect to RESTful service through JSON from JS (Angular2/TS) ?
What is involved.
Also is there easy way to expose Java Spring4 service classes as RESTful Web services?
Is it @Controller or @RestController?
Needs an extra channel?  Or what in config?

On Thu, Apr 27, 2017 at 11:16 AM, Christofer Dutz [via Apache Flex Users] <[hidden email]> wrote:
Well the Spring Flex integration test-drive has this functionality because spring has it on board.
I have never come across any JSON functionality inside BlazeDS however.

Chris

Am 27.04.17, 16:51 schrieb "olegkon" <[hidden email]>:

    That is not entirely true. From Spring-BlazeDS-reference:
    "A complete insync-rest example of interacting with a Spring MVC @Controller
    is now provided in the Test
    Drive. This sample duplicates the full functionality of the complete inSync
    application that was originally built
    using BlazeDS Remoting. It shows in detail how to work around Flash player's
    limitations to use AMF to
    interact with a RESTful service that supports it."
   
    There is "Chapter 4. Communicating with RESTful Spring[3] MVC Endpoints
    using AMF" which shows some JSON, so in theory that can be called from JS.
    See:
    http://docs.spring.io/spring-flex/docs/1.6.x/reference/pdf/spring-blazeds-reference.pdf
   
   
   
   
    --
    View this message in context: http://apache-flex-users.2333346.n4.nabble.com/Flex-app-with-Angular2-tp14960p15128.html
    Sent from the Apache Flex Users mailing list archive at Nabble.com.
   




If you reply to this email, your message will be added to the discussion below:
http://apache-flex-users.2333346.n4.nabble.com/Flex-app-with-Angular2-tp14960p15130.html
To unsubscribe from Flex app with Angular2, click here.
NAML



--
Thank you,
Oleg.
Reply | Threaded
Open this post in threaded view
|

Re: Flex app with Angular2

sampath
In reply to this post by olegkon
Hi, Did you get the solution. I am too having same problem. I have a flex application and migrating to angular2. As part of migration, I am writing restful spring web services and using them for angular2 application. Few of the components takes much time to convert in to angular2 so, I would like to use something to show the flex components into angular2. I am also having same requirement list as you have. Please tell me your progress.
Reply | Threaded
Open this post in threaded view
|

Re: Flex app with Angular2

olegkon
Honestly, I haven't made much progress - got stuck trying to revive that Flex-Spring testdrive and migrate it first to latest Spring3 
and then to Spring4 (as in the rest of my current Flex+Java app).

But I spoke to Dan Vega who teaches a lot of Spring Boot courses on Udemy.
He told me that Spring Boot does not add any extra when connecting to/from Angular, it is done via standard RESTful web service.
Here is an interesting blog entry from him:

Keep me posted.

HTH,
Oleg.


On Fri, May 19, 2017 at 2:31 PM, sampath [via Apache Flex Users] <[hidden email]> wrote:
Hi, Did you get the solution. I am too having same problem. I have a flex application and migrating to angular2. As part of migration, I am writing restful spring web services and using them for angular2 application. Few of the components takes much time to convert in to angular2 so, I would like to use something to show the flex components into angular2. I am also having same requirement list as you have. Please tell me your progress.


If you reply to this email, your message will be added to the discussion below:
http://apache-flex-users.2333346.n4.nabble.com/Flex-app-with-Angular2-tp14960p15250.html
To unsubscribe from Flex app with Angular2, click here.
NAML



--
Thank you,
Oleg.
Reply | Threaded
Open this post in threaded view
|

Re: Flex app with Angular2

Christofer Dutz
In reply to this post by olegkon
Hi Oleg,

Sorry for not replying any sooner … I must have missed that one (

I usually only use @Controller for my rest-services. Also, you don’t need Spring Boot if you already have a Spring Web Application. All you need is Spring MVC and that should be part of the default Spring Web stuff.

Chris


Am 28.04.17, 11:58 schrieb "olegkon" <[hidden email]>:

    OK. So do I have to add Spring Boot to my current Spring4 app backend
    in order to be able to connect to RESTful service through JSON from JS
    (Angular2/TS) ?
    What is involved.
    Also is there easy way to expose Java Spring4 service classes as RESTful
    Web services?
    Is it @Controller or @RestController?
    Needs an extra channel?  Or what in config?
   
    On Thu, Apr 27, 2017 at 11:16 AM, Christofer Dutz [via Apache Flex Users] <
    [hidden email]> wrote:
   
    > Well the Spring Flex integration test-drive has this functionality because
    > spring has it on board.
    > I have never come across any JSON functionality inside BlazeDS however.
    >
    > Chris
    >
    > Am 27.04.17, 16:51 schrieb "olegkon" <[hidden email]
    > <http:///user/SendEmail.jtp?type=node&node=15130&i=0>>:
    >
    >     That is not entirely true. From Spring-BlazeDS-reference:
    >     "A complete insync-rest example of interacting with a Spring MVC
    > @Controller
    >     is now provided in the Test
    >     Drive. This sample duplicates the full functionality of the complete
    > inSync
    >     application that was originally built
    >     using BlazeDS Remoting. It shows in detail how to work around Flash
    > player's
    >     limitations to use AMF to
    >     interact with a RESTful service that supports it."
    >
    >     There is "Chapter 4. Communicating with RESTful Spring[3] MVC
    > Endpoints
    >     using AMF" which shows some JSON, so in theory that can be called from
    > JS.
    >     See:
    >     http://docs.spring.io/spring-flex/docs/1.6.x/reference/pdf/
    > spring-blazeds-reference.pdf
    >
    >
    >
    >
    >     --
    >     View this message in context: http://apache-flex-users.
    > 2333346.n4.nabble.com/Flex-app-with-Angular2-tp14960p15128.html
    >     Sent from the Apache Flex Users mailing list archive at Nabble.com.
    >
    >
    >
    >
    > ------------------------------
    > If you reply to this email, your message will be added to the discussion
    > below:
    > http://apache-flex-users.2333346.n4.nabble.com/Flex-app-with-Angular2-
    > tp14960p15130.html
    > To unsubscribe from Flex app with Angular2, click here
    > <
    > .
    > NAML
    > <
http://apache-flex-users.2333346.n4.nabble.com/template/NamlServlet.jtp?macro=macro_viewer&id=instant_html%21nabble%3Aemail.naml&base=nabble.naml.namespaces.BasicNamespace-nabble.view.web.template.NabbleNamespace-nabble.view.web.template.NodeNamespace&breadcrumbs=notify_subscribers%21nabble%3Aemail.naml-instant_emails%21nabble%3Aemail.naml-send_instant_email%21nabble%3Aemail.naml>
    >
   
   
   
    --
    Thank you,
    Oleg.
   
   
   
   
    --
    View this message in context: http://apache-flex-users.2333346.n4.nabble.com/Flex-app-with-Angular2-tp14960p15141.html
    Sent from the Apache Flex Users mailing list archive at Nabble.com.