Examples of GadgletRequestWrapper


Examples of com.gadglet.core.GadgletRequestWrapper

  private void checkUser(HttpServletRequest httpServletRequest,
      HttpServletResponse httpServletResponse) {

    GadgletResponse gadgetServerResponse = new GadgletResponse();

    GadgletRequestWrapper platformRequestWrapper = new GadgletRequestWrapper(
        httpServletRequest);

    if (!(platformRequestWrapper.getParameter("ignoreJson") != null && UrlUtils
        .isOnDevPort8888(platformRequestWrapper)))
      setResponseHeaders(httpServletResponse);

    boolean userIsValid = false;
    try {
      userIsValid = validateOauthUser(platformRequestWrapper,
          gadgetServerResponse);
     
      // load gadget
      Gadget g = GadgetUtils.getGadget(platformRequestWrapper.getGadgetName());
     
      if(g==null || g.getGadgletType()==null || !g.getGadgletType().equals(GadgetType.BIZLET.getGadgetType()))
        throw new RequestException(
            ReqErrorTypes.UNRECOGNIZED_GADGET);
      else
        platformRequestWrapper.setRequestedGadget(g);

    } catch (RequestException e) {
      userIsValid = false;
      gadgetServerResponse.setError(e);
    } catch (Exception e) {
View Full Code Here

Examples of com.gadglet.core.GadgletRequestWrapper

  }

  private void checkUser(HttpServletRequest httpServletRequest,
      HttpServletResponse httpServletResponse) {
    GadgletResponse gadgetServerResponse = new GadgletResponse();
    GadgletRequestWrapper platformRequestWrapper = new GadgletRequestWrapper(
        httpServletRequest);
    boolean userIsValid = true;
    UserProfile userProfile = null;

    if (!(platformRequestWrapper.getParameter("ignoreJson") != null && UrlUtils
        .isOnDevPort8888(platformRequestWrapper)))
      setResponseHeaders(httpServletResponse);

    try {
      if (platformRequestWrapper.getOpenSocialConsumerKey() == null) {
        log.warning("oauth_consumer_key is null");
        throw new RequestException(ReqErrorTypes.UNSUPPORETED_PLATFORM);
      }
      if (platformRequestWrapper.getOpenSocialViewerId() == null) {
        log.warning("opensocial_viewer_id is null");
        throw new RequestException(ReqErrorTypes.USER_NOT_LOGGEDIN);
      }

      if (!UrlUtils.isOnDevPort8888(platformRequestWrapper)
          && !validateSignedRequestWithContainer(platformRequestWrapper)) {
        throw new RequestException(ReqErrorTypes.USER_NOT_LOGGEDIN);
      }

      if (platformRequestWrapper.getCurrentUserProfile() != null){
        // check if user changed in session the middle ?
        userProfile = platformRequestWrapper.getCurrentUserProfile();
       
        if(!userProfile.getOpenSocialViewerId().equals(platformRequestWrapper.getOpenSocialViewerId()))
          platformRequestWrapper.getSession().setAttribute(
              "userProfile", null);
      }
     
      if (platformRequestWrapper.getCurrentUserProfile() == null) {

        userProfile = UserProfilesUtils
            .getMyProfile(platformRequestWrapper);
        if (userProfile != null){
          platformRequestWrapper.getSession().setAttribute(
              "userProfile", userProfile);
         
          userIsValid = true;
        }
        else if (platformRequestWrapper.getGadgetActionType().equals(
            ReqActionTypes.ADD_PROFILE))
          userIsValid = true; // proceed to profile creation
        else
          throw new RequestException(
              ReqErrorTypes.PROFILE_DOESNT_EXISTS);
      }
      else
        userIsValid = true;
     
      // load gadget
      Gadget g = GadgetUtils.getGadget(platformRequestWrapper.getGadgetName());
      if(g==null || g.getGadgletType()==null || !g.getGadgletType().equals(GadgetType.MINGLET.getGadgetType()))
        throw new RequestException(
            ReqErrorTypes.UNRECOGNIZED_GADGET);
      else
        platformRequestWrapper.setRequestedGadget(g);
     
     
    } catch (RequestException e) {
      userIsValid = false;
      gadgetServerResponse.setError(e);
View Full Code Here

Examples of com.gadglet.core.GadgletRequestWrapper

      HttpServletResponse httpServletResponse) {
 
   
    GadgletResponse gadgetServerResponse = new GadgletResponse();

    GadgletRequestWrapper platformRequestWrapper = new GadgletRequestWrapper(
        httpServletRequest);

    if (!(platformRequestWrapper.getParameter("ignoreJson") != null && UrlUtils
        .isOnDevPort8888(platformRequestWrapper)))
      setResponseHeaders(httpServletResponse);

    boolean userIsValid = false;
    try {
      userIsValid = validateOpenSocialUser(platformRequestWrapper,
          gadgetServerResponse);
     
      // load gadget
      Gadget g = GadgetUtils.getGadget(platformRequestWrapper.getGadgetName());
     
      if(g==null || g.getGadgletType()==null || !g.getGadgletType().equals(GadgetType.BIZLET.getGadgetType()))
        throw new RequestException(
            ReqErrorTypes.UNRECOGNIZED_GADGET);
      else
        platformRequestWrapper.setRequestedGadget(g);

    } catch (RequestException e) {
   
      userIsValid = false;
      gadgetServerResponse.setError(e);
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.