marshaller.java

来自「Ajax 框架,可以用来做数型菜单或者联动下拉列表」· Java 代码 · 共 57 行

JAVA
57
字号
/*
 * Copyright 2005 Joe Walker
 *
 * 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 org.directwebremoting;

import java.io.IOException;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

/**
 * A Marshaller is responsible for all the on-the-wire communication between
 * DWR on the server and the HTTP channel. DWREngine does the corresponding
 * work on thhe Javascript side.
 * @author Joe Walker [joe at getahead dot ltd dot uk]
 */
public interface Marshaller
{
    /**
     * Marshall an incomming HttpRequest into an abstract Calls POJO that
     * defines the functions that we need to call.
     * @param request The incoming Http request
     * @param response An Ajax response, XML, JSON, Javascript, etc.
     * @return Data specifying the methods to call
     * @throws IOException If the connection breaks
     */
    Calls marshallInbound(HttpServletRequest request, HttpServletResponse response) throws IOException;

    /**
     * Marshall the return values from executing this batch of requests.
     * @param replies The objects to convert into a reply
     * @param request The incoming Http request
     * @param response An Ajax response, XML, JSON, Javascript, etc.
     * @throws IOException If the connection breaks
     */
    void marshallOutbound(Replies replies, HttpServletRequest request, HttpServletResponse response) throws IOException;

    /**
     * Check if we can coerce the given type
     * @param paramType The type to check
     * @return true iff <code>paramType</code> is coercable
     */
    boolean isConvertable(Class paramType);
}

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?