abstract class IconAdjuster extends java.lang.Object implements HttpServer.Handler
Modifier and Type | Field and Description |
---|---|
private java.net.URL |
baseUrl_ |
private static java.lang.String |
OUTPUT_FORMAT_NAME |
private static java.lang.String |
OUTPUT_MIME_TYPE |
Constructor and Description |
---|
IconAdjuster(HttpServer server,
java.lang.String basePath)
Constructor.
|
Modifier and Type | Method and Description |
---|---|
abstract java.awt.image.RenderedImage |
adjustImage(java.awt.image.BufferedImage inImage)
Produces an adjusted image for serving.
|
java.net.URL |
exportAdjustedIcon(java.net.URL iconUrl)
Returns a URL at which the dynamically adjusted version of the icon
at the given URL will be served.
|
private java.net.URL |
getOriginalUrl(java.lang.String resourcePath)
Returns the URL at which the underlying icon for the one represented
by the given server path.
|
HttpServer.Response |
serveRequest(HttpServer.Request request)
Provides a response to an HTTP request.
|
private final java.net.URL baseUrl_
private static final java.lang.String OUTPUT_FORMAT_NAME
private static final java.lang.String OUTPUT_MIME_TYPE
public IconAdjuster(HttpServer server, java.lang.String basePath)
server
- server with which this handler will be usedbasePath
- path at which the dynamic URLs generated by
this server will be rootedpublic abstract java.awt.image.RenderedImage adjustImage(java.awt.image.BufferedImage inImage)
inImage
- input imageinImage
public java.net.URL exportAdjustedIcon(java.net.URL iconUrl)
iconUrl
- URL of existing icon (GIF, PNG or JPEG)private java.net.URL getOriginalUrl(java.lang.String resourcePath) throws java.net.MalformedURLException
resourcePath
should be
the path part of a URL returned from an earlier call to
exportAdjustedIcon(java.net.URL)
.resourcePath
- path part of a URL requesting an adjusted iconjava.net.MalformedURLException
public HttpServer.Response serveRequest(HttpServer.Request request)
HttpServer.Handler
serveRequest
in interface HttpServer.Handler
request
- HTTP request