Package juzu

Examples of juzu.Response$Redirect


    this.rememberMeSupported = rememberMeSupported;
  }

  public Response doLogout(Stage.Handler request) {
    SecurityUtils.getSubject().logout();
    Response resp = request.invoke();
    if (rememberMeSupported) {
      RememberMeUtil.forgetIdentity();
    }
    return resp;
  }
View Full Code Here


    try {
      subject.login(new UsernamePasswordToken(username, password.toCharArray(), remember));

      //
      Response resp = stage.invoke();
      if (remember && rememberMeSupported) {
        RememberMeUtil.forgetIdentity();
        RememberMeUtil.rememberSerialized();
      }
      return resp;
    } catch (AuthenticationException e) {
      List<ControlParameter> parameters = request.getHandler().getParameters();
      for (ControlParameter parameter : parameters) {
        if (parameter instanceof ContextualParameter) {
          if (AuthenticationException.class.isAssignableFrom(parameter.getType())) {
            request.getContextualArguments().put((ContextualParameter)parameter, e);
            Response resp = stage.invoke();
            if (remember) {
              RememberMeUtil.forgetIdentity();
            }
            return resp;
          }
View Full Code Here

    //
    JSON methodsJSON = controllerJSON.getJSON("methods");
    JSON methodJSON;

    if (controllerJSON.get("require") != null) {
      Response resp = authorizer.isAuthorized(stage, controllerJSON);
      if (resp != null) {
        return resp;
      } else {
        if (methodsJSON == null) {
          return stage.invoke();
View Full Code Here

    return doInvoke(stage, methodJSON);
  }

  private Response doInvoke(Stage.Handler request, JSON json) {
    Response resp = authorizer.isAuthorized(request, json);
    if (resp != null) {
      return resp;
    } else {
      if ("login".equals(json.get("operator"))) {
        return authenticater.doLogin(request);
View Full Code Here

  public void beginRequest(RequestContext context) {
  }

  @Override
  public void endRequest(RequestContext context) {
      Response response = context.getResponse();
      if (response instanceof ValidationError) {
        ValidationError error = (ValidationError)response;
        String id = context.getParameters().get("id").getValue();
       
        Iterator<ConstraintViolation<Object>> v = error.getViolations().iterator();
View Full Code Here

  public void beginRequest(RequestContext context) {   
  }

  @Override
  public void endRequest(RequestContext context) {
      Response response = context.getResponse();
      if (response instanceof ValidationError) {
        ValidationError error = (ValidationError)response;       
        violation.add(Violation.REGISTER, error.getHtmlMessage());
       
        context.setResponse(Application_.register());
View Full Code Here

  }

  @Override
  public Response handle(Stage.Unmarshalling argument) {
    final Request request = argument.getRequest();
    Response result = argument.invoke();

    //
    if (request.getPhase() == Phase.VIEW) {
      if (result instanceof Response.Content) {
        Response.Status status = (Response.Status)result;
View Full Code Here

    return Stage.Unmarshalling.class;
  }

  @Override
  public Response handle(Stage.Unmarshalling argument) {
    Response result = argument.invoke();
    Request request = argument.getRequest();
    if (request.getPhase() == Phase.VIEW) {
      if (result instanceof Response.Content) {
        final Collection<Chunk.Property<String>> bar = foo(request.getHandler().getMethod(), Collections.<Chunk.Property<String>>emptyList());
        Response.Status status = (Response.Status)result;
View Full Code Here

          return new Response.Error(e);
        }
      }

      //
      Response response = context.getResponse();
      if (response == null) {
        Stage.Invoke invokeStage = new Invoke(request, context, controller, args);
        response = invokeStage.invoke();
        context.setResponse(response);
View Full Code Here

          // We should check that it matches....
          // btw we should try to enforce matching during compilation phase
          // @Action -> Response.Action
          // @View -> Response.Mime
          // as we can do it
          Response resp = (Response)ret;
          if (mimeType != null) {
            resp = resp.with(PropertyType.MIME_TYPE, mimeType.value()[0]);
          }
          return resp;
        } else if (ret != null && mimeType != null) {
          for (EntityMarshaller writer : Tools.loadService(EntityMarshaller.class, request.controllerPlugin.getApplication().getClassLoader())) {
            for (String s : mimeType.value()) {
View Full Code Here

TOP

Related Classes of juzu.Response$Redirect

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.