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
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 Summary
ConstructorsConstructorDescriptionShareRequestEvent(@NotNull String httpPath, @NotNull String filePath, @NotNull Exchange exchange, RouteRegistry.ShareMapping mapping) Creates a new ShareRequestEvent with the specified path. -
Method Summary
Modifier and TypeMethodDescriptionvoidDeprecated, for removal: This API element is subject to removal in a future version.@NotNull ExchangeGets theExchangewhich stores the involved request, response and some other data.@NotNull StringGets the relativ path on the file system associated with the share request.Deprecated, for removal: This API element is subject to removal in a future version.UseResponse.getHeaders(String)instead.Deprecated, for removal: This API element is subject to removal in a future version.UseResponse.getHeaders()instead.@NotNull StringGets the url that is used to access the shareGets the share mapping, which includes some basic information about the share.booleanDeprecated, for removal: This API element is subject to removal in a future version.UseResponse.hasHeader(String)instead.voidsetFilePath(@NotNull String path) Sets the relativ path on the file system associated with the share request.voidDeprecated, for removal: This API element is subject to removal in a future version.UseResponse.setHeader(String, String)instead.Methods inherited from class de.craftsblock.craftsnet.events.EventWithCancelReason
getCancelReason, hasCancelReason, setCancelReasonMethods inherited from class de.craftsblock.craftscore.event.CancellableEvent
isCancelled, setCancelledMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface de.craftsblock.craftsnet.events.requests.GenericRequestEventBase
getRequest, getResponse
-
Constructor Details
-
Method Details
-
getExchange
Gets theExchangewhich stores the involved request, response and some other data.- Specified by:
getExchangein interfaceGenericRequestEventBase- Returns:
- The
Exchange.
-
getMapping
Gets the share mapping, which includes some basic information about the share.- Returns:
- The mapping of the share
-
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
Sets the relativ path on the file system associated with the share request.- Parameters:
path- The new path for the share request.
-
getHttpPath
Gets the url that is used to access the share- Returns:
- The url which is used to access the share
-
getHeaders
Deprecated, for removal: This API element is subject to removal in a future version.UseResponse.getHeaders()instead.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.UseResponse.addHeader(String, String)instead.Adds a value for the specified header to the response.- Parameters:
key- The "name" of the headervalue- 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.UseResponse.setHeader(String, String)instead.Set the header with the specified key and value to this Request.- Parameters:
key- The "name" of the headervalue- The value which should override the value of the header if it exists already, otherwise just adds the value to the header.
-
getHeader
Deprecated, for removal: This API element is subject to removal in a future version.UseResponse.getHeaders(String)instead.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, for removal: This API element is subject to removal in a future version.UseResponse.hasHeader(String)instead.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
-
Response.addHeader(String, String)instead.