Win a copy of Re-engineering Legacy Software this week in the Refactoring forum
or Docker in Action in the Cloud/Virtualization forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Public content for unsigned user using JSF

 
Marcelo Tataje
Ranch Hand
Posts: 64
Java Oracle Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Pie
Posts: 18020
47
Android Eclipse IDE Linux
  • Likes 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
Marcelo Tataje
Ranch Hand
Posts: 64
Java Oracle Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thank you very much, it worked. I've been racking my brain with this. Thanks
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic