Re: Servlet HttpSession in webobjects?
Re: Servlet HttpSession in webobjects?
- Subject: Re: Servlet HttpSession in webobjects?
- From: netBrackets <email@hidden>
- Date: Thu, 14 Feb 2008 09:39:05 -0800
Cool, thanks, I'll give that a shot.
Do you think it would be worth posting the final code if I get it working? Or maybe a short "HowTo" on the wiki disucssing creating a facebook integrated application, including how to setup things on the facebook side and in your project? Being it's a public app that anyone could develop a webobjects app for maybe folks would be interested?
Jeff
On Thursday, February 14, 2008, at 08:18AM, "Mike Schrag" <email@hidden> wrote:
>your Session.java:
>public class Session extends WOSession {
> private String _facebookSession;
>
> ...
>
> public void setFacebookSession(String facebookSession) {
> _facebookSession = facebookSession;
> }
>
> public String facebookSession() {
> return _facebookSession;
> }
>}
>
>> HttpSession session = request.getSession();
>Session session = (Session)session();
>> String sessionKey = (String)
>> session.getAttribute("facebookSession");
>String sessionKey = session.facebookSession();
>> String token = request.getParameter("auth_token");
>String token = request.stringFormValueForKey("auth_token");
>>
>> if (sessionKey != null && sessionKey.length() > 0) {
>> facebookRestClient = new FacebookXmlRestClient(apiKey, secretKey,
>> sessionKey);
>>
>> }
>> else if (token != null) {
>> facebookRestClient = new FacebookXmlRestClient(apiKey, secretKey);
>above is the same
>> session.setAttribute("facebookSession", sessionKey);
>session.setFacebookSession(sessionKey);
>>
>> try {
>> sessionKey = facebookRestClient.auth_getSession(token);
>above is the same
>> session.setAttribute("facebookSession", sessionKey);
>session.setFacebookSession(sessionKey);
>> } catch (FacebookException e) {
>> e.printStackTrace();
>> }
>> } else {
>above is the same
>> response.sendRedirect("http://www.facebook.com/login.php?api_key="
>> + apiKey + "&v=1.0");
>WORedirect redirect =
>(WORedirect)pageWithName(WORedirect.class.getName());
>redirect.setUrl("http://www.facebook.com/login.php?api_key=" + apiKey
>+ "&v=1.0");
>> return;
>return redirect;
>> }
>> response.getWriter().println("Hello World");
>return pageWithName("HelloWorldPage");
>
>ms
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Webobjects-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden