Ignore:
Timestamp:
08/18/11 12:39:22 (13 years ago)
Author:
vmipsl
Message:

[Visualization] interface quite finish

File:
1 edited

Legend:

Unmodified
Added
Removed
  • ether_megapoli/trunk/common/implementation/com/ether/WebHelper.java

    r89 r130  
    44import java.io.PrintWriter; 
    55import java.security.InvalidParameterException; 
     6import java.util.Locale; 
     7import java.util.ResourceBundle; 
    68 
    79import javax.servlet.ServletOutputStream; 
     
    1416import org.jetbrains.annotations.Nullable; 
    1517 
    16 import com.ether.WebException.WebCode; 
     18import com.ether.EtherException.EtherCode; 
    1719 
    1820public final class WebHelper 
     
    2325 
    2426    @NotNull 
    25     public static String getRequestParameter(@NotNull final HttpServletRequest httpServletRequest, @Nullable final String parameterName, @Nullable final String defaultParameterValue, final boolean canBeNull ) 
    26         throws InvalidParameterException 
     27    public static String getRequestParameter( @NotNull final HttpServletRequest httpServletRequest, @Nullable final String parameterName, @Nullable final String defaultParameterValue, final boolean canBeNull ) 
     28            throws InvalidParameterException 
    2729    { 
    28         String parameterValue; 
    29         if(null == parameterName) 
    30                 parameterValue = defaultParameterValue; 
    31          
     30        String parameterValue; 
     31        if( null == parameterName ) 
     32            parameterValue = defaultParameterValue; 
     33 
    3234        parameterValue = httpServletRequest.getParameter( parameterName ); 
    3335 
     
    5456    } 
    5557 
    56     public static void displayAjaxError(@NotNull final HttpServletResponse response, @Nullable final String methodName)  
    57         throws WebException 
    58     {            
    59         try { 
    60                 response.setStatus(HttpServletResponse.SC_NOT_IMPLEMENTED); 
    61                 response.setCharacterEncoding(UTF8Charset.getEncoding()); 
    62                 response.setContentType("text/plain;charset="+ UTF8Charset.getEncoding()); 
    63                 final ServletOutputStream outputStream = response.getOutputStream(); 
    64                 outputStream.print("error.method_not_implemented : " + methodName+ " is not implemented."); 
    65                 outputStream.flush(); 
    66                 outputStream.close(); 
    67         } catch (IOException e) { 
    68                 throw new WebException(WebCode.IO_EXCEPTION_ERROR_TO_GET_OUTPUTSTREAM, e); 
    69         } 
     58    public static void displayAjaxError( @NotNull final HttpServletResponse response, @Nullable final String methodName ) 
     59            throws EtherException 
     60    { 
     61        try 
     62        { 
     63            response.setStatus( HttpServletResponse.SC_NOT_IMPLEMENTED ); 
     64            response.setCharacterEncoding( UTF8Charset.getEncoding() ); 
     65            response.setContentType( "text/plain;charset=" + UTF8Charset.getEncoding() ); 
     66            final ServletOutputStream outputStream = response.getOutputStream(); 
     67            outputStream.print( "error.method_not_implemented : " + methodName + " is not implemented." ); 
     68            outputStream.flush(); 
     69            outputStream.close(); 
     70        } 
     71        catch( IOException e ) 
     72        { 
     73            throw new EtherException( EtherCode.IO_EXCEPTION_ERROR_TO_GET_OUTPUTSTREAM, e ); 
     74        } 
     75    } 
     76 
     77    @NotNull 
     78    public static ResourceBundle getBundle( @Nullable final Locale locale ) 
     79    { 
     80        if( null != locale ) 
     81            return ResourceBundle.getBundle( "ApplicationResources", locale ); 
     82        else 
     83            return ResourceBundle.getBundle( "ApplicationResources" ); 
    7084    } 
    7185 
    7286    private static final Log LOGGER = LogFactory.getLog( WebHelper.class ); 
    73      
     87 
    7488    private static final String CONTENT_TYPE_TEXT_JSON = "text/javascript;charset=" + UTF8Charset.getEncoding(); 
    75     private static final char JSON_TAG_BEGIN = ' ' ;  // '('; 
     89    private static final char JSON_TAG_BEGIN = ' ';  // '('; 
    7690    private static final char JSON_TAG_END = ' ';     // ')'; 
    7791} 
Note: See TracChangeset for help on using the changeset viewer.