org.mmbase.servlet
Class remoteXML
java.lang.Object
|
+--javax.servlet.GenericServlet
|
+--javax.servlet.http.HttpServlet
|
+--org.mmbase.servlet.JamesServlet
|
+--org.mmbase.servlet.remoteXML
- All Implemented Interfaces:
- java.io.Serializable, javax.servlet.Servlet, javax.servlet.ServletConfig
- public class remoteXML
- extends JamesServlet
The remoteXML Servlet serves GET requests coming from remotebuilders
and POST requests coming both remotebuilders and mmservers.
Remotebuilder requests can come from a cdplayer that wants to update itself or wants to send
itself (eg. after statechange) to mmbase, inwhich mmbase merges and commits it.
The servletname is called remoteXML.db
- An incoming GET request looks like:
"/remoteXML.db?builderTypeName+serviceName+http+hostname+portnr GET"
The buildertypename eg. cdplayers, serviceName(cdplayersnode.name) eg. CDROM-1
- An incoming POST request looks like: "/remoteXML.db POST"
All incoming requests are checked for the shared secret key before handling them.
- Version:
- $Revision: 1.24 $ $Date: 2001/07/02 16:43:08 $
- See Also:
- Serialized Form
|
Method Summary |
boolean |
commitXML(java.lang.String xml,
javax.servlet.http.HttpServletRequest req)
Checks what node is being posted and tries to find it in mmbase. |
java.util.Hashtable |
getXMLValues(java.lang.String body)
Gets the node fields and values from the xml string, and saves them as an
hastable. |
void |
init()
Initializing mmbase root variable and get mmbaseCop. |
int |
insertRemoteBuilderNode(ServiceBuilder serviceBuilder,
java.lang.String builderName,
java.lang.String nodeName,
java.lang.String remoteUrl)
Searches mmserver object representing the remoteserver from which the GET/POST request comes,
and adds the remotebuilder node as a servicebuilder node to mmbase. |
void |
service(javax.servlet.http.HttpServletRequest req,
javax.servlet.http.HttpServletResponse res)
Checks all incoming requests and validates it wich shared secret before handling. |
| Methods inherited from class org.mmbase.servlet.JamesServlet |
debug, decRefCount, finalize, getAddress, getAuthorization, getAuthorization, getCookie, getInitParameters, getModule, getParam, getParamVector, getProperties, getProperty, getRequestURL, incRefCount, init, isInternalVPROAddress |
| Methods inherited from class javax.servlet.http.HttpServlet |
doDelete, doGet, doOptions, doPost, doPut, doTrace, getLastModified, service |
| Methods inherited from class javax.servlet.GenericServlet |
destroy, getInitParameter, getInitParameterNames, getServletConfig, getServletContext, getServletInfo, getServletName, log, log |
| Methods inherited from class java.lang.Object |
clone, equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
remoteXML
public remoteXML()
init
public void init()
- Initializing mmbase root variable and get mmbaseCop.
- Overrides:
init in class javax.servlet.GenericServlet
service
public void service(javax.servlet.http.HttpServletRequest req,
javax.servlet.http.HttpServletResponse res)
throws javax.servlet.ServletException,
java.io.IOException
- Checks all incoming requests and validates it wich shared secret before handling.
- Overrides:
service in class javax.servlet.http.HttpServlet
- Parameters:
req - the current HttpServletRequestres - the current HttpServletResponse
insertRemoteBuilderNode
public int insertRemoteBuilderNode(ServiceBuilder serviceBuilder,
java.lang.String builderName,
java.lang.String nodeName,
java.lang.String remoteUrl)
- Searches mmserver object representing the remoteserver from which the GET/POST request comes,
and adds the remotebuilder node as a servicebuilder node to mmbase.
MMServer search is done using remotebuilder serverUrl as host fieldname.
- Parameters:
serviceBuilder - a serviceBuilder reference.builderName - the name of the remotebuilder type.nodeName - the name of the new node that needs to be added.remoteUrl - the url of the remoteserver that sent the request.- Returns:
- true when insert succeeds; false otherwise.
commitXML
public boolean commitXML(java.lang.String xml,
javax.servlet.http.HttpServletRequest req)
- Checks what node is being posted and tries to find it in mmbase. If it can be found,
the posted node will be merged . If it can't be found it will be inserted in mmbase but only if
this node is of type ServiceBuilder, otherwise post will be canceled.
- Parameters:
xml - posted node in xml.req - the HttpServletRequest.- Returns:
- true when posted node is merged, false otherwise.
getXMLValues
public java.util.Hashtable getXMLValues(java.lang.String body)
- Gets the node fields and values from the xml string, and saves them as an
hastable.
- Parameters:
body - String with node in XML form.- Returns:
- the node as Hashtable
MMBase 2001