Skip navigation links

Oracle© Fusion Middleware Java API Reference for Oracle ADF Faces
11g Release 1 (11.1.1.7.0)
E10684-08


oracle.adf.view.rich.remote
Class RemoteApplicationRequest

java.lang.Object
  extended by oracle.adf.view.rich.remote.RemoteApplicationRequest

All Implemented Interfaces:
java.io.Serializable

public class RemoteApplicationRequest
extends java.lang.Object
implements java.io.Serializable

This is the request object into the remote application. This object contains all of the information needed to actually execute a remote task flow or other producer logic. <p/> Asside from standard request artifacts (like cookies and headers and whatnot), this Object supports "tasks". Tasks are units of work which can be added to the request on an as-needed basis, and allow information be be exchanged between consumer and producer as well as custom code to be executed. The RegionComponent provides the ability for different pieces of ADF to add tasks to each request by creating these task invocations. The system typically works as follows: <p/> String responseId = remoteApplicationRequest.addTask(MyRemoteTaskHandler.class, param1, param2, param3); RemoteApplicationResponse remoteApplicationResponse = RemoteApplicationUtils.run(remoteApplicationRequest); Object fromHandler = remoteApplicationResponse.getTaskResponse(responseId); <p/> Obviously this is a simplistic usecase, but essentially what happens is the task is added to the remote request. That executes a TaskHandler called MyRemoteTaskHandler on the producer which could do setup with the specified params before the faces lifecycle is run. It can then return a result after the faces lifecycle is run which is then retrieved from the response. It is in this way that the RemoteApplication system can be extended in functionality while allowing the base protocol and framework to remain relatively lean.

See Also:
Serialized Form

Nested Class Summary
static class RemoteApplicationRequest.Operation
          An enumeration of request types.

 

Constructor Summary
RemoteApplicationRequest(RemoteApplication app)
           
RemoteApplicationRequest(RemoteApplication app, RemoteApplicationRequest.Operation operation)
          Constructs a new RemoteApplicationRequest for a particular RemoteApplication.
RemoteApplicationRequest(RemoteApplication app, RemoteApplicationRequest.Operation operation, java.lang.String resource)
          Constructs a new RemoteApplicationRequest with for a particular resource.
RemoteApplicationRequest(RemoteApplication app, java.lang.String resource)
          Constructs a new Execute RemoteApplicationRequest for a particular RemoteApplication.

 

Method Summary
 void addCookie(javax.servlet.http.Cookie cookie)
          Add's a cookie to this request
 void addCookies(java.util.List<? extends javax.servlet.http.Cookie> cookies)
          Adds a list of cookies to this request
 void addHeader(java.lang.String name, java.lang.String value)
          Add's a header to the header map.
 void addHeaders(java.lang.String name, java.lang.String[] values)
          This add's multiple headers with the same name to this request.
 java.lang.String addTask(java.lang.Class<? extends TaskHandler> taskHandler, java.io.Serializable... parameters)
          Adds a task to this request.
 java.lang.String addTask(java.lang.String taskHandler, java.io.Serializable... parameters)
          Adds a task to this request.
 void clearCookies()
          Clears all the stored cookies on this request
 java.util.List<? extends javax.servlet.http.Cookie> getCookies()
          Returns an unmodifiable list of cookies which need to be sent back to to the remote application during this request.
 java.lang.String getHeader(java.lang.String header)
          Returns a single header value.
 java.util.Map<java.lang.String,java.util.List<java.lang.String>> getHeaderMap()
          Returns a map of headers.
 java.util.List<java.lang.String> getHeaderValues(java.lang.String header)
          Returns all of the values of a header.
 java.lang.String getMethod()
          Returns the 'simulated' method of this remote request.
 RemoteApplicationRequest.Operation getOperation()
          Returns the operation which is to be performed by this request.
 java.util.Map<java.lang.String,java.lang.String[]> getParameterMap()
          Returns the parameter map use for this request.
 java.lang.String getQueryString()
          Returns the current query string of this instance.
 RemoteApplication getRemoteApplication()
          Returns the RemoteApplication or the RemoteApplicationInstance used to create this class.
 java.lang.String getResource()
          Returns the resource that should be retrieved by this RemoteApplicationRequest
 java.util.List<TaskInvocation> getTaskInvocations()
          Returns an unmodifiable list of TaskInvocation objects.
 void setMethod(java.lang.String method)
          Sets the 'simulated' request method for this request.
 void setQueryString(java.lang.String queryString)
          Sets the query string of this request.

 

Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait

 

Constructor Detail

RemoteApplicationRequest

public RemoteApplicationRequest(RemoteApplication app)

RemoteApplicationRequest

public RemoteApplicationRequest(RemoteApplication app,
                                java.lang.String resource)
Constructs a new Execute RemoteApplicationRequest for a particular RemoteApplication.
Parameters:
app -

RemoteApplicationRequest

public RemoteApplicationRequest(RemoteApplication app,
                                RemoteApplicationRequest.Operation operation)
Constructs a new RemoteApplicationRequest for a particular RemoteApplication. If a RemoteApplicationInstance is provided, the cookies and query string will be pre-populated into thier respective fields on this request and the subsessionId will be used on the request to the server.
Parameters:
app -

RemoteApplicationRequest

public RemoteApplicationRequest(RemoteApplication app,
                                RemoteApplicationRequest.Operation operation,
                                java.lang.String resource)
Constructs a new RemoteApplicationRequest with for a particular resource.
Parameters:
app -
operation -
resource -
Throws:
java.lang.NullPointerException - is either app or operation is null
java.lang.IllegalArgumentException - if this is a "fetch" operation and resource is null

Method Detail

getRemoteApplication

