Start line:  
End line:  

Snippet Preview

Snippet HTML Code

Stack Overflow Questions
  /*
   * #%L
   * *********************************************************************************************************************
   *
   * NorthernWind - lightweight CMS
   * http://northernwind.tidalwave.it - hg clone https://bitbucket.org/tidalwave/northernwind-src
   * %%
   * Copyright (C) 2011 - 2014 Tidalwave s.a.s. (http://tidalwave.it)
   * %%
  * *********************************************************************************************************************
  *
  * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with
  * the License. You may obtain a copy of the License at
  *
  *     http://www.apache.org/licenses/LICENSE-2.0
  *
  * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on
  * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.  See the License for the
  * specific language governing permissions and limitations under the License.
  *
  * *********************************************************************************************************************
  *
  * $Id: DefaultSiteViewController.java,v f214f4c8488f 2014/01/03 18:03:50 fabrizio $
  *
  * *********************************************************************************************************************
  * #L%
  */
 package it.tidalwave.northernwind.frontend.ui.spi;
 
 import  javax.annotation.Nonnull;
 import java.util.List;
 import  it.tidalwave.util.NotFoundException;
 import static it.tidalwave.northernwind.core.model.RequestProcessor.Status.*;

The default implementation of SiteViewController.

Author(s):
Fabrizio Giudici
Version:
$Id: DefaultSiteViewController.java,v f214f4c8488f 2014/01/03 18:03:50 fabrizio $ /
 
 @Scope(value = "session") @Slf4j
 public class DefaultSiteViewController implements SiteViewController
   {
     @Inject @Nonnull
 
     @Inject @Nonnull
 
     @Inject @Nonnull
     private RequestHolder requestHolder;
 
     @Inject @Nonnull
     private ResponseHolder<?> responseHolder;

    
/
 
     @Override @Nonnull @SuppressWarnings("unchecked")
     public <ResponseType> ResponseType processRequest (final @Nonnull Request request)
       {
         try
           {
             log.info("processRequest({})"request);
             resetRequestResettables();
             .set(request);
 
             for (final RequestProcessor requestProcessor : )
               {
                 log.debug(">>>> trying {} ..."requestProcessor);
 
                 if (requestProcessor.process(request) == )
                   {
                     break;
                   }
               }
 
             return (ResponseType).get();
           }
         catch (NotFoundException e)
           {
            log.warn("processing: {} - {}"requeste.toString());
            return (ResponseType).response().forException(e).build();
          }
        catch (IOException e)
          {
            log.warn("processing: " + requeste);
            return (ResponseType).response().forException(e).build();
          }
        catch (HttpStatusException e)
          {
            if (e.getHttpStatus() != 302) //
              {
                log.warn("processing: " + requeste);
              }
            return (ResponseType).response().forException(e).build();
          }
        finally
          {
            resetRequestResettables();
          }
      }

    
Resets all Resettables. /
    private void resetRequestResettables()
      {
        for (final RequestResettable requestResettable : )
          {
            log.debug(">>>> resetting {} ..."requestResettable);
            requestResettable.requestReset();
          }
      }

    
Logs the RequestProcessors. /
    /* package */ void initialize()
      {
        Collections.sort(new AnnotationAwareOrderComparator());
        log.info(">>>> requestProcessors:");
        for (final RequestProcessor requestProcessor : )
          {
            log.info(">>>>>>>> {}"requestProcessor);
          }
      }
  }
New to GrepCode? Check out our FAQ X