Re: How to show pdf ByteArrayResouce in browser

2011-02-23 Thread chitrabhanu.das

Thanks for the reply... I was able to render the pdf in browser with the
following piece of code:

ResourceStreamRequestTarget target = new ResourceStreamRequestTarget(null){

@Override
public void detach(RequestCycle requestCycle) {
// TODO Auto-generated method stub

}

@Override
public void respond(RequestCycle requestCycle) {
try{
OutputStream out =   
requestCycle.getResponse().getOutputStream();   
out.write(stream.toByteArray());
out.flush();
stream.close();
}
catch(Exception e){
e.printStackTrace();
}
}

};

getRequestCycle().setRequestTarget(target.setFileName("eFile.pdf"));


But now the problem is that the file name I set in the last line doesnot
work. It renders as 

.pdf

Any suggestions??? Thanks


-- 
View this message in context: 
http://apache-wicket.1842946.n4.nabble.com/How-to-show-pdf-ByteArrayResouce-in-browser-tp3320759p3321003.html
Sent from the Users forum mailing list archive at Nabble.com.

-
To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
For additional commands, e-mail: users-h...@wicket.apache.org



How to show pdf ByteArrayResouce in browser

2011-02-23 Thread chitrabhanu.das

I have class which generates pdf report. The report is generated as stream as
I donot want to save the file in server. I need to show the pdf in the
browser. But the link provided to this dynamically generated pdf opens a new
window and asks for saving the file. How to open the pdf in new window?

My piece of code:

IResourceStream stream1 = new ByteArrayResource("application/pdf",
stream.toByteArray()).getResourceStream();  
getRequestCycle().setRequestTarget(new
ResourceStreamRequestTarget(stream1).setFileName("eFile.pdf"));

The stream here is the stream to which the pdf is written. I also tried the
following code. But this gives null pointer exception

getRequestCycle().setRequestTarget(new RedirectRequestTarget(urlFor(new
ResourceStreamRequestTarget(stream1).setFileName("eFile.pdf")).toString()));

Any help will be great. Thanks in advance.
-- 
View this message in context: 
http://apache-wicket.1842946.n4.nabble.com/How-to-show-pdf-ByteArrayResouce-in-browser-tp3320759p3320759.html
Sent from the Users forum mailing list archive at Nabble.com.

-
To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
For additional commands, e-mail: users-h...@wicket.apache.org



Re: Problem using wicket-extensions

2010-10-06 Thread chitrabhanu.das

Thanks for the repley. Yes I am using maven This is my pom.xml




http://maven.apache.org/POM/4.0.0";
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance";
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0
http://maven.apache.org/maven-v4_0_0.xsd";>
4.0.0
nic.fts
FTS2
war
1.0-SNAPSHOT

quickstart




The Apache Software License, Version 2.0

http://www.apache.org/licenses/LICENSE-2.0.txt
repo





org.apache.wicket
wicket
${wicket.version}


org.springframework
spring
2.5.6


org.apache.wicket
wicket-spring
${wicket.version}


org.hibernate
hibernate-core
3.3.2.GA


javax.persistence
persistence-api
1.0


org.hibernate
hibernate-annotations
3.4.0.GA


commons-dbcp
commons-dbcp
1.2.2


 org.apache.wicket
wicket-extensions
${wicket.version} 





org.slf4j
slf4j-log4j12
1.4.2


log4j
log4j
1.2.14




junit
junit
3.8.2
test




org.mortbay.jetty
jetty
${jetty.version}
provided


org.mortbay.jetty
jetty-util
${jetty.version}
provided


org.mortbay.jetty
jetty-management
${jetty.version}
provided





false
src/main/resources


false
src/main/java

**


**/*.java





false
src/test/java

**


**/*.java





true
org.apache.maven.plugins
maven-compiler-plugin

1.5
1.5
true
true



org.mortbay.jetty
maven-jetty-plugin


org.apache.maven.plugins
maven-eclipse-plugin

true



FTS


1.4.3
6.1.4




Thanks again...
-- 
View this message in context: 
http://apache-wicket.1842946.n4.nabble.com/Problem-using-wicket-extensions-tp2965023p2966215.html
Sent from the Users forum mailing list a

Problem using wicket-extensions

2010-10-06 Thread chitrabhanu.das

Hi all,   I am trying to add DataTable into my wicket application. But I am
facing is problem doing that. And the fact is that it is not giving coding
related error. After adding wicket-extensions1.4.3.jar I am getting the
following error:



java.lang.NoClassDefFoundError: org/slf4j/LoggerFactory
at
org.apache.wicket.extensions.ajax.markup.html.form.upload.UploadProgressBar.(UploadProgressBar.java:42)
at
org.apache.wicket.extensions.ajax.markup.html.form.upload.UploadProgressBar$ComponentInitializer.init(UploadProgressBar.java:55)
at org.apache.wicket.extensions.Initializer.init(Initializer.java:36)
at org.apache.wicket.Application.callInitializers(Application.java:844)
at 
org.apache.wicket.Application.initializeComponents(Application.java:679)
at 
org.apache.wicket.protocol.http.WicketFilter.init(WicketFilter.java:714)
at org.mortbay.jetty.servlet.FilterHolder.doStart(FilterHolder.java:99)
at 
org.mortbay.component.AbstractLifeCycle.start(AbstractLifeCycle.java:40)
at
org.mortbay.jetty.servlet.ServletHandler.initialize(ServletHandler.java:594)
at org.mortbay.jetty.servlet.Context.startContext(Context.java:139)
at
org.mortbay.jetty.webapp.WebAppContext.startContext(WebAppContext.java:1218)
at
org.mortbay.jetty.handler.ContextHandler.doStart(ContextHandler.java:500)
at 
org.mortbay.jetty.webapp.WebAppContext.doStart(WebAppContext.java:448)
at 
org.mortbay.component.AbstractLifeCycle.start(AbstractLifeCycle.java:40)
at
org.mortbay.jetty.handler.HandlerWrapper.doStart(HandlerWrapper.java:117)
at org.mortbay.jetty.Server.doStart(Server.java:220)
at 
org.mortbay.component.AbstractLifeCycle.start(AbstractLifeCycle.java:40)
at nic.fts.Start.main(Start.java:35)
Caused by: java.lang.ClassNotFoundException: org.slf4j.LoggerFactory
at java.net.URLClassLoader$1.run(URLClassLoader.java:200)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(URLClassLoader.java:188)
at
org.mortbay.jetty.webapp.WebAppClassLoader.loadClass(WebAppClassLoader.java:366)
at
org.mortbay.jetty.webapp.WebAppClassLoader.loadClass(WebAppClassLoader.java:337)
at java.lang.ClassLoader.loadClassInternal(ClassLoader.java:320)
... 18 more
ERROR - log- failed
org.mortbay.jetty.webapp.webappcont...@54777e{/,src/main/webapp}



sl4j jar is added to the classpath. Is it a jar conflict??? 
Any help will be highly appreciated Thanx.
-- 
View this message in context: 
http://apache-wicket.1842946.n4.nabble.com/Problem-using-wicket-extensions-tp2965023p2965023.html
Sent from the Users forum mailing list archive at Nabble.com.

-
To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
For additional commands, e-mail: users-h...@wicket.apache.org