-Moving AjaxHandler to spring-js
-Polishing Spring.js API -Refactoring spring-faces components to match Spring.js API changes.
This commit is contained in:
@@ -27,5 +27,6 @@
|
||||
<classpathentry kind="var" path="IVY_CACHE/org.springframework/spring-webmvc/spring-webmvc-2.5.3.jar" sourcepath="IVY_CACHE/org.springframework/spring-webmvc/spring-webmvc-sources-2.5.3.jar"/>
|
||||
<classpathentry kind="var" path="IVY_CACHE/javax.faces/jsf-api/jsf-api-1.2.08.jar"/>
|
||||
<classpathentry kind="var" path="IVY_CACHE/javax.faces/jsf-impl/jsf-impl-1.2.08.jar"/>
|
||||
<classpathentry combineaccessrules="false" kind="src" path="/spring-js"/>
|
||||
<classpathentry kind="output" path="target/classes"/>
|
||||
</classpath>
|
||||
|
||||
@@ -26,7 +26,7 @@ import javax.servlet.http.HttpServletResponse;
|
||||
|
||||
import org.ajax4jsf.context.AjaxContext;
|
||||
import org.springframework.faces.webflow.FlowLifecycle;
|
||||
import org.springframework.webflow.mvc.servlet.SpringJavascriptAjaxHandler;
|
||||
import org.springframework.js.mvc.servlet.SpringJavascriptAjaxHandler;
|
||||
|
||||
/**
|
||||
* Ajax handler that works with Rich Faces, allowing support for Web Flow ajax features with the Rich Faces toolkit.
|
||||
|
||||
@@ -17,12 +17,12 @@ package org.springframework.faces.ui;
|
||||
|
||||
import java.io.IOException;
|
||||
|
||||
import javax.faces.FacesException;
|
||||
import javax.faces.component.UIComponent;
|
||||
import javax.faces.context.FacesContext;
|
||||
import javax.faces.context.ResponseWriter;
|
||||
import javax.faces.event.ActionEvent;
|
||||
|
||||
import org.springframework.faces.webflow.JsfUtils;
|
||||
import org.springframework.util.Assert;
|
||||
import org.springframework.util.StringUtils;
|
||||
|
||||
@@ -38,32 +38,37 @@ public class AjaxEventInterceptorRenderer extends DojoRenderer {
|
||||
writer.writeAttribute("type", "text/javascript", null);
|
||||
|
||||
String processIds = (String) component.getAttributes().get("processIds");
|
||||
String renderIds = (String) component.getAttributes().get("renderIds");
|
||||
if (StringUtils.hasText(processIds) && !processIds.contains(component.getClientId(context))) {
|
||||
processIds = component.getClientId(context) + ", " + processIds;
|
||||
} else if (!StringUtils.hasText(processIds)) {
|
||||
processIds = component.getClientId(context);
|
||||
}
|
||||
if (!StringUtils.hasText(renderIds)) {
|
||||
renderIds = processIds;
|
||||
}
|
||||
String childId = getElementId(context, component);
|
||||
StringBuffer script = new StringBuffer();
|
||||
script.append("Spring.advisors.push(new Spring.RemoteEventAdvisor({");
|
||||
script.append("Spring.addDecoration(new Spring.AjaxEventDecoration({");
|
||||
script.append("event:'" + event + "'");
|
||||
script.append(", targetId: '" + ((UIComponent) component.getChildren().get(0)).getClientId(context) + "'");
|
||||
script.append(", sourceId : '" + component.getClientId(context) + "'");
|
||||
script.append(", elementId: '" + childId + "'");
|
||||
script.append(", formId : '" + RendererUtils.getFormId(context, component) + "'");
|
||||
script.append(", processIds : '" + processIds + "'");
|
||||
script.append(", renderIds : '" + renderIds + "'})");
|
||||
if (JsfUtils.isAsynchronousFlowRequest()) {
|
||||
script.append(".apply()");
|
||||
}
|
||||
script.append(");");
|
||||
script.append(", params: {processIds : '" + processIds + "'");
|
||||
script.append(", ajaxSource : '" + component.getClientId(context) + "'} }));");
|
||||
|
||||
writer.writeText(script.toString(), null);
|
||||
writer.endElement("script");
|
||||
}
|
||||
|
||||
private String getElementId(FacesContext context, UIComponent component) {
|
||||
if (component.getChildCount() > 0) {
|
||||
UIComponent child = (UIComponent) component.getChildren().get(0);
|
||||
if (!(child instanceof DojoAdvisor)) {
|
||||
return child.getClientId(context);
|
||||
} else {
|
||||
return getElementId(context, child);
|
||||
}
|
||||
} else {
|
||||
throw new FacesException("Could not locate a proper child element to trigger the ajax event.");
|
||||
}
|
||||
}
|
||||
|
||||
public void decode(FacesContext context, UIComponent component) {
|
||||
if (context.getExternalContext().getRequestParameterMap().containsKey("ajaxSource")
|
||||
&& context.getExternalContext().getRequestParameterMap().get("ajaxSource").equals(
|
||||
|
||||
@@ -25,7 +25,6 @@ import javax.faces.context.FacesContext;
|
||||
import javax.faces.context.ResponseWriter;
|
||||
|
||||
import org.springframework.faces.ui.resource.ResourceHelper;
|
||||
import org.springframework.faces.webflow.JsfUtils;
|
||||
import org.springframework.util.StringUtils;
|
||||
|
||||
public class DojoAdvisorRenderer extends DojoRenderer {
|
||||
@@ -48,11 +47,10 @@ public class DojoAdvisorRenderer extends DojoRenderer {
|
||||
writer.startElement(SCRIPT_ELEMENT, component);
|
||||
writer.writeAttribute("type", "text/javascript", null);
|
||||
StringBuffer script = new StringBuffer();
|
||||
script.append(" Spring.advisors.push(new Spring.ValidatingFieldAdvisor({ ");
|
||||
script.append(" targetElId : '" + advisedChild.getClientId(context) + "', ");
|
||||
script.append(" msgElId : '" + advisedChild.getClientId(context) + ":msg', ");
|
||||
script.append(" decoratorType : '" + ((DojoAdvisor) component).getDojoComponentType() + "', ");
|
||||
script.append(" decoratorAttrs : \"{ ");
|
||||
script.append(" Spring.addDecoration(new Spring.ElementDecoration({ ");
|
||||
script.append(" elementId : '" + advisedChild.getClientId(context) + "', ");
|
||||
script.append(" widgetType : '" + ((DojoAdvisor) component).getDojoComponentType() + "', ");
|
||||
script.append(" widgetAttrs : { ");
|
||||
|
||||
String nodeAttrs = getNodeAttributesAsString(context, advisedChild);
|
||||
String dojoAttrs = getDojoAttributesAsString(context, component);
|
||||
@@ -63,13 +61,7 @@ public class DojoAdvisorRenderer extends DojoRenderer {
|
||||
}
|
||||
script.append(dojoAttrs);
|
||||
|
||||
script.append(" }\"})");
|
||||
|
||||
if (JsfUtils.isAsynchronousFlowRequest()) {
|
||||
script.append(".apply()");
|
||||
}
|
||||
|
||||
script.append("); ");
|
||||
script.append(" }}));");
|
||||
|
||||
writer.writeText(script, null);
|
||||
writer.endElement(SCRIPT_ELEMENT);
|
||||
|
||||
@@ -69,20 +69,16 @@ public class ProgressiveCommandButtonRenderer extends BaseDojoParentComponentRen
|
||||
|
||||
Boolean ajaxEnabled = (Boolean) component.getAttributes().get("ajaxEnabled");
|
||||
String processIds = (String) component.getAttributes().get("processIds");
|
||||
String renderIds = (String) component.getAttributes().get("renderIds");
|
||||
if (Boolean.TRUE.equals(ajaxEnabled)) {
|
||||
if (StringUtils.hasText(processIds) && !processIds.contains(component.getClientId(context))) {
|
||||
processIds = component.getClientId(context) + ", " + processIds;
|
||||
} else if (!StringUtils.hasText(processIds)) {
|
||||
processIds = component.getClientId(context);
|
||||
}
|
||||
if (!StringUtils.hasText(renderIds)) {
|
||||
renderIds = processIds;
|
||||
}
|
||||
onclick.append("Spring.RemotingHandler.submitForm('" + component.getClientId(context) + "', ");
|
||||
onclick.append("Spring.remoting.submitForm('" + component.getClientId(context) + "', ");
|
||||
onclick.append("'" + RendererUtils.getFormId(context, component) + "', ");
|
||||
onclick.append("'" + processIds + "', '" + renderIds + "', " + encodeParams(context, component)
|
||||
+ "); return false;");
|
||||
onclick.append("{processIds: '" + processIds + "'" + encodeParams(context, component)
|
||||
+ "}); return false;");
|
||||
} else {
|
||||
onclick.append(getOnClickNoAjax(context, component));
|
||||
}
|
||||
@@ -142,20 +138,15 @@ public class ProgressiveCommandButtonRenderer extends BaseDojoParentComponentRen
|
||||
|
||||
protected String encodeParams(FacesContext context, UIComponent component) {
|
||||
StringBuffer paramArray = new StringBuffer();
|
||||
paramArray.append("[");
|
||||
for (int i = 0; i < component.getChildCount(); i++) {
|
||||
if (component.getChildren().get(i) instanceof UIParameter) {
|
||||
UIParameter param = (UIParameter) component.getChildren().get(i);
|
||||
Assert.hasText(param.getName(),
|
||||
"UIParameter requires a name when used as a child of a UICommand component");
|
||||
if (paramArray.length() > 1) {
|
||||
paramArray.append(", ");
|
||||
}
|
||||
paramArray.append("{name : '" + param.getName() + "'");
|
||||
paramArray.append(", value : '" + param.getValue() + "'}");
|
||||
|
||||
paramArray.append(", " + param.getName() + ": '" + param.getValue() + "'");
|
||||
}
|
||||
}
|
||||
paramArray.append("]");
|
||||
return paramArray.toString();
|
||||
}
|
||||
|
||||
|
||||
@@ -101,9 +101,9 @@ public class ProgressiveCommandLinkRenderer extends ProgressiveCommandButtonRend
|
||||
public void encodeEnd(FacesContext context, UIComponent component) throws IOException {
|
||||
super.encodeEnd(context, component);
|
||||
|
||||
StringBuffer advisorParams = new StringBuffer();
|
||||
advisorParams.append("{");
|
||||
advisorParams.append("targetElId : '" + component.getClientId(context) + "'");
|
||||
StringBuffer decorationParams = new StringBuffer();
|
||||
decorationParams.append("{");
|
||||
decorationParams.append("elementId : '" + component.getClientId(context) + "'");
|
||||
|
||||
ResponseWriter writer = context.getResponseWriter();
|
||||
// Close the script variable started in encodeBegin if this is not an AJAX request
|
||||
@@ -117,18 +117,14 @@ public class ProgressiveCommandLinkRenderer extends ProgressiveCommandButtonRend
|
||||
String scriptVarEnd = "\";\n";
|
||||
writer.writeText(scriptVarEnd, null);
|
||||
|
||||
advisorParams.append(", linkHtml : " + component.getClientId(context).replaceAll(":", "_") + "_link");
|
||||
decorationParams.append(", linkHtml : " + component.getClientId(context).replaceAll(":", "_") + "_link");
|
||||
writer.endElement("script");
|
||||
}
|
||||
|
||||
advisorParams.append("}");
|
||||
decorationParams.append("}");
|
||||
StringBuffer advisorScript = new StringBuffer();
|
||||
advisorScript.append("Spring.advisors.push(new Spring.CommandLinkAdvisor(" + advisorParams.toString() + ")");
|
||||
// Apply the advisor immediately if this is an AJAX request
|
||||
if (JsfUtils.isAsynchronousFlowRequest()) {
|
||||
advisorScript.append(".apply()");
|
||||
}
|
||||
advisorScript.append(");");
|
||||
advisorScript.append("Spring.addDecoration(new Spring.CommandLinkDecoration(" + decorationParams.toString()
|
||||
+ "));");
|
||||
writer.startElement("script", component);
|
||||
writer.writeText(advisorScript, null);
|
||||
writer.endElement("script");
|
||||
|
||||
@@ -44,8 +44,8 @@ public class ValidateAllRenderer extends SpringFacesRenderer {
|
||||
writer.startElement(SCRIPT_ELEMENT, component);
|
||||
writer.writeAttribute("type", "text/javascript", null);
|
||||
StringBuffer script = new StringBuffer();
|
||||
script.append("Spring.advisors.push(new Spring.ValidateAllAdvisor({" + "event : 'onclick', " + "targetId : '"
|
||||
+ advisedChild.getClientId(context) + "'}));");
|
||||
script.append("Spring.addDecoration(new Spring.ValidateAllDecoration({" + "event : 'onclick', "
|
||||
+ "elementId : '" + advisedChild.getClientId(context) + "'}));");
|
||||
writer.writeText(script, null);
|
||||
writer.endElement(SCRIPT_ELEMENT);
|
||||
}
|
||||
|
||||
@@ -35,12 +35,12 @@ import org.springframework.context.ApplicationContext;
|
||||
import org.springframework.core.io.ContextResource;
|
||||
import org.springframework.core.io.Resource;
|
||||
import org.springframework.faces.ui.AjaxViewRoot;
|
||||
import org.springframework.js.mvc.servlet.AjaxHandler;
|
||||
import org.springframework.js.mvc.servlet.SpringJavascriptAjaxHandler;
|
||||
import org.springframework.webflow.context.ExternalContext;
|
||||
import org.springframework.webflow.execution.RequestContext;
|
||||
import org.springframework.webflow.execution.View;
|
||||
import org.springframework.webflow.execution.ViewFactory;
|
||||
import org.springframework.webflow.mvc.servlet.AjaxHandler;
|
||||
import org.springframework.webflow.mvc.servlet.SpringJavascriptAjaxHandler;
|
||||
|
||||
/**
|
||||
* JSF-specific {@link ViewFactory} implementation.
|
||||
|
||||
@@ -5,7 +5,6 @@
|
||||
<classpathentry kind="src" output="target/test-classes" path="src/test/java"/>
|
||||
<classpathentry kind="src" path="src/test/resources"/>
|
||||
<classpathentry combineaccessrules="false" kind="src" path="/spring-binding"/>
|
||||
<classpathentry combineaccessrules="false" kind="src" path="/spring-webflow"/>
|
||||
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/>
|
||||
<classpathentry kind="var" path="IVY_CACHE/javax.servlet/servlet-api/servlet-api-2.4.jar" sourcepath="IVY_CACHE/javax.servlet/servlet-api/servlet-api-sources-2.4.jar"/>
|
||||
<classpathentry kind="var" path="IVY_CACHE/org.apache/commons-logging/commons-logging-1.1.1.jar" sourcepath="/IVY_CACHE/org.apache/commons-logging/commons-logging-sources-1.1.1.jar"/>
|
||||
@@ -14,5 +13,12 @@
|
||||
<classpathentry kind="var" path="IVY_CACHE/org.junit/junit/junit-3.8.2.jar" sourcepath="/IVY_CACHE/org.junit/junit/junit-sources-3.8.2.jar"/>
|
||||
<classpathentry kind="var" path="IVY_CACHE/org.springframework/spring-test/spring-test-2.5.3.jar" sourcepath="IVY_CACHE/org.springframework/spring-test/spring-test-sources-2.5.3.jar"/>
|
||||
<classpathentry kind="var" path="IVY_CACHE/org.springframework/spring-core/spring-core-2.5.3.jar" sourcepath="IVY_CACHE/org.springframework/spring-core/spring-core-sources-2.5.3.jar"/>
|
||||
<classpathentry kind="var" path="IVY_CACHE/org.springframework/spring-webmvc/spring-webmvc-2.5.3.jar" sourcepath="IVY_CACHE/org.springframework/spring-webmvc/spring-webmvc-sources-2.5.3.jar"/>
|
||||
<classpathentry kind="var" path="IVY_CACHE/org.springframework/spring-context/spring-context-2.5.3.jar" sourcepath="IVY_CACHE/org.springframework/spring-context/spring-context-sources-2.5.3.jar"/>
|
||||
<classpathentry kind="var" path="IVY_CACHE/org.apache.tiles/tiles-core/tiles-core-2.0.5.jar"/>
|
||||
<classpathentry kind="var" path="IVY_CACHE/org.springframework/spring-beans/spring-beans-2.5.3.jar" sourcepath="IVY_CACHE/org.springframework/spring-beans/spring-beans-sources-2.5.3.jar"/>
|
||||
<classpathentry kind="var" path="IVY_CACHE/org.springframework/spring-web/spring-web-2.5.3.jar" sourcepath="IVY_CACHE/org.springframework/spring-web/spring-web-sources-2.5.3.jar"/>
|
||||
<classpathentry kind="var" path="IVY_CACHE/org.apache.tiles/tiles-api/tiles-api-2.0.5.jar"/>
|
||||
<classpathentry kind="var" path="IVY_CACHE/org.apache.tiles/tiles-jsp/tiles-jsp-2.0.5.jar"/>
|
||||
<classpathentry kind="output" path="target/classes"/>
|
||||
</classpath>
|
||||
|
||||
@@ -23,9 +23,15 @@
|
||||
<!-- global dependencies -->
|
||||
<dependency org="org.apache" name="commons-logging" rev="1.1.1" conf="compile->default"/>
|
||||
<dependency org="org.springframework" name="spring-core" rev="2.5.3" conf="compile->default"/>
|
||||
<dependency org="org.springframework" name="spring-beans" rev="2.5.3" conf="compile->default"/>
|
||||
<dependency org="org.springframework" name="spring-web" rev="2.5.3" conf="compile->default"/>
|
||||
<dependency org="org.springframework" name="spring-webmvc" rev="2.5.3" conf="compile->default"/>
|
||||
|
||||
<!-- build time only dependencies -->
|
||||
<dependency org="javax.servlet" name="servlet-api" rev="2.4" conf="provided->default" />
|
||||
<dependency org="org.apache.tiles" name="tiles-api" rev="2.0.5" conf="provided->default"/>
|
||||
<dependency org="org.apache.tiles" name="tiles-core" rev="2.0.5" conf="provided->default"/>
|
||||
<dependency org="org.apache.tiles" name="tiles-jsp" rev="2.0.5" conf="provided->default"/>
|
||||
|
||||
<!-- test dependencies -->
|
||||
<dependency org="org.apache.logging" name="log4j" rev="1.2.15" conf="test->default" />
|
||||
|
||||
@@ -0,0 +1,77 @@
|
||||
package org.springframework.js.ajax.view;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.Iterator;
|
||||
import java.util.Map;
|
||||
|
||||
import javax.servlet.ServletContext;
|
||||
import javax.servlet.ServletException;
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
|
||||
import org.apache.tiles.Attribute;
|
||||
import org.apache.tiles.Definition;
|
||||
import org.apache.tiles.Attribute.AttributeType;
|
||||
import org.apache.tiles.access.TilesAccess;
|
||||
import org.apache.tiles.context.TilesRequestContext;
|
||||
import org.apache.tiles.impl.BasicTilesContainer;
|
||||
import org.springframework.js.mvc.servlet.AjaxHandler;
|
||||
import org.springframework.js.mvc.servlet.SpringJavascriptAjaxHandler;
|
||||
import org.springframework.web.servlet.support.JstlUtils;
|
||||
import org.springframework.web.servlet.support.RequestContext;
|
||||
import org.springframework.web.servlet.view.tiles2.TilesView;
|
||||
|
||||
public class TilesAjaxView extends TilesView {
|
||||
|
||||
public static final String FRAGMENTS_PARAM = "fragments";
|
||||
|
||||
private AjaxHandler ajaxHandler = new SpringJavascriptAjaxHandler();
|
||||
|
||||
protected void renderMergedOutputModel(Map model, HttpServletRequest request, HttpServletResponse response)
|
||||
throws Exception {
|
||||
|
||||
ServletContext servletContext = getServletContext();
|
||||
if (ajaxHandler.isAjaxRequest(servletContext, request, response)) {
|
||||
BasicTilesContainer container = (BasicTilesContainer) TilesAccess.getContainer(servletContext);
|
||||
if (container == null) {
|
||||
throw new ServletException("Tiles container is not initialized. "
|
||||
+ "Have you added a TilesConfigurer to your web application context?");
|
||||
}
|
||||
|
||||
exposeModelAsRequestAttributes(model, request);
|
||||
JstlUtils.exposeLocalizationContext(new RequestContext(request, servletContext));
|
||||
|
||||
TilesRequestContext tilesRequestContext = container.getContextFactory().createRequestContext(
|
||||
container.getApplicationContext(), new Object[] { request, response });
|
||||
Definition compositeDefinition = container.getDefinitionsFactory().getDefinition(getUrl(),
|
||||
tilesRequestContext);
|
||||
Map flattenedAttributeMap = new HashMap();
|
||||
flattenAttributeMap(container, tilesRequestContext, flattenedAttributeMap, compositeDefinition);
|
||||
|
||||
String attrName = request.getParameter(FRAGMENTS_PARAM);
|
||||
|
||||
Attribute attributeToRender = (Attribute) flattenedAttributeMap.get(attrName);
|
||||
|
||||
container.render(attributeToRender, response.getWriter(), new Object[] { request, response });
|
||||
} else {
|
||||
super.renderMergedOutputModel(model, request, response);
|
||||
}
|
||||
}
|
||||
|
||||
private void flattenAttributeMap(BasicTilesContainer container, TilesRequestContext requestContext, Map resultMap,
|
||||
Definition compositeDefinition) throws Exception {
|
||||
Iterator i = compositeDefinition.getAttributes().keySet().iterator();
|
||||
while (i.hasNext()) {
|
||||
Object key = i.next();
|
||||
Attribute attr = (Attribute) compositeDefinition.getAttributes().get(key);
|
||||
if (attr.getType() == AttributeType.DEFINITION) {
|
||||
Definition nestedDefinition = container.getDefinitionsFactory().getDefinition(
|
||||
attr.getValue().toString(), requestContext);
|
||||
flattenAttributeMap(container, requestContext, resultMap, nestedDefinition);
|
||||
} else {
|
||||
resultMap.put(key, attr);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
@@ -13,7 +13,7 @@
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
package org.springframework.webflow.mvc.servlet;
|
||||
package org.springframework.js.mvc.servlet;
|
||||
|
||||
import java.io.IOException;
|
||||
|
||||
@@ -13,7 +13,7 @@
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
package org.springframework.webflow.mvc.servlet;
|
||||
package org.springframework.js.mvc.servlet;
|
||||
|
||||
import java.io.IOException;
|
||||
|
||||
@@ -34,22 +34,22 @@ public class SpringJavascriptAjaxHandler implements AjaxHandler {
|
||||
/**
|
||||
* The response header to be set on an Ajax redirect
|
||||
*/
|
||||
private static final String FLOW_REDIRECT_URL_HEADER = "Flow-Redirect-URL";
|
||||
public static final String REDIRECT_URL_HEADER = "Spring-Redirect-URL";
|
||||
|
||||
/**
|
||||
* The response header to be set on an redirect that should be issued from a popup window.
|
||||
*/
|
||||
private static final String POPUP_VIEW_HEADER = "Flow-Modal-View";
|
||||
public static final String POPUP_VIEW_HEADER = "Spring-Modal-View";
|
||||
|
||||
/**
|
||||
* The accept header value that signifies an Ajax request.
|
||||
*/
|
||||
private static final String AJAX_ACCEPT_CONTENT_TYPE = "text/html;type=ajax";
|
||||
public static final String AJAX_ACCEPT_CONTENT_TYPE = "text/html;type=ajax";
|
||||
|
||||
/**
|
||||
* Alternate request parameter to indicate an Ajax request for cases when control of the header is not available.
|
||||
*/
|
||||
private static final String AJAX_SOURCE_PARAM = "ajaxSource";
|
||||
public static final String AJAX_SOURCE_PARAM = "ajaxSource";
|
||||
|
||||
public boolean isAjaxRequest(ServletContext context, HttpServletRequest request, HttpServletResponse response) {
|
||||
String acceptHeader = request.getHeader("Accept");
|
||||
@@ -66,7 +66,7 @@ public class SpringJavascriptAjaxHandler implements AjaxHandler {
|
||||
if (popup) {
|
||||
response.setHeader(POPUP_VIEW_HEADER, "true");
|
||||
}
|
||||
response.setHeader(FLOW_REDIRECT_URL_HEADER, response.encodeRedirectURL(targetUrl));
|
||||
response.setHeader(REDIRECT_URL_HEADER, response.encodeRedirectURL(targetUrl));
|
||||
}
|
||||
|
||||
}
|
||||
File diff suppressed because one or more lines are too long
@@ -13,88 +13,62 @@
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
Spring.DojoValidatingFieldAdvisor = function(config){
|
||||
|
||||
dojo.mixin(this, config);
|
||||
};
|
||||
|
||||
Spring.DojoValidatingFieldAdvisor.prototype = {
|
||||
|
||||
targetElId : "",
|
||||
decoratorType : "",
|
||||
decorator : null,
|
||||
decoratorAttrs : "",
|
||||
|
||||
apply : function(){
|
||||
if (dijit.byId(this.targetElId)) {
|
||||
dijit.byId(this.targetElId).destroyRecursive(false);
|
||||
|
||||
dojo.declare("Spring.ElementDecoration", Spring.AbstractElementDecoration, {
|
||||
constructor : function(config) {
|
||||
this.copyFields = new Array('name', 'value', 'type', 'checked', 'selected', 'readOnly', 'disabled', 'alt', 'maxLength');
|
||||
dojo.mixin(this, config);
|
||||
if(this.widgetModule == "") {
|
||||
this.widgetModule = this.widgetType;
|
||||
}
|
||||
this.decorator = eval("new "+ this.decoratorType + "(" + this.decoratorAttrs +", dojo.byId('"+this.targetElId+"'));" );
|
||||
this.decorator.startup();
|
||||
|
||||
},
|
||||
|
||||
apply : function(){
|
||||
if (dijit.byId(this.elementId)) {
|
||||
dijit.byId(this.elementId).destroyRecursive(false);
|
||||
}
|
||||
var element = dojo.byId(this.elementId);
|
||||
for (var copyField in this.copyFields) {
|
||||
copyField = this.copyFields[copyField];
|
||||
if (!this.widgetAttrs[copyField] && element[copyField] && (typeof element[copyField] != 'number' ||
|
||||
(typeof element[copyField] == 'number' && element[copyField] >= 0))) {
|
||||
this.widgetAttrs[copyField] = element[copyField];
|
||||
}
|
||||
}
|
||||
dojo.require(this.widgetModule);
|
||||
var widgetConstructor = dojo.eval(this.widgetType);
|
||||
this.widget = new widgetConstructor(this.widgetAttrs, element);
|
||||
this.widget.startup();
|
||||
//return this to support method chaining
|
||||
return this;
|
||||
},
|
||||
|
||||
validate : function(){
|
||||
var isValid = this.decorator.isValid(false);
|
||||
if (!this.widget.isValid) {
|
||||
// some widgets cannot be validated
|
||||
return true;
|
||||
}
|
||||
var isValid = this.widget.isValid(false);
|
||||
if (!isValid) {
|
||||
this.decorator.state = "Error";
|
||||
this.decorator._setStateClass();
|
||||
this.widget.state = "Error";
|
||||
this.widget._setStateClass();
|
||||
}
|
||||
return isValid;
|
||||
}
|
||||
};
|
||||
});
|
||||
|
||||
Spring.ValidatingFieldAdvisor = Spring.DojoValidatingFieldAdvisor;
|
||||
|
||||
Spring.DojoRemoteEventAdvisor = function(config){
|
||||
dojo.mixin(this, config);
|
||||
};
|
||||
|
||||
Spring.DojoRemoteEventAdvisor.prototype = {
|
||||
|
||||
event : "",
|
||||
targetId : "",
|
||||
sourceId : "",
|
||||
formId : "",
|
||||
processIds : "",
|
||||
renderIds : "",
|
||||
params : [],
|
||||
connection : null,
|
||||
|
||||
apply : function() {
|
||||
this.connection = dojo.connect(dojo.byId(this.targetId), this.event, this, "submit");
|
||||
return this;
|
||||
dojo.declare("Spring.ValidateAllDecoration", Spring.AbstractValidateAllDecoration, {
|
||||
constructor : function(config) {
|
||||
this.originalHandler = null;
|
||||
this.connection = null;
|
||||
dojo.mixin(this, config);
|
||||
},
|
||||
|
||||
cleanup : function(){
|
||||
dojo.disconnect(this.connection);
|
||||
},
|
||||
|
||||
submit : function(){
|
||||
Spring.RemotingHandler.submitForm(this.sourceId, this.formId, this.processIds, this.renderIds, this.params);
|
||||
}
|
||||
};
|
||||
|
||||
Spring.RemoteEventAdvisor = Spring.DojoRemoteEventAdvisor;
|
||||
|
||||
Spring.DojoValidateAllAdvisor = function(config){
|
||||
dojo.mixin(this, config);
|
||||
};
|
||||
|
||||
Spring.DojoValidateAllAdvisor.prototype = {
|
||||
|
||||
event : "",
|
||||
targetId : "",
|
||||
originalHandler : null,
|
||||
connection : null,
|
||||
|
||||
apply : function() {
|
||||
var targetEl = dojo.byId(this.targetId);
|
||||
this.originalHandler = targetEl[this.event];
|
||||
var element = dojo.byId(this.elementId);
|
||||
this.originalHandler = element[this.event];
|
||||
var context = this;
|
||||
targetEl[this.event] = function(event){
|
||||
element[this.event] = function(event){
|
||||
context.handleEvent(event, context);
|
||||
};
|
||||
return this;
|
||||
@@ -107,40 +81,65 @@ Spring.DojoValidateAllAdvisor.prototype = {
|
||||
handleEvent : function(event, context){
|
||||
if (!Spring.validateAll()) {
|
||||
dojo.stopEvent(event);
|
||||
} else {
|
||||
} else if(dojo.isFunction(context.originalHandler)) {
|
||||
var result = context.originalHandler(event);
|
||||
if (result == false) {
|
||||
dojo.stopEvent(event);
|
||||
}
|
||||
}
|
||||
}
|
||||
};
|
||||
});
|
||||
|
||||
Spring.ValidateAllAdvisor = Spring.DojoValidateAllAdvisor;
|
||||
|
||||
Spring.DojoRemotingHandler = function(){};
|
||||
|
||||
Spring.DojoRemotingHandler.prototype = {
|
||||
dojo.declare("Spring.AjaxEventDecoration", Spring.AbstractAjaxEventDecoration, {
|
||||
constructor : function(config){
|
||||
this.connection = null;
|
||||
dojo.mixin(this, config);
|
||||
},
|
||||
|
||||
submitForm : function(/*String */ sourceId, /*String*/formId, /*String*/ processIds, /*String*/renderIds, /*Array*/ params) {
|
||||
apply : function() {
|
||||
this.connection = dojo.connect(dojo.byId(this.elementId), this.event, this, "submit");
|
||||
return this;
|
||||
},
|
||||
|
||||
cleanup : function(){
|
||||
dojo.disconnect(this.connection);
|
||||
},
|
||||
|
||||
submit : function(event){
|
||||
if (this.sourceId == ""){
|
||||
this.sourceId = this.elementId;
|
||||
}
|
||||
if(this.formId == ""){
|
||||
Spring.remoting.getLinkedResource(this.sourceId, this.params, false);
|
||||
} else {
|
||||
Spring.remoting.submitForm(this.sourceId, this.formId, this.params);
|
||||
}
|
||||
dojo.stopEvent(event);
|
||||
}
|
||||
});
|
||||
|
||||
dojo.declare("Spring.RemotingHandler", Spring.AbstractRemotingHandler, {
|
||||
constructor : function(){},
|
||||
|
||||
submitForm : function(/*String */ sourceId, /*String*/formId, /*Object*/ params) {
|
||||
var content = new Object();
|
||||
for (var key in params) {
|
||||
content[key] = params[key];
|
||||
}
|
||||
|
||||
var sourceComponent = dojo.byId(sourceId);
|
||||
content['processIds'] = processIds;
|
||||
content['renderIds'] = renderIds;
|
||||
|
||||
if (sourceComponent != null){
|
||||
if(sourceComponent.value) {
|
||||
if(sourceComponent.value != undefined) {
|
||||
content[sourceId] = sourceComponent.value;
|
||||
} else {
|
||||
content[sourceId] = sourceId;
|
||||
}
|
||||
}
|
||||
|
||||
dojo.forEach(params, function(param){
|
||||
content[param.name] = param.value;
|
||||
});
|
||||
|
||||
content['ajaxSource'] = sourceId;
|
||||
if (!content['ajaxSource']) {
|
||||
content['ajaxSource'] = sourceId;
|
||||
}
|
||||
|
||||
dojo.xhrPost({
|
||||
|
||||
@@ -161,18 +160,22 @@ Spring.DojoRemotingHandler.prototype = {
|
||||
|
||||
},
|
||||
|
||||
getLinkedResource: function(/*String */ linkId, /*boolean*/ modal) {
|
||||
this.getResource(dojo.byId(linkId).href, modal);
|
||||
getLinkedResource: function(/*String */ linkId, /*Object*/params, /*boolean*/ modal) {
|
||||
this.getResource(dojo.byId(linkId).href, params, modal);
|
||||
},
|
||||
|
||||
getResource: function(/*String */ resourceUri, /*boolean*/ modal) {
|
||||
getResource: function(/*String */ resourceUri, /*Object*/params, /*boolean*/ modal) {
|
||||
|
||||
dojo.xhrGet({
|
||||
|
||||
url: resourceUri,
|
||||
|
||||
content: params,
|
||||
|
||||
handleAs: "text",
|
||||
|
||||
headers: {"Accept" : "text/html;type=ajax"},
|
||||
|
||||
load: this.handleResponse,
|
||||
|
||||
error: this.handleError,
|
||||
@@ -184,14 +187,14 @@ Spring.DojoRemotingHandler.prototype = {
|
||||
handleResponse: function(response, ioArgs) {
|
||||
|
||||
//First check if this response should redirect
|
||||
var redirectURL = ioArgs.xhr.getResponseHeader('Flow-Redirect-URL');
|
||||
var modalViewHeader = ioArgs.xhr.getResponseHeader('Flow-Modal-View');
|
||||
var redirectURL = ioArgs.xhr.getResponseHeader('Spring-Redirect-URL');
|
||||
var modalViewHeader = ioArgs.xhr.getResponseHeader('Spring-Modal-View');
|
||||
var modalView = ((dojo.isString(modalViewHeader) && modalViewHeader.length > 0) || ioArgs.args.modal);
|
||||
|
||||
if (dojo.isString(redirectURL) && redirectURL.length > 0) {
|
||||
if (modalView) {
|
||||
//render a popup with the new URL
|
||||
Spring.RemotingHandler.renderURLToModalDialog(redirectURL, ioArgs);
|
||||
Spring.remoting.renderURLToModalDialog(redirectURL, ioArgs);
|
||||
return response;
|
||||
}
|
||||
else {
|
||||
@@ -229,7 +232,7 @@ Spring.DojoRemotingHandler.prototype = {
|
||||
|
||||
//For a modal view, just dump the new nodes into a modal dialog
|
||||
if (modalView) {
|
||||
Spring.RemotingHandler.renderNodeListToModalDialog(newNodes);
|
||||
Spring.remoting.renderNodeListToModalDialog(newNodes);
|
||||
}
|
||||
else {
|
||||
|
||||
@@ -258,7 +261,7 @@ Spring.DojoRemotingHandler.prototype = {
|
||||
renderURLToModalDialog: function(url, ioArgs) {
|
||||
url = url + "&"+dojo.objectToQuery(ioArgs.args.content);
|
||||
|
||||
Spring.RemotingHandler.getResource(url, true);
|
||||
Spring.remoting.getResource(url, {}, true);
|
||||
},
|
||||
|
||||
renderNodeListToModalDialog: function(nodes) {
|
||||
@@ -271,28 +274,21 @@ Spring.DojoRemotingHandler.prototype = {
|
||||
});
|
||||
dialog.show();
|
||||
}
|
||||
};
|
||||
});
|
||||
|
||||
Spring.RemotingHandler = new Spring.DojoRemotingHandler();
|
||||
|
||||
Spring.DojoCommandLinkAdvisor = function(config){
|
||||
dojo.mixin(this, config);
|
||||
};
|
||||
|
||||
Spring.DojoCommandLinkAdvisor.prototype = {
|
||||
|
||||
targetElId : "",
|
||||
|
||||
linkHtml : "",
|
||||
dojo.declare("Spring.CommandLinkDecoration", Spring.AbstractCommandLinkDecoration, {
|
||||
constructor : function(config){
|
||||
dojo.mixin(this, config);
|
||||
},
|
||||
|
||||
apply : function(){
|
||||
var advisedNode = dojo.byId(this.targetElId);
|
||||
var advisedNode = dojo.byId(this.elementId);
|
||||
if (!dojo.hasClass(advisedNode, "progressiveLink")) {
|
||||
//Node must be replaced
|
||||
var nodeToReplace = new dojo.NodeList(advisedNode);
|
||||
nodeToReplace.addContent(this.linkHtml, "after").orphan("*");
|
||||
//Get the new node
|
||||
advisedNode = dojo.byId(this.targetElId);
|
||||
advisedNode = dojo.byId(this.elementId);
|
||||
}
|
||||
advisedNode.submitFormFromLink = this.submitFormFromLink;
|
||||
//return this to support method chaining
|
||||
@@ -325,8 +321,6 @@ Spring.DojoCommandLinkAdvisor.prototype = {
|
||||
});
|
||||
}
|
||||
}
|
||||
};
|
||||
});
|
||||
|
||||
Spring.CommandLinkAdvisor = Spring.DojoCommandLinkAdvisor;
|
||||
|
||||
dojo.addOnLoad(Spring.applyAdvisors);
|
||||
dojo.addOnLoad(Spring.initialize);
|
||||
@@ -13,4 +13,4 @@
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
Spring={};Spring.advisors=[];Spring.advisors.applied=false;Spring.applyAdvisors=function(){if(!Spring.advisors.applied){for(var x=0;x<Spring.advisors.length;x++){Spring.advisors[x].apply();}Spring.advisors.applied=true;}};Spring.validateAll=function(){var _2=true;for(x in Spring.advisors){if(Spring.advisors[x].decorator&&!Spring.advisors[x].validate()){_2=false;}}return _2;};Spring.validateRequired=function(){var _3=true;for(x in Spring.advisors){if(Spring.advisors[x].decorator&&Spring.advisors[x].isRequired()&&!Spring.advisors[x].validate()){_3=false;}}return _3;};Spring.ValidatingFieldAdvisor=function(){};Spring.ValidatingFieldAdvisor.prototype={targetElId:"",decoratorType:"",decorator:null,decoratorAttrs:"",apply:function(){},validate:function(){},isRequired:function(){}};Spring.ValidateAllAdvisor=function(){};Spring.ValidateAllAdvisor.prototype={event:"",targetId:"",connection:null,apply:function(){},cleanup:function(){},handleEvent:function(_4){}};Spring.CommandLinkAdvisor=function(){};Spring.CommandLinkAdvisor.prototype={targetElId:"",linkHtml:"",apply:function(){},submitFormFromLink:function(_5,_6,_7){}};Spring.RemoteEventAdvisor=function(){};Spring.RemoteEventAdvisor.prototype={event:"",targetId:"",sourceId:"",formId:"",processIds:"",renderIds:"",params:[],connection:null,apply:function(){},cleanup:function(){},submit:function(_8){}};Spring.RemotingHandler=function(){};Spring.RemotingHandler.prototype={submitForm:function(_9,_a,_b,_c,_d){},getResource:function(_e,_f,_10){},handleResponse:function(){},handleError:function(){}};
|
||||
Spring={};Spring.decorations=[];Spring.decorations.applied=false;Spring.initialize=function(){Spring.applyDecorations();Spring.remoting=new Spring.RemotingHandler();};Spring.addDecoration=function(_1){Spring.decorations.push(_1);if(Spring.decorations.applied){_1.apply();}};Spring.applyDecorations=function(){if(!Spring.decorations.applied){for(var x=0;x<Spring.decorations.length;x++){Spring.decorations[x].apply();}Spring.decorations.applied=true;}};Spring.validateAll=function(){var _3=true;for(x in Spring.decorations){if(Spring.decorations[x].widget&&!Spring.decorations[x].validate()){_3=false;}}return _3;};Spring.validateRequired=function(){var _4=true;for(x in Spring.decorations){if(Spring.decorations[x].decorator&&Spring.decorations[x].isRequired()&&!Spring.decorations[x].validate()){_4=false;}}return _4;};Spring.AbstractElementDecoration=function(){};Spring.AbstractElementDecoration.prototype={elementId:"",widgetType:"",widgetModule:"",widget:null,widgetAttrs:{},apply:function(){},validate:function(){},isRequired:function(){}};Spring.AbstractValidateAllDecoration=function(){};Spring.AbstractValidateAllDecoration.prototype={event:"",elementId:"",apply:function(){},cleanup:function(){},handleEvent:function(_5){}};Spring.AbstractCommandLinkDecoration=function(){};Spring.AbstractCommandLinkDecoration.prototype={elementId:"",linkHtml:"",apply:function(){},submitFormFromLink:function(_6,_7,_8){}};Spring.AbstractAjaxEventDecoration=function(){};Spring.AbstractAjaxEventDecoration.prototype={event:"",elementId:"",sourceId:"",formId:"",params:{},apply:function(){},cleanup:function(){},submit:function(_9){}};Spring.AbstractRemotingHandler=function(){};Spring.AbstractRemotingHandler.prototype={submitForm:function(_a,_b,_c){},getLinkedResource:function(_d,_e,_f){},getResource:function(_10,_11,_12){},handleResponse:function(){},handleError:function(){}};
|
||||
@@ -15,24 +15,36 @@
|
||||
*/
|
||||
Spring = {};
|
||||
|
||||
Spring.advisors = [];
|
||||
Spring.decorations = [];
|
||||
|
||||
Spring.advisors.applied = false;
|
||||
Spring.decorations.applied = false;
|
||||
|
||||
Spring.initialize = function(){
|
||||
Spring.applyDecorations();
|
||||
Spring.remoting = new Spring.RemotingHandler();
|
||||
};
|
||||
|
||||
Spring.addDecoration = function(/*Object*/decoration){
|
||||
Spring.decorations.push(decoration);
|
||||
if(Spring.decorations.applied) {
|
||||
decoration.apply();
|
||||
}
|
||||
};
|
||||
|
||||
Spring.applyAdvisors = function(){
|
||||
if (!Spring.advisors.applied) {
|
||||
for (var x=0; x<Spring.advisors.length; x++) {
|
||||
Spring.advisors[x].apply();
|
||||
Spring.applyDecorations = function(){
|
||||
if (!Spring.decorations.applied) {
|
||||
for (var x=0; x<Spring.decorations.length; x++) {
|
||||
Spring.decorations[x].apply();
|
||||
}
|
||||
Spring.advisors.applied = true;
|
||||
Spring.decorations.applied = true;
|
||||
}
|
||||
};
|
||||
|
||||
Spring.validateAll = function(){
|
||||
var valid = true;
|
||||
for(x in Spring.advisors) {
|
||||
if (Spring.advisors[x].decorator &&
|
||||
!Spring.advisors[x].validate()) {
|
||||
for(x in Spring.decorations) {
|
||||
if (Spring.decorations[x].widget &&
|
||||
!Spring.decorations[x].validate()) {
|
||||
valid = false;
|
||||
}
|
||||
}
|
||||
@@ -41,23 +53,24 @@ Spring.validateAll = function(){
|
||||
|
||||
Spring.validateRequired = function(){
|
||||
var valid = true;
|
||||
for(x in Spring.advisors) {
|
||||
if(Spring.advisors[x].decorator &&
|
||||
Spring.advisors[x].isRequired() &&
|
||||
!Spring.advisors[x].validate())
|
||||
for(x in Spring.decorations) {
|
||||
if(Spring.decorations[x].decorator &&
|
||||
Spring.decorations[x].isRequired() &&
|
||||
!Spring.decorations[x].validate())
|
||||
valid = false;
|
||||
}
|
||||
return valid;
|
||||
};
|
||||
|
||||
Spring.ValidatingFieldAdvisor = function(){};
|
||||
Spring.AbstractElementDecoration = function(){};
|
||||
|
||||
Spring.ValidatingFieldAdvisor.prototype = {
|
||||
Spring.AbstractElementDecoration.prototype = {
|
||||
|
||||
targetElId : "",
|
||||
decoratorType : "",
|
||||
decorator : null,
|
||||
decoratorAttrs : "",
|
||||
elementId : "",
|
||||
widgetType : "",
|
||||
widgetModule : "",
|
||||
widget : null,
|
||||
widgetAttrs : {},
|
||||
|
||||
apply : function(){},
|
||||
|
||||
@@ -66,13 +79,12 @@ Spring.ValidatingFieldAdvisor.prototype = {
|
||||
isRequired : function(){}
|
||||
};
|
||||
|
||||
Spring.ValidateAllAdvisor = function(){};
|
||||
Spring.AbstractValidateAllDecoration = function(){};
|
||||
|
||||
Spring.ValidateAllAdvisor.prototype = {
|
||||
Spring.AbstractValidateAllDecoration.prototype = {
|
||||
|
||||
event : "",
|
||||
targetId : "",
|
||||
connection : null,
|
||||
elementId : "",
|
||||
|
||||
apply : function() {},
|
||||
|
||||
@@ -81,11 +93,11 @@ Spring.ValidateAllAdvisor.prototype = {
|
||||
handleEvent : function(event){}
|
||||
};
|
||||
|
||||
Spring.CommandLinkAdvisor = function(){};
|
||||
Spring.AbstractCommandLinkDecoration = function(){};
|
||||
|
||||
Spring.CommandLinkAdvisor.prototype = {
|
||||
Spring.AbstractCommandLinkDecoration.prototype = {
|
||||
|
||||
targetElId : "",
|
||||
elementId : "",
|
||||
linkHtml : "",
|
||||
|
||||
apply : function(){},
|
||||
@@ -93,18 +105,15 @@ Spring.CommandLinkAdvisor.prototype = {
|
||||
submitFormFromLink : function(/*String*/ formId, /*String*/ sourceId, /*Array of name,value params*/ params){}
|
||||
};
|
||||
|
||||
Spring.RemoteEventAdvisor = function(){};
|
||||
Spring.AbstractAjaxEventDecoration = function(){};
|
||||
|
||||
Spring.RemoteEventAdvisor.prototype = {
|
||||
Spring.AbstractAjaxEventDecoration.prototype = {
|
||||
|
||||
event : "",
|
||||
targetId : "",
|
||||
elementId : "",
|
||||
sourceId : "",
|
||||
formId : "",
|
||||
processIds : "",
|
||||
renderIds : "",
|
||||
params : [],
|
||||
connection : null,
|
||||
params : {},
|
||||
|
||||
apply : function(){},
|
||||
|
||||
@@ -113,13 +122,15 @@ Spring.RemoteEventAdvisor.prototype = {
|
||||
submit : function(event){}
|
||||
};
|
||||
|
||||
Spring.RemotingHandler = function(){};
|
||||
Spring.AbstractRemotingHandler = function(){};
|
||||
|
||||
Spring.RemotingHandler.prototype = {
|
||||
Spring.AbstractRemotingHandler.prototype = {
|
||||
|
||||
submitForm : function(/*String */ sourceId, /*String*/formId, /*String*/ processIds, /*String*/renderIds, /*Array*/ params){},
|
||||
submitForm : function(/*String */ sourceId, /*String*/formId, /*Object*/ params){},
|
||||
|
||||
getResource : function(/*String */ sourceId, /*String*/ processIds, /*String*/renderIds) {},
|
||||
getLinkedResource: function(/*String */ linkId, /*Object*/params, /*boolean*/ modal) {},
|
||||
|
||||
getResource : function(/*String */ resourceUri, /*Object*/params, /*boolean*/ modal) {},
|
||||
|
||||
handleResponse : function() {},
|
||||
|
||||
|
||||
@@ -8,7 +8,6 @@ import javax.servlet.ServletContext;
|
||||
|
||||
import junit.framework.TestCase;
|
||||
|
||||
import org.springframework.js.resource.ResourceServlet;
|
||||
import org.springframework.mock.web.MockHttpServletRequest;
|
||||
import org.springframework.mock.web.MockHttpServletResponse;
|
||||
import org.springframework.mock.web.MockServletConfig;
|
||||
@@ -60,6 +59,14 @@ public class ResourceServletTests extends TestCase {
|
||||
assertEquals(404, response.getStatus());
|
||||
}
|
||||
|
||||
public final void testExecute_ProtectedPath() throws Exception {
|
||||
String requestPath = "/WEB-INF/web.xml";
|
||||
request.setPathInfo(requestPath);
|
||||
servlet.doGet(request, response);
|
||||
|
||||
assertEquals(404, response.getStatus());
|
||||
}
|
||||
|
||||
private class ResourceTestMockServletContext extends MockServletContext {
|
||||
|
||||
public String getMimeType(String filePath) {
|
||||
|
||||
@@ -39,5 +39,6 @@
|
||||
<classpathentry kind="var" path="IVY_CACHE/org.springframework/spring-webmvc-portlet/spring-webmvc-portlet-2.5.3.jar" sourcepath="IVY_CACHE/org.springframework/spring-webmvc-portlet/spring-webmvc-portlet-sources-2.5.3.jar"/>
|
||||
<classpathentry kind="var" path="IVY_CACHE/org.springframework.security/spring-security-core/spring-security-core-2.0.0.m2.jar" sourcepath="IVY_CACHE/org.springframework.security/spring-security-core/spring-security-core-sources-2.0.0.m2.jar"/>
|
||||
<classpathentry kind="var" path="IVY_CACHE/edu.emory.mathcs/backport-util-concurrent/backport-util-concurrent-3.0.0.jar"/>
|
||||
<classpathentry combineaccessrules="false" kind="src" path="/spring-js"/>
|
||||
<classpathentry kind="output" path="target/classes"/>
|
||||
</classpath>
|
||||
|
||||
@@ -28,6 +28,7 @@
|
||||
<dependency org="org.springframework" name="spring-web" rev="2.5.3" conf="compile->default"/>
|
||||
<dependency org="org.springframework" name="spring-webmvc" rev="2.5.3" conf="compile->default"/>
|
||||
<dependency org="org.springframework.webflow" name="spring-binding" rev="latest.integration" conf="compile->compile"/>
|
||||
<dependency org="org.springframework.webflow" name="spring-js" rev="latest.integration" conf="compile->compile"/>
|
||||
|
||||
<!-- testing support only dependencies -->
|
||||
<dependency org="org.junit" name="junit" rev="3.8.2" conf="compile, test->default" />
|
||||
|
||||
@@ -25,6 +25,8 @@ import javax.servlet.http.HttpServletResponse;
|
||||
|
||||
import org.apache.commons.logging.Log;
|
||||
import org.apache.commons.logging.LogFactory;
|
||||
import org.springframework.js.mvc.servlet.AjaxHandler;
|
||||
import org.springframework.js.mvc.servlet.SpringJavascriptAjaxHandler;
|
||||
import org.springframework.web.servlet.ModelAndView;
|
||||
import org.springframework.web.servlet.mvc.AbstractController;
|
||||
import org.springframework.web.servlet.view.RedirectView;
|
||||
|
||||
@@ -24,6 +24,8 @@ import javax.servlet.http.HttpServletResponse;
|
||||
|
||||
import org.apache.commons.logging.Log;
|
||||
import org.apache.commons.logging.LogFactory;
|
||||
import org.springframework.js.mvc.servlet.AjaxHandler;
|
||||
import org.springframework.js.mvc.servlet.SpringJavascriptAjaxHandler;
|
||||
import org.springframework.web.context.support.WebApplicationObjectSupport;
|
||||
import org.springframework.web.servlet.HandlerAdapter;
|
||||
import org.springframework.web.servlet.ModelAndView;
|
||||
|
||||
@@ -9,6 +9,7 @@ import javax.servlet.http.HttpServletResponse;
|
||||
import junit.framework.TestCase;
|
||||
|
||||
import org.easymock.EasyMock;
|
||||
import org.springframework.js.mvc.servlet.SpringJavascriptAjaxHandler;
|
||||
import org.springframework.mock.web.MockHttpServletRequest;
|
||||
import org.springframework.mock.web.MockHttpServletResponse;
|
||||
import org.springframework.mock.web.MockServletContext;
|
||||
|
||||
Reference in New Issue
Block a user