net.csdn.modules.mock
Class MockRestRequest

java.lang.Object
  extended by net.csdn.modules.mock.MockRestRequest
All Implemented Interfaces:
RestRequest

public class MockRestRequest
extends Object
implements RestRequest

User: WilliamZhu Date: 12-7-5 Time: 下午5:12


Nested Class Summary
 
Nested classes/interfaces inherited from interface net.csdn.modules.http.RestRequest
RestRequest.Method
 
Constructor Summary
MockRestRequest(Map<String,String> params, RestRequest.Method method, String bodyContentNotForm)
           
MockRestRequest(String path, Map<String,String> params, RestRequest.Method requestMethod, String bodyContentNotForm)
           
 
Method Summary
 String contentAsString()
           
 byte[] contentByteArray()
           
 int contentByteArrayOffset()
           
 int contentLength()
           
 boolean contentUnsafe()
          Is the byte array write safe or unsafe for usage on other threads
 String cookie(String name)
           
 Object flash(String key)
           
 void flash(String key, Object value)
           
 boolean hasContent()
           
 boolean hasParam(String key)
           
 String header(String name)
           
 RestRequest.Method method()
           
 String param(String key)
           
 String param(String key, String defaultValue)
           
 boolean paramAsBoolean(String key, boolean defaultValue)
           
 Boolean paramAsBoolean(String key, Boolean defaultValue)
           
 float paramAsFloat(String key, float defaultValue)
           
 int paramAsInt(String key, int defaultValue)
           
 long paramAsLong(String key, long defaultValue)
           
 net.csdn.common.unit.ByteSizeValue paramAsSize(String key, net.csdn.common.unit.ByteSizeValue defaultValue)
           
 String[] paramAsStringArray(String key, String[] defaultValue)
           
 net.csdn.common.unit.TimeValue paramAsTime(String key, net.csdn.common.unit.TimeValue defaultValue)
           
 String paramMultiKey(String... keys)
           
 Map<String,String> params()
           
 String path()
          The path part of the URI (without the query string), decoded.
 String queryString()
           
 String rawPath()
          The non decoded, raw path provided.
 Object session(String key)
           
 void session(String key, Object value)
           
 String uri()
          The uri of the rest request, with the query string.
 String url()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

MockRestRequest

public MockRestRequest(Map<String,String> params,
                       RestRequest.Method method,
                       String bodyContentNotForm)

MockRestRequest

public MockRestRequest(String path,
                       Map<String,String> params,
                       RestRequest.Method requestMethod,
                       String bodyContentNotForm)
Method Detail

method

public RestRequest.Method method()
Specified by:
method in interface RestRequest

uri

public String uri()
Description copied from interface: RestRequest
The uri of the rest request, with the query string.

Specified by:
uri in interface RestRequest

rawPath

public String rawPath()
Description copied from interface: RestRequest
The non decoded, raw path provided.

Specified by:
rawPath in interface RestRequest

url

public String url()
Specified by:
url in interface RestRequest

queryString

public String queryString()
Specified by:
queryString in interface RestRequest

hasContent

public boolean hasContent()
Specified by:
hasContent in interface RestRequest

contentUnsafe

public boolean contentUnsafe()
Description copied from interface: RestRequest
Is the byte array write safe or unsafe for usage on other threads

Specified by:
contentUnsafe in interface RestRequest

contentByteArray

public byte[] contentByteArray()
Specified by:
contentByteArray in interface RestRequest

contentByteArrayOffset

public int contentByteArrayOffset()
Specified by:
contentByteArrayOffset in interface RestRequest

contentLength

public int contentLength()
Specified by:
contentLength in interface RestRequest

contentAsString

public String contentAsString()
Specified by:
contentAsString in interface RestRequest

header

public String header(String name)
Specified by:
header in interface RestRequest

params

public Map<String,String> params()
Specified by:
params in interface RestRequest

cookie

public String cookie(String name)
Specified by:
cookie in interface RestRequest

session

public Object session(String key)
Specified by:
session in interface RestRequest

session

public void session(String key,
                    Object value)
Specified by:
session in interface RestRequest

flash

public Object flash(String key)
Specified by:
flash in interface RestRequest

flash

public void flash(String key,
                  Object value)
Specified by:
flash in interface RestRequest

hasParam

public boolean hasParam(String key)
Specified by:
hasParam in interface RestRequest

param

public String param(String key)
Specified by:
param in interface RestRequest

paramMultiKey

public String paramMultiKey(String... keys)
Specified by:
paramMultiKey in interface RestRequest

param

public String param(String key,
                    String defaultValue)
Specified by:
param in interface RestRequest

path

public final String path()
Description copied from interface: RestRequest
The path part of the URI (without the query string), decoded.

Specified by:
path in interface RestRequest

paramAsFloat

public float paramAsFloat(String key,
                          float defaultValue)
Specified by:
paramAsFloat in interface RestRequest

paramAsInt

public int paramAsInt(String key,
                      int defaultValue)
Specified by:
paramAsInt in interface RestRequest

paramAsLong

public long paramAsLong(String key,
                        long defaultValue)
Specified by:
paramAsLong in interface RestRequest

paramAsBoolean

public boolean paramAsBoolean(String key,
                              boolean defaultValue)
Specified by:
paramAsBoolean in interface RestRequest

paramAsBoolean

public Boolean paramAsBoolean(String key,
                              Boolean defaultValue)
Specified by:
paramAsBoolean in interface RestRequest

paramAsTime

public net.csdn.common.unit.TimeValue paramAsTime(String key,
                                                  net.csdn.common.unit.TimeValue defaultValue)
Specified by:
paramAsTime in interface RestRequest

paramAsSize

public net.csdn.common.unit.ByteSizeValue paramAsSize(String key,
                                                      net.csdn.common.unit.ByteSizeValue defaultValue)
Specified by:
paramAsSize in interface RestRequest

paramAsStringArray

public String[] paramAsStringArray(String key,
                                   String[] defaultValue)
Specified by:
paramAsStringArray in interface RestRequest


Copyright © 2014. All Rights Reserved.