Many resources are needed to download a project. Please understand that we have to compensate our server costs. Thank you in advance. Project price only 1 $
You can buy this project and download/modify it how often you want.
/*
* Copyright 2013 Geeoz Software
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.geeoz.ean.ws.rs;
import com.ean.wsapi.hotel.v3.BaseRequest;
import com.ean.wsapi.hotel.v3.LocaleType;
import com.ean.wsapi.hotel.v3.Room;
import com.ean.wsapi.hotel.v3.RoomGroup;
import org.glassfish.jersey.message.internal.ReaderWriter;
import javax.security.auth.Subject;
import javax.ws.rs.Produces;
import javax.ws.rs.core.MediaType;
import javax.ws.rs.core.MultivaluedMap;
import javax.ws.rs.ext.MessageBodyWriter;
import javax.ws.rs.ext.Provider;
import java.io.IOException;
import java.io.OutputStream;
import java.io.UnsupportedEncodingException;
import java.lang.annotation.Annotation;
import java.lang.reflect.Field;
import java.lang.reflect.Type;
import java.net.URLEncoder;
import java.security.PrivilegedAction;
import java.util.List;
/**
* Provider for marshalling of {@code application/x-www-form-urlencoded}
* entity type from {@link BaseRequest} child instance.
*
* @author Alex Voloshyn
* @version 1.0 7/13/2013
*/
@Provider
@Produces("application/x-www-form-urlencoded")
public final class JsonFormBodyWriter
implements MessageBodyWriter {
/**
* UTF-8 charset name.
*/
private static final String CHARSET_NAME = "UTF-8";
/**
* Write a type to an string builder.
*
* @param type the instance to write
* @param object the instance to write
* @param builder string builder
*/
public static void writeTo(final Class> type,
final Object object,
final StringBuilder builder) {
final Class> superclass = type.getSuperclass();
if (superclass != null) {
writeTo(superclass, object, builder);
}
Subject.doAsPrivileged(null, new PrivilegedAction