org.cybergarage.upnp.control.ActionRequest Maven / Gradle / Ivy
/******************************************************************
*
* CyberUPnP for Java
*
* Copyright (C) Satoshi Konno 2002
*
* File: ControlRequest.java
*
* Revision;
*
* 01/29/03
* - first revision.
* 05/09/05
* - Changed getActionName() to return when the delimiter is not found.
*
******************************************************************/
package org.cybergarage.upnp.control;
import org.cybergarage.http.*;
import org.cybergarage.xml.*;
import org.cybergarage.soap.*;
import org.cybergarage.upnp.*;
public class ActionRequest extends ControlRequest
{
////////////////////////////////////////////////
// Constructor
////////////////////////////////////////////////
public ActionRequest()
{
}
public ActionRequest(HTTPRequest httpReq)
{
set(httpReq);
}
////////////////////////////////////////////////
// Action
////////////////////////////////////////////////
public Node getActionNode()
{
Node bodyNode = getBodyNode();
if (bodyNode == null)
return null;
if (bodyNode.hasNodes() == false)
return null;
return bodyNode.getNode(0);
}
public String getActionName()
{
Node node = getActionNode();
if (node == null)
return "";
String name = node.getName();
if (name == null)
return "";
int idx = name.indexOf(SOAP.DELIM)+1;
if (idx < 0)
return "";
return name.substring(idx, name.length());
}
public ArgumentList getArgumentList()
{
Node actNode = getActionNode();
int nArgNodes = actNode.getNNodes();
ArgumentList argList = new ArgumentList();
for (int n=0; n