public RemoteApplication getRemoteApplication()
Returns the RemoteApplication or the RemoteApplicationInstance used to create this class.
Returns:
the RemoteApplication or RemoteApplicationInstance

getOperation

public RemoteApplicationRequest.Operation getOperation()
Returns the operation which is to be performed by this request. Currently there are two types of requests: INVOKE and EXECUTE. The differences between these request types are listed under RemoteApplicationRequest.Operation.
Returns:
the current operation to be performed by this request.

getResource

public java.lang.String getResource()
Returns the resource that should be retrieved by this RemoteApplicationRequest
Returns:

setMethod

public void setMethod(java.lang.String method)
Sets the 'simulated' request method for this request. In the RemoteApplication framework, all requests to a producer are 'post' requests. Some frameworks on the producer side however, like JSF, have different behavior based on whether a request is a post or a get. This method is what is returned from the HttpServletRequest.getMetho() on the producer. Valid methods are: GET, POST, HEAD, OPTIONS, PUT, DELETE, or TRACE. The default is GET.
Parameters:
method - the 'simulated' method of the remote request.

getMethod

public java.lang.String getMethod()
Returns the 'simulated' method of this remote request.
Returns:
the name of the method used.

getCookies

public java.util.List<? extends javax.servlet.http.Cookie> getCookies()
Returns an unmodifiable list of cookies which need to be sent back to to the remote application during this request. These should be appended to the cookies which are stored on the instance and represent per-request cookie state rather then persisted cookie state. <p/> It is important to note that these cookies will be transmitted as real cookies across the HttpRequest, so setting cookies here should be sufficient for interacting with any 'front-end' servers or proxy's which may get the request before it is sent to the final endpoint.
Returns:
a list of Cookies which will be appended

clearCookies

public void clearCookies()
Clears all the stored cookies on this request

addCookie

public void addCookie(javax.servlet.http.Cookie cookie)
Add's a cookie to this request
Parameters:
cookie - the cookie

addCookies

public void addCookies(java.util.List<? extends javax.servlet.http.Cookie> cookies)
Adds a list of cookies to this request
Parameters:
cookies -

setQueryString

public void setQueryString(java.lang.String queryString)
Sets the query string of this request. Generally speaking this querystring overrides any that is specified in the RemoteApplicationInstance. Items in this querystring will automatically be added as parameters to the remote request. TODO: Do we need these to actually be on the URL? I think not, simulating them should be fine
Parameters:
queryString - a valid queryString without the leading "?".

getQueryString

public java.lang.String getQueryString()
Returns the current query string of this instance. The parameters in this queryString will also be added as parameters automatically.
Returns:
a valid queryString or null if there isn't one

getParameterMap

public java.util.Map<java.lang.String,java.lang.String[]> getParameterMap()
Returns the parameter map use for this request. Using this mechanism, the request is able to simulated "post" data. Note: this information will not be xmitted across the wire as post data, but it will appear in the HttpServletRequest as such.
Returns:

getHeaderMap

public java.util.Map<java.lang.String,java.util.List<java.lang.String>> getHeaderMap()
Returns a map of headers. These headers will be transmitted as part of the physical http request, so they will be suitable for interacting with external frameworks like the one used for authorization. The format of this map is kind of strange in that it returns a list of String's for it's value. The reason for this is to support headers that may appear in the HttpRequest more then once. Generally speaking, a the value should be a single value. For more convenient access, there are several convenience methods provided.
Returns:
a Map of headers.

addHeader

public void addHeader(java.lang.String name,
                      java.lang.String value)
Add's a header to the header map. If added before the request is made, this header will be appended to the header of the HTTP Request, making it able to be used with external frameworks which may run before items are dispatched to this webapp. An example of these systems would be authorization-type systems.
Parameters:
name - the name of the header
value - the value of the header

addHeaders

public void addHeaders(java.lang.String name,
                       java.lang.String[] values)
This add's multiple headers with the same name to this request.
Parameters:
name -
values -

getHeader

public java.lang.String getHeader(java.lang.String header)
Returns a single header value. If the header is not present, this function returns null. If the headers are present then the value of the first occurance of this header is returned.
Parameters:
header -
Returns:

getHeaderValues

public java.util.List<java.lang.String> getHeaderValues(java.lang.String header)
Returns all of the values of a header. If there are no values for the header, the header returns an empty list.
Parameters:
header -
Returns:

addTask

public java.lang.String addTask(java.lang.String taskHandler,
                                java.io.Serializable... parameters)
Adds a task to this request. The value returned will be a unique idenifier that will be used to refer to the results returned from this task.
Parameters:
taskHandler - a string representing the classname of the handler being invoked
parameters - a list of parameters
Returns:
a String containing an id that will return the results of this tasks invocation
Throws:
java.lang.UnsupportedOperationException - id this method is not supported for the type of request. Currently "fetch" type requests do not support task execution.

addTask

public java.lang.String addTask(java.lang.Class<? extends TaskHandler> taskHandler,
                                java.io.Serializable... parameters)
Adds a task to this request. The value returned will be a unique idenifier that will be used to refer to the results returned from this task.
Parameters:
taskHandler - a Class representing the classname of the handler being invoked
parameters - a list of parameters
Returns:
a String containing an id that will return the results of this tasks invocation
Throws:
java.lang.UnsupportedOperationException - id this method is not supported for the type of request. Currently "fetch" type requests do not support task execution.

getTaskInvocations

public java.util.List<TaskInvocation> getTaskInvocations()
Returns an unmodifiable list of TaskInvocation objects.
Returns:
a list of invocations for the current request

Skip navigation links

Oracle© Fusion Middleware Java API Reference for Oracle ADF Faces
11g Release 1 (11.1.1.7.0)
E10684-08


Copyright (c) 1998, 2013, Oracle and/or its affiliates. All rights reserved.