[JBoss Portal] - custom LoginModule integration with portal ("org.jboss.porta
by michmich
Hi,
This question is about integrating a custom LoginModule in the portal.
I implemented a custom LoginModule (extending AbstractServerLoginModule) and deployed it as a .sar in the deploy directory. I changed the security-domain of the portal app by editing jboss-portal.sar/jboss-server.war/WEB-INF/jboss-web.xml in order to user. Finally I've added security-constraints on a portal and pages object with custom roles.
With this configuration I'm able to logon on my portal using my custom LoginModule (I can see pages and portlets which the user logged in is granted for) but something goes wrong because "Login" is still displayed in the top right corner of the page : I should see something "Logged in as : user1" ... "Logout". It seems that the "org.jboss.portal.header.USER" attribute is not set in the request object so jboss-portal.sar/portal-core.war/WEB-INF/jsp/header/header.jsp displays the "Login" link and not the user welcome informations.
Did I miss something? What should I do to integrate my custom LoginModule with the jboss portal application?
Thank you for your answers
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4113433#4113433
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4113433
18 years, 4 months
[JBoss Portal] - Re: CMS Content - Navigate between pages
by mrostan
Hi all, I'm using JBossPortal 2.6.3 on a JBossAS 4.2.2 and I can reproduce the problem reported by Nidhi and I also have it working as Michael says.
The difference is the href in the html link, if the link is relative (default/B.html as in the example by Michael) it works fine and B.html is displayed in the same window, but if the link is absolute (/portal/content/default/B.html) the page is displayed in the default CMS window.
In the first case the generated URL points to the window with action=2,uri=default/B.html, in the later case the generated URL is absolute (/portal/content/...)
Be careful with the WYSIWYG editor, it seems to be prefixing relative urls with "/portal/content/", so you must edit the page directly, maybe this is an issue to be reported.
Martin
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4113431#4113431
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4113431
18 years, 4 months
[JBoss Seam] - Re: Trouble W/ NullPointerException
by nathandennis
i actually already tried that. but the entity manager is still null. im starting to wonder if it is a bug. this version is cvs 11/15/07. here is an updated code snippet.
| @Stateful
| @Name("uploadAction")
| @Scope(ScopeType.SESSION)
| public class FileUploadAction implements FileUploadLocal, Serializable{
|
| @PersistenceContext
| private EntityManager entityManager;
|
| @Logger
| private Log log;
|
| FtpRemote send;
|
| @Out(required=false)
| private Media media;
|
| private String medianame;
| private Long size;
| private String userid;
| private String comment;
| private String server;
| private String url;
| private String filetype;
| private Date dob;
| private Long mark;
| private FileInputStream fis;
| private byte[] is;
|
| public void UploadFile() throws NullPointerException {
|
|
| if(!medianame.equals("")){
| try{
| // create empty file with specified name and path
| File os = new File("/var/temp/filewritetemp/"+getMediaName());
| FileOutputStream oStream =new FileOutputStream(os);
| oStream.write(getIs());
|
|
|
|
| File file = new File("/var/temp/filewritetemp/" + getMediaName());
| size = file.length();
| dob = new Date();
| fis = new FileInputStream("/var/temp/filewritetemp/" + getMediaName());
| try{
| ftpFile(fis);
|
| Media media = new Media();
| media.setServer(server);
| media.setUrl(url);
| media.setDob(dob);
| media.setFiletype(filetype);
| media.setMark(mark);
| media.setMedianame(medianame);
| media.setSize(size);
| media.setUserid(userid);
| entityManager.persist(media);
| }catch (Exception e){
| e.printStackTrace();
| }
| file.delete();
| // Media media = ;
| /* media.setServer(server);
| media.setUrl(url);
| media.setDob(dob);
| media.setFiletype(filetype);
| media.setMark(mark);
| media.setMedianame(medianame);
| media.setSize(size);
| media.setUserid(userid);
| entityManager.persist(media);
| */ destroy();
|
| } catch(Exception e){
| e.printStackTrace();
|
| }
| }
| }
| public void ftpFile(FileInputStream fis){
| send = new FtpRemote(); //action starts
| send.findServer(fis);
| }
| ...
|
now to process the file..
|
| @Stateful
| @Name("ftpRemote")
| public class FtpRemote implements FtpRemoteLocal, Serializable {
| /**
| */
| private String login;
| private String password;
| private String directory;
| private String path;
| private String filename;
| private String server;
| private Long serverid;
| private Long usedspace;
| private int reply;
| private int replywrite;
| private byte[] filestream;
| private boolean successflag;
|
| @PersistenceContext
| private EntityManager entityManager;
|
| @In(required=false)
| @Out(required=false)
| ReturnServer host;
|
| @In(required=false)
| @Out(required=false)
| ReturnServer host2;
|
|
| public void findServer(FileInputStream fis){
| host = new ReturnServer(); //return an available server from DB second action
| server = host.findServer();
| serverid = host.getServerId();
| login = host.getLogin();
| password = host.getPasswd();
| usedspace = host.getUsedSpace();
| successflag = ftpConnect(fis);
| host.destroy();
| for(boolean flag=successflag; flag==true;){
| host2 = new ReturnServer();
| server = host2.findServer();
| serverid = host2.getServerId();
| login = host2.getLogin();
| password = host2.getPasswd();
| usedspace = host2.getUsedSpace();
| host2.destroy();
| flag = ftpConnect(fis);
| }
| }
|
the query to return the server is where it is breaking... EM is null for some reason.
| @Stateful
| @Name("returnServer")
| public class ReturnServer implements ReturnServerLocal, Serializable
| {
| @PersistenceContext
| private EntityManager entityManager;
|
| private String server;
| private ArrayList<Server> serverlist;
|
| private String login;
| private String passwd;
| private Long usedspace;
| private Long serverid;
| private int serverindex;
| private int noavail;
|
| @Logger private Log log;
|
| @In(create=true)
| private List<Server> result;
|
| @Create
| public String findServer(){
| queryServer();
| requestServer();
| return server;
| }
|
| public void requestServer() {
| int i = 0;
| noavail = serverlist.size();
| if(serverlist.isEmpty()){
| System.out.println("null query");
| } else {
| for (i = 0; i == serverlist.size() + 1; i++) {
| if(serverlist.get(i).getUsedspace()
| < serverlist.get(i).getTotalspace()) {
| server = serverlist.get(i).getServername();
| login = serverlist.get(i).getLogin();
| passwd = serverlist.get(i).getPasswd();
| serverid = serverlist.get(i).getId();
| }}
| }
| }
|
| @SuppressWarnings("unchecked")
| public void queryServer() {
| System.out.println("made it to RemoteServer -- before QUERY");
| if(entityManager==null){
| System.out.println("em is null");
| }
| if(entityManager != null){
| System.out.println("em not null");
| }
| //
| try{
| log.info("i am here");
|
| List resultList = entityManager.createQuery("select s from " +
| "Server s where lower (s.status) = :param order by s.usedspace desc")
| .setParameter("param", "online")
| .getResultList();
| serverlist = new ArrayList(resultList.subList(0, resultList.size()));
| }catch (Exception e){
| e.printStackTrace();
| }
|
|
| }
| ...
i local interfaces for all. i thought there might have been something i was missing. i cant really find anything similar in the examples and google is really letting me down too.
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4113430#4113430
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4113430
18 years, 4 months