Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
B
BigDataViewer_Server_Extension
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package registry
Container registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
BioinformaticDataCompression
BigDataViewer_Server_Extension
Commits
f2fb6b89
Commit
f2fb6b89
authored
10 years ago
by
Tobias Pietzsch
Browse files
Options
Downloads
Patches
Plain Diff
don't read thumbnail into BufferedImage. Just send the bytes out.
parent
3dc5f434
No related branches found
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
src/main/java/bdv/server/CellHandler.java
+10
-30
10 additions, 30 deletions
src/main/java/bdv/server/CellHandler.java
with
10 additions
and
30 deletions
src/main/java/bdv/server/CellHandler.java
+
10
−
30
View file @
f2fb6b89
...
...
@@ -35,6 +35,9 @@ import javax.servlet.http.HttpServletResponse;
import
java.awt.image.BufferedImage
;
import
java.io.*
;
import
java.nio.file.Files
;
import
java.nio.file.Path
;
import
java.nio.file.Paths
;
public
class
CellHandler
extends
ContextHandler
{
...
...
@@ -165,26 +168,14 @@ public class CellHandler extends ContextHandler
}
}
p
ublic
void
provideThumbnail
(
final
Request
baseRequest
,
final
HttpServletResponse
response
)
p
rivate
void
provideThumbnail
(
final
Request
baseRequest
,
final
HttpServletResponse
response
)
throws
IOException
{
// Just check it once
final
File
pngFile
=
new
File
(
baseFilename
+
".png"
);
final
Path
path
=
Paths
.
get
(
baseFilename
+
".png"
);
if
(
png
File
.
exists
()
)
if
(
File
s
.
exists
(
path
)
)
{
byte
[]
imageData
=
null
;
try
{
final
BufferedImage
image
=
ImageIO
.
read
(
pngFile
);
final
ByteArrayOutputStream
baos
=
new
ByteArrayOutputStream
();
ImageIO
.
write
(
image
,
"png"
,
baos
);
imageData
=
baos
.
toByteArray
();
}
catch
(
final
IOException
e
)
{
e
.
printStackTrace
();
}
final
byte
[]
imageData
=
Files
.
readAllBytes
(
path
);
if
(
imageData
!=
null
)
{
response
.
setContentType
(
"image/png"
);
...
...
@@ -192,22 +183,11 @@ public class CellHandler extends ContextHandler
response
.
setStatus
(
HttpServletResponse
.
SC_OK
);
baseRequest
.
setHandled
(
true
);
try
{
final
OutputStream
os
=
response
.
getOutputStream
();
os
.
write
(
imageData
);
os
.
close
();
}
catch
(
final
IOException
e
)
{
return
;
}
final
OutputStream
os
=
response
.
getOutputStream
();
os
.
write
(
imageData
);
os
.
close
();
}
}
else
{
return
;
}
}
public
String
getXmlFile
()
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment