Package javax.ws.rs.core

Examples of javax.ws.rs.core.Cookie


            if (!name.startsWith("$")) { //$NON-NLS-1$
                // this is the start of a new cookie
                if (currentCookie != null) {
                    if (currentCookie.name != null && currentCookie.value != null) {
                        cookies.add(new Cookie(currentCookie.name, currentCookie.value,
                                               currentCookie.path, currentCookie.domain,
                                               currentCookie.version));
                    }
                }
                currentCookie = new ModifiableCookie();
                currentCookie.name = name;
                currentCookie.value = value;
                currentCookie.version = version;
            } else if (name.startsWith(VERSION)) {
                version = Integer.parseInt(value);
            } else if (name.startsWith(PATH) && currentCookie != null) {
                currentCookie.path = value;
            } else if (name.startsWith(DOMAIN) && currentCookie != null) {
                currentCookie.domain = value;
            }
        }

        if (currentCookie != null) {
            if (currentCookie.name != null && currentCookie.value != null) {
                cookies.add(new Cookie(currentCookie.name, currentCookie.value,
                                       currentCookie.path, currentCookie.domain,
                                       currentCookie.version));
            }
        }
       
View Full Code Here


            if (value == null) {
                continue;
            }
            List<String> cs = getHeaderValues(HttpHeaders.COOKIE, value, getCookieSeparator());
            for (String c : cs) {
                Cookie cookie = Cookie.valueOf(c);
                cl.put(cookie.getName(), cookie);
            }
        }
        return cl;
    }
View Full Code Here

    }

    private static Object processCookieParam(Message m, String cookieName,
                              Class<?> pClass, Type genericType,
                              Annotation[] paramAnns, String defaultValue) {
        Cookie c = new HttpHeadersImpl(m).getCookies().get(cookieName);
       
        if (c == null && defaultValue != null) {
            c = Cookie.valueOf(cookieName + '=' + defaultValue);
        }
        if (c == null) {
            return null;
        }
       
        if (pClass.isAssignableFrom(Cookie.class)) {
            return c;
        }
       
        return InjectionUtils.handleParameter(c.getValue(), false, pClass, paramAnns,
                                              ParameterType.COOKIE, m);
    }
View Full Code Here

            if (value == null) {
                continue;
            }
            List<String> cs = getHeaderValues(HttpHeaders.COOKIE, value, getCookieSeparator());
            for (String c : cs) {
                Cookie cookie = Cookie.valueOf(c);
                cl.put(cookie.getName(), cookie);
            }
        }
        return cl;
    }
View Full Code Here

    public static Response getRequestFromServlet(HttpServletRequest request, String endpoint, Map<String, Object> attrs) {
        String token = (String) request.getSession().getAttribute(AdminConsoleAuthModule.REST_TOKEN);
        WebTarget target = targetWithQueryParams(JERSEY_CLIENT.target(endpoint), attrs);
        Response cr = target
                .request().cookie(new Cookie(REST_TOKEN_COOKIE, token))
                .get(Response.class);

        return cr;
    }
View Full Code Here

    public static void getRestRequestFromServlet(HttpServletRequest request, String endpoint, Map<String, Object> attrs, boolean quiet, boolean throwException) {
        String token = (String) request.getSession().getAttribute(AdminConsoleAuthModule.REST_TOKEN);
        WebTarget target = targetWithQueryParams(JERSEY_CLIENT.target(endpoint), attrs);
        Response cr = target
                .request(RESPONSE_TYPE)
                .cookie(new Cookie(REST_TOKEN_COOKIE, token))
                .get(Response.class);
        RestResponse rr = RestResponse.getRestResponse(cr);
        parseResponse(rr, null, endpoint, attrs, quiet, throwException);

    }
View Full Code Here

            address = FacesContext.getCurrentInstance().getExternalContext().getSessionMap().get("REST_URL") + address;
        }
        WebTarget target = targetWithQueryParams(getJerseyClient().target(address), payload);
        Response resp = target
                .request(RESPONSE_TYPE)
                .cookie(new Cookie(REST_TOKEN_COOKIE, getRestToken()))
                .get(Response.class);
        return RestResponse.getRestResponse(resp);
    }
View Full Code Here

        }
        if (payload instanceof Map) {
            payload = buildMultivalueMap((Map<String, Object>) payload);
        }
        Response cr = target.request(RESPONSE_TYPE).header("Content-Type", contentType)
                .cookie(new Cookie(REST_TOKEN_COOKIE, getRestToken()))
                //                .header("Content-type", MediaType.APPLICATION_FORM_URLENCODED)
                .post(Entity.entity(payload, contentType), Response.class);
        RestResponse rr = RestResponse.getRestResponse(cr);
        return rr;
    }
View Full Code Here

        WebTarget target = getJerseyClient().target(address);
        MultivaluedMap formData = buildMultivalueMap(payload);
        Response cr = target
                //                .header("Content-type", MediaType.APPLICATION_FORM_URLENCODED)
                .request(RESPONSE_TYPE)
                .cookie(new Cookie(REST_TOKEN_COOKIE, getRestToken()))
                .post(Entity.entity(formData, MediaType.APPLICATION_FORM_URLENCODED), Response.class);
        RestResponse rr = RestResponse.getRestResponse(cr);
        return rr;
    }
View Full Code Here

        WebTarget target = getJerseyClient().target(address);
        MultivaluedMap formData = buildMultivalueMap(payload);
        Response cr = target
                //                .header("Content-type", MediaType.APPLICATION_FORM_URLENCODED)
                .request(RESPONSE_TYPE)
                .cookie(new Cookie(REST_TOKEN_COOKIE, getRestToken()))
                .put(Entity.entity(formData, MediaType.APPLICATION_FORM_URLENCODED), Response.class);
        RestResponse rr = RestResponse.getRestResponse(cr);
        return rr;
    }
View Full Code Here

TOP

Related Classes of javax.ws.rs.core.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.