EJB/Java question

classic Classic list List threaded Threaded
4 messages Options
Reply | Threaded
Open this post in threaded view
|

EJB/Java question

Manuel Alejandro de Brito Fontes
Hi,

Having troubles connecting forms (for example an login screen with an java
local class or EJB method that do the authentication and later redirect to
another form), outside that no problems. Anyone can provide an functional
example more complex that "J2EE Authentication" or "Integrating w/Java" ?

Thanks.

PD: sorry my bad english.
 



--
You receive this message as a subscriber of the [hidden email] mailing list.
To unsubscribe: mailto:[hidden email]
For general help: mailto:[hidden email]?subject=help
ObjectWeb mailing lists service home page: http://www.objectweb.org/wws
Reply | Threaded
Open this post in threaded view
|

Re: EJB/Java question

Alessandro  Vernet
Administrator
--- Manuel Alejandro de Brito Fontes <[hidden email]>
wrote:
> Having troubles connecting forms (for example an login screen with an
> java  local class or EJB method that do the authentication and later
> redirect to  another form), outside that no problems. Anyone can
> provide an functional  example more complex that "J2EE Authentication"
> or "Integrating w/Java"

Hi Manuel,

I don't quite get how "EJB" and "J2EE authentication" are related in your
case. Are you talking about authentication, in which case there are
usually no EJBs involved, or about calling an EJB and passing along some
authentication information? We would need to know more about what your are
trying to achieve, how you are doing it, and what error you are getting
back to help.

Alex

--
Blog (XML, Web apps, Open Source): http://www.orbeon.com/blog/



--
You receive this message as a subscriber of the [hidden email] mailing list.
To unsubscribe: mailto:[hidden email]
For general help: mailto:[hidden email]?subject=help
ObjectWeb mailing lists service home page: http://www.objectweb.org/wws
--
Follow Orbeon on Twitter: @orbeon
Follow me on Twitter: @avernet
Reply | Threaded
Open this post in threaded view
|

Re: EJB/Java question

Manuel Alejandro de Brito Fontes
Hi,
First, thanks for reply. Second sorry for a bad generic example.
So i will try to do better now.
I'm  trying to write an application that needs user authentication. This is
already developed in a method of an EJB. Sending username and password it
answer is name and profile of the user or an error message, this works fine,
but this method use HashMap as params, so i write an java processor that
takes the user and password from the form, access to the remote ejb method,
take the answer and generate and xml document like output.
Ok, to not start from scratch i use the authentication example.

Here are my problems:
1. How connect the submit button to the java processor?
2. How i can take the output of the processor (authentication result) to do
some action and redirect to another form?


Sorry for this basic questions.

Here are the files.

page-flow.xml

<config xmlns="http://www.orbeon.com/oxf/controller"
        xmlns:xu="http://www.xmldb.org/xupdate">

    <page id="home" path-info="/logTest" xforms="form.xml" view="view.xsl">
        <action when="/action = 'logout'" action="logout.xpl">
            <result page="home"/>
        </action>
    </page>

    <page path-info="/logTest/login" xforms="login-form.xml"
view="login-view.xsl" model="model.xpl">
        <action when="/submitted='true'" >
            <result page="login-error"/>
        </action>
        <action when="/action='submit'" >
            <result page="login-error"/>
        </action>
    </page>

    <page id="login-error" path-info="/logTest/login-error"
xforms="login-form.xml" view="login-error.xsl"/>

    <epilogue url="/config/epilogue.xpl"/>

</config>

model.xpl

<p:config xmlns:p="http://www.orbeon.com/oxf/pipeline"
          xmlns:oxf="http://www.orbeon.com/oxf/processors">

    <p:param debug="param-out" name="data" type="output"/>
    <p:param debug="param-in" name="data" type="input"/>

    <p:processor name="oxf:java" xmlns:p="http://www.orbeon.com/oxf/pipeline">
        <p:input name="config">
            <config sourcepath="." class="login"/>
        </p:input>
        <p:input debug="proc-in" name="data" href="#data"/>
        <p:output debug="proc-out" name="data" ref="data"/>
    </p:processor>

</p:config>


login-view. xsl

