Package com.azaptree.services.command.http

Examples of com.azaptree.services.command.http.WebRequestCommand


  }

  private void generateCommandXSD(final String target, final HttpServletResponse response) throws IOException {
    final CommandKey commandKey = targetUriCommandKeyMap.get(toCommandUriTarget(target));
    final CommandCatalog catalog = commandService.getCommandCatalog(commandKey.getCatalogName());
    @SuppressWarnings("rawtypes")
    final WebRequestCommand command = (WebRequestCommand) catalog.getCommand(commandKey.getCommandName());
    if (!command.hasXmlSchema()) {
      response.setStatus(HttpStatus.NO_CONTENT_204);
      return;
    }
    response.setStatus(HttpStatus.OK_200);
    response.setContentType("application/xml");
    response.setCharacterEncoding("UTF-8");
    command.generateSchema(response.getOutputStream());
  }
View Full Code Here


  @SuppressWarnings("rawtypes")
  @Override
  protected void process(final String target, final Request baseRequest, final HttpServletRequest request, final HttpServletResponse response) {
    final CommandKey commandKey = targetUriCommandKeyMap.get(target);
    final WebRequestCommand command = (WebRequestCommand) commandService.getCommand(commandKey);
    final WebCommandContext<?, ?> commandContext;
    try {
      commandContext = createWebCommandContext(command, baseRequest, request, response);
    } catch (JAXBException | IOException e) {
      log.error(String.format("%s : Failed to unmarshal request message", target), e);
      handleUnmarshallingRequestMessageError(baseRequest, response, e);
      return;
    }

    try {
      command.execute(commandContext);
    } catch (final Exception e) {
      log.error(String.format("%s : Failed to execute command : %s", target, commandKey), e);
      handleCommandExecutionError(baseRequest, response, e);
    }
  }
View Full Code Here

TOP

Related Classes of com.azaptree.services.command.http.WebRequestCommand

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.