For a previous project, I added a virtual stream handler. Within the same URL,
the URLStreamHandler returns a stream pointing to some object in memory. This
works fine in JBoss:
|
| public static URL create(String filename, byte b[], String ct) {
| VirtualStreamHandler vsh = new VirtualStreamHandler(b, ct);
| return new URL("mem", null, 0, filename, vsh);
| }
|
| class VirtualStreamHandler extends URLStreamHandler {
|
| private byte b[];
| private String ct;
|
| public VirtualStreamHandler(byte b[], String ct) {
| this.b = b;
| this.ct = ct;
| }
|
| protected URLConnection openConnection(URL u) {
| return new URLConnection(u) {
| public void connect() {
| this.connected = true;
| }
| public InputStream getInputStream() throws IOException {
| return new ByteArrayInputStream(b);
| }
| public String getHeaderField(String s) {
| if (s.equalsIgnoreCase("content-type")) return ct;
| return null;
| }
| };
|
| }
|
| }
|
View the original post :
http://www.jboss.org/index.html?module=bb&op=viewtopic&p=3880525#3880525
Reply to the post :
http://www.jboss.org/index.html?module=bb&op=posting&mode=reply&p=3880525
-------------------------------------------------------
This SF.Net email is sponsored by: NEC IT Guy Games. How far can you shotput
a projector? How fast can you ride your desk chair down the office luge track?
If you want to score the big prize, get to know the little guy.
Play to win an NEC 61" plasma display: http://www.necitguy.com/?r=20
_______________________________________________
JBoss-user mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/jboss-user