Ejemplo n.º 1
0
        /// <summary>
        /// Validates the specified AtomPub request.
        /// </summary>
        /// <param name="context">An instance of HttpContext containing the request details.</param>
        /// <param name="errorMessage">An error message describing the reason if validation is failed.</param>
        /// <returns>True if the request is valid, otherwise false.</returns>
        public bool ValidateRequest(HttpContext context, out string errorMessage)
        {
            string httpRequestType = context.Request.RequestType.ToUpperInvariant();

            // Verify request type is GET, PUT, POST, DELETE
            if (!(PlatformConstants.GetRequestType == httpRequestType ||
                  PlatformConstants.PutRequestType == httpRequestType ||
                  PlatformConstants.PostRequestType == httpRequestType ||
                  PlatformConstants.DeleteRequestType == httpRequestType))
            {
                errorMessage = Resources.ATOMPUB_INVALID_METHOD;
                return(false);
            }

            Uri baseUri = new Uri(AtomPubHelper.GetBaseUri());
            AtomPubRequestType requestType = AtomPubHelper.GetAtomPubRequestType(context, baseUri);
            bool isValidRequest            = AtomPubRequestType.Unknwon != requestType;

            errorMessage = (isValidRequest) ? string.Empty : Resources.ATOMPUB_BAD_REQUEST;
            return(isValidRequest);
        }
Ejemplo n.º 2
0
 /// <summary>
 /// Initializes a new instance of the <see cref="AtomPubGetProcessor"/> class.
 /// </summary>
 public AtomPubGetProcessor()
     : this(AtomPubHelper.GetBaseUri())
 {
 }
Ejemplo n.º 3
0
 /// <summary>
 /// Initializes a new instance of the <see cref="ZentityAtomPubStoreWriter"/> class.
 /// </summary>
 public ZentityAtomPubStoreWriter()
     : this(AtomPubHelper.GetBaseUri())
 {
 }