[jboss-cvs] jboss-seam/src/pdf/org/jboss/seam/pdf ...
Gavin King
gavin.king at jboss.com
Tue Jun 19 16:11:06 EDT 2007
User: gavin
Date: 07/06/19 16:11:06
Modified: src/pdf/org/jboss/seam/pdf DocumentStorePhaseListener.java
DocumentStoreServlet.java
Log:
repackaging
Revision Changes Path
1.7 +20 -18 jboss-seam/src/pdf/org/jboss/seam/pdf/DocumentStorePhaseListener.java
(In the diff below, changes in quantity of whitespace are not shown.)
Index: DocumentStorePhaseListener.java
===================================================================
RCS file: /cvsroot/jboss/jboss-seam/src/pdf/org/jboss/seam/pdf/DocumentStorePhaseListener.java,v
retrieving revision 1.6
retrieving revision 1.7
diff -u -b -r1.6 -r1.7
--- DocumentStorePhaseListener.java 9 Mar 2007 02:14:15 -0000 1.6
+++ DocumentStorePhaseListener.java 19 Jun 2007 20:11:06 -0000 1.7
@@ -8,8 +8,8 @@
import javax.faces.event.PhaseListener;
import javax.servlet.http.HttpServletResponse;
-import org.jboss.seam.core.Pages;
-import org.jboss.seam.util.Parameters;
+import org.jboss.seam.navigation.Pages;
+import org.jboss.seam.web.Parameters;
public class DocumentStorePhaseListener
@@ -17,45 +17,47 @@
{
private static final long serialVersionUID = 7308251684939658978L;
- public PhaseId getPhaseId() {
+ public PhaseId getPhaseId()
+ {
return PhaseId.RENDER_RESPONSE;
}
-
public void afterPhase(PhaseEvent phaseEvent) {
// ...
}
-
- public void beforePhase(PhaseEvent phaseEvent) {
+ public void beforePhase(PhaseEvent phaseEvent)
+ {
String rootId = Pages.getViewId( phaseEvent.getFacesContext() );
- String id = (String)
- Parameters.convertMultiValueRequestParameter(Parameters.getRequestParameters(),
- "docId",
- String.class);
- if (rootId.contains("/seam-doc")) {
+ Parameters params = Parameters.instance();
+ String id = (String) params.convertMultiValueRequestParameter(params.getRequestParameters(), "docId", String.class);
+ if ( rootId.contains("/seam-doc") )
+ {
sendContent(phaseEvent.getFacesContext(), id);
}
}
- public void sendContent(FacesContext context, String contentId) {
- try {
+ public void sendContent(FacesContext context, String contentId)
+ {
+ try
+ {
DocumentData documentData = DocumentStore.instance().getDocumentData(contentId);
byte[] data = documentData.getData();
HttpServletResponse response = (HttpServletResponse) context.getExternalContext().getResponse();
- response.setContentType(documentData.getDocType().getMimeType());
+ response.setContentType( documentData.getDocType().getMimeType() );
- response.setHeader("Content-Disposition",
- "inline; filename=\"" + documentData.getFileName() + "\"");
+ response.setHeader("Content-Disposition", "inline; filename=\"" + documentData.getFileName() + "\"");
- if (data != null) {
+ if (data != null)
+ {
response.getOutputStream().write(data);
}
context.responseComplete();
- } catch (IOException e) {
+ }
+ catch (IOException e) {
e.printStackTrace();
}
}
1.12 +8 -10 jboss-seam/src/pdf/org/jboss/seam/pdf/DocumentStoreServlet.java
(In the diff below, changes in quantity of whitespace are not shown.)
Index: DocumentStoreServlet.java
===================================================================
RCS file: /cvsroot/jboss/jboss-seam/src/pdf/org/jboss/seam/pdf/DocumentStoreServlet.java,v
retrieving revision 1.11
retrieving revision 1.12
diff -u -b -r1.11 -r1.12
--- DocumentStoreServlet.java 13 Jun 2007 21:10:14 -0000 1.11
+++ DocumentStoreServlet.java 19 Jun 2007 20:11:06 -0000 1.12
@@ -8,7 +8,7 @@
import javax.servlet.http.HttpServletResponse;
import org.jboss.seam.contexts.ContextualHttpServletRequest;
-import org.jboss.seam.util.Parameters;
+import org.jboss.seam.web.Parameters;
public class DocumentStoreServlet
extends HttpServlet
@@ -25,7 +25,6 @@
public void process() throws ServletException, IOException
{
doWork(request, response);
-
}
}.run();
@@ -35,24 +34,23 @@
private static void doWork(HttpServletRequest request, HttpServletResponse response)
throws IOException
{
- String contentId = (String)
- Parameters.convertMultiValueRequestParameter(Parameters.getRequestParameters(),
- "docId",
- String.class);
+ Parameters params = Parameters.instance();
+ String contentId = (String) params.convertMultiValueRequestParameter(params.getRequestParameters(), "docId", String.class);
DocumentStore store = DocumentStore.instance();
- if ( store.idIsValid(contentId ))
+ if ( store.idIsValid(contentId) )
{
DocumentData documentData = store.getDocumentData(contentId);
byte[] data = documentData.getData();
- response.setContentType(documentData.getDocType().getMimeType());
+ response.setContentType( documentData.getDocType().getMimeType() );
response.setHeader("Content-Disposition",
"inline; filename=\"" + documentData.getFileName() + "\"");
- if (data != null) {
+ if (data != null)
+ {
response.getOutputStream().write(data);
}
}
More information about the jboss-cvs-commits
mailing list