Request request = new Request(Code.GET); request.setURI("coap://example.com:5683/sensors/temperature"); request.setObserve(); request.addMessageObserver(new MessageObserverAdapter() { public void responded(Response response) { if (response.getCode() == ResponseCode.CONTENT) { System.out.println("Received " + response.getPayloadString()); } else { // error handling } } }); request.send();We can also modify the options of a request. For example:
Request post = new Request(Code.POST); post.setPayload("Plain text"); post.getOptions() .setContentFormat(MediaTypeRegistry.TEXT_PLAIN) .setAccept(MediaTypeRegistry.TEXT_PLAIN) .setIfNoneMatch(true); String response = post.send().waitForResponse().getPayloadString();@see Response
This class is only intended for internal use inside the AWS client libraries. Callers shouldn't ever interact directly with objects of this class. @param < T> The type of original, user facing request represented by this request.
{@link Request} represents a HTTP request, and offers a fluent interface to customizevarious attributes such as the path, the headers, the content, etc.
You can create {@link Request} objects via {@link HttpClient#newRequest(String)} andyou can send them using either {@link #send()} for a blocking semantic, or{@link #send(Response.CompleteListener)} for an asynchronous semantic.
@see Responsecom.google.gwt.http.HTTP
. {@gwt.include com/google/gwt/examples/http/InheritsExample.gwt.xml}
The static method parse() is responsible for creating this object. @author Mark Reinhold @author Brad R. Wetmore @version 1.3, 05/11/17
Warning: This is a facade provided for use by user code, not for implementation by user code. User implementations of this interface are highly likely to be incompatible with future releases of the product at both binary and source levels.
@mock.generateThe static method parse() is responsible for creating this object. @author Mark Reinhold @author Brad R. Wetmore @version 1.3, 05/11/17
ServletRequest
that is to be processed, in order to produce the corresponding Response
.
@author Craig R. McClanahan
@version $Revision: 466595 $ $Date: 2006-10-21 23:24:41 +0100 (Sat, 21 Oct 2006) $
Request r = new RequestBuilder().setUrl("url") .setRealm((new Realm.RealmBuilder()).setPrincipal(user) .setPassword(admin) .setRealmName("MyRealm") .setScheme(Realm.AuthScheme.DIGEST).build());
{@link Request} represents a HTTP request, and offers a fluent interface to customizevarious attributes such as the path, the headers, the content, etc.
You can create {@link Request} objects via {@link HttpClient#newRequest(String)} andyou can send them using either {@link #send()} for a blocking semantic, or{@link #send(Response.CompleteListener)} for an asynchronous semantic.
@see Response Implements {@link javax.servlet.http.HttpServletRequest} from the javax.servlet.http
package.
The standard interface of mostly getters, is extended with setters so that the request is mutable by the handlers that it is passed to. This allows the request object to be as lightweight as possible and not actually implement any significant behavior. For example
org.eclipse.jetty.servlet.ServletHandler
and the pathInfo matched against the servlet URL patterns and {@link Request#setServletPath(String)} called as a result.The form content that a request can process is limited to protect from Denial of Service attacks. The size in bytes is limited by {@link ContextHandler#getMaxFormContentSize()} or if there is no context then the "org.eclipse.jetty.server.Request.maxFormContentSize" {@link Server}attribute. The number of parameters keys is limited by {@link ContextHandler#getMaxFormKeys()} or if there is no context then the"org.eclipse.jetty.server.Request.maxFormKeys" {@link Server} attribute.
Note: This class/interface is part of an interim API that is still under development and expected to change significantly before reaching stability. It is being made available at this early stage to solicit feedback from pioneering adopters on the understanding that any code that uses this API will almost certainly be broken (repeatedly) as the API evolves.
Request
wraps all of the information needed to invoke a method on a remote object.
@author Tim Anderson
@version $Revision: 1.3 $ $Date: 2005/04/14 15:08:06 $
@see Response
@see Connection
Database compatible workgroup request information.
@author Derek DeMoroRequest
is an abstract description of tests to be run. Older versions of JUnit did not need such a concept--tests to be run were described either by classes containing tests or a tree of {@link org.junit.Test}s. However, we want to support filtering and sorting, so we need a more abstract specification than the tests themselves and a richer specification than just the classes. The flow when JUnit runs tests is that a Request
specifies some tests to be run -> a {@link org.junit.runner.Runner} is created for each class implied by the Request
->the {@link org.junit.runner.Runner} returns a detailed {@link org.junit.runner.Description}which is a tree structure of the tests to be run.
@since 4.0
Implements {@link javax.servlet.HttpServletRequest} from the {@link javax.servlet} package.
The standard interface of mostly getters, is extended with setters so that the request is mutable by the handlers that it is passed to. This allows the request object to be as lightweight as possible and not actually implement any significant behaviour. For example
Request
objects behave.
Request
is used to provide an interface to the HTTP entity body and message header. This provides methods that allow the entity body to be acquired as a stream, string, or if the message is a multipart encoded body, then the individual parts of the request body can be acquired. This can also maintain data during the request lifecycle as well as the session lifecycle. A Session
is made available for convenience. It provides a means for the services to associate data with a given client session, which can be retrieved when there are subsequent requests sent to the server.
It is important to note that the entity body can be read multiple times from the request. Calling getInputStream
will start reading from the first byte in the body regardless of the number of times it is called. This allows POST parameters as well as multipart bodies to be read from the stream if desired.
@author Niall Gallagher
Also provides access to the HttpRequest that spawned this GeoServer Request. This HttpRequest is most often used to lookup information stored in the Web Container (such as the GeoServer Global information).
@author Rob Hranac, TOPP @author Chris Holmes, TOPP @author Gabriel Roldan @author $Author: Alessio Fabiani (alessio.fabiani@gmail.com) $ (last modification) @author $Author: Simone Giannecchini (simboss1@gmail.com) $ (last modification) @version $Id: Request.java 11513 2009-03-01 04:39:08Z groldan $Provides a set of accessor functions to fetch the individual fields of the HTTP request.
Utility methods that are generically useful for manipulating HTTP requests are included here as well. An instance of this class is passed to handlers. There will be exactly one request object per thead at any time.
The fields {@link #headers}, {@link #query}, and {@link #url}, and the method {@link #getQueryData()}are most often used to examine the content of the request. The field {@link #props}contains information about the server, or up-stream handlers.
The methods {@link #sendResponse(String,String,int)} and{@link Request#sendError(int,String)}are commonly used to return content to the client. The methods {@link #addHeader(String)} and{@link #setStatus(int)} can be used to modify the response headersand return code respectively before the response is sent.
Many of the other methods are used internally, but can be useful to handlers that need finer control over the output that the above methods provide. Note that the order of the methods is important. For instance, the user cannot change the HTTP response headers (by calling the addHeader
method or by modifying the responseHeaders
field) after having already sent an HTTP response.
A number of the fields in the Request
object are public, by design. Many of the methods are convenience methods; the underlying data fields are meant to be accessed for more complicated operations, such as changing the URL or deleting HTTP response headers.
@see Handler
@see Server
@author Stephen Uhler (stephen.uhler@sun.com)
@author Colin Stevens (colin.stevens@sun.com)
@version 2.6
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|