PDA

View Full Version : Calling Servlet Service from Flash


snapple
04-16-2005, 10:10 AM
Hello,

I am trying to get a 'Servlet Service" up and running using Tomcat and Java. I have sucessfully called methods on classes and so-called 'Java Bean Services', however, for a project i have to use a servlet (to be able to call many different classes).

Here is my code so far:

Here is my web.xml on the server:


<web-app>

<servlet>
<servlet-name>DefaultGateway</servlet-name>
<display-name>DefaultGateway</display-name>
<description>DefaultGateway</description>
<servlet-class>org.openamf.DefaultGateway</servlet-class>
<init-param>
<param-name>OPENAMF_CONFIG</param-name>
<param-value>/WEB-INF/openamf-config.xml</param-value>
<description>Location of the OpenAMF config file.</description>
</init-param>
</servlet>

<display-name> flashServletExample </display-name>
<description>This better work</description>
<servlet>
<servlet-name>ServiceServlet</servlet-name> <!-- mapping name below -->
<servlet-class>ServiceServlet</servlet-class> <!-- name of class -->
</servlet>

<servlet-mapping>
<servlet-name>DefaultGateway</servlet-name>
<url-pattern>/gateway</url-pattern>
</servlet-mapping>

<servlet-mapping>
<servlet-name>ServiceServlet</servlet-name> <!-- servlet name looked for when URL below is searched for -->
<url-pattern>/ServiceServlet</url-pattern> <!-- the url that can be typed in the browser -->
</servlet-mapping>

</web-app>


And here is my Java servlet:


import java.util.*;
import javax.servlet.*;
import javax.servlet.http.*;
import java.io.IOException;

public class ServletService extends HttpServlet
{
public void service( HttpServletRequest request, HttpServletResponse response ) throws ServletException
{
List params = ( List ) request.getAttribute( "FLASH.PARAMS" );
request.setAttribute( "FLASH.RESULT", params );
}
}


And here is my front-end Actionscript (i have moved it in to the webapp folder of the servlet):


#include "NetServices.as"
var service:NetConnection = myConnection.getService( "flashServletExample", this );
service.ServletService( "Hello." );

function showServletResult( result ):Void
{
trace( result );
}


However, i am not seeing any result at all. I would be very grateful if anyone could point out where i might be going wrong.

Thanks in advance.

Regards, snapple :)

snapple
04-16-2005, 05:55 PM
Simple Question:



DOES OPENAMF SUPPORT SERVLET SERVICES ?



Regards, snapple :)

snapple
04-17-2005, 03:10 PM
NO!!!!!!!!!

It ****ing well doesn't :(