001// -------------------------------------------------------------------------------- 002// Copyright 2002-2024 Echo Three, LLC 003// 004// Licensed under the Apache License, Version 2.0 (the "License"); 005// you may not use this file except in compliance with the License. 006// You may obtain a copy of the License at 007// 008// http://www.apache.org/licenses/LICENSE-2.0 009// 010// Unless required by applicable law or agreed to in writing, software 011// distributed under the License is distributed on an "AS IS" BASIS, 012// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 013// See the License for the specific language governing permissions and 014// limitations under the License. 015// -------------------------------------------------------------------------------- 016 017/* 018Copyright 2005-2006 Seth Fitzsimmons <seth@note.amherst.edu> 019 020Licensed under the Apache License, Version 2.0 (the "License"); 021you may not use this file except in compliance with the License. 022You may obtain a copy of the License at 023 024 http://www.apache.org/licenses/LICENSE-2.0 025 026Unless required by applicable law or agreed to in writing, software 027distributed under the License is distributed on an "AS IS" BASIS, 028WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 029See the License for the specific language governing permissions and 030limitations under the License. 031*/ 032package com.echothree.view.client.web.struts.sprout; 033 034import com.echothree.view.client.web.struts.sslext.action.SecureRequestProcessor; 035import java.io.IOException; 036import javax.servlet.ServletException; 037import javax.servlet.http.HttpServletRequest; 038import javax.servlet.http.HttpServletResponse; 039import org.apache.struts.action.Action; 040import org.apache.struts.action.ActionForm; 041import org.apache.struts.action.ActionForward; 042import org.apache.struts.action.ActionMapping; 043 044/** 045 * Extension of <code>SecureRequestProcessor</code> that adds 046 * Sprout initialization. 047 * 048 * @see com.echothree.view.client.web.struts.sslext.action.SecureRequestProcessor 049 * @author Seth Fitzsimmons 050 */ 051public class SproutRequestProcessor 052 extends SecureRequestProcessor { 053 054 /** 055 * Provides each Sprout with an extensive set of objects during its 056 * initialization. 057 */ 058 @Override 059 protected ActionForward processActionPerform(final HttpServletRequest request, final HttpServletResponse response, 060 final Action action, final ActionForm form, final ActionMapping mapping) 061 throws IOException, ServletException { 062 // initialize Sprout if necessary 063 if(action instanceof Sprout) { 064 ((Sprout)action).init(mapping, form, request, response); 065 } 066 067 return super.processActionPerform(request, response, action, form, mapping); 068 } 069 070}