Java Code Examples for org.fourthline.cling.model.action.ActionInvocation#getAction()

The following examples show how to use org.fourthline.cling.model.action.ActionInvocation#getAction() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: OutgoingActionRequestMessage.java    From TVRemoteIME with GNU General Public License v2.0 6 votes vote down vote up
public OutgoingActionRequestMessage(ActionInvocation actionInvocation, URL controlURL) {
    this(actionInvocation.getAction(), new UpnpRequest(UpnpRequest.Method.POST, controlURL));

    // For proxy remote invocations, pass through the user agent header
    if (actionInvocation instanceof RemoteActionInvocation) {
        RemoteActionInvocation remoteActionInvocation = (RemoteActionInvocation) actionInvocation;
        if (remoteActionInvocation.getRemoteClientInfo() != null
            && remoteActionInvocation.getRemoteClientInfo().getRequestUserAgent() != null) {
            getHeaders().add(
                UpnpHeader.Type.USER_AGENT,
                new UserAgentHeader(remoteActionInvocation.getRemoteClientInfo().getRequestUserAgent())
            );
        }
    } else if (actionInvocation.getClientInfo() != null) {
        getHeaders().putAll(actionInvocation.getClientInfo().getRequestHeaders());
    }
}
 
Example 2
Source File: OutgoingActionRequestMessage.java    From DroidDLNA with GNU General Public License v3.0 6 votes vote down vote up
public OutgoingActionRequestMessage(ActionInvocation actionInvocation, URL controlURL) {
    this(actionInvocation.getAction(), new UpnpRequest(UpnpRequest.Method.POST, controlURL));

    // For proxy remote invocations, pass through the user agent header
    if (actionInvocation instanceof RemoteActionInvocation) {
        RemoteActionInvocation remoteActionInvocation = (RemoteActionInvocation) actionInvocation;
        if (remoteActionInvocation.getRemoteClientInfo() != null
            && remoteActionInvocation.getRemoteClientInfo().getRequestUserAgent() != null) {
            getHeaders().add(
                UpnpHeader.Type.USER_AGENT,
                new UserAgentHeader(remoteActionInvocation.getRemoteClientInfo().getRequestUserAgent())
            );
        }
    } else if (actionInvocation.getClientInfo() != null) {
        getHeaders().putAll(actionInvocation.getClientInfo().getRequestHeaders());
    }
}