Class ShareRequestEvent

java.lang.Object
de.craftsblock.craftscore.event.Event
de.craftsblock.craftscore.event.CancellableEvent
de.craftsblock.craftsnet.events.EventWithCancelReason
de.craftsblock.craftsnet.events.requests.shares.ShareRequestEvent
All Implemented Interfaces:
de.craftsblock.craftscore.event.Cancellable, GenericRequestEventBase

public class ShareRequestEvent extends EventWithCancelReason implements GenericRequestEventBase
Represents an event that is triggered when a share request is made. This event can be canceled to prevent the share request from being processed.
Since:
2.3.2-SNAPSHOT
See Also:
  • Constructor Details

    • ShareRequestEvent

      public ShareRequestEvent(@NotNull @NotNull String httpPath, @NotNull @NotNull String filePath, @NotNull @NotNull Exchange exchange, @NotNull RouteRegistry.ShareMapping mapping)
      Creates a new ShareRequestEvent with the specified path.
      Parameters:
      httpPath - The url used to access the share
      filePath - The relativ path on the file system
      exchange - The exchange used by the share to handle its connection
      mapping - The share mapping of the request
  • Method Details

    • getExchange

      @NotNull public @NotNull Exchange getExchange()
      Gets the Exchange which stores the involved request, response and some other data.
      Specified by:
      getExchange in interface GenericRequestEventBase
      Returns:
      The Exchange.
    • getMapping

      public RouteRegistry.ShareMapping getMapping()
      Gets the share mapping, which includes some basic information about the share.
      Returns:
      The mapping of the share
    • getFilePath

      @NotNull public @NotNull String getFilePath()
      Gets the relativ path on the file system associated with the share request.
      Returns:
      The relativ path on file system the for the share request.
    • setFilePath

      public void setFilePath(@NotNull @NotNull String path)
      Sets the relativ path on the file system associated with the share request.
      Parameters:
      path - The new path for the share request.
    • getHttpPath

      @NotNull public @NotNull String getHttpPath()
      Gets the url that is used to access the share
      Returns:
      The url which is used to access the share
    • getHeaders

      @Deprecated(forRemoval=true, since="3.4.0-SNAPSHOT") public Headers getHeaders()
      Deprecated, for removal: This API element is subject to removal in a future version.
      Gets the headers for this response.
      Returns:
      Returns the header object
    • addHeader

      @Deprecated(forRemoval=true, since="3.4.0-SNAPSHOT") public void addHeader(String key, String value)
      Deprecated, for removal: This API element is subject to removal in a future version.
      Adds a value for the specified header to the response.
      Parameters:
      key - The "name" of the header
      value - The value of the header
    • setHeader

      @Deprecated(forRemoval=true, since="3.4.0-SNAPSHOT") public void setHeader(String key, String value)
      Deprecated, for removal: This API element is subject to removal in a future version.
      Set the header with the specified key and value to this Request.
      Parameters:
      key - The "name" of the header
      value - The value which should override the value of the header if it exists already, otherwise just adds the value to the header.
    • getHeader

      @Deprecated(forRemoval=true, since="3.4.0-SNAPSHOT") public List<String> getHeader(String key)
      Deprecated, for removal: This API element is subject to removal in a future version.
      Get all the values from the response headers for the specified header name.
      Parameters:
      key - The "name" of the header used to find the header
      Returns:
      A list of alle the values
    • hasHeader

      @Deprecated(forRemoval=true, since="3.4.0-SNAPSHOT") public boolean hasHeader(String key)
      Deprecated, for removal: This API element is subject to removal in a future version.
      Checks if a response header was set
      Parameters:
      key - The "name" of the header which should be checked if it is present
      Returns:
      true if the header is set, false otherwise