Si può eseguire il seguente comando sql
xp_readerrorlog 0, 1, N'Server in ascolto sulla porta'','any', NULL, NULL, N'asc'
xp_readerrorlog 0, 1, N'Server in ascolto sulla porta'','any', NULL, NULL, N'asc'
public static Comment addComment(HSSFCell cell,String testo){
Drawing drawing = cell.getSheet().createDrawingPatriarch();
CreationHelper factory = cell.getSheet().getWorkbook().getCreationHelper();
ClientAnchor anchor = factory.createClientAnchor();
anchor.setCol1(cell.getColumnIndex());
anchor.setCol2(cell.getColumnIndex() + 3);
anchor.setRow1(cell.getRowIndex());
anchor.setRow2(cell.getRowIndex() + 2);
Comment comment = drawing.createCellComment(anchor);
RichTextString str = factory.createRichTextString(testo);
comment.setString(str);
return comment;
}
SELECT a.row_num, b.col_num, SUM(a.value*b.value) from a,b
on a.col_num=b.row_num group by a.row_num,b.col_num;
public void copia(String in,String out) throws Exception{
BufferedWriter bw=new BufferedWriter(new FileWriter(in));
BufferedReader br = new BufferedReader(new FileReader(out));
String line;
while ((line = br.readLine()) != null) {
bw.write(line);
bw.newLine();
}
br.close();
bw.flush();
bw.close();
}
<login-config>
<auth-method>BASIC</auth-method>
<realm-name>Richiesta autenticazione per gestione utenze</realm-name>
</login-config>
<security-constraint>
<web-resource-collection>
<web-resource-name>restricted methods</web-resource-name>
<url-pattern>/index.jsf</url-pattern>
<http-method>GET</http-method>
<http-method>POST</http-method>
</web-resource-collection>
<auth-constraint>
<role-name>APP_ADMIN</role-name>
</auth-constraint>
</security-constraint>
<security-role>
<role-name>APP_ADMIN</role-name>
</security-role>
<role rolename="LEASING_ADMIN"/>
<user password="qawsedrf" roles="APP_ADMIN" username="master"/>
<Realm className="org.apache.catalina.realm.LockOutRealm">
<!-- This Realm uses the UserDatabase configured in the global JNDI
resources under the key "UserDatabase". Any edits
that are performed against this UserDatabase are immediately
available for use by the Realm. -->
<Realm className="org.apache.catalina.realm.UserDatabaseRealm" resourceName="UserDatabase" digest="md5"/>
</Realm>
<error-page>
<exception-type>javax.faces.application.ViewExpiredException</exception-type>
<location>/viewExpired.xhtml</location>
</error-page>
package it.exceptionHandler;
import it.util.Costanti;
import it.util.Utility;
import java.io.IOException;
import java.util.Iterator;
import javax.faces.FacesException;
import javax.faces.application.ViewExpiredException;
import javax.faces.context.ExceptionHandler;
import javax.faces.context.ExceptionHandlerWrapper;
import javax.faces.context.ExternalContext;
import javax.faces.context.FacesContext;
import javax.faces.event.ExceptionQueuedEvent;
import org.apache.log4j.Logger;
public class ViexExpiredExceptionHandler extends ExceptionHandlerWrapper {
private static final Logger log=Logger.getLogger(Costanti.LOGGER);
private ExceptionHandler parent;
public ViexExpiredExceptionHandler(ExceptionHandler parent){
this.parent=parent;
}
@Override
public ExceptionHandler getWrapped() {
return this.parent;
}
@Override
public void handle() throws FacesException{
FacesContext facesContext = FacesContext.getCurrentInstance();
for (Iterator<ExceptionQueuedEvent> iter = getUnhandledExceptionQueuedEvents().iterator(); iter.hasNext();) {
Throwable exception = iter.next().getContext().getException();
if (exception instanceof ViewExpiredException) {
final ExternalContext externalContext = facesContext
.getExternalContext();
try {
facesContext.setViewRoot(facesContext.getApplication()
.getViewHandler()
.createView(facesContext, "/viewExpired.jsf"));
externalContext.redirect("viewExpired.jsf");
facesContext.getPartialViewContext().setRenderAll(true);
facesContext.renderResponse();
}
catch(IOException ioex){
log.error(Utility.stackToString(ioex));
}
finally {
iter.remove();
}
}
}
getWrapped().handle();
}
}
Quindi occorre creare una classe che estenda
package it.exceptionHandler;
import javax.faces.context.ExceptionHandler;
import javax.faces.context.ExceptionHandlerFactory;
public class MyExceptionHandlerFactory extends ExceptionHandlerFactory {
private ExceptionHandlerFactory parent;
public MyExceptionHandlerFactory(ExceptionHandlerFactory parent){
this.parent=parent;
}
@Override
public ExceptionHandler getExceptionHandler() {
ExceptionHandler result=parent.getExceptionHandler();
result=new ViexExpiredExceptionHandler(result);
return result;
}
}
<factory>
<exception-handler-factory>it.exceptionHandler.MyExceptionHandlerFactory</exception-handler-factory>
</factory>