use of org.springframework.web.servlet.view.RedirectView in project spring-security-oauth by spring-projects.
the class AuthorizationEndpointTests method testAuthorizationCodeWithQueryParams.
@Test
public void testAuthorizationCodeWithQueryParams() throws Exception {
endpoint.setAuthorizationCodeServices(new StubAuthorizationCodeServices());
model.put("authorizationRequest", getAuthorizationRequest("foo", "http://anywhere.com?foo=bar", null, null, Collections.singleton("code")));
View result = endpoint.approveOrDeny(Collections.singletonMap(OAuth2Utils.USER_OAUTH_APPROVAL, "true"), model, sessionStatus, principal);
assertEquals("http://anywhere.com?foo=bar&code=thecode", ((RedirectView) result).getUrl());
}
use of org.springframework.web.servlet.view.RedirectView in project opennms by OpenNMS.
the class AlarmDetailController method removeJournalMemo.
public ModelAndView removeJournalMemo(HttpServletRequest httpServletRequest, HttpServletResponse httpServletResponse) throws Exception {
int alarmId;
String alarmIdString = "";
// Try to parse alarm ID from string to integer
try {
alarmIdString = httpServletRequest.getParameter("alarmId");
alarmId = Integer.parseInt(alarmIdString);
m_webAlarmRepository.removeReductionKeyMemo(alarmId);
return new ModelAndView(new RedirectView("detail.htm", true), "id", alarmId);
} catch (NumberFormatException e) {
logger.error("Could not parse alarm ID '{}' to integer.", httpServletRequest.getParameter("alarmId"));
throw new ServletException("Could not parse alarm ID " + httpServletRequest.getParameter("alarmId") + " to integer.");
}
}
use of org.springframework.web.servlet.view.RedirectView in project opennms by OpenNMS.
the class AlarmDetailController method saveJournalMemo.
public ModelAndView saveJournalMemo(HttpServletRequest httpServletRequest, HttpServletResponse httpServletResponse) throws Exception {
int alarmId;
String alarmIdString = "";
// Try to parse alarm ID from string to integer
try {
alarmIdString = httpServletRequest.getParameter("alarmId");
alarmId = Integer.parseInt(alarmIdString);
String journalMemoBody = httpServletRequest.getParameter("journalMemoBody");
m_webAlarmRepository.updateReductionKeyMemo(alarmId, journalMemoBody, httpServletRequest.getRemoteUser());
return new ModelAndView(new RedirectView("detail.htm", true), "id", alarmId);
} catch (NumberFormatException e) {
logger.error("Could not parse alarm ID '{}' to integer.", httpServletRequest.getParameter("alarmId"));
throw new ServletException("Could not parse alarm ID " + httpServletRequest.getParameter("alarmId") + " to integer.");
}
}
use of org.springframework.web.servlet.view.RedirectView in project opennms by OpenNMS.
the class EventController method getRedirectView.
private ModelAndView getRedirectView(HttpServletRequest request) {
String redirectParms = request.getParameter("redirectParms");
String redirect = request.getParameter("redirect");
String viewName;
if (redirect != null) {
viewName = redirect;
} else {
viewName = (redirectParms == null || "".equals(redirectParms) || "null".equals(redirectParms) ? "/event/list" : "/event/list" + "?" + redirectParms);
}
RedirectView redirectView = new RedirectView(viewName);
return new ModelAndView(redirectView);
}
use of org.springframework.web.servlet.view.RedirectView in project libresonic by Libresonic.
the class SetMusicFileInfoController method handleRequestInternal.
@RequestMapping(method = RequestMethod.GET)
protected ModelAndView handleRequestInternal(HttpServletRequest request) throws Exception {
int id = ServletRequestUtils.getRequiredIntParameter(request, "id");
String action = request.getParameter("action");
MediaFile mediaFile = mediaFileService.getMediaFile(id);
if ("comment".equals(action)) {
mediaFile.setComment(StringUtil.toHtml(request.getParameter("comment")));
mediaFileService.updateMediaFile(mediaFile);
}
String url = "main.view?id=" + id;
return new ModelAndView(new RedirectView(url));
}
Aggregations