<xhtml:html xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
            xmlns:f="http://orbeon.org/oxf/xml/formatting"
xmlns:xhtml="http://www.w3.org/1999/xhtml"
            xsl:version="2.0">
    <xhtml:head>
        <xhtml:title>Login</xhtml:title>
    </xhtml:head>
    <xhtml:body>
        <xhtml:p>
            Please enter your login and password:
        </xhtml:p>
        <xhtml:form action="/logTest/login">
            <xhtml:table>
                <xhtml:tr>
                    <xhtml:td align="right">Login:</xhtml:td>
                    <xhtml:td><input name="username"/></xhtml:td>
                </xhtml:tr>
                <xhtml:tr>
                    <xhtml:td align="right">Password:</xhtml:td>
                    <xhtml:td><xhtml:input type="password"
name="password"/></xhtml:td>
                </xhtml:tr>
                <xhtml:tr>
                    <xhtml:td/><xhtml:td>
                    <xhtml:input type="submit" value="Login"/></xhtml:td>
                </xhtml:tr>
            </xhtml:table>
        </xhtml:form>
    </xhtml:body>
</xhtml:html>






El Lun 22 Ago 2005 13:03, Alessandro Vernet escribió:

> --- Manuel Alejandro de Brito Fontes <[hidden email]>
>
> wrote:
> > Having troubles connecting forms (for example an login screen with an
> > java  local class or EJB method that do the authentication and later
> > redirect to  another form), outside that no problems. Anyone can
> > provide an functional  example more complex that "J2EE Authentication"
> > or "Integrating w/Java"
>
> Hi Manuel,
>
> I don't quite get how "EJB" and "J2EE authentication" are related in your
> case. Are you talking about authentication, in which case there are
> usually no EJBs involved, or about calling an EJB and passing along some
> authentication information? We would need to know more about what your are
> trying to achieve, how you are doing it, and what error you are getting
> back to help.
>
> Alex
>
> --
> Blog (XML, Web apps, Open Source): http://www.orbeon.com/blog/


--
You receive this message as a subscriber of the [hidden email] mailing list.
To unsubscribe: mailto:[hidden email]
For general help: mailto:[hidden email]?subject=help
ObjectWeb mailing lists service home page: http://www.objectweb.org/wws
Reply | Threaded
Open this post in threaded view
|

Re: EJB/Java question

Alessandro  Vernet
Administrator
--- Manuel Alejandro de Brito Fontes <[hidden email]>
> Here are my problems:
> 1. How connect the submit button to the java processor?
> 2. How i can take the output of the processor (authentication result) to
> do
> some action and redirect to another form?

Hi Manuel,

1) First, it is in general better to use servlet authentication. With
servlet authentication, whenever an end-user tries to access a protected
page, the application server checks if the user has logged in properly. If
he hasn't, he will be redirected to a login page. Application servers
implement a few ways to check the login/password of a user. Since you have
an EJB, you would have to write some code to interface the application
server with your EJB. In Tomcat this is done with a security realm: you
can implement your own security realm and reference it in the server.xml.
Unless you have special requirements (like support for multiple
application servers), this is the option I would choose.

2) If you are not using the servlet authentication, you will have to check
on every page if the user has logged in properly, and if he did not,
redirect him to the login page. This seems to be the route you have
chosen. Answering your two questions:

Q1) You put a <xforms:setvalue> in the submit button and set the value of
a node in the instance to a specific value that you can then test on in
the PFC with <action when="/form/submitted = 'true'" ...>.
Q2) When the action is triggered, you want to run a pipeline that calls
your processor. That pipeline has an output with you can test on with an
XPath expression in the <result> element. Have a look at the page-flow.xml
of the ATM example. It is doing something very similar when it is checking
the password on the first page.

Alex

--
Blog (XML, Web apps, Open Source): http://www.orbeon.com/blog/



--
You receive this message as a subscriber of the [hidden email] mailing list.
To unsubscribe: mailto:[hidden email]
For general help: mailto:[hidden email]?subject=help
ObjectWeb mailing lists service home page: http://www.objectweb.org/wws
--
Follow Orbeon on Twitter: @orbeon
Follow me on Twitter: @avernet