func (r *Request) SetAttribute(name string, value interface{}) {
	r.attributes[name] = value
}
SetAttribute adds or replaces the attribute with the given value.
package restful
import (
	"bytes"
	"compress/zlib"
	"io/ioutil"
	"net/http"
)
var defaultRequestContentType string
var doCacheReadEntityBytes = true
type Request struct {
	Request           *http.Request
	bodyContent       *[]byte  
	pathParameters    map[string]string
	attributes        map[string]interface{}  
	selectedRoutePath string                  
}
func NewRequest(httpRequest *http.Request) *Request {
	return &Request{
		Request:        httpRequest,
		pathParameters: map[string]string{},
		attributes:     map[string]interface{}{},
	}  
}
func DefaultRequestContentType(mime string) {
	defaultRequestContentType = mime
}
func SetCacheReadEntity(doCache bool) {
	doCacheReadEntityBytes = doCache
}
func (r *Request) PathParameter(name string) string {
	return r.pathParameters[name]
}
func (r *Request) PathParameters() map[string]string {
	return r.pathParameters
}
func (r *Request) QueryParameter(name string) string {
	return r.Request.FormValue(name)
}
func (r *Request) BodyParameter(name string) (string, error) {
	err := r.Request.ParseForm()
	if err != nil {
		return "", err
	}
	return r.Request.PostFormValue(name), nil
}
func (r *Request) HeaderParameter(name string) string {
	return r.Request.Header.Get(name)
}
func (r *Request) ReadEntity(entityPointer interface{}) (err error) {
	contentType := r.Request.Header.Get(HEADER_ContentType)
	contentEncoding := r.Request.Header.Get(HEADER_ContentEncoding)
	if doCacheReadEntityBytes {
		if r.bodyContent == nil {
			data, err := ioutil.ReadAll(r.Request.Body)
			if err != nil {
				return err
			}
			r.bodyContent = &data
		}
		r.Request.Body = ioutil.NopCloser(bytes.NewReader(*r.bodyContent))
	}
	if ENCODING_GZIP == contentEncoding {
		gzipReader := currentCompressorProvider.AcquireGzipReader()
		defer currentCompressorProvider.ReleaseGzipReader(gzipReader)
		gzipReader.Reset(r.Request.Body)
		r.Request.Body = gzipReader
	} else if ENCODING_DEFLATE == contentEncoding {
		zlibReader, err := zlib.NewReader(r.Request.Body)
		if err != nil {
			return err
		}
		r.Request.Body = zlibReader
	}
	entityReader, ok := entityAccessRegistry.accessorAt(contentType)
	if !ok {
		return NewError(http.StatusBadRequest, "Unable to unmarshal content of type:"+contentType)
	}
	return entityReader.Read(r, entityPointer)
}