alvinalexander.com | career | drupal | java | mac | mysql | perl | scala | uml | unix  

Struts example source code file (SerializationParams.java)

This example Struts source code file (SerializationParams.java) is included in the DevDaily.com "Java Source Code Warehouse" project. The intent of this project is to help you "Learn Java by Example" TM.

Java - Struts tags/keywords

default_content_type, default_content_type, http, httpservletresponse, httpservletresponse, request, response, serializationparams, serializationparams, servlet, string, string

The Struts SerializationParams.java source code

/*
 * $Id: SerializationParams.java 1076544 2011-03-03 07:19:37Z lukaszlenart $
 *
 * Licensed to the Apache Software Foundation (ASF) under one
 * or more contributor license agreements.  See the NOTICE file
 * distributed with this work for additional information
 * regarding copyright ownership.  The ASF licenses this file
 * to you 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 org.apache.struts2.json;

import org.apache.commons.lang.StringUtils;

import javax.servlet.http.HttpServletResponse;

public class SerializationParams {
    private static final String DEFAULT_CONTENT_TYPE = "application/json";

    private final HttpServletResponse response;
    private final String encoding;
    private final boolean wrapWithComments;
    private final String serializedJSON;
    private final boolean smd;
    private final boolean gzip;
    private final boolean noCache;
    private final int statusCode;
    private final int errorCode;
    private final boolean prefix;
    private String contentType = DEFAULT_CONTENT_TYPE;
    private String wrapPrefix;
    private String wrapSuffix;

    public SerializationParams(HttpServletResponse response, String encoding, boolean wrapWithComments,
            String serializedJSON, boolean smd, boolean gzip, boolean noCache, int statusCode, int errorCode,
            boolean prefix, String contentType, String wrapPrefix, String wrapSuffix) {
        this.response = response;
        this.encoding = encoding;
        this.wrapWithComments = wrapWithComments;
        this.serializedJSON = serializedJSON;
        this.smd = smd;
        this.gzip = gzip;
        this.noCache = noCache;
        this.statusCode = statusCode;
        this.errorCode = errorCode;
        this.prefix = prefix;
        this.contentType = StringUtils.defaultString(contentType, DEFAULT_CONTENT_TYPE);
        this.wrapPrefix = wrapPrefix;
        this.wrapSuffix = wrapSuffix;
    }

    public SerializationParams(HttpServletResponse response, String defaultEncoding,
            boolean wrapWithComments, String json, boolean b, boolean b1, boolean noCache, int i, int i1,
            boolean prefix, String contentType) {
        this(response, defaultEncoding, wrapWithComments, json, b, b1, noCache, i, i1, prefix, contentType,
                null, null);
    }

    public String getWrapSuffix() {
        return wrapSuffix;
    }

    public String getWrapPrefix() {
        return wrapPrefix;
    }

    public HttpServletResponse getResponse() {
        return response;
    }

    public String getEncoding() {
        return encoding;
    }

    public boolean isWrapWithComments() {
        return wrapWithComments;
    }

    public String getSerializedJSON() {
        return serializedJSON;
    }

    public boolean isSmd() {
        return smd;
    }

    public boolean isGzip() {
        return gzip;
    }

    public boolean isNoCache() {
        return noCache;
    }

    public int getStatusCode() {
        return statusCode;
    }

    public int getErrorCode() {
        return errorCode;
    }

    public boolean isPrefix() {
        return prefix;
    }

    public String getContentType() {
        return contentType;
    }
}

Other Struts examples (source code examples)

Here is a short list of links related to this Struts SerializationParams.java source code file:

... this post is sponsored by my books ...

#1 New Release!

FP Best Seller

 

new blog posts

 

Copyright 1998-2021 Alvin Alexander, alvinalexander.com
All Rights Reserved.

A percentage of advertising revenue from
pages under the /java/jwarehouse URI on this website is
paid back to open source projects.