Logic
Prev | Chapter 6. HTTP File Upload component | Next

## Logic

Logic is responsible for generation of URI and applying limits. It groups all configuration settings related to allocation of slots, etc.

Available properties:

local-only
  Allow only users with accounts on the local XMPP server to use this component for slot allocation. (default: true)
max-file-size
  Set maximum size of a single allocated slot (maximum file size) in bytes. (default: 5000)
port
  Specifies the port which should be used in generating the upload and download URI. If it is not set, then secured (HTTPS) server port will be used if available, and plain HTTP in other case. (default: not set)
protocol

  Protocol which should be used. This is only used in conjunction with `port`. Possible values are:

  - http
  - https
serverName
  Server name to use as domain part in generated URI. (default: server hostname)
upload-uri-format
  Template used in generation of URI for file upload. (default: `{proto}://{serverName}:{port}/upload/{userJid}/{slotId}/{filename}`)
download-uri-format
  Template used in generation of URI for file download. (default: `{proto}://{serverName}:{port}/upload/{slotId}/{filename}`)

### URI template format

Every block in the template between `{` and `}` is a named part which will be replaced by the property value during generation of URI for slot.

Blocks possible to use:

proto
  Name of protocol.
serverName
  Domain name of server.
port
  Port on which HTTPS (or HTTP) server is listening.
userJid
  JID of user requesting slot allocation.
domain
  Domain of user requesting slot allocation.
slotId
  Generated ID of slot.
filename
  Name of file to upload.

### Note

`slotId` and `filename` are required to be part of every URI template.

### Warning

Inclusion of `userJid` or `domain` will speed up the lookup for slot id during upload and download operation if more than one metadata repository is configured. However, this may lead to leak of user JID or user domain if message with URI containing this part will be send to recipient which is unaware of the senders' JID (ie. in case of anonymous MUC room).

Prev | Up | Next
Storage | Home | File upload expiration