|
|
|
@ -86,7 +86,6 @@ import org.springframework.web.context.request.WebRequest; |
|
|
|
import org.springframework.web.context.support.GenericWebApplicationContext; |
|
|
|
import org.springframework.web.context.support.GenericWebApplicationContext; |
|
|
|
import org.springframework.web.portlet.DispatcherPortlet; |
|
|
|
import org.springframework.web.portlet.DispatcherPortlet; |
|
|
|
import org.springframework.web.portlet.ModelAndView; |
|
|
|
import org.springframework.web.portlet.ModelAndView; |
|
|
|
import org.springframework.web.portlet.bind.MissingPortletRequestParameterException; |
|
|
|
|
|
|
|
import org.springframework.web.portlet.bind.annotation.ActionMapping; |
|
|
|
import org.springframework.web.portlet.bind.annotation.ActionMapping; |
|
|
|
import org.springframework.web.portlet.bind.annotation.EventMapping; |
|
|
|
import org.springframework.web.portlet.bind.annotation.EventMapping; |
|
|
|
import org.springframework.web.portlet.bind.annotation.RenderMapping; |
|
|
|
import org.springframework.web.portlet.bind.annotation.RenderMapping; |
|
|
|
@ -519,6 +518,17 @@ public class Portlet20AnnotationControllerTests { |
|
|
|
portlet.render(request, response); |
|
|
|
portlet.render(request, response); |
|
|
|
assertEquals("myLargeView-value2", response.getContentAsString()); |
|
|
|
assertEquals("myLargeView-value2", response.getContentAsString()); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
actionRequest = new MockActionRequest("error"); |
|
|
|
|
|
|
|
actionResponse = new MockActionResponse(); |
|
|
|
|
|
|
|
portlet.processAction(actionRequest, actionResponse); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
request = new MockRenderRequest(PortletMode.VIEW, WindowState.MAXIMIZED); |
|
|
|
|
|
|
|
request.setParameters(actionResponse.getRenderParameterMap()); |
|
|
|
|
|
|
|
request.setSession(actionRequest.getPortletSession()); |
|
|
|
|
|
|
|
response = new MockRenderResponse(); |
|
|
|
|
|
|
|
portlet.render(request, response); |
|
|
|
|
|
|
|
assertEquals("XXX", response.getContentAsString()); |
|
|
|
|
|
|
|
|
|
|
|
MockEventRequest eventRequest = new MockEventRequest(new MockEvent("event1")); |
|
|
|
MockEventRequest eventRequest = new MockEventRequest(new MockEvent("event1")); |
|
|
|
MockEventResponse eventResponse = new MockEventResponse(); |
|
|
|
MockEventResponse eventResponse = new MockEventResponse(); |
|
|
|
portlet.processEvent(eventRequest, eventResponse); |
|
|
|
portlet.processEvent(eventRequest, eventResponse); |
|
|
|
@ -1029,6 +1039,11 @@ public class Portlet20AnnotationControllerTests { |
|
|
|
response.setRenderParameter("test", "value2"); |
|
|
|
response.setRenderParameter("test", "value2"); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@ActionMapping("error") |
|
|
|
|
|
|
|
public void myError(StateAwareResponse response) { |
|
|
|
|
|
|
|
throw new IllegalStateException("XXX"); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
@EventMapping("event1") |
|
|
|
@EventMapping("event1") |
|
|
|
public void myHandle(EventResponse response) throws IOException { |
|
|
|
public void myHandle(EventResponse response) throws IOException { |
|
|
|
response.setRenderParameter("test", "value3"); |
|
|
|
response.setRenderParameter("test", "value3"); |
|
|
|
@ -1049,6 +1064,11 @@ public class Portlet20AnnotationControllerTests { |
|
|
|
writer.write("myView"); |
|
|
|
writer.write("myView"); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@ExceptionHandler |
|
|
|
|
|
|
|
public void handleException(Exception ex, Writer writer) throws IOException { |
|
|
|
|
|
|
|
writer.write(ex.getMessage()); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
@ResourceMapping("resource1") |
|
|
|
@ResourceMapping("resource1") |
|
|
|
public void myResource(Writer writer) throws IOException { |
|
|
|
public void myResource(Writer writer) throws IOException { |
|
|
|
writer.write("myResource"); |
|
|
|
writer.write("myResource"); |
|
|
|
|