protected MultivaluedMap<String, String> initMap() { MultivaluedMap<String, String> map = new MetadataMap<>(); map.putSingle(OAuthConstants.GRANT_TYPE, grantType); return map; }
@SuppressWarnings("unchecked") protected MultivaluedMap<String, String> createMap(Class<?> clazz) throws Exception { if (clazz == MultivaluedMap.class || clazz == Form.class) { return new MetadataMap<String, String>(); } return (MultivaluedMap<String, String>)clazz.newInstance(); }
protected MultivaluedMap<String, String> initMap() { MultivaluedMap<String, String> map = new MetadataMap<>(); map.putSingle(OAuthConstants.GRANT_TYPE, grantType); return map; }
public LocalClientState(LocalClientState cs) { this.requestHeaders = new MetadataMap<>(cs.requestHeaders); this.templates = cs.templates == null ? null : new MetadataMap<String, String>(cs.templates); this.response = cs.response; this.baseURI = cs.baseURI; this.currentBuilder = cs.currentBuilder != null ? cs.currentBuilder.clone() : null; }
@SuppressWarnings("unchecked") private MultivaluedMap<String, Object> getWriteHeaders(Message message) { return new MetadataMap<String, Object>( (Map<String, List<Object>>)message.get(Message.PROTOCOL_HEADERS), true, true); }
public static MultivaluedMap<String, String> getMatrixParams(String path, boolean decode) { int index = path.indexOf(';'); return index == -1 ? new MetadataMap<String, String>() : JAXRSUtils.getStructuredParams(path.substring(index + 1), ";", decode, false); }
protected MultivaluedMap<String, String> toCodeRequestState(ContainerRequestContext rc, UriInfo ui) { MultivaluedMap<String, String> state = toRequestState(rc, ui); if (state == null) { state = new MetadataMap<>(); } return state; }
public static MultivaluedMap<String, Object> extractValuesFromBean(Object bean, String baseName) { MultivaluedMap<String, Object> values = new MetadataMap<>(); fillInValuesFromBean(bean, baseName, values); return values; }
public MultivaluedMap<String, String> toMap() { String request = getRequest(); MultivaluedMap<String, String> newMap = new MetadataMap<>(); newMap.putSingle("request", request); return newMap; } public String getRequest() {
public MultivaluedMap<String, String> getQueryParameters(boolean decode) { MultivaluedMap<String, String> queries = !caseInsensitiveQueries ? new MetadataMap<String, String>() : new MetadataMap<String, String>(false, true); JAXRSUtils.getStructuredParams(queries, (String)message.get(Message.QUERY_STRING), "&", decode, decode, queryValueIsCollection); return queries; }
public static void writeForm(FormEncodingProvider<Form> provider, Form form, OutputStream os) throws Exception { provider.writeTo(form, Form.class, Form.class, new Annotation[]{}, MediaType.APPLICATION_FORM_URLENCODED_TYPE, new MetadataMap<String, Object>(), os); }
@Override public MultivaluedMap<String, String> toMap() { MultivaluedMap<String, String> map = new MetadataMap<>(); map.putSingle(OAuthConstants.GRANT_TYPE, "custom_grant"); return map; }
@Override public MultivaluedMap<String, String> toMap() { MultivaluedMap<String, String> map = new MetadataMap<>(); map.putSingle(OAuthConstants.GRANT_TYPE, "custom_grant"); return map; }
@SuppressWarnings("unchecked") protected MultivaluedMap<String, String> getTemplateValues(Message msg) { MultivaluedMap<String, String> values = new MetadataMap<>(); MultivaluedMap<String, String> oldValues = (MultivaluedMap<String, String>)msg.get(URITemplate.TEMPLATE_PARAMETERS); if (oldValues != null) { values.putAll(oldValues); } return values; }
@Override public void writeTo(OutputStream os) { try { writer.writeTo(obj, cls, genericType, anns, contentType, new MetadataMap<String, Object>(), os); } catch (IOException ex) { throw ExceptionUtils.toInternalServerErrorException(ex, null); } }
/** * {@inheritDoc} */ @Override public MultivaluedMap<String, String> getHeaders() { MultivaluedMap<String, String> map = new MetadataMap<>(false, true); map.putAll(state.getRequestHeaders()); return map; }
public static MultivaluedMap<String, String> populateFormMap(MessageContext mc, boolean errorIfMissing) { MultivaluedMap<String, String> data = new MetadataMap<>(); FormUtils.populateMapFromMultipart(data, AttachmentUtils.getMultipartBody(mc), PhaseInterceptorChain.getCurrentMessage(), true); return data; }
public Response build() { if (entity == null && !statusSet) { status = 204; } ResponseImpl r = new ResponseImpl(status, null, reasonPhrase); MetadataMap<String, Object> m = new MetadataMap<>(metadata, false, true); r.addMetadata(m); r.setEntity(entity, annotations); reset(); return r; }
private MultivaluedMap<String, String> toRequestState(ContainerRequestContext rc) { MultivaluedMap<String, String> requestState = new MetadataMap<>(); requestState.putAll(rc.getUriInfo().getQueryParameters(true)); if (MediaType.APPLICATION_FORM_URLENCODED_TYPE.isCompatible(rc.getMediaType())) { String body = FormUtils.readBody(rc.getEntityStream(), StandardCharsets.UTF_8.name()); FormUtils.populateMapFromString(requestState, JAXRSUtils.getCurrentMessage(), body, StandardCharsets.UTF_8.name(), true); rc.setEntityStream(new ByteArrayInputStream(StringUtils.toBytesUTF8(body))); } return requestState; } public void setRedirectUri(String redirectUri) {
public void write(OutputStream output) throws IOException, WebApplicationException { if (!"text/plain".equals(BookStore.this.messageContext.get("Content-Type"))) { throw new RuntimeException(); } BookStore.this.messageContext.put(Message.RESPONSE_CODE, 503); MultivaluedMap<String, String> headers = new MetadataMap<>(); headers.putSingle("Content-Type", "text/custom+plain"); headers.putSingle("CustomHeader", "CustomValue"); BookStore.this.messageContext.put(Message.PROTOCOL_HEADERS, headers); output.write("Response is not available".getBytes()); }