File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes JSF and the fly likes Public content for unsigned user using JSF Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » JSF
Bookmark "Public content for unsigned user using JSF" Watch "Public content for unsigned user using JSF" New topic

Public content for unsigned user using JSF

Marcelo Tataje
Ranch Hand

Joined: Jan 31, 2011
Posts: 64

Hello everybody, I've been working in a Java EE Project using JSF as my framework and JPA for persistence. The issue is kind of complex for me, well I think maybe it's simplier than it looks like.
I've developed a web application in which an user can register itself to send documents in pdf through a nice user interface. When the user is registered he uploads a document and when he click on a button named "Send document", he specifies an email to alert the recipient that he has recieved a document.

I've already managed to send the email through my application, the email contains a text like this: "You have recieved a file, to look it please click on the following url: sjdhajhdajsd.xhtml"
When somebody click this link if he's not registered in my application he can see the document but he has no all the options I included in this application. But if he's registered he can access all the options. I don't know if there's some solution for this case, it's something like using profiles?

Please I'd be very grateful if somebody could help me. I heard from a friend that in Struts2 he did it something similar by creating a public directory and a private directory and configure both tomcat and web.xml

Any ideas or suggestion please? Thanks in advance
Tim Holloway
Saloon Keeper

Joined: Jun 25, 2001
Posts: 17417

A URL in the form "sjdhajhdajsd.xhtml" would generally be wrong, since ".xhtml" is commonly used as the resource file extension, and resource paths and URL paths are not the same thing, even if they do look almost identical. It confuses a lot of people.

In any event, JSF isn't a good mechanism for serving up static or generated content, such as PDFs. For that part of the webapp, use a file copy servlet. You can then define the URL of that servlet as a secured URL in the web.xml, just like you would in Struts.

An IDE is no substitute for an Intelligent Developer.
Marcelo Tataje
Ranch Hand

Joined: Jan 31, 2011
Posts: 64

Thank you very much, it worked. I've been racking my brain with this. Thanks
I agree. Here's the link:
subject: Public content for unsigned user using JSF
It's not a secret anymore!