How can my Spring-Flex project use a vanilla HttpServlet via Java?

Without doing some refactoring of the code, I don't think there's any great way to do this from your application's service layer. It is typically not a good idea to have your service layer be dependent on the Servlet API in any way, and that would be required if you were going to try to invoke the Servlet by simulating an HTTP request.

Without doing some refactoring of the code, I don't think there's any great way to do this from your application's service layer. It is typically not a good idea to have your service layer be dependent on the Servlet API in any way, and that would be required if you were going to try to invoke the Servlet by simulating an HTTP request. Actually, I think invoking the Servlet from Flex is the simplest way to go if you don't want to change the Servlet at all.

I don't see any reason why it wouldn't be quite straightforward to use HttpService for this: livedocs.adobe.com/blazeds/1/blazeds_dev... Otherwise, if you really must invoke this ASP endpoint from within the context of your service tier, I would recommend refactoring the bit that does the invocation into a separate @Service class that has no dependency on the Servlet API. You could potentially even simplify the code a bit by using Spring's RestTemplate to do the invocation and handle the result: http://static.springsource.org/spring/docs/3.0.x/spring-framework-reference/html/remoting.html#rest-client-access.

Thanks Jeremy! Mind if I ask a follow-up question? In implementing the first option (sounds like that's the best-practice route), does this sound right?

I'll write an AS3 function that: 1) Set's up any dynamic elements needed by the HttpService (this may be gold-plating). 2) Invoke the HttpService. 3) Use a RemoteObject to log the result of the HttpService and/or perform more business logic What do you think @Jeremy-Grelle?P.S.Thanks so much!

– Brian L. Mar 22 at 17:56 That approach sounds feasible to me if you need to stick with the servlet endpoint. – James Ward Mar 22 at 19:55 Thanks so much for you help guys!

Here's what I came up with --> link to pastebin. Com . I'm not sure if it's best practice, but for now it works.

Eventually, I'd like to do it "the Spring way", but I'm not quite sure how to do that yet. I think if I can modify the Servlet class to implement a particular interface from Spring, I can refactor this solution to be even better. – Brian L.

Mar 24 at 18:37.

I cant really gove you an answer,but what I can give you is a way to a solution, that is you have to find the anglde that you relate to or peaks your interest. A good paper is one that people get drawn into because it reaches them ln some way.As for me WW11 to me, I think of the holocaust and the effect it had on the survivors, their families and those who stood by and did nothing until it was too late.

Related Questions