|
Spring Framework example source code file (ThrowawayControllerHandlerAdapter.java)
The Spring Framework ThrowawayControllerHandlerAdapter.java source code
/*
* Copyright 2002-2008 the original author or authors.
*
* 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.springframework.web.servlet.mvc.throwaway;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import org.springframework.web.bind.ServletRequestDataBinder;
import org.springframework.web.servlet.HandlerAdapter;
import org.springframework.web.servlet.ModelAndView;
/**
* Adapter to use the ThrowawayController workflow interface with the
* generic DispatcherServlet. Does not support last-modified checks.
*
* <p>This is an SPI class, not used directly by application code.
* It can be explicitly configured in a DispatcherServlet context, to use a
* customized version instead of the default ThrowawayControllerHandlerAdapter.
*
* @author Juergen Hoeller
* @since 08.12.2003
* @deprecated as of Spring 2.5, in favor of annotation-based controllers.
* To be removed in Spring 3.0.
*/
public class ThrowawayControllerHandlerAdapter implements HandlerAdapter {
public static final String DEFAULT_COMMAND_NAME = "throwawayController";
private String commandName = DEFAULT_COMMAND_NAME;
/**
* Set the name of the command in the model.
* The command object will be included in the model under this name.
*/
public final void setCommandName(String commandName) {
this.commandName = commandName;
}
/**
* Return the name of the command in the model.
*/
public final String getCommandName() {
return this.commandName;
}
public boolean supports(Object handler) {
return (handler instanceof ThrowawayController);
}
/**
* This implementation binds request parameters to the ThrowawayController
* instance and then calls <code>execute on it.
* @see #createBinder
* @see ThrowawayController#execute
*/
public ModelAndView handle(HttpServletRequest request, HttpServletResponse response, Object handler)
throws Exception {
ThrowawayController throwaway = (ThrowawayController) handler;
ServletRequestDataBinder binder = createBinder(request, throwaway);
binder.bind(request);
binder.closeNoCatch();
return throwaway.execute();
}
/**
* Create a new binder instance for the given command and request.
* <p>Called by
Other Spring Framework examples (source code examples)Here is a short list of links related to this Spring Framework ThrowawayControllerHandlerAdapter.java source code file: |
... this post is sponsored by my books ... | |
#1 New Release! |
FP Best Seller |
Copyright 1998-2024 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.