当前位置: 首页>>代码示例>>Java>>正文


Java Status.setRedirect方法代码示例

本文整理汇总了Java中org.springframework.extensions.webscripts.Status.setRedirect方法的典型用法代码示例。如果您正苦于以下问题:Java Status.setRedirect方法的具体用法?Java Status.setRedirect怎么用?Java Status.setRedirect使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在org.springframework.extensions.webscripts.Status的用法示例。


在下文中一共展示了Status.setRedirect方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: executeImpl

import org.springframework.extensions.webscripts.Status; //导入方法依赖的package包/类
protected Map<String, Object> executeImpl(WebScriptRequest req, Status status)
{
    // extract username and password
    String username = req.getParameter("u");
    if (username == null || username.length() == 0)
    {
        throw new WebScriptException(HttpServletResponse.SC_BAD_REQUEST, "Username not specified");
    }
    String password = req.getParameter("pw");
    if (password == null)
    {
        throw new WebScriptException(HttpServletResponse.SC_BAD_REQUEST, "Password not specified");
    }

    try
    {
        return login(username, password);
    }
    catch(WebScriptException e)
    {
        status.setCode(e.getStatus());
        status.setMessage(e.getMessage());
        status.setRedirect(true);
        return null;
    }
}
 
开发者ID:Alfresco,项目名称:alfresco-remote-api,代码行数:27,代码来源:Login.java

示例2: buildModel

import org.springframework.extensions.webscripts.Status; //导入方法依赖的package包/类
@Override
protected Map<String, Object> buildModel(ReplicationModelBuilder modelBuilder, 
                                         WebScriptRequest req, Status status, Cache cache)
{
    // Which definition did they ask for?
    String replicationDefinitionName = 
       req.getServiceMatch().getTemplateVars().get("replication_definition_name");
    ReplicationDefinition replicationDefinition =
       replicationService.loadReplicationDefinition(replicationDefinitionName);
   
    // Does it exist?
    if(replicationDefinition == null) {
       throw new WebScriptException(
             Status.STATUS_NOT_FOUND, 
             "No Replication Definition found with that name"
       );
    }
    
    // Delete it
    replicationService.deleteReplicationDefinition(replicationDefinition);
    
    // Report that we have deleted it
    status.setCode(Status.STATUS_NO_CONTENT);
    status.setMessage("Replication Definition deleted");
    status.setRedirect(true);
    return null;
}
 
开发者ID:Alfresco,项目名称:alfresco-remote-api,代码行数:28,代码来源:ReplicationDefinitionDelete.java

示例3: executeImpl

import org.springframework.extensions.webscripts.Status; //导入方法依赖的package包/类
@Override
protected Map<String, Object> executeImpl(WebScriptRequest req, Status status)
{
    // retrieve ticket from request and current ticket
    String ticket = req.getExtensionPath();
    if (ticket == null || ticket.length() == 0)
    {
        throw new WebScriptException(HttpServletResponse.SC_BAD_REQUEST, "Ticket not specified");
    }
    
    // construct model for ticket
    Map<String, Object> model = new HashMap<String, Object>(1, 1.0f);
    model.put("ticket",  ticket);
    
    try
    {
        String ticketUser = ticketComponent.validateTicket(ticket);

        // do not go any further if tickets are different
        if (!AuthenticationUtil.getFullyAuthenticatedUser().equals(ticketUser))
        {
            status.setCode(HttpServletResponse.SC_NOT_FOUND);
            status.setMessage("Ticket not found");
        }
        else
        {
            // delete the ticket
            authenticationService.invalidateTicket(ticket);
            status.setMessage("Deleted Ticket " + ticket);
        }
    }
    catch(AuthenticationException e)
    {
        status.setCode(HttpServletResponse.SC_NOT_FOUND);
        status.setMessage("Ticket not found");
    }

    status.setRedirect(true);
    return model;
}
 
开发者ID:Alfresco,项目名称:alfresco-remote-api,代码行数:41,代码来源:LoginTicketDelete.java

示例4: executeImpl

import org.springframework.extensions.webscripts.Status; //导入方法依赖的package包/类
@Override
protected Map<String, Object> executeImpl(WebScriptRequest req, Status status)
{
    // retrieve ticket from request and current ticket
    String ticket = req.getExtensionPath();
    if (ticket == null || ticket.length() == 0)
    {
        throw new WebScriptException(HttpServletResponse.SC_BAD_REQUEST, "Ticket not specified");
    }
    
    // construct model for ticket
    Map<String, Object> model = new HashMap<String, Object>(1, 1.0f);
    model.put("ticket",  ticket);
    
    try
    {
        String ticketUser = ticketComponent.validateTicket(ticket);
        
        String currentUser = AuthenticationUtil.getFullyAuthenticatedUser();

        // do not go any further if tickets are different 
        // or the user is not fully authenticated
        if (currentUser == null || !currentUser.equals(ticketUser))
        {
            status.setRedirect(true);
            status.setCode(HttpServletResponse.SC_NOT_FOUND);
            status.setMessage("Ticket not found");
        }
    }
    catch (AuthenticationException e)
    {
        status.setRedirect(true);
        status.setCode(HttpServletResponse.SC_NOT_FOUND);
        status.setMessage("Ticket not found");
    }
    
    return model;
}
 
开发者ID:Alfresco,项目名称:alfresco-remote-api,代码行数:39,代码来源:LoginTicket.java

示例5: buildModel

import org.springframework.extensions.webscripts.Status; //导入方法依赖的package包/类
@Override
protected Map<String, Object> buildModel(
      RunningActionModelBuilder modelBuilder, WebScriptRequest req,
      Status status, Cache cache) {
   // Which action did they ask for?
   String actionTrackingId = 
      req.getServiceMatch().getTemplateVars().get("action_tracking_id");

   // Check it exists
   ExecutionSummary action = 
      getSummaryFromKey(actionTrackingId);
   if(action == null) {
      throw new WebScriptException(
            Status.STATUS_NOT_FOUND, 
            "No Running Action found with that tracking id"
      );
   }
   
   ExecutionDetails details =
      actionTrackingService.getExecutionDetails(action);
   if(details == null) {
      throw new WebScriptException(
            Status.STATUS_NOT_FOUND, 
            "No Running Action found with that tracking id"
      );
   }
   
   // Request the cancel
   actionTrackingService.requestActionCancellation(action);
   
   // Report it as having been cancelled
   status.setCode(Status.STATUS_NO_CONTENT);
   status.setMessage("Action cancellation requested");
   status.setRedirect(true);
   return null;
}
 
开发者ID:Alfresco,项目名称:alfresco-remote-api,代码行数:37,代码来源:RunningActionDelete.java


注:本文中的org.springframework.extensions.webscripts.Status.setRedirect方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。