Package org.wymiwyg.wrhapi.util

Examples of org.wymiwyg.wrhapi.util.Cookie


                      "LOGIN INVALID".getBytes()));
            }

          });
        }
        Cookie loginCookie = new Cookie("login", username + ":"
            + password);
        response.setHeader(HeaderName.SET_COOKIE, loginCookie
            .toString());
        response.setResponseStatus(ResponseStatus.MOVED_TEMPORARILY);
        response.setHeader(HeaderName.LOCATION,
            "/application/gvs-browser");
        // response.setBody((MessageBody)null);
View Full Code Here


          }
         
        });
        return;*/
        try {
          Cookie loginCookie = new Cookie("login", "-");
          loginCookie.setMaxAge(-1);
          response.setHeader(HeaderName.SET_COOKIE, loginCookie.toString());

          loginContext = new LoginContext("GVS-Auth", new CallbackHandler() {

            public void handle(Callback[] callbacks) throws IOException, UnsupportedCallbackException {
              for (int i = 0; i < callbacks.length; i++) {
View Full Code Here

  result.addProperty(LOGIN.refererUri, new UriRef(baseUri + "/dashboard/overview"));
  return result;
    }

    public static Cookie getLogoutCookie() {
  Cookie cookie = new Cookie(CookieLogin.AUTH_COOKIE_NAME, null);
  cookie.setMaxAge(0);
  return cookie;
    }
View Full Code Here

   * @throws HandlerException
   */
  private String getCookieValue(EnhancedRequest ehRequest) throws HandlerException {
    Cookie[] cookies = ehRequest.getCookies();
    String cookieValue = null;
    Cookie cookie = null;
    if (cookies != null) {
      for (int i = 0; i < cookies.length; i++) {
        if (cookies[i].getName().equals("lang")) {
          cookie = cookies[i];
          cookieValue = cookie.getValue();
          break;
        }
      }
    }
    return cookieValue;
View Full Code Here

        while (languagesForCookieIter.hasNext()) {
            cookieBuffer.append(languagesForCookieIter.next());
            cookieBuffer.append('!');
        }
        String cookieValue = cookieBuffer.toString();
        Cookie cookie = new Cookie("lang", cookieValue);
        cookie.setPath("/");
        response.setHeader(HeaderName.SET_COOKIE, cookie);
        return cookieValue;
  }
View Full Code Here

      String fieldValue = request
          .getHeaderValues(HeaderName.AUTHORIZATION)[0];
      String encryptedPart = fieldValue
          .substring(fieldValue.indexOf(' ') + 1);
      authorization = new String(Base64.decode(encryptedPart));
      Cookie cookie = new Cookie("auth", authorization);
      cookie.setMaxAge(3 * 30 * 24 * 60 * 60);
      cookie.setPath("/");
      response.setHeader(HeaderName.SET_COOKIE, cookie);
    } catch (ArrayIndexOutOfBoundsException ex) {
    }

    // TODO if login-status cookie indicates failed, consider anyway - or
    // give priority to http-auth: problem is: wrong password entered, no
    // fixing!
    if (authorization == null) {
      Cookie[] cookies = request.getCookies();
      for (int i = 0; i < cookies.length; i++) {
        Cookie cookie = cookies[i];
        if (cookie.getName().equals("auth")) {
          authorization = cookie.getValue();
        }
      }
    }
    /*
     * if (authorization == null) { try { authorization = request
View Full Code Here

    } finally {
      model.leaveCriticalSection();
      model.enterCriticalSection(ModelLock.READ);
    }
    model.leaveCriticalSection();
    Cookie cookie = new Cookie("auth", username+":"+password);
    cookie.setMaxAge(3*30*24*60*60);
        cookie.setPath("/");
        response.setHeader(HeaderName.SET_COOKIE, cookie);
    try {
        RefreshUtil.doRefresh(context, request);
    } finally {
        model.enterCriticalSection(ModelLock.READ);
View Full Code Here

     */
    private Resource getCookieSubject(Request request) throws HandlerException {
        Resource result = null;
        EnhancedRequest ehRequest = new EnhancedRequest(request);
        Cookie[] cookies = ehRequest.getCookies();
        Cookie cookie = null;
        if (cookies != null) {
            for (int i = 0; i < cookies.length; i++) {
                if (cookies[i].getName().equals("temp_user") && !cookies[i].getValue().equals("")) {
                    cookie = cookies[i];
                    result = model.createResource(cookie.getValue());
                }
            }
        }

        return result;
View Full Code Here

     * @param temporarySubject
     * @param response
     * @throws HandlerException
     */
    private void removeCookie(Response response) throws HandlerException {
        Cookie cookie = new Cookie("temp_user", "");
        cookie.setPath("/");
        cookie.setMaxAge(0);
        response.setHeader(HeaderName.SET_COOKIE, cookie);
    }
View Full Code Here

        if (temporarySubject.hasProperty(AUTHORIZATION.pass_sha1sum)) {
          //the user opened an accound or logged in, in between
          //as with initial-configuration
          return;
        }
    Cookie cookie = new Cookie("temp_user", temporarySubject.getURI());
    cookie.setPath("/");
    setHeader(HeaderName.SET_COOKIE, cookie);
    Model model = temporarySubject.getModel();
    AddAction action = new AddAction();
    action.add(model.createStatement(temporarySubject, RDF.type, TEMPSUBJECT.TemporarySubject));
    action.add(model.createStatement(temporarySubject, DC.date, new W3CDateFormat().format(new Date())));
View Full Code Here

TOP

Related Classes of org.wymiwyg.wrhapi.util.Cookie

Copyright © 2018 www.massapicom. 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.