Class MongoRequestContentInjector

java.lang.Object
org.restheart.exchange.MongoRequestContentInjector

public class MongoRequestContentInjector extends Object
Injects the request content to MongoRequest also check the Content-Type header in case the content is not empty
Author:
Andrea Di Cesare <andrea@softinstigate.com>
  • Constructor Summary

    Constructors
    Constructor
    Description
     
  • Method Summary

    Modifier and Type
    Method
    Description
    static String
    checkReservedId(org.bson.BsonValue content)
    Checks the _id in POST requests; it cannot be a string having a special meaning e.g _null, since the URI /db/coll/_null refers to the document with _id: null
    protected static org.bson.BsonDocument
    extractMetadata(io.undertow.server.handlers.form.FormData formData)
    Search the request for a field named 'metadata' (or 'properties') which must contain valid JSON
    static org.bson.BsonValue
    inject(io.undertow.server.HttpServerExchange exchange)
     

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Constructor Details

    • MongoRequestContentInjector

      public MongoRequestContentInjector()
  • Method Details

    • checkReservedId

      public static String checkReservedId(org.bson.BsonValue content)
      Checks the _id in POST requests; it cannot be a string having a special meaning e.g _null, since the URI /db/coll/_null refers to the document with _id: null
      Parameters:
      content -
      Returns:
      null if ok, or the first not valid id
    • extractMetadata

      protected static org.bson.BsonDocument extractMetadata(io.undertow.server.handlers.form.FormData formData) throws BadRequestException
      Search the request for a field named 'metadata' (or 'properties') which must contain valid JSON
      Parameters:
      formData -
      Returns:
      the parsed BsonDocument from the form data or an empty BsonDocument
      Throws:
      BadRequestException
    • inject

      public static org.bson.BsonValue inject(io.undertow.server.HttpServerExchange exchange) throws BadRequestException, IOException
      Parameters:
      exchange -
      Returns:
      the parsed bson
      Throws:
      BadRequestException
      IOException