org.geomajas.dojo.server.servlet
Class JsonServlet

java.lang.Object
  extended by javax.servlet.GenericServlet
      extended by javax.servlet.http.HttpServlet
          extended by org.geomajas.dojo.server.servlet.JsonServlet
All Implemented Interfaces:
com.metaparadigm.jsonrpc.ErrorInvocationCallback, com.metaparadigm.jsonrpc.InvocationCallback, Serializable, EventListener, javax.servlet.Servlet, javax.servlet.ServletConfig, org.springframework.context.ApplicationListener<org.springframework.context.event.ContextRefreshedEvent>

public class JsonServlet
extends javax.servlet.http.HttpServlet
implements com.metaparadigm.jsonrpc.ErrorInvocationCallback, org.springframework.context.ApplicationListener<org.springframework.context.event.ContextRefreshedEvent>

This servlet handles JSON-RPC requests over HTTP and hands them to a JSONRPCBridge instance registered in the HttpSession.

By default, the GGISJSONServlet places an instance of the JSONRPCBridge object is automatically in the HttpSession object registered under the attribute "JSONRPCBridge".

The following can be added to your web.xml to export the servlet under the URI "/JSON-RPC"

<servlet> <servlet-name>com.metaparadigm.jsonrpc.JSONRPCServlet</servlet-name> <servlet-class>com.metaparadigm.jsonrpc.JSONRPCServlet</servlet-class> </servlet> <servlet-mapping> <servlet-name>com.metaparadigm.jsonrpc.JSONRPCServlet</servlet-name> <url-pattern>/JSON-RPC</url-pattern> </servlet-mapping>

Author:
Jan De Moerloose, Pieter De Graef, Joachim Van der Auwera
See Also:
Serialized Form

Constructor Summary
JsonServlet()
           
 
Method Summary
 void init(javax.servlet.ServletConfig config)
           
 void invocationError(Object context, Object instance, Method method, Throwable error)
           
 void onApplicationEvent(org.springframework.context.event.ContextRefreshedEvent event)
           
 void postInvoke(Object context, Object instance, Method method, Object result)
           
 void preInvoke(Object context, Object instance, Method method, Object[] arguments)
           
 void service(javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response)
           
 
Methods inherited from class javax.servlet.http.HttpServlet
doDelete, doGet, doHead, doOptions, doPost, doPut, doTrace, getLastModified, service
 
Methods inherited from class javax.servlet.GenericServlet
destroy, getInitParameter, getInitParameterNames, getServletConfig, getServletContext, getServletInfo, getServletName, init, log, log
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

JsonServlet

public JsonServlet()
Method Detail

init

public void init(javax.servlet.ServletConfig config)
          throws javax.servlet.ServletException
Specified by:
init in interface javax.servlet.Servlet
Overrides:
init in class javax.servlet.GenericServlet
Throws:
javax.servlet.ServletException

onApplicationEvent

public void onApplicationEvent(org.springframework.context.event.ContextRefreshedEvent event)
Specified by:
onApplicationEvent in interface org.springframework.context.ApplicationListener<org.springframework.context.event.ContextRefreshedEvent>

service

public void service(javax.servlet.http.HttpServletRequest request,
                    javax.servlet.http.HttpServletResponse response)
             throws IOException
Overrides:
service in class javax.servlet.http.HttpServlet
Throws:
IOException

postInvoke

public void postInvoke(Object context,
                       Object instance,
                       Method method,
                       Object result)
                throws Exception
Specified by:
postInvoke in interface com.metaparadigm.jsonrpc.InvocationCallback
Throws:
Exception

preInvoke

public void preInvoke(Object context,
                      Object instance,
                      Method method,
                      Object[] arguments)
               throws Exception
Specified by:
preInvoke in interface com.metaparadigm.jsonrpc.InvocationCallback
Throws:
Exception

invocationError

public void invocationError(Object context,
                            Object instance,
                            Method method,
                            Throwable error)
Specified by:
invocationError in interface com.metaparadigm.jsonrpc.ErrorInvocationCallback


Copyright © 2010 Geosparc. All Rights Reserved.